snark
label_points/PointWithId.h
1 // This file is part of snark, a generic and flexible library
2 // for robotics research.
3 //
4 // Copyright (C) 2011 The University of Sydney
5 //
6 // snark is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 3 of the License, or (at your option) any later version.
10 //
11 // snark is distributed in the hope that it will be useful, but WITHOUT ANY
12 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
14 // for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with snark. If not, see <http://www.gnu.org/licenses/>.
18 
19 #ifndef SNARK_GRAPHICS_APPLICATIONS_LABELPOINTS_POINTWITHID_H_
20 #define SNARK_GRAPHICS_APPLICATIONS_LABELPOINTS_POINTWITHID_H_
21 
22 #include <comma/base/types.h>
23 #include <comma/visiting/traits.h>
24 #include <snark/visiting/eigen.h>
25 
26 namespace snark { namespace graphics { namespace View {
27 
28 struct PointWithId // quick and dirty
29 {
30  Eigen::Vector3d point;
31  comma::uint32 id;
32 };
33 
34 } } } // namespace snark { namespace graphics { namespace View {
35 
36 namespace comma { namespace visiting {
37 
38 template <> struct traits< snark::graphics::View::PointWithId >
39 {
40  template < typename Key, class Visitor >
41  static void visit( Key, snark::graphics::View::PointWithId& p, Visitor& v )
42  {
43  v.apply( "point", p.point );
44  v.apply( "id", p.id );
45  }
46 
47  template < typename Key, class Visitor >
48  static void visit( Key, const snark::graphics::View::PointWithId& p, Visitor& v )
49  {
50  v.apply( "point", p.point );
51  v.apply( "id", p.id );
52  }
53 };
54 
55 } } // namespace comma { namespace visiting {
56 
57 #endif // SNARK_GRAPHICS_APPLICATIONS_LABELPOINTS_POINTWITHID_H_