RTI Connext .NET API (legacy)  Version 6.1.2

<<interface>> <<generic>> A type-safe, ordered collection of elements. The type of these elements is referred to in this documentation as Foo. More...

#include <managed_sequence.h>

Inheritance diagram for FooSeq:
DDS::LoanableSequence< Foo^> DDS::Sequence< Foo^ >

Public Member Functions

 FooSeq ()
 Create a sequence with a maximum of 0. More...
 
 FooSeq (System::Int32 new_max)
 Create a sequence with the given maximum. More...
 
 FooSeq (FooSeq^ src)
 Create a sequence by copying from an existing sequence. More...
 
- Public Member Functions inherited from DDS::Sequence< Foo^ >
System::Boolean ensure_length (System::Int32 length, System::Int32 max)
 Set the sequence to the desired length, and resize the sequence if necessary. More...
 
virtual void set_at (System::Int32 i, Foo^ val)
 Set the i-th element of the sequence. More...
 
void loan (array< Foo^ >^ buffer, System::Int32 new_length)
 Loan a contiguous buffer to this sequence. More...
 
void from_array (array< Foo^ >^ arr)
 Copy elements from an array of elements, resizing the sequence if necessary. The original contents of the sequence (if any) are replaced. More...
 
void to_array (array< Foo^ >^ arr)
 Copy elements to an array of elements. The original contents of the array (if any) are replaced. More...
 
System::Boolean copy_from (Sequence< Foo^ >^ src_seq)
 Copy elements from another sequence, resizing the sequence if necessary. More...
 

Additional Inherited Members

- Properties inherited from DDS::Sequence< Foo^ >
System::Int32 length [get, set]
 The logical length of this sequence. More...
 
virtual System::Int32 maximum [get, set]
 The current maximum number of elements that can be stored in this sequence. More...
 
array< Foo^ >^ buffer [get]
 Return the contiguous buffer of the sequence. More...
 
System::Boolean has_ownership [get]
 Return the value of the owned flag. More...
 

Detailed Description

<<interface>> <<generic>> A type-safe, ordered collection of elements. The type of these elements is referred to in this documentation as Foo.

For users who define data types in OMG IDL, this type corresponds to the IDL express sequence<Foo>.

For any user-data type Foo that an application defines for the purpose of data-distribution with RTI Connext, a FooSeq is generated. We refer to an IDL sequence<Foo> as FooSeq.

The state of a sequence is described by the properties 'maximum', 'length' and 'owned'.

  • The 'maximum' represents the size of the underlying buffer; this is the maximum number of elements it can possibly hold. It is returned by the DDS::Sequence::maximum operation.
  • The 'length' represents the actual number of elements it currently holds. It is returned by the DDS::Sequence::length operation.
  • The 'owned' flag represents whether the sequence owns the underlying buffer. It is returned by the DDS::Sequence::has_ownership operation. If the sequence does not own the underlying buffer, the underlying buffer is loaned from somewhere else. This flag influences the lifecycle of the sequence and what operations are allowed on it. The general guidelines are provided below and more details are described in detail as pre-conditions and post-conditions of each of the sequence's operations:
    • If owned == true, the sequence has ownership on the buffer. It is then responsible for destroying the buffer when the sequence is destroyed.

    • If the owned == false, the sequence does not have ownership on the buffer. This implies that the sequence is loaning the buffer. The sequence cannot be destroyed until the loan is returned.

    • A sequence with a zero maximum always has owned == true
See also
DDS::TypedDataWriter, DDS::TypedDataReader, FooTypeSupport, rtiddsgen

Constructor & Destructor Documentation

◆ FooSeq() [1/3]

FooSeq::FooSeq ( )

Create a sequence with a maximum of 0.

This is a constructor for the sequence. The constructor will allocate no memory.

This constructor will be used when the application creates a sequence using one of the following:

In C#:

FooSeq my_seq = new FooSeq();

In C++/CLI:

FooSeq^ my_seq = gcnew FooSeq();
Postcondition
maximum == 0
length == 0
owned == true,

◆ FooSeq() [2/3]

FooSeq::FooSeq ( System::Int32  new_max)

Create a sequence with the given maximum.

This is a constructor for the sequence. The constructor will automatically allocate memory to hold new_max elements of type Foo.

This constructor will be used when the application creates a sequence using one of the following:

In C#:

FooSeq my_seq = new FooSeq(5);

In C++/CLI:

FooSeq^ my_seq = gcnew FooSeq(5);
Postcondition
maximum == new_max
length == 0
owned == true,
Parameters
new_maxMust be >= 0. Otherwise the sequence will be initialized to a new_max=0.

◆ FooSeq() [3/3]

FooSeq::FooSeq ( FooSeq src)

Create a sequence by copying from an existing sequence.

This is a constructor for the sequence. The constructor will automatically allocate memory to hold foo_seq::maximum() elements of type Foo and will copy the current contents of foo_seq into the new sequence.

This constructor will be used when the application creates a sequence using one of the following:

In C#:

FooSeq my_seq = new FooSeq(foo_seq);

In C++/CLI:

FooSeq^ my_seq = gcnew FooSeq(foo_seq);
Postcondition
this::maximum == foo_seq::maximum
this::length == foo_seq::length
this[i] == foo_seq[i] for 0 <= i < foo_seq::length
this::owned == true