SickLMS1xxUtility.hh
Go to the documentation of this file.
1 
17 /* Auto-generated header */
18 #include "SickConfig.hh"
19 
20 /* Implementation Dependencies */
21 #include <sstream>
22 
27 #define REVERSE_BYTE_ORDER_16( y ) ( ( ( y & 0x00FF ) << 8 ) | ( ( y & 0xFF00 ) >> 8 ) )
28 
33 #define REVERSE_BYTE_ORDER_32( y ) ( ( ( y & 0x000000FF ) << 24 ) | ( ( y & 0x0000FF00 ) << 8 ) | ( ( y & 0x00FF0000 ) >> 8 ) | ( ( y & 0xFF000000 ) >> 24 ) )
34 
35 /* Associate the namespace */
36 namespace SickToolbox {
37 
38 #ifndef WORDS_BIGENDIAN
39 
40  /* NOTE: The following functions are necessary since the Sick LD doesn't adopt the
41  * convention of converting from network byte order.
42  */
43 
49  inline uint16_t host_to_sick_lms_1xx_byte_order( uint16_t value ) {
50  return value;
51  }
52 
58  inline uint32_t host_to_sick_lms_1xx_byte_order( uint32_t value ) {
59  return value;
60  }
61 
67  inline uint16_t sick_lms_1xx_to_host_byte_order( uint16_t value ) {
68  return value;
69  }
70 
76  inline uint32_t sick_lms_1xx_to_host_byte_order( uint32_t value ) {
77  return value;
78  }
79 
80 #else // The host has a big-endian architecture
81 
87  inline uint16_t host_to_sick_lms_1xx_byte_order( uint16_t value ) {
88  return REVERSE_BYTE_ORDER_16(value);
89  }
90 
96  inline uint32_t host_to_sick_lms_1xx_byte_order( uint32_t value ) {
97  return REVERSE_BYTE_ORDER_32(value);
98  }
99 
105  inline uint16_t sick_lms_1xx_to_host_byte_order( uint16_t value ) {
106  return REVERSE_BYTE_ORDER_16(value);
107  }
108 
114  inline uint32_t sick_lms_1xx_to_host_byte_order( uint32_t value ) {
115  return REVERSE_BYTE_ORDER_32(value);
116  }
117 
118 #endif /* _LITTLE_ENDIAN_HOST */
119 
120  /*
121  * NOTE: Other utility functions can be defined here
122  */
123 
129  inline std::string int_to_str( const int value ) {
130  std::stringstream ss;
131  ss << value;
132  return ss.str();
133  }
134 
135 
136 
137 } //namespace SickToolbox
#define REVERSE_BYTE_ORDER_32(y)
Reverses the byte order of the given 32 bit unsigned integer.
std::string int_to_str(const int value)
Utility function for converting int to standard string.
uint16_t host_to_sick_lms_1xx_byte_order(uint16_t value)
Converts host byte order (little-endian) to Sick LMS byte order (little-endian)
uint16_t sick_lms_1xx_to_host_byte_order(uint16_t value)
Converts Sick LMS byte order (little-endian) to host byte order (little-endian)
#define REVERSE_BYTE_ORDER_16(y)
Reverses the byte order of the given 16 bit unsigned integer.
Encapsulates the Sick LIDAR Matlab/C++ toolbox.
Definition: SickLD.cc:44


sicktoolbox
Author(s): Jason Derenick , Thomas Miller
autogenerated on Tue Sep 10 2019 03:37:34