OpenRTM-aist 2.0.2
Loading...
Searching...
No Matches
RTC::PublisherFlush Class Reference

PublisherFlush class. More...

#include <PublisherFlush.h>

Inheritance diagram for RTC::PublisherFlush:
Collaboration diagram for RTC::PublisherFlush:

Public Member Functions

 PublisherFlush ()
 Constructor.
 
 ~PublisherFlush () override
 Destructor.
 
DataPortStatus init (coil::Properties &prop) override
 initialization
 
DataPortStatus setConsumer (InPortConsumer *consumer) override
 Store InPort consumer.
 
DataPortStatus setBuffer (CdrBufferBase *buffer) override
 Setting buffer pointer.
 
::RTC::DataPortStatus setListener (ConnectorInfo &info, RTC::ConnectorListenersBase *listeners) override
 Set the listener.
 
DataPortStatus write (ByteDataStreamBase *data, std::chrono::nanoseconds timeout=std::chrono::nanoseconds(-1)) override
 Write data.
 
bool isActive () override
 If publisher is active state.
 
DataPortStatus activate () override
 activation
 
DataPortStatus deactivate () override
 deactivation
 
- Public Member Functions inherited from RTC::PublisherBase
virtual ~PublisherBase ()=default
 Destructor.
 
virtual DataPortStatus setBuffer (BufferBase< ByteData > *buffer)=0
 Setting buffer pointer.
 
virtual void release ()
 Release the Publisher.
 

Protected Member Functions

void onSend (ByteData &data)
 Notify an ON_SEND event to listners.
 
void onReceived (ByteData &data)
 Notify an ON_RECEIVED event to listeners.
 
void onReceiverFull (ByteData &data)
 Notify an ON_RECEIVER_FULL event to listeners.
 
void onReceiverTimeout (ByteData &data)
 Notify an ON_RECEIVER_TIMEOUT event to listeners.
 
void onReceiverError (ByteData &data)
 Notify an ON_RECEIVER_ERROR event to listeners.
 

Detailed Description

PublisherFlush class.

This is a Publisher class of Flush type. This class sends unsend data that has been stored in the buffer. This executes Consumer that waits for the data send timing in the same thread as its send side.

Constructor & Destructor Documentation

◆ PublisherFlush()

RTC::PublisherFlush::PublisherFlush ( )

Constructor.

Consrtuctor.

◆ ~PublisherFlush()

RTC::PublisherFlush::~PublisherFlush ( )
override

Destructor.

Destructor

Member Function Documentation

◆ activate()

DataPortStatus RTC::PublisherFlush::activate ( )
overridevirtual

activation

This function activates the publisher. By calling this function, this publisher starts the thread that pushes data to InPort. If precondition such as initialization process and so on is not met, the error code PRECONDITION_NOT_MET is returned.

Returns
PORT_OK normal return PRECONDITION_NOT_MET precondition is not met

Implements RTC::PublisherBase.

◆ deactivate()

DataPortStatus RTC::PublisherFlush::deactivate ( )
overridevirtual

deactivation

This function deactivates the publisher. By calling this function, this publisher stops the thread that pushes data to InPort. If precondition such as initialization process and so on is not met, the error code PRECONDITION_NOT_MET is returned.

Returns
PORT_OK normal return PRECONDITION_NOT_MET precondition is not met

Implements RTC::PublisherBase.

◆ init()

DataPortStatus RTC::PublisherFlush::init ( coil::Properties & prop)
overridevirtual

initialization

This function have to be called before using this class object. However, this PublisherFlush class has no parameters to be initialized.

Parameters
propertyProperty objects that includes the control information of this Publisher
Returns
DataPortStatus PORT_OK normal return INVALID_ARGS Properties with invalid values.

Implements RTC::PublisherBase.

◆ isActive()

bool RTC::PublisherFlush::isActive ( )
overridevirtual

If publisher is active state.

A Publisher can be activated/deactivated synchronized with the data port. The active state and the non-active state are made transition by the "activate()" and the "deactivate()" functions respectively. This function confirms if the publisher is in active state.

Returns
Result of state confirmation (Active state:true, Inactive state:false)

Implements RTC::PublisherBase.

◆ onReceived()

void RTC::PublisherFlush::onReceived ( ByteData & data)
inlineprotected

