ADTF  3.14.3
output_sample_data< T >

Wrapper class that facilitates the handling of output samples. More...

Public Member Functions

 output_sample_data (base::flash::tNanoSeconds tmSampleTime)
 Initializes the data timestamp. More...
 
 output_sample_data (tTimeStamp tmSampleTime)
 Initializes the data timestamp. More...
 
 output_sample_data (base::flash::tNanoSeconds tmSampleTime, const T &oValue)
 Initializes the data timestamp and value. More...
 
 output_sample_data (base::flash::tNanoSeconds tmSampleTime, const T &oValue, uint32_t nSubStreamId)
 
 output_sample_data (tTimeStamp tmSampleTime, const T &oValue)
 Initializes the data timestamp and value. More...
 
 output_sample_data (const ant::ISample &oSampleToCopy)
 Initializes the data from an existing sample. More...
 
 output_sample_data (const ucom::ant::iobject_ptr< const ant::ISample > &pSampleToCopy)
 Initializes the data from an existing sample. More...
 
 output_sample_data (output_sample_data &&)=default
 
output_sample_dataoperator= (output_sample_data &&)=default
 
void SetSubStreamId (uint32_t nSubStreamId)
 Sets the Substream id of the generated sample. More...
 
T * GetDataPtr ()
 
const T * GetDataPtr () const
 
T * operator-> ()
 
const T * operator-> () const
 
T & GetData ()
 
const T & GetData () const
 
T & operator* ()
 
const T & operator* () const
 
output_sample_dataoperator= (const T &oValue)
 Assigns a new value to the data. More...
 
 operator T& ()
 
 operator const T & () const
 
ucom::ant::object_ptr< ant::ISampleRelease ()
 Returns a sample that contains the data and resets all internal data. More...
 

Protected Attributes

ucom::ant::object_ptr< ant::ISamplem_pSample
 
ucom::ant::object_ptr_locked< ant::ISampleBufferm_pBuffer
 

Private Member Functions

 output_sample_data (const output_sample_data &)=delete
 
output_sample_dataoperator= (const output_sample_data &)=delete
 

Detailed Description

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

Wrapper class that facilitates the handling of output samples.

Use one of its constructors to initialize the data, then update it and finally call Release() to retrieve a sample that you can write via ISampleWriter::Write().

See also
sample_data

Definition at line 709 of file sample.h.

Constructor & Destructor Documentation

◆ output_sample_data() [1/6]

output_sample_data ( base::flash::tNanoSeconds  tmSampleTime)
inlineexplicit

Initializes the data timestamp.

Example Usage

void generate_data(adtf::streaming::ISampleWriter* pWriter)
{
oOutputData = 54321;
pWriter->Write(oOutputData.Release());
}
Copyright © Audi Electronics Venture GmbH.
Interface for sample writers that write to sample streams via output pins.
virtual tResult Write(const ucom::ant::iobject_ptr< const ant::ISample > &pSample)=0
Writes a sample to the connected sample stream.
Wrapper class that facilitates the handling of output samples.
Definition: sample.h:710
ucom::ant::object_ptr< ant::ISample > Release()
Returns a sample that contains the data and resets all internal data.
Definition: sample.h:945

or

struct tMyData
{
uint32_t nValue1;
uint32_t nValue2;
uint32_t nValue3;
};
void generate_data(adtf::streaming::ISampleWriter* pWriter)
{
oOutputData = {1, 2};
oOutputData->nValue3 = 3;
pWriter->Write(oOutputData.Release());
}
Parameters
[in]tmSampleTimeThe timestamp.
Exceptions
tResultIn case of an error.

Definition at line 726 of file sample.h.

References adtf::streaming::ant::alloc_sample(), and THROW_IF_FAILED.

◆ output_sample_data() [2/6]

output_sample_data ( tTimeStamp  tmSampleTime)
inlineexplicit

Initializes the data timestamp.

Parameters
[in]tmSampleTimeThe timestamp.
Exceptions
tResultIn case of an error.

Definition at line 737 of file sample.h.

References adtf::streaming::ant::alloc_sample(), and THROW_IF_FAILED.

◆ output_sample_data() [3/6]

output_sample_data ( base::flash::tNanoSeconds  tmSampleTime,
const T &  oValue 
)
inline

Initializes the data timestamp and value.

Example Usage

void generate_data(adtf::streaming::ISampleWriter* pWriter)
{
pWriter->Write(oOutputData.Release());
}
Parameters
[in]tmSampleTimeThe timestamp.
[in]oValueThe value of the sample data
Exceptions
tResultIn case of an error.

Definition at line 753 of file sample.h.

◆ output_sample_data() [4/6]

output_sample_data ( tTimeStamp  tmSampleTime,
const T &  oValue 
)
inline

