Orocos Real-Time Toolkit  2.9.0
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
RTT::ConnPolicy Class Reference

A connection policy object describes how a given connection should behave. More...

#include <rtt/ConnPolicy.hpp>

Classes

struct  ConnPolicyDefault
 

Public Member Functions

 ConnPolicy ()
 Constructs a new ConnPolicy instance based on the current default settings as returned by ConnPolicy::Default(). More...
 
 ConnPolicy (int type)
 Constructs a new ConnPolicy instance based on the current default settings as returned by ConnPolicy::Default(), but overrides the type. More...
 
 ConnPolicy (int type, int lock_policy)
 Constructs a new ConnPolicy instance based on the current default settings as returned by ConnPolicy::Default(), but overrides the type and lock_policy. More...
 

Static Public Member Functions

static ConnPolicyDefault ()
 Returns the process-wide default ConnPolicy that serves as a template for new ConnPolicy instances. More...
 
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...
 
int size
 If the connection is a buffered connection, the size of the buffer. More...
 
int lock_policy
 This is the locking policy on the connection. More...
 
bool init
 If true, one should initialize the connection's value with the last value written on the writer port. More...
 
bool pull
 If true, then the sink will have to pull data. More...
 
int buffer_policy
 The policy on how buffer elements will be installed for this connection, which influences the behavior of reads and writes if the port has muliple connections. More...
 
int max_threads
 The maximum number of threads that will access the connection data or buffer object. More...
 
bool mandatory
 Whether the connection described by this connection policy is mandatory, which means that write operations will fail if the connection could not be served, e.g. 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
 
static const bool PUSH = false
 
static const bool PULL = true
 

Detailed Description

A connection policy object describes how a given connection should behave.

Various parameters are available:

Definition at line 107 of file ConnPolicy.hpp.

Constructor & Destructor Documentation

RTT::ConnPolicy::ConnPolicy ( )

Constructs a new ConnPolicy instance based on the current default settings as returned by ConnPolicy::Default().

Definition at line 109 of file ConnPolicy.cpp.

RTT::ConnPolicy::ConnPolicy ( int  type)
explicit

Constructs a new ConnPolicy instance based on the current default settings as returned by ConnPolicy::Default(), but overrides the type.

You should not use this contructor anymore and prefer the static methods ConnPolicy::data(), ConnPolicy::buffer(), etc. instead.

Parameters
type
Deprecated:

Definition at line 122 of file ConnPolicy.cpp.

RTT::ConnPolicy::ConnPolicy ( int  type,
int  lock_policy 
)
explicit

Constructs a new ConnPolicy instance based on the current default settings as returned by ConnPolicy::Default(), but overrides the type and lock_policy.

You should not use this contructor anymore and prefer the static methods ConnPolicy::data(), ConnPolicy::buffer(), etc. instead.

Parameters
type
lock_policy
Deprecated:

Definition at line 135 of file ConnPolicy.cpp.

Member Function Documentation

ConnPolicy RTT::ConnPolicy::buffer ( int  size,
int  lock_policy = LOCK_FREE,
bool  init_connection = false,
bool  pull = false 
)
static

Create a policy for a (lock-free) fifo buffer connection of a given size.

Parameters
sizeThe size of the buffer in this connection
lock_policyThe locking policy
init_connectionIf an initial sample should be pushed into the buffer upon creation.
pullIn inter-process cases, should the consumer pull itself ?
Returns
the specified policy.

Definition at line 77 of file ConnPolicy.cpp.

References init, lock_policy, pull, size, and type.

Referenced by RTT::base::OutputPortInterface::createBufferConnection().

ConnPolicy RTT::ConnPolicy::circularBuffer ( int  size,
int  lock_policy = LOCK_FREE,
bool  init_connection = false,
bool  pull = false 
)
static

Create a policy for a (lock-free) circular fifo buffer connection of a given size.

Parameters
sizeThe size of the buffer in this connection
lock_policyThe locking policy
init_connectionIf an initial sample should be pushed into the buffer upon creation.
pullIn inter-process cases, should the consumer pull itself ?
Returns
the specified policy.

Definition at line 88 of file ConnPolicy.cpp.

References init, lock_policy, pull, size, and type.

