Entropy Piano Tuner
1.1.3 (documentation not yet complete)
An open-source experimental software for piano tuning by entropy minimization
|
Abstract singleton adapter for opening files. More...
#include <filemanager.h>
Public Member Functions | |
FileManager () | |
Constructor, setting the singleton pointer to its own instance. More... | |
virtual | ~FileManager () |
Virtual destructor. More... | |
virtual bool | open (std::ifstream &stream, const std::string &absolute, std::ios_base::openmode mode=std::ios_base::in) |
Open an input stream. More... | |
virtual bool | open (std::ofstream &stream, const std::string &absolute, std::ios_base::openmode mode=std::ios_base::out) |
Open an output file stream. More... | |
virtual std::string | getLogFilePath (const std::string &logname) const =0 |
Abstract function: Get the standard path for logfiles. More... | |
virtual std::string | getAlgorithmInformationFileContent (const std::string &algorithmId) const =0 |
Abstract function: Get the file content for an algorithm. More... | |
Static Public Member Functions | |
static FileManager & | getSingleton () |
FileManager::getSingleton: Get a reference to the singleton. More... | |
Static Private Attributes | |
static std::unique_ptr < FileManager > | mSingleton |
Singleton unique pointer. More... | |
Abstract singleton adapter for opening files.
This adapter provides an interface for opening files. The tuner produces various files (e.g. log files) which have to be saved at certain standard locations, depending on the platform of the implementation. For example, Windows and Android applications provide different standard locations for writing and reading files. These differences are accounted for in the derived implemenations.
The FileManager is a singleton class, i.e., there is only a single instance.
Definition at line 43 of file filemanager.h.
|
inline |
Constructor, setting the singleton pointer to its own instance.
Definition at line 47 of file filemanager.h.
|
inlinevirtual |
Virtual destructor.
Definition at line 48 of file filemanager.h.
|
pure virtual |
Abstract function: Get the file content for an algorithm.
In the EPT each tuning algorithm comes with its own xml file. This function opens the xml file and returns its content in form of a single string. The only parameter is the ID of the algorithm. This function has to be implemented in the derived class.
algorithID | : Identification string of the algorithm |
Implemented in FileManagerForQt.
|
pure virtual |
Abstract function: Get the standard path for logfiles.
Each platform provides a different standard directory for logfile. This abstract function has to be overridden accordingly in the respective implementation. The tuner software allows for different logs labelled by certain names passed here as an argument.
logname | : The name of the log |
Implemented in FileManagerForQt.
|
static |
FileManager::getSingleton: Get a reference to the singleton.
Definition at line 47 of file filemanager.cpp.
|
virtual |
Open an input stream.
This function opens an input stream. If the stream can be opened successfully an information message is sent. If it cannot be opened a warning is displayed. The function may be overwritten in the implementation.
stream | : Reference to standard C11 stream |
absolute | : Absolute path and file name |
mode | : Standard C11 reading mode |
Definition at line 71 of file filemanager.cpp.
|
virtual |
Open an output file stream.
This function opens an output stream. If the stream can be opened successfully an information message is sent. If it cannot be opened a warning is displayed. The function may be overwritten in the implementation.
Reference | to the C11 standard output stream. |
Absolute | path and filename. |
Standard | C11 output mode. |
Definition at line 106 of file filemanager.cpp.
|
staticprivate |
Singleton unique pointer.
Singleton pointer.
The FileManager is a singleton class, meaning that it admits only a single instance. The unique pointer mSingleton points to this instance.
Definition at line 90 of file filemanager.h.