DataSourceBase Class Reference

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

Inheritance diagram for DataSourceBase:

ExpressionProxy DataSource DataSource< bool > DataSource< boost::function_traits< SignatureT >::boost::function_traits< Signature >::result_type > DataSource< CORBA::Any_ptr > DataSource< double > DataSource< F::result_type > DataSource< function::result_type > DataSource< FunctorT::result_type > DataSource< void > List of all members.

Detailed Description

The base class for all DataSource's.

The DataSource is an object containing Data of any type. It's interface is designed for dynamic build-up and destruction of these objects and allowing Commands, Properties etc to use them as 'storage' devices which have the dual copy() /clone() semantics (which is heavily used by the Orocos Task Infrastructure).

DataSource's are reference counted and must be allocated on the headp. Use DataSourceBase::shared_ptr or DataSource<T>::shared_ptr to deal with cleanup of allocated DataSources. You are not allowed to delete a DataSource. If you must have the pointer of a DataSource, use the .get() method of the shared_ptr class.

Once a newly created DataSource is assigned to a shared_ptr, it will be deleted when that pointer goes out of scope and is not shared by other shared_ptr objects.

See also:
DataSource


Public Types

typedef boost::intrusive_ptr<
DataSourceBase
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

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 bool evaluate () const=0
 Force an evaluation of the DataSourceBase.
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 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.
virtual DataSourceBaseclone () const=0
 Return a shallow clone of this DataSource.
virtual DataSourceBasecopy (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=0
 Return useful type info in a human readable format.
virtual const TypeInfogetTypeInfo () const=0
 Return the Orocos type info object.
virtual std::string getTypeName () const=0
 Return the Orocos type name, without const, pointer or reference qualifiers.
virtual CORBA::Any * createAny ()=0
 Creates a CORBA Any object with the current value of this DataSource.
virtual CORBA::Any * getAny ()=0
 Creates a CORBA Any object with the current value of this DataSource.
virtual bool update (const CORBA::Any &any)
 Updates the value of this DataSource with the value of a CORBA Any object.
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.

Protected Member Functions

virtual ~DataSourceBase ()
 the destructor is private.

Protected Attributes

oro_atomic_t refcount
 We keep the refcount ourselves.


Constructor & Destructor Documentation

virtual ~DataSourceBase (  )  [protected, virtual]

the destructor is private.

You are not allowed to delete this class yourself, use a shared pointer !


Member Function Documentation

virtual bool evaluate (  )  const [pure virtual]

Force an evaluation of the DataSourceBase.

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

Implemented in ExpressionProxy, DataSource, DataSource< DataSourceType >, DataSource< Arg6T >, DataSource< boost::function_types::function_type_parameter_c< Function, 1 >::type >, DataSource< boost::function_types::function_type_parameter_c< Function, 0 >::type >, DataSource< FunctionT::arg3_type >, DataSource< EventT::SlotFunction::arg2_type >, DataSource< double >, DataSource< function::sixth_argument_type >, DataSource< Arg1T >, DataSource< Arg2T >, DataSource< R >, DataSource< FunctionImpl::arg2_type >, DataSource< A >, DataSource< function::argument_type >, DataSource< boost::weak_ptr< boost::remove_pointer< typename FunctionImpl::arg1_type >::type > >, DataSource< void >, DataSource< boost::weak_ptr< RTT::RTT::StateMachine > >, DataSource< boost::weak_ptr< ComponentT > >, DataSource< RTT::ProgramInterface * >, DataSource< FunctorT::result_type >, DataSource< function::result_type >, DataSource< boost::weak_ptr< RTT::ProgramInterface > >, DataSource< function::second_argument_type >, DataSource< F::result_type >, DataSource< boost::weak_ptr< RTT::StateMachine > >, DataSource< function::fourth_argument_type >, DataSource< EventT::SlotFunction::arg1_type >, DataSource< boost::function_traits< SignatureT >::boost::function_traits< Signature >::result_type >, DataSource< FunctionT::arg2_type >, DataSource< DataType >, DataSource< function::fifth_argument_type >, DataSource< value_t >, DataSource< bool >, DataSource< boost::weak_ptr< RTT::RTT::ProgramInterface > >, DataSource< EventT::SlotFunction::arg3_type >, DataSource< function::first_argument_type >, DataSource< Arg3T >, DataSource< function::third_argument_type >, DataSource< Arg4T >, DataSource< CORBA::Any_ptr >, DataSource< Arg5T >, and DataSource< boost::function_types::function_type_parameter_c< Function, 2 >::type >.

virtual bool update ( DataSourceBase other  )  [virtual]

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 CommandInterface* updateCommand ( DataSourceBase other  )  [virtual]

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]

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]

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.

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

