Orocos Real-Time Toolkit  2.8.3
DataSourceBase.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  tag: Peter Soetens Wed Jan 18 14:11:39 CET 2006 DataSourceBase.hpp
3 
4  DataSourceBase.hpp - description
5  -------------------
6  begin : Wed January 18 2006
7  copyright : (C) 2006 Peter Soetens
8  email : peter.soetens@mech.kuleuven.be
9 
10  ***************************************************************************
11  * This library is free software; you can redistribute it and/or *
12  * modify it under the terms of the GNU General Public *
13  * License as published by the Free Software Foundation; *
14  * version 2 of the License. *
15  * *
16  * As a special exception, you may use this file as part of a free *
17  * software library without restriction. Specifically, if other files *
18  * instantiate templates or use macros or inline functions from this *
19  * file, or you compile this file and link it with other files to *
20  * produce an executable, this file does not by itself cause the *
21  * resulting executable to be covered by the GNU General Public *
22  * License. This exception does not however invalidate any other *
23  * reasons why the executable file might be covered by the GNU General *
24  * Public License. *
25  * *
26  * This library is distributed in the hope that it will be useful, *
27  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
28  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
29  * Lesser General Public License for more details. *
30  * *
31  * You should have received a copy of the GNU General Public *
32  * License along with this library; if not, write to the Free Software *
33  * Foundation, Inc., 59 Temple Place, *
34  * Suite 330, Boston, MA 02111-1307 USA *
35  * *
36  ***************************************************************************/
37 
38 
39 
40 #ifndef CORELIB_DATASOURCE_BASE_HPP
41 #define CORELIB_DATASOURCE_BASE_HPP
42 
43 #include <boost/intrusive_ptr.hpp>
44 #include <map>
45 #include <string>
46 #include <vector>
47 #include "../os/Atomic.hpp"
48 #include "../rtt-config.h"
49 #include "ActionInterface.hpp"
50 #include "../rtt-fwd.hpp"
51 
52 namespace RTT
53 { namespace base {
54 
77  {
78  protected:
89 
93  virtual ~DataSourceBase();
94 
95  public:
99  typedef boost::intrusive_ptr<DataSourceBase> shared_ptr;
100 
104  typedef boost::intrusive_ptr<const DataSourceBase> const_ptr;
105 
111  static shared_ptr stack_shared_ptr(DataSourceBase* dsb);
112 
118  static const_ptr stack_const_ptr(const DataSourceBase* dsb);
119 
120  DataSourceBase();
124  void ref() const;
128  void deref() const;
129 
133  virtual void reset();
134 
139  virtual bool evaluate() const = 0;
140 
146  virtual bool isAssignable() const;
147 
153  virtual void updated();
154 
163  virtual bool update( DataSourceBase* other );
164 
172  virtual ActionInterface* updateAction( DataSourceBase* other);
173 
182  virtual shared_ptr getMember( const std::string& member_name);
183 
191  virtual shared_ptr getMember( DataSourceBase::shared_ptr member_id, DataSourceBase::shared_ptr offset);
192 
199  virtual std::vector<std::string> getMemberNames() const;
200 
205  virtual shared_ptr getParent();
206 
213  virtual DataSourceBase* clone() const = 0;
214 
222  virtual DataSourceBase* copy( std::map<const DataSourceBase*, DataSourceBase*>& alreadyCloned ) const = 0;
223 
227  virtual std::string getType() const = 0;
228 
232  virtual const types::TypeInfo* getTypeInfo() const = 0;
233 
238  virtual std::string getTypeName() const = 0;
239 
244  std::ostream& write(std::ostream& os);
245 
250  std::string toString();
251 
258  virtual void* getRawPointer();
259 
266  virtual void const* getRawConstPointer();
267  };
268 
273  RTT_API std::ostream& operator<<(std::ostream& os, DataSourceBase::shared_ptr dsb );
274 
277 
278 }}
279 
280 #endif
The base class for all internal data representations.
C++ abstraction of atomic integer operations.
Definition: Atomic.hpp:49
void RTT_API intrusive_ptr_add_ref(ChannelElementBase *e)
os::AtomicInt refcount
We keep the refcount ourselves.
#define RTT_API
Definition: rtt-config.h:97
RTT_API std::ostream & operator<<(std::ostream &os, DataSourceBase::shared_ptr dsb)
Stream the contents of this object.
Definition: DataSource.cpp:46
Based on the software pattern &#39;command&#39;, this interface allows execution of action objects...
A class for representing a user type, and which can build instances of that type. ...
Definition: TypeInfo.hpp:66
boost::intrusive_ptr< const DataSourceBase > const_ptr
Use this type to store a const pointer to a DataSourceBase.
void RTT_API intrusive_ptr_release(ChannelElementBase *e)
boost::intrusive_ptr< DataSourceBase > shared_ptr
Use this type to store a pointer to a DataSourceBase.
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition: Activity.cpp:51