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 |
FileHandler & | operator= (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 |
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.
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.
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.
[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.
bitpit::FileHandler::FileHandler | ( | const FileHandler & | other | ) |
Copy Constructor.
[in] | other | FileHandler to be copied. |
Definition at line 65 of file fileHandler.cpp.
bool bitpit::FileHandler::exists | ( | ) | const |
Checks if file exists.
Definition at line 92 of file fileHandler.cpp.
const std::string & bitpit::FileHandler::getAppendix | ( | ) | const |
Get the appendix of the file
Definition at line 136 of file fileHandler.cpp.
int bitpit::FileHandler::getBlock | ( | ) | const |
gets the index of the parallel block
Definition at line 237 of file fileHandler.cpp.
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.
Definition at line 191 of file fileHandler.cpp.
const std::string & bitpit::FileHandler::getDirectory | ( | ) | const |
Get the directory where the file will be saved
Definition at line 118 of file fileHandler.cpp.
const std::string & bitpit::FileHandler::getName | ( | ) | const |
Get the name of the file
Definition at line 127 of file fileHandler.cpp.
std::string bitpit::FileHandler::getPath | ( | ) | const |
void bitpit::FileHandler::incrementCounter | ( | ) |
Increments the counter used for series.
Definition at line 211 of file fileHandler.cpp.
bool bitpit::FileHandler::isParallel | ( | ) | const |
Checks if file belongs to a parallel output
Definition at line 220 of file fileHandler.cpp.
bool bitpit::FileHandler::isSeries | ( | ) | const |
Checks if file belongs to a time series
Definition at line 172 of file fileHandler.cpp.
FileHandler & bitpit::FileHandler::operator= | ( | const FileHandler & | other | ) |
Assignment operator.
Definition at line 74 of file fileHandler.cpp.
void bitpit::FileHandler::setAppendix | ( | const std::string & | a_ | ) |
void bitpit::FileHandler::setBlock | ( | int | b_ | ) |
sets the index of the parallel block
[in] | b_ | index of the parallel block |
Definition at line 245 of file fileHandler.cpp.
void bitpit::FileHandler::setCounter | ( | int | c_ | ) |
sets the counter of the series
[in] | c_ | index of series |
Definition at line 203 of file fileHandler.cpp.
void bitpit::FileHandler::setDirectory | ( | const std::string & | d_ | ) |
sets the directory
[in] | d_ | name of directory |
Definition at line 145 of file fileHandler.cpp.
void bitpit::FileHandler::setName | ( | const std::string & | n_ | ) |
void bitpit::FileHandler::setParallel | ( | bool | p_ | ) |
sets if file belongs to a parallel output
[in] | p_ | [true/false] if parallel |
Definition at line 228 of file fileHandler.cpp.
void bitpit::FileHandler::setSeries | ( | bool | s_ | ) |
sets if file belongs to a time series
[in] | s_ | [true/false] if series |
Definition at line 180 of file fileHandler.cpp.
|
static |
dummy counter associate with files that doesn't belong to a time series
Definition at line 61 of file fileHandler.hpp.