ExpressionProxy Class Reference

#include <rtt/corba/ExpressionProxy.hpp>

Inheritance diagram for ExpressionProxy:

DataSourceBase

List of all members.


Detailed Description

This class manages the access of remote Expression Corba Servers.

Definition at line 55 of file ExpressionProxy.hpp.


Public Types

typedef
boost::intrusive_ptr
< ExpressionProxy
shared_ptr
 Use this type to store a pointer to a DataSourceBase.
typedef
boost::intrusive_ptr
< const
DataSourceBase
const_ptr
 Use this type to store a const pointer to a DataSourceBase.

Public Member Functions

template<class T>
DataSource< T > * narrowDataSource () const
 Create an Orocos DataSource<T> proxy.
DataSource< void > * narrowDataSource () const
 Create an Orocos DataSource<void> proxy.
template<class T>
AssignableDataSource
< T > * 
narrowAssignableDataSource () const
 Create an Orocos AssignableDataSource<T> proxy.
virtual int serverProtocol () const
 Get the Corba Object reference of the Expression.
virtual bool evaluate () const
 Force an evaluation of the DataSourceBase.
virtual DataSourceBaseclone () const
 Return a shallow clone of this DataSource.
virtual DataSourceBasecopy (std::map< const DataSourceBase *, DataSourceBase * > &alreadyCloned) const
 Create a deep copy of this DataSource, unless it is already cloned.
virtual std::string getType () const
 Return useful type info in a human readable format.
virtual const TypeInfogetTypeInfo () const
 Return the Orocos type info object.
virtual std::string getTypeName () const
 Return the Orocos type name, without const, pointer or reference qualifiers.
virtual void * createBlob (int p)
 Creates a transportable data object with the current value of this DataSource.
virtual void * getBlob (int p)
 Creates a transportable data object with the current value of this DataSource.
virtual void * server (int p, void *arg)
 Create an object server which 'mirrors' this DataSource.
virtual void * server (int p, void *arg) const
virtual void * method (int p, MethodC *, void *arg)
 Create an object server which 'mirrors' this DataSource.
void ref () const
 Increase the reference count by one.
void deref () const
 Decrease the reference count by one and delete this on zero.
virtual void reset ()
 Reset the data to initial values.
virtual void updated ()
 In case the DataSource returns a 'reference' type, call this method to notify it that the data was updated in the course of an invocation of get().
virtual bool update (DataSourceBase *other)
 Update the value of this DataSource with the value of an other DataSource.
virtual
CommandInterface
updateCommand (DataSourceBase *other)
 Generate a CommandInterface object which will update this DataSource with the value of another DataSource when execute()'ed.
virtual bool updatePart (DataSourceBase *part, DataSourceBase *other)
 Update part of the value of this DataSource with the value of an other DataSource.
virtual
CommandInterface
updatePartCommand (DataSourceBase *part, DataSourceBase *other)
 Generate a CommandInterface object which will partially update this DataSource with the value of another DataSource when execute()'ed.
std::ostream & write (std::ostream &os)
 Stream the contents of this object.
std::string toString ()
 Get the contents of this object as a string.
bool decomposeType (PropertyBag &targetbag)
 Decompose the contents of this object into properties.
bool composeType (DataSourceBase::shared_ptr source)
 Compose the contents of this object from another datasource.
virtual bool updateBlob (int protocol, const void *data)
 Updates the value of this DataSource with the value of a transportable data object.

Static Public Member Functions

static
ExpressionProxy::shared_ptr 
Create (::RTT::Corba::Expression_ptr expr)
 Factory method: create a CORBA connection to an existing Expression Object.
static
DataSourceBase::shared_ptr 
CreateDataSource (::RTT::Corba::Expression_ptr expr)
 Factory method: create a DataSource to an existing Expression Object.
template<class T>
static DataSource< T > * NarrowDataSource (::RTT::Corba::Expression_ptr expr)
 Create a DataSource connection to an existing Expression Object.
template<class T>
static DataSource< T > * NarrowConstant (const CORBA::Any &any)
 Create a ConstantDataSource representing a read-only Any.
template<class T>
static
AssignableDataSource
< T > * 
NarrowAssignableDataSource (::RTT::Corba::Expression_ptr expr)
 Create an Orocos AssignableDataSource<T> proxy.

Protected Types

typedef std::map
< Corba::Expression_ptr,
ExpressionProxy::shared_ptr
EMap
typedef std::map
< Corba::Expression_ptr,
DataSourceBase::shared_ptr
DMap

Protected Member Functions

 ExpressionProxy (::RTT::Corba::Expression_ptr t)
 Private constructor which creates a new connection to a corba object.

