ADTF
Loading...
Searching...
No Matches
adtf::streaming::output_sample_data< T > Class Template Reference

#include <sample.h>

Public Member Functions

 output_sample_data (base::flash::tNanoSeconds tmSampleTime)
 
 output_sample_data (tTimeStamp tmSampleTime)
 
 output_sample_data (base::flash::tNanoSeconds tmSampleTime, const T &oValue)
 
 output_sample_data (base::flash::tNanoSeconds tmSampleTime, const T &oValue, uint32_t nSubStreamId)
 
 output_sample_data (tTimeStamp tmSampleTime, const T &oValue)
 
 output_sample_data (const ant::ISample &oSampleToCopy)
 
 output_sample_data (const ucom::ant::iobject_ptr< const ant::ISample > &pSampleToCopy)
 
 output_sample_data (output_sample_data &&)=default
 
output_sample_dataoperator= (output_sample_data &&)=default
 
output_sample_dataoperator= (const T &oValue)
 
void SetSubStreamId (uint32_t nSubStreamId)
 
T * GetDataPtr ()
 
const T * GetDataPtr () const
 
T * operator-> ()
 
const T * operator-> () const
 
T & GetData ()
 
const T & GetData () const
 
T & operator* ()
 
const T & operator* () const
 
 operator T& ()
 
 operator const T & () const
 
ucom::ant::object_ptr< ant::ISampleRelease ()
 
tResult SetSampleInfo (const ISampleInfo::tHashKey &oHash, const adtf::util::cVariant oValue)
 

Protected Attributes

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

Detailed Description

template<typename T>
class adtf::streaming::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

Constructor & Destructor Documentation

◆ output_sample_data() [1/6]

template<typename T>
adtf::streaming::flash::output_sample_data< T >::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());
}
Definition samplestreamer_intf.h:234
virtual tResult Write(const ucom::ant::iobject_ptr< const ant::ISample > &pSample)=0
ucom::ant::object_ptr< ant::ISample > Release()
Definition sample.h:589
A timestamp with nanosecond precision.
Definition chrono.h:23

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.

◆ output_sample_data() [2/6]

template<typename T>
adtf::streaming::flash::output_sample_data< T >::output_sample_data ( tTimeStamp tmSampleTime)
inlineexplicit

Initializes the data timestamp

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

◆ output_sample_data() [3/6]

template<typename T>
adtf::streaming::flash::output_sample_data< T >::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.

◆ output_sample_data() [4/6]

template<typename T>
adtf::streaming::flash::output_sample_data< T >::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.

◆ output_sample_data() [5/6]

template<typename T>
adtf::streaming::flash::output_sample_data< T >::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());
}
Definition sample_intf.h:34
Parameters
[in]oSampleToCopyThe sample to copy.
Exceptions
tResultIn case of an error.

◆ output_sample_data() [6/6]

template<typename T>
adtf::streaming::flash::output_sample_data< T >::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.

Member Function Documentation

◆ GetData() [1/2]

template<typename T>
T & adtf::streaming::flash::output_sample_data< T >::GetData ( )
inline
Returns
A reference to the data cast to the requested type.
Exceptions
ERR_INVALID_STATEIf Release() has been called.

◆ GetData() [2/2]

template<typename T>
const T & adtf::streaming::flash::output_sample_data< T >::GetData ( ) const
inline
Returns
A reference to the data cast to the requested type.
Exceptions
ERR_INVALID_STATEIf Release() has been called.

◆ GetDataPtr() [1/2]

template<typename T>
T * adtf::streaming::flash::output_sample_data< T >::GetDataPtr ( )
inline
Returns
A pointer to the data cast to the requested type.
Exceptions
ERR_INVALID_STATEIf Release() has been called.

◆ GetDataPtr() [2/2]

template<typename T>
const T * adtf::streaming::flash::output_sample_data< T >::GetDataPtr ( ) const
inline
Returns
A pointer to the data cast to the requested type.
Exceptions
ERR_INVALID_STATEIf Release() has been called.

◆ operator const T &()

template<typename T>
adtf::streaming::flash::output_sample_data< 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.

◆ operator T&()

template<typename T>
adtf::streaming::flash::output_sample_data< T >::operator T& ( )
inline
Returns
A reference to the data cast to the requested type.
Exceptions
ERR_INVALID_STATEIf Release() has been called.

◆ operator*() [1/2]

template<typename T>
T & adtf::streaming::flash::output_sample_data< T >::operator* ( )
inline

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

◆ operator*() [2/2]

template<typename T>
const T & adtf::streaming::flash::output_sample_data< T >::operator* ( ) const
inline

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

◆ operator->() [1/2]

template<typename T>
T * adtf::streaming::flash::output_sample_data< T >::operator-> ( )
inline

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

◆ operator->() [2/2]

template<typename T>
const T * adtf::streaming::flash::output_sample_data< T >::operator-> ( ) const
inline

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

◆ operator=()

template<typename T>
output_sample_data & adtf::streaming::flash::output_sample_data< T >::operator= ( const T & oValue)
inline

Assigns a new value to the data.

Exceptions
ERR_INVALID_STATEIf Release() has been called.

◆ Release()

template<typename T>
ucom::ant::object_ptr< ant::ISample > adtf::streaming::flash::output_sample_data< T >::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.

◆ SetSampleInfo()

template<typename T>
tResult adtf::streaming::flash::output_sample_data< T >::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

◆ SetSubStreamId()

template<typename T>
void adtf::streaming::flash::output_sample_data< T >::SetSubStreamId ( uint32_t nSubStreamId)
inline

Sets the Substream id of the generated sample.

Parameters
[in]nSubStreamIdThe substream id.

The documentation for this class was generated from the following file: