168 tTimeStamp tmTime = _clock ? _clock->GetStreamTime() : adtf::util::cSystem::GetTime();
186 oSampleWriter.Transmit(pSample);
187 return oSampleWriter;
200 oSampleWriter.Transmit(ucom::ucom_object_ptr_cast<const ISample>(pSample));
201 return oSampleWriter;
213 oSampleWriter.ChangeType(pType);
214 return oSampleWriter;
226 return pStreamfunc(oSampleWriter);
238 oSampleWriter.SetStreamError(oError);
239 return oSampleWriter;
246 template<
typename DATA_TYPE>
294 tTimeStamp tmTime = _clock ? _clock->GetStreamTime() : adtf_util::cSystem::GetTime();
309 template<
typename DATA_TYPE>
310 ADTF3_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);
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;
462 template<
typename DATA_TYPE>
466 return oSampleWriter;
474 oSampleWriter << pSample;
476 return oSampleReader;
488 template<
typename DATA_TYPE,
typename BASE = cSampleWriter>
502 using BASE::Transmit;
513 "sample_writer<DATA_TYPE>::Write(tmTime, oSampleData) instead.")
514 tResult Write(const DATA_TYPE& oSampleData)
516 auto tmTime = m_pClock ? m_pClock->GetStreamTimeNs() : base::flash::duration_cast<base::flash::tNanoSeconds>(adtf_util::cSystem::GetTime());
517 return Write(tmTime, oSampleData);
522 return Write(base::flash::duration_cast<base::flash::tNanoSeconds>(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);
553 return Write(base::flash::duration_cast<base::flash::tNanoSeconds>(tmTime), 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;
565 template<
typename DATA_TYPE>
566 ADTF3_DEPRECATED(
"Writing data with no concrete sample time is deprecated. Use "
567 "sample_writer<DATA_TYPE>::Write(tmTime, oSampleData) instead.")
568 sample_writer<DATA_TYPE>& operator<<(sample_writer<DATA_TYPE>& oSampleWriter,
569 const DATA_TYPE& oSampleData)
572 return oSampleWriter;
577 using flash::cSampleWriter;
578 using flash::sample_writer;
579 using 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.
#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...
A common result class usable as return value throughout.
@ RUN_TRIGGER
Trigger run call.
The IString interface provides methods for getting and setting strings through abstract interfaces.
Template class implementation for the ant::IRawMemory interface (see Supported types for adtf_memory<...
@ 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.
Helper template can be used to implement ISampleStreamer.
ucom::object_ptr< cOutPin > m_poPin
pin reference reading/writing from
void SetName(const char *strName)
Sets the name of the streamer.
tResult SetType(const ucom::ant::iobject_ptr< const IStreamType > &pStreamType)
Sets the StreamType of the streamer.
ucom::object_ptr< const IStreamType > m_pStreamType
stream type of the streamer
adtf_util::cString m_strName
name of the streamer (used i.e. to create the pins name)
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 adtf::stream...
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.
virtual tResult GetObject(iobject_ptr< IObject > &pObject, const char *strNameOID) const =0
Get registered object from object registry.
Base object pointer to realize binary compatible reference counting in interface methods.
Implementation for a exclusive lock guard.
Object pointer implementation used for reference counting on objects of type IObject.
void Reset()
Reset this object_ptr.
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.
tResult make_sample_writer(cSampleWriter &oWriter, const char *strNameOfWriter, const ucom::ant::iobject_ptr< const IStreamType > &pStreamType)
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 adtf::ucom::ant::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 entire ADTF SDK.
Copyright © Audi Electronics Venture GmbH.
adtf::ucom::IRuntime * _runtime
Global Runtime Pointer to reference to the current runtime.
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