41 #include "reda/reda_sequence.h"
43 #if defined(RTI_WIN32) || defined(RTI_WINCE30)
44 #ifdef RTI_EXPORT_REDA_SEQUENCE
48 #define REDADllExport __declspec( dllexport )
52 #define concatenate(A, B) A ## B
58 #ifdef REDA_SEQUENCE_USER_API
59 #ifndef REDA_SEQUENCE_API
60 #define REDA_SEQUENCE_API REDA_SEQUENCE_API_USER_DEFAULT
62 #if REDA_SEQUENCE_API < REDA_SEQUENCE_API_BASIC
63 #error "REDA_SEQUENCE_USER_API defined along with API level < REDA_SEQUENCE_API_BASIC"
68 #ifndef REDA_SEQUENCE_API
69 #define REDA_SEQUENCE_API REDA_SEQUENCE_API_DEFAULT
72 #if REDA_SEQUENCE_API < REDA_SEQUENCE_API_UNTYPED
73 #error "REDA_SEQUENCE_API_UNTYPED <= REDA_SEQUENCE_API <= REDA_SEQUENCE_API_FULL"
77 #if REDA_SEQUENCE_API > REDA_SEQUENCE_API_UNTYPED
78 #ifndef TSeq_initialize
79 #define TSeq_initialize
81 #ifndef TSeq_get_maximum
82 #define TSeq_get_maximum
84 #ifndef TSeq_set_maximum
85 #define TSeq_set_maximum
87 #ifndef TSeq_get_length
88 #define TSeq_get_length
90 #ifndef TSeq_set_length
91 #define TSeq_set_length
93 #ifndef TSeq_get_reference
94 #define TSeq_get_reference
101 #ifdef REDA_SEQUENCE_USER_API
109 #if REDA_SEQUENCE_API > REDA_SEQUENCE_API_BASIC
113 #ifndef TSeq_is_equal
114 #define TSeq_is_equal
116 #ifndef TSeq_loan_contiguous
117 #define TSeq_loan_contiguous
119 #ifndef TSeq_loan_discontiguous
120 #define TSeq_loan_discontiguous
122 #ifndef TSeq_has_ownership
123 #define TSeq_has_ownership
125 #ifndef TSeq_has_discontiguous_buffer
126 #define TSeq_has_discontiguous_buffer
128 #ifndef TSeq_get_contiguous_buffer
129 #define TSeq_get_contiguous_buffer
131 #ifndef TSeq_get_discontiguous_buffer
132 #define TSeq_get_discontiguous_buffer
134 #ifndef TSeq_set_contiguous_buffer
135 #define TSeq_set_contiguous_buffer
140 #ifndef TSeq_set_token
141 #define TSeq_set_token
143 #ifndef TSeq_get_token
144 #define TSeq_get_token
146 #ifndef TSeq_ensure_length
147 #define TSeq_ensure_length
149 #ifndef TSeq_from_array
150 #define TSeq_from_array
152 #ifndef TSeq_to_array
153 #define TSeq_to_array
157 #if REDA_SEQUENCE_API > REDA_SEQUENCE_API_FULL
158 #error "REDA_SEQUENCE_API_UNTYPED <= REDA_SEQUENCE_API <= REDA_SEQUENCE_API_FULL"
165 #ifndef REDA_SEQUENCE_EXCLUDE_STRUCT
167 struct REDADllExport TSeq
169 T* _contiguous_buffer;
172 RTI_INT32 _element_size;
178 #ifdef TSeq_get_maximum
179 RTI_INT32 maximum()
const;
181 #ifdef TSeq_set_maximum
182 bool maximum(RTI_INT32 new_max);
184 #ifdef TSeq_get_length
185 RTI_INT32 length()
const;
187 #ifdef TSeq_set_length
188 bool length(RTI_INT32 new_length);
190 #ifdef TSeq_get_reference
191 T* get_reference(RTI_INT32 i);
194 bool copy(
const TSeq& src_seq);
197 bool is_equal(
const TSeq& other);
199 #ifdef TSeq_loan_contiguous
200 bool loan_contiguous(
void* buffer, RTI_INT32 new_length, RTI_INT32 new_max);
202 #ifdef TSeq_loan_discontiguous
203 bool loan_discontiguous(
void* buffer, RTI_INT32 new_length, RTI_INT32 new_max);
208 #ifdef TSeq_has_ownership
209 bool has_ownership();
211 #ifdef TSeq_get_contiguous_buffer
212 T* get_contiguous_buffer()
const;
214 #ifdef TSeq_set_contiguous_buffer
215 bool set_contiguous_buffer(T* buffer);
217 #ifdef TSeq_has_discontiguous_buffer
218 bool has_discontiguous_buffer();
220 #ifdef TSeq_set_token
221 void set_token(
void *token1,
void *token2);
223 #ifdef TSeq_get_token
224 void get_token(
void **token1,
void **token2);
226 #ifdef TSeq_ensure_length
227 bool ensure_length(RTI_INT32 length, RTI_INT32 max);
229 #ifdef TSeq_from_array
230 bool from_array(
const T elv[], RTI_INT32 length);
233 bool to_array(T elv[], RTI_INT32 length);
243 TSeq(
const TSeq& seq);
245 TSeq& operator=(
const TSeq& src_seq);
247 #ifdef TSeq_get_reference
248 T& operator[] (RTI_INT32 index);
251 bool operator==(
const TSeq& other);\
252 bool operator!=(
const TSeq& other);
260 #if REDA_SEQUENCE_API > REDA_SEQUENCE_API_FULL
261 #error "REDA_SEQUENCE_API_UNTYPED <= REDA_SEQUENCE_API <= REDA_SEQUENCE_API_FULL"
265 #ifndef REDA_SEQUENCE_EXCLUDE_C_METHODS
271 #ifdef TSeq_initialize
272 #undef TSeq_initialize
273 #define _initialize(TSeq) concatenate(TSeq, _initialize)
274 #define TSeq_initialize _initialize(TSeq)
291 TSeq_initialize(
struct TSeq*
self);
293 #undef TSeq_initialize
298 #define _finalize(TSeq) concatenate(TSeq, _finalize)
299 #define TSeq_finalize _finalize(TSeq)
316 TSeq_finalize(
struct TSeq *
self);
321 #ifdef TSeq_get_maximum
322 #undef TSeq_get_maximum
323 #define _get_maximum(TSeq) concatenate(TSeq, _get_maximum)
324 #define TSeq_get_maximum _get_maximum(TSeq)
325 REDADllExport RTI_INT32
326 TSeq_get_maximum(
const struct TSeq *
self);
328 #undef TSeq_get_maximum
331 #ifdef TSeq_set_maximum
332 #undef TSeq_set_maximum
333 #define _set_maximum(TSeq) concatenate(TSeq, _set_maximum)
334 #define TSeq_set_maximum _set_maximum(TSeq)
335 #ifndef TSeq_isCDRStringType
337 TSeq_set_maximum(
struct TSeq *
self, RTI_INT32 new_max);
340 TSeq_set_maximum(
struct TSeq *
self, RTI_INT32 new_max, RTI_UINT32 max_str_len);
343 #undef TSeq_set_maximum
346 #ifdef TSeq_get_length
347 #undef TSeq_get_length
348 #define _get_length(TSeq) concatenate(TSeq, _get_length)
349 #define TSeq_get_length _get_length(TSeq)
350 REDADllExport RTI_INT32
351 TSeq_get_length(
const struct TSeq *
self);
353 #undef TSeq_get_length
356 #ifdef TSeq_set_length
357 #undef TSeq_set_length
358 #define _set_length(TSeq) concatenate(TSeq, _set_length)
359 #define TSeq_set_length _set_length(TSeq)
361 TSeq_set_length(
struct TSeq *
self, RTI_INT32 new_length);
363 #undef TSeq_set_length
366 #ifdef TSeq_get_reference
367 #undef TSeq_get_reference
368 #define _get_reference(TSeq) concatenate(TSeq, _get_reference)
369 #define TSeq_get_reference _get_reference(TSeq)
371 TSeq_get_reference(
const struct TSeq *
self, RTI_INT32 i);
372 #undef _get_reference
373 #undef TSeq_get_reference
378 #define _copy(TSeq) concatenate(TSeq, _copy)
379 #define TSeq_copy _copy(TSeq)
380 #ifndef TSeq_isCDRStringType
381 REDADllExport
struct TSeq*
382 TSeq_copy(
struct TSeq *
self,
const struct TSeq *src);
384 REDADllExport
struct TSeq*
385 TSeq_copy(
struct TSeq *
self,
const struct TSeq *src, RTI_UINT32 max_str_len);
393 #define _is_equal(TSeq) concatenate(TSeq, _is_equal)
394 #define TSeq_is_equal _is_equal(TSeq)
396 TSeq_is_equal(
const struct TSeq *left,
const struct TSeq *right);
401 #ifdef TSeq_loan_contiguous
402 #undef TSeq_loan_contiguous
403 #define _loan_contiguous(TSeq) concatenate(TSeq, _loan_contiguous)
404 #define TSeq_loan_contiguous _loan_contiguous(TSeq)
406 TSeq_loan_contiguous(
struct TSeq *
self,
void *buffer,
407 RTI_INT32 new_length, RTI_INT32 new_max);
408 #undef _loan_contiguous
409 #undef TSeq_loan_contiguous
412 #ifdef TSeq_loan_discontiguous
413 #undef TSeq_loan_discontiguous
414 #define _loan_discontiguous(TSeq) concatenate(TSeq, _loan_discontiguous)
415 #define TSeq_loan_discontiguous _loan_discontiguous(TSeq)
417 TSeq_loan_discontiguous(
struct TSeq *
self,
void *buffer,
418 RTI_INT32 new_length, RTI_INT32 new_max);
419 #undef _loan_discontiguous
420 #undef TSeq_loan_discontiguous
425 #define _unloan(TSeq) concatenate(TSeq, _unloan)
426 #define TSeq_unloan _unloan(TSeq)
428 TSeq_unloan(
struct TSeq *
self);
433 #ifdef TSeq_has_ownership
434 #undef TSeq_has_ownership
435 #define _has_ownership(TSeq) concatenate(TSeq, _has_ownership)
436 #define TSeq_has_ownership _has_ownership(TSeq)
438 TSeq_has_ownership(
const struct TSeq *
self);
439 #undef _has_ownership
440 #undef TSeq_has_ownership
443 #ifdef TSeq_get_contiguous_buffer
444 #undef TSeq_get_contiguous_buffer
445 #define _get_contiguous_buffer(TSeq) concatenate(TSeq, _get_contiguous_buffer)
446 #define TSeq_get_contiguous_buffer _get_contiguous_buffer(TSeq)
448 TSeq_get_contiguous_buffer(
const struct TSeq *
self);
449 #undef _get_contiguous_buffer
450 #undef TSeq_get_contiguous_buffer
453 #ifdef TSeq_get_discontiguous_buffer
454 #undef TSeq_get_discontiguous_buffer
455 #define _get_discontiguous_buffer(TSeq) concatenate(TSeq, TSeq_get_discontiguous_buffer)
456 #define TSeq_get_discontiguous_buffer _get_discontiguous_buffer(TSeq)
458 TSeq_get_discontiguous_buffer(
const struct TSeq *
self);
459 #undef _get_discontiguous_buffer
460 #undef TSeq_get_discontiguous_buffer
463 #ifdef TSeq_set_contiguous_buffer
464 #undef TSeq_set_contiguous_buffer
465 #define _set_contiguous_buffer(TSeq) concatenate(TSeq, _set_contiguous_buffer)
466 #define TSeq_set_contiguous_buffer _set_contiguous_buffer(TSeq)
468 TSeq_set_contiguous_buffer(
struct TSeq *
self, T *buffer);
469 #undef _set_contiguous_buffer
470 #undef TSeq_set_contiguous_buffer
473 #ifdef TSeq_has_discontiguous_buffer
474 #undef TSeq_has_discontiguous_buffer
475 #define _has_discontiguous_buffer(TSeq) concatenate(TSeq, _has_discontiguous_buffer)
476 #define TSeq_has_discontiguous_buffer _has_discontiguous_buffer(TSeq)
478 TSeq_has_discontiguous_buffer(
const struct TSeq *
self);
479 #undef _has_discontiguous_buffer
480 #undef TSeq_has_discontiguous_buffer
483 #ifdef TSeq_set_token
484 #undef TSeq_set_token
485 #define _set_token(TSeq) concatenate(TSeq, _set_token)
486 #define TSeq_set_token _set_token(TSeq)
488 TSeq_set_token(
struct TSeq *
self,
void *token1,
void *token2);
490 #undef TSeq_set_token
493 #ifdef TSeq_get_token
494 #undef TSeq_get_token
495 #define _get_token(TSeq) concatenate(TSeq, _get_token)
496 #define TSeq_get_token _get_token(TSeq)
498 TSeq_get_token(
struct TSeq *
self,
void **token1,
void **token2);
500 #undef TSeq_get_token
503 #ifdef TSeq_ensure_length
504 #undef TSeq_ensure_length
505 #define _ensure_length(TSeq) concatenate(TSeq, _ensure_length)
506 #define TSeq_ensure_length _ensure_length(TSeq)
507 #ifndef TSeq_isCDRStringType
509 TSeq_ensure_length(
struct TSeq *
self,RTI_INT32 length, RTI_INT32 max);
512 TSeq_ensure_length(
struct TSeq *
self,RTI_INT32 length, RTI_INT32 max,
513 RTI_INT32 max_str_len);
515 #undef _ensure_length
516 #undef TSeq_ensure_length
519 #ifdef TSeq_from_array
520 #undef TSeq_from_array
521 #define _from_array(TSeq) concatenate(TSeq, _from_array)
522 #define TSeq_from_array _from_array(TSeq)
523 #ifndef TSeq_isCDRStringType
525 TSeq_from_array(
struct TSeq *
self,
const T elms_seq[], RTI_INT32 length);
528 TSeq_from_array(
struct TSeq *
self,
const T elms_seq[], RTI_INT32 length,RTI_INT32 max_str_len);
531 #undef TSeq_from_array
536 #define _to_array(TSeq) concatenate(TSeq, _to_array)
537 #define TSeq_to_array _to_array(TSeq)
538 #ifndef TSeq_isCDRStringType
540 TSeq_to_array(
struct TSeq *
self,T elms_seq[], RTI_INT32 length);
543 TSeq_to_array(
struct TSeq *
self,T elms_seq[], RTI_INT32 length,RTI_INT32 max_str_len);
557 #undef REDA_SEQUENCE_API
559 #undef TSeq_isCDRStringType
560 #undef REDA_SEQUENCE_EXCLUDE_STRUCT
561 #undef REDA_SEQUENCE_EXCLUDE_C_METHODS
562 #undef REDA_SEQUENCE_USER_API