RTI Connext Micro  Version 2.4.4.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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-2015.
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 /*i @ingroup DDSSequenceModule
55 
56  @brief Declares an abstract \st_interface \p TSeq, for IDL \p
57  sequence\_T of type \p T.
58 
59  @uses T base type
60  @defines TSeq name of the sequence type to be defined
61 
62  Using this macro introduces a class declaration TSeq in the
63  enclosing name space.
64 
65  <STRONG>Incarnation:</STRONG>
66 
67  \em Incarnation is the process of realizing a concrete type
68  from the \em generic skeleton defined by TSeq. Given a user type
69  \p Foo, a type \p FooSeq representing the IDL type \p
70  sequence\_Foo is incarnated as follows.
71 
72  <EM>\em Value-type sequences</EM>
73 
74  When the base type \p T is a value-type, \p sequence\_T is declared
75  follows.
76  \code
77  DDS_SEQUENCE(FooSeq, Foo);
78  \endcode
79 
80  <EM>\em Reference-type sequences</EM>
81 
82  When the base type \p Foo is a reference-type, \p sequence\_Foo is
83  declared as follows.
84 
85  \code
86  typedef Foo* Foo_ptr;
87 
88  DDS_SEQUENCE(FooSeq, Foo_ptr);
89 
90  \endcode
91 
92  We use a two step process, because in C++
93  \code
94  const Foo_ptr = Foo *const
95  != const Foo*
96  \endcode
97  and we want the \p Foo_ptr semantics for the method:
98  \code
99  const T& TSeq::operator[]() const
100  \endcode
101 
102  \hideinitializer
103 */
104 
105 #define DDS_SEQUENCE REDA_DEFINE_SEQUENCE
106 
107 /*ce \dref_FooSeq_SEQUENCE_INITIALIZER
108  */
109 #define DDS_SEQUENCE_INITIALIZER(_t) REDA_DEFINE_SEQUENCE_INITIALIZER(_t)
110 
111 /* ================================================================= */
112 #ifdef DOXYGEN_DOCUMENTATION_ONLY
113 
114 /*ce \dref_FooSeq
115  */
116 struct FooSeq
117 {
118  /*e @brief Pointer to array of contiguous or discontiguous data
119  *
120  */
122 
123 
124  /*e @brief Maximum size of the sequence
125  *
126  * The allocated length of this sequence. It applies to whichever of
127  * the above buffers is non-NULL, if any. If both a NULL, its value
128  * must be 0.
129  *
130  * If _maximum == 0, _owned == true.
131  */
133 
134  /*e @brief Actual length of the sequence that contains data
135  *
136  * The current logical length of this seqeunce, i.e. the number of valid
137  * elements it contains. It applies to whichever of the above
138  * buffers is non-null, if any. If both are NULL, its value must be 0.
139  */
141 
142  /*e @brief Size of data element in the sequence
143  *
144  * Each element in the sequence has this size.
145  */
147 
148  /*e @brief Size of data element in the sequence
149  *
150  * Each element in the sequence has this size.
151  */
153 
154  /*e @brief Internal-use flags
155  *
156  * Reserved for internal-use.
157  */
159 };
160 
161 /*ce \dref_FooSeq_initialize
162  */
163 DDS_Boolean FooSeq_initialize(struct FooSeq *self);
164 
165 /*ce \dref_FooSeq_finalize
166  */
167 DDS_Boolean FooSeq_finalize(struct FooSeq *self);
168 
169 /*ce \dref_FooSeq_get_maximum
170  */
171 DDS_Long FooSeq_get_maximum(const struct FooSeq *self);
172 
173 /*ce \dref_FooSeq_set_maximum
174  */
175 DDS_Boolean FooSeq_set_maximum(struct FooSeq *self, DDS_Long new_max);
176 
177 /*ce \dref_FooSeq_get_length
178  */
179 DDS_Long FooSeq_get_length(const struct FooSeq *self);
180 
181 /*ce \dref_FooSeq_set_length
182  */
183 DDS_Boolean FooSeq_set_length(struct FooSeq *self, DDS_Long new_length);
184 
185 /*ce \dref_FooSeq_get_reference
186  */
187 Foo *FooSeq_get_reference(const struct FooSeq *self, DDS_Long i);
188 
189 /*ce \dref_FooSeq_copy
190  */
191 struct FooSeq *FooSeq_copy(struct FooSeq *self, const struct FooSeq *src_seq);
192 
193 /*ce \dref_FooSeq_is_equal
194  */
195 DDS_Boolean FooSeq_is_equal(struct FooSeq* self, struct FooSeq* other);
196 
197 /*ce \dref_FooSeq_loan_contiguous
198  */
199 DDS_Boolean FooSeq_loan_contiguous(struct FooSeq *self, void *buffer,
200  DDS_Long new_length, DDS_Long new_max);
201 
202 /*ce \dref_FooSeq_loan_discontiguous
203  */
204 DDS_Boolean FooSeq_loan_discontiguous(struct FooSeq *self, void *buffer,
205  DDS_Long new_length, DDS_Long new_max);
206 
207 /*ce \dref_FooSeq_unloan
208  */
209 DDS_Boolean FooSeq_unloan(struct FooSeq *self);
210 
211 /*ce \dref_FooSeq_has_ownership
212  */
213 DDS_Boolean FooSeq_has_ownership(const struct FooSeq *self);
214 
215 /*ce \dref_FooSeq_get_buffer
216  */
217 Foo* FooSeq_get_buffer(struct FooSeq *self);
218 
219 /*ce \dref_FooSeq_set_buffer
220  */
221 DDS_Boolean FooSeq_set_buffer(struct FooSeq *self, Foo* buffer);
222 
223 /*ce \dref_FooSeq_has_discontiguous_buffer
224  */
226 
227 
228 #endif /* DOXYGEN_DOCUMENTATION_ONLY */
229 
230 #ifdef __cplusplus
231 } /* extern "C" */
232 #endif
233 
234 
235 #endif /* dds_c_sequence_h */

RTI Connext Micro Version 2.4.4.0 Copyright © Thu Apr 30 2015 Real-Time Innovations, Inc