ChannelDataElement.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  tag: Peter Soetens Thu Oct 22 11:59:08 CEST 2009 ChannelDataElement.hpp
3 
4  ChannelDataElement.hpp - description
5  -------------------
6  begin : Thu October 22 2009
7  copyright : (C) 2009 Sylvain Joyeux
8  email : sylvain.joyeux@m4x.org
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_CHANNEL_DATA_ELEMENT_HPP
40 #define ORO_CHANNEL_DATA_ELEMENT_HPP
41 
42 #include "../base/ChannelElement.hpp"
43 #include "../base/DataObjectInterface.hpp"
44 #include "../ConnPolicy.hpp"
45 
46 namespace RTT { namespace internal {
47 
50  template<typename T>
52  {
55 
56  public:
60 
62  : data(sample), policy(policy) {}
63 
66  virtual WriteStatus write(param_t sample)
67  {
68  if (!data->Set(sample)) return WriteFailure;
69  return this->signal() ? WriteSuccess : NotConnected;
70  }
71 
76  virtual FlowStatus read(reference_t sample, bool copy_old_data)
77  {
78  return data->Get(sample, copy_old_data);
79  }
80 
84  virtual void clear()
85  {
86  data->clear();
88  }
89 
90  virtual WriteStatus data_sample(param_t sample, bool reset = true)
91  {
92  if (!data->data_sample(sample, reset)) return WriteFailure;
93  return base::ChannelElement<T>::data_sample(sample, reset);
94  }
95 
96  virtual value_t data_sample()
97  {
98  return data->data_sample();
99  }
100 
103  virtual const ConnPolicy* getConnPolicy() const
104  {
105  return &policy;
106  }
107 
108  virtual std::string getElementName() const
109  {
110  return "ChannelDataElement";
111  };
112  };
113 }}
114 
115 #endif
116 
virtual WriteStatus write(param_t sample)
boost::call_traits< T >::param_type param_t
base::DataObjectInterface< T >::shared_ptr data
boost::shared_ptr< DataObjectInterface< T > > shared_ptr
virtual WriteStatus data_sample(param_t sample, bool reset=true)
FlowStatus
Definition: FlowStatus.hpp:56
virtual FlowStatus Get(reference_t pull, bool copy_old_data=true) const =0
base::ChannelElement< T >::value_t value_t
ChannelDataElement(typename base::DataObjectInterface< T >::shared_ptr sample, const ConnPolicy &policy=ConnPolicy())
virtual bool data_sample(param_t sample, bool reset=true)=0
virtual const ConnPolicy * getConnPolicy() const
boost::call_traits< T >::reference reference_t
virtual value_t data_sample()
virtual std::string getElementName() const
virtual FlowStatus read(reference_t sample, bool copy_old_data)
virtual bool Set(param_t push)=0
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition: Activity.cpp:53
base::ChannelElement< T >::param_t param_t
WriteStatus
Definition: FlowStatus.hpp:66
base::ChannelElement< T >::reference_t reference_t


rtt
Author(s): RTT Developers
autogenerated on Fri Oct 25 2019 03:59:31