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" 254 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 256 char *_username = NULL;
258 if (_username == NULL) {
259 vpERROR_TRACE(
"Cannot get the username. Check your LOGNAME environment variable");
262 username = _username;
263 #elif defined(_WIN32) 264 #if (!defined(WINRT)) 265 unsigned int info_buffer_size = 1024;
266 TCHAR *infoBuf =
new TCHAR[info_buffer_size];
267 DWORD bufCharCount = (DWORD)info_buffer_size;
269 if (!GetUserName(infoBuf, &bufCharCount)) {
277 "Windows Platform"));
300 std::string username;
301 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 303 char *_username = NULL;
305 if (_username == NULL) {
306 vpERROR_TRACE(
"Cannot get the username. Check your LOGNAME environment variable");
309 username = _username;
310 #elif defined(_WIN32) 311 #if (!defined(WINRT)) 312 unsigned int info_buffer_size = 1024;
313 TCHAR *infoBuf =
new TCHAR[info_buffer_size];
314 DWORD bufCharCount = (DWORD)info_buffer_size;
316 if (!GetUserName(infoBuf, &bufCharCount)) {
325 "Windows Platform"));
364 #if defined(_WIN32) && defined(WINRT) 366 "implemented on Universal Windows Platform"));
372 if (_value == NULL) {
424 void vpIoTools::getVersion(
const std::string &version,
unsigned int &major,
unsigned int &minor,
unsigned int &patch)
426 if (version.size() == 0) {
431 size_t major_pos = version.find(
'.');
432 std::string major_str = version.substr(0, major_pos);
433 major = (unsigned)atoi(major_str.c_str());
435 if (major_pos != std::string::npos) {
436 size_t minor_pos = version.find(
'.', major_pos + 1);
437 std::string minor_str = version.substr(major_pos + 1, (minor_pos - (major_pos + 1)));
438 minor = (unsigned)atoi(minor_str.c_str());
440 if (minor_pos != std::string::npos) {
441 std::string patch_str = version.substr(minor_pos + 1);
442 patch = (unsigned)atoi(patch_str.c_str());
469 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 471 #elif defined(_WIN32) && defined(__MINGW32__) 473 #elif defined(_WIN32) 477 if (dirname == NULL || dirname[0] ==
'\0') {
481 std::string _dirname =
path(dirname);
483 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 484 if (stat(_dirname.c_str(), &stbuf) != 0)
485 #elif defined(_WIN32) && defined(__MINGW32__) 490 _dirname = _dirname.substr(0, _dirname.size() - 1);
491 if (stat(_dirname.c_str(), &stbuf) != 0)
492 #elif defined(_WIN32) 493 if (_stat(_dirname.c_str(), &stbuf) != 0)
498 #if defined(_WIN32) || (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) 499 if ((stbuf.st_mode & S_IFDIR) == 0)
504 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 505 if ((stbuf.st_mode & S_IWUSR) == 0)
506 #elif defined(_WIN32)
507 if ((stbuf.st_mode & S_IWRITE) == 0)
535 const size_t len = strlen(path);
536 char _path[PATH_MAX];
540 std::fill(_path, _path + PATH_MAX, 0);
543 if (len >
sizeof(_path) - 1) {
544 errno = ENAMETOOLONG;
551 for (p = _path + 1; *p; p++) {
556 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) 557 if (mkdir(_path, (mode_t)mode) != 0)
558 #elif defined(_WIN32) 570 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) 571 if (mkdir(_path, (mode_t)mode) != 0)
572 #elif defined(_WIN32)
573 if (_mkdir(_path) != 0)
599 #if ((!defined(__unix__) && !defined(__unix) && (!defined(__APPLE__) || !defined(__MACH__)))) && !defined(_WIN32) 600 std::cerr <<
"Unsupported platform for vpIoTools::makeDirectory()!" << std::endl;
604 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 606 #elif defined(_WIN32) && defined(__MINGW32__) 608 #elif defined(_WIN32) 612 if (dirname == NULL || dirname[0] ==
'\0') {
617 std::string _dirname =
path(dirname);
619 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 620 if (stat(_dirname.c_str(), &stbuf) != 0)
621 #elif defined(_WIN32) && defined(__MINGW32__) 622 if (stat(_dirname.c_str(), &stbuf) != 0)
623 #elif defined(_WIN32) 624 if (_stat(_dirname.c_str(), &stbuf) != 0)
658 vpERROR_TRACE(
"unable to create directory '%s'\n", dirname.c_str());
677 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 679 #elif defined(_WIN32) 683 if (filename == NULL || filename[0] ==
'\0') {
687 std::string _filename =
path(filename);
688 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 689 if (stat(_filename.c_str(), &stbuf) != 0)
690 #elif defined(_WIN32) 691 if (_stat(_filename.c_str(), &stbuf) != 0)
696 if ((stbuf.st_mode & S_IFREG) == 0) {
699 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 700 if ((stbuf.st_mode & S_IRUSR) == 0)
701 #elif defined(_WIN32)
702 if ((stbuf.st_mode & S_IREAD) == 0)
741 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 742 #if TARGET_OS_IOS == 0 // The following code is not working on iOS since 744 char cmd[FILENAME_MAX];
746 sprintf(cmd,
"cp -p %s %s", src, dst);
755 #elif defined(_WIN32) 756 #if (!defined(WINRT)) 757 char cmd[FILENAME_MAX];
761 sprintf(cmd,
"copy %s %s", src_.c_str(), dst_.c_str());
774 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 775 #if TARGET_OS_IOS == 0 // The following code is not working on iOS since 777 char cmd[FILENAME_MAX];
779 sprintf(cmd,
"cp -p -r %s %s", src, dst);
788 #elif defined(_WIN32) 789 #if (!defined(WINRT)) 790 char cmd[FILENAME_MAX];
794 sprintf(cmd,
"copy %s %s", src_.c_str(), dst_.c_str());
806 std::cout <<
"Cannot copy: " << src <<
" in " << dst << std::endl;
842 if (::
remove(file_or_dir) != 0)
848 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 849 #if TARGET_OS_IOS == 0 // The following code is not working on iOS since 851 char cmd[FILENAME_MAX];
852 sprintf(cmd,
"rm -rf \"%s\"", file_or_dir);
853 int ret = system(cmd);
861 #elif defined(_WIN32) 862 #if (!defined(WINRT)) 863 char cmd[FILENAME_MAX];
865 sprintf(cmd,
"rmdir /S /Q %s", file_or_dir_.c_str());
866 int ret = system(cmd);
877 std::cout <<
"Cannot remove: " << file_or_dir << std::endl;
907 if (::
rename(oldfilename, newfilename) != 0)
943 std::string
path(pathname);
946 for (
unsigned int i = 0; i < path.length(); i++)
949 #elif defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__)) 950 for (
unsigned int i = 0; i < path.length(); i++)
953 #if TARGET_OS_IOS == 0 // The following code is not working on iOS and android since 958 wordexp_t exp_result;
961 replaceAll(path,
"'",
"'\\''");
963 wordexp(std::string(
"'" + path +
"'").c_str(), &exp_result, 0);
964 path = exp_result.we_wordc == 1 ? exp_result.we_wordv[0] :
"";
965 wordfree(&exp_result);
1000 std::ifstream confContent(
configFile.c_str(), std::ios::in);
1002 if (confContent.is_open()) {
1003 std::string line, var, val;
1004 long unsigned int k;
1006 std::string stop[3] = {
" ",
"\t",
"#"};
1007 while (std::getline(confContent, line)) {
1008 if ((line.compare(0, 1,
"#") != 0) && (line.size() > 2)) {
1011 k = (
unsigned long)line.find(
" ");
1012 var = line.substr(0, k);
1015 for (
unsigned i = 0; i < 3; ++i)
1018 c = (int)line.size();
1019 long unsigned int c_ = (
long unsigned int)c;
1020 val = line.substr(k + 1, c_ - k - 1);
1027 confContent.close();
1045 for (
unsigned int k = 0; k <
configVars.size() && found ==
false; ++k) {
1048 value = (
float)M_PI;
1050 value = (
float)(M_PI / 2.0);
1052 value = (
float)(-M_PI / 2.0);
1059 std::cout << var <<
" not found in config file" << std::endl;
1073 for (
unsigned int k = 0; k <
configVars.size() && found ==
false; ++k) {
1087 std::cout << var <<
" not found in config file" << std::endl;
1102 for (
unsigned int k = 0; k <
configVars.size() && found ==
false; ++k) {
1109 std::cout << var <<
" not found in config file" << std::endl;
1125 value = (
unsigned int)v;
1172 for (
unsigned int k = 0; k <
configVars.size() && found ==
false; ++k) {
1179 std::cout << var <<
" not found in config file" << std::endl;
1197 const unsigned int &nRows)
1201 for (
unsigned int k = 0; k <
configVars.size() && found ==
false; ++k) {
1205 if (nCols != 0 && nRows != 0)
1206 value.
resize(nRows, nCols);
1207 size_t ind = 0, ind2;
1208 for (
unsigned int i = 0; i < value.
getRows(); ++i)
1209 for (
unsigned int j = 0; j < value.
getCols(); ++j) {
1212 if (nb.compare(
"PI") == 0)
1214 else if (nb.compare(
"PI/2") == 0)
1215 value[i][j] = M_PI / 2;
1216 else if (nb.compare(
"-PI/2") == 0)
1217 value[i][j] = -M_PI / 2;
1219 value[i][j] = atof(nb.c_str());
1225 std::cout << var <<
" not found in config file" << std::endl;
1243 else if (strFalse !=
"")
1258 if (std::fabs(val) < std::numeric_limits<double>::epsilon()) {
1260 sprintf(valC,
"%.3f", val);
1261 std::string valS(valC);
1318 std::string data_path;
1319 std::string file_to_test(
"mbt/cube.cao");
1320 std::string filename;
1321 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 1323 data_path =
"/usr/share/visp-images-data/ViSP-images";
1324 filename = data_path +
"/" + file_to_test;
1327 data_path =
"/usr/share/visp-images-data/visp-images";
1328 filename = data_path +
"/" + file_to_test;
1335 filename = data_path +
"/" + file_to_test;
1339 filename = data_path +
"/" + file_to_test;
1343 filename = data_path +
"/" + file_to_test;
1370 std::string sep =
"\\";
1371 std::string altsep =
"/";
1372 std::string extsep =
".";
1375 std::string sep =
"/";
1376 std::string altsep =
"";
1377 std::string extsep =
".";
1410 int sepIndex = (int)pathname.rfind(sep);
1411 if (!altsep.empty()) {
1412 int altsepIndex = (int)pathname.rfind(altsep);
1413 sepIndex = ((std::max))(sepIndex, altsepIndex);
1416 size_t dotIndex = pathname.rfind(extsep);
1417 if (dotIndex != std::string::npos) {
1419 if ((sepIndex != (
int)std::string::npos && (
int)dotIndex > sepIndex) || sepIndex == (
int)std::string::npos) {
1420 if (sepIndex == (
int)std::string::npos) {
1423 size_t filenameIndex = (size_t)(sepIndex + 1);
1425 while (filenameIndex < dotIndex) {
1426 if (pathname.compare(filenameIndex, 1, extsep) != 0) {
1427 return pathname.substr(dotIndex);
1444 if (pathname.size() > 0) {
1448 if (index != std::string::npos) {
1449 return convertedPathname.substr(index + 1);
1452 return convertedPathname;
1467 size_t found = name.find_last_of(
".");
1468 std::string name_we = name.substr(0, found);
1479 if (pathname.size() > 0) {
1483 if (index != std::string::npos) {
1484 return convertedPathname.substr(0, index);
1502 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 1503 std::string real_path_str = pathname;
1504 char *real_path = realpath(pathname.c_str(), NULL);
1506 if (real_path != NULL) {
1507 real_path_str = real_path;
1510 return real_path_str;
1511 #elif defined(_WIN32) 1512 #if (!defined(WINRT)) 1513 std::string real_path_str = pathname;
1515 TCHAR buffer[4096] = TEXT(
"");
1517 retval = GetFullPathName(pathname.c_str(), 4096, buffer, 0);
1519 real_path_str = buffer;
1521 return real_path_str;
1524 "Cannot get absolute path of %s: not implemented on " 1525 "Universal Windows Platform",
1543 if (child.size() == 0 && parent.size() == 0) {
1547 if (child.size() == 0) {
1551 if (parent.size() == 0) {
1558 std::stringstream ss;
1560 std::string stringSeparator;
1561 ss >> stringSeparator;
1563 std::string lastConvertedParentChar = convertedParent.substr(convertedParent.size() - 1);
1564 std::string firstConvertedChildChar = convertedChild.substr(0, 1);
1566 if (lastConvertedParentChar == stringSeparator) {
1567 convertedParent = convertedParent.substr(0, convertedParent.size() - 1);
1570 if (firstConvertedChildChar == stringSeparator) {
1571 convertedChild = convertedChild.substr(1);
1574 return std::string(convertedParent + vpIoTools::separator + convertedChild);
1596 return path.size() > 0 && (path.substr(0, 1) ==
"/" || path.substr(0, 1) ==
"\\");
1616 return (path1_normalize == path2_normalize);
1679 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) 1680 return std::pair<std::string, std::string>(
"", pathname);
1682 const std::string sep =
"\\";
1683 const std::string sepsep =
"\\\\";
1684 const std::string altsep =
"/";
1686 if (pathname.size() > 1) {
1687 std::string normPathname = pathname;
1688 std::replace(normPathname.begin(), normPathname.end(), *altsep.c_str(), *sep.c_str());
1690 if (normPathname.substr(0, 2) == sepsep && normPathname.substr(2, 1) != sep) {
1695 size_t index = normPathname.find(sep, 2);
1696 if (index == std::string::npos) {
1697 return std::pair<std::string, std::string>(
"", pathname);
1700 size_t index2 = normPathname.find(sep, index + 1);
1703 if (index2 == index + 1) {
1704 return std::pair<std::string, std::string>(
"", pathname);
1707 if (index2 == std::string::npos) {
1708 index2 = pathname.size();
1711 return std::pair<std::string, std::string>(pathname.substr(0, index2), pathname.substr(index2));
1714 if (normPathname[1] ==
':') {
1715 return std::pair<std::string, std::string>(pathname.substr(0, 2), pathname.substr(2));
1719 return std::pair<std::string, std::string>(
"", pathname);
1773 size_t startIndex = 0;
1775 std::string chainToSplit = chain;
1776 std::vector<std::string> subChain;
1777 size_t sepIndex = chainToSplit.find(sep);
1779 while (sepIndex != std::string::npos) {
1780 std::string sub = chainToSplit.substr(startIndex, sepIndex);
1782 subChain.push_back(sub);
1783 chainToSplit = chainToSplit.substr(sepIndex + 1, chain.size() - 1);
1785 sepIndex = chainToSplit.find(sep);
1787 if (!chainToSplit.empty())
1788 subChain.push_back(chainToSplit);
1806 std::string dirName =
path(pathname);
1808 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 1810 std::vector<std::string> files;
1811 struct dirent **list = NULL;
1812 int filesCount = scandir(dirName.c_str(), &list, NULL, NULL);
1813 if (filesCount == -1) {
1816 for (
int i = 0; i < filesCount; i++) {
1817 std::string fileName = list[i]->d_name;
1818 if (fileName !=
"." && fileName !=
"..") {
1819 files.push_back(fileName);
1824 std::sort(files.begin(), files.end());
1827 #elif defined(_WIN32) 1828 #if (!defined(WINRT)) 1830 std::vector<std::string> files;
1831 std::string fileMask = dirName;
1832 fileMask.append(
"\\*");
1833 WIN32_FIND_DATA FindFileData;
1834 HANDLE hFind = FindFirstFile(fileMask.c_str(), &FindFileData);
1836 if (HandleToLong(&hFind) == ERROR_FILE_NOT_FOUND) {
1839 if (hFind == INVALID_HANDLE_VALUE) {
1843 std::string fileName = FindFileData.cFileName;
1844 if (fileName !=
"." && fileName !=
"..") {
1845 files.push_back(fileName);
1847 }
while (FindNextFile(hFind, &FindFileData));
1849 std::sort(files.begin(), files.end());
1854 "Cannot read files of directory %s: not implemented on " 1855 "Universal Windows Platform",
1866 file.read((
char *)(&short_value),
sizeof(short_value));
1868 #ifdef VISP_BIG_ENDIAN 1870 short_value = swap16bits((uint16_t)short_value);
1879 file.read((
char *)(&ushort_value),
sizeof(ushort_value));
1881 #ifdef VISP_BIG_ENDIAN 1883 ushort_value = swap16bits(ushort_value);
1892 file.read((
char *)(&int_value),
sizeof(int_value));
1894 #ifdef VISP_BIG_ENDIAN 1896 int_value = swap32bits((uint32_t)int_value);
1905 file.read((
char *)(&uint_value),
sizeof(uint_value));
1907 #ifdef VISP_BIG_ENDIAN 1909 uint_value = swap32bits(uint_value);
1918 file.read((
char *)(&float_value),
sizeof(float_value));
1920 #ifdef VISP_BIG_ENDIAN 1922 float_value = swapFloat(float_value);
1931 file.read((
char *)(&double_value),
sizeof(double_value));
1933 #ifdef VISP_BIG_ENDIAN 1935 double_value = swapDouble(double_value);
1944 #ifdef VISP_BIG_ENDIAN 1946 uint16_t swap_short = swap16bits((uint16_t)short_value);
1947 file.write((
char *)(&swap_short),
sizeof(swap_short));
1949 file.write((
char *)(&short_value),
sizeof(short_value));
1958 #ifdef VISP_BIG_ENDIAN 1960 uint16_t swap_ushort = swap16bits(ushort_value);
1961 file.write((
char *)(&swap_ushort),
sizeof(swap_ushort));
1963 file.write((
char *)(&ushort_value),
sizeof(ushort_value));
1972 #ifdef VISP_BIG_ENDIAN 1974 uint32_t swap_int = swap32bits((uint32_t)int_value);
1975 file.write((
char *)(&swap_int),
sizeof(swap_int));
1977 file.write((
char *)(&int_value),
sizeof(int_value));
1986 #ifdef VISP_BIG_ENDIAN 1988 uint32_t swap_int = swap32bits(uint_value);
1989 file.write((
char *)(&swap_int),
sizeof(swap_int));
1991 file.write((
char *)(&uint_value),
sizeof(uint_value));
2000 #ifdef VISP_BIG_ENDIAN 2002 float swap_float = swapFloat(float_value);
2003 file.write((
char *)(&swap_float),
sizeof(swap_float));
2005 file.write((
char *)(&float_value),
sizeof(float_value));
2014 #ifdef VISP_BIG_ENDIAN 2016 double swap_double = swapDouble(double_value);
2017 file.write((
char *)(&swap_double),
sizeof(swap_double));
2019 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.
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)
unsigned int getRows() const
static vpColor getColor(const unsigned int &i)