DataSource Class Template Reference

#include </home/sspr/src/www/orocos-1.0/export/build/orocos-rtt-1.2.2/build/rtt/DataSource.hpp>

Inheritance diagram for DataSource:

DataSourceBase AssignableDataSource BufferDataSource ConstantDataSource DataSourceTime DataSourceArgsMethod DataObjectInterface ReferenceDataSource ValueDataSource CorbaDataObject CorbaDataObjectProxy DataObject DataObjectLocked DataObjectLockFree DataObjectPriorityGet DataObjectPrioritySet IndexedValueDataSource List of all members.

Detailed Description

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

DataSource is a base class representing a generic way to read data of type T.

See also:
DataSourceBase for shared_ptr use.
Parameters:
T The type of data returned by get(). It does not necessarily say that the data is stored as a T, it only specifies in which form the get() method returns the data. Thus a DataSource<const std::string&> returns a const ref to a string, but may store the string itself by value.


Public Types

typedef boost::remove_const <
typename boost::remove_reference<
T >::type >::type 
value_t
 The bare type of T is extracted into value_t.
typedef T result_t
typedef boost::intrusive_ptr<
DataSource< T > > 
shared_ptr
 Use this type to store a pointer to a DataSourceBase.
typedef boost::intrusive_ptr<
const DataSource< T > > 
const_ptr
 Use this type to store a const pointer to a DataSourceBase.

Public Member Functions

virtual result_t get () const=0
 Return the data as type T.
virtual result_t value () const=0
 Return the result of the last evaluate() function.
virtual bool evaluate () const
 Force an evaluation of the DataSourceBase.
virtual DataSource< T > * clone () const=0
 Return a shallow clone of this DataSource.
virtual DataSource< T > * copy (std::map< const DataSourceBase *, DataSourceBase * > &alreadyCloned) const =0
 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 CORBA::Any * createAny ()
 Creates a CORBA Any object with the current value of this DataSource.
virtual CORBA::Any * getAny ()
 Creates a CORBA Any object with the current value of 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 bool update (const CORBA::Any &any)
 Updates the value of this DataSource with the value of a CORBA Any object.
