Main MRPT website > C++ reference
MRPT logo
CPoseOrPoint_detail.h
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | The Mobile Robot Programming Toolkit (MRPT) C++ library |
3  | |
4  | http://www.mrpt.org/ |
5  | |
6  | Copyright (C) 2005-2012 University of Malaga |
7  | |
8  | This software was written by the Machine Perception and Intelligent |
9  | Robotics Lab, University of Malaga (Spain). |
10  | Contact: Jose-Luis Blanco <jlblanco@ctima.uma.es> |
11  | |
12  | This file is part of the MRPT project. |
13  | |
14  | MRPT is free software: you can redistribute it and/or modify |
15  | it under the terms of the GNU General Public License as published by |
16  | the Free Software Foundation, either version 3 of the License, or |
17  | (at your option) any later version. |
18  | |
19  | MRPT is distributed in the hope that it will be useful, |
20  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
21  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
22  | GNU General Public License for more details. |
23  | |
24  | You should have received a copy of the GNU General Public License |
25  | along with MRPT. If not, see <http://www.gnu.org/licenses/>. |
26  | |
27  +---------------------------------------------------------------------------+ */
28 #ifndef CPOSEORPOINT_DETAIL_H
29 #define CPOSEORPOINT_DETAIL_H
30 
31 namespace mrpt
32 {
33  namespace poses
34  {
35  class CPoint2D;
36  class CPoint3D;
37  class CPose2D;
38  class CPose3D;
39  class CPose3DQuat;
40  class CPose3DRotVec;
41 
42  /** Internal, auxiliary templates for MRPT classes */
43  namespace detail
44  {
45  template <class POSEORPOINT> struct T3DTypeHelper; // generic version. Specialized below.
46 
47  template <> struct T3DTypeHelper<CPoint2D> { enum { is_3D_val = 0 }; };
48  template <> struct T3DTypeHelper<CPoint3D> { enum { is_3D_val = 1 }; };
49  template <> struct T3DTypeHelper<CPose2D> { enum { is_3D_val = 0 }; };
50  template <> struct T3DTypeHelper<CPose3D> { enum { is_3D_val = 1 }; };
51  template <> struct T3DTypeHelper<CPose3DQuat> { enum { is_3D_val = 1 }; };
52  template <> struct T3DTypeHelper<CPose3DRotVec> { enum { is_3D_val = 1 }; };
53 
54 
55  template <class DERIVEDCLASS, int IS3D> struct pose_point_impl; // generic template, specialized below:
56 
57  // Extra members for 3D implementation:
58  template <class DERIVEDCLASS> struct pose_point_impl<DERIVEDCLASS,1>
59  {
60  inline double z() const /*!< Get Z coord. */ { return static_cast<const DERIVEDCLASS*>(this)->m_coords[2]; }
61  inline double &z() /*!< Get ref to Z coord. */ { return static_cast<DERIVEDCLASS*>(this)->m_coords[2]; }
62  inline void z(const double v) /*!< Set Z coord. */ { static_cast<DERIVEDCLASS*>(this)->m_coords[2]=v; }
63  inline void z_incr(const double v) /*!< Z+=v */ { static_cast<DERIVEDCLASS*>(this)->m_coords[2]+=v; }
64  };
65 
66  // Extra members for 2D implementation:
67  template <class DERIVEDCLASS> struct pose_point_impl<DERIVEDCLASS,0>
68  {
69  };
70 
71  } // End of namespace
72  } // End of namespace
73 } // End of namespace
74 
75 #endif



Page generated by Doxygen 1.8.3 for MRPT 0.9.6 SVN: at Fri Feb 15 22:05:02 EST 2013