38 #ifndef IO_UTILS_HEADER
39 #define IO_UTILS_HEADER
48 template<
typename T> T*
allocate_2d(T ***arr,
int row,
int col);
54 template<
typename T>
void free_2d(T ***array, T *data);
66 template <
class charType>
67 static void TrimLeft(std::basic_string<charType> & str,
const char *chars2remove = NULL);
68 template <
class charType>
69 static void TrimRight(std::basic_string<charType> & str,
const char *chars2remove = NULL);
70 template <
class charType>
71 static void Trim(std::basic_string<charType> & str,
const char *chars2remove = NULL);
73 static int ExtractLines(
const char *input_file_path, std::vector<std::string> & lines);
75 static std::string
JoinPath(std::string folder, std::string filename);
77 static std::pair<std::string, std::string>
SplitPath(std::string path);
78 static std::pair<std::string, std::string>
SplitPathExt(std::string path);
81 static bool Mkdir(
const std::string path);
87 #endif // IO_UTILS_HEADER
static std::pair< std::string, std::string > SplitPath(std::string path)
separate the folder from the filename
Definition: io_utils.cpp:251
static size_t GetAvailMem()
return the total availbale memory that can be used
Definition: io_utils.cpp:300
static std::pair< std::string, std::string > SplitPathExt(std::string path)
separate the basename from the file type (extension)
Definition: io_utils.cpp:261
static std::string GetFilename(std::string path)
get filename without folder path and suffix file format
Definition: io_utils.cpp:271
T * allocate_2d(T ***array, int row, int col)
Definition: io_utils.cpp:71
static bool IsEmptyString(const std::string &str)
Definition: io_utils.cpp:189
static bool IsFileExist(const char *filename)
judge whether the file exists
Definition: io_utils.cpp:227
static void TrimRight(std::basic_string< charType > &str, const char *chars2remove=NULL)
trim the right of a string
Definition: io_utils.cpp:144
To safely read and write files.
Definition: io_utils.h:61
namespace tw is mostly related to some utility functions developed by the repository owner...
Definition: opencv_libvot_api.cpp:12
static int ExtractLines(const char *input_file_path, std::vector< std::string > &lines)
extract lines from a text file
Definition: io_utils.cpp:203
static void TrimLeft(std::basic_string< charType > &str, const char *chars2remove=NULL)
trim the left of a string
Definition: io_utils.cpp:101
void free_2d(T ***array, T *data)
Definition: io_utils.cpp:82
static void Trim(std::basic_string< charType > &str, const char *chars2remove=NULL)
Definition: io_utils.cpp:183
static bool Mkdir(const std::string path)
make a directory
Definition: io_utils.cpp:278
static std::string JoinPath(std::string folder, std::string filename)
join a filename with a directory name
Definition: io_utils.cpp:233