Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | List of all members
bitpit::FileHandler Class Reference

Creates file names and checks status. More...

#include <fileHandler.hpp>

Public Member Functions

 FileHandler ()
 
 FileHandler (const FileHandler &other)
 
 FileHandler (const std::string &dir_, const std::string &name_, const std::string &app_)
 
bool exists () const
 
const std::string & getAppendix () const
 
int getBlock () const
 
int getCounter () const
 
const std::string & getDirectory () const
 
const std::string & getName () const
 
std::string getPath () const
 
void incrementCounter ()
 
bool isParallel () const
 
bool isSeries () const
 
FileHandleroperator= (const FileHandler &other)
 
void setAppendix (const std::string &a_)
 
void setBlock (int b_)
 
void setCounter (int c_)
 
void setDirectory (const std::string &d_)
 
void setName (const std::string &n_)
 
void setParallel (bool p_)
 
void setSeries (bool s_)
 

Static Public Attributes

static BITPIT_PUBLIC_API const int INVALID_COUNTER = -1
 

Detailed Description

Creates file names and checks status.

Permits to create easily filenames for parallel output and for writing time series. Typical filenames are directory/name.bxxxx.yyyy.appendix and can be retirieved via GetName().

Definition at line 47 of file fileHandler.hpp.

Constructor & Destructor Documentation

◆ FileHandler() [1/3]

bitpit::FileHandler::FileHandler ( )

Default constructor. Refers to a serial file in the current directory called "file.dat" Default values of counters and blocks are set to 0.

Definition at line 41 of file fileHandler.cpp.

◆ FileHandler() [2/3]

bitpit::FileHandler::FileHandler ( const std::string & dir_,
const std::string & name_,
const std::string & app_ )

Constructor. Refers to a serial file named according to input parameters. Default values of counters and blocks are set to 0.

Parameters
[in]dir_directory of file
[in]name_name of the file
[in]app_appendix of the file

Definition at line 55 of file fileHandler.cpp.

◆ FileHandler() [3/3]

bitpit::FileHandler::FileHandler ( const FileHandler & other)

Copy Constructor.

Parameters
[in]otherFileHandler to be copied.

Definition at line 65 of file fileHandler.cpp.

Member Function Documentation

◆ exists()

bool bitpit::FileHandler::exists ( ) const

Checks if file exists.

Returns
[true/false] if file exists

Definition at line 92 of file fileHandler.cpp.

◆ getAppendix()

const std::string & bitpit::FileHandler::getAppendix ( ) const

Get the appendix of the file

Returns
The appendix of the file.

Definition at line 136 of file fileHandler.cpp.

◆ getBlock()

int bitpit::FileHandler::getBlock ( ) const

gets the index of the parallel block

Returns
the index of the parallel block

Definition at line 237 of file fileHandler.cpp.

◆ getCounter()

int bitpit::FileHandler::getCounter ( ) const

Get the time index of the following file. If the file doen't belong to a time series, a negative number will be returned.

Returns
counter

Definition at line 191 of file fileHandler.cpp.

◆ getDirectory()

const std::string & bitpit::FileHandler::getDirectory ( ) const

Get the directory where the file will be saved

Returns
The directory where the file will be saved.

Definition at line 118 of file fileHandler.cpp.

◆ getName()

const std::string & bitpit::FileHandler::getName ( ) const

Get the name of the file

Returns
The name of the file.

Definition at line 127 of file fileHandler.cpp.

◆ getPath()

std::string bitpit::FileHandler::getPath ( ) const

Composes the filename.

Returns
complete filename

Definition at line 101 of file fileHandler.cpp.

◆ incrementCounter()

void bitpit::FileHandler::incrementCounter ( )

Increments the counter used for series.

Definition at line 211 of file fileHandler.cpp.

◆ isParallel()

bool bitpit::FileHandler::isParallel ( ) const

Checks if file belongs to a parallel output

Returns
Returns true if the file belongs to a parallel output, false otherwise

Definition at line 220 of file fileHandler.cpp.

◆ isSeries()

bool bitpit::FileHandler::isSeries ( ) const

Checks if file belongs to a time series

Returns
Returns true if the file belongs to a time series, false otherwise

Definition at line 172 of file fileHandler.cpp.

◆ operator=()

FileHandler & bitpit::FileHandler::operator= ( const FileHandler & other)

Assignment operator.

Definition at line 74 of file fileHandler.cpp.

◆ setAppendix()

void bitpit::FileHandler::setAppendix ( const std::string & a_)

sets the appendix

Parameters
[in]a_appendix of file

Definition at line 163 of file fileHandler.cpp.

◆ setBlock()

void bitpit::FileHandler::setBlock ( int b_)

sets the index of the parallel block

Parameters
[in]b_index of the parallel block

Definition at line 245 of file fileHandler.cpp.

◆ setCounter()

void bitpit::FileHandler::setCounter ( int c_)

sets the counter of the series

Parameters
[in]c_index of series

Definition at line 203 of file fileHandler.cpp.

◆ setDirectory()

void bitpit::FileHandler::setDirectory ( const std::string & d_)

sets the directory

Parameters
[in]d_name of directory

Definition at line 145 of file fileHandler.cpp.

◆ setName()

void bitpit::FileHandler::setName ( const std::string & n_)

sets the name

Parameters
[in]n_name of file

Definition at line 154 of file fileHandler.cpp.

◆ setParallel()

void bitpit::FileHandler::setParallel ( bool p_)

sets if file belongs to a parallel output

Parameters
[in]p_[true/false] if parallel

Definition at line 228 of file fileHandler.cpp.

◆ setSeries()

void bitpit::FileHandler::setSeries ( bool s_)

sets if file belongs to a time series

Parameters
[in]s_[true/false] if series

Definition at line 180 of file fileHandler.cpp.

Member Data Documentation

◆ INVALID_COUNTER

BITPIT_PUBLIC_API const int bitpit::FileHandler::INVALID_COUNTER = -1
static

dummy counter associate with files that doesn't belong to a time series

Definition at line 61 of file fileHandler.hpp.


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