Go to the documentation of this file. 1 #ifndef _ASTRA_ROS_PARAMETER_HPP_
2 #define _ASTRA_ROS_PARAMETER_HPP_
5 #include <boost/optional.hpp>
20 typedef std::function<bool (
const T &value,
const T &previous)>
OnChange;
32 bool set(
const T &value) noexcept
34 std::lock_guard<std::mutex> lock(
mutex_);
53 const T &
get() const noexcept
55 std::lock_guard<std::mutex> lock(
mutex_);
115 return impl_->set(value);
143 impl_->setOnChangeHandler(on_change);
150 template<
typename F,
typename... Args>
163 return impl_->getOnChangeHandler();
169 template<
typename F,
typename... Args>
172 return OnChange(std::bind(
f,
args..., std::placeholders::_1, std::placeholders::_2));
176 std::shared_ptr<ParameterImpl<T>>
impl_;
const boost::optional< OnChange > & getOnChangeHandler() const
Internal implementation of a Parameter.
void setOnChangeHandler(const boost::optional< OnChange > &on_change)
ParameterImpl(const T &value)
Parameter(const T &value)
bool set(const T &value) noexcept
void bindOnChangeHandler(F &&f, Args &&...args)
static OnChange bind(F &&f, Args &&...args)
A "live" value that can be changed at runtime. Changes are broadcast to a listener.
std::shared_ptr< ParameterImpl< T > > impl_
ParameterImpl< T >::ValueType ValueType
boost::optional< OnChange > on_change_
const T & operator*() const
const T & get() const noexcept
const boost::optional< OnChange > & getOnChangeHandler() const
ParameterImpl< T >::OnChange OnChange
std::function< bool(const T &value, const T &previous)> OnChange
void setOnChangeHandler(const boost::optional< OnChange > &on_change)
astra_ros
Author(s): Braden McDorman
autogenerated on Wed Mar 2 2022 00:53:06