Implemented in AnyDataSource, BufferDataSource, CorbaDataObject, CorbaDataObjectProxy, CORBAExpression< void >, ExpressionProxy, DataObjectLocked, DataObjectPrioritySet, DataObjectPriorityGet, DataObjectLockFree, DataObject, DataSource, AssignableDataSource, DataSourceArgsMethod, DataSourceCommand, DataSourceCondition, ValueDataSource, ConstantDataSource, ReferenceDataSource, IndexedValueDataSource, BinaryDataSource, TernaryDataSource, SixaryDataSource, UnaryDataSource, NArityDataSource, DataSourceTime, FunctorDataSource0, FunctorDataSourceDS0, FunctorDataSourceDS1, DataSource< DataSourceType >, DataSource< Arg6T >, DataSource< boost::function_types::function_type_parameter_c< Function, 1 >::type >, DataSource< boost::function_types::function_type_parameter_c< Function, 0 >::type >, DataSource< FunctionT::arg3_type >, DataSource< EventT::SlotFunction::arg2_type >, DataSource< double >, DataSource< function::sixth_argument_type >, DataSource< Arg1T >, DataSource< Arg2T >, DataSource< R >, DataSource< FunctionImpl::arg2_type >, DataSource< A >, DataSource< function::argument_type >, DataSource< boost::weak_ptr< boost::remove_pointer< typename FunctionImpl::arg1_type >::type > >, DataSource< void >, DataSource< boost::weak_ptr< RTT::RTT::StateMachine > >, DataSource< boost::weak_ptr< ComponentT > >, DataSource< RTT::ProgramInterface * >, DataSource< FunctorT::result_type >, DataSource< function::result_type >, DataSource< boost::weak_ptr< RTT::ProgramInterface > >, DataSource< function::second_argument_type >, DataSource< F::result_type >, DataSource< boost::weak_ptr< RTT::StateMachine > >, DataSource< function::fourth_argument_type >, DataSource< EventT::SlotFunction::arg1_type >, DataSource< boost::function_traits< SignatureT >::boost::function_traits< Signature >::result_type >, DataSource< FunctionT::arg2_type >, DataSource< DataType >, DataSource< function::fifth_argument_type >, DataSource< value_t >, DataSource< bool >, DataSource< boost::weak_ptr< RTT::RTT::ProgramInterface > >, DataSource< EventT::SlotFunction::arg3_type >, DataSource< function::first_argument_type >, DataSource< Arg3T >, DataSource< function::third_argument_type >, DataSource< Arg4T >, DataSource< CORBA::Any_ptr >, DataSource< Arg5T >, DataSource< boost::function_types::function_type_parameter_c< Function, 2 >::type >, 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 DataSourceBase* 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.

