27 #ifndef SCRIBO_CORE_COMPONENT_INFO_HH
28 # define SCRIBO_CORE_COMPONENT_INFO_HH
35 # include <mln/core/alias/box2d.hh>
36 # include <mln/core/alias/point2d.hh>
37 # include <mln/util/object_id.hh>
39 # include <scribo/core/component_features_data.hh>
40 # include <scribo/core/concept/serializable.hh>
41 # include <scribo/core/tag/component.hh>
42 # include <scribo/core/tag/line.hh>
81 unsigned card()
const;
84 bool has_features()
const;
96 bool is_valid()
const;
112 template <
typename L>
114 operator<<(std::ostream& ostr, const component_info<L>&
info);
116 template <
typename L>
121 # ifndef MLN_INCLUDE_ONLY
124 template <
typename L>
126 : id_(0), tag_(component::Ignored), type_(component::Undefined)
132 template <
typename L>
138 : id_(id), bbox_(bbox), mass_center_(mass_center), card_(card),
148 template <
typename L>
149 typename component_info<L>::component_id_t
150 component_info<L>::id()
const
156 template <
typename L>
164 template <
typename L>
166 component_info<L>::mass_center()
const
171 template <
typename L>
173 component_info<L>::card()
const
178 template <
typename L>
180 component_info<L>::has_features()
const
182 return features_.valid;
185 template <
typename L>
187 component_info<L>::update_features(
const component_features_data& features)
189 features_ = features;
192 template <
typename L>
193 const component_features_data&
194 component_info<L>::features()
const
199 template <
typename L>
201 component_info<L>::tag()
const
207 template <
typename L>
215 template <
typename L>
217 component_info<L>::type()
const
223 template <
typename L>
231 template <
typename L>
233 component_info<L>::is_valid()
const
240 template <
typename L>
242 operator<<(std::ostream& ostr, const component_info<L>& info)
244 ostr <<
"component_info("
245 <<
"id=" << info.id()
246 <<
", bbox=" << info.bbox()
247 <<
", mass_center=" << info.mass_center()
248 <<
", card=" << info.card()
249 <<
", tag=" << info.tag();
251 if (info.features().valid)
252 ostr <<
", features=" << info.features();
254 ostr <<
", features=none";
256 ostr <<
")" << std::endl;
261 template <
typename L>
263 operator==(
const component_info<L>& lhs,
const component_info<L>& rhs)
268 && lhs.bbox() == rhs.bbox()
269 && lhs.mass_center() == rhs.mass_center()
270 && lhs.card() == rhs.card()
271 && (lhs.has_features() == rhs.has_features()
272 || (lhs.has_features()
273 && rhs.has_features()
274 && lhs.features() == rhs.features()))
275 && lhs.tag() == rhs.tag()
276 && lhs.type() == rhs.type();
279 # endif // ! MLN_INCLUDE_ONLY
285 #endif // ! SCRIBO_CORE_COMPONENT_INFO_HH