ADTF
sample_data< T >

Sample Data getter for an easy use of samples with samplebuffer set to the type T. More...

Public Member Functions

 sample_data ()
 CTOR.
 
 sample_data (const sample_data &oSampleData)
 CTOR.
 
 sample_data (sample_data &&oSampleData)
 move CTOR More...
 
 sample_data (const ucom::iobject_ptr< const ISample > &pSample)
 copy CTOR More...
 
tTimeStamp GetTime () const
 retrieves the time of the data. More...
 
const T * GetDataPtr () const
 Retrieves the pointer to the datas memory. More...
 
const T GetData () const
 Retrieves the pointer to the datas memory as type T*. More...
 
bool IsValid () const
 Validate if sample and sample buffer is set. More...
 
 operator bool () const
 Validate if sample and sample buffer is set. More...
 
 operator T () const
 Convert the content of sample buffer as. More...
 
tResult Reset (const ucom::ant::iobject_ptr< const ISample > &pSample)
 Resets the sample the sample data reference to with a new reference to a sample. More...
 
tResult Reset ()
 Resets the sample the sample data reference to. More...
 

Protected Attributes

ucom::object_ptr< const ISamplem_pCurrentSample
 
ucom::object_ptr_shared_locked< const ISampleBufferm_pBuffer
 

Detailed Description

template<typename T>
class adtf::streaming::ant::sample_data< T >

Sample Data getter for an easy use of samples with samplebuffer set to the type T.

Template Parameters
Ttype of content of the samples sample buffer to get via GetData or sample_data::operator::T
Remarks
as long a sample data holds an reference to a sample the buffer is read locked !

Please use the newer versions (adtf::streaming::flash::sample_data) from the flash namespace.

See also
adtf::streaming::penguin::sample_data
adtf::streaming::flash::output_sample_data

Definition at line 32 of file sample_data.h.

Constructor & Destructor Documentation

◆ sample_data() [1/2]

sample_data ( sample_data< T > &&  oSampleData)
inline

move CTOR

Parameters
oSampleDataData to move from

Definition at line 49 of file sample_data.h.

◆ sample_data() [2/2]

sample_data ( const ucom::iobject_ptr< const ISample > &  pSample)
inline

copy CTOR

Parameters
pSampleSample to get the data from

Definition at line 56 of file sample_data.h.

References sample_data< T >::Reset().

Member Function Documentation

◆ GetData()

const T GetData ( ) const
inline

Retrieves the pointer to the datas memory as type T*.

Internally it gets the buffer pointer of the sample.

Returns
returns the pointer to the sample data.
Return values
nullptrno buffer set

Definition at line 100 of file sample_data.h.

References sample_data< T >::GetDataPtr().

◆ GetDataPtr()

const T* GetDataPtr ( ) const
inline

Retrieves the pointer to the datas memory.

Internally it gets the buffer pointer of the sample.

Returns
returns the pointer to the sample data.
Return values
nullptrno buffer set

Definition at line 84 of file sample_data.h.

Referenced by sample_data< T >::GetData(), and sample_data< T >::operator T().

◆ GetTime()

tTimeStamp GetTime ( ) const
inline

retrieves the time of the data.

Internally it gets the time of the sample.

Returns
returns the sample data time
Return values
-1no time set

Definition at line 68 of file sample_data.h.

◆ IsValid()

bool IsValid ( ) const
inline

Validate if sample and sample buffer is set.

Return values
trueis valid
falseis invalid

Definition at line 116 of file sample_data.h.

Referenced by sample_data< T >::operator bool(), and sample_data< T >::operator T().

◆ operator bool()

operator bool ( ) const
inline

Validate if sample and sample buffer is set.

Return values
trueis valid
falseis invalid

Definition at line 125 of file sample_data.h.

References sample_data< T >::IsValid().

◆ operator T()

operator T ( ) const
inline

Convert the content of sample buffer as.

Returns
the value of the sample buffer as T
Return values
T()if no sample buffer set
See also
IsValid

Definition at line 135 of file sample_data.h.

References sample_data< T >::GetDataPtr(), and sample_data< T >::IsValid().

◆ Reset() [1/2]

tResult Reset ( )
inline

Resets the sample the sample data reference to.

The reference will be empty.

Returns
standard result
Return values
ERR_NOERRORsample is reset
See also
IsValid

Definition at line 164 of file sample_data.h.

References object_ptr< T >::Reset(), and RETURN_NOERROR.

Referenced by sample_data< T >::sample_data().

◆ Reset() [2/2]

tResult Reset ( const ucom::ant::iobject_ptr< const ISample > &  pSample)
inline

Resets the sample the sample data reference to with a new reference to a sample.

Parameters
pSample[in] Reference to the sampel the sample data will reference to
Returns
standard result
Return values
ERR_NOERRORsample is reset
See also
IsValid

Definition at line 151 of file sample_data.h.

References RETURN_IF_FAILED, and RETURN_NOERROR.