Initializes the data timestamp and value.

Parameters
[in]tmSampleTimeThe timestamp.
[in]oValueThe value of the sample data
Exceptions
tResultIn case of an error.

Definition at line 780 of file sample.h.

◆ output_sample_data() [5/6]

output_sample_data ( const ant::ISample oSampleToCopy)
inlineexplicit

Initializes the data from an existing sample.

Example Usage

void generate_data(adtf::streaming::ISampleWriter* pWriter,
const adtf::streaming::ISample& oInputSample)
{
oOutputData += 1234;
pWriter->Write(oOutputData.Release());
}
The ISample interface sets and retrieves properties on samples .
Definition: sample_intf.h:35
Parameters
[in]oSampleToCopyThe sample to copy.
Exceptions
tResultIn case of an error.

Definition at line 796 of file sample.h.

References adtf::streaming::ant::alloc_sample(), THROW_ERROR_DESC, and THROW_IF_FAILED.

◆ output_sample_data() [6/6]

output_sample_data ( const ucom::ant::iobject_ptr< const ant::ISample > &  pSampleToCopy)
inlineexplicit

Initializes the data from an existing sample.

Parameters
[in]pSampleToCopyThe sample to copy.
Exceptions
tResultIn case of an error.

Definition at line 814 of file sample.h.

Member Function Documentation

◆ GetData() [1/2]

T& GetData ( )
inline
Returns
A reference to the data cast to the requested type.
Exceptions
ERR_INVALID_STATEIf Release() has been called.

Definition at line 877 of file sample.h.

◆ GetData() [2/2]

const T& GetData ( ) const
inline
Returns
A reference to the data cast to the requested type.
Exceptions
ERR_INVALID_STATEIf Release() has been called.

Definition at line 886 of file sample.h.

◆ GetDataPtr() [1/2]

T* GetDataPtr ( )
inline
Returns
A pointer to the data cast to the requested type.
Exceptions
ERR_INVALID_STATEIf Release() has been called.

Definition at line 837 of file sample.h.

◆ GetDataPtr() [2/2]

const T* GetDataPtr ( ) const
inline
Returns
A pointer to the data cast to the requested type.
Exceptions
ERR_INVALID_STATEIf Release() has been called.

Definition at line 846 of file sample.h.

References THROW_ERROR_DESC.

◆ operator const T &()

operator const T & ( ) const
inline
Returns
A reference to the data cast to the requested type.
Exceptions
ERR_INVALID_STATEIf Release() has been called.

Definition at line 930 of file sample.h.

◆ operator T&()

operator T& ( )
inline
Returns
A reference to the data cast to the requested type.
Exceptions
ERR_INVALID_STATEIf Release() has been called.

Definition at line 921 of file sample.h.

◆ operator*() [1/2]

T& operator* ( )
inline

Returns
A reference to the data cast to the requested type.
Exceptions
ERR_INVALID_STATEIf Release() has been called.

Definition at line 894 of file sample.h.

◆ operator*() [2/2]

const T& operator* ( ) const
inline

Returns
A reference to the data cast to the requested type.
Exceptions
ERR_INVALID_STATEIf Release() has been called.

Definition at line 902 of file sample.h.

◆ operator->() [1/2]

T* operator-> ( )
inline

Returns
A pointer to the data cast to the requested type.
Exceptions
ERR_INVALID_STATEIf Release() has been called.

Definition at line 860 of file sample.h.

◆ operator->() [2/2]

const T* operator-> ( ) const
inline

Returns
A pointer to the data cast to the requested type.
Exceptions
ERR_INVALID_STATEIf Release() has been called.

Definition at line 868 of file sample.h.

◆ operator=()

output_sample_data& operator= ( const T &  oValue)
inline

Assigns a new value to the data.

Exceptions
ERR_INVALID_STATEIf Release() has been called.

Definition at line 911 of file sample.h.

◆ Release()

ucom::ant::object_ptr<ant::ISample> Release ( )
inline

Returns a sample that contains the data and resets all internal data.

Do not call any other methods after you called this method.

Example Usage

void generate_data(adtf::streaming::ISampleWriter* pWriter)
{
oOutputData = 54321;
pWriter->Write(oOutputData.Release());
}
Returns
A pointer to a sample containing the output data.
Exceptions
ERR_INVALID_STATEIf Release() has been called.

Definition at line 945 of file sample.h.

References THROW_ERROR_DESC.

◆ SetSubStreamId()

void SetSubStreamId ( uint32_t  nSubStreamId)
inline

Sets the Substream id of the generated sample.

Parameters
[in]nSubStreamIdThe substream id.

Definition at line 828 of file sample.h.

References adtf::streaming::hollow::set_sample_substream_id().


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