#include <OutputPort.hpp>
Public Member Functions | |
virtual base::PortInterface * | antiClone () const |
virtual base::PortInterface * | clone () const |
virtual bool | createConnection (base::InputPortInterface &input_port, ConnPolicy const &policy) |
virtual Service * | createPortObject () |
virtual bool | createStream (ConnPolicy const &policy) |
virtual base::DataSourceBase::shared_ptr | getDataSource () const |
T | getLastWrittenValue () const |
bool | getLastWrittenValue (T &sample) const |
virtual const types::TypeInfo * | getTypeInfo () 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) |
OutputPort & | operator= (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 > |
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.
Definition at line 70 of file OutputPort.hpp.
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.
RTT::OutputPort< T >::OutputPort | ( | std::string const & | name = "unnamed" , |
bool | keep_last_written_value = true |
||
) | [inline] |
Creates a named Output port.
name | The name of this port, unique among the ports of a TaskContext. |
keep_last_written_value | Defaults 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.
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 304 of file OutputPort.hpp.
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 296 of file OutputPort.hpp.
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.
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 311 of file OutputPort.hpp.
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 326 of file OutputPort.hpp.
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.
policy | The connection policy describing how the stream must be set up. |
Implements RTT::base::PortInterface.
Definition at line 316 of file OutputPort.hpp.
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.
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.
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.
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().
Definition at line 194 of file OutputPort.hpp.
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.
sample | The data sample to store the value into. |
Definition at line 205 of file OutputPort.hpp.
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 290 of file OutputPort.hpp.
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.
Implements RTT::base::OutputPortInterface.
Definition at line 182 of file OutputPort.hpp.
void RTT::OutputPort< T >::keepNextWrittenValue | ( | bool | keep | ) | [inline] |
Definition at line 177 of file OutputPort.hpp.
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.
OutputPort& RTT::OutputPort< T >::operator= | ( | OutputPort< T > const & | orig | ) | [private] |
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.
sample |
Definition at line 230 of file OutputPort.hpp.
void RTT::OutputPort< T >::write | ( | const T & | sample | ) | [inline] |
Writes a new sample to all receivers (if any).
sample | The new sample to send out. |
Definition at line 251 of file OutputPort.hpp.
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 272 of file OutputPort.hpp.
friend class internal::ConnInputEndpoint< T > [friend] |
Definition at line 72 of file OutputPort.hpp.
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.
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.
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.
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.
base::DataObjectInterface<T>::shared_ptr RTT::OutputPort< T >::sample [private] |
Definition at line 137 of file OutputPort.hpp.