ADTF  3.18.2
sample_data< T, typename std::enable_if_t< std::is_trivially_copyable< T >::value > >

Easy data access for input samples for trivial types (see Supported types for adtf_memory<T> for writing and reading Samples) More...

Inheritance diagram for sample_data< T, typename std::enable_if_t< std::is_trivially_copyable< T >::value > >:
[legend]

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 flash::ISample > &pSample)
 copy CTOR More...
 
- Public Member Functions inherited from sample_data< T >
 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...
 
adtf_util::cVariant GetSampleInfo (const ISampleInfo::tHashKey &oHash, const adtf::util::cVariant oDefault=adtf::util::cVariant()) const
 Retrieves a variant value for the hash key oHash out of the samples sample information . More...
 

Private Types

using _base_type = flash::sample_data< T >
 

Detailed Description

template<typename T>
class adtf::streaming::penguin::sample_data< T, typename std::enable_if_t< std::is_trivially_copyable< T >::value > >

Easy data access for input samples for trivial types (see Supported types for adtf_memory<T> for writing and reading Samples)

Example Usage

{
LOG_INFO("sample value = %u", *adtf::streaming::sample_data<uint32_t>(pSample));
}
void process_sample_array(const adtf::ucom::iobject_ptr<const adtf::streaming::ISample>& pSample)
{
LOG_INFO("sample value[4] = %u", adtf::streaming::sample_data<std::array<uint32_t, 5>>(pSample).GetData()[4]);
}
void process_sample_vector(const adtf::ucom::iobject_ptr<const adtf::streaming::ISample>& pSample)
{
if (sample_data_vector.GetData().size() > 4)
{
LOG_INFO("sample value[4] = %u", adtf::streaming::sample_data<std::vector<uint32_t>>(pSample).GetData()[4]);
}
}
Copyright © Audi Electronics Venture GmbH.
const T & GetData() const
Retrieves a reference to the data.
Definition: sample_data.h:322
Easy data access for input samples of non trivial type @T (see Supported types for adtf_memory<T> for...
Definition: sample_data.h:428
Base object pointer to realize binary compatible reference counting in interface methods.

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 662 of file sample_data.h.

Constructor & Destructor Documentation

◆ sample_data() [1/3]

sample_data ( sample_data< T, typename std::enable_if_t< std::is_trivially_copyable< T >::value > > &&  oSampleData)
inline

move CTOR

Parameters
oSampleDataData to move from

Definition at line 680 of file sample_data.h.

◆ sample_data() [2/3]

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

copy CTOR

Parameters
pSampleSample to get the data from

Definition at line 686 of file sample_data.h.

◆ sample_data() [3/3]

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

copy CTOR

Parameters
pSampleSample to get the data from

Definition at line 692 of file sample_data.h.