57 #ifndef __SICK_SCANSEGMENT_XD_COMMON_H
58 #define __SICK_SCANSEGMENT_XD_COMMON_H
60 #define _USE_MATH_DEFINES
78 # define KBHIT() ::_kbhit()
79 # define GETCH() ::_getch()
80 # define SPRINTF sprintf_s
83 # include <sys/stat.h>
84 # include <sys/types.h>
85 # define localtime_s(a,b) localtime_r(b,a)
86 # define KBHIT() false
88 # define SPRINTF sprintf
92 #define SCANDATA_MSGPACK 1
93 #define SCANDATA_COMPACT 2
95 #if defined __ROS_VERSION && __ROS_VERSION > 1
97 #include <rclcpp/rclcpp.hpp>
98 #include <sensor_msgs/msg/point_cloud2.hpp>
108 #elif defined __ROS_VERSION && __ROS_VERSION > 0
151 template<
typename T>
static std::string
FormatNumber(
const T& number,
int width = -1,
bool setfill =
false,
bool setfixed =
false,
int precision = -1)
153 std::stringstream stream;
155 stream << std::setw(width);
157 stream << std::setfill(
'0');
159 stream << std::fixed;
161 stream << std::setprecision(3);
173 bool fileexists = filestream.is_open();
186 std::string path =
folder;
188 std::replace(path.begin(), path.end(),
'/',
'\\');
189 return (::_mkdir(path.c_str()) == 0);
191 std::replace(path.begin(), path.end(),
'\\',
'/');
192 return (mkdir(path.c_str(), 0777) == 0);
204 size_t sep_pos = filepath.find_last_of(
"/\\");
205 std::string
name = ((sep_pos != std::string::npos) ? (filepath.substr(sep_pos + 1)) : filepath);
206 size_t ext_pos =
name.rfind(
'.');
207 if (ext_pos != std::string::npos)
213 #endif // __SICK_SCANSEGMENT_XD_COMMON_H