Main MRPT website > C++ reference for MRPT 1.5.9
xsrange.h
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +---------------------------------------------------------------------------+ */
9 #ifndef XSRANGE_H
10 #define XSRANGE_H
11 
12 #include "xstypesconfig.h"
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #else
17 #define XSRANGE_INITIALIZER { 0, -1 }
18 #endif
19 
20 struct XsRange;
21 
22 XSTYPES_DLL_API int XsRange_count(const struct XsRange* thisPtr);
23 XSTYPES_DLL_API int XsRange_contains(const struct XsRange* thisPtr, int i);
24 XSTYPES_DLL_API int XsRange_interval(const struct XsRange* thisPtr);
25 XSTYPES_DLL_API void XsRange_setRange(struct XsRange* thisPtr, int f, int l);
26 XSTYPES_DLL_API int XsRange_empty(const struct XsRange* thisPtr);
27 
28 #ifdef __cplusplus
29 } // extern "C"
30 #endif
31 
32 struct XsRange {
33 #ifdef __cplusplus
34  //! \brief Constructs a range starting at \a f and ending at \a l. Default value are 0.
35  inline explicit XsRange(int f = 0, int l = 0)
36  : m_first(f)
37  , m_last(l)
38  {}
39 
40  //! \brief Constructs a range based upon \a other
41  inline XsRange(const XsRange& other)
42  : m_first(other.m_first)
43  , m_last(other.m_last)
44  {}
45 
46  //! \brief Assigns the range \a other to this
47  inline XsRange& operator = (const XsRange& other)
48  {
49  m_first = other.m_first;
50  m_last = other.m_last;
51  return *this;
52  }
53 
54  //! \brief \copybrief XsRange_count
55  inline int count() const
56  {
57  return XsRange_count(this);
58  }
59 
60  //! \brief \copybrief XsRange_interval
61  inline int interval() const
62  {
63  return XsRange_interval(this);
64  }
65 
66  //! \brief \copybrief XsRange_contains
67  inline bool contains(int i) const
68  {
69  return 0 != XsRange_contains(this, i);
70  }
71 
72  //! \brief Set the range to \a f - \a l
73  inline void setRange(int f, int l)
74  {
75  m_first = f;
76  m_last = l;
77  }
78 
79  //! \brief \copybrief XsRange_empty
80  inline bool empty() const
81  {
82  return 0 != XsRange_empty(this);
83  }
84 
85  //! \brief Return the \e first value of the range
86  inline int first() const
87  {
88  return m_first;
89  }
90 
91  //! \brief Return the \e last value of the range
92  inline int last() const
93  {
94  return m_last;
95  }
96 
97  //! \brief Return true if this is equal to other
98  bool operator == (const XsRange& other) const
99  {
100  return m_first == other.m_first && m_last == other.m_last;
101  }
102 private:
103 #endif
104 
105  int m_first; //!< Storage for the lower end of the range
106  int m_last; //!< Storage for the upper end of the range
107 };
108 
109 typedef struct XsRange XsRange;
110 
111 #endif // file guard
bool operator==(const TPoint2D &p1, const TPoint2D &p2)
Exact comparison between 2D points.
GLuint GLuint GLsizei count
Definition: glext.h:3512
EIGEN_STRONG_INLINE bool empty() const
int m_first
Storage for the lower end of the range.
Definition: xsrange.h:105
GLint * first
Definition: glext.h:3703
int m_last
Storage for the upper end of the range.
Definition: xsrange.h:106
XSTYPES_DLL_API int XsRange_count(const struct XsRange *thisPtr)
XSTYPES_DLL_API int XsRange_contains(const struct XsRange *thisPtr, int i)
XSTYPES_DLL_API int XsRange_interval(const struct XsRange *thisPtr)
#define XSTYPES_DLL_API
Definition: xstypesconfig.h:9
struct XsRange XsRange
Definition: xsrange.h:109
XSTYPES_DLL_API void XsRange_setRange(struct XsRange *thisPtr, int f, int l)
XSTYPES_DLL_API int XsRange_empty(const struct XsRange *thisPtr)



Page generated by Doxygen 1.8.14 for MRPT 1.5.9 Git: 690a4699f Wed Apr 15 19:29:53 2020 +0200 at miƩ abr 15 19:30:12 CEST 2020