Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 #ifndef CORELIB_DATASOURCE_BASE_HPP
00041 #define CORELIB_DATASOURCE_BASE_HPP
00042
00043 #include <boost/intrusive_ptr.hpp>
00044 #include <map>
00045 #include <string>
00046 #include <vector>
00047 #include "../os/Atomic.hpp"
00048 #include "../rtt-config.h"
00049 #include "ActionInterface.hpp"
00050 #include "../rtt-fwd.hpp"
00051
00052 namespace RTT
00053 { namespace base {
00054
00076 class RTT_API DataSourceBase
00077 {
00078 protected:
00088 mutable os::AtomicInt refcount;
00089
00093 virtual ~DataSourceBase();
00094
00095 public:
00099 typedef boost::intrusive_ptr<DataSourceBase> shared_ptr;
00100
00104 typedef boost::intrusive_ptr<const DataSourceBase> const_ptr;
00105
00111 static shared_ptr stack_shared_ptr(DataSourceBase* dsb);
00112
00118 static const_ptr stack_const_ptr(const DataSourceBase* dsb);
00119
00120 DataSourceBase();
00124 void ref() const;
00128 void deref() const;
00129
00133 virtual void reset();
00134
00139 virtual bool evaluate() const = 0;
00140
00146 virtual bool isAssignable() const;
00147
00153 virtual void updated();
00154
00163 virtual bool update( DataSourceBase* other );
00164
00172 virtual ActionInterface* updateAction( DataSourceBase* other);
00173
00182 virtual shared_ptr getMember( const std::string& member_name);
00183
00191 virtual shared_ptr getMember( DataSourceBase::shared_ptr member_id, DataSourceBase::shared_ptr offset);
00192
00199 virtual std::vector<std::string> getMemberNames() const;
00200
00205 virtual shared_ptr getParent();
00206
00213 virtual DataSourceBase* clone() const = 0;
00214
00222 virtual DataSourceBase* copy( std::map<const DataSourceBase*, DataSourceBase*>& alreadyCloned ) const = 0;
00223
00227 virtual std::string getType() const = 0;
00228
00232 virtual const types::TypeInfo* getTypeInfo() const = 0;
00233
00238 virtual std::string getTypeName() const = 0;
00239
00244 std::ostream& write(std::ostream& os);
00245
00250 std::string toString();
00251
00258 virtual void* getRawPointer();
00259
00266 virtual void const* getRawConstPointer();
00267 };
00268
00273 RTT_API std::ostream& operator<<(std::ostream& os, DataSourceBase::shared_ptr dsb );
00274
00275 RTT_API void intrusive_ptr_add_ref( const RTT::base::DataSourceBase* p );
00276 RTT_API void intrusive_ptr_release( const RTT::base::DataSourceBase* p );
00277
00278 }}
00279
00280 #endif