Public Member Functions | Private Member Functions | Private Attributes | Friends
RTT::OutputPort< T > Class Template Reference

#include <OutputPort.hpp>

Inheritance diagram for RTT::OutputPort< T >:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual base::PortInterfaceantiClone () const
virtual base::PortInterfaceclone () const
virtual bool createConnection (base::InputPortInterface &input_port, ConnPolicy const &policy)
virtual ServicecreatePortObject ()
virtual bool createStream (ConnPolicy const &policy)
virtual
base::DataSourceBase::shared_ptr 
getDataSource () const
getLastWrittenValue () const
bool getLastWrittenValue (T &sample) const
virtual const types::TypeInfogetTypeInfo () const
void keepLastWrittenValue (bool keep)
void keepNextWrittenValue (bool keep)
bool keepsLastWrittenValue () const
 OutputPort (std::string const &name="unnamed", bool keep_last_written_value=true)
void setDataSample (const T &sample)
void write (const T &sample)
void write (base::DataSourceBase::shared_ptr source)

Private Member Functions

virtual bool connectionAdded (base::ChannelElementBase::shared_ptr channel_input, ConnPolicy const &policy)
bool do_init (typename base::ChannelElement< T >::param_t sample, const internal::ConnectionManager::ChannelDescriptor &descriptor)
bool do_write (typename base::ChannelElement< T >::param_t sample, const internal::ConnectionManager::ChannelDescriptor &descriptor)
OutputPortoperator= (OutputPort const &orig)
 OutputPort (OutputPort const &orig)

Private Attributes

bool has_initial_sample
 True if sample has been written at least once, either by calling.
bool has_last_written_value
 True if sample has been set at least once by a call to write()
bool keeps_last_written_value
 If true, all calls to write() will save the sample in sample.
bool keeps_next_written_value
 If true, the next call to write() will save the sample in sample.
base::DataObjectInterface< T >
::shared_ptr 
sample

Friends

class internal::ConnInputEndpoint< T >

Detailed Description

template<typename T>
class RTT::OutputPort< T >

A component's data output port. An Orocos OutputPort is a send-and-forget mechanism. The publisher writes data samples into the OutputPort and the underlying middleware will communicate it to all subscribers. An output port without subscribers is not an error on the component level (it may be at the system level, which can inspect the status with calling connected() ).

The data written into an OutputPort should be copyable and should provide a copy constructor in case it's not plain old data. If you want the RTT to transport your data over the network, or use it in scripting, you need to register your data class with the RTT type system.

See also:
RTT::types::TemplateTypeInfo for adding custom data classes to the RTT.

Definition at line 70 of file OutputPort.hpp.


Constructor & Destructor Documentation

template<typename T>
RTT::OutputPort< T >::OutputPort ( OutputPort< T > const &  orig) [private]

You are not allowed to copy ports. In case you want to create a container of ports, use pointers to ports instead of the port object itself.

template<typename T>
RTT::OutputPort< T >::OutputPort ( std::string const &  name = "unnamed",
bool  keep_last_written_value = true 
) [inline]

Creates a named Output port.

Parameters:
nameThe name of this port, unique among the ports of a TaskContext.
keep_last_written_valueDefaults to true. You need keep_last_written_value == true in two cases: * You're sending dynamically sized objects through this port in real-time. In that case, you need to write() to this port such an object before a connection is created. That object will be used to allocate enough data storage in each there-after created connection. If you would set keep_last_written_value == false in this use case, several memory allocations will happen during the initial writes, after which none will happen anymore. * You want to have an input to have the last written data available from before its connection was created, such that it is immediately initialized. The keep_last_written_value incurs a space overhead of one thread-safe data storage container. This is about the same size as one extra connection.

Definition at line 165 of file OutputPort.hpp.


Member Function Documentation

template<typename T>
virtual base::PortInterface* RTT::OutputPort< T >::antiClone ( ) const [inline, virtual]

Create the anti-clone (inverse port) of this port with the same name A port for reading will return a new port for writing and vice versa.

Implements RTT::base::PortInterface.

Definition at line 292 of file OutputPort.hpp.

template<typename T>
virtual base::PortInterface* RTT::OutputPort< T >::clone ( ) const [inline, virtual]

Create a clone of this port with the same name

Implements RTT::base::PortInterface.

Definition at line 284 of file OutputPort.hpp.

template<typename T>
virtual bool RTT::OutputPort< T >::connectionAdded ( base::ChannelElementBase::shared_ptr  channel_input,
ConnPolicy const &  policy 
) [inline, private, virtual]

Upcall to OutputPort.

Implements RTT::base::OutputPortInterface.

Definition at line 100 of file OutputPort.hpp.

template<typename T>
virtual bool RTT::OutputPort< T >::createConnection ( base::InputPortInterface input_port,
ConnPolicy const &  policy 
) [inline, virtual]

Connects this write port to the given read port, using the given policy

Implements RTT::base::OutputPortInterface.

Definition at line 299 of file OutputPort.hpp.

template<typename T>
virtual Service* RTT::OutputPort< T >::createPortObject ( ) [inline, virtual]

Create accessor Object for this Port, for addition to a TaskContext Object interface.

Reimplemented from RTT::base::PortInterface.

Definition at line 314 of file OutputPort.hpp.

template<typename T>
virtual bool RTT::OutputPort< T >::createStream ( ConnPolicy const &  policy) [inline, virtual]

