Orocos Real-Time Toolkit  2.8.3
PropertyBase.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  tag: Peter Soetens Thu Jul 15 11:21:05 CEST 2004 PropertyBase.cxx
3 
4  PropertyBase.cxx - description
5  -------------------
6  begin : Thu July 15 2004
7  copyright : (C) 2004 Peter Soetens
8  email : peter.soetens at 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 #ifdef ORO_PRAGMA_INTERFACE
39 #pragma implementation
40 #endif
41 #include "PropertyBase.hpp"
42 #include "internal/DataSources.hpp"
43 #include "PropertyBag.hpp"
44 #include "../types/PropertyDecomposition.hpp"
45 
46 namespace RTT {
47  using namespace detail;
48 
50  {}
51 
53  {}
54 
55  PropertyBase::PropertyBase( std::string name, std::string description)
56  : _name(name), _description(description)
57  {}
58 
59  void PropertyBase::setName(const std::string& name)
60  {
61  _name = name;
62  }
63 
64  void PropertyBase::setDescription(const std::string& desc)
65  {
66  _description = desc;
67  }
68 
69  namespace base {
70  std::ostream& operator<<(std::ostream &os, PropertyBase* p)
71  {
72  if ( p )
73  os << p->getDataSource();
74  else
75  os << "(null property)";
76  return os;
77  }
78  }
79 
80  bool PropertyBase::compose( const PropertyBag& source)
81  {
84  rds.ref();
85  if (dsb)
86  return dsb->getTypeInfo()->composeType( &rds, dsb);
87  return false;
88  }
89 }
Base class for all properties.
A DataSource which is used to read a const reference to an external value.
A container for holding references to properties.
Definition: PropertyBag.hpp:96
PropertyBase()
Create an uninitialised PropertyBase.
std::string _name
A short name for this PropertyBase.
virtual bool compose(const PropertyBag &source)
Composes the data of this property with information found in a PropertyBag.
RTT_API std::ostream & operator<<(std::ostream &os, DataSourceBase::shared_ptr dsb)
Stream the contents of this object.
Definition: DataSource.cpp:46
virtual ~PropertyBase()
The default destructor.
void setName(const std::string &name)
Set the name of the property.
std::string _description
A lengthy description for this PropertyBase.
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
void ref() const
Increase the reference count by one.
Definition: DataSource.cpp:80
virtual DataSourceBase::shared_ptr getDataSource() const =0
Get an assignable base::DataSource through which this PropertyBase can be manipulated.
void setDescription(const std::string &desc)
Set the description of the property.