Implemented in AnyDataSource, BufferDataSource, CorbaDataObject, CorbaDataObjectProxy, CORBAExpression< void >, ExpressionProxy, DataObjectLocked, DataObjectPrioritySet, DataObjectPriorityGet, DataObjectLockFree, DataObject, DataSource, AssignableDataSource, DataSourceArgsMethod, DataSourceCommand, DataSourceCondition, ValueDataSource, ConstantDataSource, ReferenceDataSource, IndexedValueDataSource, BinaryDataSource, TernaryDataSource, SixaryDataSource, UnaryDataSource, NArityDataSource, DataSourceTime, FunctorDataSource0, FunctorDataSourceDS0, FunctorDataSourceDS1, DataSource< DataSourceType >, DataSource< Arg6T >, DataSource< boost::function_types::function_type_parameter_c< Function, 1 >::type >, DataSource< boost::function_types::function_type_parameter_c< Function, 0 >::type >, DataSource< FunctionT::arg3_type >, DataSource< EventT::SlotFunction::arg2_type >, DataSource< double >, DataSource< function::sixth_argument_type >, DataSource< Arg1T >, DataSource< Arg2T >, DataSource< R >, DataSource< FunctionImpl::arg2_type >, DataSource< A >, DataSource< function::argument_type >, DataSource< boost::weak_ptr< boost::remove_pointer< typename FunctionImpl::arg1_type >::type > >, DataSource< void >, DataSource< boost::weak_ptr< RTT::RTT::StateMachine > >, DataSource< boost::weak_ptr< ComponentT > >, DataSource< RTT::ProgramInterface * >, DataSource< FunctorT::result_type >, DataSource< function::result_type >, DataSource< boost::weak_ptr< RTT::ProgramInterface > >, DataSource< function::second_argument_type >, DataSource< F::result_type >, DataSource< boost::weak_ptr< RTT::StateMachine > >, DataSource< function::fourth_argument_type >, DataSource< EventT::SlotFunction::arg1_type >, DataSource< boost::function_traits< SignatureT >::boost::function_traits< Signature >::result_type >, DataSource< FunctionT::arg2_type >, DataSource< DataType >, DataSource< function::fifth_argument_type >, DataSource< value_t >, DataSource< bool >, DataSource< boost::weak_ptr< RTT::RTT::ProgramInterface > >, DataSource< EventT::SlotFunction::arg3_type >, DataSource< function::first_argument_type >, DataSource< Arg3T >, DataSource< function::third_argument_type >, DataSource< Arg4T >, DataSource< CORBA::Any_ptr >, DataSource< Arg5T >, DataSource< boost::function_types::function_type_parameter_c< Function, 2 >::type >, 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 CORBA::Any* createAny (  )  [pure 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.

Implemented in ExpressionProxy, DataSource, DataSource< DataSourceType >, DataSource< Arg6T >, DataSource< boost::function_types::function_type_parameter_c< Function, 1 >::type >, DataSource< boost::function_types::function_type_parameter_c< Function, 0 >::type >, DataSource< FunctionT::arg3_type >, DataSource< EventT::SlotFunction::arg2_type >, DataSource< double >, DataSource< function::sixth_argument_type >, DataSource< Arg1T >, DataSource< Arg2T >, DataSource< R >, DataSource< FunctionImpl::arg2_type >, DataSource< A >, DataSource< function::argument_type >, DataSource< boost::weak_ptr< boost::remove_pointer< typename FunctionImpl::arg1_type >::type > >, DataSource< void >, DataSource< boost::weak_ptr< RTT::RTT::StateMachine > >, DataSource< boost::weak_ptr< ComponentT > >, DataSource< RTT::ProgramInterface * >, DataSource< FunctorT::result_type >, DataSource< function::result_type >, DataSource< boost::weak_ptr< RTT::ProgramInterface > >, DataSource< function::second_argument_type >, DataSource< F::result_type >, DataSource< boost::weak_ptr< RTT::StateMachine > >, DataSource< function::fourth_argument_type >, DataSource< EventT::SlotFunction::arg1_type >, DataSource< boost::function_traits< SignatureT >::boost::function_traits< Signature >::result_type >, DataSource< FunctionT::arg2_type >, DataSource< DataType >, DataSource< function::fifth_argument_type >, DataSource< value_t >, DataSource< bool >, DataSource< boost::weak_ptr< RTT::RTT::ProgramInterface > >, DataSource< EventT::SlotFunction::arg3_type >, DataSource< function::first_argument_type >, DataSource< Arg3T >, DataSource< function::third_argument_type >, DataSource< Arg4T >, DataSource< CORBA::Any_ptr >, DataSource< Arg5T >, and DataSource< boost::function_types::function_type_parameter_c< Function, 2 >::type >.

virtual CORBA::Any* getAny (  )  [pure 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.

Implemented in ExpressionProxy, DataSource, DataSource< DataSourceType >, DataSource< Arg6T >, DataSource< boost::function_types::function_type_parameter_c< Function, 1 >::type >, DataSource< boost::function_types::function_type_parameter_c< Function, 0 >::type >, DataSource< FunctionT::arg3_type >, DataSource< EventT::SlotFunction::arg2_type >, DataSource< double >, DataSource< function::sixth_argument_type >, DataSource< Arg1T >, DataSource< Arg2T >, DataSource< R >, DataSource< FunctionImpl::arg2_type >, DataSource< A >, DataSource< function::argument_type >, DataSource< boost::weak_ptr< boost::remove_pointer< typename FunctionImpl::arg1_type >::type > >, DataSource< void >, DataSource< boost::weak_ptr< RTT::RTT::StateMachine > >, DataSource< boost::weak_ptr< ComponentT > >, DataSource< RTT::ProgramInterface * >, DataSource< FunctorT::result_type >, DataSource< function::result_type >, DataSource< boost::weak_ptr< RTT::ProgramInterface > >, DataSource< function::second_argument_type >, DataSource< F::result_type >, DataSource< boost::weak_ptr< RTT::StateMachine > >, DataSource< function::fourth_argument_type >, DataSource< EventT::SlotFunction::arg1_type >, DataSource< boost::function_traits< SignatureT >::boost::function_traits< Signature >::result_type >, DataSource< FunctionT::arg2_type >, DataSource< DataType >, DataSource< function::fifth_argument_type >, DataSource< value_t >, DataSource< bool >, DataSource< boost::weak_ptr< RTT::RTT::ProgramInterface > >, DataSource< EventT::SlotFunction::arg3_type >, DataSource< function::first_argument_type >, DataSource< Arg3T >, DataSource< function::third_argument_type >, DataSource< Arg4T >, DataSource< CORBA::Any_ptr >, DataSource< Arg5T >, and DataSource< boost::function_types::function_type_parameter_c< Function, 2 >::type >.

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

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

std::ostream& write ( std::ostream &  os  ) 

Stream the contents of this object.

See also:
TypeInfo

std::string toString (  ) 

Get the contents of this object as a string.

See also:
TypeInfo

bool decomposeType ( PropertyBag targetbag  ) 

Decompose the contents of this object into properties.

See also:
TypeInfo

bool composeType ( DataSourceBase::shared_ptr  source  ) 

Compose the contents of this object from another datasource.

See also:
TypeInfo


Member Data Documentation

oro_atomic_t refcount [mutable, protected]

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 file:
Generated on Fri Oct 19 16:27:23 2007 for Orocos by  doxygen 1.5.1