Protected Attributes

Corba::Expression_var mdata
oro_atomic_t refcount
 We keep the refcount ourselves.

Static Protected Attributes

static EMap proxies
static DMap dproxies

Member Function Documentation

ExpressionProxy::shared_ptr Create ( ::RTT::Corba::Expression_ptr  expr  )  [static]

Factory method: create a CORBA connection to an existing Expression Object.

Parameters:
expr The Object to connect to.
Returns:
A new or previously created CORBA proxy for expr.

Definition at line 71 of file ExpressionProxy.cpp.

References ExpressionProxy::ExpressionProxy(), and ExpressionProxy::proxies.

Referenced by ExpressionProxy::CreateDataSource().

DataSourceBase::shared_ptr CreateDataSource ( ::RTT::Corba::Expression_ptr  expr  )  [static]

Factory method: create a DataSource to an existing Expression Object.

Parameters:
expr The Object to connect to.
Returns:
A new or previously created DataSource for expr.

Definition at line 86 of file ExpressionProxy.cpp.

References ExpressionProxy::Create(), ExpressionProxy::dproxies, TypeInfo::getProtocol(), TypeInfoRepository::Instance(), and TypeTransporter::proxy().

Referenced by CorbaMethodFactory::produce().

static DataSource<T>* NarrowDataSource ( ::RTT::Corba::Expression_ptr  expr  )  [inline, static]

Create a DataSource connection to an existing Expression Object.

Parameters:
T the type of data the Expression supposedly has.
expr The Object to connect to.
Returns:
0 if the Expression is not convertible to T.

Definition at line 83 of file ExpressionProxy.hpp.

References Logger::Debug, Logger::endl(), Logger::log(), DataSourceBase::ref(), and AssignableDataSource::updateBlob().

static DataSource<T>* NarrowConstant ( const CORBA::Any &  any  )  [inline, static]

Create a ConstantDataSource representing a read-only Any.

Parameters:
T the type of data the Any supposedly has.
any The any.
Returns:
0 if the Any is not convertible to T.

Definition at line 104 of file ExpressionProxy.hpp.

static AssignableDataSource<T>* NarrowAssignableDataSource ( ::RTT::Corba::Expression_ptr  expr  )  [inline, static]

Create an Orocos AssignableDataSource<T> proxy.

Parameters:
T the type of data the Expression supposedly has.
expr The Object to connect to.
Returns:
0 if the Expression is not convertible to T.

Definition at line 117 of file ExpressionProxy.hpp.

References Logger::Debug, Logger::endl(), Logger::log(), DataSourceBase::ref(), and AssignableDataSource::updateBlob().

DataSource<T>* narrowDataSource (  )  const [inline]

Create an Orocos DataSource<T> proxy.

Parameters:
T the type of data the Expression supposedly has.
Returns:
0 if the Expression is not convertible to T.

Definition at line 140 of file ExpressionProxy.hpp.

References ExpressionProxy::mdata.

DataSource<void>* narrowDataSource (  )  const [inline]

Create an Orocos DataSource<void> proxy.

Returns:
A new DataSource.

Definition at line 148 of file ExpressionProxy.hpp.

References ExpressionProxy::mdata.

AssignableDataSource<T>* narrowAssignableDataSource (  )  const [inline]

Create an Orocos AssignableDataSource<T> proxy.

Parameters:
T the type of data the Expression supposedly has.
Returns:
0 if the Expression is not convertible to T.

Definition at line 158 of file ExpressionProxy.hpp.

References ExpressionProxy::mdata.

virtual int serverProtocol (  )  const [inline, virtual]

Get the Corba Object reference of the Expression.

This object universally identifies the remote Expression Object and can be used to tell other (remote) objects where to find it.

Reimplemented from DataSourceBase.

Definition at line 169 of file ExpressionProxy.hpp.

virtual bool evaluate (  )  const [inline, virtual]

Force an evaluation of the DataSourceBase.

Returns:
true on successful evaluation. If the DataSource itself contains a boolean, return that boolean.

Implements DataSourceBase.

Definition at line 174 of file ExpressionProxy.hpp.

References ExpressionProxy::mdata.

virtual DataSourceBase* clone (  )  const [inline, virtual]

Return a shallow clone of this DataSource.

This method returns a duplicate of this instance which re-uses the DataSources this DataSource holds reference to. The clone() function is thus a non-deep copy.

Implements DataSourceBase.

Definition at line 178 of file ExpressionProxy.hpp.

References ExpressionProxy::ExpressionProxy(), and ExpressionProxy::mdata.

