ADTF  3.18.2
cSampleWriter

This base implementation of a sample writer is able to write to one Sample Stream which is connected to ONE cOutPin. More...

Inheritance diagram for cSampleWriter:
[legend]

Public Member Functions

 cSampleWriter ()
 CTOR.
 
virtual ~cSampleWriter ()
 DTOR.
 
 cSampleWriter (const char *strName, const ucom::ant::iobject_ptr< const IStreamType > &pStreamType)
 CTOR with name and type. More...
 
tResult BeginStreaming (ISampleStream &oSampleStream) override
 BeginStreaming will open the given Sample Stream for Writing while a connection is establishing. More...
 
tResult EndStreaming () override
 Sample Stream disconnected. More...
 
virtual tResult Transmit (const ucom::ant::iobject_ptr< const ISample > &pSample)
 Transmits and writes a sample reference to the opened ISampleOutStream. More...
 
virtual tResult ChangeType (const ucom::ant::iobject_ptr< const IStreamType > &pType)
 Changes and writes a stream type reference to the opened ISampleOutStream. More...
 
virtual tResult Flush ()
 Flushes a the opened ISampleOutStream. More...
 
virtual tResult SetStreamError (tResult oErr)
 Writes an error to the opened ISampleOutStream. More...
 
tResult ManualTrigger ()
 This is to Run a trigger call manually. More...
 
- Public Member Functions inherited from sample_streamer< ISampleWriter, cOutPin >
 sample_streamer ()=default
 CTOR.
 
 sample_streamer (const char *strName, const ucom::ant::iobject_ptr< const IStreamType > &pStreamType)
 CTOR initializer. More...
 
virtual ~sample_streamer ()
 DTOR.
 
void SetName (const char *strName)
 Sets the name of the streamer. More...
 
void ResetPin (ucom::ant::object_ptr< cOutPin > &pPin)
 Resets the pin reference This is only internaly used. More...
 
void ResetPin ()
 Resets the pin reference to nullptr. More...
 
tResult GetName (base::ant::IString &&strName) const
 Gets the name of the streamer. More...
 
tResult SetType (const ucom::ant::iobject_ptr< const IStreamType > &pStreamType)
 Sets the StreamType of the streamer. More...
 
tResult GetType (ucom::ant::iobject_ptr< const IStreamType > &pStreamType) const override
 
tResult EndStreaming () override
 

Protected Types

typedef sample_streamer< ISampleWriter, cOutPinbase_type
 base type
 

Protected Attributes

ucom::object_ptr< ISampleOutStreamm_pOutStream
 The SampleOutStream which is opened while BeginStreaming.
 
ucom::object_ptr< adtf::services::IReferenceClock_clock
 
- Protected Attributes inherited from sample_streamer< ISampleWriter, cOutPin >
adtf_util::cString m_strName
 name of the streamer (used i.e. to create the pins name)
 
ucom::object_ptr< const IStreamTypem_pStreamType
 stream type of the streamer
 
ucom::object_ptr< cOutPinm_poPin
 pin reference reading/writing from
 

Additional Inherited Members

- Public Types inherited from sample_streamer< ISampleWriter, cOutPin >
typedef cOutPin pin_type
 
- Protected Member Functions inherited from sample_streamer< ISampleWriter, cOutPin >
 sample_streamer (const sample_streamer &)=delete
 deleted copy CTOR
 
 sample_streamer (sample_streamer &&)=delete
 deleted move CTOR
 
sample_streameroperator= (const sample_streamer &)=delete
 deleted copy operator
 
sample_streameroperator= (sample_streamer &&)=delete
 deleted move operator
 
- Protected Member Functions inherited from ISampleWriter
 ~ISampleWriter ()=default
 not destructable
 
- Protected Member Functions inherited from ISampleStreamer
 ~ISampleStreamer ()=default
 not destructable
 

Detailed Description

This base implementation of a sample writer is able to write to one Sample Stream which is connected to ONE cOutPin.

