SickLMS1xxUtility.hh
Go to the documentation of this file.
00001 
00017 /* Auto-generated header */
00018 #include "SickConfig.hh"
00019 
00020 /* Implementation Dependencies */
00021 #include <sstream>
00022 
00027 #define REVERSE_BYTE_ORDER_16( y ) ( ( ( y & 0x00FF ) << 8 ) | ( ( y & 0xFF00 ) >> 8 ) )
00028 
00033 #define REVERSE_BYTE_ORDER_32( y ) ( ( ( y & 0x000000FF ) << 24 ) | ( ( y & 0x0000FF00 ) << 8 ) | ( ( y & 0x00FF0000 ) >> 8 ) | ( ( y & 0xFF000000 ) >> 24 ) )
00034 
00035 /* Associate the namespace */
00036 namespace SickToolbox {
00037   
00038 #ifndef WORDS_BIGENDIAN
00039   
00040   /* NOTE: The following functions are necessary since the Sick LD doesn't adopt the
00041    *       convention of converting from network byte order.
00042    */
00043   
00049   inline uint16_t host_to_sick_lms_1xx_byte_order( uint16_t value ) {
00050     return value;
00051   }
00052   
00058   inline uint32_t host_to_sick_lms_1xx_byte_order( uint32_t value ) {
00059     return value;
00060   }
00061   
00067   inline uint16_t sick_lms_1xx_to_host_byte_order( uint16_t value ) {
00068     return value;
00069   }
00070   
00076   inline uint32_t sick_lms_1xx_to_host_byte_order( uint32_t value ) {
00077     return value;
00078   }
00079   
00080 #else // The host has a big-endian architecture
00081   
00087   inline uint16_t host_to_sick_lms_1xx_byte_order( uint16_t value ) {
00088     return REVERSE_BYTE_ORDER_16(value);
00089   }
00090   
00096   inline uint32_t host_to_sick_lms_1xx_byte_order( uint32_t value ) {
00097     return REVERSE_BYTE_ORDER_32(value);
00098   }
00099   
00105   inline uint16_t sick_lms_1xx_to_host_byte_order( uint16_t value ) {
00106     return REVERSE_BYTE_ORDER_16(value);
00107   }
00108   
00114   inline uint32_t sick_lms_1xx_to_host_byte_order( uint32_t value ) {
00115     return REVERSE_BYTE_ORDER_32(value);
00116   }
00117   
00118 #endif /* _LITTLE_ENDIAN_HOST */
00119   
00120   /*
00121    * NOTE: Other utility functions can be defined here
00122    */
00123   
00129   inline std::string int_to_str( const int value ) {
00130     std::stringstream ss;
00131     ss << value;
00132     return ss.str();
00133   }
00134   
00135 
00136   
00137 } //namespace SickToolbox


sicktoolbox
Author(s): Jason Derenick , Thomas Miller
autogenerated on Sun May 5 2019 02:28:23