30 #include "reda/reda_sequence.h"
32 #define concatenate(A, B) A ## B
38 #ifdef REDA_SEQUENCE_USER_API
39 #ifndef REDA_SEQUENCE_API
40 #define REDA_SEQUENCE_API REDA_SEQUENCE_API_USER_DEFAULT
42 #if REDA_SEQUENCE_API < REDA_SEQUENCE_API_BASIC
43 #error "REDA_SEQUENCE_USER_API defined along with API level < REDA_SEQUENCE_API_BASIC"
48 #ifndef REDA_SEQUENCE_API
49 #define REDA_SEQUENCE_API REDA_SEQUENCE_API_DEFAULT
52 #if REDA_SEQUENCE_API < REDA_SEQUENCE_API_UNTYPED
53 #error "REDA_SEQUENCE_API_UNTYPED <= REDA_SEQUENCE_API <= REDA_SEQUENCE_API_FULL"
57 #if REDA_SEQUENCE_API > REDA_SEQUENCE_API_UNTYPED
58 #ifndef TSeq_initialize
59 #define TSeq_initialize
61 #ifndef TSeq_get_maximum
62 #define TSeq_get_maximum
64 #ifndef TSeq_set_maximum
65 #define TSeq_set_maximum
67 #ifndef TSeq_get_length
68 #define TSeq_get_length
70 #ifndef TSeq_set_length
71 #define TSeq_set_length
73 #ifndef TSeq_get_reference
74 #define TSeq_get_reference
81 #ifdef REDA_SEQUENCE_USER_API
89 #if REDA_SEQUENCE_API > REDA_SEQUENCE_API_BASIC
96 #ifndef TSeq_loan_contiguous
97 #define TSeq_loan_contiguous
99 #ifndef TSeq_loan_discontiguous
100 #define TSeq_loan_discontiguous
102 #ifndef TSeq_has_ownership
103 #define TSeq_has_ownership
105 #ifndef TSeq_has_discontiguous_buffer
106 #define TSeq_has_discontiguous_buffer
108 #ifndef TSeq_get_contiguous_buffer
109 #define TSeq_get_contiguous_buffer
111 #ifndef TSeq_get_discontiguous_buffer
112 #define TSeq_get_discontiguous_buffer
114 #ifndef TSeq_set_contiguous_buffer
115 #define TSeq_set_contiguous_buffer
120 #ifndef TSeq_set_token
121 #define TSeq_set_token
123 #ifndef TSeq_get_token
124 #define TSeq_get_token
126 #ifndef TSeq_ensure_length
127 #define TSeq_ensure_length
129 #ifndef TSeq_from_array
130 #define TSeq_from_array
132 #ifndef TSeq_to_array
133 #define TSeq_to_array
137 #if REDA_SEQUENCE_API > REDA_SEQUENCE_API_FULL
138 #error "REDA_SEQUENCE_API_UNTYPED <= REDA_SEQUENCE_API <= REDA_SEQUENCE_API_FULL"
141 #if defined(T_copy) && !defined(T_initialize)
142 #error "T_copy defined without T_initialize"
145 #if defined(T_compare) && !defined(T_initialize)
146 #error "T_compare defined without T_initialize"
150 #if defined(TSeq_isCDRStringType) && (!defined(T_initialize) || !defined(T_finalize) || !defined(T_copy))
151 #error "TSeq_isCDRStringType defined without T_initialize/T_finalize/T_copy"
154 #if defined(TSeq_isCDRStringType) && (!defined(T_initialize) || !defined(T_copy))
155 #error "TSeq_isCDRStringType defined without T_initialize/T_copy"
159 #if defined(T_initialize) || defined(T_finalize) || defined(T_copy)
161 #if !(defined(TSeq_isCDRStringType) && defined(RTI_CERT))
163 #define _map(TSeq) concatenate(TSeq, _map)
164 #define TSeq_map _map(TSeq)
166 TSeq_map(T *buffer,RTI_BOOL(*map)(T*),RTI_INT32 begin, RTI_INT32 end)
170 for (i = begin; i <= end; i++)
172 if (!map(&buffer[i]))
183 #ifdef TSeq_isCDRStringType
184 #ifndef TSeq_map_w_length
185 #define _map_w_length(TSeq) concatenate(TSeq, _map_w_length)
186 #define TSeq_map_w_length _map_w_length(TSeq)
188 TSeq_map_w_length(T *buffer,RTI_BOOL(*map)(T*, RTI_UINT32),RTI_INT32 begin, RTI_INT32 end, RTI_UINT32 max_str_len)
192 for (i = begin; i <= end; i++)
194 if (!map(&buffer[i], max_str_len))
207 #ifdef TSeq_initialize
208 #undef TSeq_initialize
209 #define _initialize(TSeq) concatenate(TSeq, _initialize)
210 #define TSeq_initialize _initialize(TSeq)
212 TSeq_initialize(
struct TSeq *
self)
214 return REDA_Sequence_initialize((
struct REDA_Sequence*)
self,
sizeof(T));
220 #define _finalize(TSeq) concatenate(TSeq, _finalize)
221 #define TSeq_finalize _finalize(TSeq)
223 TSeq_finalize(
struct TSeq *
self)
227 result = TSeq_map(self->_contiguous_buffer,T_finalize,0,self->_maximum-1);
232 return REDA_Sequence_finalize((
struct REDA_Sequence*)
self);
234 return REDA_Sequence_finalize((
struct REDA_Sequence*)
self);
242 #ifdef TSeq_get_maximum
243 #undef TSeq_get_maximum
244 #define _get_maximum(TSeq) concatenate(TSeq, _get_maximum)
245 #define TSeq_get_maximum _get_maximum(TSeq)
247 TSeq_get_maximum(
const struct TSeq *
self)
249 return REDA_Sequence_get_maximum((
const struct REDA_Sequence *)
self);
253 #ifdef TSeq_set_maximum
254 #undef TSeq_set_maximum
255 #define _set_maximum(TSeq) concatenate(TSeq, _set_maximum)
256 #define TSeq_set_maximum _set_maximum(TSeq)
257 #ifndef TSeq_isCDRStringType
259 TSeq_set_maximum(
struct TSeq *
self, RTI_INT32 new_max)
264 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 result = REDA_Sequence_set_maximum((
struct REDA_Sequence*)
self,
290 result = TSeq_map(self->_contiguous_buffer,T_initialize,0,self->_maximum-1);
297 if (self->_length > 0)
301 for (i = 0; i < (new_max < copy_length ? new_max : copy_length); ++i)
303 if (!T_copy(&self->_contiguous_buffer[i],(
const T*)©_buffer[i]))
310 if (copy_buffer != NULL)
312 result = TSeq_map(copy_buffer,T_finalize,0,copy_max-1);
318 self->_element_size =
sizeof(T);
319 return REDA_Sequence_set_maximum((
struct REDA_Sequence*)
self, new_max,RTI_TRUE);
323 #ifdef TSeq_isCDRStringType_no_max
325 TSeq_set_maximum(
struct TSeq *
self, RTI_INT32 new_max, RTI_UINT32 max_str_len)
327 #undef TSeq_set_maximum_w_max
328 #define _set_maximum_w_max(TSeq) concatenate(TSeq, _set_maximum_w_max)
329 #define TSeq_set_maximum_w_max _set_maximum_w_max(TSeq)
331 TSeq_set_maximum_w_max(
struct TSeq *
self, RTI_INT32 new_max, RTI_UINT32 max_str_len)
341 OSAPI_PRECONDITION(
self == NULL,
343 OSAPI_Log_entry_add_int(
"max_str_len",(RTI_INT32)max_str_len,RTI_FALSE);
344 OSAPI_Log_entry_add_pointer(
"self",
self,RTI_TRUE);)
346 self->_element_size =
sizeof(T);
347 if (max_str_len < REDA_SEQUENCE_ELEMENT_ALLOC)
349 self->_flags |= REDA_SEQUENCE_FLAG_PTR_ALLOCATION;
352 old_max = REDA_Sequence_get_maximum((
const struct REDA_Sequence *)
self);
355 if (old_max == new_max)
361 copy_buffer =
self->_contiguous_buffer;
366 result = REDA_Sequence_set_maximum((
struct REDA_Sequence*)
self,
375 for (i = 0; i < ((old_max < new_max) ? old_max : new_max); i++)
377 self->_contiguous_buffer[i] = copy_buffer[i];
384 result = TSeq_map_w_length(self->_contiguous_buffer,T_initialize,old_max,new_max-1,max_str_len);
393 if (copy_buffer != NULL)
395 result = TSeq_map(copy_buffer,T_finalize,new_max,old_max-1);
402 #ifndef TSeq_isCDRStringType_no_max
404 TSeq_set_maximum(
struct TSeq *
self, RTI_INT32 new_max)
406 return TSeq_set_maximum_w_max(
self,new_max,REDA_SEQUENCE_ELEMENT_ALLOC);
413 #ifdef TSeq_get_length
414 #undef TSeq_get_length
415 #define _get_length(TSeq) concatenate(TSeq, _get_length)
416 #define TSeq_get_length _get_length(TSeq)
418 TSeq_get_length(
const struct TSeq *
self)
420 return REDA_Sequence_get_length((
const struct REDA_Sequence *)
self);
423 #undef TSeq_get_length
427 #ifdef TSeq_set_length
428 #undef TSeq_set_length
429 #define _set_length(TSeq) concatenate(TSeq, _set_length)
430 #define TSeq_set_length _set_length(TSeq)
432 TSeq_set_length(
struct TSeq *
self, RTI_INT32 new_length)
434 return REDA_Sequence_set_length((
struct REDA_Sequence *)
self, new_length);
438 #ifdef TSeq_get_reference
439 #undef TSeq_get_reference
440 #define _get_reference(TSeq) concatenate(TSeq, _get_reference)
441 #define TSeq_get_reference _get_reference(TSeq)
443 TSeq_get_reference(
const struct TSeq *
self, RTI_INT32 i)
445 return (T*)REDA_Sequence_get_reference((
const struct REDA_Sequence*)
self,i);
447 #undef _get_reference
448 #undef TSeq_get_reference
454 #define _copy(TSeq) concatenate(TSeq, _copy)
455 #define TSeq_copy _copy(TSeq)
456 #ifndef TSeq_isCDRStringType
458 TSeq_copy(
struct TSeq *
self,
const struct TSeq *src)
468 OSAPI_PRECONDITION(
self == NULL,
470 OSAPI_Log_entry_add_pointer(
"self",
self,RTI_TRUE);)
472 copy_buffer = self->_contiguous_buffer;
473 if (src->_element_size > 0)
475 self->_element_size =
sizeof(T);
478 copy_max =
self->_maximum;
482 if (REDA_Sequence_copy((
struct REDA_Sequence *)
self,
483 (
const struct REDA_Sequence *)src,
490 if (self->_contiguous_buffer != copy_buffer)
492 result = TSeq_map(self->_contiguous_buffer,T_initialize,0,self->_maximum-1);
500 for (i = 0; i < src->_length; i++)
502 if (!T_copy(&self->_contiguous_buffer[i],
503 (
const T*) &src->_contiguous_buffer[i]))
513 if ((copy_buffer != NULL) &&
514 (copy_buffer != self->_contiguous_buffer))
516 result = TSeq_map(copy_buffer,T_finalize,0,copy_max-1);
527 if (src->_element_size > 0)
529 self->_element_size =
sizeof(T);
531 return (
struct TSeq*)REDA_Sequence_copy((
struct REDA_Sequence *)
self,
532 (
const struct REDA_Sequence *)src,
537 #ifdef TSeq_isCDRStringType_no_max
539 TSeq_copy(
struct TSeq *
self,
const struct TSeq *src, RTI_UINT32 max_str_len)
541 #undef TSeq_copy_w_max
542 #define _copy_w_max(TSeq) concatenate(TSeq, _copy_w_max)
543 #define TSeq_copy_w_max _copy_w_max(TSeq)
545 TSeq_copy_w_max(
struct TSeq *
self,
const struct TSeq *src, RTI_UINT32 max_str_len)
555 OSAPI_PRECONDITION(
self == NULL,
557 OSAPI_Log_entry_add_int(
"max_str_len",(RTI_INT32)max_str_len,RTI_FALSE);
558 OSAPI_Log_entry_add_pointer(
"self",
self,RTI_TRUE);)
560 if (max_str_len < REDA_SEQUENCE_ELEMENT_ALLOC)
562 self->_flags |= REDA_SEQUENCE_FLAG_PTR_ALLOCATION;
565 copy_buffer =
self->_contiguous_buffer;
566 if (src->_element_size > 0)
568 self->_element_size =
sizeof(T);
571 copy_max =
self->_maximum;
575 if (REDA_Sequence_copy((
struct REDA_Sequence *)
self,
576 (
const struct REDA_Sequence *)src,
586 if (self->_contiguous_buffer != copy_buffer)
589 for (i = 0; i < copy_max; i++)
591 self->_contiguous_buffer[i] = copy_buffer[i];
596 result = TSeq_map_w_length(self->_contiguous_buffer,T_initialize,copy_max,self->_maximum-1,max_str_len);
602 result = TSeq_map_w_length(self->_contiguous_buffer,T_initialize,0,self->_maximum-1,max_str_len);
611 for (i = 0; i < src->_length; i++)
613 if (!T_copy(&self->_contiguous_buffer[i],
614 (
const T*) &src->_contiguous_buffer[i],
624 if ((copy_buffer != NULL) && (copy_buffer != self->_contiguous_buffer))
633 #ifndef TSeq_isCDRStringType_no_max
635 TSeq_copy(
struct TSeq *
self,
const struct TSeq *src)
637 if (self->_flags & REDA_SEQUENCE_FLAG_PTR_ALLOCATION)
639 return TSeq_copy_w_max(
self,src,REDA_SEQUENCE_ELEMENT_REPLACE);
643 return TSeq_copy_w_max(
self,src,REDA_SEQUENCE_ELEMENT_ALLOC);
653 #define _is_equal(TSeq) concatenate(TSeq, _is_equal)
654 #define TSeq_is_equal _is_equal(TSeq)
656 TSeq_is_equal(
const struct TSeq *left,
const struct TSeq *right)
662 result = REDA_Sequence_is_equal((
const struct REDA_Sequence*)left,
663 (
const struct REDA_Sequence*)right,RTI_FALSE);
669 for (i = 0; i < left->_length; i++)
671 if (T_compare((
const T*)&left->_contiguous_buffer[i],
672 (
const T*)&right->_contiguous_buffer[i]))
680 return REDA_Sequence_is_equal((
const struct REDA_Sequence *)left,
681 (
const struct REDA_Sequence *)right,RTI_TRUE);
688 #ifdef TSeq_loan_contiguous
689 #undef TSeq_loan_contiguous
690 #define _loan_contiguous(TSeq) concatenate(TSeq, _loan_contiguous)
691 #define TSeq_loan_contiguous _loan_contiguous(TSeq)
693 TSeq_loan_contiguous(
struct TSeq *
self,
void *buffer,
694 RTI_INT32 new_length, RTI_INT32 new_max)
696 return REDA_Sequence_loan_contiguous(
697 (
struct REDA_Sequence *)
self, buffer, new_length, new_max);
701 #ifdef TSeq_loan_discontiguous
702 #undef TSeq_loan_discontiguous
703 #define _loan_discontiguous(TSeq) concatenate(TSeq, _loan_discontiguous)
704 #define TSeq_loan_discontiguous _loan_discontiguous(TSeq)
706 TSeq_loan_discontiguous(
struct TSeq *
self,
void *buffer,
707 RTI_INT32 new_length, RTI_INT32 new_max)
709 return REDA_Sequence_loan_discontiguous(
710 (
struct REDA_Sequence *)
self, buffer, new_length, new_max);
715 #ifdef TSeq_has_ownership
716 #undef TSeq_has_ownership
717 #define _has_ownership(TSeq) concatenate(TSeq, _has_ownership)
718 #define TSeq_has_ownership _has_ownership(TSeq)
720 TSeq_has_ownership(
const struct TSeq *
self)
722 return REDA_Sequence_has_ownership((
const struct REDA_Sequence *)
self);
727 #ifdef TSeq_has_discontiguous_buffer
728 #undef TSeq_has_discontiguous_buffer
729 #define _has_discontiguous_buffer(TSeq) concatenate(TSeq, _has_discontiguous_buffer)
730 #define TSeq_has_discontiguous_buffer _has_discontiguous_buffer(TSeq)
732 TSeq_has_discontiguous_buffer(
const struct TSeq *
self)
734 return REDA_Sequence_has_discontiguous_buffer(
735 (
const struct REDA_Sequence *)
self);
738 #undef _has_discontiguous_buffer
739 #undef TSeq_has_discontiguous_buffer
743 #ifdef TSeq_get_contiguous_buffer
744 #undef TSeq_get_contiguous_buffer
745 #define _get_contiguous_buffer(TSeq) concatenate(TSeq, _get_contiguous_buffer)
746 #define TSeq_get_contiguous_buffer _get_contiguous_buffer(TSeq)
748 TSeq_get_contiguous_buffer(
const struct TSeq *
self)
750 return (T*)REDA_Sequence_get_buffer((
const struct REDA_Sequence *)
self);
752 #undef _get_contiguous_buffer
753 #undef TSeq_get_contiguous_buffer
756 #ifdef TSeq_get_discontiguous_buffer
757 #undef TSeq_get_discontiguous_buffer
758 #define _get_discontiguous_buffer(TSeq) concatenate(TSeq, TSeq_get_discontiguous_buffer)
759 #define TSeq_get_discontiguous_buffer _get_discontiguous_buffer(TSeq)
761 TSeq_get_discontiguous_buffer(
const struct TSeq *
self)
763 return (T*)REDA_Sequence_get_buffer((
const struct REDA_Sequence *)
self);
765 #undef _get_discontiguous_buffer
766 #undef TSeq_get_discontiguous_buffer
769 #ifdef TSeq_set_contiguous_buffer
770 #undef TSeq_set_contiguous_buffer
771 #define _set_contiguous_buffer(TSeq) concatenate(TSeq, _set_contiguous_buffer)
772 #define TSeq_set_contiguous_buffer _set_contiguous_buffer(TSeq)
774 TSeq_set_contiguous_buffer(
struct TSeq *
self, T *buffer)
776 return REDA_Sequence_set_buffer((
struct REDA_Sequence *)
self,
779 #undef _set_contiguous_buffer
780 #undef TSeq_set_contiguous_buffer
786 #define _unloan(TSeq) concatenate(TSeq, _unloan)
787 #define TSeq_unloan _unloan(TSeq)
789 TSeq_unloan(
struct TSeq *
self)
791 return REDA_Sequence_unloan((
struct REDA_Sequence *)
self);
795 #ifdef TSeq_set_token
796 #undef TSeq_set_token
797 #define _set_token(TSeq) concatenate(TSeq, _set_token)
798 #define TSeq_set_token _set_token(TSeq)
800 TSeq_set_token(
struct TSeq *
self,
void *token1,
void *token2)
802 REDA_Sequence_set_token((
struct REDA_Sequence *)
self,token1,token2);
805 #undef TSeq_set_token
808 #ifdef TSeq_get_token
809 #undef TSeq_get_token
810 #define _get_token(TSeq) concatenate(TSeq, _get_token)
811 #define TSeq_get_token _get_token(TSeq)
813 TSeq_get_token(
struct TSeq *
self,
void **token1,
void **token2)
815 REDA_Sequence_get_token((
struct REDA_Sequence *)
self,token1,token2);
818 #undef TSeq_get_token
821 #ifdef TSeq_ensure_length
822 #undef TSeq_ensure_length
823 #define _ensure_length(TSeq) concatenate(TSeq, _ensure_length)
824 #define TSeq_ensure_length _ensure_length(TSeq)
826 #ifndef TSeq_isCDRStringType
827 TSeq_ensure_length(
struct TSeq *
self,RTI_INT32 length, RTI_INT32 max)
829 #ifdef TSeq_isCDRStringType_no_max
830 TSeq_ensure_length(
struct TSeq *
self,RTI_INT32 length, RTI_INT32 max,
831 RTI_INT32 max_str_len)
833 #undef TSeq_ensure_length_w_max
834 #define _ensure_length_w_max(TSeq) concatenate(TSeq, _ensure_length_w_max)
835 #define TSeq_ensure_length_w_max _ensure_length_w_max(TSeq)
836 TSeq_ensure_length_w_max(
struct TSeq *
self,RTI_INT32 length, RTI_INT32 max,
837 RTI_INT32 max_str_len)
841 OSAPI_PRECONDITION((
self == NULL) || (length > max) ||
842 (length < 0) || (max < 0),
844 OSAPI_Log_entry_add_pointer(
"self",
self,RTI_FALSE);
845 OSAPI_Log_entry_add_int(
"length",length,RTI_FALSE);
846 OSAPI_Log_entry_add_int(
"max",max,RTI_TRUE);)
848 if (!TSeq_has_ownership(
self))
853 if (length > TSeq_get_maximum(
self))
855 #ifndef TSeq_isCDRStringType
856 if (!TSeq_set_maximum(
self, max))
857 #elif defined(TSeq_isCDRStringType_no_max)
858 if (!TSeq_set_maximum(
self, max,(RTI_UINT32)max_str_len))
860 if (!TSeq_set_maximum_w_max(
self, max,(RTI_UINT32)max_str_len))
867 return TSeq_set_length(
self, length);
870 #if defined(TSeq_isCDRStringType) && !defined(TSeq_isCDRStringType_no_max)
872 TSeq_ensure_length(
struct TSeq *
self,RTI_INT32 length, RTI_INT32 max)
874 return TSeq_ensure_length_w_max(
self,length,max,REDA_SEQUENCE_ELEMENT_ALLOC);
878 #undef _ensure_length
879 #undef TSeq_ensure_length
880 #undef _ensure_length_w_max
881 #undef TSeq_ensure_length_w_max
884 #ifdef TSeq_from_array
885 #undef TSeq_from_array
886 #define _from_array(TSeq) concatenate(TSeq, _from_array)
887 #define TSeq_from_array _from_array(TSeq)
888 REDADllExport RTI_BOOL
889 #ifndef TSeq_isCDRStringType
890 TSeq_from_array(
struct TSeq *
self,
const T elv[], RTI_INT32 length)
892 #ifdef TSeq_isCDRStringType_no_max
893 TSeq_from_array(
struct TSeq *
self,
const T elv[], RTI_INT32 length,RTI_INT32 max_str_length)
895 #undef TSeq_from_array_w_max
896 #define _from_array_w_max(TSeq) concatenate(TSeq, _from_array_w_max)
897 #define TSeq_from_array_w_max _from_array_w_max(TSeq)
898 TSeq_from_array_w_max(
struct TSeq *
self,
const T elv[], RTI_INT32 length,RTI_INT32 max_str_length)
903 struct TSeq elms_seq;
905 struct TSeq elms_seq = REDA_DEFINE_EMPTY_SEQUENCE_INITIALIZER;
907 if (!TSeq_initialize(&elms_seq))
913 OSAPI_PRECONDITION((
self == NULL) || (length < 0),
915 OSAPI_Log_entry_add_pointer(
"self",
self,RTI_FALSE);
916 OSAPI_Log_entry_add_int(
"length",length,RTI_TRUE););
919 if (!TSeq_loan_contiguous(&elms_seq, (T*)elv, length, length))
925 #ifndef TSeq_isCDRStringType
926 if (TSeq_copy(
self, &elms_seq) == NULL)
927 #elif defined(TSeq_isCDRStringType_no_max)
928 if (TSeq_copy(
self, &elms_seq,(RTI_UINT32)max_str_length) == NULL)
930 if (TSeq_copy_w_max(
self, &elms_seq,(RTI_UINT32)max_str_length) == NULL)
937 TSeq_unloan(&elms_seq);
942 #if defined(TSeq_isCDRStringType) && !defined(TSeq_isCDRStringType_no_max)
943 REDADllExport RTI_BOOL
944 TSeq_from_array(
struct TSeq *
self,
const T elv[], RTI_INT32 length)
946 return TSeq_from_array_w_max(
self,elv,length,REDA_SEQUENCE_ELEMENT_ALLOC);
951 #undef TSeq_from_array
952 #undef _from_array_w_max
953 #undef TSeq_from_array_w_max
959 #define _to_array(TSeq) concatenate(TSeq, _to_array)
960 #define TSeq_to_array _to_array(TSeq)
961 REDADllExport RTI_BOOL
962 #ifndef TSeq_isCDRStringType
963 TSeq_to_array(
struct TSeq *
self,T elv[], RTI_INT32 length)
965 #ifdef TSeq_isCDRStringType_no_max
966 TSeq_to_array(
struct TSeq *
self,T elv[], RTI_INT32 length,RTI_INT32 max_str_length)
968 #undef TSeq_to_array_w_max
969 #define _to_array_w_max(TSeq) concatenate(TSeq, _to_array_w_max)
970 #define TSeq_to_array_w_max _to_array_w_max(TSeq)
971 TSeq_to_array_w_max(
struct TSeq *
self,T elv[], RTI_INT32 length,RTI_INT32 max_str_length)
976 struct TSeq elms_seq;
978 struct TSeq elms_seq = REDA_DEFINE_EMPTY_SEQUENCE_INITIALIZER;
980 if (!TSeq_initialize(&elms_seq))
986 OSAPI_PRECONDITION((
self == NULL) || (length < 0),
988 OSAPI_Log_entry_add_pointer(
"self",
self,RTI_FALSE);
989 OSAPI_Log_entry_add_int(
"length",length,RTI_TRUE););
992 if (!TSeq_loan_contiguous(&elms_seq, (T*)elv, length, length))
998 #ifndef TSeq_isCDRStringType
999 if (TSeq_copy(&elms_seq,
self) == NULL)
1000 #elif defined(TSeq_isCDRStringType_no_max)
1001 if (TSeq_copy(&elms_seq,
self,(RTI_UINT32)max_str_length) == NULL)
1003 if (TSeq_copy_w_max(&elms_seq,
self,(RTI_UINT32)max_str_length) == NULL)
1010 TSeq_unloan(&elms_seq);
1015 #if defined(TSeq_isCDRStringType) && !defined(TSeq_isCDRStringType_no_max)
1016 REDADllExport RTI_BOOL
1017 TSeq_to_array(
struct TSeq *
self,T elv[], RTI_INT32 length)
1019 return TSeq_to_array_w_max(
self,elv,length,REDA_SEQUENCE_ELEMENT_ALLOC);
1024 #undef TSeq_to_array
1025 #undef _to_array_w_max
1026 #undef TSeq_to_array_w_max
1031 #undef _map_w_length
1032 #undef TSeq_map_w_length
1034 #undef REDA_SEQUENCE_API
1037 #undef TSeq_isCDRStringType
1038 #undef TSeq_isCDRStringType_no_max
1043 #undef REDA_SEQUENCE_USER_API
1045 #undef TSeq_set_length
1047 #undef _set_maximum_w_max
1048 #undef TSeq_set_maximum
1049 #undef TSeq_set_maximum_w_max
1051 #undef TSeq_get_maximum
1055 #undef TSeq_copy_w_max
1056 #undef _loan_discontiguous
1057 #undef TSeq_loan_discontiguous
1060 #undef _loan_contiguous
1061 #undef TSeq_loan_contiguous
1062 #undef _has_ownership
1063 #undef TSeq_has_ownership
1065 #undef TSeq_initialize
1066 #undef TSeq_isCDRCharStringType