ADTF  3.14.3
sample_data< T >

Easy data access for input samples. 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 ant::ISample > &pSample)
 copy CTOR More...
 
 sample_data (const ucom::iobject_ptr< const ISample > &pSample)
 
tTimeStamp GetTime () const
 retrieves the timestamp of the data. More...
 
adtf::base::flash::tNanoSeconds GetTimeNs () const
 retrieves the timestamp of the data. More...
 
const T * GetDataPtr () const
 Retrieves the pointer to the datas memory. More...
 
size_t GetDataSize () const
 
const T * operator-> ()
 Retrieves the pointer to the datas memory. More...
 
const T * operator-> () const
 Retrieves the pointer to the datas memory. More...
 
const T & GetData () const
 Retrieves a reference to the data. More...
 
const T & operator* () const
 Retrieves a reference to the data. More...
 
bool IsValid () const
 Validate if sample and sample buffer is set. More...
 
 operator const T & () const
 Return the content of sample buffer as a reference. More...
 
tResult Reset (const ucom::ant::iobject_ptr< const ant::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...
 

Private Attributes

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

Detailed Description

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

Easy data access for input samples.

Example Usage

{
LOG_INFO("sample value = %u", *adtf::streaming::sample_data<uint32_t>(pSample));
}
Copyright © Audi Electronics Venture GmbH.
Easy data access for input samples.
Definition: sample.h:499
Base object pointer to realize binary compatible reference counting in interface methods.
#define LOG_INFO(...)
Log a message with LogLevel Info.
Definition: log.h:123

or

struct tMyData
{
uint32_t nValue1;
uint32_t nValue2;
uint32_t nValue3;
};
{
LOG_INFO("my data = {%u, %u, %u}",
oMyData->nValue1,
oMyData->nValue2,
oMyData->nValue3);
}
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 !
See also
output_sample_data

Definition at line 498 of file sample.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 519 of file sample.h.

References a_util::memory::swap().

◆ sample_data() [2/2]

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

copy CTOR

Parameters
pSampleSample to get the data from

Definition at line 526 of file sample.h.

Member Function Documentation

◆ GetData()

const T& GetData ( ) const
inline

Retrieves a reference to the data.

Internally it gets the buffer pointer of the sample.

Returns
returns a reference to the sample data.
Return values
T()if not valid.

Definition at line 629 of file sample.h.

◆ 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
nullptrif no buffer set

Definition at line 578 of file sample.h.

◆ GetDataSize()

size_t GetDataSize ( ) const
inline
Returns
The size of the buffer that the data resides in.

Definition at line 593 of file sample.h.

◆ GetTime()

tTimeStamp GetTime ( ) const
inline

retrieves the timestamp of the data.

Internally it gets the time of the sample.

Returns
returns the sample time
Return values
-1if not valid.

Definition at line 544 of file sample.h.

◆ GetTimeNs()

adtf::base::flash::tNanoSeconds GetTimeNs ( ) const
inline

retrieves the timestamp of the data.

Internally it gets the time of the sample.

Returns
returns the sample time
Return values
-1if not valid.

Definition at line 561 of file sample.h.

References adtf::streaming::giant::get_sample_time().

◆ IsValid()

bool IsValid ( ) const
inline

Validate if sample and sample buffer is set.

Return values
trueis valid
falseis invalid

Definition at line 655 of file sample.h.

◆ operator const T &()

operator const T & ( ) const
inline

Return the content of sample buffer as a reference.

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

Definition at line 666 of file sample.h.

◆ operator*()

const T& operator* ( ) const
inline

Retrieves a reference to the data.

Internally it gets the buffer pointer of the sample.

Returns
returns a reference to the sample data.
Return values
T()if not valid.

Definition at line 645 of file sample.h.

◆ operator->() [1/2]

const T* operator-> ( )
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
nullptrif no buffer set

Definition at line 608 of file sample.h.

◆ operator->() [2/2]

const T* operator-> ( ) 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
nullptrif no buffer set

Definition at line 616 of file sample.h.

◆ 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 691 of file sample.h.

References object_ptr< T >::Reset().

◆ Reset() [2/2]

tResult Reset ( const ucom::ant::iobject_ptr< const ant::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 678 of file sample.h.

References RETURN_IF_FAILED.


Copyright © Audi Electronics Venture GmbH. All rights reserved. (Generated on Thu Jun 9 2022 by doxygen 1.9.1)