Orocos Real-Time Toolkit
2.8.3
|
A connection policy object describes how a given connection should behave. More...
#include <rtt/ConnPolicy.hpp>
Public Member Functions | |
ConnPolicy (int type=DATA, int lock_policy=LOCK_FREE) | |
The default policy is data driven, lock-free and local. More... | |
Static Public Member Functions | |
static ConnPolicy | buffer (int size, int lock_policy=LOCK_FREE, bool init_connection=false, bool pull=false) |
Create a policy for a (lock-free) fifo buffer connection of a given size. More... | |
static ConnPolicy | circularBuffer (int size, int lock_policy=LOCK_FREE, bool init_connection=false, bool pull=false) |
Create a policy for a (lock-free) circular fifo buffer connection of a given size. More... | |
static ConnPolicy | data (int lock_policy=LOCK_FREE, bool init_connection=true, bool pull=false) |
Create a policy for a (lock-free) shared data connection of a given size. More... | |
Public Attributes | |
int | type |
DATA, BUFFER or CIRCULAR_BUFFER. More... | |
bool | init |
If true, one should initialize the connection's value with the last value written on the writer port. More... | |
int | lock_policy |
This is the locking policy on the connection. More... | |
bool | pull |
If true, then the sink will have to pull data. More... | |
int | size |
If the connection is a buffered connection, the size of the buffer. More... | |
int | transport |
The prefered transport used. More... | |
int | data_size |
Suggest the payload size of the data sent over this channel. More... | |
std::string | name_id |
The name of this connection. More... | |
Static Public Attributes | |
static const int | UNBUFFERED = -1 |
static const int | DATA = 0 |
static const int | BUFFER = 1 |
static const int | CIRCULAR_BUFFER = 2 |
static const int | UNSYNC = 0 |
static const int | LOCKED = 1 |
static const int | LOCK_FREE = 2 |
A connection policy object describes how a given connection should behave.
Various parameters are available:
the locking policy: LOCKED, LOCK_FREE or UNSYNC. This defines how locking is done in the connection. For now, only three policies are available. LOCKED uses mutexes, LOCK_FREE uses a lock free method and UNSYNC means there's no synchronisation at all (not thread safe). The latter should be used only when there is no contention (simultaneous write-read).
if, upon connection, the last value that has been written on the writer end should be written on the connection as well to initialize it. This flag has an effect only if the writer has keepsLastWrittenValue() set to true (see OutputPortInterface::keepLastWrittenValue()).
if the data is pushed or pulled on the connection. This has an effect only on multi-process communication. In the pushed case (the default), new data is actively pushed to the reader's process. In the pulled case, data must be requested by the reader.
Definition at line 92 of file ConnPolicy.hpp.
The default policy is data driven, lock-free and local.
It is unsafe to rely on these defaults. It is prefered to use the above buffer() and data() functions.
type | |
lock_policy |
Definition at line 80 of file ConnPolicy.cpp.
References RTT::extras::composeProperty(), data_size, RTT::Debug, RTT::extras::decomposeProperty(), RTT::PropertyBag::empty(), RTT::Error, RTT::PropertyBag::find(), RTT::Property< T >::get(), RTT::PropertyBag::getProperty(), RTT::PropertyBag::getType(), init, lock_policy, name_id, RTT::PropertyBag::ownProperty(), pull, RTT::base::PropertyBase::ready(), RTT::PropertyBag::setType(), size, transport, and type.
|
static |
Create a policy for a (lock-free) fifo buffer connection of a given size.
size | The size of the buffer in this connection |
lock_policy | The locking policy |
init_connection | If an initial sample should be pushed into the buffer upon creation. |
pull | In inter-process cases, should the consumer pull itself ? |
Definition at line 54 of file ConnPolicy.cpp.
References init, pull, and size.
Referenced by RTT::base::OutputPortInterface::createBufferConnection().
|
static |
Create a policy for a (lock-free) circular fifo buffer connection of a given size.
size | The size of the buffer in this connection |
lock_policy | The locking policy |
init_connection | If an initial sample should be pushed into the buffer upon creation. |
pull | In inter-process cases, should the consumer pull itself ? |
Definition at line 63 of file ConnPolicy.cpp.
|
static |
Create a policy for a (lock-free) shared data connection of a given size.
lock_policy | The locking policy |
init_connection | If the data object should be initialised with the last value of the OutputPort upon creation. |
pull | In inter-process cases, should the consumer pull data itself ? |
Definition at line 72 of file ConnPolicy.cpp.
Referenced by RTT::base::OutputPortInterface::createDataConnection().
|
static |
Definition at line 97 of file ConnPolicy.hpp.
Referenced by RTT::internal::ConnFactory::buildDataStorage(), and RTT::types::RealTimeTypekitPlugin::loadGlobals().
|
static |
Definition at line 98 of file ConnPolicy.hpp.
Referenced by RTT::internal::ConnFactory::buildDataStorage(), and RTT::types::RealTimeTypekitPlugin::loadGlobals().
|
static |
Definition at line 96 of file ConnPolicy.hpp.
Referenced by RTT::internal::ConnFactory::buildDataStorage(), and RTT::types::RealTimeTypekitPlugin::loadGlobals().
|
mutable |
Suggest the payload size of the data sent over this channel.
Connections can use this value to optimize transmission or prepare the communication channel for real-time communication. This value might be overruled by the transport protocol if it can make a better guess. The interpretation of data_size is transport specific. It may be bytes, it may be something else. Leave this value set to zero, unless the transport documents otherwise.
Definition at line 174 of file ConnPolicy.hpp.
Referenced by ConnPolicy(), RTT::internal::ConnFactory::createAndCheckOutOfBandConnection(), RTT::internal::ConnFactory::createAndCheckStream(), boost::serialization::serialize(), RTT::mqueue::MQSendRecv::setupStream(), toCORBA(), and toRTT().
bool RTT::ConnPolicy::init |
If true, one should initialize the connection's value with the last value written on the writer port.
This is only possible if the writer port has the keepsLastWrittenValue() flag set (i.e. if it remembers what was the last written value).
Definition at line 150 of file ConnPolicy.hpp.
Referenced by buffer(), circularBuffer(), ConnPolicy(), data(), boost::serialization::serialize(), toCORBA(), and toRTT().
|
static |
Definition at line 102 of file ConnPolicy.hpp.
Referenced by RTT::internal::ConnFactory::buildDataStorage(), and RTT::types::RealTimeTypekitPlugin::loadGlobals().
int RTT::ConnPolicy::lock_policy |
This is the locking policy on the connection.
Definition at line 152 of file ConnPolicy.hpp.
Referenced by RTT::internal::ConnFactory::buildDataStorage(), ConnPolicy(), boost::serialization::serialize(), toCORBA(), and toRTT().
|
static |
Definition at line 101 of file ConnPolicy.hpp.
Referenced by RTT::internal::ConnFactory::buildDataStorage(), and RTT::types::RealTimeTypekitPlugin::loadGlobals().
|
mutable |
The name of this connection.
May be used by transports to define a 'topic' or lookup name to connect two data streams. If you leave this empty (recommended), the protocol will choose an appropriate name itself. Only specify a name to work around name clashes or if the transport protocol documents to do so.
Definition at line 182 of file ConnPolicy.hpp.
Referenced by RTT::corba::RemoteInputPort::buildRemoteChannelOutput(), ConnPolicy(), RTT::internal::ConnFactory::createAndCheckOutOfBandConnection(), RTT::internal::ConnFactory::createAndCheckStream(), RTT::corba::RemoteOutputPort::createConnection(), RTT::internal::ConnFactory::createOutOfBandConnection(), RTT::internal::ConnFactory::createStream(), RTT::corba::CDataFlowInterface_i::deregisterChannel(), boost::serialization::serialize(), RTT::mqueue::MQSendRecv::setupStream(), toCORBA(), and toRTT().
bool RTT::ConnPolicy::pull |
If true, then the sink will have to pull data.
Otherwise, it is pushed from the source. In both cases, the reader side is notified that new data is available by base::ChannelElementBase::signal()
Definition at line 157 of file ConnPolicy.hpp.
Referenced by buffer(), RTT::corba::RemoteInputPort::buildRemoteChannelOutput(), circularBuffer(), ConnPolicy(), RTT::internal::ConnFactory::createAndCheckOutOfBandConnection(), data(), boost::serialization::serialize(), toCORBA(), and toRTT().
int RTT::ConnPolicy::size |
If the connection is a buffered connection, the size of the buffer.
Definition at line 159 of file ConnPolicy.hpp.
Referenced by buffer(), RTT::internal::ConnFactory::buildDataStorage(), circularBuffer(), ConnPolicy(), boost::serialization::serialize(), RTT::mqueue::MQSendRecv::setupStream(), toCORBA(), and toRTT().
int RTT::ConnPolicy::transport |
The prefered transport used.
0 is local (in process), a higher number is used for inter-process or networked communication transports.
Definition at line 164 of file ConnPolicy.hpp.
Referenced by RTT::corba::RemoteInputPort::buildRemoteChannelOutput(), ConnPolicy(), RTT::internal::ConnFactory::createAndCheckOutOfBandConnection(), RTT::internal::ConnFactory::createAndCheckStream(), RTT::internal::ConnFactory::createConnection(), RTT::internal::ConnFactory::createRemoteConnection(), boost::serialization::serialize(), toCORBA(), and toRTT().
int RTT::ConnPolicy::type |
DATA, BUFFER or CIRCULAR_BUFFER.
Definition at line 144 of file ConnPolicy.hpp.
Referenced by RTT::internal::ConnFactory::buildDataStorage(), ConnPolicy(), boost::serialization::serialize(), toCORBA(), and toRTT().
|
static |
Definition at line 95 of file ConnPolicy.hpp.
|
static |
Definition at line 100 of file ConnPolicy.hpp.
Referenced by RTT::internal::ConnFactory::buildDataStorage(), and RTT::types::RealTimeTypekitPlugin::loadGlobals().