|
1 | | -/*************************************************************************** |
2 | | - * This file is part of the OROCOS toolchain ROS project |
3 | | - * |
4 | | - * (C) 2020, Intermodalics BVBA |
| 1 | +/* |
| 2 | + * (C) 2020, Intermodalics BVBA |
5 | 3 | * |
6 | 4 | * Redistribution and use in source and binary forms, with or without |
7 | 5 | * modification, are permitted provided that the following conditions |
|
11 | 9 | * 2. Redistributions in binary form must reproduce the above copyright |
12 | 10 | * notice, this list of conditions and the following disclaimer in the |
13 | 11 | * documentation and/or other materials provided with the distribution. |
14 | | - * 3. Neither the name of the author nor the names of its contributors may |
15 | | - * be used to endorse or promote products derived from this software |
| 12 | + * 3. Neither the name of the copyright holder nor the names of its contributors |
| 13 | + * may be used to endorse or promote products derived from this software |
16 | 14 | * without specific prior written permission. |
17 | 15 | * |
18 | | - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |
19 | | - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
20 | | - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
21 | | - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
22 | | - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
23 | | - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
24 | | - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
25 | | - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
26 | | - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
27 | | - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
28 | | - * SUCH DAMAGE. |
| 16 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 | + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 | + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 19 | + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
| 20 | + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 21 | + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
| 22 | + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 23 | + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| 24 | + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 25 | + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
| 26 | + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 27 | + * POSSIBILITY OF SUCH DAMAGE. |
29 | 28 | */ |
30 | 29 |
|
31 | 30 | #ifndef __RTT_ROSPARAM__ROS_PARAM_DATA_SOURCE_HPP |
32 | 31 | #define __RTT_ROSPARAM__ROS_PARAM_DATA_SOURCE_HPP |
33 | 32 |
|
34 | 33 | #include "rtt/internal/DataSource.hpp" |
35 | | -#include "rtt/internal/DataSourceTypeInfo.hpp" |
36 | | -#include "rtt/internal/Reference.hpp" |
37 | 34 | #include "rtt/Logger.hpp" |
38 | 35 |
|
39 | | -#include "ros/ros.h" |
40 | 36 | #include "ros/param.h" |
41 | | -#include "ros/names.h" |
42 | | - |
43 | | -#include <boost/function.hpp> |
44 | | -#include <exception> |
45 | 37 |
|
46 | 38 | using namespace RTT; |
47 | 39 |
|
@@ -82,7 +74,8 @@ class RosParamDataSource |
82 | 74 | { |
83 | 75 | } |
84 | 76 |
|
85 | | - typename internal::DataSource<T>::result_t get() const { |
| 77 | + typename internal::DataSource<T>::result_t get() const |
| 78 | + { |
86 | 79 | (void) evaluate(); |
87 | 80 | return value(); |
88 | 81 | } |
@@ -115,16 +108,16 @@ class RosParamDataSource |
115 | 108 | updated(); |
116 | 109 | } |
117 | 110 |
|
118 | | - // There is not referred element, no allocation exists for this data source |
119 | | - // and it is not an alias. |
| 111 | + // The referenced element is a cache, since the source of the data is external. |
120 | 112 | // After working with the reference, if something was assigned, the data |
121 | 113 | // source may need a call to updated() after set() |
122 | 114 | typename internal::AssignableDataSource<T>::reference_t set() |
123 | 115 | { |
124 | 116 | return mcached_data_; |
125 | 117 | } |
126 | 118 |
|
127 | | - void updated() { |
| 119 | + void updated() |
| 120 | + { |
128 | 121 | ros::param::set(mparam_name_, mcached_data_); |
129 | 122 | } |
130 | 123 |
|
|
0 commit comments