ADTF
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...
 
tResult SetSampleInfo (const ISampleInfo::tHashKey &oHash, const adtf::util::cVariant oValue)
 Sets a variant value for the hash key oHash into the current samples sample information. More...
 

Protected Attributes

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

Private Member Functions

void AssignValue (const T &oValue)
 
 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 352 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:353
ucom::ant::object_ptr< ant::ISample > Release()
Returns a sample that contains the data and resets all internal data.
Definition: sample.h:588

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 369 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 380 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 396 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 423 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 439 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 457 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 520 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 529 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 480 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 489 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 573 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 564 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 537 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 545 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 503 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 511 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 554 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 588 of file sample.h.

References THROW_ERROR_DESC.

◆ SetSampleInfo()

tResult SetSampleInfo ( const ISampleInfo::tHashKey oHash,
const adtf::util::cVariant  oValue 
)
inline

Sets a variant value for the hash key oHash into the current samples sample information.

Parameters
[in]oHashThe hash key of the value.
[in]oValuevalue to set.
Returns
standard error code
Return values
ERR_NOERRORvalue is set
ERR_INVALID_TYPEType is not supported. See base::ant::IHashValueMapValue::tType

Definition at line 609 of file sample.h.

References adtf::streaming::ant::set_sample_info().

◆ SetSubStreamId()

void SetSubStreamId ( uint32_t  nSubStreamId)
inline

Sets the Substream id of the generated sample.

Parameters
[in]nSubStreamIdThe substream id.

Definition at line 471 of file sample.h.

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