7 #include <sys/socket.h> 21 #pragma warning(disable: 4267) 22 #pragma warning(disable: 4996) 35 line =
"Length= " +
toString(len) +
" bytes.";
43 for (
UINT16 i=0; i< 16; i++)
62 std::string
s =
"0123456789ABCDEF";
101 std::string
s = s1 + s2;
114 for (i=0; i < text.length(); i++)
117 if ((c >=
'A') || (c <=
'Z'))
135 std::ostringstream os;
146 INT32 inch = (
INT32)((m - ((
double)feet * 0.3048)) / 0.0254);
151 if ((inch > 0) || (feet == 0))
169 int conversions = sscanf(text.c_str(),
"%d", &
value);
170 if (conversions == 1)
185 if ((c >=
'0') && (c <=
'9'))
189 else if ((c >=
'A') && (c <=
'F'))
191 value = c -
'A' + 10;
193 else if ((c >=
'a') && (c <=
'f'))
195 value = c -
'a' + 10;
215 if (useLowerCaseLetters ==
false)
218 c =
'A' + value - 10;
223 c =
'a' + value - 10;
262 const double twoPi = (2.0 *
PI);
282 sprintf(c,
"%i", value);
283 return (std::string(c));
292 sprintf(c,
"%i", value);
293 return (std::string(c));
296 #if INTPTR_MAX != INT32_MAX 300 sprintf(c,
"%zu", value);
301 return (std::string(c));
316 std::string::size_type digits_before_decimal_point,
317 std::string::size_type digits_after_decimal_point)
320 std::string text =
doubleToString(val, digits_after_decimal_point);
323 const std::string::size_type dotPosition = text.find_first_of(
'.', 0);
324 if (dotPosition != std::string::npos)
327 if (dotPosition < digits_before_decimal_point)
330 std::string::size_type numExtraSpaces = digits_before_decimal_point - dotPosition;
331 text = std::string(numExtraSpaces,
' ') + text;
338 if (text.length() < (digits_before_decimal_point + digits_after_decimal_point + 1))
341 std::string::size_type numExtraSpaces =
342 (digits_before_decimal_point + digits_after_decimal_point + 1) - text.length();
343 text += std::string(numExtraSpaces,
' ');
353 int digits_after_decimal_point)
356 std::stringstream sstr;
357 sstr << std::fixed << std::setprecision(digits_after_decimal_point) << val;
362 std::string
toString(
double val,
int digits_after_decimal_point)
378 if (ipAdrStr.length() < 3)
384 UINT32 adrVal = INADDR_NONE;
388 size_t pos = ipAdrStr.find_first_of(
':');
389 if ((pos > 0) && (pos < (ipAdrStr.length() - 1)))
391 addrStr = ipAdrStr.substr(0, pos);
392 portStr = ipAdrStr.substr(pos+1);
400 adrVal = (
UINT32)inet_addr(addrStr.c_str());
404 if (portStr.length() > 0)
450 (((
UINT32)buffer[1]) << 16) +
451 (((
UINT32)buffer[2]) << 8 ) +
496 (((
UINT32)buffer[1]) << 16) +
497 (((
UINT32)buffer[2]) << 8 ) +
510 for (
UINT16 i = 0; i<length; i++)
564 buffer[0] = ((value >> 24) & 0xFF);
565 buffer[1] = ((value >> 16) & 0xFF);
566 buffer[2] = ((value >> 8 ) & 0xFF);
567 buffer[3] = ((value ) & 0xFF);
586 buffer[0] = ((value >> 8 ) & 0xFF);
587 buffer[1] = ((value ) & 0xFF);
614 strncpy((
char*)buffer, text.c_str(), text.length());
615 buffer += text.length();
Internal: Structure for reading/writing a float as an UINT32.
#define printInfoMessage(a, b)
static sick_scan::SickScanCommonTcp * s