RTI Connext .Net APIs  Version 5.1.0
FooSeq Class Reference

<<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< E > DDS::Sequence< E >

Public Member Functions

 FooSeq ()
 Create a sequence with a maximum of 0.
 
 FooSeq (System::Int32 new_max)
 Create a sequence with the given maximum.
 
 FooSeq (FooSeq^ src)
 Create a sequence by copying from an existing sequence.
 
- Public Member Functions inherited from DDS::LoanableSequence< E >
virtual E get_at (System::Int32 i) overridesealed
 Get the i-th element for a const sequence.
 
virtual System::Boolean copy_from_no_alloc (Sequence< E >^src) overridesealed
 Copy elements from another sequence, only if the destination sequence has enough capacity.
 
virtual void unloan () overridesealed
 Return the loaned buffer in the sequence and set the maximum to 0.
 
- Public Member Functions inherited from DDS::Sequence< E >
System::Boolean ensure_length (System::Int32 length, System::Int32 max)
 Set the sequence to the desired length, and resize the sequence if necessary.
 
virtual void set_at (System::Int32 i, Eval)
 Set the i-th element of the sequence.
 
void loan (array< E >^buffer, System::Int32 new_length)
 Loan a contiguous buffer to this sequence.
 
void from_array (array< E >^arr)
 Copy elements from an array of elements, resizing the sequence if necessary. The original contents of the sequence (if any) are replaced.
 
void to_array (array< E >^arr)
 Copy elements to an array of elements. The original contents of the array (if any) are replaced.
 
System::Boolean copy_from (Sequence< E >^src_seq)
 Copy elements from another sequence, resizing the sequence if necessary.
 

Additional Inherited Members

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

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::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::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::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
Note
If the pre-conditions are not met, the constructor will initialize the new sequence to a maximum of zero.

RTI Connext .Net APIs Version 5.1.0 Copyright © Mon Feb 3 2014 Real-Time Innovations, Inc