MRPT  1.9.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-2018, 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 \
18  { \
19  0, -1 \
20  }
21 #endif
22 
23 struct XsRange;
24 
25 XSTYPES_DLL_API int XsRange_count(const struct XsRange* thisPtr);
26 XSTYPES_DLL_API int XsRange_contains(const struct XsRange* thisPtr, int i);
27 XSTYPES_DLL_API int XsRange_interval(const struct XsRange* thisPtr);
28 XSTYPES_DLL_API void XsRange_setRange(struct XsRange* thisPtr, int f, int l);
29 XSTYPES_DLL_API int XsRange_empty(const struct XsRange* thisPtr);
30 
31 #ifdef __cplusplus
32 } // extern "C"
33 #endif
34 
35 struct XsRange
36 {
37 #ifdef __cplusplus
38  //! \brief Constructs a range starting at \a f and ending at \a l. Default
39  //! value are 0.
40  inline explicit XsRange(int f = 0, int l = 0) : m_first(f), m_last(l) {}
41  //! \brief Constructs a range based upon \a other
42  inline XsRange(const XsRange& other)
43  : m_first(other.m_first), m_last(other.m_last)
44  {
45  }
46 
47  //! \brief Assigns the range \a other to this
48  inline XsRange& operator=(const XsRange& other)
49  {
50  m_first = other.m_first;
51  m_last = other.m_last;
52  return *this;
53  }
54 
55  //! \brief \copybrief XsRange_count
56  inline int count() const { return XsRange_count(this); }
57  //! \brief \copybrief XsRange_interval
58  inline int interval() const { return XsRange_interval(this); }
59  //! \brief \copybrief XsRange_contains
60  inline bool contains(int i) const { return 0 != XsRange_contains(this, i); }
61  //! \brief Set the range to \a f - \a l
62  inline void setRange(int f, int l)
63  {
64  m_first = f;
65  m_last = l;
66  }
67 
68  //! \brief \copybrief XsRange_empty
69  inline bool empty() const { return 0 != XsRange_empty(this); }
70  //! \brief Return the \e first value of the range
71  inline int first() const { return m_first; }
72  //! \brief Return the \e last value of the range
73  inline int last() const { return m_last; }
74  //! \brief Return true if this is equal to other
75  bool operator==(const XsRange& other) const
76  {
77  return m_first == other.m_first && m_last == other.m_last;
78  }
79 
80  private:
81 #endif
82 
83  /** Storage for the lower end of the range */
84  int m_first;
85  /** Storage for the upper end of the range */
86  int m_last;
87 };
88 
89 typedef struct XsRange XsRange;
90 
91 #endif // file guard
GLuint GLuint GLsizei count
Definition: glext.h:3528
EIGEN_STRONG_INLINE bool empty() const
int m_first
Storage for the lower end of the range.
Definition: xsrange.h:84
GLint * first
Definition: glext.h:3827
int m_last
Storage for the upper end of the range.
Definition: xsrange.h:86
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)
bool operator==(const mrpt::img::TCamera &a, const mrpt::img::TCamera &b)
Definition: TCamera.cpp:201
#define XSTYPES_DLL_API
Definition: xstypesconfig.h:9
struct XsRange XsRange
Definition: xsrange.h:89
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.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020