53 #include <sys/types.h> 54 #include <visp3/core/vpDebug.h> 55 #include <visp3/core/vpIoException.h> 56 #include <visp3/core/vpIoTools.h> 57 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 72 #if defined(__APPLE__) && defined(__MACH__) // Apple OSX and iOS (Darwin) 73 #include <TargetConditionals.h> 78 # define PATH_MAX _MAX_PATH 80 # define PATH_MAX 1024 86 #if defined(__GLIBC__) 88 #if (__BYTE_ORDER == __LITTLE_ENDIAN) 89 #define VISP_LITTLE_ENDIAN 90 #elif (__BYTE_ORDER == __BIG_ENDIAN) 91 #define VISP_BIG_ENDIAN 92 #elif (__BYTE_ORDER == __PDP_ENDIAN) 94 #define VISP_PDP_ENDIAN 97 #error Unknown machine endianness detected. 99 #elif defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN) || defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__) 100 #define VISP_BIG_ENDIAN 101 #elif defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN) || defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__) 102 #define VISP_LITTLE_ENDIAN 103 #elif defined(__sparc) || defined(__sparc__) || defined(_POWER) || defined(__powerpc__) || defined(__ppc__) || \ 104 defined(__hpux) || defined(_MIPSEB) || defined(_POWER) || defined(__s390__) 106 #define VISP_BIG_ENDIAN 107 #elif defined(__i386__) || defined(__alpha__) || defined(__ia64) || defined(__ia64__) || defined(_M_IX86) || \ 108 defined(_M_IA64) || defined(_M_ALPHA) || defined(__amd64) || defined(__amd64__) || defined(_M_AMD64) || \ 109 defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || defined(__ANDROID__) 112 #define VISP_LITTLE_ENDIAN 113 #elif defined(WINRT) // For UWP 115 #define VISP_LITTLE_ENDIAN 117 #error Cannot detect host machine endianness. 130 #if (TARGET_OS_IOS == 0) && !defined(__ANDROID__) 131 void replaceAll(std::string &str,
const std::string &search,
const std::string &replace)
133 size_t start_pos = 0;
134 while ((start_pos = str.find(search, start_pos)) != std::string::npos) {
135 str.replace(start_pos, search.length(), replace);
136 start_pos += replace.length();
142 #ifdef VISP_BIG_ENDIAN 145 uint16_t swap16bits(
const uint16_t val)
147 return (((val >> 8) & 0x00FF) | ((val << 8) & 0xFF00));
152 uint32_t swap32bits(
const uint32_t val)
154 return (((val >> 24) & 0x000000FF) | ((val >> 8) & 0x0000FF00) | ((val << 8) & 0x00FF0000) |
155 ((val << 24) & 0xFF000000));
160 float swapFloat(
const float f)
168 dat2.b[0] = dat1.b[3];
169 dat2.b[1] = dat1.b[2];
170 dat2.b[2] = dat1.b[1];
171 dat2.b[3] = dat1.b[0];
177 double swapDouble(
const double d)
185 dat2.b[0] = dat1.b[7];
186 dat2.b[1] = dat1.b[6];
187 dat2.b[2] = dat1.b[5];
188 dat2.b[3] = dat1.b[4];
189 dat2.b[4] = dat1.b[3];
190 dat2.b[5] = dat1.b[2];
191 dat2.b[6] = dat1.b[1];
192 dat2.b[7] = dat1.b[0];
203 static std::string build_info =
204 #include "version_string.inc" 252 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 254 char *_username = NULL;
256 if (_username == NULL) {
257 username =
"unknown";
260 username = _username;
262 #elif defined(_WIN32) 263 #if (!defined(WINRT)) 264 unsigned int info_buffer_size = 1024;
265 TCHAR *infoBuf =
new TCHAR[info_buffer_size];
266 DWORD bufCharCount = (DWORD)info_buffer_size;
268 if (!GetUserName(infoBuf, &bufCharCount)) {
276 username =
"unknown";
279 username =
"unknown";
301 std::string username;
302 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 304 char *_username = NULL;
306 if (_username == NULL) {
307 vpERROR_TRACE(
"Cannot get the username. Check your LOGNAME environment variable");
310 username = _username;
311 #elif defined(_WIN32) 312 #if (!defined(WINRT)) 313 unsigned int info_buffer_size = 1024;
314 TCHAR *infoBuf =
new TCHAR[info_buffer_size];
315 DWORD bufCharCount = (DWORD)info_buffer_size;
317 if (!GetUserName(infoBuf, &bufCharCount)) {
326 "Windows Platform"));
365 #if defined(_WIN32) && defined(WINRT) 367 "implemented on Universal Windows Platform"));
373 if (_value == NULL) {
425 void vpIoTools::getVersion(
const std::string &version,
unsigned int &major,
unsigned int &minor,
unsigned int &patch)
427 if (version.size() == 0) {
432 size_t major_pos = version.find(
'.');
433 std::string major_str = version.substr(0, major_pos);
434 major = (unsigned)atoi(major_str.c_str());
436 if (major_pos != std::string::npos) {
437 size_t minor_pos = version.find(
'.', major_pos + 1);
438 std::string minor_str = version.substr(major_pos + 1, (minor_pos - (major_pos + 1)));
439 minor = (unsigned)atoi(minor_str.c_str());
441 if (minor_pos != std::string::npos) {
442 std::string patch_str = version.substr(minor_pos + 1);
443 patch = (unsigned)atoi(patch_str.c_str());
470 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 472 #elif defined(_WIN32) && defined(__MINGW32__) 474 #elif defined(_WIN32) 478 if (dirname == NULL || dirname[0] ==
'\0') {
482 std::string _dirname =
path(dirname);
484 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 485 if (stat(_dirname.c_str(), &stbuf) != 0)
486 #elif defined(_WIN32) && defined(__MINGW32__) 491 _dirname = _dirname.substr(0, _dirname.size() - 1);
492 if (stat(_dirname.c_str(), &stbuf) != 0)
493 #elif defined(_WIN32) 494 if (_stat(_dirname.c_str(), &stbuf) != 0)
499 #if defined(_WIN32) || (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) 500 if ((stbuf.st_mode & S_IFDIR) == 0)
505 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 506 if ((stbuf.st_mode & S_IWUSR) == 0)
507 #elif defined(_WIN32)
508 if ((stbuf.st_mode & S_IWRITE) == 0)
536 const size_t len = strlen(path);
537 char _path[PATH_MAX];
541 std::fill(_path, _path + PATH_MAX, 0);
544 if (len >
sizeof(_path) - 1) {
545 errno = ENAMETOOLONG;
552 for (p = _path + 1; *p; p++) {
557 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) 558 if (mkdir(_path, (mode_t)mode) != 0)
559 #elif defined(_WIN32) 571 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) 572 if (mkdir(_path, (mode_t)mode) != 0)
573 #elif defined(_WIN32)
574 if (_mkdir(_path) != 0)
600 #if ((!defined(__unix__) && !defined(__unix) && (!defined(__APPLE__) || !defined(__MACH__)))) && !defined(_WIN32) 601 std::cerr <<
"Unsupported platform for vpIoTools::makeDirectory()!" << std::endl;
605 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 607 #elif defined(_WIN32) && defined(__MINGW32__) 609 #elif defined(_WIN32) 613 if (dirname == NULL || dirname[0] ==
'\0') {
618 std::string _dirname =
path(dirname);
620 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 621 if (stat(_dirname.c_str(), &stbuf) != 0)
622 #elif defined(_WIN32) && defined(__MINGW32__) 623 if (stat(_dirname.c_str(), &stbuf) != 0)
624 #elif defined(_WIN32) 625 if (_stat(_dirname.c_str(), &stbuf) != 0)
659 vpERROR_TRACE(
"unable to create directory '%s'\n", dirname.c_str());
678 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 680 #elif defined(_WIN32) 684 if (filename == NULL || filename[0] ==
'\0') {
688 std::string _filename =
path(filename);
689 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 690 if (stat(_filename.c_str(), &stbuf) != 0)
691 #elif defined(_WIN32) 692 if (_stat(_filename.c_str(), &stbuf) != 0)
697 if ((stbuf.st_mode & S_IFREG) == 0) {
700 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 701 if ((stbuf.st_mode & S_IRUSR) == 0)
702 #elif defined(_WIN32)
703 if ((stbuf.st_mode & S_IREAD) == 0)
742 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 743 #if TARGET_OS_IOS == 0 // The following code is not working on iOS since 745 char cmd[FILENAME_MAX];
747 sprintf(cmd,
"cp -p %s %s", src, dst);
756 #elif defined(_WIN32) 757 #if (!defined(WINRT)) 758 char cmd[FILENAME_MAX];
762 sprintf(cmd,
"copy %s %s", src_.c_str(), dst_.c_str());
775 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 776 #if TARGET_OS_IOS == 0 // The following code is not working on iOS since 778 char cmd[FILENAME_MAX];
780 sprintf(cmd,
"cp -p -r %s %s", src, dst);
789 #elif defined(_WIN32) 790 #if (!defined(WINRT)) 791 char cmd[FILENAME_MAX];
795 sprintf(cmd,
"copy %s %s", src_.c_str(), dst_.c_str());
807 std::cout <<
"Cannot copy: " << src <<
" in " << dst << std::endl;
843 if (::
remove(file_or_dir) != 0)
849 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 850 #if TARGET_OS_IOS == 0 // The following code is not working on iOS since 852 char cmd[FILENAME_MAX];
853 sprintf(cmd,
"rm -rf \"%s\"", file_or_dir);
854 int ret = system(cmd);
862 #elif defined(_WIN32) 863 #if (!defined(WINRT)) 864 char cmd[FILENAME_MAX];
866 sprintf(cmd,
"rmdir /S /Q %s", file_or_dir_.c_str());
867 int ret = system(cmd);
878 std::cout <<
"Cannot remove: " << file_or_dir << std::endl;
908 if (::
rename(oldfilename, newfilename) != 0)
944 std::string
path(pathname);
947 for (
unsigned int i = 0; i < path.length(); i++)
950 #elif defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__)) 951 for (
unsigned int i = 0; i < path.length(); i++)
954 #if TARGET_OS_IOS == 0 // The following code is not working on iOS and android since 959 wordexp_t exp_result;
962 replaceAll(path,
"'",
"'\\''");
964 wordexp(std::string(
"'" + path +
"'").c_str(), &exp_result, 0);
965 path = exp_result.we_wordc == 1 ? exp_result.we_wordv[0] :
"";
966 wordfree(&exp_result);
1001 std::ifstream confContent(
configFile.c_str(), std::ios::in);
1003 if (confContent.is_open()) {
1004 std::string line, var, val;
1005 long unsigned int k;
1007 std::string stop[3] = {
" ",
"\t",
"#"};
1008 while (std::getline(confContent, line)) {
1009 if ((line.compare(0, 1,
"#") != 0) && (line.size() > 2)) {
1012 k = (
unsigned long)line.find(
" ");
1013 var = line.substr(0, k);
1016 for (
unsigned i = 0; i < 3; ++i)
1019 c = (int)line.size();
1020 long unsigned int c_ = (
long unsigned int)c;
1021 val = line.substr(k + 1, c_ - k - 1);
1028 confContent.close();
1046 for (
unsigned int k = 0; k <
configVars.size() && found ==
false; ++k) {
1049 value = (
float)M_PI;
1051 value = (
float)(M_PI / 2.0);
1053 value = (
float)(-M_PI / 2.0);
1060 std::cout << var <<
" not found in config file" << std::endl;
1074 for (
unsigned int k = 0; k <
configVars.size() && found ==
false; ++k) {
1088 std::cout << var <<
" not found in config file" << std::endl;
1103 for (
unsigned int k = 0; k <
configVars.size() && found ==
false; ++k) {
1110 std::cout << var <<
" not found in config file" << std::endl;
1126 value = (
unsigned int)v;
1173 for (
unsigned int k = 0; k <
configVars.size() && found ==
false; ++k) {
1180 std::cout << var <<
" not found in config file" << std::endl;
1198 const unsigned int &nRows)
1202 for (
unsigned int k = 0; k <
configVars.size() && found ==
false; ++k) {
1206 if (nCols != 0 && nRows != 0)
1207 value.
resize(nRows, nCols);
1208 size_t ind = 0, ind2;
1209 for (
unsigned int i = 0; i < value.
getRows(); ++i)
1210 for (
unsigned int j = 0; j < value.
getCols(); ++j) {
1213 if (nb.compare(
"PI") == 0)
1215 else if (nb.compare(
"PI/2") == 0)
1216 value[i][j] = M_PI / 2;
1217 else if (nb.compare(
"-PI/2") == 0)
1218 value[i][j] = -M_PI / 2;
1220 value[i][j] = atof(nb.c_str());
1226 std::cout << var <<
" not found in config file" << std::endl;
1244 else if (strFalse !=
"")
1259 if (std::fabs(val) < std::numeric_limits<double>::epsilon()) {
1261 sprintf(valC,
"%.3f", val);
1262 std::string valS(valC);
1319 std::string data_path;
1320 std::string file_to_test(
"mbt/cube.cao");
1321 std::string filename;
1322 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 1324 data_path =
"/usr/share/visp-images-data/ViSP-images";
1325 filename = data_path +
"/" + file_to_test;
1328 data_path =
"/usr/share/visp-images-data/visp-images";
1329 filename = data_path +
"/" + file_to_test;
1336 filename = data_path +
"/" + file_to_test;
1340 filename = data_path +
"/" + file_to_test;
1344 filename = data_path +
"/" + file_to_test;
1371 std::string sep =
"\\";
1372 std::string altsep =
"/";
1373 std::string extsep =
".";
1376 std::string sep =
"/";
1377 std::string altsep =
"";
1378 std::string extsep =
".";
1411 int sepIndex = (int)pathname.rfind(sep);
1412 if (!altsep.empty()) {
1413 int altsepIndex = (int)pathname.rfind(altsep);
1414 sepIndex = ((std::max))(sepIndex, altsepIndex);
1417 size_t dotIndex = pathname.rfind(extsep);
1418 if (dotIndex != std::string::npos) {
1420 if ((sepIndex != (
int)std::string::npos && (
int)dotIndex > sepIndex) || sepIndex == (
int)std::string::npos) {
1421 if (sepIndex == (
int)std::string::npos) {
1424 size_t filenameIndex = (size_t)(sepIndex + 1);
1426 while (filenameIndex < dotIndex) {
1427 if (pathname.compare(filenameIndex, 1, extsep) != 0) {
1428 return pathname.substr(dotIndex);
1445 if (pathname.size() > 0) {
1449 if (index != std::string::npos) {
1450 return convertedPathname.substr(index + 1);
1453 return convertedPathname;
1468 size_t found = name.find_last_of(
".");
1469 std::string name_we = name.substr(0, found);
1480 if (pathname.size() > 0) {
1484 if (index != std::string::npos) {
1485 return convertedPathname.substr(0, index);
1503 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 1504 std::string real_path_str = pathname;
1505 char *real_path = realpath(pathname.c_str(), NULL);
1507 if (real_path != NULL) {
1508 real_path_str = real_path;
1511 return real_path_str;
1512 #elif defined(_WIN32) 1513 #if (!defined(WINRT)) 1514 std::string real_path_str = pathname;
1516 TCHAR buffer[4096] = TEXT(
"");
1518 retval = GetFullPathName(pathname.c_str(), 4096, buffer, 0);
1520 real_path_str = buffer;
1522 return real_path_str;
1525 "Cannot get absolute path of %s: not implemented on " 1526 "Universal Windows Platform",
1544 if (child.size() == 0 && parent.size() == 0) {
1548 if (child.size() == 0) {
1552 if (parent.size() == 0) {
1559 std::stringstream ss;
1561 std::string stringSeparator;
1562 ss >> stringSeparator;
1564 std::string lastConvertedParentChar = convertedParent.substr(convertedParent.size() - 1);
1565 std::string firstConvertedChildChar = convertedChild.substr(0, 1);
1567 if (lastConvertedParentChar == stringSeparator) {
1568 convertedParent = convertedParent.substr(0, convertedParent.size() - 1);
1571 if (firstConvertedChildChar == stringSeparator) {
1572 convertedChild = convertedChild.substr(1);
1575 return std::string(convertedParent + vpIoTools::separator + convertedChild);
1597 return path.size() > 0 && (path.substr(0, 1) ==
"/" || path.substr(0, 1) ==
"\\");
1617 return (path1_normalize == path2_normalize);
1680 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) 1681 return std::pair<std::string, std::string>(
"", pathname);
1683 const std::string sep =
"\\";
1684 const std::string sepsep =
"\\\\";
1685 const std::string altsep =
"/";
1687 if (pathname.size() > 1) {
1688 std::string normPathname = pathname;
1689 std::replace(normPathname.begin(), normPathname.end(), *altsep.c_str(), *sep.c_str());
1691 if (normPathname.substr(0, 2) == sepsep && normPathname.substr(2, 1) != sep) {
1696 size_t index = normPathname.find(sep, 2);
1697 if (index == std::string::npos) {
1698 return std::pair<std::string, std::string>(
"", pathname);
1701 size_t index2 = normPathname.find(sep, index + 1);
1704 if (index2 == index + 1) {
1705 return std::pair<std::string, std::string>(
"", pathname);
1708 if (index2 == std::string::npos) {
1709 index2 = pathname.size();
1712 return std::pair<std::string, std::string>(pathname.substr(0, index2), pathname.substr(index2));
1715 if (normPathname[1] ==
':') {
1716 return std::pair<std::string, std::string>(pathname.substr(0, 2), pathname.substr(2));
1720 return std::pair<std::string, std::string>(
"", pathname);
1774 size_t startIndex = 0;
1776 std::string chainToSplit = chain;
1777 std::vector<std::string> subChain;
1778 size_t sepIndex = chainToSplit.find(sep);
1780 while (sepIndex != std::string::npos) {
1781 std::string sub = chainToSplit.substr(startIndex, sepIndex);
1783 subChain.push_back(sub);
1784 chainToSplit = chainToSplit.substr(sepIndex + 1, chain.size() - 1);
1786 sepIndex = chainToSplit.find(sep);
1788 if (!chainToSplit.empty())
1789 subChain.push_back(chainToSplit);
1807 std::string dirName =
path(pathname);
1809 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 1811 std::vector<std::string> files;
1812 struct dirent **list = NULL;
1813 int filesCount = scandir(dirName.c_str(), &list, NULL, NULL);
1814 if (filesCount == -1) {
1817 for (
int i = 0; i < filesCount; i++) {
1818 std::string fileName = list[i]->d_name;
1819 if (fileName !=
"." && fileName !=
"..") {
1820 files.push_back(fileName);
1825 std::sort(files.begin(), files.end());
1828 #elif defined(_WIN32) 1829 #if (!defined(WINRT)) 1831 std::vector<std::string> files;
1832 std::string fileMask = dirName;
1833 fileMask.append(
"\\*");
1834 WIN32_FIND_DATA FindFileData;
1835 HANDLE hFind = FindFirstFile(fileMask.c_str(), &FindFileData);
1837 if (HandleToLong(&hFind) == ERROR_FILE_NOT_FOUND) {
1840 if (hFind == INVALID_HANDLE_VALUE) {
1844 std::string fileName = FindFileData.cFileName;
1845 if (fileName !=
"." && fileName !=
"..") {
1846 files.push_back(fileName);
1848 }
while (FindNextFile(hFind, &FindFileData));
1850 std::sort(files.begin(), files.end());
1855 "Cannot read files of directory %s: not implemented on " 1856 "Universal Windows Platform",
1867 file.read((
char *)(&short_value),
sizeof(short_value));
1869 #ifdef VISP_BIG_ENDIAN 1871 short_value = swap16bits((uint16_t)short_value);
1880 file.read((
char *)(&ushort_value),
sizeof(ushort_value));
1882 #ifdef VISP_BIG_ENDIAN 1884 ushort_value = swap16bits(ushort_value);
1893 file.read((
char *)(&int_value),
sizeof(int_value));
1895 #ifdef VISP_BIG_ENDIAN 1897 int_value = swap32bits((uint32_t)int_value);
1906 file.read((
char *)(&uint_value),
sizeof(uint_value));
1908 #ifdef VISP_BIG_ENDIAN 1910 uint_value = swap32bits(uint_value);
1919 file.read((
char *)(&float_value),
sizeof(float_value));
1921 #ifdef VISP_BIG_ENDIAN 1923 float_value = swapFloat(float_value);
1932 file.read((
char *)(&double_value),
sizeof(double_value));
1934 #ifdef VISP_BIG_ENDIAN 1936 double_value = swapDouble(double_value);
1945 #ifdef VISP_BIG_ENDIAN 1947 uint16_t swap_short = swap16bits((uint16_t)short_value);
1948 file.write((
char *)(&swap_short),
sizeof(swap_short));
1950 file.write((
char *)(&short_value),
sizeof(short_value));
1959 #ifdef VISP_BIG_ENDIAN 1961 uint16_t swap_ushort = swap16bits(ushort_value);
1962 file.write((
char *)(&swap_ushort),
sizeof(swap_ushort));
1964 file.write((
char *)(&ushort_value),
sizeof(ushort_value));
1973 #ifdef VISP_BIG_ENDIAN 1975 uint32_t swap_int = swap32bits((uint32_t)int_value);
1976 file.write((
char *)(&swap_int),
sizeof(swap_int));
1978 file.write((
char *)(&int_value),
sizeof(int_value));
1987 #ifdef VISP_BIG_ENDIAN 1989 uint32_t swap_int = swap32bits(uint_value);
1990 file.write((
char *)(&swap_int),
sizeof(swap_int));
1992 file.write((
char *)(&uint_value),
sizeof(uint_value));
2001 #ifdef VISP_BIG_ENDIAN 2003 float swap_float = swapFloat(float_value);
2004 file.write((
char *)(&swap_float),
sizeof(swap_float));
2006 file.write((
char *)(&float_value),
sizeof(float_value));
2015 #ifdef VISP_BIG_ENDIAN 2017 double swap_double = swapDouble(double_value);
2018 file.write((
char *)(&swap_double),
sizeof(swap_double));
2020 file.write((
char *)(&double_value),
sizeof(double_value));
void resize(const unsigned int nrows, const unsigned int ncols, const bool flagNullify=true, const bool recopy_=true)
Class to define colors available for display functionnalities.
unsigned int getRows() const
Error that can be emited by the vpIoTools class and its derivates.
unsigned int getCols() const
static Type minimum(const Type &a, const Type &b)
static vpColor getColor(const unsigned int &i)