72 OSSIA_EXPORT
friend bool operator==(
const state& lhs,
const state& rhs);
73 OSSIA_EXPORT
friend bool operator!=(
const state& lhs,
const state& rhs);
75 auto begin() {
return m_children.begin(); }
76 auto end() {
return m_children.end(); }
77 auto begin()
const {
return m_children.begin(); }
78 auto end()
const {
return m_children.end(); }
79 auto cbegin()
const {
return m_children.cbegin(); }
80 auto cend()
const {
return m_children.cend(); }
82 auto& children()
const {
return m_children; }
84 std::size_t size()
const {
return m_children.size(); }
86 bool empty()
const {
return m_children.empty(); }
90 for(
auto&
state : m_children)
92 ossia::apply(state_execution_visitor{}, std::move(
state.second));
102 m_children[std::make_pair(&e.dest.value.get(), e.get_unit())] = e;
107 m_children[std::make_pair(&e.dest.value.get(), e.get_unit())] = std::move(e);
109 void add(
const ossia::piecewise_message& e)
112 m_children[std::make_pair(&e.address.get(), e.get_unit())] = e;
114 template <std::
size_t N>
115 void add(piecewise_vec_message<N>&& e)
118 m_children[std::make_pair(&e.address.get(), e.get_unit())] = std::move(e);
120 template <std::
size_t N>
121 void add(
const piecewise_vec_message<N>& e)
124 m_children[std::make_pair(&e.address.get(), e.get_unit())] = e;
134 return add(*
static_cast<const ossia::piecewise_message*
>(e.target()));
136 return add(*
static_cast<const ossia::piecewise_vec_message<2>*
>(e.target()));
138 return add(*
static_cast<const ossia::piecewise_vec_message<3>*
>(e.target()));
140 return add(*
static_cast<const ossia::piecewise_vec_message<4>*
>(e.target()));
143 throw std::runtime_error(
"there shouldn't be a state here");
154 return add(std::move(*
static_cast<ossia::piecewise_message*
>(e.target())));
157 std::move(*
static_cast<ossia::piecewise_vec_message<2>*
>(e.target())));
160 std::move(*
static_cast<ossia::piecewise_vec_message<3>*
>(e.target())));
163 std::move(*
static_cast<ossia::piecewise_vec_message<4>*
>(e.target())));
166 throw std::runtime_error(
"there shouldn't be a state here");
173 return m_children.find({&e.dest.value.get(), e.get_unit()});
175 auto find(
const piecewise_message& e)
177 return m_children.find({&e.address.get(), e.get_unit()});
179 template <std::
size_t N>
180 auto find(
const piecewise_vec_message<N>& e)
182 return m_children.find({&e.address.get(), e.get_unit()});
187 m_children.erase(std::make_pair(&e.dest.value.get(), e.get_unit()));
190 void remove(
const ossia::piecewise_message& e)
192 m_children.erase(std::make_pair(&e.address.get(), e.get_unit()));
195 using map_t = ossia::hash_map<
196 std::pair<ossia::net::parameter_base*, ossia::unit_t>,
state_element>;
197 using iterator = map_t::iterator;
198 using const_iterator = map_t::const_iterator;
199 void remove(iterator it) { m_children.erase(it); }
200 void remove(const_iterator it) { m_children.erase(it); }
202 template <std::
size_t N>
203 void remove(
const ossia::piecewise_vec_message<N>& e)
205 m_children.erase(std::make_pair(&e.address.get(), e.get_unit()));
208 void reserve(std::size_t n) { m_children.reserve(n); }
209 void clear() { m_children.clear(); }
void launch(state_element &e)
launch Launch a state_element
Definition state_element.cpp:18
ossia::nullable_variant< message, state, piecewise_message, piecewise_vec_message< 2 >, piecewise_vec_message< 3 >, piecewise_vec_message< 4 > > state_element
Definition state_element_fwd.hpp:28