The cOutPin it is registered to will call ISampleWriter::BeginStreaming while connecting.

Definition at line 34 of file samplewriter.h.

Constructor & Destructor Documentation

◆ cSampleWriter()

cSampleWriter ( const char *  strName,
const ucom::ant::iobject_ptr< const IStreamType > &  pStreamType 
)
inline

CTOR with name and type.

Parameters
[in]strNameName to set
[in]pStreamTypeStream to set on the writer (deep copy is created)

Definition at line 58 of file samplewriter.h.

Member Function Documentation

◆ BeginStreaming()

tResult BeginStreaming ( ISampleStream pStream)
inlineoverridevirtual

BeginStreaming will open the given Sample Stream for Writing while a connection is establishing.

Parameters
pStream[in] Sample Stream to open
Returns
Result Code depends on the implementation

Implements ISampleWriter.

Definition at line 63 of file samplewriter.h.

References _runtime, IRuntime::GetObject(), cSampleWriter::m_pOutStream, sample_streamer< ISampleWriter, cOutPin >::m_pStreamType, sample_streamer< ISampleWriter, cOutPin >::m_strName, ISampleStream::Open(), ISampleStreamAccess::PushRead, RETURN_IF_FAILED, and RETURN_NOERROR.

◆ ChangeType()

virtual tResult ChangeType ( const ucom::ant::iobject_ptr< const IStreamType > &  pType)
inlinevirtual

Changes and writes a stream type reference to the opened ISampleOutStream.

Parameters
[in]pTypestream type reference to change and write
Returns
Standard Result Code

Definition at line 112 of file samplewriter.h.

References cSampleWriter::m_pOutStream, and sample_streamer< ISampleWriter, cOutPin >::SetType().

◆ EndStreaming()

tResult EndStreaming ( )
inlineoverridevirtual

Sample Stream disconnected.

Streaming ends.

Returns
Standard Result Code. Depends on implmentation.

Implements ISampleStreamer.

Definition at line 82 of file samplewriter.h.

References cSampleWriter::m_pOutStream, object_ptr< T >::Reset(), and RETURN_NOERROR.

◆ Flush()

virtual tResult Flush ( )
inlinevirtual

Flushes a the opened ISampleOutStream.

Returns
Standard Result Code

Definition at line 128 of file samplewriter.h.

References cSampleWriter::m_pOutStream, and RETURN_ERROR.

◆ ManualTrigger()

tResult ManualTrigger ( )
inline

This is to Run a trigger call manually.

A Trigger to the Trigger Pipe on the Pin will be forwarded.

Warning
do not call this within a filter! You will destroy the runtimebehaviour provided by a the Trigger Pipe.
Returns
Standard Result of the adtf::base::IRunnable::Run
Return values
ERR_NOT_INITIALIZEDThe Pin is not set. use create_pin to make sure the pin is set

Definition at line 164 of file samplewriter.h.

References sample_streamer< ISampleWriter, cOutPin >::m_poPin, RETURN_ERROR, and IRunnable::RUN_TRIGGER.

Referenced by cLegacyOutputPin::Transmit().

◆ SetStreamError()

virtual tResult SetStreamError ( tResult  oErr)
inlinevirtual

Writes an error to the opened ISampleOutStream.

Parameters
[in]oErrerrror to write to the stream
Returns
Standard Result Code

Definition at line 145 of file samplewriter.h.

References cSampleWriter::m_pOutStream, and RETURN_ERROR.

◆ Transmit()

virtual tResult Transmit ( const ucom::ant::iobject_ptr< const ISample > &  pSample)
inlinevirtual

Transmits and writes a sample reference to the opened ISampleOutStream.

Parameters
[in]pSamplesample reference to transmit
Returns
Standard Result Code

Reimplemented in cLegacyOutputPin.

Definition at line 95 of file samplewriter.h.

References cSampleWriter::m_pOutStream, and RETURN_ERROR.

Referenced by cLegacyOutputPin::Transmit().