Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-02 08:43:50

0001 #ifndef PROPERTIES_MANAGER_H
0002 #define PROPERTIES_MANAGER_H
0003 
0004 /**
0005  * @file PropertiesManager.h
0006  * @author Bryan BERTHOU (SPhN / CEA Saclay)
0007  * @date April 21, 2015
0008  * @version 1.0
0009  */
0010 
0011 #include <string>
0012 
0013 #include "parser/IniFileParser.h"
0014 
0015 namespace sf {
0016 class Mutex;
0017 } /* namespace sf */
0018 
0019 namespace ElemUtils {
0020 
0021 /**
0022  * @class PropertiesManager
0023  * @brief \<singleton\> Handles properties from configuration file.
0024  */
0025 class PropertiesManager {
0026 public:
0027 
0028     /**
0029      * A static function that provides a unique pointer of this class
0030      *
0031      * @return A unique pointer of this class
0032      */
0033     static PropertiesManager* getInstance();
0034 
0035     /**
0036      * Default destructor
0037      */
0038     virtual ~PropertiesManager();
0039 
0040     void init(const std::string &iniFilePath);
0041 
0042     std::string getString(const std::string & section, const std::string & key);
0043     std::string getString(const std::string & key);
0044 
0045     bool checkIfAvailable(const std::string & section,
0046             const std::string & key) const;
0047     bool checkIfAvailable(const std::string & key) const;
0048 
0049     std::string getPropertiesFilePath() const;
0050 
0051 private:
0052     static sf::Mutex m_mutex;
0053 
0054     static PropertiesManager* pInstance; ///< Private pointer of this class for a unique instance
0055 
0056     /**
0057      * Private default constructor for a unique instance of this class
0058      */
0059     PropertiesManager();
0060 
0061     IniFileParser m_iniFileParser;
0062 };
0063 
0064 } // namespace ElemUtils
0065 
0066 #endif /* PROPERTIES_MANAGER_H */