Notify an ON_RECEIVED event to listeners.

Parameters
datacdrMemoryStream

References RTC::ConnectorListenersBase::notifyOut(), and RTC::ON_RECEIVED.

◆ onReceiverError()

void RTC::PublisherFlush::onReceiverError ( ByteData & data)
inlineprotected

Notify an ON_RECEIVER_ERROR event to listeners.

Parameters
datacdrMemoryStream

References RTC::ConnectorListenersBase::notifyOut(), and RTC::ON_RECEIVER_ERROR.

◆ onReceiverFull()

void RTC::PublisherFlush::onReceiverFull ( ByteData & data)
inlineprotected

Notify an ON_RECEIVER_FULL event to listeners.

Parameters
datacdrMemoryStream

References RTC::ConnectorListenersBase::notifyOut(), and RTC::ON_RECEIVER_FULL.

◆ onReceiverTimeout()

void RTC::PublisherFlush::onReceiverTimeout ( ByteData & data)
inlineprotected

Notify an ON_RECEIVER_TIMEOUT event to listeners.

Parameters
datacdrMemoryStream

References RTC::ConnectorListenersBase::notifyOut(), and RTC::ON_RECEIVER_TIMEOUT.

◆ onSend()

void RTC::PublisherFlush::onSend ( ByteData & data)
inlineprotected

Notify an ON_SEND event to listners.

Parameters
datacdrMemoryStream

References RTC::ConnectorListenersBase::notifyOut(), and RTC::ON_SEND.

◆ setBuffer()

DataPortStatus RTC::PublisherFlush::setBuffer ( CdrBufferBase * buffer)
override

Setting buffer pointer.

Since PublisherFlush does not use any buffers, This function always returns PORT_OK.

Parameters
bufferCDR buffer
Returns
PORT_OK

◆ setConsumer()

DataPortStatus RTC::PublisherFlush::setConsumer ( InPortConsumer * consumer)
overridevirtual

Store InPort consumer.

This operation sets a consumer that is associated with this object. If the consumer object is NULL, INVALID_ARGS will be returned.

Parameters
consumerA pointer to a consumer object.
Returns
DataPortStatus PORT_OK normal return INVALID_ARGS given argument has invalid value

Implements RTC::PublisherBase.

◆ setListener()

::RTC::DataPortStatus RTC::PublisherFlush::setListener ( ConnectorInfo & info,
RTC::ConnectorListenersBase * listeners )
overridevirtual

Set the listener.

This function sets ConnectorListeners listener object to the Publisher. By setting ConnectorListeners containing various listeners objects, these listeners are called at the time of reading and writing of a buffer, and transmission of data etc. Since the ownership of the ConnectorListeners object is owned by Port or RTObject, the Publisher never deletes the ConnectorListeners object. If the given ConnectorListeners' pointer is NULL, this function returns INVALID_ARGS.

Parameters
infoConnectorInfo that is localized object of ConnectorProfile
listenersConnectorListeners that holds various listeners
Returns
PORT_OK Normal return INVALID_ARGS Invalid arguments

Implements RTC::PublisherBase.

◆ write()

DataPortStatus RTC::PublisherFlush::write ( ByteDataStreamBase * data,
std::chrono::nanoseconds timeout = std::chrono::nanoseconds(-1) )
overridevirtual

Write data.

This function writes data into the consumer associated with this Publisher. If this function is called without initializing correctly such as a consumer, listeners, etc., error code PRECONDITION_NOT_MET will be returned and no operation of the writing to the consumer etc. will be performed.

When publisher writes data to the buffer, if the consumer returns full-status, returns error, is returned with timeout, error codes BUFFER_FULL, BUFFER_ERROR and BUFFER_TIMEOUT will be returned respectively.

In other cases, PROT_ERROR will be returned.

Parameters
dataData to be wrote to the buffer
timeoutTimeout time in unit nano-seconds
Returns
PORT_OK Normal return PRECONDITION_NO_MET Precondition does not met. A consumer, a buffer, listenes are not set properly. SEND_FULL Data was sent but full-status returned SEND_TIMEOUT Data was sent but timeout occurred CONNECTION_LOST detected that the connection has been lost

Implements RTC::PublisherBase.


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