ConnPolicy RTT::ConnPolicy::data ( int  lock_policy = LOCK_FREE,
bool  init_connection = true,
bool  pull = false 
)
static

Create a policy for a (lock-free) shared data connection of a given size.

Parameters
lock_policyThe locking policy
init_connectionIf the data object should be initialised with the last value of the OutputPort upon creation.
pullIn inter-process cases, should the consumer pull data itself ?
Returns
the specified policy.

Definition at line 99 of file ConnPolicy.cpp.

References init, lock_policy, pull, and type.

Referenced by RTT::base::OutputPortInterface::createDataConnection().

ConnPolicy & RTT::ConnPolicy::Default ( )
static

Returns the process-wide default ConnPolicy that serves as a template for new ConnPolicy instances.

This method returns a non-const reference and you can change the defaults. This is not thread-safe and should only be done very early in the deployment phase, before the first component is loaded and before connecting ports.

Definition at line 71 of file ConnPolicy.cpp.

Referenced by RTT::types::RealTimeTypekitPlugin::loadGlobals().

Member Data Documentation

const int RTT::ConnPolicy::BUFFER = 1
static
int RTT::ConnPolicy::buffer_policy
const int RTT::ConnPolicy::CIRCULAR_BUFFER = 2
static
const int RTT::ConnPolicy::DATA = 0
static
int RTT::ConnPolicy::data_size
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 248 of file ConnPolicy.hpp.

Referenced by RTT::corba::RemoteInputPort::buildRemoteChannelOutput(), RTT::internal::ConnFactory::createAndCheckStream(), RTT::corba::RemoteOutputPort::createConnection(), RTT::corba::RemoteInputPort::createConnection(), 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 203 of file ConnPolicy.hpp.

Referenced by buffer(), circularBuffer(), data(), boost::serialization::serialize(), toCORBA(), and toRTT().

const int RTT::ConnPolicy::LOCK_FREE = 2
static
int RTT::ConnPolicy::lock_policy
const int RTT::ConnPolicy::LOCKED = 1
static
bool RTT::ConnPolicy::mandatory

Whether the connection described by this connection policy is mandatory, which means that write operations will fail if the connection could not be served, e.g.

due to a full input buffer or because of a broken remote connection. By default, all connections are mandatory.

Definition at line 232 of file ConnPolicy.hpp.

Referenced by RTT::corba::RemoteInputPort::buildRemoteChannelOutput(), RTT::internal::ConnFactory::buildSharedConnection(), RTT::internal::ConnFactory::createAndCheckConnection(), RTT::internal::ConnFactory::createAndCheckSharedConnection(), RTT::internal::ConnFactory::createAndCheckStream(), RTT::corba::CDataFlowInterface_i::deregisterChannel(), boost::serialization::serialize(), toCORBA(), and toRTT().

int RTT::ConnPolicy::max_threads

The maximum number of threads that will access the connection data or buffer object.

This only needs to be specified for lock-free data structures. If 0, the number of threads will be determined by a simple heuristic depending on the read and write policies of the connection.

Definition at line 224 of file ConnPolicy.hpp.

Referenced by RTT::operator<<(), RTT::base::DataObjectBase::Options::Options(), RTT::base::BufferBase::Options::Options(), toCORBA(), and toRTT().

std::string RTT::ConnPolicy::name_id
mutable
const bool RTT::ConnPolicy::PULL = true
static
bool RTT::ConnPolicy::pull
const bool RTT::ConnPolicy::PUSH = false
static
int RTT::ConnPolicy::size
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 238 of file ConnPolicy.hpp.

Referenced by RTT::corba::RemoteInputPort::buildRemoteChannelOutput(), RTT::internal::ConnFactory::buildRemoteChannelOutput(), RTT::internal::ConnFactory::createAndCheckStream(), RTT::internal::ConnFactory::createConnection(), boost::serialization::serialize(), toCORBA(), and toRTT().

int RTT::ConnPolicy::type
const int RTT::ConnPolicy::UNBUFFERED = -1
static

Definition at line 110 of file ConnPolicy.hpp.

Referenced by RTT::operator<<().

const int RTT::ConnPolicy::UNSYNC = 0
static

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