creaImageIOSettings.h

Go to the documentation of this file.
00001 #include <boost/program_options.hpp>
00002 #include <map>
00003 
00004 #define SETTINGS_DICOM_LIBRARY                  "<DICOM Library>"
00005 #define SETTINGS_SYNC_EVENT                             "<syncro_event>"
00006 #define SETTINGS_SYNC_FREQ                              "<syncro_frequency>"
00007 #define SETTINGS_DBPATH                                 "<dbpath>"
00008 #define SETTINGS_COPY_PATH                              "<copy_path>"
00009 #define SETTINGS_REMOVE_PATIENT_DISPLAY "<remove_patient>"
00010 #define SETTINGS_OUTPUT_ASK                             "<output_ask>"
00011 #define SETTINGS_OUTPUT_DIM                             "<output_dim>"
00012 
00013 
00014 namespace creaImageIO
00015 {
00016     class Settings{
00017     public :
00018         Settings(const std::string i_path);
00019         ~Settings();
00020 
00021         //get the value for a given option
00022                 const std::string getValue(const std::string i_key){return m_SettingsMap[i_key];}
00023         
00024                 void addDB(const std::string &i_path);
00025 
00026                 void removeDB(const std::string &i_path);
00027 
00028                 void updateSetting(const std::string& key, const std::string &val);
00029         
00030                 //write configuration file
00031                 void writeSettingsFile();
00032                 
00033     private :
00034                 // Settings Key-Value Map
00035                 std::map<std::string, std::string> m_SettingsMap;
00036                 
00037                 //read the configuration file
00038                 void readSettings(std::vector<std::string> &i_Keys, const std::string &i_file);
00039         // create the configuration file
00040         void createFile();
00041                 void writeSettings(std::ofstream &o_filebuf);
00042                 std::string m_SettingsFileName;
00043                 
00044                 
00045     };
00046 }