Open3D (C++ API)
0.17.0
|
#include <FileSystem.h>
Public Member Functions | |
~CFile () | |
The destructor closes the file automatically. More... | |
bool | Open (const std::string &filename, const std::string &mode) |
Open a file. More... | |
std::string | GetError () |
Returns the last encountered error for this file. More... | |
void | Close () |
Close the file. More... | |
int64_t | CurPos () |
Returns current position in the file (ftell). More... | |
int64_t | GetFileSize () |
Returns the file size in bytes. More... | |
int64_t | GetNumLines () |
Returns the number of lines in the file. More... | |
const char * | ReadLine () |
template<class T > | |
size_t | ReadData (T *data, size_t num_elems) |
size_t | ReadData (void *data, size_t elem_size, size_t num_elems) |
FILE * | GetFILE () |
Returns the underlying C FILE pointer. More... | |
RAII Wrapper for C FILE* Throws exceptions in situations where the caller is not usually going to have proper handling code:
open3d::utility::filesystem::CFile::~CFile | ( | ) |
The destructor closes the file automatically.
void open3d::utility::filesystem::CFile::Close | ( | ) |
Close the file.
int64_t open3d::utility::filesystem::CFile::CurPos | ( | ) |
Returns current position in the file (ftell).
std::string open3d::utility::filesystem::CFile::GetError | ( | ) |
Returns the last encountered error for this file.
|
inline |
Returns the underlying C FILE pointer.
int64_t open3d::utility::filesystem::CFile::GetFileSize | ( | ) |
Returns the file size in bytes.
int64_t open3d::utility::filesystem::CFile::GetNumLines | ( | ) |
Returns the number of lines in the file.
bool open3d::utility::filesystem::CFile::Open | ( | const std::string & | filename, |
const std::string & | mode | ||
) |
Open a file.
|
inline |
Read data to a buffer.
data | The data buffer to be written into. |
num_elems | Number of elements to be read. The byte size of the element is determined by the size of buffer type. |
size_t open3d::utility::filesystem::CFile::ReadData | ( | void * | data, |
size_t | elem_size, | ||
size_t | num_elems | ||
) |
Read data to a buffer.
data | The data buffer to be written into. |
elem_size | Element size in bytes. |
num_elems | Number of elements to read. |
const char * open3d::utility::filesystem::CFile::ReadLine | ( | ) |
Throws if we hit buffer maximum. In most cases, calling code is only capable of processing a complete line, if it receives a partial line it will probably fail and it is very likely to fail/corrupt on the next call that receives the remainder of the line.