3D Forest
Software for analysis of Lidar data from forest environment.
File Class Reference

#include <File.hpp>

Public Member Functions

 File ()
 
 ~File ()
 
 File (const File &other)
 
Fileoperator= (const File &other)
 
void create (const std::string &path)
 
void open (const std::string &path)
 
void open (const std::string &path, const std::string &mode)
 
void close ()
 
void seek (uint64_t offset)
 
void skip (uint64_t nbyte)
 
void read (uint8_t *buffer, uint64_t nbyte)
 
void write (const uint8_t *buffer, uint64_t nbyte)
 
void write (const std::string &str)
 
void write (File &input, uint64_t nbyte)
 
void truncate (uint64_t newSize=0)
 
bool open () const
 
bool eof () const
 
uint64_t size () const
 
uint64_t offset () const
 
const std::string & path () const
 

Static Public Member Functions

static std::string join (const std::string &path1, const std::string &path2)
 
static std::string currentPath ()
 
static bool exists (const std::string &path)
 
static bool absolute (const std::string &path)
 
static std::string fileName (const std::string &path)
 
static std::string fileExtension (const std::string &path)
 
static std::string replaceFileName (const std::string &path, const std::string &newFileName)
 
static std::string replaceExtension (const std::string &path, const std::string &newExtension)
 
static std::string resolvePath (const std::string &path, const std::string &basePath)
 
static void read (uint8_t *buffer, const std::string &path, uint64_t nbyte, uint64_t offset)
 
static void write (const uint8_t *buffer, const std::string &path, uint64_t nbyte, uint64_t offset)
 
static std::string read (const std::string &path)
 
static void write (const std::string &path, const std::string &data)
 
static std::string tmpname (const std::string &path)
 
static std::string tmpname (const std::string &outputPath, const std::string &inputPath)
 
static void sort (const std::string &path, size_t element_size, int(*comp)(const void *, const void *))
 
static void move (const std::string &outputPath, const std::string &inputPath)
 
static void remove (const std::string &path)
 

Private Member Functions

void create ()
 

Static Private Member Functions

static int seek (int fd, uint64_t offset)
 
static int read (int fd, uint8_t *buffer, uint64_t nbyte)
 
static int write (int fd, const uint8_t *buffer, uint64_t nbyte)
 

Private Attributes

int fd_
 
uint64_t size_
 
uint64_t offset_
 
std::string path_
 

Static Private Attributes

static const int INVALID_DESCRIPTOR = -1
 

Constructor & Destructor Documentation

◆ File() [1/2]

File::File ( )

◆ ~File()

File::~File ( )

◆ File() [2/2]

File::File ( const File & other)

Member Function Documentation

◆ absolute()

bool File::absolute ( const std::string & path)
static

Referenced by resolvePath().

◆ close()

◆ create() [1/2]

void File::create ( )
private

Referenced by create().

◆ create() [2/2]

void File::create ( const std::string & path)

◆ currentPath()

std::string File::currentPath ( )
static

◆ eof()

bool File::eof ( ) const

Referenced by ChunkFile::eof().

◆ exists()

◆ fileExtension()

std::string File::fileExtension ( const std::string & path)
static

◆ fileName()

std::string File::fileName ( const std::string & path)
static

◆ join()

std::string File::join ( const std::string & path1,
const std::string & path2 )
static

Referenced by Editor::close().

◆ move()

void File::move ( const std::string & outputPath,
const std::string & inputPath )
static

Referenced by LasFile::move(), and Json::write().

◆ offset()

◆ open() [1/3]

bool File::open ( ) const
inline

Referenced by create(), open(), open(), read(), and write().

◆ open() [2/3]

◆ open() [3/3]

void File::open ( const std::string & path,
const std::string & mode )

◆ operator=()

File & File::operator= ( const File & other)

◆ path()

◆ read() [1/4]

std::string File::read ( const std::string & path)
static

◆ read() [2/4]

int File::read ( int fd,
uint8_t * buffer,
uint64_t nbyte )
staticprivate

◆ read() [3/4]

void File::read ( uint8_t * buffer,
const std::string & path,
uint64_t nbyte,
uint64_t offset )
static

◆ read() [4/4]

◆ remove()

void File::remove ( const std::string & path)
static

◆ replaceExtension()

std::string File::replaceExtension ( const std::string & path,
const std::string & newExtension )
static

◆ replaceFileName()

std::string File::replaceFileName ( const std::string & path,
const std::string & newFileName )
static

Referenced by resolvePath().

◆ resolvePath()

std::string File::resolvePath ( const std::string & path,
const std::string & basePath )
static

◆ seek() [1/2]

int File::seek ( int fd,
uint64_t offset )
staticprivate

◆ seek() [2/2]

◆ size()

◆ skip()

void File::skip ( uint64_t nbyte)

Referenced by ChunkFile::skip().

◆ sort()

void File::sort ( const std::string & path,
size_t element_size,
int(*)(const void *, const void *) comp )
static

◆ tmpname() [1/2]

std::string File::tmpname ( const std::string & outputPath,
const std::string & inputPath )
static

◆ tmpname() [2/2]

std::string File::tmpname ( const std::string & path)
static

◆ truncate()

void File::truncate ( uint64_t newSize = 0)

◆ write() [1/6]

void File::write ( const std::string & path,
const std::string & data )
static

◆ write() [2/6]

void File::write ( const std::string & str)

◆ write() [3/6]

void File::write ( const uint8_t * buffer,
const std::string & path,
uint64_t nbyte,
uint64_t offset )
static

◆ write() [4/6]

◆ write() [5/6]

void File::write ( File & input,
uint64_t nbyte )

◆ write() [6/6]

int File::write ( int fd,
const uint8_t * buffer,
uint64_t nbyte )
staticprivate

Member Data Documentation

◆ fd_

int File::fd_
private

◆ INVALID_DESCRIPTOR

const int File::INVALID_DESCRIPTOR = -1
staticprivate

Referenced by close(), create(), open(), read(), write(), and ~File().

◆ offset_

uint64_t File::offset_
private

◆ path_

std::string File::path_
private

◆ size_

uint64_t File::size_
private

Referenced by close(), create(), eof(), open(), size(), and write().


The documentation for this class was generated from the following files: