Collision Checker
serialize_sphere.cc
Go to the documentation of this file.
2 
3 #if ENABLE_SERIALIZER
5 namespace collision {
6 namespace serialize {
7 ICollisionObjectExport *exportObject(const collision::Sphere &sphere) {
8  return new SphereExport(sphere);
9 }
10 
11 SphereExport::SphereExport(const Sphere &sphere) {
12  m_fields.radius = sphere.radius();
13 
14  m_fields.center_x = sphere.center_x();
15  m_fields.center_y = sphere.center_y();
16 }
17 
18 CollisionObject *SphereExport::loadObject(void) {
19  return new Sphere(m_fields.radius,
20  Eigen::Vector2d(m_fields.center_x, m_fields.center_y));
21 }
22 
23 bool SphereExport::operator()(s11nlite::node_type &dest) const {
24  typedef s11nlite::node_traits TR;
25  TR::class_name(dest, "SphereExport");
26  TR::set(dest, "radius", m_fields.radius);
27  TR::set(dest, "center_x", m_fields.center_x);
28  TR::set(dest, "center_y", m_fields.center_y);
29 
30  return true;
31 }
32 bool SphereExport::operator()(const s11nlite::node_type &src) {
33  typedef s11nlite::node_traits TR;
34  m_fields.radius = TR::get(src, "radius", double(0));
35  m_fields.center_x = TR::get(src, "center_x", double(0));
36 
37  m_fields.center_y = TR::get(src, "center_y", double(0));
38 
39  return true;
40 }
41 } // namespace serialize
42 } // namespace collision
43 #endif
CollisionObject * loadObject(void)
virtual bool operator()(s11nlite::node_type &dest) const
Circle.
Definition: sphere.h:14
int serialize(const test::BroadphaseFailureCCObj &bf_object, std::ostream &output_stream, const char *format=SERIALIZER_DEFAULT_FORMAT)