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 |
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().
- directory set via SetDirectory( const std::string &)
- name set via SetName(const std::string &)
- bxxxx is added if SetParallel(true) and SetBlock(xxxx) have been called
- yyyy is added if SetSeries(true) and SetCounter(yyyy) have been called. yyyy is incremented by one if IncrementCounter() is called.
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] other FileHandler 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 |
◆ 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_ | ) |
◆ 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_ | ) |
◆ 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
|
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:
- src/common/fileHandler.hpp
- src/common/fileHandler.cpp
