RTI Connext Micro  Version 2.4.1.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
dds_c_sequence.h
Go to the documentation of this file.
1 /*
2  * FILE: dds_c_sequence.h - DDS sequence definitions
3  *
4  * (c) Copyright, Real-Time Innovations, 2012-2014.
5  *
6  * All rights reserved.
7  *
8  * No duplications, whole or partial, manual or electronic, may be made
9  * without express written permission. Any such copies, or
10  * revisions thereof, must display this notice unaltered.
11  * This code contains trade secrets of Real-Time Innovations, Inc.
12  *
13  * Modification History
14  * --------------------
15  * 08jun2012,tk Written
16  */
17 /*ce
18  * \file
19  * \brief DDS sequence definitions
20  */
21 /*e \dref_SequenceGroupDocs
22  */
23 #ifndef dds_c_sequence_h
24 #define dds_c_sequence_h
25 
26 #ifndef dds_c_dll_h
27 #include "dds_c/dds_c_dll.h"
28 #endif
29 #ifndef dds_c_common_h
30 #include "dds_c/dds_c_common.h"
31 #endif
32 #ifndef reda_sequence_h
33 #include "reda/reda_sequence.h"
34 #endif
35 
36 #ifdef __cplusplus
37 extern "C"
38 {
39 #endif
40 
41 /* Make sure that NDDSUSERDllExport expands to nothing by default */
42 #ifndef NDDSUSERDllExport
43 #define NDDSUSERDllExport
44 #endif
45 
46 /*ci @ingroup DDSSequenceModule
47  @brief Empty Sequence dll export variable
48 
49  Since for dds c sequence structure, there are no methods. Therefore, there is
50  no need to export anything.
51 */
52 #define DDS_SEQUENCE_DLL_EXPORT
53 
54 #define DDS_SEQUENCE_METHODS_IN_C REDA_DEFINE_SEQUENCE_IN_C
55 
56 
57 /*i @ingroup DDSSequenceModule
58 
59  @brief Declares an abstract \st_interface \p TSeq, for IDL \p
60  sequence\_T of type \p T.
61 
62  @uses T base type
63  @defines TSeq name of the sequence type to be defined
64 
65  Using this macro introduces a class declaration TSeq in the
66  enclosing name space.
67 
68  <STRONG>Incarnation:</STRONG>
69 
70  \em Incarnation is the process of realizing a concrete type
71  from the \em generic skeleton defined by TSeq. Given a user type
72  \p Foo, a type \p FooSeq representing the IDL type \p
73  sequence\_Foo is incarnated as follows.
74 
75  <EM>\em Value-type sequences</EM>
76 
77  When the base type \p T is a value-type, \p sequence\_T is declared
78  follows.
79  \code
80  DDS_SEQUENCE(FooSeq, Foo);
81  \endcode
82 
83  <EM>\em Reference-type sequences</EM>
84 
85  When the base type \p Foo is a reference-type, \p sequence\_Foo is
86  declared as follows.
87 
88  \code
89  typedef Foo* Foo_ptr;
90 
91  DDS_SEQUENCE(FooSeq, Foo_ptr);
92 
93  \endcode
94 
95  We use a two step process, because in C++
96  \code
97  const Foo_ptr = Foo *const
98  != const Foo*
99  \endcode
100  and we want the \p Foo_ptr semantics for the method:
101  \code
102  const T& TSeq::operator[]() const
103  \endcode
104 
105  \hideinitializer
106 */
107 
108 #define DDS_SEQUENCE REDA_DEFINE_SEQUENCE
109 
110 /*ce \dref_FooSeq_SEQUENCE_INITIALIZER
111  */
112 #define DDS_SEQUENCE_INITIALIZER(_t) REDA_DEFINE_SEQUENCE_INITIALIZER(_t)
113 
114 /* ================================================================= */
115 #ifdef DOXYGEN_DOCUMENTATION_ONLY
116 
117 /*ce \dref_FooSeq
118  */
119 struct FooSeq
120 {
121  /*e @brief Pointer to array of contiguous or discontiguous data
122  *
123  */
125 
126 
127  /*e @brief Maximum size of the sequence
128  *
129  * The allocated length of this sequence. It applies to whichever of
130  * the above buffers is non-NULL, if any. If both a NULL, its value
131  * must be 0.
132  *
133  * If _maximum == 0, _owned == true.
134  */
136 
137  /*e @brief Actual length of the sequence that contains data
138  *
139  * The current logical length of this seqeunce, i.e. the number of valid
140  * elements it contains. It applies to whichever of the above
141  * buffers is non-null, if any. If both are NULL, its value must be 0.
142  */
144 
145  /*e @brief Size of data element in the sequence
146  *
147  * Each element in the sequence has this size.
148  */
150 
151  /*e @brief Size of data element in the sequence
152  *
153  * Each element in the sequence has this size.
154  */
156 
157  /*e @brief Internal-use flags
158  *
159  * Reserved for internal-use.
160  */
162 };
163 
164 /*ce \dref_FooSeq_initialize
165  */
166 DDS_Boolean FooSeq_initialize(struct FooSeq *self);
167 
168 /*ce \dref_FooSeq_finalize
169  */
170 DDS_Boolean FooSeq_finalize(struct FooSeq *self);
171 
172 /*ce \dref_FooSeq_get_maximum
173  */
174 DDS_Long FooSeq_get_maximum(const struct FooSeq *self);
175 
176 /*ce \dref_FooSeq_set_maximum
177  */
178 DDS_Boolean FooSeq_set_maximum(struct FooSeq *self, DDS_Long new_max);
179 
180 /*ce \dref_FooSeq_get_length
181  */
182 DDS_Long FooSeq_get_length(const struct FooSeq *self);
183 
184 /*ce \dref_FooSeq_set_length
185  */
186 DDS_Boolean FooSeq_set_length(struct FooSeq *self, DDS_Long new_length);
187 
188 /*ce \dref_FooSeq_get_reference
189  */
190 Foo *FooSeq_get_reference(const struct FooSeq *self, DDS_Long i);
191 
192 /*ce \dref_FooSeq_copy
193  */
194 struct FooSeq *FooSeq_copy(struct FooSeq *self, const struct FooSeq *src_seq);
195 
196 /*ce \dref_FooSeq_is_equal
197  */
198 DDS_Boolean FooSeq_is_equal(struct FooSeq* self, struct FooSeq* other);
199 
200 /*ce \dref_FooSeq_loan_contiguous
201  */
202 DDS_Boolean FooSeq_loan_contiguous(struct FooSeq *self, void *buffer,
203  DDS_Long new_length, DDS_Long new_max);
204 
205 /*ce \dref_FooSeq_loan_discontiguous
206  */
207 DDS_Boolean FooSeq_loan_discontiguous(struct FooSeq *self, void *buffer,
208  DDS_Long new_length, DDS_Long new_max);
209 
210 /*ce \dref_FooSeq_unloan
211  */
212 DDS_Boolean FooSeq_unloan(struct FooSeq *self);
213 
214 /*ce \dref_FooSeq_has_ownership
215  */
216 DDS_Boolean FooSeq_has_ownership(const struct FooSeq *self);
217 
218 /*ce \dref_FooSeq_get_buffer
219  */
220 Foo* FooSeq_get_buffer(struct FooSeq *self);
221 
222 /*ce \dref_FooSeq_set_buffer
223  */
224 DDS_Boolean FooSeq_set_buffer(struct FooSeq *self, Foo* buffer);
225 
226 /*ce \dref_FooSeq_has_discontiguous_buffer
227  */
229 
230 
231 #endif /* DOXYGEN_DOCUMENTATION_ONLY */
232 
233 #ifdef __cplusplus
234 } /* extern "C" */
235 #endif
236 
237 
238 #endif /* dds_c_sequence_h */

RTI Connext Micro Version 2.4.1.0 Copyright © Thu Nov 20 2014 Real-Time Innovations, Inc