virtual CommandInterfaceupdateCommand (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 CommandInterfaceupdatePartCommand (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.

Static Public Member Functions

static std::string GetType ()
 Return usefull type info in a human readable format.
static const TypeInfoGetTypeInfo ()
 Return the Orocos type info.
static std::string GetTypeName ()
 Return the Orocos type name, without const, pointer or reference qualifiers.
static DataSource< T > * narrow (DataSourceBase *db)
 This method narrows a DataSourceBase to a typeded DataSource, possibly returning a new object.

Protected Attributes

oro_atomic_t refcount
 We keep the refcount ourselves.


Member Function Documentation

bool evaluate (  )  const [virtual]

Force an evaluation of the DataSourceBase.

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

Implements DataSourceBase.

virtual DataSource<T>* clone (  )  const [pure 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.

Implemented in AnyDataSource, BufferDataSource, CorbaDataObject, CorbaDataObjectProxy, CORBAExpression< void >, DataObjectLocked, DataObjectPrioritySet, DataObjectPriorityGet, DataObjectLockFree, DataObject, AssignableDataSource, DataSourceArgsMethod, DataSourceCommand, DataSourceCondition, ValueDataSource, ConstantDataSource, ReferenceDataSource, IndexedValueDataSource, BinaryDataSource, TernaryDataSource, SixaryDataSource, UnaryDataSource, NArityDataSource, DataSourceTime, FunctorDataSource0, FunctorDataSourceDS0, FunctorDataSourceDS1, 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< RTT::ProgramInterface * >, AssignableDataSource< boost::weak_ptr< RTT::ProgramInterface > >, AssignableDataSource< boost::weak_ptr< RTT::StateMachine > >, AssignableDataSource< EventT::SlotFunction::arg1_type >, AssignableDataSource< DataType >, AssignableDataSource< bool >, AssignableDataSource< value_t >, AssignableDataSource< EventT::SlotFunction::arg3_type >, AssignableDataSource< boost::function_types::function_type_parameter_c< Function, 2 >::type >, ValueDataSource< R >, ValueDataSource< A >, ValueDataSource< boost::weak_ptr< ProgramInterface > >, ValueDataSource< boost::weak_ptr< StateMachine > >, and FunctorDataSource0< F >.

virtual DataSource<T>* copy ( std::map< const DataSourceBase *, DataSourceBase * > &  alreadyCloned  )  const [pure 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.

Implemented in AnyDataSource, BufferDataSource, CorbaDataObject, CorbaDataObjectProxy, CORBAExpression< void >, DataObjectLocked, DataObjectPrioritySet, DataObjectPriorityGet, DataObjectLockFree, DataObject, AssignableDataSource, DataSourceArgsMethod, DataSourceCommand, DataSourceCondition, ValueDataSource, ConstantDataSource, ReferenceDataSource, IndexedValueDataSource, BinaryDataSource, TernaryDataSource, SixaryDataSource, UnaryDataSource, NArityDataSource, DataSourceTime, FunctorDataSource0, FunctorDataSourceDS0, FunctorDataSourceDS1, 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< RTT::ProgramInterface * >, AssignableDataSource< boost::weak_ptr< RTT::ProgramInterface > >, AssignableDataSource< boost::weak_ptr< RTT::StateMachine > >, AssignableDataSource< EventT::SlotFunction::arg1_type >, AssignableDataSource< DataType >, AssignableDataSource< bool >, AssignableDataSource< value_t >, AssignableDataSource< EventT::SlotFunction::arg3_type >, AssignableDataSource< boost::function_types::function_type_parameter_c< Function, 2 >::type >, ValueDataSource< R >, ValueDataSource< A >, ValueDataSource< boost::weak_ptr< ProgramInterface > >, ValueDataSource< boost::weak_ptr< StateMachine > >, and FunctorDataSource0< F >.

CORBA::Any * createAny (  )  [virtual]

Creates a CORBA Any object with the current value of this DataSource.

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

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

Implements DataSourceBase.

CORBA::Any * getAny (  )  [virtual]

Creates a CORBA Any object with the current value of this DataSource.

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

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

Implements DataSourceBase.

virtual 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< RTT::ProgramInterface * >, AssignableDataSource< boost::weak_ptr< RTT::ProgramInterface > >, AssignableDataSource< boost::weak_ptr< RTT::StateMachine > >, AssignableDataSource< EventT::SlotFunction::arg1_type >, AssignableDataSource< DataType >, AssignableDataSource< bool >, AssignableDataSource< value_t >, AssignableDataSource< EventT::SlotFunction::arg3_type >, and AssignableDataSource< boost::function_types::function_type_parameter_c< Function, 2 >::type >.

virtual bool update ( const CORBA::Any &  any  )  [virtual, inherited]

Updates the value of this DataSource with the value of a CORBA Any 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< RTT::ProgramInterface * >, AssignableDataSource< boost::weak_ptr< RTT::ProgramInterface > >, AssignableDataSource< boost::weak_ptr< RTT::StateMachine > >, AssignableDataSource< EventT::SlotFunction::arg1_type >, AssignableDataSource< DataType >, AssignableDataSource< bool >, AssignableDataSource< value_t >, AssignableDataSource< EventT::SlotFunction::arg3_type >, and AssignableDataSource< boost::function_types::function_type_parameter_c< Function, 2 >::type >.

virtual 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 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< RTT::ProgramInterface * >, AssignableDataSource< boost::weak_ptr< RTT::ProgramInterface > >, AssignableDataSource< boost::weak_ptr< RTT::StateMachine > >, AssignableDataSource< EventT::SlotFunction::arg1_type >, AssignableDataSource< DataType >, AssignableDataSource< bool >, AssignableDataSource< value_t >, AssignableDataSource< EventT::SlotFunction::arg3_type >, and AssignableDataSource< boost::function_types::function_type_parameter_c< Function, 2 >::type >.

virtual 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.

virtual 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 IndexedValueDataSource.

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

Stream the contents of this object.

See also:
TypeInfo

std::string toString (  )  [inherited]

Get the contents of this object as a string.

See also:
TypeInfo

bool decomposeType ( PropertyBag targetbag  )  [inherited]

Decompose the contents of this object into properties.

See also:
TypeInfo

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

Compose the contents of this object from another datasource.

See also:
TypeInfo


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 :)


The documentation for this class was generated from the following files:
Generated on Fri Oct 19 16:27:23 2007 for Orocos by  doxygen 1.5.1