Orocos Real-Time Toolkit  2.8.3
DataSources.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  tag: Peter Soetens Mon Jun 26 13:25:56 CEST 2006 DataSources.hpp
3 
4  DataSources.hpp - description
5  -------------------
6  begin : Mon June 26 2006
7  copyright : (C) 2006 Peter Soetens
8  email : peter.soetens@fmtc.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 #ifndef ORO_CORELIB_DATASOURCES_HPP
40 #define ORO_CORELIB_DATASOURCES_HPP
41 
42 #include "mystd.hpp"
43 #include "DataSource.hpp"
44 #include "DataSourceTypeInfo.hpp"
45 #include "Reference.hpp"
46 #include <vector>
47 
48 namespace RTT
49 {
50  namespace internal {
51 
59  template<typename T>
61  : public AssignableDataSource<T>
62  {
63  protected:
64  mutable typename DataSource<T>::value_t mdata;
65 
66  public:
71 
72  typedef boost::intrusive_ptr<ValueDataSource<T> > shared_ptr;
73 
74  ValueDataSource( T data );
75 
76  ValueDataSource( );
77 
78  typename DataSource<T>::result_t get() const
79  {
80  return mdata;
81  }
82 
83  typename DataSource<T>::result_t value() const
84  {
85  return mdata;
86  }
87 
88  void set( typename AssignableDataSource<T>::param_t t );
89 
91  {
92  return mdata;
93  }
94 
96  {
97  return mdata;
98  }
99 
100  virtual ValueDataSource<T>* clone() const;
101 
102  virtual ValueDataSource<T>* copy( std::map<const base::DataSourceBase*, base::DataSourceBase*>& replace ) const;
103  };
104 
110  template<typename T>
112  : public DataSource<T>
113  {
118  typename boost::add_const<typename DataSource<T>::value_t>::type mdata;
119 
120  public:
125 
126  typedef boost::intrusive_ptr< ConstantDataSource<T> > shared_ptr;
127 
129 
130  typename DataSource<T>::result_t get() const
131  {
132  return mdata;
133  }
134 
136  {
137  return mdata;
138  }
139 
141  {
142  return mdata;
143  }
144 
145  virtual ConstantDataSource<T>* clone() const;
146 
147  virtual ConstantDataSource<T>* copy( std::map<const base::DataSourceBase*, base::DataSourceBase*>& alreadyCloned ) const;
148  };
149 
155  template<typename T>
157  : public DataSource<T>
158  {
159  // a reference to a value_t
160  typename DataSource<T>::const_reference_t mref;
161  public:
166 
167  typedef boost::intrusive_ptr<ConstReferenceDataSource<T> > shared_ptr;
168 
170 
171  typename DataSource<T>::result_t get() const
172  {
173  return mref;
174  }
175 
177  {
178  return mref;
179  }
180 
182  {
183  return mref;
184  }
185 
186  virtual ConstReferenceDataSource<T>* clone() const;
187 
188  virtual ConstReferenceDataSource<T>* copy( std::map<const base::DataSourceBase*, base::DataSourceBase*>& alreadyCloned ) const;
189  };
190 
191 
197  template<typename T>
199  : public AssignableDataSource<T>, public Reference
200  {
201  // a pointer to a value_t
202  T* mptr;
203  public:
208 
209  typedef boost::intrusive_ptr<ReferenceDataSource<T> > shared_ptr;
210 
212 
213  void setReference(void* ref)
214  {
215  mptr = static_cast<T*>(ref);
216  }
218  {
219  typename AssignableDataSource<T>::shared_ptr ads = boost::dynamic_pointer_cast<AssignableDataSource<T> >(dsb);
220  if (ads) {
221  ads->evaluate();
222  mptr = &ads->set();
223  return true;
224  } else {
225  return false;
226  }
227  }
228 
229  typename DataSource<T>::result_t get() const
230  {
231  return *mptr;
232  }
233 
235  {
236  return *mptr;
237  }
238 
239  void set( typename AssignableDataSource<T>::param_t t );
240 
242  {
243  return *mptr;
244  }
245 
247  {
248  return *mptr;
249  }
250 
251  virtual ReferenceDataSource<T>* clone() const;
252 
253  virtual ReferenceDataSource<T>* copy( std::map<const base::DataSourceBase*, base::DataSourceBase*>& alreadyCloned ) const;
254  };
255 
262  template<typename T>
264  : public DataSource<T>
265  {
266  typename DataSource<T>::shared_ptr alias;
267  public:
268  typedef boost::intrusive_ptr<AliasDataSource<T> > shared_ptr;
269 
271  : alias(ds)
272  {}
273 
275 
276  bool evaluate() const {
277  return alias->evaluate();
278  }
279 
280  typename DataSource<T>::result_t get() const
281  {
282  return alias->get();
283  }
284 
286  {
287  return alias->value();
288  }
289 
291  {
292  return alias->rvalue();
293  }
294 
295  virtual void reset() { alias->reset(); }
296 
297  virtual AliasDataSource<T>* clone() const {
298  return new AliasDataSource(alias.get());
299  }
300  virtual AliasDataSource<T>* copy( std::map<const base::DataSourceBase*, base::DataSourceBase*>& alreadyCloned ) const {
301  return new AliasDataSource(alias->copy(alreadyCloned) );
302  }
303  };
304 
305 
311  template<typename T>
313  : public AssignableDataSource<T>
314  {
315  protected:
316  typename T::value_type* mdata;
318 
319  public:
323  ~ArrayDataSource();
324 
325  typedef boost::intrusive_ptr<ArrayDataSource<T> > shared_ptr;
326 
332  ArrayDataSource( std::size_t size = 0);
333 
339  ArrayDataSource( T const& odata );
347  void newArray( std::size_t size );
348 
349  typename DataSource<T>::result_t get() const
350  {
351  return marray;
352  }
353 
355  {
356  return marray;
357  }
358 
359  void set( typename AssignableDataSource<T>::param_t t );
360 
362  {
363  return marray;
364  }
365 
367  {
368  return marray;
369  }
370 
371  virtual ArrayDataSource<T>* clone() const;
372 
373  virtual ArrayDataSource<T>* copy( std::map<const base::DataSourceBase*, base::DataSourceBase*>& replace ) const;
374  };
375 
384  template<typename T>
386  : public AssignableDataSource<T>
387  {
388  // a reference to a value_t
389  typename AssignableDataSource<T>::value_t* mptr;
390  public:
391 
392  typedef boost::intrusive_ptr<LateReferenceDataSource<T> > shared_ptr;
393 
395  :mptr(ptr) {}
396 
398  mptr = ptr;
399  }
400 
401  typename DataSource<T>::result_t get() const
402  {
403  return *mptr;
404  }
405 
407  {
408  return *mptr;
409  }
410 
411  void const* getRawDataConst()
412  {
413  return mptr;
414  }
415  void* getRawData()
416  {
417  return mptr;
418  }
419 
420  void set( typename AssignableDataSource<T>::param_t t ) {
421  *mptr = t;
422  }
423 
425  {
426  return *mptr;
427  }
428 
430  {
431  return *mptr;
432  }
433 
435  return new LateReferenceDataSource<T>( mptr );
436  }
437 
438  virtual LateReferenceDataSource<T>* copy( std::map<const base::DataSourceBase*, base::DataSourceBase*>& ) const {
439  return const_cast<LateReferenceDataSource<T>* >(this);
440  }
441  };
442 
451  template<typename T>
453  : public DataSource<T>
454  {
455  // a reference to a value_t
456  const typename DataSource<T>::value_t* mptr;
457  public:
458 
459  typedef boost::intrusive_ptr<LateConstReferenceDataSource<T> > shared_ptr;
460 
462  :mptr(ptr) {}
463 
464  void setPointer(const typename AssignableDataSource<T>::value_t* ptr ) {
465  mptr = ptr;
466  }
467 
468  void const* getRawDataConst()
469  {
470  return mptr;
471  }
472 
473  typename DataSource<T>::result_t get() const
474  {
475  return *mptr;
476  }
477 
479  {
480  return *mptr;
481  }
482 
484  {
485  return *mptr;
486  }
487 
489  return new LateConstReferenceDataSource<T>( mptr );
490  }
491 
492  virtual LateConstReferenceDataSource<T>* copy( std::map<const base::DataSourceBase*, base::DataSourceBase*>& ) const {
493  return const_cast<LateConstReferenceDataSource<T>* >(this);
494  }
495  };
496 
497 
503  template<typename T>
505  : public DataSource<T>
506  {
507  base::ActionInterface* action;
508  typename DataSource<T>::shared_ptr alias;
509  public:
510  typedef boost::intrusive_ptr<ActionAliasDataSource<T> > shared_ptr;
511 
513  : action(act), alias(ds)
514  {}
515 
516  ~ActionAliasDataSource() { delete action; }
517 
518  bool evaluate() const {
519  // since get() may return a copy, we override evaluate() to
520  // call alias->get() with alias->evaluate().
521  action->readArguments();
522  bool r = action->execute();
523  action->reset();
524  // alias may only be evaluated after action was executed.
525  alias->evaluate();
526  return r;
527  }
528 
529  typename DataSource<T>::result_t get() const
530  {
531  action->readArguments();
532  action->execute();
533  action->reset();
534  return alias->get();
535  }
536 
538  {
539  return alias->value();
540  }
541 
543  {
544  return alias->rvalue();
545  }
546 
547  virtual void reset() { alias->reset(); }
548 
549  virtual ActionAliasDataSource<T>* clone() const {
550  return new ActionAliasDataSource(action, alias.get());
551  }
552  virtual ActionAliasDataSource<T>* copy( std::map<const base::DataSourceBase*, base::DataSourceBase*>& alreadyCloned ) const {
553  return new ActionAliasDataSource( action->copy(alreadyCloned), alias->copy(alreadyCloned) );
554  }
555  };
556 
557 
563  template<typename T>
565  : public AssignableDataSource<T>
566  {
567  base::ActionInterface* action;
569  public:
570  typedef boost::intrusive_ptr<ActionAliasDataSource<T> > shared_ptr;
571 
573  : action(act), alias(ds)
574  {}
575 
577 
578  bool evaluate() const {
579  // since get() may return a copy, we override evaluate() to
580  // call alias->get() with alias->evaluate().
581  action->readArguments();
582  bool r = action->execute();
583  action->reset();
584  // alias may only be evaluated after action was executed.
585  alias->evaluate();
586  return r;
587  }
588 
589  typename DataSource<T>::result_t get() const
590  {
591  action->readArguments();
592  action->execute();
593  action->reset();
594  return alias->get();
595  }
596 
598  {
599  return alias->value();
600  }
601 
602  void set( typename AssignableDataSource<T>::param_t t ) {
603  alias->set( t );
604  }
605 
607  {
608  return alias->set();
609  }
610 
612  {
613  return alias->rvalue();
614  }
615 
616  virtual void reset() { alias->reset(); }
617 
619  return new ActionAliasAssignableDataSource(action, alias.get());
620  }
621  virtual ActionAliasAssignableDataSource<T>* copy( std::map<const base::DataSourceBase*, base::DataSourceBase*>& alreadyCloned ) const {
622  return new ActionAliasAssignableDataSource( action->copy(alreadyCloned), alias->copy(alreadyCloned) );
623  }
624  };
625 
640  template<typename BoundType>
642  : public BoundType
643  {
644  public:
645  typedef typename BoundType::result_t T;
646  typedef boost::intrusive_ptr< UnboundDataSource<BoundType> > shared_ptr;
647 
648  UnboundDataSource( T data );
649 
651 
653  }
654 
655  virtual BoundType* clone() const {
656  return BoundType::clone();
657  }
658 
659  virtual UnboundDataSource<BoundType>* copy( std::map<const base::DataSourceBase*, base::DataSourceBase*>& replace) const;
660  };
661 
674  template<typename function>
676  : public DataSource< typename remove_cr<typename function::result_type>::type >
677  {
679  typedef typename remove_cr<typename function::first_argument_type>::type first_arg_t;
680  typedef typename remove_cr<typename function::second_argument_type>::type second_arg_t;
683  function fun;
684  mutable value_t mdata;
685  public:
686  typedef boost::intrusive_ptr<BinaryDataSource<function> > shared_ptr;
687 
694  function f )
695  : mdsa( a ), mdsb( b ), fun( f )
696  {
697  }
698 
699  virtual value_t get() const
700  {
701  first_arg_t a = mdsa->get();
702  second_arg_t b = mdsb->get();
703  return mdata = fun( a, b );
704  }
705 
706  virtual value_t value() const
707  {
708  return mdata;
709  }
710 
712  {
713  return mdata;
714  }
715 
716  virtual void reset()
717  {
718  mdsa->reset();
719  mdsb->reset();
720  }
721 
723  {
724  return new BinaryDataSource<function>(mdsa.get(), mdsb.get(), fun);
725  }
726 
727  virtual BinaryDataSource<function>* copy( std::map<const base::DataSourceBase*, base::DataSourceBase*>& alreadyCloned ) const {
728  return new BinaryDataSource<function>( mdsa->copy( alreadyCloned ), mdsb->copy( alreadyCloned ), fun );
729  }
730  };
731 
737  template <typename function>
739  : public DataSource<typename remove_cr<typename function::result_type>::type>
740  {
743  typename DataSource<arg_t>::shared_ptr mdsa;
744  function fun;
745  mutable value_t mdata;
746  public:
747  typedef boost::intrusive_ptr<UnaryDataSource<function> > shared_ptr;
748 
754  : mdsa( a ), fun( f )
755  {
756  }
757 
758  virtual value_t get() const
759  {
760  return mdata = fun( mdsa->get() );
761  }
762 
763  virtual value_t value() const
764  {
765  return mdata;
766  }
767 
769  {
770  return mdata;
771  }
772 
773 
774  void reset()
775  {
776  mdsa->reset();
777  }
778 
780  {
781  return new UnaryDataSource<function>(mdsa.get(), fun);
782  }
783 
784  virtual UnaryDataSource<function>* copy( std::map<const base::DataSourceBase*, base::DataSourceBase*>& alreadyCloned ) const {
785  return new UnaryDataSource<function>( mdsa->copy( alreadyCloned ), fun );
786  }
787  };
788 
796  template<typename function>
798  : public DataSource<typename remove_cr<typename function::result_type>::type>
799  {
802  mutable std::vector<arg_t> margs;
803  std::vector<typename DataSource<arg_t>::shared_ptr > mdsargs;
804  function fun;
805  mutable value_t mdata;
806  public:
807  typedef boost::intrusive_ptr<NArityDataSource<function> > shared_ptr;
808 
813  NArityDataSource( function f = function() )
814  : fun( f )
815  {
816  }
817 
822  NArityDataSource( function f, const std::vector<typename DataSource<arg_t>::shared_ptr >& dsargs )
823  : margs( dsargs.size() ), mdsargs(dsargs), fun( f )
824  {
825  }
826 
827  void add( typename DataSource<arg_t>::shared_ptr ds ) {
828  mdsargs.push_back(ds);
829  margs.push_back( ds->value() );
830  }
831 
832  virtual value_t get() const
833  {
834  assert( mdsargs.size() == margs.size() );
835  for( unsigned int i=0; i !=mdsargs.size(); ++i)
836  margs[i] = mdsargs[i]->get();
837  return mdata = fun( margs );
838  }
839 
840  virtual value_t value() const
841  {
842  return mdata;
843  }
844 
846  {
847  return mdata;
848  }
849 
850  virtual void reset()
851  {
852  for( unsigned int i=0; i !=mdsargs.size(); ++i)
853  mdsargs[i]->reset();
854  }
855 
857  {
858  return new NArityDataSource<function>(fun, mdsargs);
859  }
860 
861  virtual NArityDataSource<function>* copy( std::map<const base::DataSourceBase*, base::DataSourceBase*>& alreadyCloned ) const {
862  std::vector<typename DataSource<arg_t>::shared_ptr > newargs( mdsargs.size() );
863  for( unsigned int i=0; i !=mdsargs.size(); ++i)
864  newargs[i] = mdsargs[i]->copy(alreadyCloned);
865  return new NArityDataSource<function>( fun, newargs );
866  }
867  };
868  }
869 }
870 
871 #include "DataSources.inl"
872 
873 /*
874  * Extern template declarations for core data source types
875  * (instantiated in DataSources.cpp)
876  */
883 
884 #endif
void setPointer(typename AssignableDataSource< T >::value_t *ptr)
DataSource< T >::result_t value() const
Return the result of the last evaluate() function.
bool evaluate() const
Force an evaluation of the DataSourceBase.
DataSource is a base class representing a generic way to read data of type T.
Definition: DataSource.hpp:94
A DataSource which returns the return value of a unary function.
BinaryDataSource(typename DataSource< first_arg_t >::shared_ptr a, typename DataSource< second_arg_t >::shared_ptr b, function f)
Create a DataSource which returns the return value of a function f which is given argument a and b...
NArityDataSource(function f=function())
Create a DataSource which returns the return value of a function f.
virtual LateReferenceDataSource< T > * clone() const
Return a shallow clone of this DataSource.
DataSource< T >::value_t mdata
Definition: DataSources.hpp:64
DataSource< T >::result_t value() const
Return the result of the last evaluate() function.
DataSource< T >::result_t value() const
Return the result of the last evaluate() function.
virtual result_t get() const =0
Return the data as type T.
LateReferenceDataSource(typename AssignableDataSource< T >::value_t *ptr=0)
bool evaluate() const
Force an evaluation of the DataSourceBase.
boost::intrusive_ptr< ActionAliasDataSource< T > > shared_ptr
virtual NArityDataSource< function > * clone() const
Return a shallow clone of this DataSource.
boost::intrusive_ptr< UnboundDataSource< BoundType > > shared_ptr
virtual LateReferenceDataSource< T > * copy(std::map< const base::DataSourceBase *, base::DataSourceBase * > &) const
Create a deep copy of this internal::DataSource, unless it is already cloned.
virtual UnaryDataSource< function > * copy(std::map< const base::DataSourceBase *, base::DataSourceBase * > &alreadyCloned) const
Create a deep copy of this internal::DataSource, unless it is already cloned.
boost::intrusive_ptr< UnaryDataSource< function > > shared_ptr
A DataSource which is used to manipulate a reference to an external value, by means of a pointer...
boost::call_traits< value_t >::reference reference_t
Definition: DataSource.hpp:193
virtual void reset()
Reset this action.
virtual ValueDataSource< T > * copy(std::map< const base::DataSourceBase *, base::DataSourceBase * > &replace) const
Create a deep copy of this internal::DataSource, unless it is already cloned.
Definition: DataSources.inl:50
DataSource< T >::result_t value() const
Return the result of the last evaluate() function.
boost::intrusive_ptr< ArrayDataSource< T > > shared_ptr
void setReference(void *ref)
Sets the reference to a given pointer.
virtual void reset()
Reset the data to initial values.
boost::intrusive_ptr< LateConstReferenceDataSource< T > > shared_ptr
virtual void set(param_t t)=0
Set this DataSource with a value.
boost::intrusive_ptr< ConstantDataSource< T > > shared_ptr
virtual value_t value() const
Return the result of the last evaluate() function.
virtual void readArguments()=0
This is invoked some time before execute() at a time when the action may read its function arguments...
void add(typename DataSource< arg_t >::shared_ptr ds)
bool setReference(base::DataSourceBase::shared_ptr dsb)
Sets the reference to the data contained in the data source.
T value_t
The bare type of T is extracted into value_t.
Definition: DataSource.hpp:105
AliasDataSource(DataSource< T > *ds)
boost::intrusive_ptr< ConstReferenceDataSource< T > > shared_ptr
DataSource< T >::result_t value() const
Return the result of the last evaluate() function.
Definition: DataSources.hpp:83
bool evaluate() const
Force an evaluation of the DataSourceBase.
DataSource< T >::const_reference_t rvalue() const
Get a const reference to the value of this DataSource.
A DataSource which is used to manipulate a reference to an external value.
A DataSource which is used to read a const reference to an external value.
virtual void reset()
Reset the data to initial values.
NArityDataSource(function f, const std::vector< typename DataSource< arg_t >::shared_ptr > &dsargs)
Create a DataSource which returns the return value of a function f.
virtual void reset()
Reset the data to initial values.
Definition: DataSource.cpp:87
UnaryDataSource(typename DataSource< arg_t >::shared_ptr a, function f)
Create a DataSource which returns the return value of a function f which is given argument a...
A DataSource which is used to manipulate a const reference to an external value, by means of a pointe...
A generic binary composite DataSource.
boost::intrusive_ptr< NArityDataSource< function > > shared_ptr
virtual DataSource< T > * copy(std::map< const base::DataSourceBase *, base::DataSourceBase * > &alreadyCloned) const =0
Create a deep copy of this internal::DataSource, unless it is already cloned.
DataSource< T >::result_t value() const
Return the result of the last evaluate() function.
AssignableDataSource< T >::const_reference_t rvalue() const
Get a const reference to the value of this DataSource.
virtual void reset()
Reset the data to initial values.
AssignableDataSource< T >::const_reference_t rvalue() const
Get a const reference to the value of this DataSource.
AssignableDataSource< T >::const_reference_t rvalue() const
Get a const reference to the value of this DataSource.
DataSource< T >::result_t value() const
Return the result of the last evaluate() function.
virtual NArityDataSource< function > * copy(std::map< const base::DataSourceBase *, base::DataSourceBase * > &alreadyCloned) const
Create a deep copy of this internal::DataSource, unless it is already cloned.
A DataSource which is used to execute an action and then return the value of another DataSource...
virtual value_t value() const
Return the result of the last evaluate() function.
virtual BoundType * clone() const
DataSource< T >::const_reference_t rvalue() const
Get a const reference to the value of this DataSource.
virtual const_reference_t rvalue() const =0
Get a const reference to the value of this DataSource.
virtual bool execute()=0
Execute the functionality of this action.
boost::intrusive_ptr< LateReferenceDataSource< T > > shared_ptr
boost::intrusive_ptr< AliasDataSource< T > > shared_ptr
#define RTT_EXT_IMPL
Definition: rtt-config.h:100
Based on the software pattern &#39;command&#39;, this interface allows execution of action objects...
DataSource< value_t >::const_reference_t rvalue() const
Get a const reference to the value of this DataSource.
ActionAliasAssignableDataSource(base::ActionInterface *act, AssignableDataSource< T > *ds)
virtual value_t value() const
Return the result of the last evaluate() function.
virtual AliasDataSource< T > * clone() const
Return a shallow clone of this DataSource.
A DataSource which is used to mirror another datasource.
virtual BinaryDataSource< function > * clone() const
Return a shallow clone of this DataSource.
virtual void reset()
Reset the data to initial values.
LateConstReferenceDataSource(const typename DataSource< T >::value_t *ptr=0)
virtual LateConstReferenceDataSource< T > * copy(std::map< const base::DataSourceBase *, base::DataSourceBase * > &) const
Create a deep copy of this internal::DataSource, unless it is already cloned.
boost::intrusive_ptr< DataSource< T > > shared_ptr
Definition: DataSource.hpp:115
boost::intrusive_ptr< AssignableDataSource< T > > shared_ptr
Use this type to store a pointer to an AssignableDataSource.
Definition: DataSource.hpp:198
virtual void reset()
Reset the data to initial values.
DataSource< T >::result_t value() const
Return the result of the last evaluate() function.
virtual BinaryDataSource< function > * copy(std::map< const base::DataSourceBase *, base::DataSourceBase * > &alreadyCloned) const
Create a deep copy of this internal::DataSource, unless it is already cloned.
DataSource< T >::result_t value() const
Return the result of the last evaluate() function.
A special DataSource only to be used for if you understand the copy()/clone() semantics very well...
DataSource< T >::const_reference_t rvalue() const
Get a const reference to the value of this DataSource.
A DataSource which holds a constant value and returns it in its get() method.
virtual AliasDataSource< T > * copy(std::map< const base::DataSourceBase *, base::DataSourceBase * > &alreadyCloned) const
Create a deep copy of this internal::DataSource, unless it is already cloned.
ActionAliasDataSource(base::ActionInterface *act, DataSource< T > *ds)
A DataSource that holds a fixed size array, using the types::carray class.
virtual ActionAliasDataSource< T > * copy(std::map< const base::DataSourceBase *, base::DataSourceBase * > &alreadyCloned) const
Create a deep copy of this internal::DataSource, unless it is already cloned.
A DataSource which has set() methods.
Definition: DataSource.hpp:184
DataSource< T >::const_reference_t rvalue() const
Get a const reference to the value of this DataSource.
virtual ActionAliasDataSource< T > * clone() const
Return a shallow clone of this DataSource.
virtual ValueDataSource< T > * clone() const
Return a shallow clone of this DataSource.
Definition: DataSources.inl:44
boost::intrusive_ptr< ReferenceDataSource< T > > shared_ptr
void reset()
Reset the data to initial values.
void setPointer(const typename AssignableDataSource< T >::value_t *ptr)
DataSource< value_t >::const_reference_t rvalue() const
Get a const reference to the value of this DataSource.
boost::remove_const< typename boost::remove_reference< T >::type >::type type
Definition: mystd.hpp:63
virtual result_t value() const =0
Return the result of the last evaluate() function.
DataSource< T >::value_t value_t
Definition: DataSource.hpp:190
DataSource< T >::const_reference_t const_reference_t
Definition: DataSource.hpp:191
DataSource< T >::const_reference_t rvalue() const
Get a const reference to the value of this DataSource.
Object that may receive a reference to some data by means of a pointer or data source.
Definition: Reference.hpp:15
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
AssignableDataSource< T >::const_reference_t rvalue() const
Get a const reference to the value of this DataSource.
Definition: DataSources.hpp:95
virtual LateConstReferenceDataSource< T > * clone() const
Return a shallow clone of this DataSource.
virtual bool evaluate() const
Force an evaluation of the DataSourceBase.
Definition: DataSource.inl:52
AssignableDataSource< T >::const_reference_t rvalue() const
Get a const reference to the value of this DataSource.
void ref() const
Increase the reference count by one.
Definition: DataSource.cpp:80
A simple, yet very useful DataSource, which keeps a value, and returns it in its get() method...
Definition: DataSources.hpp:60
~ValueDataSource()
Use shared_ptr.
Definition: DataSources.inl:11
details::GetConstRef< T >::type const_reference_t
Definition: DataSource.hpp:107
virtual ActionAliasAssignableDataSource< T > * clone() const
Return a shallow clone of this DataSource.
virtual ActionAliasAssignableDataSource< T > * copy(std::map< const base::DataSourceBase *, base::DataSourceBase * > &alreadyCloned) const
Create a deep copy of this internal::DataSource, unless it is already cloned.
A generic N-arity composite DataSource.
DataSource< value_t >::const_reference_t rvalue() const
Get a const reference to the value of this DataSource.
boost::intrusive_ptr< ValueDataSource< T > > shared_ptr
Definition: DataSources.hpp:72
DataSource< T >::result_t value() const
Return the result of the last evaluate() function.
virtual UnaryDataSource< function > * clone() const
Return a shallow clone of this DataSource.
boost::intrusive_ptr< ActionAliasDataSource< T > > shared_ptr
boost::intrusive_ptr< BinaryDataSource< function > > shared_ptr
An AssignableDataSource which is used to execute an action and then return the value of another DataS...
virtual AssignableDataSource< T > * copy(std::map< const base::DataSourceBase *, base::DataSourceBase * > &alreadyCloned) const =0
Create a deep copy of this internal::DataSource, unless it is already cloned.
boost::call_traits< value_t >::param_type param_t
Definition: DataSource.hpp:192
virtual ActionInterface * copy(std::map< const DataSourceBase *, DataSourceBase * > &alreadyCloned) const
When copying an Orocos program, we want identical internal::DataSource&#39;s to be mapped to identical Da...