MRPT  1.9.9
xsrange.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2019, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://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 {
17 #else
18 #define XSRANGE_INITIALIZER \
19  { \
20  0, -1 \
21  }
22 #endif
23 
24  struct XsRange;
25 
26  XSTYPES_DLL_API int XsRange_count(const struct XsRange* thisPtr);
27  XSTYPES_DLL_API int XsRange_contains(const struct XsRange* thisPtr, int i);
28  XSTYPES_DLL_API int XsRange_interval(const struct XsRange* thisPtr);
30  struct XsRange* thisPtr, int f, int l);
31  XSTYPES_DLL_API int XsRange_empty(const struct XsRange* thisPtr);
32 
33 #ifdef __cplusplus
34 } // extern "C"
35 #endif
36 
37 struct XsRange
38 {
39 #ifdef __cplusplus
40  //! \brief Constructs a range starting at \a f and ending at \a l. Default
41  //! value are 0.
42  inline explicit XsRange(int f = 0, int l = 0) : m_first(f), m_last(l) {}
43  //! \brief Constructs a range based upon \a other
44  inline XsRange(const XsRange& other)
45  : m_first(other.m_first), m_last(other.m_last)
46  {
47  }
48 
49  //! \brief Assigns the range \a other to this
50  inline XsRange& operator=(const XsRange& other)
51  {
52  m_first = other.m_first;
53  m_last = other.m_last;
54  return *this;
55  }
56 
57  //! \brief \copybrief XsRange_count
58  inline int count() const { return XsRange_count(this); }
59  //! \brief \copybrief XsRange_interval
60  inline int interval() const { return XsRange_interval(this); }
61  //! \brief \copybrief XsRange_contains
62  inline bool contains(int i) const { return 0 != XsRange_contains(this, i); }
63  //! \brief Set the range to \a f - \a l
64  inline void setRange(int f, int l)
65  {
66  m_first = f;
67  m_last = l;
68  }
69 
70  //! \brief \copybrief XsRange_empty
71  inline bool empty() const { return 0 != XsRange_empty(this); }
72  //! \brief Return the \e first value of the range
73  inline int first() const { return m_first; }
74  //! \brief Return the \e last value of the range
75  inline int last() const { return m_last; }
76  //! \brief Return true if this is equal to other
77  bool operator==(const XsRange& other) const
78  {
79  return m_first == other.m_first && m_last == other.m_last;
80  }
81 
82  private:
83 #endif
84 
85  /** Storage for the lower end of the range */
86  int m_first;
87  /** Storage for the upper end of the range */
88  int m_last;
89 };
90 
91 typedef struct XsRange XsRange;
92 
93 #endif // file guard
GLuint GLuint GLsizei count
Definition: glext.h:3532
int m_first
Storage for the lower end of the range.
Definition: xsrange.h:86
GLint * first
Definition: glext.h:3833
int m_last
Storage for the upper end of the range.
Definition: xsrange.h:88
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 empty() const
Definition: ts_hash_map.h:190
bool operator==(const mrpt::img::TCamera &a, const mrpt::img::TCamera &b)
Definition: TCamera.cpp:202
#define XSTYPES_DLL_API
Definition: xstypesconfig.h:9
struct XsRange XsRange
Definition: xsrange.h:91
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: 8fe78517f Sun Jul 14 19:43:28 2019 +0200 at lun oct 28 02:10:00 CET 2019