virtual DataSourceBase* copy ( std::map< const DataSourceBase *, DataSourceBase * > &  alreadyCloned  )  const [inline, virtual]

Create a deep copy of this DataSource, unless it is already cloned.

Places the association (parent, clone) in alreadyCloned. If the DataSource is non-copyable (for example it represents the Property of a Task ), this may be returned.

Implements DataSourceBase.

Definition at line 182 of file ExpressionProxy.hpp.

virtual void* createBlob ( int  protocol  )  [inline, virtual]

Creates a transportable data object with the current value of this DataSource.

This does not trigger the evaluation() of this data source.

Returns:
a valid object or nill if this type is not supported.

Reimplemented from DataSourceBase.

Definition at line 193 of file ExpressionProxy.hpp.

References ExpressionProxy::mdata.

virtual void* getBlob ( int  protocol  )  [inline, virtual]

Creates a transportable data object with the current value of this DataSource.

This does trigger the evaluation() of this data source. Equivalent to this->evaluate(); this->createBlob();

Returns:
a valid object or nill if this type is not supported.

Reimplemented from DataSourceBase.

Definition at line 199 of file ExpressionProxy.hpp.

References ExpressionProxy::mdata.

virtual void* server ( int  protocol,
void *  arg 
) [inline, virtual]

Create an object server which 'mirrors' this DataSource.

Returns:
The existing server if serverProtocol() == protocol, or a new server object reference otherwise.
See also:
Operations.idl

Reimplemented from DataSourceBase.

Definition at line 205 of file ExpressionProxy.hpp.

References ExpressionProxy::mdata.

virtual void* method ( int  protocol,
MethodC orig,
void *  arg 
) [inline, virtual]

Create an object server which 'mirrors' this DataSource.

Returns:
The existing server if serverProtocol() == protocol, or a new method object reference otherwise.
See also:
Operations.idl

Reimplemented from DataSourceBase.

Definition at line 217 of file ExpressionProxy.hpp.

References ExpressionProxy::mdata.

bool update ( DataSourceBase other  )  [virtual, inherited]

Update the value of this DataSource with the value of an other DataSource.

Update does a full update of the value, adding extra information if necessary.

Returns:
false if the DataSources are of different type OR if the contents of this DataSource can not be updated.

Reimplemented in AssignableDataSource, AssignableDataSource< DataSourceType >, AssignableDataSource< boost::function_types::function_type_parameter_c< Function, 1 >::type >, AssignableDataSource< boost::function_types::function_type_parameter_c< Function, 0 >::type >, AssignableDataSource< EventT::SlotFunction::arg2_type >, AssignableDataSource< R >, AssignableDataSource< A >, AssignableDataSource< boost::function_traits< DataType >::arg3_type >, AssignableDataSource< RTT::ProgramInterface * >, AssignableDataSource< boost::function_traits< DataType >::arg1_type >, AssignableDataSource< boost::weak_ptr< RTT::ProgramInterface > >, AssignableDataSource< boost::function_traits< DataType >::arg2_type >, AssignableDataSource< boost::weak_ptr< RTT::StateMachine > >, AssignableDataSource< EventT::SlotFunction::arg1_type >, AssignableDataSource< bool >, AssignableDataSource< value_t >, AssignableDataSource< boost::function_traits< DataType >::result_type >, AssignableDataSource< EventT::SlotFunction::arg3_type >, AssignableDataSource< boost::function_traits< DataType >::arg4_type >, and AssignableDataSource< boost::function_types::function_type_parameter_c< Function, 2 >::type >.

Definition at line 89 of file DataSource.cpp.

CommandInterface * updateCommand ( DataSourceBase other  )  [virtual, inherited]

Generate a CommandInterface object which will update this DataSource with the value of another DataSource when execute()'ed.

Returns:
zero if the DataSource types do not match OR if the contents of this DataSource can not be updated.

Reimplemented in CORBAAssignableExpression, AssignableDataSource, IndexedValueDataSource, AssignableDataSource< DataSourceType >, AssignableDataSource< boost::function_types::function_type_parameter_c< Function, 1 >::type >, AssignableDataSource< boost::function_types::function_type_parameter_c< Function, 0 >::type >, AssignableDataSource< EventT::SlotFunction::arg2_type >, AssignableDataSource< R >, AssignableDataSource< A >, AssignableDataSource< boost::function_traits< DataType >::arg3_type >, AssignableDataSource< RTT::ProgramInterface * >, AssignableDataSource< boost::function_traits< DataType >::arg1_type >, AssignableDataSource< boost::weak_ptr< RTT::ProgramInterface > >, AssignableDataSource< boost::function_traits< DataType >::arg2_type >, AssignableDataSource< boost::weak_ptr< RTT::StateMachine > >, AssignableDataSource< EventT::SlotFunction::arg1_type >, AssignableDataSource< bool >, AssignableDataSource< value_t >, AssignableDataSource< boost::function_traits< DataType >::result_type >, AssignableDataSource< EventT::SlotFunction::arg3_type >, AssignableDataSource< boost::function_traits< DataType >::arg4_type >, and AssignableDataSource< boost::function_types::function_type_parameter_c< Function, 2 >::type >.

