Orocos Real-Time Toolkit  2.9.0
PropertyBase.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  tag: Peter Soetens Mon Jan 19 14:11:20 CET 2004 PropertyBase.hpp
3 
4  PropertyBase.hpp - description
5  -------------------
6  begin : Mon January 19 2004
7  copyright : (C) 2004 Peter Soetens
8  email : peter.soetens@mech.kuleuven.ac.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 #ifndef PI_PROPERTYBASE
39 #define PI_PROPERTYBASE
40 
41 #include <string>
42 #include "ActionInterface.hpp"
43 #include "DataSourceBase.hpp"
44 
45 #ifdef ORO_PRAGMA_INTERFACE
46 #pragma interface
47 #endif
48 
49 namespace RTT
50 { namespace base {
51 
57  {
58  public:
62  virtual ~PropertyBase();
63 
71  PropertyBase( std::string name, std::string description);
72 
76  PropertyBase();
77 
82  virtual PropertyBase& operator=( PropertyBase* source ) = 0;
83 
88  const std::string& getName() const { return _name; }
89 
94  void setName(const std::string& name);
95 
100  const std::string& getDescription() const { return _description; }
101 
106  void setDescription(const std::string& desc);
107 
114  bool ready() const { return this->getDataSource().get() != 0; }
115 
121  virtual void identify( PropertyIntrospection* pi) = 0;
122 
128  virtual void identify( PropertyBagVisitor* pi);
129 
140  virtual bool update( const PropertyBase* other ) = 0;
141 
152  virtual bool refresh( const PropertyBase* other ) = 0;
153 
164  virtual bool copy( const PropertyBase* other ) = 0;
165 
172  virtual bool compose( const PropertyBag& source);
173 
179  virtual PropertyBase* clone() const = 0;
180 
186  virtual PropertyBase* create() const = 0;
187 
193  virtual PropertyBase* create( const base::DataSourceBase::shared_ptr& datasource ) const = 0;
194 
199  virtual DataSourceBase::shared_ptr getDataSource() const = 0;
200 
206  virtual bool setDataSource( const DataSourceBase::shared_ptr& dsb ) = 0;
207 
212  virtual std::string getType() const = 0;
213 
217  virtual const types::TypeInfo* getTypeInfo() const = 0;
218 
219  protected:
223  std::string _name;
224 
228  std::string _description;
229  };
230 
236  RTT_API std::ostream& operator<<(std::ostream &os, PropertyBase* p);
237 
238 
239  }
240 } // namespace RTT
241 #endif
bool ready() const
Inspect if this Property is correctly initialised and ready for usage.
Base class for all properties.
#define RTT_API
Definition: rtt-config.h:97
A container for holding references to properties.
Definition: PropertyBag.hpp:96
std::string _name
A short name for this PropertyBase.
A simple introspection interface to visit PropertyBags.
RTT_API std::ostream & operator<<(std::ostream &os, DataSourceBase::shared_ptr dsb)
Stream the contents of this object.
Definition: DataSource.cpp:46
A class for representing a user type, and which can build instances of that type. ...
Definition: TypeInfo.hpp:67
const std::string & getDescription() const
Get a description of the property.
An interface which all classes which wish to visit a Property should implement.
std::string _description
A lengthy description for this PropertyBase.
const std::string & getName() const
Get the name of the property.
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:52