RefleX
Build DDS Applications in Modern C++ without IDL
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Pages
sample.h
Go to the documentation of this file.
1 /*********************************************************************************************
2 (c) 2005-2014 Copyright, Real-Time Innovations, Inc. All rights reserved.
3 RTI grants Licensee a license to use, modify, compile, and create derivative works
4 of the Software. Licensee has the right to distribute object form only for use with RTI
5 products. The Software is provided "as is", with no warranty of any type, including
6 any warranty for fitness for any purpose. RTI is under no obligation to maintain or
7 support the Software. RTI shall not be liable for any incidental or consequential
8 damages arising out of the use or inability to use the software.
9 **********************************************************************************************/
10 
11 #ifndef RTIREFLEX_SAMPLE_H
12 #define RTIREFLEX_SAMPLE_H
13 
14 struct DDS_SampleInfo;
15 
16 namespace reflex {
17 
18  namespace sub {
19 
23  template <class T>
24  class Sample
25  {
26  T val;
27  DDS_SampleInfo val_info;
28 
29  public:
30 
32  { }
33 
34  Sample(T &t, DDS_SampleInfo &i)
35  : val(t),
36  val_info(i)
37  { }
38 
39  T & data()
40  {
41  return val;
42  }
43 
44  const T & data() const
45  {
46  return val;
47  }
48 
49  const DDS_SampleInfo & info() const
50  {
51  return val_info;
52  }
53 
54  DDS_SampleInfo & info()
55  {
56  return val_info;
57  }
58 
60  {
61  return &val;
62  }
63 
64  const T * operator -> () const
65  {
66  return &val;
67  }
68  };
69 
70  } // namespace sub
71 } // namespace reflex
72 
73 
74 #endif // RTIREFLEX_SAMPLE_H
T * operator->()
Definition: sample.h:59
Sample()
Definition: sample.h:31
DDS_SampleInfo & info()
Definition: sample.h:54
const DDS_SampleInfo & info() const
Definition: sample.h:49
const T & data() const
Definition: sample.h:44
T & data()
Definition: sample.h:39
Sample(T &t, DDS_SampleInfo &i)
Definition: sample.h:34
A valuetype that combines an instance of type T (data) and DDS_SampleInfo.
Definition: sample.h:24