49 ucom::ant::IClassInfo>
91 tResult Lock(ucom::ant::iobject_ptr_shared_locked<const
adtf::streaming::ant::
ISampleBuffer>& oSampleBuffer) const override;
92 tResult WriteLock(ucom::ant::iobject_ptr_locked<
ISampleBuffer>& oSampleBuffer,
size_t szPreAllocateSize) override;
93 tResult Set(const ant::
ISample& oSample) override;
94 tResult Get(ant::
ISample& oSample) const override;
95 tResult Reset() override;
96 tTimeStamp GetTime() const;
97 tResult SetTime(tTimeStamp tmTimeStamp);
98 uint32_t GetFlags() const override;
99 tResult SetFlags(uint32_t ui32Flags) override;
100 tResult Set(tTimeStamp tmTime,
103 uint32_t ui32Flags=0) override;
111 base::flash::tNanoSeconds GetTimeNs() const override;
112 tResult SetTime(base::flash::tNanoSeconds tmTimeStamp) override;
113 tResult Set(base::flash::tNanoSeconds tmTimeStamp,
116 uint32_t ui32Flags=0) override;
119 uint32_t GetSubStreamId() const override;
120 void SetSubStreamId(uint32_t nSubStreamId) override;
165 template <
typename T>
179 Reset(oSampleData.m_pCurrentSample);
185 std::swap(m_pCurrentSample, oSampleData.m_pCurrentSample);
186 std::swap(m_pBuffer, oSampleData.m_pBuffer);
204 if (m_pCurrentSample)
206 return m_pCurrentSample->GetTime();
222 return reinterpret_cast<const T*
>(m_pBuffer->GetPtr());
236 const T* pData = GetDataPtr();
252 return (m_pCurrentSample && m_pBuffer && m_pBuffer->GetSize() >=
sizeof(T));
259 operator bool()
const
273 return *GetDataPtr();
288 m_pCurrentSample = pSample;
300 m_pCurrentSample.
Reset();
497 template <
typename T>
500 static_assert(std::is_trivially_copyable<T>::value,
501 "You can only use plain types or structs without pointers or complex members.");
515 Reset(oSampleData.m_pCurrentSample);
521 std::swap(m_pCurrentSample, oSampleData.m_pCurrentSample);
522 std::swap(m_pBuffer, oSampleData.m_pBuffer);
533 Reset(ucom::ucom_object_ptr_cast<const ant::ISample>(pSample));
546 if (m_pCurrentSample)
548 return m_pCurrentSample->GetTime();
563 if (m_pCurrentSample)
582 return reinterpret_cast<const T*
>(m_pBuffer->GetPtr());
597 return m_pBuffer->GetSize();
633 return *GetDataPtr();
637 static T oDefaultValue;
638 return oDefaultValue;
657 return (m_pCurrentSample && m_pBuffer && m_pBuffer->GetSize() >=
sizeof(T));
666 operator const T&()
const
681 m_pCurrentSample = pSample;
693 m_pCurrentSample.
Reset();
708 template <
typename T>
711 static_assert(std::is_trivially_copyable<T>::value,
712 "You can only use plain types or structs without pointers or complex members.");
762 uint32_t nSubStreamId):
767 pSample->SetTime(tmSampleTime);
768 pSample->SetSubStreamId(nSubStreamId);
801 if (m_pBuffer->GetSize() !=
sizeof(T))
803 THROW_ERROR_DESC(ERR_INVALID_ARG,
"The sample passed to output_sample_data (%d), does not match the size of the requested type (%d).",
804 m_pBuffer->GetSize(),
851 "This output_sample_data instance is not valid. Maybe you tried to access it after you called Release()");
854 return reinterpret_cast<T*
>(m_pBuffer->GetPtr());
879 return *GetDataPtr();
888 return *GetDataPtr();
930 operator const T&()
const
950 "This output_sample_data instance is not valid. Maybe you tried to access it after you called Release()");
#define UCOM_RESOLVE(...)
Resolve a path to a base class which is inherited multiple times.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.
#define ADTF_CLASS_INFO_IMPL(_class)
Common macro to implement correct treatment of adtf::ucom::ant::IClassInfo.
The SampleBuffer factory manages and can create SampleBuffers.
The SampleBuffer is the memory block object for the data of a ISample.
The ISample interface sets and retrieves properties on samples .
Interface for additional sample information on a Additional Sample Information.
The ISampleLog interface defines an interface to trace and store Sample data- and timing flow.
Sample that uses samples buffers that do not copy the data, but only keep a reference to it.
The cSample class implements a basic sample which contains streaming data.
tResult SetSampleBufferFactory(const ucom::ant::iobject_ptr< ISampleBufferFactory > &pFactory)
Sets the reference to the buffer factory, which will be used to create the user data content in ISamp...
ADTF_CLASS_ID_NAME(cSample, "sample.streaming.adtf.cid", "ADTF Default Sample")
private d pointer
Sample Data getter for an easy use of samples with samplebuffer set to the type T.
tResult Reset()
Resets the sample the sample data reference to.
sample_data(sample_data &&oSampleData)
move CTOR
sample_data(const sample_data &oSampleData)
CTOR.
const T GetData() const
Retrieves the pointer to the datas memory as type T*.
tTimeStamp GetTime() const
retrieves the time of the data.
const T * GetDataPtr() const
Retrieves the pointer to the datas memory.
tResult Reset(const ucom::ant::iobject_ptr< const ISample > &pSample)
Resets the sample the sample data reference to with a new reference to a sample.
bool IsValid() const
Validate if sample and sample buffer is set.
sample_data(const ucom::iobject_ptr< const ISample > &pSample)
copy CTOR
Wrapper class that facilitates the handling of output samples.
output_sample_data(const ant::ISample &oSampleToCopy)
Initializes the data from an existing sample.
void SetSubStreamId(uint32_t nSubStreamId)
Sets the Substream id of the generated sample.
const T & operator*() const
const T * operator->() const
output_sample_data(base::flash::tNanoSeconds tmSampleTime, const T &oValue)
Initializes the data timestamp and value.
output_sample_data & operator=(const T &oValue)
Assigns a new value to the data.
const T * GetDataPtr() const
const T & GetData() const
output_sample_data(tTimeStamp tmSampleTime, const T &oValue)
Initializes the data timestamp and value.
output_sample_data(base::flash::tNanoSeconds tmSampleTime)
Initializes the data timestamp.
output_sample_data(const ucom::ant::iobject_ptr< const ant::ISample > &pSampleToCopy)
Initializes the data from an existing sample.
output_sample_data(tTimeStamp tmSampleTime)
Initializes the data timestamp.
ucom::ant::object_ptr< ant::ISample > Release()
Returns a sample that contains the data and resets all internal data.
Easy data access for input samples.
tResult Reset()
Resets the sample the sample data reference to.
sample_data(const ucom::iobject_ptr< const ant::ISample > &pSample)
copy CTOR
sample_data(sample_data &&oSampleData)
move CTOR
sample_data(const sample_data &oSampleData)
CTOR.
const T & operator*() const
Retrieves a reference to the data.
const T * operator->() const
Retrieves the pointer to the datas memory.
const T * operator->()
Retrieves the pointer to the datas memory.
adtf::base::flash::tNanoSeconds GetTimeNs() const
retrieves the timestamp of the data.
tTimeStamp GetTime() const
retrieves the timestamp of the data.
const T * GetDataPtr() const
Retrieves the pointer to the datas memory.
bool IsValid() const
Validate if sample and sample buffer is set.
const T & GetData() const
Retrieves a reference to the data.
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.
size_t GetDataSize() const
virtual T * Get() const =0
Get raw pointer to shared object.
Base object pointer to realize binary compatible reference counting in interface methods.
Implementation for a exclusive lock guard.
Implementation for a shared lock guard.
Object pointer implementation used for reference counting on objects of type IObject.
void Reset()
Reset this object_ptr.
Use this template if you want to implement an ucom::ant::IObject based Interface and/or subclass an e...
void swap(StackPtr< T, StackSize, Alignment > &lhs, StackPtr< T, StackSize, Alignment > &rhs)
Swap storages of two objects of type StackPtr.
tResult alloc_sample(ucom::ant::iobject_ptr< ucom::ant::IObject > &pSampleObject, const char *strSampleCID)
Helper Function to get a Sample Instance through the adtf::ucom::ant::IRuntime.
tResult alloc_sample(ucom::ant::iobject_ptr< ucom::ant::IObject > &pSample)
Helper Function to get a ISample Instance through the adtf::ucom::ant::IRuntime.
base::flash::tNanoSeconds get_sample_time(const ucom::ant::iobject_ptr< const ant::ISample > &pSample)
Returns the sample time stamp with nanosecond precision.
base::flash::tNanoSeconds get_sample_time(const ant::ISample &oSample)
Returns the sample timestamp with nanosecond precision.
void set_sample_time(ant::ISample &oSample, base::flash::tNanoSeconds tmTimeStamp)
Sets the sample timestamp with nanosecond precision.
void set_sample_time(const ucom::ant::iobject_ptr< ant::ISample > &pSample, base::flash::tNanoSeconds tmTimeStamp)
Sets the sample timestamp with nanosecond precision.
void set_sample_substream_id(const ucom::ant::iobject_ptr< ant::ISample > &pSample, uint32_t nSubStreamId)
Sets the substream id of a given sample.
uint32_t get_sample_substream_id(const ant::ISample &oSample)
void set_sample_substream_id(ant::ISample &oSample, uint32_t nSubStreamId)
Sets the substream id of a given sample.
uint32_t get_sample_substream_id(const ucom::ant::iobject_ptr< const ant::ISample > &pSample)
ant::iobject_ptr< T > iobject_ptr
Alias always bringing the latest version of ant::iobject_ptr into scope.
ant::IObject IObject
Alias always bringing the latest version of ant::IObject into scope.
Namespace for entire ADTF SDK.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.
a timestamp with nanosecond precision
#define THROW_ERROR_DESC(_code,...)
throws a tResult exception
#define RETURN_IF_FAILED(s)
returns if the expression returns a failed tResult or throws an exception.
#define THROW_IF_FAILED(s)
throws if the expression returns a failed tResult