32 #ifndef reda_sequence_h
33 #define reda_sequence_h
51 #define REDA_DEFINE_SEQUENCE_MEMBERS(_TSeq,_T) \
52 _T* _contiguous_buffer;\
55 RTI_INT32 _element_size;\
67 #define REDA_DEFINE_SEQUENCE_OVERLOADED_METHODS(_TSeq,_T)\
69 _TSeq(const _TSeq& seq); \
70 _TSeq& operator=(const _TSeq& src_seq);
72 #define REDA_DEFINE_SEQUENCE_OVERLOADED_METHODS(_TSeq,_T)\
74 _TSeq(const _TSeq& seq); \
75 _TSeq& operator=(const _TSeq& src_seq);
78 #define REDA_DEFINE_SEQUENCE_METHODS(_TSeq,_T)\
80 RTI_INT32 maximum() const; \
81 bool maximum(RTI_INT32 new_max); \
82 RTI_INT32 length() const; \
83 bool length(RTI_INT32 new_length); \
84 _T* get_reference(RTI_INT32 i); \
85 bool copy(const _TSeq& src_seq); \
86 bool is_equal(const _TSeq& other); \
87 bool loan_contiguous(void* buffer, RTI_INT32 new_length, RTI_INT32 new_max); \
88 bool loan_discontiguous(void* buffer, RTI_INT32 new_length, RTI_INT32 new_max); \
90 bool has_ownership(); \
91 _T* get_buffer() const; \
92 bool set_buffer(_T* buffer); \
93 bool has_discontiguous_buffer(); \
94 void set_token(void *token1,void *token2); \
95 void get_token(void **token1,void **token2); \
98 REDA_DEFINE_SEQUENCE_OVERLOADED_METHODS(_TSeq,_T)
101 #define REDA_DEFINE_SEQUENCE_METHODS(_TSeq,_T)
104 #if defined(RTI_WIN32) || defined(RTI_WINCE30)
105 #ifdef RTI_EXPORT_REDA_SEQUENCE
109 #define REDADllExport __declspec( dllexport )
113 #define REDA_DEFINE_SEQUENCE_STRUCT(_TSeq,_T) \
114 struct REDADllExport _TSeq {\
115 REDA_DEFINE_SEQUENCE_MEMBERS(_TSeq,_T)\
117 REDA_DEFINE_SEQUENCE_METHODS(_TSeq,_T)\
121 #define REDA_DEFINE_SEQUENCE_IN_C(TSeq, T) \
123 RTI_BOOL TSeq ## _initialize(struct TSeq* self); \
126 RTI_BOOL TSeq ## _finalize(struct TSeq* self); \
129 RTI_INT32 TSeq ## _get_maximum(const struct TSeq* self); \
132 RTI_BOOL TSeq ## _set_maximum(struct TSeq* self, RTI_INT32 new_max); \
135 RTI_INT32 TSeq ## _get_length(const struct TSeq *self); \
138 RTI_BOOL TSeq ## _set_length(struct TSeq *self, RTI_INT32 new_length);\
141 T* TSeq ## _get_reference(const struct TSeq* self, RTI_INT32 i); \
144 struct TSeq* TSeq ## _copy(struct TSeq* self, const struct TSeq* src); \
147 RTI_BOOL TSeq ## _is_equal(const struct TSeq* self, const struct TSeq* src); \
150 RTI_BOOL TSeq ## _loan_contiguous(struct TSeq* self, void *buffer, \
151 RTI_INT32 new_length, RTI_INT32 new_max); \
154 RTI_BOOL TSeq ## _loan_discontiguous(struct TSeq* self, void *buffer, \
155 RTI_INT32 new_length, RTI_INT32 new_max); \
158 RTI_BOOL TSeq ## _unloan(struct TSeq *self); \
161 RTI_BOOL TSeq ## _has_ownership(const struct TSeq* self); \
164 T* TSeq ## _get_buffer(const struct TSeq* self); \
167 RTI_BOOL TSeq ## _set_buffer(struct TSeq* self, T *buffer); \
170 RTI_BOOL TSeq ## _has_discontiguous_buffer(const struct TSeq* self); \
173 void TSeq ## _set_token(struct TSeq* self, void *token1,void *token2); \
176 void TSeq ## _get_token(struct TSeq* self, void **token1,void **token2);
178 #define REDA_DEFINE_SEQUENCE(_TSeq,_T) \
179 REDA_DEFINE_SEQUENCE_STRUCT(_TSeq,_T) \
180 REDA_DEFINE_SEQUENCE_IN_C(_TSeq,_T)
182 #define REDA_DEFINE_STRING_SEQUENCE_IN_C(TSeq, T) \
184 RTI_BOOL TSeq ## _initialize(struct TSeq* self); \
187 RTI_BOOL TSeq ## _finalize(struct TSeq* self); \
190 RTI_INT32 TSeq ## _get_maximum(const struct TSeq* self); \
193 RTI_BOOL TSeq ## _set_maximum(struct TSeq* self, RTI_INT32 new_max, \
194 RTI_UINT32 max_str_len); \
197 RTI_INT32 TSeq ## _get_length(const struct TSeq *self); \
200 RTI_BOOL TSeq ## _set_length(struct TSeq *self, RTI_INT32 new_length);\
203 T* TSeq ## _get_reference(const struct TSeq* self, RTI_INT32 i); \
206 struct TSeq* TSeq ## _copy(struct TSeq* self, const struct TSeq* src, \
207 RTI_UINT32 max_str_len); \
210 RTI_BOOL TSeq ## _is_equal(const struct TSeq* self, const struct TSeq* src); \
213 RTI_BOOL TSeq ## _loan_contiguous(struct TSeq* self, void *buffer, \
214 RTI_INT32 new_length, RTI_INT32 new_max); \
217 RTI_BOOL TSeq ## _loan_discontiguous(struct TSeq* self, void *buffer, \
218 RTI_INT32 new_length, RTI_INT32 new_max); \
221 RTI_BOOL TSeq ## _unloan(struct TSeq *self); \
224 RTI_BOOL TSeq ## _has_ownership(const struct TSeq* self); \
227 T* TSeq ## _get_buffer(const struct TSeq* self); \
230 RTI_BOOL TSeq ## _set_buffer(struct TSeq* self, T *buffer); \
233 RTI_BOOL TSeq ## _has_discontiguous_buffer(const struct TSeq* self); \
236 void TSeq ## _set_token(struct TSeq* self, void *token1,void *token2); \
239 void TSeq ## _get_token(struct TSeq* self, void **token1,void **token2);
241 #define REDA_DEFINE_STRING_SEQUENCE(_TSeq,_T) \
242 REDA_DEFINE_SEQUENCE_STRUCT(_TSeq,_T) \
243 REDA_DEFINE_STRING_SEQUENCE_IN_C(_TSeq,_T)
245 #define REDA_DEFINE_SEQUENCE_INITIALIZER(t_) \
246 { NULL,0,0,sizeof(t_),0,NULL,NULL }
248 #define REDA_DEFINE_EMPTY_SEQUENCE_INITIALIZER \
249 { NULL,0,0,0,0,NULL,NULL }
251 struct REDA_Sequence;
256 #define REDA_SEQUENCE_FLAG_LOAN 0x01
261 #define REDA_SEQUENCE_FLAG_DISCONTIGUOUS 0x02
277 MUST_CHECK_RETURN REDADllExport
RTI_BOOL
278 REDA_Sequence_initialize(
struct REDA_Sequence *
self, RTI_INT32 element_size);
293 SHOULD_CHECK_RETURN REDADllExport
RTI_BOOL
294 REDA_Sequence_finalize(
struct REDA_Sequence *
self);
310 REDADllExport RTI_INT32
311 REDA_Sequence_get_maximum(
const struct REDA_Sequence *
self);
339 MUST_CHECK_RETURN REDADllExport
RTI_BOOL
340 REDA_Sequence_set_maximum(
struct REDA_Sequence *
self, RTI_INT32 new_max,
356 REDADllExport RTI_INT32
357 REDA_Sequence_get_length(
const struct REDA_Sequence *
self);
376 MUST_CHECK_RETURN REDADllExport
RTI_BOOL
377 REDA_Sequence_set_length(
struct REDA_Sequence *
self, RTI_INT32 new_length);
394 MUST_CHECK_RETURN REDADllExport
void*
395 REDA_Sequence_get_buffer(
const struct REDA_Sequence *
self);
414 MUST_CHECK_RETURN REDADllExport
RTI_BOOL
415 REDA_Sequence_set_buffer(
struct REDA_Sequence *
self,
void *buffer);
432 MUST_CHECK_RETURN REDADllExport
void*
433 REDA_Sequence_get_reference(
const struct REDA_Sequence *
self,RTI_INT32 index);
461 MUST_CHECK_RETURN REDADllExport
struct REDA_Sequence*
462 REDA_Sequence_copy(
struct REDA_Sequence *
self,
463 const struct REDA_Sequence *src,
490 REDA_Sequence_is_equal(
const struct REDA_Sequence *left,
491 const struct REDA_Sequence *right,
514 MUST_CHECK_RETURN REDADllExport
RTI_BOOL
515 REDA_Sequence_loan_contiguous(
struct REDA_Sequence *
self,
void *buffer,
516 RTI_INT32 new_length, RTI_INT32 new_max);
539 MUST_CHECK_RETURN REDADllExport
RTI_BOOL
540 REDA_Sequence_loan_discontiguous(
struct REDA_Sequence *
self,
void *buffer,
541 RTI_INT32 new_length, RTI_INT32 new_max);
555 MUST_CHECK_RETURN REDADllExport
RTI_BOOL
556 REDA_Sequence_unloan(
struct REDA_Sequence *
self);
572 REDA_Sequence_has_ownership(
const struct REDA_Sequence *
self);
588 REDA_Sequence_has_discontiguous_buffer(
const struct REDA_Sequence *
self);
604 REDA_Sequence_set_token(
struct REDA_Sequence *
self,
void *token1,
void *token2);
620 REDA_Sequence_get_token(
const struct REDA_Sequence *
self,
void **token1,
void **token2);