Public Types | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
RTC::PublisherFlush Class Reference

PublisherFlush class. More...

#include <PublisherFlush.h>

Inheritance diagram for RTC::PublisherFlush:
Inheritance graph
[legend]

Public Types

typedef coil::Condition< MutexCondition
 
typedef coil::Guard< coil::MutexGuard
 
typedef coil::Mutex Mutex
 
- Public Types inherited from RTC::DataPortStatus
enum  Enum {
  PORT_OK = 0, PORT_ERROR, BUFFER_ERROR, BUFFER_FULL,
  BUFFER_EMPTY, BUFFER_TIMEOUT, SEND_FULL, SEND_TIMEOUT,
  RECV_EMPTY, RECV_TIMEOUT, INVALID_ARGS, PRECONDITION_NOT_MET,
  CONNECTION_LOST, UNKNOWN_ERROR
}
 DataPortStatus return codes. More...
 

Public Member Functions

virtual ReturnCode activate ()
 activation More...
 
virtual ReturnCode deactivate ()
 deactivation More...
 
virtual ReturnCode init (coil::Properties &prop)
 initialization More...
 
virtual bool isActive ()
 If publisher is active state. More...
 
DATAPORTSTATUS_ENUM PublisherFlush ()
 Constructor. More...
 
virtual ReturnCode setBuffer (CdrBufferBase *buffer)
 Setting buffer pointer. More...
 
virtual ReturnCode setConsumer (InPortConsumer *consumer)
 Store InPort consumer. More...
 
virtual ::RTC::DataPortStatus::Enum setListener (ConnectorInfo &profile, RTC::ConnectorListeners *listeners)
 Set the listener. More...
 
virtual ReturnCode write (const cdrMemoryStream &data, unsigned long sec, unsigned long usec)
 Write data. More...
 
virtual ~PublisherFlush (void)
 Destructor. More...
 
- Public Member Functions inherited from RTC::PublisherBase
virtual void release ()
 Release the Publisher. More...
 
virtual DATAPORTSTATUS_ENUM ~PublisherBase (void)
 Destructor. More...
 

Protected Member Functions

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

Private Attributes

bool m_active
 
InPortConsumerm_consumer
 
ConnectorListenersm_listeners
 
ConnectorInfo m_profile
 
ReturnCode m_retcode
 
Mutex m_retmutex
 
Logger rtclog
 

Additional Inherited Members

- Static Public Member Functions inherited from RTC::DataPortStatus
static const char * toString (DataPortStatus::Enum status)
 Convert DataPortStatus into the string. More...
 

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.

Definition at line 58 of file PublisherFlush.h.

Member Typedef Documentation

Definition at line 63 of file PublisherFlush.h.

Definition at line 64 of file PublisherFlush.h.

Definition at line 62 of file PublisherFlush.h.

Constructor & Destructor Documentation

RTC::PublisherFlush::PublisherFlush ( )

Constructor.

Consrtuctor.

Definition at line 36 of file PublisherFlush.cpp.

RTC::PublisherFlush::~PublisherFlush ( void  )
virtual

Destructor.

Destructor

Definition at line 50 of file PublisherFlush.cpp.

Member Function Documentation

PublisherBase::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.

Returns
PORT_OK normal return PRECONDITION_NOT_MET precondition is not met

Implements RTC::PublisherBase.

Definition at line 202 of file PublisherFlush.cpp.

PublisherBase::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.

Returns
PORT_OK normal return PRECONDITION_NOT_MET precondition is not met

Implements RTC::PublisherBase.

Definition at line 215 of file PublisherFlush.cpp.

PublisherBase::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.

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

Implements RTC::PublisherBase.

Definition at line 64 of file PublisherFlush.cpp.

bool RTC::PublisherFlush::isActive ( void  )
virtual

If publisher is active state.

Confirm to activate.

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.

Definition at line 190 of file PublisherFlush.cpp.

void RTC::PublisherFlush::onReceived ( const cdrMemoryStream &  data)
inlineprotected

Notify an ON_RECEIVED event to listeners.

Parameters
datacdrMemoryStream

Definition at line 379 of file PublisherFlush.h.

void RTC::PublisherFlush::onReceiverError ( const cdrMemoryStream &  data)
inlineprotected

Notify an ON_RECEIVER_ERROR event to listeners.

Parameters
datacdrMemoryStream

Definition at line 424 of file PublisherFlush.h.

void RTC::PublisherFlush::onReceiverFull ( const cdrMemoryStream &  data)
inlineprotected

Notify an ON_RECEIVER_FULL event to listeners.

Parameters
datacdrMemoryStream

Definition at line 394 of file PublisherFlush.h.

void RTC::PublisherFlush::onReceiverTimeout ( const cdrMemoryStream &  data)
inlineprotected

Notify an ON_RECEIVER_TIMEOUT event to listeners.

Parameters
datacdrMemoryStream

Definition at line 409 of file PublisherFlush.h.

void RTC::PublisherFlush::onSend ( const cdrMemoryStream &  data)
inlineprotected

Notify an ON_SEND event to listners.

Parameters
datacdrMemoryStream

Definition at line 364 of file PublisherFlush.h.

PublisherBase::ReturnCode RTC::PublisherFlush::setBuffer ( CdrBufferBase buffer)
virtual

Setting buffer pointer.

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

Parameters
bufferCDR buffer
Returns
PORT_OK

Implements RTC::PublisherBase.

Definition at line 97 of file PublisherFlush.cpp.

PublisherBase::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.

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

Implements RTC::PublisherBase.

Definition at line 78 of file PublisherFlush.cpp.

RTC::DataPortStatus::Enum RTC::PublisherFlush::setListener ( ConnectorInfo profile,
RTC::ConnectorListeners listeners 
)
virtual

Set the listener.

Setting buffer pointer.

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.

Definition at line 112 of file PublisherFlush.cpp.

PublisherBase::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.

Parameters
dataData to be wrote to the buffer
secTimeout time in unit seconds
nsecTimeout 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.

Definition at line 136 of file PublisherFlush.cpp.

Member Data Documentation

bool RTC::PublisherFlush::m_active
private

Definition at line 437 of file PublisherFlush.h.

InPortConsumer* RTC::PublisherFlush::m_consumer
private

Definition at line 432 of file PublisherFlush.h.

ConnectorListeners* RTC::PublisherFlush::m_listeners
private

Definition at line 434 of file PublisherFlush.h.

ConnectorInfo RTC::PublisherFlush::m_profile
private

Definition at line 433 of file PublisherFlush.h.

ReturnCode RTC::PublisherFlush::m_retcode
private

Definition at line 435 of file PublisherFlush.h.

Mutex RTC::PublisherFlush::m_retmutex
private

Definition at line 436 of file PublisherFlush.h.

Logger RTC::PublisherFlush::rtclog
private

Definition at line 431 of file PublisherFlush.h.


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


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Thu Jun 6 2019 19:26:04