76 _runtime->GetObject(_clock);
168 tTimeStamp tmTime = _clock ? _clock->GetStreamTime() : adtf::util::cSystem::GetTime();
186 oSampleWriter.Transmit(pSample);
187 return oSampleWriter;
201 return oSampleWriter;
213 oSampleWriter.ChangeType(pType);
214 return oSampleWriter;
226 return pStreamfunc(oSampleWriter);
238 oSampleWriter.SetStreamError(oError);
239 return oSampleWriter;
246template<
typename DATA_TYPE>
294 tTimeStamp tmTime = _clock ? _clock->GetStreamTime() : adtf_util::cSystem::GetTime();
309template<
typename DATA_TYPE>
310ADTF3_DEPRECATED(
"Writing data with no concrete sample time is deprecated. Use sample_writer<DATA_TYPE>::Write(tmTime, oSampleData) instead.")
313 oSampleWriter.Transmit(oSampleData);
314 return oSampleWriter;
329 oSampleWriter << pSample;
331 return oSampleReader;
341 const char* strNameOfWriter,
344 oWriter.
SetName(strNameOfWriter);
345 return oWriter.
SetType(pStreamType);
359 ~cSampleWriter()
override;
386 class cImplementation;
387 std::unique_ptr<cImplementation> m_pImplementation;
391 const char* strNameOfWriter,
394 oWriter.
SetName(strNameOfWriter);
395 return oWriter.
SetType(pStreamType);
409 return oSampleWriter;
423 return oSampleWriter;
436 return pStreamfunc(oSampleWriter);
450 return oSampleWriter;
462template<
typename DATA_TYPE>
466 return oSampleWriter;
474 oSampleWriter << pSample;
476 return oSampleReader;
488template<
typename DATA_TYPE,
typename BASE = cSampleWriter>
498 _runtime->GetObject(m_pClock);
502 using BASE::Transmit;
513 "sample_writer<DATA_TYPE>::Write(tmTime, oSampleData) instead.")
514 tResult Write(const DATA_TYPE& oSampleData)
517 return Write(tmTime, oSampleData);
527 static_assert(!std::is_pointer_v<DATA_TYPE>,
528 "pointer types are not allowed for sample writing. To support this you need to specialize the sample_writer template");
538 RETURN_IF_FAILED(pFlashSample->WriteLock(pSampleBuffer, oMemory.GetSize()));
539 pSampleBuffer->Write(oMemory);
541 return BASE::Write(pSample);
544 ADTF3_DEPRECATED(
"Writing data with no concrete sample time is deprecated. Use "
545 "sample_writer<DATA_TYPE>::Write(tmTime, oSampleData) instead.")
546 tResult Transmit(const DATA_TYPE& oSampleData)
548 return Write(oSampleData);
556 tResult Transmit(base::flash::tNanoSeconds tmTime,
const DATA_TYPE& oSampleData)
558 return Write(tmTime, oSampleData);
562 ucom::ant::object_ptr<services::flash::IReferenceClock> m_pClock;
565template<
typename DATA_TYPE>
566ADTF3_DEPRECATED(
"Writing data with no concrete sample time is deprecated. Use "
567 "sample_writer<DATA_TYPE>::Write(tmTime, oSampleData) instead.")
569 const DATA_TYPE& oSampleData)
572 return oSampleWriter;
579using flash::make_sample_writer;
Copyright © Audi Electronics Venture GmbH.
#define ADTF3_DEPRECATED(_depr_message_)
Mark a function or variable as deprecated.
tInt64 tTimeStamp
type definition for a time value.
A_UTILS_NS::cResult tResult
For backwards compatibility and to bring latest version into scope.
#define RETURN_IF_FAILED(s)
Return if expression is failed, which requires the calling function's return type to be tResult.
#define RETURN_NOERROR
Return status ERR_NOERROR, which requires the calling function's return type to be tResult.
#define RETURN_ERROR(code)
Return specific error code, which requires the calling function's return type to be tResult.
#define IS_OK(s)
Check if result is OK.
#define RETURN_IF_POINTER_NULL(_ptr)
Return ERR_POINTER if _ptr is nullptr, which requires the calling function's return type to be tResul...
@ RUN_TRIGGER
Trigger run call.
The IString interface provides methods for getting and setting strings through abstract interfaces.
Template class implementation for the IRawMemory interface (see Supported types for adtf_memory<T> fo...
@ PushRead
PushRead Operation mode for the ISampleStream::Open. See PushRead Mode - Synchronous Data Pipes.
Interface of the SampleStream.
virtual tResult Open(const char *strName, adtf::ucom::ant::iobject_ptr< ISampleInStream > &pInStream, const adtf::ucom::ant::iobject_ptr< const IStreamType > &pInitialAcceptedStreamType, IPushReadEventSink *&pPushEventSink, ISampleStreamAccess::tMode ui32Mode, size_t szQueueSize)=0
Opens The SampleStream for reading access.
The default Sample Reader will read the incomung Stream of a IInPin.
virtual tResult GetNextSample(ucom::ant::iobject_ptr< const ISample > &pSample)
Gets the next Sample within internal queue which not has been read.
This base implementation of a sample writer is able to write to one Sample Stream which is connected ...
sample_streamer< ISampleWriter, cOutPin > base_type
base type
ucom::object_ptr< ISampleOutStream > m_pOutStream
The SampleOutStream which is opened while BeginStreaming.
cSampleWriter(const char *strName, const ucom::ant::iobject_ptr< const IStreamType > &pStreamType)
CTOR with name and type.
virtual tResult Transmit(const ucom::ant::iobject_ptr< const ISample > &pSample)
Transmits and writes a sample reference to the opened ISampleOutStream.
tResult EndStreaming() override
Sample Stream disconnected.
virtual tResult ChangeType(const ucom::ant::iobject_ptr< const IStreamType > &pType)
Changes and writes a stream type reference to the opened ISampleOutStream.
tResult ManualTrigger()
This is to Run a trigger call manually.
virtual ~cSampleWriter()
DTOR.
virtual tResult Flush()
Flushes a the opened ISampleOutStream.
tResult BeginStreaming(ISampleStream &oSampleStream) override
BeginStreaming will open the given Sample Stream for Writing while a connection is establishing.
virtual tResult SetStreamError(tResult oErr)
Writes an error to the opened ISampleOutStream.
sample_streamer(const sample_streamer &)=delete
ucom::object_ptr< cOutPin > m_poPin
void SetName(const char *strName)
Sets the name of the streamer.
tResult SetType(const ucom::ant::iobject_ptr< const IStreamType > &pStreamType)
ucom::object_ptr< const IStreamType > m_pStreamType
adtf_util::cString m_strName
Specialized Sample Writer to write DATA of type DATA_TYPE.
tResult Transmit(const DATA_TYPE &oSampleData)
Interface for sample reads that read from sample streams via input pins.
virtual tResult GetNextSample(ucom::ant::iobject_ptr< const ant::ISample > &pSample)=0
Reads the next available sample from the associated sample stream.
virtual void SetName(const char *strName)=0
Sets the name of the streamer.
virtual tResult SetType(const ucom::ant::iobject_ptr< const ant::IStreamType > &pStreamType)=0
Sets the initial stream type of a streamer.
Interface for sample writers that write to sample streams via output pins.
This base implementation of a sample writer is samples and types to the given pin set at SetStreamerP...
virtual tResult Transmit(const ucom::ant::iobject_ptr< const ant::ISample > &pSample)
For compatibility purposes, call Write() instead.
tResult GetType(ucom::ant::iobject_ptr< const ant::IStreamType > &pStreamType) const override
Returns the initial stream type of the streamer.
tResult ManualTrigger(base::flash::tNanoSeconds tmActivationTime=base::flash::tNanoSeconds {-1}) override
Calls all connected runners synchronously in this call.
tResult ChangeType(const ucom::ant::iobject_ptr< const ant::IStreamType > &pType) override
Communicates a type change for all following samples.
void SetName(const char *strName) override
Sets the name of the streamer.
tResult GetName(base::ant::IString &&strName) override
Retrieves the name of the streamer.
tResult EndStreaming() override
End streaming.
tResult SetStreamError(tResult oError) override
Reports and handles an error via the sample stream.
tResult Flush() override
Flushes the writer.
tResult SetStreamerPin(const ucom::ant::iobject_ptr< IStreamerPin > &pStreamerPin) override
Sets the pin that the streamer is associated with.
tResult SetType(const ucom::ant::iobject_ptr< const ant::IStreamType > &pStreamType) override
Sets the initial stream type of a streamer.
tResult BeginStreaming(ISampleStream &oSampleStream) override
Begin streaming on the given sample stream.
tResult Write(const ucom::ant::iobject_ptr< const ant::ISample > &pSample) override
Writes a sample to the connected sample stream.
Wrapper class that facilitates the handling of output samples.
Specialized Sample Writer to write data of a given type DATA_TYPE (see Supported types for adtf_memor...
sample_writer()
Default CTOR.
ADTF3_DEPRECATED("Writing data with no concrete sample time is deprecated. Use " "sample_writer<DATA_TYPE>::Write(tmTime, oSampleData) instead.") tResult Write(const DATA_TYPE &oSampleData)
Writes Data of the given DATA_TYPE.
Base object pointer to realize binary compatible reference counting in interface methods.
Implementation for a exclusive lock guard.
DestinationTimeStamp duration_cast(const SourceTimeStamp &)
Duration cast base template to converted between different time resolution.
Namespace for all functionality of the ADTF Streaming SDK provided since v3.0.
tResult make_sample_writer(cSampleWriter &oWriter, const char *strNameOfWriter, const ucom::ant::iobject_ptr< const IStreamType > &pStreamType)
ISampleOutStream & operator<<(ISampleOutStream &oStreamWriter, const adtf::ucom::ant::iobject_ptr< const ISample > &pSample)
Streaming Operator<< to write a sample to a writers queue of the ISampleStream.
const ISampleInStream & operator>>(const ISampleInStream &oStreamReader, IStreamItem &oItem)
Streaming Operator>> to read a sample from the readers queue.
tResult alloc_sample(ucom::ant::iobject_ptr< ucom::ant::IObject > &pSampleObject, const char *strSampleCID)
Helper Function to get a Sample Instance through the IRuntime.
ISampleWriter & operator<<(ISampleWriter &oSampleWriter, const ucom::ant::iobject_ptr< const ant::ISample > &pSample)
streaming operator to write a sample to the sample writer
Namespace for the ADTF Streaming SDK.
tResult alloc_sample(ucom::ant::iobject_ptr< ucom::ant::IObject > &pSample)
Helper Function to get a ISample Instance through the IRuntime.
object_ptr< T > ucom_object_ptr_cast(object_ptr< T > oCasted)
Alias always bringing the latest version of ant::ucom_object_ptr_cast() into scope.
Namespace for entire ADTF SDK.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.
A timestamp with nanosecond precision.
#define THROW_IF_FAILED(s)
throws if the expression returns a failed tResult