Creates a data stream from or to this port using connection-less transports. Typically, policy.transport and policy.name_id must be properly filled in such that the data stream can be set up and input and output port can find each other. You need to call this method on two ports (input and output) using the same transport and (probably) same name_id.

Parameters:
policyThe connection policy describing how the stream must be set up.

Implements RTT::base::PortInterface.

Definition at line 304 of file OutputPort.hpp.

template<typename T>
bool RTT::OutputPort< T >::do_init ( typename base::ChannelElement< T >::param_t  sample,
const internal::ConnectionManager::ChannelDescriptor descriptor 
) [inline, private]

Definition at line 87 of file OutputPort.hpp.

template<typename T>
bool RTT::OutputPort< T >::do_write ( typename base::ChannelElement< T >::param_t  sample,
const internal::ConnectionManager::ChannelDescriptor descriptor 
) [inline, private]

Definition at line 74 of file OutputPort.hpp.

template<typename T>
virtual base::DataSourceBase::shared_ptr RTT::OutputPort< T >::getDataSource ( ) const [inline, virtual]

Returns a Data source that stores the last written value, or a null pointer if this port does not keep its last written value.

Implements RTT::base::OutputPortInterface.

Definition at line 215 of file OutputPort.hpp.

template<typename T>
T RTT::OutputPort< T >::getLastWrittenValue ( ) const [inline]

Returns the last written value written to this port, in case it is kept by this port, otherwise, returns a default T().

Returns:
The last written value or T().

Definition at line 194 of file OutputPort.hpp.

template<typename T>
bool RTT::OutputPort< T >::getLastWrittenValue ( T &  sample) const [inline]

Reads the last written value written to this port, in case it is kept by this port, otherwise, returns false.

Parameters:
sampleThe data sample to store the value into.
Returns:
true if it could be retrieved, false otherwise.

Definition at line 205 of file OutputPort.hpp.

template<typename T>
virtual const types::TypeInfo* RTT::OutputPort< T >::getTypeInfo ( ) const [inline, virtual]

Returns the types::TypeInfo object for the port's type

Implements RTT::base::PortInterface.

Definition at line 278 of file OutputPort.hpp.

template<typename T>
void RTT::OutputPort< T >::keepLastWrittenValue ( bool  new_flag) [inline, virtual]

Change the setting for keeping the last written value. Setting this to false will clear up any unneeded storage. If set, this port can initialize new connections with a data sample and allows real-time data transport of dynamically sized objects over its newly created connections.

See also:
OutputPort::OutputPort.

Implements RTT::base::OutputPortInterface.

Definition at line 182 of file OutputPort.hpp.

template<typename T>
void RTT::OutputPort< T >::keepNextWrittenValue ( bool  keep) [inline]

Definition at line 177 of file OutputPort.hpp.

template<typename T>
bool RTT::OutputPort< T >::keepsLastWrittenValue ( ) const [inline, virtual]

Returns true if this port records the last written value.

Implements RTT::base::OutputPortInterface.

Definition at line 187 of file OutputPort.hpp.

template<typename T>
OutputPort& RTT::OutputPort< T >::operator= ( OutputPort< T > const &  orig) [private]
template<typename T>
void RTT::OutputPort< T >::setDataSample ( const T &  sample) [inline]

Provides this port a data sample that is representative for the samples being used in write(). The sample will not be delivered to receivers, and only passed on to the underlying communication channel to allow it to allocate enough memory to hold the sample. You only need to call this in case you want to transfer dynamically sized objects in real-time over this OutputPort.

Parameters:
sample

Definition at line 230 of file OutputPort.hpp.

template<typename T>
void RTT::OutputPort< T >::write ( const T &  sample) [inline]

Writes a new sample to all receivers (if any).

Parameters:
sampleThe new sample to send out.

Definition at line 245 of file OutputPort.hpp.

template<typename T>
void RTT::OutputPort< T >::write ( base::DataSourceBase::shared_ptr  source) [inline, virtual]

Write this port using the value stored in source.

Reimplemented from RTT::base::OutputPortInterface.

Definition at line 260 of file OutputPort.hpp.


Friends And Related Function Documentation

template<typename T>
friend class internal::ConnInputEndpoint< T > [friend]

Definition at line 72 of file OutputPort.hpp.


Member Data Documentation

template<typename T>
bool RTT::OutputPort< T >::has_initial_sample [private]

True if sample has been written at least once, either by calling.

Definition at line 130 of file OutputPort.hpp.

template<typename T>
bool RTT::OutputPort< T >::has_last_written_value [private]

True if sample has been set at least once by a call to write()

Definition at line 126 of file OutputPort.hpp.

template<typename T>
bool RTT::OutputPort< T >::keeps_last_written_value [private]

If true, all calls to write() will save the sample in sample.

Definition at line 136 of file OutputPort.hpp.

template<typename T>
bool RTT::OutputPort< T >::keeps_next_written_value [private]

If true, the next call to write() will save the sample in sample.

Definition at line 133 of file OutputPort.hpp.

template<typename T>
base::DataObjectInterface<T>::shared_ptr RTT::OutputPort< T >::sample [private]

Definition at line 137 of file OutputPort.hpp.


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


rtt
Author(s): RTT Developers
autogenerated on Thu Jan 2 2014 11:35:43