CoreDX DDS C++ Reference Manual
Public Member Functions | List of all members
DDS::sequence< T > Class Template Reference

Sequence data type. More...

Public Member Functions

 sequence ()
 construct an empty sequence
 
 sequence (const sequence &x)
 copy constructor Copies sequence contents.
 
 ~sequence ()
 destroy the sequence and release resources. Destroys sequence contents.
 
sequenceoperator= (const sequence &x)
 assignment operator Copies seqeuence contents.
 
uint32_t size () const
 Returns the current size (number of elements) of the sequence.
 
uint32_t length () const
 alias for size()
 
uint32_t capacity () const
 Returns the current capacity (number of elements) of the sequence. The equation "size <= capacity" is always true.
 
bool reserve (uint32_t n)
 Set the capacity of the sequence. More...
 
bool resize (uint32_t n)
 Set the 'capacity' and 'size' of the sequence. More...
 
void maximum (uint32_t n)
 set the 'maximum' length of the sequence
 
uint32_t maximum () const
 set the 'maximum' length of the sequence
 
bool empty () const
 test if the sequence is empty
 
void shrink_to_fit ()
 reduce 'capacity' to match 'size'
 
void assign (T *buffer, uint32_t n)
 Caller provides an array of elements of size 'n'. The Sequence takes ownership of the memory. Note, 'buffer' must be allocated via new[].
 
T * release ()
 Release current sequence contents, caller takes ownership of the memory. If successful, the sequence is empty after this operation.
 
T & operator[] (uint32_t n)
 
const T & operator[] (uint32_t n) const
 
T & at (uint32_t n)
 
const T & at (uint32_t n) const
 
T & front ()
 
const T & front () const
 
T & back ()
 
const T & back () const
 
const T * buffer () const
 
void push_back (const T &v)
 
void pop_back ()
 
void swap (sequence &x)
 
void clear ()
 

Detailed Description

template<class T>
class DDS::sequence< T >

Sequence data type.

Provides an implementation of the Sequence data type. This data type is used in a few places throughout the DDS API.

It is most prevelant in the DataReader API where it is used to return a collection of samples and SampleInfo items back to the caller.

It is also used in a few QoS Policies.

Member Function Documentation

template<class T >
T & DDS::sequence< T >::at ( uint32_t  n)

access an element

template<class T >
const T & DDS::sequence< T >::at ( uint32_t  n) const

access an element

template<class T >
T & DDS::sequence< T >::back ( )

access the last element

template<class T >
const T & DDS::sequence< T >::back ( ) const

access the last element

template<class T >
const T * DDS::sequence< T >::buffer ( ) const

get access to underlying buffer

template<class T >
void DDS::sequence< T >::clear ( )

clear the contents of this sequence

template<class T >
T & DDS::sequence< T >::front ( )

access the first element

template<class T >
const T & DDS::sequence< T >::front ( ) const

access the first element

template<class T >
T & DDS::sequence< T >::operator[] ( uint32_t  n)

access an element

template<class T >
const T & DDS::sequence< T >::operator[] ( uint32_t  n) const

access an element

template<class T >
void DDS::sequence< T >::pop_back ( )

reduce 'size' by one

template<class T>
void DDS::sequence< T >::push_back ( const T &  v)

add an element after the last Increments 'size' (and possibly 'capacity') if requried.

template<class T >
bool DDS::sequence< T >::reserve ( uint32_t  n)

Set the capacity of the sequence.

If n is larger than current capacity, then the capacity is increased to 'n'. If 'n' is smaller than current capacity, then the capacity is reduced to 'n'. If capacity is reduced below 'size', then 'size' will be reduced to match 'capacity'. In the case of a reduction in 'size', the elimitated elements will be destroyed.

template<class T >
bool DDS::sequence< T >::resize ( uint32_t  n)

Set the 'capacity' and 'size' of the sequence.

If n is larger than current capacity, then the capacity is increased to 'n'. If 'n' is smaller than current capacity, then the capacity is reduced to 'n'. If capacity is reduced below 'size', then 'size' will be reduced to match 'capacity'. In the case of a reduction in 'size', the elimitated elements will be destroyed.

template<class T >
void DDS::sequence< T >::swap ( sequence< T > &  x)

swap the contents of this sequence with that of another


© 2009-2017 Twin Oaks Computing, Inc
Castle Rock, CO 80108
All rights reserved.