Orocos Real-Time Toolkit  2.9.0
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  // alias may only be evaluated after action was executed.
524  alias->evaluate();
525  return r;
526  }
527 
528  typename DataSource<T>::result_t get() const
529  {
530  action->readArguments();
531  action->execute();
532  return alias->get();
533  }
534 
536  {
537  return alias->value();
538  }
539 
541  {
542  return alias->rvalue();
543  }
544 
545  virtual void reset() { action->reset(); alias->reset(); }
546 
547  virtual ActionAliasDataSource<T>* clone() const {
548  return new ActionAliasDataSource(action, alias.get());
549  }
550  virtual ActionAliasDataSource<T>* copy( std::map<const base::DataSourceBase*, base::DataSourceBase*>& alreadyCloned ) const {
551  return new ActionAliasDataSource( action->copy(alreadyCloned), alias->copy(alreadyCloned) );
552  }
553  };
554 
555 
561  template<typename T>
563  : public AssignableDataSource<T>
564  {
565  base::ActionInterface* action;
567  public:
568  typedef boost::intrusive_ptr<ActionAliasDataSource<T> > shared_ptr;
569 
571  : action(act), alias(ds)
572  {}
573 
575 
576  bool evaluate() const {
577  // since get() may return a copy, we override evaluate() to
578  // call alias->get() with alias->evaluate().
579  action->readArguments();
580  bool r = action->execute();
581  // alias may only be evaluated after action was executed.
582  alias->evaluate();
583  return r;
584  }
585 
586  typename DataSource<T>::result_t get() const
587  {
588  action->readArguments();
589  action->execute();
590  return alias->get();
591  }
592 
594  {
595  return alias->value();
596  }
597 
598  void set( typename AssignableDataSource<T>::param_t t ) {
599  alias->set( t );
600  }
601 
603  {
604  return alias->set();
605  }
606 
608  {
609  return alias->rvalue();
610  }
611 
612  virtual void reset() { action->reset(); alias->reset(); }
613 
615  return new ActionAliasAssignableDataSource(action, alias.get());
616  }
617  virtual ActionAliasAssignableDataSource<T>* copy( std::map<const base::DataSourceBase*, base::DataSourceBase*>& alreadyCloned ) const {
618  return new ActionAliasAssignableDataSource( action->copy(alreadyCloned), alias->copy(alreadyCloned) );
619  }
620  };
621 
636  template<typename BoundType>
638  : public BoundType
639  {
640  public:
641  typedef typename BoundType::result_t T;
642  typedef boost::intrusive_ptr< UnboundDataSource<BoundType> > shared_ptr;
643 
644  UnboundDataSource( T data );
645 
647 
649  }
650 
651  virtual BoundType* clone() const {
652  return BoundType::clone();
653  }
654 
655  virtual UnboundDataSource<BoundType>* copy( std::map<const base::DataSourceBase*, base::DataSourceBase*>& replace) const;
656  };
657 
670  template<typename function>
672  : public DataSource< typename remove_cr<typename function::result_type>::type >
673  {
675  typedef typename remove_cr<typename function::first_argument_type>::type first_arg_t;
676  typedef typename remove_cr<typename function::second_argument_type>::type second_arg_t;
679  function fun;
680  mutable value_t mdata;
681  public:
682  typedef boost::intrusive_ptr<BinaryDataSource<function> > shared_ptr;
683 
690  function f )
691  : mdsa( a ), mdsb( b ), fun( f )
692  {
693  }
694 
695  virtual value_t get() const
696  {
697  first_arg_t a = mdsa->get();
698  second_arg_t b = mdsb->get();
699  return mdata = fun( a, b );
700  }
701 
702  virtual value_t value() const
703  {
704  return mdata;
705  }
706 
708  {
709  return mdata;
710  }
711 
712  virtual void reset()
713  {
714  mdsa->reset();
715  mdsb->reset();
716  }
717 
719  {
720  return new BinaryDataSource<function>(mdsa.get(), mdsb.get(), fun);
721  }
722 
723  virtual BinaryDataSource<function>* copy( std::map<const base::DataSourceBase*, base::DataSourceBase*>& alreadyCloned ) const {
724  return new BinaryDataSource<function>( mdsa->copy( alreadyCloned ), mdsb->copy( alreadyCloned ), fun );
725  }
726  };
727 
733  template <typename function>
735  : public DataSource<typename remove_cr<typename function::result_type>::type>
736  {
739  typename DataSource<arg_t>::shared_ptr mdsa;
740  function fun;
741  mutable value_t mdata;
742  public:
743  typedef boost::intrusive_ptr<UnaryDataSource<function> > shared_ptr;
744 
750  : mdsa( a ), fun( f )
751  {
752  }
753 
754  virtual value_t get() const
755  {
756  return mdata = fun( mdsa->get() );
757  }
758 
759  virtual value_t value() const
760  {
761  return mdata;
762  }
763 
765  {
766  return mdata;
767  }
768 
769 
770  void reset()
771  {
772  mdsa->reset();
773  }
774 
776  {
777  return new UnaryDataSource<function>(mdsa.get(), fun);
778  }
779 
780  virtual UnaryDataSource<function>* copy( std::map<const base::DataSourceBase*, base::DataSourceBase*>& alreadyCloned ) const {
781  return new UnaryDataSource<function>( mdsa->copy( alreadyCloned ), fun );
782  }
783  };
784 
792  template<typename function>
794  : public DataSource<typename remove_cr<typename function::result_type>::type>
795  {
798  mutable std::vector<arg_t> margs;
799  std::vector<typename DataSource<arg_t>::shared_ptr > mdsargs;
800  function fun;
801  mutable value_t mdata;
802  public:
803  typedef boost::intrusive_ptr<NArityDataSource<function> > shared_ptr;
804 
809  NArityDataSource( function f = function() )
810  : fun( f )
811  {
812  }
813 
818  NArityDataSource( function f, const std::vector<typename DataSource<arg_t>::shared_ptr >& dsargs )
819  : margs( dsargs.size() ), mdsargs(dsargs), fun( f )
820  {
821  }
822 
823  void add( typename DataSource<arg_t>::shared_ptr ds ) {
824  mdsargs.push_back(ds);
825  margs.push_back( ds->value() );
826  }
827 
828  virtual value_t get() const
829  {
830  assert( mdsargs.size() == margs.size() );
831  for( unsigned int i=0; i !=mdsargs.size(); ++i)
832  margs[i] = mdsargs[i]->get();
833  return mdata = fun( margs );
834  }
835 
836  virtual value_t value() const
837  {
838  return mdata;
839  }
840 
842  {
843  return mdata;
844  }
845 
846  virtual void reset()
847  {
848  for( unsigned int i=0; i !=mdsargs.size(); ++i)
849  mdsargs[i]->reset();
850  }
851 
853  {
854  return new NArityDataSource<function>(fun, mdsargs);
855  }
856 
857  virtual NArityDataSource<function>* copy( std::map<const base::DataSourceBase*, base::DataSourceBase*>& alreadyCloned ) const {
858  std::vector<typename DataSource<arg_t>::shared_ptr > newargs( mdsargs.size() );
859  for( unsigned int i=0; i !=mdsargs.size(); ++i)
860  newargs[i] = mdsargs[i]->copy(alreadyCloned);
861  return new NArityDataSource<function>( fun, newargs );
862  }
863  };
864  }
865 }
866 
867 #include "DataSources.inl"
868 
869 /*
870  * Extern template declarations for core data source types
871  * (instantiated in DataSources.cpp)
872  */
879 
880 #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:52
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...