38 #ifndef ORO_SHARED_CONNECTION_HPP 39 #define ORO_SHARED_CONNECTION_HPP 42 #include "../base/ChannelElement.hpp" 43 #include "../ConnPolicy.hpp" 59 SharedConnID(boost::intrusive_ptr< SharedConnectionBase > connection)
60 : connection(connection) {}
61 virtual ConnID* clone()
const;
62 virtual bool isSameID(
ConnID const&
id)
const;
63 template <
typename T> boost::intrusive_ptr< SharedConnection<T> >
getConnection()
const 75 typedef boost::intrusive_ptr< SharedConnectionBase >
shared_ptr;
89 return dynamic_cast<SharedConnection<T> *
>(e);
95 template <
typename T> SharedConnection<T> *
narrow()
97 return dynamic_cast<SharedConnection<T> *
>(
this);
101 virtual const std::string &getName()
const;
103 virtual const ConnPolicy *getConnPolicy()
const;
112 typedef boost::shared_ptr<SharedConnectionRepository>
shared_ptr;
115 typedef std::map<key_t, SharedConnectionBase*>
Map;
122 static shared_ptr Instance();
127 bool has(
const key_t &key)
const;
134 template <
typename T>
137 typedef boost::intrusive_ptr< SharedConnection<T> >
shared_ptr;
144 bool mstorage_initialized;
150 , mstorage_initialized(false)
168 if (!this->signal()) {
182 return mstorage->
read(sample, copy_old_data);
206 if (!mstorage_initialized) {
208 mstorage_initialized =
true;
219 template <
typename T>
222 typedef boost::intrusive_ptr< SharedRemoteConnection<T> >
shared_ptr;
boost::call_traits< T >::param_type param_t
boost::intrusive_ptr< ChannelElement< T > > shared_ptr
A repository which stores pointers to all shared connections within the process.
boost::intrusive_ptr< SharedConnectionBase > shared_ptr
virtual void clear()
Clears any data stored by the channel.
virtual FlowStatus read(reference_t sample, bool copy_old_data=true)
Reads the last sample given to write()
boost::intrusive_ptr< SharedConnection< T > > getConnection() const
FlowStatus
Returns the status of a data flow read operation.
virtual ~SharedConnection()
static SharedConnection< T > * narrow(ChannelElementBase *e)
Return a pointer to the typed instance of a SharedConnectionBase.
A connection policy object describes how a given connection should behave.
std::map< key_t, SharedConnectionBase * > Map
virtual WriteStatus write(param_t sample)
Writes a new sample on this connection.
boost::intrusive_ptr< SharedConnectionBase > connection
virtual void clear()
Resets the stored sample.
virtual value_t data_sample()
Overridden implementation of MultipleInputsChannelElementBase::data_sample() that gets a sample from ...
A typed version of ChannelElementBase.
virtual WriteStatus data_sample(param_t sample, bool reset=true)
Provides a data sample to initialize this connection.
SharedRemoteConnection(const ConnPolicy &policy)
SharedConnection< T > * narrow()
Return a pointer to the typed variant of this SharedConnectionBase.
base::ChannelElement< T >::param_t param_t
virtual FlowStatus read(reference_t sample, bool copy_old_data=true)
Reads a sample from the connection.
Represents a shared connection created by the ConnFactory.
An object oriented wrapper around a shared mutex (multiple readers allowed, but only one writer with ...
boost::call_traits< T >::reference reference_t
boost::intrusive_ptr< SharedRemoteConnection< T > > shared_ptr
base::ChannelElement< T >::reference_t reference_t
boost::intrusive_ptr< SharedConnection< T > > shared_ptr
virtual ~SharedRemoteConnection()
SharedConnID(boost::intrusive_ptr< SharedConnectionBase > connection)
int buffer_policy
The policy on how buffer elements will be installed for this connection, which influences the behavio...
boost::shared_ptr< SharedConnectionRepository > shared_ptr
virtual WriteStatus data_sample(param_t sample, bool reset=true)
Provides a data sample to initialize this connection.
This class is used in places where a permanent representation of a reference to a connection is neede...
SharedConnection(typename base::ChannelElement< T > *storage, const ConnPolicy &policy)
virtual WriteStatus write(param_t sample)
Writes a new sample on this connection.
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
base::ChannelElement< T >::value_t value_t
In the data flow implementation, a channel is created by chaining ChannelElementBase objects...
std::ostream & operator<<(std::ostream &, const RTT::internal::SharedConnID &)
WriteStatus
Returns the status of a data flow write operation.
Base class for shared connection elements.