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

Holds a collection of sample data and related meta-data. More...

Public Types

typedef SampleIterator< T, false > iterator
 
typedef SampleIterator< T, true > const_iterator
 
typedef dds_type_traits< T >::SampleIteratorValueType value_type
 
typedef dds_type_traits< T >::ConstSampleIteratorValueType const_value_type
 
typedef std::ptrdiff_t difference_type
 

Public Member Functions

 LoanedSamples ()
 Default constructor.
 
 ~LoanedSamples () throw ()
 Destructor.
 
void release (DataReader &reader_ptr, Seq &data_seq, DDS::SampleInfoSeq &info_seq)
 Transfers the loan to the caller. More...
 
 LoanedSamples (LoanMemento loan_memento) throw ()
 Construct from a memento. Provides for efficient copy construction.
 
LoanedSamplesoperator= (LoanMemento loan_memento) throw ()
 Assignment operator that preserves loan ownership semantics.
 
Seq & data_seq ()
 Access the contained data sequence.
 
DDS::SampleInfoSeqinfo_seq ()
 Access the contained sample info sequence.
 
const Seq & data_seq () const
 Access the contained data sequence as const.
 
const DDS::SampleInfoSeqinfo_seq () const
 Access the contained sample info sequence as const.
 
value_type operator[] (size_t index)
 Access a specific element of the contained data sequence. The returned value will be of type SampleRef<T>.
 
const_value_type operator[] (size_t index) const
 Access a specific element of the contained data sequence as const The returned value will be of type SampleRef<const T>.
 
int length () const
 Access the length of the contained data sequence.
 
int size () const
 Access the length of the contained data sequence.
 
void return_loan ()
 Return the loaned data to the originating DataReader. More...
 
void swap (LoanedSamples &that) throw ()
 Swap contents and responsibility between this and 'that'.
 
SharedSamples< T > to_shared () throw ()
 Convert the LoanedSample sequences into a SharedSamples object. More...
 
iterator begin ()
 Obtain a SampleIterator object that refers to the beginning of the data sequence.
 
iterator end ()
 Obtain a SampleIterator object that refers to the end of the data sequence.
 
const_iterator begin () const
 Obtain a const SampleIterator object that refers to the beginning of the data sequence.
 
const_iterator end () const
 Obtain a const SampleIterator object that refers to the end of the data sequence.
 

Static Public Member Functions

static LoanedSamples< T > move_construct_from_loans (DataReader reader, Seq &data_seq, DDS::SampleInfoSeq &info_seq)
 Construct from loaned sample and sample info sequences. More...
 

Friends

LoanedSamples move (LoanedSamples &) throw ()
 move operator
 

Detailed Description

template<typename T>
class DDS::LoanedSamples< T >

Holds a collection of sample data and related meta-data.

The LoanedSamples object holds the loaned data and meta-data returned from a DataReader::read() operation. The object manages the 'loan' by automatically calling return_loan() on the source DataReader when the object is destroyed.

Member Typedef Documentation

template<typename T>
typedef SampleIterator<T, true> DDS::LoanedSamples< T >::const_iterator

const_iterator typedef

template<typename T>
typedef dds_type_traits<T>::ConstSampleIteratorValueType DDS::LoanedSamples< T >::const_value_type

const_value_type typedef. Is SampleRef<const T>

template<typename T>
typedef std::ptrdiff_t DDS::LoanedSamples< T >::difference_type

difference_type typedef

template<typename T>
typedef SampleIterator<T, false> DDS::LoanedSamples< T >::iterator

iterator typedef

template<typename T>
typedef dds_type_traits<T>::SampleIteratorValueType DDS::LoanedSamples< T >::value_type

value_type typedef. Is SampleRef<T>

Member Function Documentation

template<typename T>
static LoanedSamples<T> DDS::LoanedSamples< T >::move_construct_from_loans ( DataReader  reader,
Seq &  data_seq,
DDS::SampleInfoSeq info_seq 
)
static

Construct from loaned sample and sample info sequences.

Takes over responbility of the loan. Will return when destroyed or explicitly via 'return_loan()', or by transfering the responsibility via 'release()'.

See also
return_loan()
release()
template<typename T>
void DDS::LoanedSamples< T >::release ( DataReader &  reader_ptr,
Seq &  data_seq,
DDS::SampleInfoSeq info_seq 
)

Transfers the loan to the caller.

The LoanedSamples instance will no longer manage the loaned data. The caller is responsible for ensuring DataReader::return_loan() is invoked as required.

template<typename T>
void DDS::LoanedSamples< T >::return_loan ( )

Return the loaned data to the originating DataReader.

After this call, the LoanedSamples object no longer manages the data or sample info sequences.

template<typename T>
SharedSamples<T> DDS::LoanedSamples< T >::to_shared ( )
throw (
)

Convert the LoanedSample sequences into a SharedSamples object.

The SharedSamples object holds a reference to the data and sample info sequences.

See also
SharedSamples

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