RTI Connext Cert C API
Version 2.4.15
|
Defines sequence interface and primitive data types sequences. More...
Data Structures | |
struct | FooSeq |
<<interface>> <<generic>> <<cert>> A type-safe, ordered collection of elements. The type of these elements is referred to in this documentation as "Foo" . More... |
Macros | |
#define | DDS_SEQUENCE_INITIALIZER |
An initializer for new sequence instances. |
Functions | |
DDS_Boolean | FooSeq_initialize (struct FooSeq *self) |
<<cert>> Initialize sequence instances. | |
DDS_Long | FooSeq_get_maximum (const struct FooSeq *self) |
<<cert>> Get the current maximum number of elements that can be stored in this sequence. | |
DDS_Boolean | FooSeq_set_maximum (struct FooSeq *self, DDS_Long new_max) |
<<cert>> Resize this sequence to a new desired maximum. | |
DDS_Long | FooSeq_get_length (const struct FooSeq *self) |
<<cert>> Get the logical length of this sequence. | |
DDS_Boolean | FooSeq_set_length (struct FooSeq *self, DDS_Long new_length) |
<<cert>> Change the length of this sequence. | |
Foo * | FooSeq_get_reference (const struct FooSeq *self, DDS_Long i) |
<<cert>> Get the pointer to the i-th element of this sequence. | |
struct FooSeq * | FooSeq_copy (struct FooSeq *self, const struct FooSeq *src_seq) |
Copy elements from another sequence, resizing the sequence if necessary. |
Defines sequence interface and primitive data types sequences.
#define DDS_SEQUENCE_INITIALIZER |
An initializer for new sequence instances.
This constant will initialize a new sequence to a valid empty state. C language users should assign it to uninitialized sequence instances before using them, at the time they are declared, or use FooSeq_initialize as an alternative function to initialize new sequences.
DDS_Boolean FooSeq_initialize | ( | struct FooSeq * | self | ) |
<<cert>> Initialize sequence instances.
Use this function to initialize new sequences to a valid emptu state. C users should initialize sequences before using them.
self | <<in>> Cannot be NULL. |
<<cert>> Get the current maximum number of elements that can be stored in this sequence.
The maximum
of the sequence represents the maximum number of elements that the underlying buffer can hold. It does not represent the current number of elements.
The maximum
is a non-negative number. It is initialized when the sequence is first created and can only be changed by mean of the FooSeq_set_maximum operation.
self | <<in>> Cannot be NULL. |
DDS_Boolean FooSeq_set_maximum | ( | struct FooSeq * | self, |
DDS_Long | new_max | ||
) |
<<cert>> Resize this sequence to a new desired maximum.
This operation does nothing if the new desired maximum matches the current maximum.
If this sequence owns its buffer and the new maximum is not equal to the old maximum, then the existing buffer will be freed and re-allocated.
self | <<in>> Cannot be NULL. |
new_max | Must be >= 0. |
DDS_Boolean FooSeq_set_length | ( | struct FooSeq * | self, |
DDS_Long | new_length | ||
) |
<<cert>> Change the length of this sequence.
This function does not allocate/deallocate memory.
The new length must not exceed the maximum of this sequence as returned by the FooSeq_get_maximum operation. (Note that, if necessary, the maximum of this sequence can be increased manually by using the FooSeq_set_maximum operation.)
The elements of the sequence are not modified by this operation. If the new length is larger than the original length, the new elements will be uninitialized; if the length is decreased, the old elements that are beyond the new length will physically remain in the sequence but will not be accessible.
self | <<in>> Cannot be NULL. |
new_length | the new desired length. This value must be non-negative and cannot exceed maximum of the sequence. In other words 0 <= new_length <= maximum |
<<cert>> Get the pointer to the i-th
element of this sequence.
self | <<in>> Cannot be NULL. |
i | index of element to access, must be >= 0 and less than FooSeq_get_length |
i-th
element Copy elements from another sequence, resizing the sequence if necessary.
This function invokes copies the content of the specified sequence, after ensuring that this sequence has enough capacity to hold the elements to be copied.
It is important to know that no check for overlapping memory regions is performed, and copying sequences with overlapping memory regions has undefined behavior. For example, copying two string sequences where the strings are overlapping has undefined behavior.
RTI Connext Micro does not create overlapping memory regions.
NOTE: If this function is called on a sequence that has been created with set_maxium_w_max or ensure_length_w_max, it will automatically call copy_w_max().
self
, this sequence