30 #include "reda/reda_sequence.h"
31 #define concatenate(A, B) A ## B
37 #ifdef REDA_SEQUENCE_USER_API
38 #ifndef REDA_SEQUENCE_API
39 #define REDA_SEQUENCE_API REDA_SEQUENCE_API_USER_DEFAULT
41 #if REDA_SEQUENCE_API < REDA_SEQUENCE_API_BASIC
42 #error "REDA_SEQUENCE_USER_API defined along with API level < REDA_SEQUENCE_API_BASIC"
47 #ifndef REDA_SEQUENCE_API
48 #define REDA_SEQUENCE_API REDA_SEQUENCE_API_DEFAULT
51 #if REDA_SEQUENCE_API < REDA_SEQUENCE_API_UNTYPED
52 #error "REDA_SEQUENCE_API_UNTYPED <= REDA_SEQUENCE_API <= REDA_SEQUENCE_API_FULL"
56 #if REDA_SEQUENCE_API > REDA_SEQUENCE_API_UNTYPED
57 #ifndef TSeq_initialize
58 #define TSeq_initialize
60 #ifndef TSeq_get_maximum
61 #define TSeq_get_maximum
63 #ifndef TSeq_set_maximum
64 #define TSeq_set_maximum
66 #ifndef TSeq_get_length
67 #define TSeq_get_length
69 #ifndef TSeq_set_length
70 #define TSeq_set_length
72 #ifndef TSeq_get_reference
73 #define TSeq_get_reference
80 #ifdef REDA_SEQUENCE_USER_API
88 #if REDA_SEQUENCE_API > REDA_SEQUENCE_API_BASIC
95 #ifndef TSeq_loan_contiguous
96 #define TSeq_loan_contiguous
98 #ifndef TSeq_loan_discontiguous
99 #define TSeq_loan_discontiguous
101 #ifndef TSeq_has_ownership
102 #define TSeq_has_ownership
104 #ifndef TSeq_has_discontiguous_buffer
105 #define TSeq_has_discontiguous_buffer
107 #ifndef TSeq_get_contiguous_buffer
108 #define TSeq_get_contiguous_buffer
110 #ifndef TSeq_get_discontiguous_buffer
111 #define TSeq_get_discontiguous_buffer
113 #ifndef TSeq_set_contiguous_buffer
114 #define TSeq_set_contiguous_buffer
119 #ifndef TSeq_set_token
120 #define TSeq_set_token
122 #ifndef TSeq_get_token
123 #define TSeq_get_token
125 #ifndef TSeq_ensure_length
126 #define TSeq_ensure_length
128 #ifndef TSeq_from_array
129 #define TSeq_from_array
131 #ifndef TSeq_to_array
132 #define TSeq_to_array
136 #if REDA_SEQUENCE_API > REDA_SEQUENCE_API_FULL
137 #error "REDA_SEQUENCE_API_UNTYPED <= REDA_SEQUENCE_API <= REDA_SEQUENCE_API_FULL"
140 #if defined(T_copy) && !defined(T_initialize)
141 #error "T_copy defined without T_initialize"
144 #if defined(T_compare) && !defined(T_initialize)
145 #error "T_compare defined without T_initialize"
149 #if defined(TSeq_isCDRStringType) && (!defined(T_initialize) || !defined(T_finalize) || !defined(T_copy))
150 #error "TSeq_isCDRStringType defined without T_initialize/T_finalize/T_copy"
153 #if defined(TSeq_isCDRStringType) && (!defined(T_initialize) || !defined(T_copy))
154 #error "TSeq_isCDRStringType defined without T_initialize/T_copy"
158 #if defined(T_initialize) || defined(T_finalize) || defined(T_copy)
160 #if !(defined(TSeq_isCDRStringType) && defined(RTI_CERT))
162 #define _map(TSeq) concatenate(TSeq, _map)
163 #define TSeq_map _map(TSeq)
165 TSeq_map(T *buffer,RTI_BOOL(*map)(T*),RTI_INT32 begin, RTI_INT32 end)
169 for (i = begin; i <= end; i++)
171 if (!map(&buffer[i]))
182 #ifdef TSeq_isCDRStringType
183 #ifndef TSeq_map_w_length
184 #define _map_w_length(TSeq) concatenate(TSeq, _map_w_length)
185 #define TSeq_map_w_length _map_w_length(TSeq)
187 TSeq_map_w_length(T *buffer,RTI_BOOL(*map)(T*, RTI_UINT32),RTI_INT32 begin, RTI_INT32 end, RTI_UINT32 max_str_len)
191 for (i = begin; i <= end; i++)
193 if (!map(&buffer[i], max_str_len))
206 #ifdef TSeq_initialize
207 #undef TSeq_initialize
208 #define _initialize(TSeq) concatenate(TSeq, _initialize)
209 #define TSeq_initialize _initialize(TSeq)
211 TSeq_initialize(
struct TSeq *
self)
213 return REDA_Sequence_initialize((
struct REDA_Sequence*)
self,
sizeof(T));
219 #define _finalize(TSeq) concatenate(TSeq, _finalize)
220 #define TSeq_finalize _finalize(TSeq)
222 TSeq_finalize(
struct TSeq *
self)
226 result = TSeq_map(self->_contiguous_buffer,T_finalize,0,self->_maximum-1);
231 return REDA_Sequence_finalize((
struct REDA_Sequence*)
self);
233 return REDA_Sequence_finalize((
struct REDA_Sequence*)
self);
241 #ifdef TSeq_get_maximum
242 #undef TSeq_get_maximum
243 #define _get_maximum(TSeq) concatenate(TSeq, _get_maximum)
244 #define TSeq_get_maximum _get_maximum(TSeq)
246 TSeq_get_maximum(
const struct TSeq *
self)
248 return REDA_Sequence_get_maximum((
const struct REDA_Sequence *)
self);
252 #ifdef TSeq_set_maximum
253 #undef TSeq_set_maximum
254 #define _set_maximum(TSeq) concatenate(TSeq, _set_maximum)
255 #define TSeq_set_maximum _set_maximum(TSeq)
256 #ifndef TSeq_isCDRStringType
258 TSeq_set_maximum(
struct TSeq *
self, RTI_INT32 new_max)
263 RTI_INT32 copy_length;
272 OSAPI_PRECONDITION(
self == NULL,
274 OSAPI_Log_entry_add_pointer(
"self",
self,RTI_TRUE);)
276 self->_element_size =
sizeof(T);
278 copy_buffer =
self->_contiguous_buffer;
279 copy_length =
self->_length;
280 copy_max =
self->_maximum;
283 old_max = REDA_Sequence_get_maximum((
const struct REDA_Sequence *)
self);
286 if (old_max == new_max)
291 result = REDA_Sequence_set_maximum((
struct REDA_Sequence*)
self,
298 result = TSeq_map(self->_contiguous_buffer,T_initialize,0,self->_maximum-1);
305 if (self->_length > 0)
309 for (i = 0; i < (new_max < copy_length ? new_max : copy_length); ++i)
311 if (!T_copy(&self->_contiguous_buffer[i],(
const T*)©_buffer[i]))
325 if (copy_buffer != NULL)
327 result = TSeq_map(copy_buffer,T_finalize,0,copy_max-1);
333 self->_element_size =
sizeof(T);
334 return REDA_Sequence_set_maximum((
struct REDA_Sequence*)
self, new_max,RTI_TRUE);
338 #ifdef TSeq_isCDRStringType_no_max
340 TSeq_set_maximum(
struct TSeq *
self, RTI_INT32 new_max, RTI_UINT32 max_str_len)
342 #undef TSeq_set_maximum_w_max
343 #define _set_maximum_w_max(TSeq) concatenate(TSeq, _set_maximum_w_max)
344 #define TSeq_set_maximum_w_max _set_maximum_w_max(TSeq)
346 TSeq_set_maximum_w_max(
struct TSeq *
self, RTI_INT32 new_max, RTI_UINT32 max_str_len)
356 OSAPI_PRECONDITION(
self == NULL,
358 OSAPI_Log_entry_add_int(
"max_str_len",(RTI_INT32)max_str_len,RTI_FALSE);
359 OSAPI_Log_entry_add_pointer(
"self",
self,RTI_TRUE);)
361 self->_element_size =
sizeof(T);
362 if (max_str_len < REDA_SEQUENCE_ELEMENT_ALLOC)
364 self->_flags |= REDA_SEQUENCE_FLAG_PTR_ALLOCATION;
367 old_max = REDA_Sequence_get_maximum((
const struct REDA_Sequence *)
self);
370 if (old_max == new_max)
376 copy_buffer =
self->_contiguous_buffer;
381 result = REDA_Sequence_set_maximum((
struct REDA_Sequence*)
self,
390 for (i = 0; i < ((old_max < new_max) ? old_max : new_max); i++)
392 self->_contiguous_buffer[i] = copy_buffer[i];
399 result = TSeq_map_w_length(self->_contiguous_buffer,T_initialize,old_max,new_max-1,max_str_len);
413 if (copy_buffer != NULL)
415 result = TSeq_map(copy_buffer,T_finalize,new_max,old_max-1);
422 #ifndef TSeq_isCDRStringType_no_max
424 TSeq_set_maximum(
struct TSeq *
self, RTI_INT32 new_max)
426 return TSeq_set_maximum_w_max(
self,new_max,REDA_SEQUENCE_ELEMENT_ALLOC);
433 #ifdef TSeq_get_length
434 #undef TSeq_get_length
435 #define _get_length(TSeq) concatenate(TSeq, _get_length)
436 #define TSeq_get_length _get_length(TSeq)
438 TSeq_get_length(
const struct TSeq *
self)
440 return REDA_Sequence_get_length((
const struct REDA_Sequence *)
self);
443 #undef TSeq_get_length
447 #ifdef TSeq_set_length
448 #undef TSeq_set_length
449 #define _set_length(TSeq) concatenate(TSeq, _set_length)
450 #define TSeq_set_length _set_length(TSeq)
452 TSeq_set_length(
struct TSeq *
self, RTI_INT32 new_length)
454 return REDA_Sequence_set_length((
struct REDA_Sequence *)
self, new_length);
458 #ifdef TSeq_get_reference
459 #undef TSeq_get_reference
460 #define _get_reference(TSeq) concatenate(TSeq, _get_reference)
461 #define TSeq_get_reference _get_reference(TSeq)
463 TSeq_get_reference(
const struct TSeq *
self, RTI_INT32 i)
465 return (T*)REDA_Sequence_get_reference((
const struct REDA_Sequence*)
self,i);
467 #undef _get_reference
468 #undef TSeq_get_reference
474 #define _copy(TSeq) concatenate(TSeq, _copy)
475 #define TSeq_copy _copy(TSeq)
476 #ifndef TSeq_isCDRStringType
478 TSeq_copy(
struct TSeq *
self,
const struct TSeq *src)
488 OSAPI_PRECONDITION(
self == NULL,
490 OSAPI_Log_entry_add_pointer(
"self",
self,RTI_TRUE);)
492 copy_buffer = self->_contiguous_buffer;
493 if (src->_element_size > 0)
495 self->_element_size =
sizeof(T);
498 copy_max =
self->_maximum;
502 if (REDA_Sequence_copy((
struct REDA_Sequence *)
self,
503 (
const struct REDA_Sequence *)src,
510 if (self->_contiguous_buffer != copy_buffer)
512 result = TSeq_map(self->_contiguous_buffer,T_initialize,0,self->_maximum-1);
520 for (i = 0; i < src->_length; i++)
522 if (!T_copy(&self->_contiguous_buffer[i],
523 (
const T*) &src->_contiguous_buffer[i]))
533 if ((copy_buffer != NULL) &&
534 (copy_buffer != self->_contiguous_buffer))
536 result = TSeq_map(copy_buffer,T_finalize,0,copy_max-1);
547 if (src->_element_size > 0)
549 self->_element_size =
sizeof(T);
551 return (
struct TSeq*)REDA_Sequence_copy((
struct REDA_Sequence *)
self,
552 (
const struct REDA_Sequence *)src,
557 #ifdef TSeq_isCDRStringType_no_max
559 TSeq_copy(
struct TSeq *
self,
const struct TSeq *src, RTI_UINT32 max_str_len)
561 #undef TSeq_copy_w_max
562 #define _copy_w_max(TSeq) concatenate(TSeq, _copy_w_max)
563 #define TSeq_copy_w_max _copy_w_max(TSeq)
565 TSeq_copy_w_max(
struct TSeq *
self,
const struct TSeq *src, RTI_UINT32 max_str_len)
575 OSAPI_PRECONDITION(
self == NULL,
577 OSAPI_Log_entry_add_int(
"max_str_len",(RTI_INT32)max_str_len,RTI_FALSE);
578 OSAPI_Log_entry_add_pointer(
"self",
self,RTI_TRUE);)
580 if (max_str_len < REDA_SEQUENCE_ELEMENT_ALLOC)
582 self->_flags |= REDA_SEQUENCE_FLAG_PTR_ALLOCATION;
585 copy_buffer =
self->_contiguous_buffer;
586 if (src->_element_size > 0)
588 self->_element_size =
sizeof(T);
591 copy_max =
self->_maximum;
595 if (REDA_Sequence_copy((
struct REDA_Sequence *)
self,
596 (
const struct REDA_Sequence *)src,
606 if (self->_contiguous_buffer != copy_buffer)
609 for (i = 0; i < copy_max; i++)
611 self->_contiguous_buffer[i] = copy_buffer[i];
616 result = TSeq_map_w_length(self->_contiguous_buffer,T_initialize,copy_max,self->_maximum-1,max_str_len);
622 result = TSeq_map_w_length(self->_contiguous_buffer,T_initialize,0,self->_maximum-1,max_str_len);
631 for (i = 0; i < src->_length; i++)
633 if (!T_copy(&self->_contiguous_buffer[i],
634 (
const T*) &src->_contiguous_buffer[i],
644 if ((copy_buffer != NULL) && (copy_buffer != self->_contiguous_buffer))
653 #ifndef TSeq_isCDRStringType_no_max
655 TSeq_copy(
struct TSeq *
self,
const struct TSeq *src)
657 if (self->_flags & REDA_SEQUENCE_FLAG_PTR_ALLOCATION)
659 return TSeq_copy_w_max(
self,src,REDA_SEQUENCE_ELEMENT_REPLACE);
663 return TSeq_copy_w_max(
self,src,REDA_SEQUENCE_ELEMENT_ALLOC);
673 #define _is_equal(TSeq) concatenate(TSeq, _is_equal)
674 #define TSeq_is_equal _is_equal(TSeq)
676 TSeq_is_equal(
const struct TSeq *left,
const struct TSeq *right)
682 result = REDA_Sequence_is_equal((
const struct REDA_Sequence*)left,
683 (
const struct REDA_Sequence*)right,RTI_FALSE);
689 for (i = 0; i < left->_length; i++)
691 if (T_compare((
const T*)&left->_contiguous_buffer[i],
692 (
const T*)&right->_contiguous_buffer[i]))
700 return REDA_Sequence_is_equal((
const struct REDA_Sequence *)left,
701 (
const struct REDA_Sequence *)right,RTI_TRUE);
708 #ifdef TSeq_loan_contiguous
709 #undef TSeq_loan_contiguous
710 #define _loan_contiguous(TSeq) concatenate(TSeq, _loan_contiguous)
711 #define TSeq_loan_contiguous _loan_contiguous(TSeq)
713 TSeq_loan_contiguous(
struct TSeq *
self,
void *buffer,
714 RTI_INT32 new_length, RTI_INT32 new_max)
716 return REDA_Sequence_loan_contiguous(
717 (
struct REDA_Sequence *)
self, buffer, new_length, new_max);
721 #ifdef TSeq_loan_discontiguous
722 #undef TSeq_loan_discontiguous
723 #define _loan_discontiguous(TSeq) concatenate(TSeq, _loan_discontiguous)
724 #define TSeq_loan_discontiguous _loan_discontiguous(TSeq)
726 TSeq_loan_discontiguous(
struct TSeq *
self,
void *buffer,
727 RTI_INT32 new_length, RTI_INT32 new_max)
729 return REDA_Sequence_loan_discontiguous(
730 (
struct REDA_Sequence *)
self, buffer, new_length, new_max);
735 #ifdef TSeq_has_ownership
736 #undef TSeq_has_ownership
737 #define _has_ownership(TSeq) concatenate(TSeq, _has_ownership)
738 #define TSeq_has_ownership _has_ownership(TSeq)
740 TSeq_has_ownership(
const struct TSeq *
self)
742 return REDA_Sequence_has_ownership((
const struct REDA_Sequence *)
self);
747 #ifdef TSeq_has_discontiguous_buffer
748 #undef TSeq_has_discontiguous_buffer
749 #define _has_discontiguous_buffer(TSeq) concatenate(TSeq, _has_discontiguous_buffer)
750 #define TSeq_has_discontiguous_buffer _has_discontiguous_buffer(TSeq)
752 TSeq_has_discontiguous_buffer(
const struct TSeq *
self)
754 return REDA_Sequence_has_discontiguous_buffer(
755 (
const struct REDA_Sequence *)
self);
758 #undef _has_discontiguous_buffer
759 #undef TSeq_has_discontiguous_buffer
763 #ifdef TSeq_get_contiguous_buffer
764 #undef TSeq_get_contiguous_buffer
765 #define _get_contiguous_buffer(TSeq) concatenate(TSeq, _get_contiguous_buffer)
766 #define TSeq_get_contiguous_buffer _get_contiguous_buffer(TSeq)
768 TSeq_get_contiguous_buffer(
const struct TSeq *
self)
770 return (T*)REDA_Sequence_get_buffer((
const struct REDA_Sequence *)
self);
772 #undef _get_contiguous_buffer
773 #undef TSeq_get_contiguous_buffer
776 #ifdef TSeq_get_discontiguous_buffer
777 #undef TSeq_get_discontiguous_buffer
778 #define _get_discontiguous_buffer(TSeq) concatenate(TSeq, TSeq_get_discontiguous_buffer)
779 #define TSeq_get_discontiguous_buffer _get_discontiguous_buffer(TSeq)
781 TSeq_get_discontiguous_buffer(
const struct TSeq *
self)
783 return (T*)REDA_Sequence_get_buffer((
const struct REDA_Sequence *)
self);
785 #undef _get_discontiguous_buffer
786 #undef TSeq_get_discontiguous_buffer
789 #ifdef TSeq_set_contiguous_buffer
790 #undef TSeq_set_contiguous_buffer
791 #define _set_contiguous_buffer(TSeq) concatenate(TSeq, _set_contiguous_buffer)
792 #define TSeq_set_contiguous_buffer _set_contiguous_buffer(TSeq)
794 TSeq_set_contiguous_buffer(
struct TSeq *
self, T *buffer)
796 return REDA_Sequence_set_buffer((
struct REDA_Sequence *)
self,
799 #undef _set_contiguous_buffer
800 #undef TSeq_set_contiguous_buffer
806 #define _unloan(TSeq) concatenate(TSeq, _unloan)
807 #define TSeq_unloan _unloan(TSeq)
809 TSeq_unloan(
struct TSeq *
self)
811 return REDA_Sequence_unloan((
struct REDA_Sequence *)
self);
815 #ifdef TSeq_set_token
816 #undef TSeq_set_token
817 #define _set_token(TSeq) concatenate(TSeq, _set_token)
818 #define TSeq_set_token _set_token(TSeq)
820 TSeq_set_token(
struct TSeq *
self,
void *token1,
void *token2)
822 REDA_Sequence_set_token((
struct REDA_Sequence *)
self,token1,token2);
825 #undef TSeq_set_token
828 #ifdef TSeq_get_token
829 #undef TSeq_get_token
830 #define _get_token(TSeq) concatenate(TSeq, _get_token)
831 #define TSeq_get_token _get_token(TSeq)
833 TSeq_get_token(
struct TSeq *
self,
void **token1,
void **token2)
835 REDA_Sequence_get_token((
struct REDA_Sequence *)
self,token1,token2);
838 #undef TSeq_get_token
841 #ifdef TSeq_ensure_length
842 #undef TSeq_ensure_length
843 #define _ensure_length(TSeq) concatenate(TSeq, _ensure_length)
844 #define TSeq_ensure_length _ensure_length(TSeq)
846 #ifndef TSeq_isCDRStringType
847 TSeq_ensure_length(
struct TSeq *
self,RTI_INT32 length, RTI_INT32 max)
849 #ifdef TSeq_isCDRStringType_no_max
850 TSeq_ensure_length(
struct TSeq *
self,RTI_INT32 length, RTI_INT32 max,
851 RTI_INT32 max_str_len)
853 #undef TSeq_ensure_length_w_max
854 #define _ensure_length_w_max(TSeq) concatenate(TSeq, _ensure_length_w_max)
855 #define TSeq_ensure_length_w_max _ensure_length_w_max(TSeq)
856 TSeq_ensure_length_w_max(
struct TSeq *
self,RTI_INT32 length, RTI_INT32 max,
857 RTI_INT32 max_str_len)
861 OSAPI_PRECONDITION((
self == NULL) || (length > max) ||
862 (length < 0) || (max < 0),
864 OSAPI_Log_entry_add_pointer(
"self",
self,RTI_FALSE);
865 OSAPI_Log_entry_add_int(
"length",length,RTI_FALSE);
866 OSAPI_Log_entry_add_int(
"max",max,RTI_TRUE);)
868 if (!TSeq_has_ownership(
self))
873 if (length > TSeq_get_maximum(
self))
875 #ifndef TSeq_isCDRStringType
876 if (!TSeq_set_maximum(
self, max))
877 #elif defined(TSeq_isCDRStringType_no_max)
878 if (!TSeq_set_maximum(
self, max,(RTI_UINT32)max_str_len))
880 if (!TSeq_set_maximum_w_max(
self, max,(RTI_UINT32)max_str_len))
887 return TSeq_set_length(
self, length);
890 #if defined(TSeq_isCDRStringType) && !defined(TSeq_isCDRStringType_no_max)
892 TSeq_ensure_length(
struct TSeq *
self,RTI_INT32 length, RTI_INT32 max)
894 return TSeq_ensure_length_w_max(
self,length,max,REDA_SEQUENCE_ELEMENT_ALLOC);
898 #undef _ensure_length
899 #undef TSeq_ensure_length
900 #undef _ensure_length_w_max
901 #undef TSeq_ensure_length_w_max
904 #ifdef TSeq_from_array
905 #undef TSeq_from_array
906 #define _from_array(TSeq) concatenate(TSeq, _from_array)
907 #define TSeq_from_array _from_array(TSeq)
908 REDADllExport RTI_BOOL
909 #ifndef TSeq_isCDRStringType
910 TSeq_from_array(
struct TSeq *
self,
const T elv[], RTI_INT32 length)
912 #ifdef TSeq_isCDRStringType_no_max
913 TSeq_from_array(
struct TSeq *
self,
const T elv[], RTI_INT32 length,RTI_INT32 max_str_length)
915 #undef TSeq_from_array_w_max
916 #define _from_array_w_max(TSeq) concatenate(TSeq, _from_array_w_max)
917 #define TSeq_from_array_w_max _from_array_w_max(TSeq)
918 TSeq_from_array_w_max(
struct TSeq *
self,
const T elv[], RTI_INT32 length,RTI_INT32 max_str_length)
923 struct TSeq elms_seq;
925 struct TSeq elms_seq = REDA_DEFINE_EMPTY_SEQUENCE_INITIALIZER;
927 if (!TSeq_initialize(&elms_seq))
933 OSAPI_PRECONDITION((
self == NULL) || (length < 0),
935 OSAPI_Log_entry_add_pointer(
"self",
self,RTI_FALSE);
936 OSAPI_Log_entry_add_int(
"length",length,RTI_TRUE););
939 if (!TSeq_loan_contiguous(&elms_seq, (T*)elv, length, length))
945 #ifndef TSeq_isCDRStringType
946 if (TSeq_copy(
self, &elms_seq) == NULL)
947 #elif defined(TSeq_isCDRStringType_no_max)
948 if (TSeq_copy(
self, &elms_seq,(RTI_UINT32)max_str_length) == NULL)
950 if (TSeq_copy_w_max(
self, &elms_seq,(RTI_UINT32)max_str_length) == NULL)
957 TSeq_unloan(&elms_seq);
962 #if defined(TSeq_isCDRStringType) && !defined(TSeq_isCDRStringType_no_max)
963 REDADllExport RTI_BOOL
964 TSeq_from_array(
struct TSeq *
self,
const T elv[], RTI_INT32 length)
966 return TSeq_from_array_w_max(
self,elv,length,REDA_SEQUENCE_ELEMENT_ALLOC);
971 #undef TSeq_from_array
972 #undef _from_array_w_max
973 #undef TSeq_from_array_w_max
979 #define _to_array(TSeq) concatenate(TSeq, _to_array)
980 #define TSeq_to_array _to_array(TSeq)
981 REDADllExport RTI_BOOL
982 #ifndef TSeq_isCDRStringType
983 TSeq_to_array(
struct TSeq *
self,T elv[], RTI_INT32 length)
985 #ifdef TSeq_isCDRStringType_no_max
986 TSeq_to_array(
struct TSeq *
self,T elv[], RTI_INT32 length,RTI_INT32 max_str_length)
988 #undef TSeq_to_array_w_max
989 #define _to_array_w_max(TSeq) concatenate(TSeq, _to_array_w_max)
990 #define TSeq_to_array_w_max _to_array_w_max(TSeq)
991 TSeq_to_array_w_max(
struct TSeq *
self,T elv[], RTI_INT32 length,RTI_INT32 max_str_length)
996 struct TSeq elms_seq;
998 struct TSeq elms_seq = REDA_DEFINE_EMPTY_SEQUENCE_INITIALIZER;
1000 if (!TSeq_initialize(&elms_seq))
1006 OSAPI_PRECONDITION((
self == NULL) || (length < 0),
1008 OSAPI_Log_entry_add_pointer(
"self",
self,RTI_FALSE);
1009 OSAPI_Log_entry_add_int(
"length",length,RTI_TRUE););
1012 if (!TSeq_loan_contiguous(&elms_seq, (T*)elv, length, length))
1018 #ifndef TSeq_isCDRStringType
1019 if (TSeq_copy(&elms_seq,
self) == NULL)
1020 #elif defined(TSeq_isCDRStringType_no_max)
1021 if (TSeq_copy(&elms_seq,
self,(RTI_UINT32)max_str_length) == NULL)
1023 if (TSeq_copy_w_max(&elms_seq,
self,(RTI_UINT32)max_str_length) == NULL)
1030 TSeq_unloan(&elms_seq);
1035 #if defined(TSeq_isCDRStringType) && !defined(TSeq_isCDRStringType_no_max)
1036 REDADllExport RTI_BOOL
1037 TSeq_to_array(
struct TSeq *
self,T elv[], RTI_INT32 length)
1039 return TSeq_to_array_w_max(
self,elv,length,REDA_SEQUENCE_ELEMENT_ALLOC);
1044 #undef TSeq_to_array
1045 #undef _to_array_w_max
1046 #undef TSeq_to_array_w_max
1051 #undef _map_w_length
1052 #undef TSeq_map_w_length
1054 #undef REDA_SEQUENCE_API
1057 #undef TSeq_isCDRStringType
1058 #undef TSeq_isCDRStringType_no_max
1063 #undef REDA_SEQUENCE_USER_API
1065 #undef TSeq_set_length
1067 #undef _set_maximum_w_max
1068 #undef TSeq_set_maximum
1069 #undef TSeq_set_maximum_w_max
1071 #undef TSeq_get_maximum
1075 #undef TSeq_copy_w_max
1076 #undef _loan_discontiguous
1077 #undef TSeq_loan_discontiguous
1080 #undef _loan_contiguous
1081 #undef TSeq_loan_contiguous
1082 #undef _has_ownership
1083 #undef TSeq_has_ownership
1085 #undef TSeq_initialize
1086 #undef TSeq_isCDRCharStringType