42 #include "reda/reda_sequence.h"
44 #if defined(RTI_WIN32) || defined(RTI_WINCE30)
45 #ifdef RTI_EXPORT_REDA_SEQUENCE
49 #define REDADllExport __declspec( dllexport )
53 #define concatenate(A, B) A ## B
59 #ifdef REDA_SEQUENCE_USER_API
60 #ifndef REDA_SEQUENCE_API
61 #define REDA_SEQUENCE_API REDA_SEQUENCE_API_USER_DEFAULT
63 #if REDA_SEQUENCE_API < REDA_SEQUENCE_API_BASIC
64 #error "REDA_SEQUENCE_USER_API defined along with API level < REDA_SEQUENCE_API_BASIC"
69 #ifndef REDA_SEQUENCE_API
70 #define REDA_SEQUENCE_API REDA_SEQUENCE_API_DEFAULT
73 #if REDA_SEQUENCE_API < REDA_SEQUENCE_API_UNTYPED
74 #error "REDA_SEQUENCE_API_UNTYPED <= REDA_SEQUENCE_API <= REDA_SEQUENCE_API_FULL"
78 #if REDA_SEQUENCE_API > REDA_SEQUENCE_API_UNTYPED
79 #ifndef TSeq_initialize
80 #define TSeq_initialize
82 #ifndef TSeq_get_maximum
83 #define TSeq_get_maximum
85 #ifndef TSeq_set_maximum
86 #define TSeq_set_maximum
88 #ifndef TSeq_get_length
89 #define TSeq_get_length
91 #ifndef TSeq_set_length
92 #define TSeq_set_length
94 #ifndef TSeq_get_reference
95 #define TSeq_get_reference
102 #ifdef REDA_SEQUENCE_USER_API
110 #if REDA_SEQUENCE_API > REDA_SEQUENCE_API_BASIC
114 #ifndef TSeq_is_equal
115 #define TSeq_is_equal
117 #ifndef TSeq_loan_contiguous
118 #define TSeq_loan_contiguous
120 #ifndef TSeq_loan_discontiguous
121 #define TSeq_loan_discontiguous
123 #ifndef TSeq_has_ownership
124 #define TSeq_has_ownership
126 #ifndef TSeq_has_discontiguous_buffer
127 #define TSeq_has_discontiguous_buffer
129 #ifndef TSeq_get_contiguous_buffer
130 #define TSeq_get_contiguous_buffer
132 #ifndef TSeq_get_discontiguous_buffer
133 #define TSeq_get_discontiguous_buffer
135 #ifndef TSeq_set_contiguous_buffer
136 #define TSeq_set_contiguous_buffer
141 #ifndef TSeq_set_token
142 #define TSeq_set_token
144 #ifndef TSeq_get_token
145 #define TSeq_get_token
147 #ifndef TSeq_ensure_length
148 #define TSeq_ensure_length
150 #ifndef TSeq_from_array
151 #define TSeq_from_array
153 #ifndef TSeq_to_array
154 #define TSeq_to_array
158 #if REDA_SEQUENCE_API > REDA_SEQUENCE_API_FULL
159 #error "REDA_SEQUENCE_API_UNTYPED <= REDA_SEQUENCE_API <= REDA_SEQUENCE_API_FULL"
166 #ifndef REDA_SEQUENCE_EXCLUDE_STRUCT
168 struct REDADllExport TSeq
170 T* _contiguous_buffer;
173 RTI_INT32 _element_size;
179 #ifdef TSeq_get_maximum
180 RTI_INT32 maximum()
const;
182 #ifdef TSeq_set_maximum
183 #ifndef TSeq_isCDRStringType
184 bool maximum(RTI_INT32 new_max);
186 #ifdef TSeq_isCDRStringType_no_max
187 bool maximum(RTI_INT32 new_max,RTI_UINT32 max_str_len);
189 bool maximum(RTI_INT32 new_max,RTI_UINT32 max_str_len);
190 bool maximum(RTI_INT32 new_max);
194 #ifdef TSeq_get_length
195 RTI_INT32 length()
const;
197 #ifdef TSeq_set_length
198 bool length(RTI_INT32 new_length);
200 #ifdef TSeq_get_reference
201 T* get_reference(RTI_INT32 i);
205 #ifndef TSeq_isCDRStringType
206 bool copy(
const TSeq& src_seq);
208 bool copy(
const TSeq& src_seq,RTI_UINT32 max_str_len);
209 bool copy(
const TSeq& src_seq);
214 bool is_equal(
const TSeq& other)
const;
216 #ifdef TSeq_loan_contiguous
217 bool loan_contiguous(
void* buffer, RTI_INT32 new_length, RTI_INT32 new_max);
219 #ifdef TSeq_loan_discontiguous
220 bool loan_discontiguous(
void* buffer, RTI_INT32 new_length, RTI_INT32 new_max);
225 #ifdef TSeq_has_ownership
226 bool has_ownership();
228 #ifdef TSeq_get_contiguous_buffer
229 T* get_contiguous_buffer()
const;
231 #ifdef TSeq_set_contiguous_buffer
232 bool set_contiguous_buffer(T* buffer);
234 #ifdef TSeq_has_discontiguous_buffer
235 bool has_discontiguous_buffer();
237 #ifdef TSeq_set_token
238 void set_token(
void *token1,
void *token2);
240 #ifdef TSeq_get_token
241 void get_token(
void **token1,
void **token2);
243 #ifdef TSeq_ensure_length
244 #ifndef TSeq_isCDRStringType
245 bool ensure_length(RTI_INT32 length, RTI_INT32 max);
247 #ifdef TSeq_isCDRStringType_no_max
248 bool ensure_length(RTI_INT32 length, RTI_INT32 max,RTI_UINT32 max_str_len);
250 bool ensure_length(RTI_INT32 length, RTI_INT32 max,RTI_UINT32 max_str_len);
251 bool ensure_length(RTI_INT32 length, RTI_INT32 max);
256 #ifdef TSeq_from_array
257 #ifndef TSeq_isCDRStringType
258 bool from_array(
const T elv[], RTI_INT32 length);
260 #ifdef TSeq_isCDRStringType_no_max
261 bool from_array(
const T elv[], RTI_INT32 length,RTI_UINT32 max_str_len);
263 bool from_array(
const T elv[], RTI_INT32 length,RTI_UINT32 max_str_len);
264 bool from_array(
const T elv[], RTI_INT32 length);
270 #ifndef TSeq_isCDRStringType
271 bool to_array(T elv[], RTI_INT32 length);
273 #ifdef TSeq_isCDRStringType_no_max
274 bool to_array(T elv[], RTI_INT32 length,RTI_UINT32 max_str_len);
276 bool to_array(T elv[], RTI_INT32 length,RTI_UINT32 max_str_len);
277 bool to_array(T elv[], RTI_INT32 length);
289 TSeq(
const TSeq& seq);
291 TSeq& operator=(
const TSeq& src_seq);
293 #ifdef TSeq_get_reference
294 T& operator[] (RTI_INT32 index);
295 const T& operator[] (RTI_INT32 index)
const;
298 bool operator==(
const TSeq& other)
const;
299 bool operator!=(
const TSeq& other)
const;
307 #if REDA_SEQUENCE_API > REDA_SEQUENCE_API_FULL
308 #error "REDA_SEQUENCE_API_UNTYPED <= REDA_SEQUENCE_API <= REDA_SEQUENCE_API_FULL"
312 #ifndef REDA_SEQUENCE_EXCLUDE_C_METHODS
318 #ifdef TSeq_initialize
319 #undef TSeq_initialize
320 #define _initialize(TSeq) concatenate(TSeq, _initialize)
321 #define TSeq_initialize _initialize(TSeq)
338 TSeq_initialize(
struct TSeq*
self);
340 #undef TSeq_initialize
345 #define _finalize(TSeq) concatenate(TSeq, _finalize)
346 #define TSeq_finalize _finalize(TSeq)
363 TSeq_finalize(
struct TSeq *
self);
368 #ifdef TSeq_get_maximum
369 #undef TSeq_get_maximum
370 #define _get_maximum(TSeq) concatenate(TSeq, _get_maximum)
371 #define TSeq_get_maximum _get_maximum(TSeq)
372 REDADllExport RTI_INT32
373 TSeq_get_maximum(
const struct TSeq *
self);
375 #undef TSeq_get_maximum
378 #ifdef TSeq_set_maximum
379 #undef TSeq_set_maximum
380 #define _set_maximum(TSeq) concatenate(TSeq, _set_maximum)
381 #define TSeq_set_maximum _set_maximum(TSeq)
382 #ifndef TSeq_isCDRStringType
384 TSeq_set_maximum(
struct TSeq *
self, RTI_INT32 new_max);
386 #ifdef TSeq_isCDRStringType_no_max
388 TSeq_set_maximum(
struct TSeq *
self, RTI_INT32 new_max, RTI_UINT32 max_str_len);
390 #undef TSeq_set_maximum_w_max
391 #define _set_maximum_w_max(TSeq) concatenate(TSeq,_set_maximum_w_max)
392 #define TSeq_set_maximum_w_max _set_maximum_w_max(TSeq)
394 TSeq_set_maximum_w_max(
struct TSeq *
self, RTI_INT32 new_max, RTI_UINT32 max_str_len);
397 TSeq_set_maximum(
struct TSeq *
self, RTI_INT32 new_max);
401 #undef TSeq_set_maximum
402 #undef _set_maximum_w_max
403 #undef TSeq_set_maximum_w_max
406 #ifdef TSeq_get_length
407 #undef TSeq_get_length
408 #define _get_length(TSeq) concatenate(TSeq, _get_length)
409 #define TSeq_get_length _get_length(TSeq)
410 REDADllExport RTI_INT32
411 TSeq_get_length(
const struct TSeq *
self);
413 #undef TSeq_get_length
416 #ifdef TSeq_set_length
417 #undef TSeq_set_length
418 #define _set_length(TSeq) concatenate(TSeq, _set_length)
419 #define TSeq_set_length _set_length(TSeq)
421 TSeq_set_length(
struct TSeq *
self, RTI_INT32 new_length);
423 #undef TSeq_set_length
426 #ifdef TSeq_get_reference
427 #undef TSeq_get_reference
428 #define _get_reference(TSeq) concatenate(TSeq, _get_reference)
429 #define TSeq_get_reference _get_reference(TSeq)
431 TSeq_get_reference(
const struct TSeq *
self, RTI_INT32 i);
432 #undef _get_reference
433 #undef TSeq_get_reference
438 #define _copy(TSeq) concatenate(TSeq, _copy)
439 #define TSeq_copy _copy(TSeq)
440 #ifndef TSeq_isCDRStringType
441 REDADllExport
struct TSeq*
442 TSeq_copy(
struct TSeq *
self,
const struct TSeq *src);
444 #ifdef TSeq_isCDRStringType_no_max
445 REDADllExport
struct TSeq*
446 TSeq_copy(
struct TSeq *
self,
const struct TSeq *src, RTI_UINT32 max_str_len);
448 #undef TSeq_copy_w_max
449 #define _copy_w_max(TSeq) concatenate(TSeq, _copy_w_max)
450 #define TSeq_copy_w_max _copy_w_max(TSeq)
451 REDADllExport
struct TSeq*
452 TSeq_copy_w_max(
struct TSeq *
self,
const struct TSeq *src, RTI_UINT32 max_str_len);
454 REDADllExport
struct TSeq*
455 TSeq_copy(
struct TSeq *
self,
const struct TSeq *src);
461 #undef TSeq_copy_w_max
466 #define _is_equal(TSeq) concatenate(TSeq, _is_equal)
467 #define TSeq_is_equal _is_equal(TSeq)
469 TSeq_is_equal(
const struct TSeq *left,
const struct TSeq *right);
474 #ifdef TSeq_loan_contiguous
475 #undef TSeq_loan_contiguous
476 #define _loan_contiguous(TSeq) concatenate(TSeq, _loan_contiguous)
477 #define TSeq_loan_contiguous _loan_contiguous(TSeq)
479 TSeq_loan_contiguous(
struct TSeq *
self,
void *buffer,
480 RTI_INT32 new_length, RTI_INT32 new_max);
481 #undef _loan_contiguous
482 #undef TSeq_loan_contiguous
485 #ifdef TSeq_loan_discontiguous
486 #undef TSeq_loan_discontiguous
487 #define _loan_discontiguous(TSeq) concatenate(TSeq, _loan_discontiguous)
488 #define TSeq_loan_discontiguous _loan_discontiguous(TSeq)
490 TSeq_loan_discontiguous(
struct TSeq *
self,
void *buffer,
491 RTI_INT32 new_length, RTI_INT32 new_max);
492 #undef _loan_discontiguous
493 #undef TSeq_loan_discontiguous
498 #define _unloan(TSeq) concatenate(TSeq, _unloan)
499 #define TSeq_unloan _unloan(TSeq)
501 TSeq_unloan(
struct TSeq *
self);
506 #ifdef TSeq_has_ownership
507 #undef TSeq_has_ownership
508 #define _has_ownership(TSeq) concatenate(TSeq, _has_ownership)
509 #define TSeq_has_ownership _has_ownership(TSeq)
511 TSeq_has_ownership(
const struct TSeq *
self);
512 #undef _has_ownership
513 #undef TSeq_has_ownership
516 #ifdef TSeq_get_contiguous_buffer
517 #undef TSeq_get_contiguous_buffer
518 #define _get_contiguous_buffer(TSeq) concatenate(TSeq, _get_contiguous_buffer)
519 #define TSeq_get_contiguous_buffer _get_contiguous_buffer(TSeq)
521 TSeq_get_contiguous_buffer(
const struct TSeq *
self);
522 #undef _get_contiguous_buffer
523 #undef TSeq_get_contiguous_buffer
526 #ifdef TSeq_get_discontiguous_buffer
527 #undef TSeq_get_discontiguous_buffer
528 #define _get_discontiguous_buffer(TSeq) concatenate(TSeq, TSeq_get_discontiguous_buffer)
529 #define TSeq_get_discontiguous_buffer _get_discontiguous_buffer(TSeq)
531 TSeq_get_discontiguous_buffer(
const struct TSeq *
self);
532 #undef _get_discontiguous_buffer
533 #undef TSeq_get_discontiguous_buffer
536 #ifdef TSeq_set_contiguous_buffer
537 #undef TSeq_set_contiguous_buffer
538 #define _set_contiguous_buffer(TSeq) concatenate(TSeq, _set_contiguous_buffer)
539 #define TSeq_set_contiguous_buffer _set_contiguous_buffer(TSeq)
541 TSeq_set_contiguous_buffer(
struct TSeq *
self, T *buffer);
542 #undef _set_contiguous_buffer
543 #undef TSeq_set_contiguous_buffer
546 #ifdef TSeq_has_discontiguous_buffer
547 #undef TSeq_has_discontiguous_buffer
548 #define _has_discontiguous_buffer(TSeq) concatenate(TSeq, _has_discontiguous_buffer)
549 #define TSeq_has_discontiguous_buffer _has_discontiguous_buffer(TSeq)
551 TSeq_has_discontiguous_buffer(
const struct TSeq *
self);
552 #undef _has_discontiguous_buffer
553 #undef TSeq_has_discontiguous_buffer
556 #ifdef TSeq_set_token
557 #undef TSeq_set_token
558 #define _set_token(TSeq) concatenate(TSeq, _set_token)
559 #define TSeq_set_token _set_token(TSeq)
561 TSeq_set_token(
struct TSeq *
self,
void *token1,
void *token2);
563 #undef TSeq_set_token
566 #ifdef TSeq_get_token
567 #undef TSeq_get_token
568 #define _get_token(TSeq) concatenate(TSeq, _get_token)
569 #define TSeq_get_token _get_token(TSeq)
571 TSeq_get_token(
struct TSeq *
self,
void **token1,
void **token2);
573 #undef TSeq_get_token
576 #ifdef TSeq_ensure_length
577 #undef TSeq_ensure_length
578 #define _ensure_length(TSeq) concatenate(TSeq, _ensure_length)
579 #define TSeq_ensure_length _ensure_length(TSeq)
580 #ifndef TSeq_isCDRStringType
582 TSeq_ensure_length(
struct TSeq *
self,RTI_INT32 length, RTI_INT32 max);
584 #ifdef TSeq_isCDRStringType_no_max
586 TSeq_ensure_length(
struct TSeq *
self,RTI_INT32 length, RTI_INT32 max,
587 RTI_INT32 max_str_len);
589 #undef TSeq_ensure_length_w_max
590 #define _ensure_length_w_max(TSeq) concatenate(TSeq, _ensure_length_w_max)
591 #define TSeq_ensure_length_w_max _ensure_length_w_max(TSeq)
593 TSeq_ensure_length_w_max(
struct TSeq *
self,RTI_INT32 length, RTI_INT32 max,
594 RTI_INT32 max_str_len);
596 TSeq_ensure_length(
struct TSeq *
self,RTI_INT32 length, RTI_INT32 max);
599 #undef _ensure_length
600 #undef TSeq_ensure_length
601 #undef _ensure_length_w_max
602 #undef TSeq_ensure_length_max
605 #ifdef TSeq_from_array
606 #undef TSeq_from_array
607 #define _from_array(TSeq) concatenate(TSeq, _from_array)
608 #define TSeq_from_array _from_array(TSeq)
609 #ifndef TSeq_isCDRStringType
611 TSeq_from_array(
struct TSeq *
self,
const T elms_seq[], RTI_INT32 length);
613 #ifdef TSeq_isCDRStringType_no_max
615 TSeq_from_array(
struct TSeq *
self,
const T elms_seq[], RTI_INT32 length,RTI_INT32 max_str_len);
617 #undef TSeq_from_array_w_max
618 #define _from_array_w_max(TSeq) concatenate(TSeq, _from_array_w_max)
619 #define TSeq_from_array_w_max _from_array_w_max(TSeq)
621 TSeq_from_array_w_max(
struct TSeq *
self,
const T elms_seq[], RTI_INT32 length,RTI_INT32 max_str_len);
624 TSeq_from_array(
struct TSeq *
self,
const T elms_seq[], RTI_INT32 length);
628 #undef TSeq_from_array
629 #undef _from_array_w_max
630 #undef TSeq_from_array_w_max
635 #define _to_array(TSeq) concatenate(TSeq, _to_array)
636 #define TSeq_to_array _to_array(TSeq)
637 #ifndef TSeq_isCDRStringType
639 TSeq_to_array(
struct TSeq *
self,T elms_seq[], RTI_INT32 length);
641 #ifdef TSeq_isCDRStringType_no_max
643 TSeq_to_array(
struct TSeq *
self,T elms_seq[], RTI_INT32 length,RTI_INT32 max_str_len);
645 #undef TSeq_to_array_w_max
646 #define _to_array_w_max(TSeq) concatenate(TSeq, _to_array_w_max)
647 #define TSeq_to_array_w_max _to_array_w_max(TSeq)
649 TSeq_to_array_w_max(
struct TSeq *
self,T elms_seq[], RTI_INT32 length,RTI_INT32 max_str_len);
652 TSeq_to_array(
struct TSeq *
self,T elms_seq[], RTI_INT32 length);
657 #undef _to_array_w_max
658 #undef TSeq_to_array_max
669 #undef REDA_SEQUENCE_API
671 #undef TSeq_isCDRStringType
672 #undef TSeq_isCDRStringType_no_max
673 #undef TSeq_isCDRCharStringType
674 #undef REDA_SEQUENCE_EXCLUDE_STRUCT
675 #undef REDA_SEQUENCE_EXCLUDE_C_METHODS
676 #undef REDA_SEQUENCE_USER_API