Definition at line 97 of file DataSource.cpp.

bool updatePart ( DataSourceBase part,
DataSourceBase other 
) [virtual, inherited]

Update part of the value of this DataSource with the value of an other DataSource.

Update does a partial update of the value, according to part, which is most likely an index or hash value of some type.

Returns:
false if the DataSources are of different type OR if the contents of this DataSource can not be partially updated.

Definition at line 101 of file DataSource.cpp.

CommandInterface * updatePartCommand ( DataSourceBase part,
DataSourceBase other 
) [virtual, inherited]

Generate a CommandInterface object which will partially update this DataSource with the value of another DataSource when execute()'ed.

part is an index or hash value of some type.

Returns:
zero if the DataSource types do not match OR if the contents of this DataSource can not be partially updated.

Reimplemented in CORBAAssignableExpression, and IndexedValueDataSource.

Definition at line 105 of file DataSource.cpp.

Referenced by CORBAAssignableExpression::updatePartCommand().

std::ostream & write ( std::ostream &  os  )  [inherited]

Stream the contents of this object.

See also:
TypeInfo

Definition at line 59 of file DataSource.cpp.

std::string toString (  )  [inherited]

Get the contents of this object as a string.

See also:
TypeInfo

Definition at line 71 of file DataSource.cpp.

bool decomposeType ( PropertyBag targetbag  )  [inherited]

Decompose the contents of this object into properties.

See also:
TypeInfo

Definition at line 77 of file DataSource.cpp.

bool composeType ( DataSourceBase::shared_ptr  source  )  [inherited]

Compose the contents of this object from another datasource.

See also:
TypeInfo

Definition at line 83 of file DataSource.cpp.

bool updateBlob ( int  protocol,
const void *  data 
) [virtual, inherited]

Updates the value of this DataSource with the value of a transportable data object.

Parameters:
any The value to update to.
Returns:
true if any had the correct type.

Reimplemented in AssignableDataSource, AssignableDataSource< DataSourceType >, AssignableDataSource< boost::function_types::function_type_parameter_c< Function, 1 >::type >, AssignableDataSource< boost::function_types::function_type_parameter_c< Function, 0 >::type >, AssignableDataSource< EventT::SlotFunction::arg2_type >, AssignableDataSource< R >, AssignableDataSource< A >, AssignableDataSource< boost::function_traits< DataType >::arg3_type >, AssignableDataSource< RTT::ProgramInterface * >, AssignableDataSource< boost::function_traits< DataType >::arg1_type >, AssignableDataSource< boost::weak_ptr< RTT::ProgramInterface > >, AssignableDataSource< boost::function_traits< DataType >::arg2_type >, AssignableDataSource< boost::weak_ptr< RTT::StateMachine > >, AssignableDataSource< EventT::SlotFunction::arg1_type >, AssignableDataSource< bool >, AssignableDataSource< value_t >, AssignableDataSource< boost::function_traits< DataType >::result_type >, AssignableDataSource< EventT::SlotFunction::arg3_type >, AssignableDataSource< boost::function_traits< DataType >::arg4_type >, and AssignableDataSource< boost::function_types::function_type_parameter_c< Function, 2 >::type >.

Definition at line 137 of file DataSource.cpp.


Member Data Documentation

oro_atomic_t refcount [mutable, protected, inherited]

We keep the refcount ourselves.

We aren't using boost::shared_ptr, because boost::intrusive_ptr is better, exactly because it can be used with refcounts that are stored in the class itself. Advantages are that the shared_ptr's for derived classes use the same refcount, which is of course very much desired, and that refcounting happens in an efficient way, which is also nice :)

Definition at line 89 of file DataSourceBase.hpp.

Referenced by DataSourceBase::DataSourceBase(), DataSourceBase::deref(), and DataSourceBase::ref().


The documentation for this class was generated from the following files:
Generated on Tue Mar 25 17:41:59 2008 for OrocosReal-TimeToolkit by  doxygen 1.5.3