]> Creatis software - creaImageIO.git/blob - src/creaImageIOSettings.h
8d13d366ae8348143566079dab4073ec7ce0e687
[creaImageIO.git] / src / creaImageIOSettings.h
1 #include <boost/program_options.hpp>
2 #include <map>
3
4 #define SETTINGS_DICOM_LIBRARY                  "<DICOM Library>"
5 #define SETTINGS_SYNC_EVENT                             "<syncro_event>"
6 #define SETTINGS_SYNC_FREQ                              "<syncro_frequency>"
7 #define SETTINGS_DBPATH                                 "<dbpath>"
8 #define SETTINGS_COPY_PATH                              "<copy_path>"
9 #define SETTINGS_REMOVE_PATIENT_DISPLAY "<remove_patient>"
10
11
12 namespace creaImageIO
13 {
14     class Settings{
15     public :
16         Settings(const std::string i_path);
17         ~Settings();
18
19         //get the value for a given option
20                 const std::string getValue(const std::string i_key){return m_SettingsMap[i_key];}
21         
22                 void addDB(const std::string &i_path);
23
24                 void removeDB(const std::string &i_path);
25
26                 void updateSetting(const std::string& key, const std::string &val);
27         
28                 //write configuration file
29                 void writeSettingsFile();
30                 
31     private :
32                 // Settings Key-Value Map
33                 std::map<std::string, std::string> m_SettingsMap;
34                 
35                 //read the configuration file
36                 void readSettings(std::vector<std::string> &i_Keys, const std::string &i_file);
37         // create the configuration file
38         void createFile();
39                 void writeSettings(std::ofstream &o_filebuf);
40                 std::string m_SettingsFileName;
41                 
42                 
43     };
44 }