RTI Connext Java API Version 7.3.0
|
Public Member Functions | |
final Class | getElementType () |
abstract void | add (int index, Object element) |
Inserts the specified element at the specified position in this sequence. More... | |
void | loan (Object buffer, int new_length) |
Loan a contiguous buffer to this sequence. More... | |
void | unloan () |
Return the loaned buffer in the sequence and set the maximum to 0. More... | |
final boolean | hasOwnership () |
Return the value of the owned flag. More... | |
final void | clear () |
final void | setSize (int newSize) |
final int | size () |
final Object | copy_from (Object src) |
![]() | |
void | setMaximum (int new_max) |
Resize this sequence to a new desired maximum. More... | |
Class | getElementType () |
void | add (int index, Object element) |
Inserts the specified element at the specified position in this sequence. More... | |
boolean | add (Object element) |
Appends the specified element to the end of this sequence. More... | |
final Object | remove (int index) |
Remove the element at the given index by shifting all subsequent elements "left" by one. More... | |
![]() | |
int | getMaximum () |
Get the current maximum number of elements that can be stored in this sequence. More... | |
void | setMaximum (int new_max) |
Resize this sequence to a new desired maximum. More... | |
Class | getElementType () |
Object | copy_from (Object src) |
Copy value of a data type from source. More... | |
A base class for sequences whose elements are of primitive types. Such sequences do not support null values.
final Class getElementType | ( | ) |
Reimplemented from AbstractSequence.
|
abstract |
Inserts the specified element at the specified position in this sequence.
Reimplemented from AbstractSequence.
Reimplemented in BooleanSeq, ByteSeq, CharSeq, DoubleSeq, FloatSeq, IntSeq, LongSeq, and ShortSeq.
void loan | ( | Object | buffer, |
int | new_length | ||
) |
Loan a contiguous buffer to this sequence.
This operation changes the owned
flag of the sequence to com.rti.dds.infrastructure.false and also sets the underlying buffer used by the sequence. See the User's Manual for more information about sequences and memory ownership.
Use this method if you want to manage the memory used by the sequence yourself. You must provide an array of elements and integers indicating how many elements are allocated in that array (i.e. the maximum) and how many elements are valid (i.e. the length). The sequence will subsequently use the memory you provide and will not permit it to be freed by a call to com.rti.dds.infrastructure.com.rti.dds.util.Sequence.Sequence.setMaximum.
By default, a sequence you create owns its memory unless you explicitly loan memory of your own to it. In a very few cases, RTI Connext will return a sequence to you that has a loan; those cases are documented as such. For example, if you call com.rti.ndds.example.FooDataReader.read or com.rti.ndds.example.FooDataReader.take and pass in sequences with no loan and no memory allocated, RTI Connext will loan memory to your sequences which must be unloaned with com.rti.ndds.example.FooDataReader.return_loan. See the documentation of those methods for more information.
buffer | The new buffer that the sequence will use. Must point to enough memory to hold new_max elements of type Foo. It may be NULL if new_max == 0. |
new_length | The desired new length for the sequence. |
References Sequence.getMaximum().
void unloan | ( | ) |
Return the loaned buffer in the sequence and set the maximum to 0.
This method affects only the state of this sequence; it does not change the contents of the buffer in any way.
Only the user who originally loaned a buffer should return that loan, as the user may have dependencies on that memory known only to them. Unloaning someone else's buffer may cause unspecified problems. For example, suppose a sequence is loaning memory from a custom memory pool. A user of the sequence likely has no way to release the memory back into the pool, so unloaning the sequence buffer would result in a resource leak. If the user were to then re-loan a different buffer, the original creator of the sequence would have no way to discover, when freeing the sequence, that the loan no longer referred to its own memory and would thus not free the user's memory properly, exacerbating the situation and leading to undefined behavior.
final boolean hasOwnership | ( | ) |
Return the value of the owned flag.
final void clear | ( | ) |
Set the logical size of this sequence to zero. This method does not generate any garbage for collection.
Referenced by AbstractPrimitiveSequence.copy_from().
final void setSize | ( | int | newSize | ) |
Set the logical size of this sequence to the given value.
newSize | the new logical size of this sequence; it must be less than or equal to the maximum allocated length of the underlying array. |
IndexOutOfBoundsException | if the new size is less than zero or greater than the allocated length of the array. |
References Sequence.getMaximum().
Referenced by DynamicData.get_uint8_seq(), DynamicData.get_uint_seq(), DynamicData.get_ushort_seq(), DynamicData.set_uint8_seq(), DynamicData.set_uint_seq(), DynamicData.set_ulong_seq(), DynamicData.set_ushort_seq(), and DynamicData.to_cdr_buffer().
final int size | ( | ) |
The logical size of this sequence.
Referenced by AbstractPrimitiveSequence.copy_from(), DynamicData.get_boolean_seq(), DynamicData.get_byte_seq(), DynamicData.get_char_seq(), DynamicData.get_double_seq(), DynamicData.get_float_seq(), DynamicData.get_int_seq(), DynamicData.get_long_seq(), DynamicData.get_short_seq(), DynamicData.get_uint8_seq(), DynamicData.get_uint_seq(), DynamicData.get_ulong_seq(), DynamicData.get_ushort_seq(), DynamicData.set_boolean_seq(), DynamicData.set_byte_seq(), DynamicData.set_char_seq(), DynamicData.set_double_seq(), DynamicData.set_float_seq(), DynamicData.set_int_seq(), DynamicData.set_long_seq(), DynamicData.set_short_seq(), DynamicData.set_uint8_seq(), DynamicData.set_uint_seq(), DynamicData.set_ulong_seq(), DynamicData.set_ushort_seq(), BytesDataWriter.write(), KeyedBytesDataWriter.write(), BytesDataWriter.write_w_timestamp(), and KeyedBytesDataWriter.write_w_timestamp().
final Object copy_from | ( | Object | src | ) |
Implementation of the Copyable
interface.
src | An AbstractPrimitiveSequence which contains the data to be copied. |
this
NullPointerException | If src is null. |
ClassCastException | If src is not a Sequence OR if one of the objects contained in the Sequence is not of the expected type. |
Implements Copyable.
References AbstractPrimitiveSequence.clear(), and AbstractPrimitiveSequence.size().
Referenced by WriteParams_t.copy_from(), and WriteParams_t.WriteParams_t().