42 #include "reda/reda_sequence.h"
48 #if defined(RTI_WIN32) || defined(RTI_WINCE30)
49 #define REDADllExport __declspec( dllexport )
54 #define concatenate(A, B) A ## B
60 #ifdef REDA_SEQUENCE_USER_API
61 #ifndef REDA_SEQUENCE_API
62 #define REDA_SEQUENCE_API REDA_SEQUENCE_API_USER_DEFAULT
64 #if REDA_SEQUENCE_API < REDA_SEQUENCE_API_BASIC
65 #error "REDA_SEQUENCE_USER_API defined along with API level < REDA_SEQUENCE_API_BASIC"
70 #ifndef REDA_SEQUENCE_API
71 #define REDA_SEQUENCE_API REDA_SEQUENCE_API_DEFAULT
74 #if REDA_SEQUENCE_API < REDA_SEQUENCE_API_UNTYPED
75 #error "REDA_SEQUENCE_API_UNTYPED <= REDA_SEQUENCE_API <= REDA_SEQUENCE_API_FULL"
79 #if REDA_SEQUENCE_API > REDA_SEQUENCE_API_UNTYPED
80 #ifndef TSeq_initialize
81 #define TSeq_initialize
83 #ifndef TSeq_get_maximum
84 #define TSeq_get_maximum
86 #ifndef TSeq_set_maximum
87 #define TSeq_set_maximum
89 #ifndef TSeq_get_length
90 #define TSeq_get_length
92 #ifndef TSeq_set_length
93 #define TSeq_set_length
95 #ifndef TSeq_get_reference
96 #define TSeq_get_reference
100 #define TSeq_finalize
103 #ifdef REDA_SEQUENCE_USER_API
111 #if REDA_SEQUENCE_API > REDA_SEQUENCE_API_BASIC
115 #ifndef TSeq_is_equal
116 #define TSeq_is_equal
118 #ifndef TSeq_loan_contiguous
119 #define TSeq_loan_contiguous
121 #ifndef TSeq_loan_discontiguous
122 #define TSeq_loan_discontiguous
124 #ifndef TSeq_has_ownership
125 #define TSeq_has_ownership
127 #ifndef TSeq_has_discontiguous_buffer
128 #define TSeq_has_discontiguous_buffer
130 #ifndef TSeq_get_contiguous_buffer
131 #define TSeq_get_contiguous_buffer
133 #ifndef TSeq_get_discontiguous_buffer
134 #define TSeq_get_discontiguous_buffer
136 #ifndef TSeq_set_contiguous_buffer
137 #define TSeq_set_contiguous_buffer
142 #ifndef TSeq_set_token
143 #define TSeq_set_token
145 #ifndef TSeq_get_token
146 #define TSeq_get_token
148 #ifndef TSeq_ensure_length
149 #define TSeq_ensure_length
151 #ifndef TSeq_from_array
152 #define TSeq_from_array
154 #ifndef TSeq_to_array
155 #define TSeq_to_array
159 #if REDA_SEQUENCE_API > REDA_SEQUENCE_API_FULL
160 #error "REDA_SEQUENCE_API_UNTYPED <= REDA_SEQUENCE_API <= REDA_SEQUENCE_API_FULL"
167 #ifndef REDA_SEQUENCE_EXCLUDE_STRUCT
169 struct REDADllExport TSeq
171 T* _contiguous_buffer;
174 RTI_INT32 _element_size;
180 #ifdef TSeq_get_maximum
181 RTI_INT32 maximum()
const;
183 #ifdef TSeq_set_maximum
184 #ifndef TSeq_isCDRStringType
185 bool maximum(RTI_INT32 new_max);
187 #ifdef TSeq_isCDRStringType_no_max
188 bool maximum(RTI_INT32 new_max,RTI_UINT32 max_str_len);
190 bool maximum(RTI_INT32 new_max,RTI_UINT32 max_str_len);
191 bool maximum(RTI_INT32 new_max);
195 #ifdef TSeq_get_length
196 RTI_INT32 length()
const;
198 #ifdef TSeq_set_length
199 bool length(RTI_INT32 new_length);
201 #ifdef TSeq_get_reference
202 T* get_reference(RTI_INT32 i);
206 #ifndef TSeq_isCDRStringType
207 bool copy(
const TSeq& src_seq);
209 bool copy(
const TSeq& src_seq,RTI_UINT32 max_str_len);
210 bool copy(
const TSeq& src_seq);
215 bool is_equal(
const TSeq& other)
const;
217 #ifdef TSeq_loan_contiguous
218 bool loan_contiguous(
void* buffer, RTI_INT32 new_length, RTI_INT32 new_max);
220 #ifdef TSeq_loan_discontiguous
221 bool loan_discontiguous(
void* buffer, RTI_INT32 new_length, RTI_INT32 new_max);
226 #ifdef TSeq_has_ownership
227 bool has_ownership();
229 #ifdef TSeq_get_contiguous_buffer
230 T* get_contiguous_buffer()
const;
232 #ifdef TSeq_set_contiguous_buffer
233 bool set_contiguous_buffer(T* buffer);
235 #ifdef TSeq_has_discontiguous_buffer
236 bool has_discontiguous_buffer();
238 #ifdef TSeq_set_token
239 void set_token(
void *token1,
void *token2);
241 #ifdef TSeq_get_token
242 void get_token(
void **token1,
void **token2);
244 #ifdef TSeq_ensure_length
245 #ifndef TSeq_isCDRStringType
246 bool ensure_length(RTI_INT32 length, RTI_INT32 max);
248 #ifdef TSeq_isCDRStringType_no_max
249 bool ensure_length(RTI_INT32 length, RTI_INT32 max,RTI_UINT32 max_str_len);
251 bool ensure_length(RTI_INT32 length, RTI_INT32 max,RTI_UINT32 max_str_len);
252 bool ensure_length(RTI_INT32 length, RTI_INT32 max);
257 #ifdef TSeq_from_array
258 #ifndef TSeq_isCDRStringType
259 bool from_array(
const T elv[], RTI_INT32 length);
261 #ifdef TSeq_isCDRStringType_no_max
262 bool from_array(
const T elv[], RTI_INT32 length,RTI_UINT32 max_str_len);
264 bool from_array(
const T elv[], RTI_INT32 length,RTI_UINT32 max_str_len);
265 bool from_array(
const T elv[], RTI_INT32 length);
271 #ifndef TSeq_isCDRStringType
272 bool to_array(T elv[], RTI_INT32 length);
274 #ifdef TSeq_isCDRStringType_no_max
275 bool to_array(T elv[], RTI_INT32 length,RTI_UINT32 max_str_len);
277 bool to_array(T elv[], RTI_INT32 length,RTI_UINT32 max_str_len);
278 bool to_array(T elv[], RTI_INT32 length);
290 TSeq(
const TSeq& seq);
292 TSeq& operator=(
const TSeq& src_seq);
294 #ifdef TSeq_get_reference
295 T& operator[] (RTI_INT32 index);
296 const T& operator[] (RTI_INT32 index)
const;
299 bool operator==(
const TSeq& other)
const;
300 bool operator!=(
const TSeq& other)
const;
308 #if REDA_SEQUENCE_API > REDA_SEQUENCE_API_FULL
309 #error "REDA_SEQUENCE_API_UNTYPED <= REDA_SEQUENCE_API <= REDA_SEQUENCE_API_FULL"
313 #ifndef REDA_SEQUENCE_EXCLUDE_C_METHODS
315 #if defined(__cplusplus) && !defined(REDA_SEQUENCE_USER_CPP)
320 #ifdef TSeq_initialize
321 #undef TSeq_initialize
322 #define _initialize(TSeq) concatenate(TSeq, _initialize)
323 #define TSeq_initialize _initialize(TSeq)
339 REDADllExport RTI_BOOL
340 TSeq_initialize(
struct TSeq*
self);
342 #undef TSeq_initialize
347 #define _finalize(TSeq) concatenate(TSeq, _finalize)
348 #define TSeq_finalize _finalize(TSeq)
364 REDADllExport RTI_BOOL
365 TSeq_finalize(
struct TSeq *
self);
370 #ifdef TSeq_get_maximum
371 #undef TSeq_get_maximum
372 #define _get_maximum(TSeq) concatenate(TSeq, _get_maximum)
373 #define TSeq_get_maximum _get_maximum(TSeq)
374 REDADllExport RTI_INT32
375 TSeq_get_maximum(
const struct TSeq *
self);
377 #undef TSeq_get_maximum
380 #ifdef TSeq_set_maximum
381 #undef TSeq_set_maximum
382 #define _set_maximum(TSeq) concatenate(TSeq, _set_maximum)
383 #define TSeq_set_maximum _set_maximum(TSeq)
384 #ifndef TSeq_isCDRStringType
385 REDADllExport RTI_BOOL
386 TSeq_set_maximum(
struct TSeq *
self, RTI_INT32 new_max);
388 #ifdef TSeq_isCDRStringType_no_max
389 REDADllExport RTI_BOOL
390 TSeq_set_maximum(
struct TSeq *
self, RTI_INT32 new_max, RTI_UINT32 max_str_len);
392 #undef TSeq_set_maximum_w_max
393 #define _set_maximum_w_max(TSeq) concatenate(TSeq,_set_maximum_w_max)
394 #define TSeq_set_maximum_w_max _set_maximum_w_max(TSeq)
395 REDADllExport RTI_BOOL
396 TSeq_set_maximum_w_max(
struct TSeq *
self, RTI_INT32 new_max, RTI_UINT32 max_str_len);
398 REDADllExport RTI_BOOL
399 TSeq_set_maximum(
struct TSeq *
self, RTI_INT32 new_max);
403 #undef TSeq_set_maximum
404 #undef _set_maximum_w_max
405 #undef TSeq_set_maximum_w_max
408 #ifdef TSeq_get_length
409 #undef TSeq_get_length
410 #define _get_length(TSeq) concatenate(TSeq, _get_length)
411 #define TSeq_get_length _get_length(TSeq)
412 REDADllExport RTI_INT32
413 TSeq_get_length(
const struct TSeq *
self);
415 #undef TSeq_get_length
418 #ifdef TSeq_set_length
419 #undef TSeq_set_length
420 #define _set_length(TSeq) concatenate(TSeq, _set_length)
421 #define TSeq_set_length _set_length(TSeq)
422 REDADllExport RTI_BOOL
423 TSeq_set_length(
struct TSeq *
self, RTI_INT32 new_length);
425 #undef TSeq_set_length
428 #ifdef TSeq_get_reference
429 #undef TSeq_get_reference
430 #define _get_reference(TSeq) concatenate(TSeq, _get_reference)
431 #define TSeq_get_reference _get_reference(TSeq)
433 TSeq_get_reference(
const struct TSeq *
self, RTI_INT32 i);
434 #undef _get_reference
435 #undef TSeq_get_reference
440 #define _copy(TSeq) concatenate(TSeq, _copy)
441 #define TSeq_copy _copy(TSeq)
442 #ifndef TSeq_isCDRStringType
443 REDADllExport
struct TSeq*
444 TSeq_copy(
struct TSeq *
self,
const struct TSeq *src);
446 #ifdef TSeq_isCDRStringType_no_max
447 REDADllExport
struct TSeq*
448 TSeq_copy(
struct TSeq *
self,
const struct TSeq *src, RTI_UINT32 max_str_len);
450 #undef TSeq_copy_w_max
451 #define _copy_w_max(TSeq) concatenate(TSeq, _copy_w_max)
452 #define TSeq_copy_w_max _copy_w_max(TSeq)
453 REDADllExport
struct TSeq*
454 TSeq_copy_w_max(
struct TSeq *
self,
const struct TSeq *src, RTI_UINT32 max_str_len);
456 REDADllExport
struct TSeq*
457 TSeq_copy(
struct TSeq *
self,
const struct TSeq *src);
463 #undef TSeq_copy_w_max
468 #define _is_equal(TSeq) concatenate(TSeq, _is_equal)
469 #define TSeq_is_equal _is_equal(TSeq)
470 REDADllExport RTI_BOOL
471 TSeq_is_equal(
const struct TSeq *left,
const struct TSeq *right);
476 #ifdef TSeq_loan_contiguous
477 #undef TSeq_loan_contiguous
478 #define _loan_contiguous(TSeq) concatenate(TSeq, _loan_contiguous)
479 #define TSeq_loan_contiguous _loan_contiguous(TSeq)
480 REDADllExport RTI_BOOL
481 TSeq_loan_contiguous(
struct TSeq *
self,
void *buffer,
482 RTI_INT32 new_length, RTI_INT32 new_max);
483 #undef _loan_contiguous
484 #undef TSeq_loan_contiguous
487 #ifdef TSeq_loan_discontiguous
488 #undef TSeq_loan_discontiguous
489 #define _loan_discontiguous(TSeq) concatenate(TSeq, _loan_discontiguous)
490 #define TSeq_loan_discontiguous _loan_discontiguous(TSeq)
491 REDADllExport RTI_BOOL
492 TSeq_loan_discontiguous(
struct TSeq *
self,
void *buffer,
493 RTI_INT32 new_length, RTI_INT32 new_max);
494 #undef _loan_discontiguous
495 #undef TSeq_loan_discontiguous
500 #define _unloan(TSeq) concatenate(TSeq, _unloan)
501 #define TSeq_unloan _unloan(TSeq)
502 REDADllExport RTI_BOOL
503 TSeq_unloan(
struct TSeq *
self);
508 #ifdef TSeq_has_ownership
509 #undef TSeq_has_ownership
510 #define _has_ownership(TSeq) concatenate(TSeq, _has_ownership)
511 #define TSeq_has_ownership _has_ownership(TSeq)
512 REDADllExport RTI_BOOL
513 TSeq_has_ownership(
const struct TSeq *
self);
514 #undef _has_ownership
515 #undef TSeq_has_ownership
518 #ifdef TSeq_get_contiguous_buffer
519 #undef TSeq_get_contiguous_buffer
520 #define _get_contiguous_buffer(TSeq) concatenate(TSeq, _get_contiguous_buffer)
521 #define TSeq_get_contiguous_buffer _get_contiguous_buffer(TSeq)
523 TSeq_get_contiguous_buffer(
const struct TSeq *
self);
524 #undef _get_contiguous_buffer
525 #undef TSeq_get_contiguous_buffer
528 #ifdef TSeq_get_discontiguous_buffer
529 #undef TSeq_get_discontiguous_buffer
530 #define _get_discontiguous_buffer(TSeq) concatenate(TSeq, TSeq_get_discontiguous_buffer)
531 #define TSeq_get_discontiguous_buffer _get_discontiguous_buffer(TSeq)
533 TSeq_get_discontiguous_buffer(
const struct TSeq *
self);
534 #undef _get_discontiguous_buffer
535 #undef TSeq_get_discontiguous_buffer
538 #ifdef TSeq_set_contiguous_buffer
539 #undef TSeq_set_contiguous_buffer
540 #define _set_contiguous_buffer(TSeq) concatenate(TSeq, _set_contiguous_buffer)
541 #define TSeq_set_contiguous_buffer _set_contiguous_buffer(TSeq)
542 REDADllExport RTI_BOOL
543 TSeq_set_contiguous_buffer(
struct TSeq *
self, T *buffer);
544 #undef _set_contiguous_buffer
545 #undef TSeq_set_contiguous_buffer
548 #ifdef TSeq_has_discontiguous_buffer
549 #undef TSeq_has_discontiguous_buffer
550 #define _has_discontiguous_buffer(TSeq) concatenate(TSeq, _has_discontiguous_buffer)
551 #define TSeq_has_discontiguous_buffer _has_discontiguous_buffer(TSeq)
552 REDADllExport RTI_BOOL
553 TSeq_has_discontiguous_buffer(
const struct TSeq *
self);
554 #undef _has_discontiguous_buffer
555 #undef TSeq_has_discontiguous_buffer
558 #ifdef TSeq_set_token
559 #undef TSeq_set_token
560 #define _set_token(TSeq) concatenate(TSeq, _set_token)
561 #define TSeq_set_token _set_token(TSeq)
563 TSeq_set_token(
struct TSeq *
self,
void *token1,
void *token2);
565 #undef TSeq_set_token
568 #ifdef TSeq_get_token
569 #undef TSeq_get_token
570 #define _get_token(TSeq) concatenate(TSeq, _get_token)
571 #define TSeq_get_token _get_token(TSeq)
573 TSeq_get_token(
struct TSeq *
self,
void **token1,
void **token2);
575 #undef TSeq_get_token
578 #ifdef TSeq_ensure_length
579 #undef TSeq_ensure_length
580 #define _ensure_length(TSeq) concatenate(TSeq, _ensure_length)
581 #define TSeq_ensure_length _ensure_length(TSeq)
582 #ifndef TSeq_isCDRStringType
583 REDADllExport RTI_BOOL
584 TSeq_ensure_length(
struct TSeq *
self,RTI_INT32 length, RTI_INT32 max);
586 #ifdef TSeq_isCDRStringType_no_max
587 REDADllExport RTI_BOOL
588 TSeq_ensure_length(
struct TSeq *
self,RTI_INT32 length, RTI_INT32 max,
589 RTI_INT32 max_str_len);
591 #undef TSeq_ensure_length_w_max
592 #define _ensure_length_w_max(TSeq) concatenate(TSeq, _ensure_length_w_max)
593 #define TSeq_ensure_length_w_max _ensure_length_w_max(TSeq)
594 REDADllExport RTI_BOOL
595 TSeq_ensure_length_w_max(
struct TSeq *
self,RTI_INT32 length, RTI_INT32 max,
596 RTI_INT32 max_str_len);
597 REDADllExport RTI_BOOL
598 TSeq_ensure_length(
struct TSeq *
self,RTI_INT32 length, RTI_INT32 max);
601 #undef _ensure_length
602 #undef TSeq_ensure_length
603 #undef _ensure_length_w_max
604 #undef TSeq_ensure_length_max
607 #ifdef TSeq_from_array
608 #undef TSeq_from_array
609 #define _from_array(TSeq) concatenate(TSeq, _from_array)
610 #define TSeq_from_array _from_array(TSeq)
611 #ifndef TSeq_isCDRStringType
612 REDADllExport RTI_BOOL
613 TSeq_from_array(
struct TSeq *
self,
const T elms_seq[], RTI_INT32 length);
615 #ifdef TSeq_isCDRStringType_no_max
616 REDADllExport RTI_BOOL
617 TSeq_from_array(
struct TSeq *
self,
const T elms_seq[], RTI_INT32 length,RTI_INT32 max_str_len);
619 #undef TSeq_from_array_w_max
620 #define _from_array_w_max(TSeq) concatenate(TSeq, _from_array_w_max)
621 #define TSeq_from_array_w_max _from_array_w_max(TSeq)
622 REDADllExport RTI_BOOL
623 TSeq_from_array_w_max(
struct TSeq *
self,
const T elms_seq[], RTI_INT32 length,RTI_INT32 max_str_len);
625 REDADllExport RTI_BOOL
626 TSeq_from_array(
struct TSeq *
self,
const T elms_seq[], RTI_INT32 length);
630 #undef TSeq_from_array
631 #undef _from_array_w_max
632 #undef TSeq_from_array_w_max
637 #define _to_array(TSeq) concatenate(TSeq, _to_array)
638 #define TSeq_to_array _to_array(TSeq)
639 #ifndef TSeq_isCDRStringType
640 REDADllExport RTI_BOOL
641 TSeq_to_array(
struct TSeq *
self,T elms_seq[], RTI_INT32 length);
643 #ifdef TSeq_isCDRStringType_no_max
644 REDADllExport RTI_BOOL
645 TSeq_to_array(
struct TSeq *
self,T elms_seq[], RTI_INT32 length,RTI_INT32 max_str_len);
647 #undef TSeq_to_array_w_max
648 #define _to_array_w_max(TSeq) concatenate(TSeq, _to_array_w_max)
649 #define TSeq_to_array_w_max _to_array_w_max(TSeq)
650 REDADllExport RTI_BOOL
651 TSeq_to_array_w_max(
struct TSeq *
self,T elms_seq[], RTI_INT32 length,RTI_INT32 max_str_len);
653 REDADllExport RTI_BOOL
654 TSeq_to_array(
struct TSeq *
self,T elms_seq[], RTI_INT32 length);
659 #undef _to_array_w_max
660 #undef TSeq_to_array_max
663 #if defined(__cplusplus) && !defined(REDA_SEQUENCE_USER_CPP)
671 #undef REDA_SEQUENCE_API
673 #undef TSeq_isCDRStringType
674 #undef TSeq_isCDRStringType_no_max
675 #undef TSeq_isCDRCharStringType
676 #undef REDA_SEQUENCE_EXCLUDE_STRUCT
677 #undef REDA_SEQUENCE_EXCLUDE_C_METHODS
678 #undef REDA_SEQUENCE_USER_API
679 #undef REDA_SEQUENCE_USER_CPP