Main MRPT website > C++ reference for MRPT 1.5.6
xssyncsetting.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 XSSYNCSETTINGS_H
10 #define XSSYNCSETTINGS_H
11 
12 #include "pstdint.h"
13 #include "xstypesconfig.h"
14 #include "xssyncline.h"
15 #include "xssyncfunction.h"
16 #include "xssyncpolarity.h"
17 
18 struct XsSyncSetting;
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #else
23 #define XSSYNCSETTINGS_INITIALIZER { XSL_Invalid, XSF_Invalid, XSP_None, 1, 0, 0, 0, 0, 0 }
24 #endif
25 
26 XSTYPES_DLL_API int XsSyncSetting_isInput(const struct XsSyncSetting* thisPtr);
27 XSTYPES_DLL_API int XsSyncSetting_isOutput(const struct XsSyncSetting* thisPtr);
29 
30 #ifdef __cplusplus
31 } // extern "C"
32 #endif
33 
34 /*! \brief A structure for storing all xsens sync settings */
35 struct XsSyncSetting {
36  XsSyncLine m_line; /*!< The sync lines enabled. \see XsSyncLine. */
37  XsSyncFunction m_function; /*!< The action to be performed, when an input sync line changes \see XsSyncFunction. */
38  XsSyncPolarity m_polarity; /*!< The edge on which the action is performed, \see XsSyncPolarity. */
39  uint32_t m_pulseWidth; /*!< The time to keep the line polarity before toggling back, in microseconds. */
40  int32_t m_offset; /*!< The time between reception of a line change and the execution of the sync action, in microseconds. */
41  uint16_t m_skipFirst; /*!< The number of frames to skip before executing the action. */
42  uint16_t m_skipFactor; /*!< The number of frames to skip between 2 actions. */
43  uint16_t m_clockPeriod; /*!< The frequency of the external clock in milliseconds, only valid when action is STE_ResetTimer. */
44  uint8_t m_triggerOnce; /*!< Whether the action is repeated for each frame. */
45 
46 #ifdef __cplusplus
47  //! \brief Default constructor, initializes to the given (default) settings
48  explicit XsSyncSetting(XsSyncLine line = XSL_Invalid
49  , XsSyncFunction function = XSF_Invalid
50  , XsSyncPolarity polarity = XSP_RisingEdge
51  , uint32_t pulseWidth = 1000
52  , int32_t offset = 0
53  , uint16_t skipFirst = 0
54  , uint16_t skipFactor = 0
55  , uint16_t clockPeriod = 0
56  , uint8_t triggerOnce = 0)
57  : m_line(line)
58  , m_function(function)
59  , m_polarity(polarity)
60  , m_pulseWidth(pulseWidth)
61  , m_offset(offset)
62  , m_skipFirst(skipFirst)
63  , m_skipFactor(skipFactor)
64  , m_clockPeriod(clockPeriod)
65  , m_triggerOnce(triggerOnce)
66  {
67  }
68 
69  //! \brief Construct a XsSyncSetting as a copy of \a other.
70  XsSyncSetting(const XsSyncSetting& other)
71  {
72  memcpy(this, &other, sizeof(XsSyncSetting));
73  }
74 
75  //! \brief Copy values of \a other into this.
76  const XsSyncSetting& operator =(const XsSyncSetting& other)
77  {
78  if (this != &other)
79  memcpy(this, &other, sizeof(XsSyncSetting));
80  return *this;
81  }
82 
83  //! \brief \copybrief XsSyncSetting_isInput
84  inline bool isInput() const
85  {
86  return 0 != XsSyncSetting_isInput(this);
87  }
88 
89  //! \brief \copybrief XsSyncSetting_isOutput
90  inline bool isOutput() const
91  {
92  return 0 != XsSyncSetting_isOutput(this);
93  }
94 
95  /*! \brief Swap the contents with \a other
96  */
97  inline void swap(XsSyncSetting& other)
98  {
99  XsSyncSetting_swap(this, &other);
100  }
101 
102  /*! \brief Return true if \a other is identical to this
103  */
104  inline bool operator == (const XsSyncSetting& other) const
105  {
106  return (this == &other) ||
107  (m_line == other.m_line &&
108  m_function == other.m_function &&
109  m_polarity == other.m_polarity &&
110  m_pulseWidth == other.m_pulseWidth &&
111  m_offset == other.m_offset &&
112  m_skipFirst == other.m_skipFirst &&
113  m_skipFactor == other.m_skipFactor &&
114  m_clockPeriod == other.m_clockPeriod &&
115  m_triggerOnce == other.m_triggerOnce);
116  }
117 #endif
118 };
119 
121 
122 #endif // file guard
void BASE_IMPEXP memcpy(void *dest, size_t destSize, const void *src, size_t copyCount) MRPT_NO_THROWS
An OS and compiler independent version of "memcpy".
Definition: os.cpp:358
bool operator==(const TPoint2D &p1, const TPoint2D &p2)
Exact comparison between 2D points.
uint8_t m_triggerOnce
Definition: xssyncsetting.h:44
unsigned __int16 uint16_t
Definition: rptypes.h:46
XSTYPES_DLL_API int XsSyncSetting_isOutput(const struct XsSyncSetting *thisPtr)
uint16_t m_skipFirst
Definition: xssyncsetting.h:41
GLintptr offset
Definition: glext.h:3780
React to a rising edge on input.
A structure for storing all xsens sync settings.
Definition: xssyncsetting.h:35
unsigned char uint8_t
Definition: rptypes.h:43
uint16_t m_clockPeriod
Definition: xssyncsetting.h:43
GLubyte GLubyte b
Definition: glext.h:5575
struct XsSyncSetting XsSyncSetting
XsSyncPolarity
Signal polarity.
XsSyncFunction m_function
Definition: xssyncsetting.h:37
XsSyncLine m_line
Definition: xssyncsetting.h:36
#define XSTYPES_DLL_API
Definition: xstypesconfig.h:9
__int32 int32_t
Definition: rptypes.h:48
int32_t m_offset
Definition: xssyncsetting.h:40
Invalid action.
XsSyncFunction
Actions to be taken on input triggers.
uint32_t m_pulseWidth
Definition: xssyncsetting.h:39
unsigned __int32 uint32_t
Definition: rptypes.h:49
XSTYPES_DLL_API int XsSyncSetting_isInput(const struct XsSyncSetting *thisPtr)
XsSyncLine
Synchronization line identifiers.
Definition: xssyncline.h:16
GLubyte GLubyte GLubyte a
Definition: glext.h:5575
XsSyncPolarity m_polarity
Definition: xssyncsetting.h:38
XSTYPES_DLL_API void XsSyncSetting_swap(struct XsSyncSetting *a, struct XsSyncSetting *b)
uint16_t m_skipFactor
Definition: xssyncsetting.h:42



Page generated by Doxygen 1.8.14 for MRPT 1.5.6 Git: 4c65e8431 Tue Apr 24 08:18:17 2018 +0200 at lun oct 28 01:35:26 CET 2019