]> Creatis software - creaImageIO.git/blob - src2/creaImageIOSettings.h
44c6e8c79561385bd59552be3e98e18324205c2e
[creaImageIO.git] / src2 / 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
10
11 namespace creaImageIO
12 {
13     class Settings{
14     public :
15         Settings(const std::string i_path);
16         ~Settings();
17
18         //get the value for a given option
19                 const std::string getValue(const std::string i_key){return m_SettingsMap[i_key];}
20         
21                 void addDB(const std::string &i_path);
22
23                 void removeDB(const std::string &i_path);
24                 //write configuration file
25                 void writeSettingsFile();
26                 
27     private :
28                 // Settings Key-Value Map
29                 std::map<std::string, std::string> m_SettingsMap;
30                 
31                 //read the configuration file
32                 void readSettings(std::vector<std::string> &i_Keys, const std::string &i_file);
33         // create the configuration file
34         void createFile();
35                 void writeSettings(std::ofstream &o_filebuf);
36                 std::string m_SettingsFileName;
37                 
38                 
39     };
40 }