PublisherFlush class. More...
#include <PublisherFlush.h>
Public Types | |
typedef coil::Mutex | Mutex |
typedef coil::Condition< Mutex > | Condition |
typedef coil::Guard< coil::Mutex > | Guard |
Public Member Functions | |
DATAPORTSTATUS_ENUM | PublisherFlush () |
Constructor. | |
virtual | ~PublisherFlush (void) |
Destructor. | |
virtual ReturnCode | init (coil::Properties &prop) |
initialization | |
virtual ReturnCode | setConsumer (InPortConsumer *consumer) |
Store InPort consumer. | |
virtual ReturnCode | setBuffer (CdrBufferBase *buffer) |
Setting buffer pointer. | |
virtual ::RTC::DataPortStatus::Enum | setListener (ConnectorInfo &profile, RTC::ConnectorListeners *listeners) |
Set the listener. | |
virtual ReturnCode | write (const cdrMemoryStream &data, unsigned long sec, unsigned long usec) |
Write data. | |
virtual bool | isActive () |
If publisher is active state. | |
virtual ReturnCode | activate () |
activation | |
virtual ReturnCode | deactivate () |
deactivation | |
Protected Member Functions | |
void | onSend (const cdrMemoryStream &data) |
Notify an ON_SEND event to listners. | |
void | onReceived (const cdrMemoryStream &data) |
Notify an ON_RECEIVED event to listeners. | |
void | onReceiverFull (const cdrMemoryStream &data) |
Notify an ON_RECEIVER_FULL event to listeners. | |
void | onReceiverTimeout (const cdrMemoryStream &data) |
Notify an ON_RECEIVER_TIMEOUT event to listeners. | |
void | onReceiverError (const cdrMemoryStream &data) |
Notify an ON_RECEIVER_ERROR event to listeners. |
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.
typedef coil::Condition<Mutex> RTC::PublisherFlush::Condition |
typedef coil::Guard<coil::Mutex> RTC::PublisherFlush::Guard |
typedef coil::Mutex RTC::PublisherFlush::Mutex |
DATAPORTSTATUS_ENUM RTC::PublisherFlush::PublisherFlush | ( | ) |
Constructor.
Consrtuctor.
virtual RTC::PublisherFlush::~PublisherFlush | ( | void | ) | [virtual] |
Destructor.
Destructor
virtual ReturnCode RTC::PublisherFlush::activate | ( | ) | [virtual] |
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.
Implements RTC::PublisherBase.
virtual ReturnCode RTC::PublisherFlush::deactivate | ( | ) | [virtual] |
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.
Implements RTC::PublisherBase.
virtual ReturnCode RTC::PublisherFlush::init | ( | coil::Properties & | prop | ) | [virtual] |
initialization
This function have to be called before using this class object. However, this PublisherFlush class has no parameters to be initialized.
property | Property objects that includes the control information of this Publisher |
Implements RTC::PublisherBase.
virtual bool RTC::PublisherFlush::isActive | ( | ) | [virtual] |
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.
Implements RTC::PublisherBase.
void RTC::PublisherFlush::onReceived | ( | const cdrMemoryStream & | data | ) | [inline, protected] |
Notify an ON_RECEIVED event to listeners.
data | cdrMemoryStream |
References RTC::ON_RECEIVED.
void RTC::PublisherFlush::onReceiverError | ( | const cdrMemoryStream & | data | ) | [inline, protected] |
Notify an ON_RECEIVER_ERROR event to listeners.
data | cdrMemoryStream |
References RTC::ON_RECEIVER_ERROR.
void RTC::PublisherFlush::onReceiverFull | ( | const cdrMemoryStream & | data | ) | [inline, protected] |
Notify an ON_RECEIVER_FULL event to listeners.
data | cdrMemoryStream |
References RTC::ON_RECEIVER_FULL.
void RTC::PublisherFlush::onReceiverTimeout | ( | const cdrMemoryStream & | data | ) | [inline, protected] |
Notify an ON_RECEIVER_TIMEOUT event to listeners.
data | cdrMemoryStream |
References RTC::ON_RECEIVER_TIMEOUT.
void RTC::PublisherFlush::onSend | ( | const cdrMemoryStream & | data | ) | [inline, protected] |
virtual ReturnCode RTC::PublisherFlush::setBuffer | ( | CdrBufferBase * | buffer | ) | [virtual] |
Setting buffer pointer.
Since PublisherFlush does not use any buffers, This function always returns PORT_OK.
buffer | CDR buffer |
virtual ReturnCode RTC::PublisherFlush::setConsumer | ( | InPortConsumer * | consumer | ) | [virtual] |
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.
consumer | A pointer to a consumer object. |
Implements RTC::PublisherBase.
virtual ::RTC::DataPortStatus::Enum RTC::PublisherFlush::setListener | ( | ConnectorInfo & | profile, | |
RTC::ConnectorListeners * | listeners | |||
) | [virtual] |
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.
info | ConnectorInfo that is localized object of ConnectorProfile | |
listeners | ConnectorListeners that holds various listeners |
Implements RTC::PublisherBase.
virtual ReturnCode RTC::PublisherFlush::write | ( | const cdrMemoryStream & | data, | |
unsigned long | sec, | |||
unsigned long | usec | |||
) | [virtual] |
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.
data | Data to be wrote to the buffer | |
sec | Timeout time in unit seconds | |
nsec | Timeout time in unit nano-seconds |
Implements RTC::PublisherBase.