55 #include <sys/types.h> 56 #include <visp3/core/vpDebug.h> 57 #include <visp3/core/vpEndian.h> 58 #include <visp3/core/vpIoException.h> 59 #include <visp3/core/vpIoTools.h> 60 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 75 #if defined(__APPLE__) && defined(__MACH__) // Apple OSX and iOS (Darwin) 76 #include <TargetConditionals.h> 81 # define PATH_MAX _MAX_PATH 83 # define PATH_MAX 1024 97 #if defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__)) 98 #if (TARGET_OS_IOS == 0) && !defined(__ANDROID__) 99 void replaceAll(std::string &str,
const std::string &search,
const std::string &replace)
101 size_t start_pos = 0;
102 while ((start_pos = str.find(search, start_pos)) != std::string::npos) {
103 str.replace(start_pos, search.length(), replace);
104 start_pos += replace.length();
111 std::string <rim(std::string &s)
113 #if VISP_CXX_STANDARD > VISP_CXX_STANDARD_98 114 s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](
int c) {
return !std::isspace(c); }));
116 s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun<int, int>(std::isspace))));
121 std::string &rtrim(std::string &s)
123 #if VISP_CXX_STANDARD > VISP_CXX_STANDARD_98 124 s.erase(std::find_if(s.rbegin(), s.rend(), [](
int c) {
return !std::isspace(c); }).base(), s.end());
126 s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::ptr_fun<int, int>(std::isspace))).base(), s.end());
137 static std::string build_info =
138 #include "version_string.inc" 184 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 186 char *_username =
::getenv(
"LOGNAME");
188 username =
"unknown";
191 username = _username;
193 #elif defined(_WIN32) 194 #if (!defined(WINRT)) 195 unsigned int info_buffer_size = 1024;
196 TCHAR *infoBuf =
new TCHAR[info_buffer_size];
197 DWORD bufCharCount = (DWORD)info_buffer_size;
199 if (!GetUserName(infoBuf, &bufCharCount)) {
200 username =
"unknown";
207 username =
"unknown";
210 username =
"unknown";
230 std::string username;
267 #if defined(_WIN32) && defined(WINRT) 269 "implemented on Universal Windows Platform"));
273 char *_value =
::getenv(env.c_str());
292 void vpIoTools::getVersion(
const std::string &version,
unsigned int &major,
unsigned int &minor,
unsigned int &patch)
294 if (version.size() == 0) {
299 size_t major_pos = version.find(
'.');
300 std::string major_str = version.substr(0, major_pos);
301 major =
static_cast<unsigned>(atoi(major_str.c_str()));
303 if (major_pos != std::string::npos) {
304 size_t minor_pos = version.find(
'.', major_pos + 1);
305 std::string minor_str = version.substr(major_pos + 1, (minor_pos - (major_pos + 1)));
306 minor =
static_cast<unsigned>(atoi(minor_str.c_str()));
308 if (minor_pos != std::string::npos) {
309 std::string patch_str = version.substr(minor_pos + 1);
310 patch =
static_cast<unsigned>(atoi(patch_str.c_str()));
334 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 336 #elif defined(_WIN32) && defined(__MINGW32__) 338 #elif defined(_WIN32) 342 if (dirname.empty()) {
346 std::string _dirname =
path(dirname);
348 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 349 if (stat(_dirname.c_str(), &stbuf) != 0)
350 #elif defined(_WIN32) && defined(__MINGW32__) 355 _dirname = _dirname.substr(0, _dirname.size() - 1);
356 if (stat(_dirname.c_str(), &stbuf) != 0)
357 #elif defined(_WIN32) 358 if (_stat(_dirname.c_str(), &stbuf) != 0)
363 #if defined(_WIN32) || (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) 364 if ((stbuf.st_mode & S_IFDIR) == 0)
369 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 370 if ((stbuf.st_mode & S_IWUSR) == 0)
371 #elif defined(_WIN32)
372 if ((stbuf.st_mode & S_IWRITE) == 0)
394 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 397 std::string _filename =
path(fifofilename);
398 if (stat(_filename.c_str(), &stbuf) != 0) {
401 if ((stbuf.st_mode & S_IFIFO) == 0) {
404 if ((stbuf.st_mode & S_IRUSR) == 0)
410 #elif defined(_WIN32) 416 #ifndef DOXYGEN_SHOULD_SKIP_THIS 419 int vpIoTools::mkdir_p(
const char *
path,
int mode)
422 const size_t len = strlen(path);
423 char _path[PATH_MAX];
426 std::fill(_path, _path + PATH_MAX, 0);
429 if (len >
sizeof(_path) - 1) {
430 errno = ENAMETOOLONG;
437 for (
char *p = _path + 1; *p; p++) {
442 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) 443 if (mkdir(_path, static_cast<mode_t>(mode)) != 0)
444 #elif defined(_WIN32) 456 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) 457 if (mkdir(_path, static_cast<mode_t>(mode)) != 0)
458 #elif defined(_WIN32)
459 if (_mkdir(_path) != 0)
468 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS 484 #if ((!defined(__unix__) && !defined(__unix) && (!defined(__APPLE__) || !defined(__MACH__)))) && !defined(_WIN32) 485 std::cerr <<
"Unsupported platform for vpIoTools::makeDirectory()!" << std::endl;
489 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 491 #elif defined(_WIN32) && defined(__MINGW32__) 493 #elif defined(_WIN32) 497 if (dirname.empty()) {
501 std::string _dirname =
path(dirname);
503 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 504 if (stat(_dirname.c_str(), &stbuf) != 0)
505 #elif defined(_WIN32) && defined(__MINGW32__) 506 if (stat(_dirname.c_str(), &stbuf) != 0)
507 #elif defined(_WIN32) 508 if (_stat(_dirname.c_str(), &stbuf) != 0)
511 if (vpIoTools::mkdir_p(_dirname.c_str(), 0755) != 0) {
535 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 540 "Unable to create fifo file. '%s' is an existing directory.", fifoname.c_str()));
553 else if (mkfifo(fifoname.c_str(), 0666) < 0) {
556 #elif defined(_WIN32) 583 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 585 std::string dirname_cpy = std::string(dirname);
587 std::string correctEnding =
"XXXXXX";
589 size_t endingLength = correctEnding.length();
590 size_t dirNameLength = dirname_cpy.length();
594 if (endingLength > dirNameLength) {
596 "Unable to create temp directory '%s'. It should end with XXXXXX.", dirname_cpy.c_str()));
599 if (dirname.compare(dirNameLength - endingLength, endingLength, correctEnding) != 0) {
601 "Unable to create temp directory '%s'. It should end with XXXXXX.", dirname_cpy.c_str()));
606 if (dirname_cpy.at(dirname_cpy.length() - 1) !=
'/') {
607 dirname_cpy = dirname_cpy +
"/";
609 dirname_cpy = dirname_cpy +
"XXXXXX";
611 char *dirname_char =
new char[dirname_cpy.length() + 1];
612 strcpy(dirname_char, dirname_cpy.c_str());
614 char *computedDirname = mkdtemp(dirname_char);
616 if (!computedDirname) {
617 delete[] dirname_char;
621 std::string res(computedDirname);
622 delete[] dirname_char;
624 #elif defined(_WIN32) 642 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 644 #elif defined(_WIN32) 648 if (filename.empty()) {
652 std::string _filename =
path(filename);
653 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 654 if (stat(_filename.c_str(), &stbuf) != 0)
655 #elif defined(_WIN32) 656 if (_stat(_filename.c_str(), &stbuf) != 0)
661 if ((stbuf.st_mode & S_IFREG) == 0) {
664 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 665 if ((stbuf.st_mode & S_IRUSR) == 0)
666 #elif defined(_WIN32)
667 if ((stbuf.st_mode & S_IREAD) == 0)
687 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 688 #if TARGET_OS_IOS == 0 // The following code is not working on iOS since 690 char cmd[FILENAME_MAX];
692 sprintf(cmd,
"cp -p %s %s", src.c_str(), dst.c_str());
701 #elif defined(_WIN32) 702 #if (!defined(WINRT)) 703 char cmd[FILENAME_MAX];
707 sprintf(cmd,
"copy %s %s", src_.c_str(), dst_.c_str());
715 src.c_str(), dst.c_str()));
720 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 721 #if TARGET_OS_IOS == 0 // The following code is not working on iOS since 723 char cmd[FILENAME_MAX];
725 sprintf(cmd,
"cp -p -r %s %s", src.c_str(), dst.c_str());
734 #elif defined(_WIN32) 735 #if (!defined(WINRT)) 736 char cmd[FILENAME_MAX];
740 sprintf(cmd,
"copy %s %s", src_.c_str(), dst_.c_str());
748 src.c_str(), dst.c_str()));
752 std::cout <<
"Cannot copy: " << src <<
" in " << dst << std::endl;
769 #
if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__)))
774 if (::
remove(file_or_dir.c_str()) != 0)
780 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 781 #if TARGET_OS_IOS == 0 // The following code is not working on iOS since 783 char cmd[FILENAME_MAX];
784 sprintf(cmd,
"rm -rf \"%s\"", file_or_dir.c_str());
785 int ret = system(cmd);
793 #elif defined(_WIN32) 794 #if (!defined(WINRT)) 795 char cmd[FILENAME_MAX];
797 sprintf(cmd,
"rmdir /S /Q %s", file_or_dir_.c_str());
798 int ret = system(cmd);
805 file_or_dir.c_str()));
809 std::cout <<
"Cannot remove: " << file_or_dir << std::endl;
825 if (::
rename(oldfilename.c_str(), newfilename.c_str()) != 0)
843 std::string
path(pathname);
846 for (
unsigned int i = 0; i < path.length(); i++)
849 #elif defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__)) 850 for (
unsigned int i = 0; i < path.length(); i++)
853 #if TARGET_OS_IOS == 0 // The following code is not working on iOS and android since 858 wordexp_t exp_result;
861 replaceAll(path,
"'",
"'\\''");
863 wordexp(std::string(
"'" + path +
"'").c_str(), &exp_result, 0);
864 path = exp_result.we_wordc == 1 ? exp_result.we_wordv[0] :
"";
865 wordfree(&exp_result);
886 std::ifstream confContent(
configFile.c_str(), std::ios::in);
888 if (confContent.is_open()) {
889 std::string line, var, val;
892 std::string stop[3] = {
" ",
"\t",
"#"};
893 while (std::getline(confContent, line)) {
894 if ((line.compare(0, 1,
"#") != 0) && (line.size() > 2)) {
897 k =
static_cast<unsigned long>(line.find(
" "));
898 var = line.substr(0, k);
901 for (
unsigned i = 0; i < 3; ++i)
902 c =
vpMath::minimum(c, static_cast<int>(line.find(stop[i], static_cast<size_t>(k) + static_cast<size_t>(1))));
904 c =
static_cast<int>(line.size());
905 long unsigned int c_ =
static_cast<long unsigned int>(c);
906 val = line.substr(static_cast<size_t>(k) + static_cast<size_t>(1), static_cast<size_t>(c_) - static_cast<size_t>(k) - static_cast<size_t>(1));
931 for (
unsigned int k = 0; k <
configVars.size() && found ==
false; ++k) {
934 value = static_cast<float>(M_PI);
936 value = static_cast<float>(M_PI / 2.0);
938 value = static_cast<float>(-M_PI / 2.0);
940 value =
static_cast<float>(atof(
configValues[k].c_str()));
945 std::cout << var <<
" not found in config file" << std::endl;
959 for (
unsigned int k = 0; k <
configVars.size() && found ==
false; ++k) {
973 std::cout << var <<
" not found in config file" << std::endl;
988 for (
unsigned int k = 0; k <
configVars.size() && found ==
false; ++k) {
995 std::cout << var <<
" not found in config file" << std::endl;
1011 value =
static_cast<unsigned int>(v);
1058 for (
unsigned int k = 0; k <
configVars.size() && found ==
false; ++k) {
1065 std::cout << var <<
" not found in config file" << std::endl;
1083 const unsigned int &nRows)
1087 for (
unsigned int k = 0; k <
configVars.size() && found ==
false; ++k) {
1091 if (nCols != 0 && nRows != 0)
1092 value.
resize(nRows, nCols);
1093 size_t ind = 0, ind2;
1094 for (
unsigned int i = 0; i < value.
getRows(); ++i)
1095 for (
unsigned int j = 0; j < value.
getCols(); ++j) {
1098 if (nb.compare(
"PI") == 0)
1100 else if (nb.compare(
"PI/2") == 0)
1101 value[i][j] = M_PI / 2;
1102 else if (nb.compare(
"-PI/2") == 0)
1103 value[i][j] = -M_PI / 2;
1105 value[i][j] = atof(nb.c_str());
1111 std::cout << var <<
" not found in config file" << std::endl;
1129 else if (strFalse !=
"")
1144 if (std::fabs(val) < std::numeric_limits<double>::epsilon()) {
1146 sprintf(valC,
"%.3f", val);
1147 std::string valS(valC);
1204 std::string data_path;
1205 std::string file_to_test(
"mbt/cube.cao");
1206 std::string filename;
1207 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 1209 data_path =
"/usr/share/visp-images-data/ViSP-images";
1210 filename = data_path +
"/" + file_to_test;
1213 data_path =
"/usr/share/visp-images-data/visp-images";
1214 filename = data_path +
"/" + file_to_test;
1221 filename = data_path +
"/" + file_to_test;
1225 filename = data_path +
"/" + file_to_test;
1229 filename = data_path +
"/" + file_to_test;
1274 std::string sep =
"\\";
1275 std::string altsep =
"/";
1276 std::string extsep =
".";
1279 std::string sep =
"/";
1280 std::string altsep =
"";
1281 std::string extsep =
".";
1314 int sepIndex =
static_cast<int>(pathname.rfind(sep));
1315 if (!altsep.empty()) {
1316 int altsepIndex =
static_cast<int>(pathname.rfind(altsep));
1317 sepIndex = ((std::max))(sepIndex, altsepIndex);
1320 size_t dotIndex = pathname.rfind(extsep);
1321 if (dotIndex != std::string::npos) {
1323 size_t npos = std::string::npos;
1324 if ((sepIndex != static_cast<int>(npos) && static_cast<int>(dotIndex) > sepIndex) || sepIndex == static_cast<int>(npos)) {
1325 if (sepIndex == static_cast<int>(npos)) {
1328 size_t filenameIndex =
static_cast<size_t>(sepIndex) + static_cast<size_t>(1);
1330 while (filenameIndex < dotIndex) {
1331 if (pathname.compare(filenameIndex, 1, extsep) != 0) {
1332 return pathname.substr(dotIndex);
1349 if (pathname.size() > 0) {
1353 if (index != std::string::npos) {
1354 return convertedPathname.substr(index + 1);
1357 return convertedPathname;
1372 size_t found = name.find_last_of(
".");
1373 std::string name_we = name.substr(0, found);
1384 if (pathname.size() > 0) {
1388 if (index != std::string::npos) {
1389 return convertedPathname.substr(0, index);
1407 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 1408 std::string real_path_str = pathname;
1409 char *real_path = realpath(pathname.c_str(), NULL);
1412 real_path_str = real_path;
1415 return real_path_str;
1416 #elif defined(_WIN32) 1417 #if (!defined(WINRT)) 1418 std::string real_path_str = pathname;
1420 TCHAR buffer[4096] = TEXT(
"");
1422 retval = GetFullPathName(pathname.c_str(), 4096, buffer, 0);
1424 real_path_str = buffer;
1426 return real_path_str;
1429 "Cannot get absolute path of %s: not implemented on " 1430 "Universal Windows Platform",
1448 if (child.size() == 0 && parent.size() == 0) {
1452 if (child.size() == 0) {
1456 if (parent.size() == 0) {
1463 std::stringstream ss;
1465 std::string stringSeparator;
1466 ss >> stringSeparator;
1468 std::string lastConvertedParentChar = convertedParent.substr(convertedParent.size() - 1);
1469 std::string firstConvertedChildChar = convertedChild.substr(0, 1);
1471 if (lastConvertedParentChar == stringSeparator) {
1472 convertedParent = convertedParent.substr(0, convertedParent.size() - 1);
1475 if (firstConvertedChildChar == stringSeparator) {
1476 convertedChild = convertedChild.substr(1);
1479 return std::string(convertedParent + vpIoTools::separator + convertedChild);
1500 std::string path =
splitDrive(pathname).second;
1501 return path.size() > 0 && (path.substr(0, 1) ==
"/" || path.substr(0, 1) ==
"\\");
1521 return (path1_normalize == path2_normalize);
1584 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) 1585 return std::pair<std::string, std::string>(
"", pathname);
1587 const std::string sep =
"\\";
1588 const std::string sepsep =
"\\\\";
1589 const std::string altsep =
"/";
1591 if (pathname.size() > 1) {
1592 std::string normPathname = pathname;
1593 std::replace(normPathname.begin(), normPathname.end(), *altsep.c_str(), *sep.c_str());
1595 if (normPathname.substr(0, 2) == sepsep && normPathname.substr(2, 1) != sep) {
1600 size_t index = normPathname.find(sep, 2);
1601 if (index == std::string::npos) {
1602 return std::pair<std::string, std::string>(
"", pathname);
1605 size_t index2 = normPathname.find(sep, index + 1);
1608 if (index2 == index + 1) {
1609 return std::pair<std::string, std::string>(
"", pathname);
1612 if (index2 == std::string::npos) {
1613 index2 = pathname.size();
1616 return std::pair<std::string, std::string>(pathname.substr(0, index2), pathname.substr(index2));
1619 if (normPathname[1] ==
':') {
1620 return std::pair<std::string, std::string>(pathname.substr(0, 2), pathname.substr(2));
1624 return std::pair<std::string, std::string>(
"", pathname);
1678 size_t startIndex = 0;
1680 std::string chainToSplit = chain;
1681 std::vector<std::string> subChain;
1682 size_t sepIndex = chainToSplit.find(sep);
1684 while (sepIndex != std::string::npos) {
1685 std::string sub = chainToSplit.substr(startIndex, sepIndex);
1687 subChain.push_back(sub);
1688 chainToSplit = chainToSplit.substr(sepIndex + 1, chain.size() - 1);
1690 sepIndex = chainToSplit.find(sep);
1692 if (!chainToSplit.empty())
1693 subChain.push_back(chainToSplit);
1711 std::string dirName =
path(pathname);
1713 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 1715 std::vector<std::string> files;
1716 struct dirent **list = NULL;
1717 int filesCount = scandir(dirName.c_str(), &list, NULL, NULL);
1718 if (filesCount == -1) {
1721 for (
int i = 0; i < filesCount; i++) {
1722 std::string fileName = list[i]->d_name;
1723 if (fileName !=
"." && fileName !=
"..") {
1724 files.push_back(fileName);
1729 std::sort(files.begin(), files.end());
1732 #elif defined(_WIN32) 1733 #if (!defined(WINRT)) 1735 std::vector<std::string> files;
1736 std::string fileMask = dirName;
1737 fileMask.append(
"\\*");
1738 WIN32_FIND_DATA FindFileData;
1739 HANDLE hFind = FindFirstFile(fileMask.c_str(), &FindFileData);
1741 if (HandleToLong(&hFind) == ERROR_FILE_NOT_FOUND) {
1744 if (hFind == INVALID_HANDLE_VALUE) {
1748 std::string fileName = FindFileData.cFileName;
1749 if (fileName !=
"." && fileName !=
"..") {
1750 files.push_back(fileName);
1752 }
while (FindNextFile(hFind, &FindFileData));
1754 std::sort(files.begin(), files.end());
1759 "Cannot read files of directory %s: not implemented on " 1760 "Universal Windows Platform",
1771 file.read((
char *)(&short_value),
sizeof(short_value));
1773 #ifdef VISP_BIG_ENDIAN 1784 file.read((
char *)(&ushort_value),
sizeof(ushort_value));
1786 #ifdef VISP_BIG_ENDIAN 1797 file.read((
char *)(&int_value),
sizeof(int_value));
1799 #ifdef VISP_BIG_ENDIAN 1810 file.read((
char *)(&uint_value),
sizeof(uint_value));
1812 #ifdef VISP_BIG_ENDIAN 1823 file.read((
char *)(&float_value),
sizeof(float_value));
1825 #ifdef VISP_BIG_ENDIAN 1836 file.read((
char *)(&double_value),
sizeof(double_value));
1838 #ifdef VISP_BIG_ENDIAN 1849 #ifdef VISP_BIG_ENDIAN 1852 file.write((
char *)(&swap_short),
sizeof(swap_short));
1854 file.write((
char *)(&short_value),
sizeof(short_value));
1863 #ifdef VISP_BIG_ENDIAN 1866 file.write((
char *)(&swap_ushort),
sizeof(swap_ushort));
1868 file.write((
char *)(&ushort_value),
sizeof(ushort_value));
1877 #ifdef VISP_BIG_ENDIAN 1880 file.write((
char *)(&swap_int),
sizeof(swap_int));
1882 file.write((
char *)(&int_value),
sizeof(int_value));
1891 #ifdef VISP_BIG_ENDIAN 1894 file.write((
char *)(&swap_int),
sizeof(swap_int));
1896 file.write((
char *)(&uint_value),
sizeof(uint_value));
1905 #ifdef VISP_BIG_ENDIAN 1908 file.write((
char *)(&swap_float),
sizeof(swap_float));
1910 file.write((
char *)(&float_value),
sizeof(float_value));
1919 #ifdef VISP_BIG_ENDIAN 1922 file.write((
char *)(&swap_double),
sizeof(swap_double));
1924 file.write((
char *)(&double_value),
sizeof(double_value));
1930 std::transform(input.begin(), input.end(), input.begin(), ::tolower);
1931 std::istringstream is(input);
1935 is >> (input.size() > 1 ? std::boolalpha : std::noboolalpha) >> b;
1944 return ltrim(rtrim(s));
VISP_EXPORT float swapFloat(float f)
void resize(unsigned int nrows, unsigned int ncols, bool flagNullify=true, bool recopy_=true)
Class to define RGB colors available for display functionnalities.
Error that can be emited by the vpIoTools class and its derivates.
unsigned int getCols() const
VISP_EXPORT uint16_t swap16bits(uint16_t val)
VISP_EXPORT double swapDouble(double d)
static Type minimum(const Type &a, const Type &b)
unsigned int getRows() const
VISP_EXPORT uint32_t swap32bits(uint32_t val)
static vpColor getColor(const unsigned int &i)