adtf_file_library  0.13.1
Public Member Functions | List of all members
adtf_file::DefaultSample Class Reference

Default Sample implementation. More...

#include <default_sample.h>

Inheritance diagram for adtf_file::DefaultSample:
[legend]
Collaboration diagram for adtf_file::DefaultSample:
[legend]

Public Member Functions

void setTimeStamp (std::chrono::nanoseconds time_stamp) override
 Set the Time Stamp. More...
 
void setSubStreamId (uint32_t substream_id) override
 Set the Sub Stream Id, if needed. More...
 
void setFlags (uint32_t flags) override
 Set the Flags. More...
 
void * beginBufferWrite (size_t size) override
 allocates the memory buffer for sample data More...
 
void endBufferWrite () override
 ends writing to the memory allocated with beginBufferWrite
 
void addInfo (uint32_t key, DataType type, uint64_t raw_bytes) override
 Adds a additional sample information. More...
 
std::chrono::nanoseconds getTimeStamp () const override
 Get the Time Stamp. More...
 
uint32_t getSubStreamId () const override
 Get the Sub Stream Id if set. More...
 
uint32_t getFlags () const override
 Get the Flags. More...
 
std::pair< const void *, size_t > beginBufferRead () const override
 Retrieve a pointer to the memory buffer for user data and size in bytes. More...
 
void endBufferRead () const override
 Ends reading from memory buffer retruned by beginBufferRead.
 
void iterateInfo (std::function< void(uint32_t key, DataType type, uint64_t raw_bytes)> functor) const override
 iterates all additional data information (if any) by calling the functor More...
 
const std::unordered_map< uint32_t, std::pair< DataType, uint64_t > > & GetInfo () const
 Get the additional sample information. More...
 
template<typename T >
void setContent (const T &value)
 Set the Content of the sample for trivially copyable types. More...
 
template<typename T >
const T & getContent () const
 Get the Content of the sample for trivially copyable types. More...
 
- Public Member Functions inherited from adtf_file::Sample
virtual ~Sample ()=default
 DTOR.
 
- Public Member Functions inherited from adtf_file::StreamItem
virtual ~StreamItem ()=default
 DTOR.
 

Detailed Description

Default Sample implementation.

Member Function Documentation

◆ addInfo()

void adtf_file::DefaultSample::addInfo ( uint32_t  key,
DataType  type,
uint64_t  raw_bytes 
)
overridevirtual

Adds a additional sample information.

Parameters
keykey for the sample information
typedata type of the information
raw_bytesthe raw value of the information

Implements adtf_file::ReadSample.

◆ beginBufferRead()

std::pair<const void*, size_t> adtf_file::DefaultSample::beginBufferRead ( ) const
overridevirtual

Retrieve a pointer to the memory buffer for user data and size in bytes.

Returns
std::pair<const void*, size_t>
Remarks
usually it shared locks the buffer, do not forget to call endBufferRead

Implements adtf_file::WriteSample.

◆ beginBufferWrite()

void* adtf_file::DefaultSample::beginBufferWrite ( size_t  size)
overridevirtual

allocates the memory buffer for sample data

Parameters
sizethe memory to allocate in bytes
Returns
void* the pointer to the memory
Remarks
usually it write locks the buffer, do not forget to call endBufferWrite

Implements adtf_file::ReadSample.

◆ getContent()

template<typename T >
const T& adtf_file::DefaultSample::getContent ( ) const
inline

Get the Content of the sample for trivially copyable types.

Template Parameters
Tthe type of the value trivially copyable
Returns
const T& reference to the value

◆ getFlags()

uint32_t adtf_file::DefaultSample::getFlags ( ) const
overridevirtual

Get the Flags.

Returns
uint32_t

Implements adtf_file::WriteSample.

◆ GetInfo()

const std::unordered_map<uint32_t, std::pair<DataType, uint64_t> >& adtf_file::DefaultSample::GetInfo ( ) const

Get the additional sample information.

Returns
a reference to the unordered map with value key and a adtf_file::Datatype - raw value pair

◆ getSubStreamId()

uint32_t adtf_file::DefaultSample::getSubStreamId ( ) const
overridevirtual

Get the Sub Stream Id if set.

Returns
uint32_t

Implements adtf_file::WriteSample.

◆ getTimeStamp()

std::chrono::nanoseconds adtf_file::DefaultSample::getTimeStamp ( ) const
overridevirtual

Get the Time Stamp.

Returns
the time stamp of the sample

Implements adtf_file::WriteSample.

◆ iterateInfo()

void adtf_file::DefaultSample::iterateInfo ( std::function< void(uint32_t key, DataType type, uint64_t raw_bytes)>  functor) const
overridevirtual

iterates all additional data information (if any) by calling the functor

Parameters
functorthe function to call for each addition sample info value

Implements adtf_file::WriteSample.

◆ setContent()

template<typename T >
void adtf_file::DefaultSample::setContent ( const T &  value)
inline

Set the Content of the sample for trivially copyable types.

Template Parameters
Tthe type of the value trivially copyable
Parameters
valuethe instance of T

◆ setFlags()

void adtf_file::DefaultSample::setFlags ( uint32_t  flags)
overridevirtual

Set the Flags.

Parameters
flags

Implements adtf_file::ReadSample.

◆ setSubStreamId()

void adtf_file::DefaultSample::setSubStreamId ( uint32_t  substream_id)
overridevirtual

Set the Sub Stream Id, if needed.

Parameters
substream_id

Implements adtf_file::ReadSample.

◆ setTimeStamp()

void adtf_file::DefaultSample::setTimeStamp ( std::chrono::nanoseconds  time_stamp)
overridevirtual

Set the Time Stamp.

Parameters
time_stamp

Implements adtf_file::ReadSample.


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

Copyright © CARIAD SE.
Generated on Fri Apr 19 2024 by doxygen 1.9.1
GIT Commit Hash: 82d535f82776c20b12fc60740bdae991b62444a7