1 #ifndef __PARAMETER_IMPL_H__
2 #define __PARAMETER_IMPL_H__
4 #include "parameter_enum.h"
8 #include <boost/program_options.hpp>
9 #include "error_code.h"
10 #include "logger_enum.h"
12 #include <boost/function.hpp>
13 #include <boost/noncopyable.hpp>
14 #include <boost/thread.hpp>
22 component(){ section = ""; function = NULL;}
23 component( std::string str, void (*p_func)() ){ section = str; function = p_func;}
24 component& operator=(const component& in_comp){ section = in_comp.section; function = in_comp.function;return *this;}
29 typedef std::map< std::string, int > int_map_type;
30 typedef std::map< std::string, std::string > string_map_type;
31 typedef std::multimap< std::string, std::string > multistring_map_type;
33 //! parameter data of string
34 string_map_type stringMap;
35 //! parameter data of multi string
36 multistring_map_type multistringMap;
37 //! parameter data of int
40 boost::mutex create_mutex;
41 //! read / write mutex
42 boost::mutex param_mutex;
43 //! componenttag to section name map
44 std::map< PARAMETER_COMPONENT_TAG, std::string >
45 tag_section_table_map;
53 static ParameterImpl & get_instance(){
54 static ParameterImpl instance;
58 //! @return true success
59 //! @return false failer
62 //! target component read
63 //! @param[in] component tag
64 //! @return false failer
65 //! @return true success
66 bool read_file( const PARAMETER_COMPONENT_TAG );
68 //! target component read specified filename
69 //! @param[in] component tag
70 //! @param[in] file name
71 //! @return false failer
72 //! @return true success
73 bool read_specified_file( const PARAMETER_COMPONENT_TAG, const std::string& filenamez );
76 //! @param[in] component tag
77 //! @param[in] keystring
78 //! @param[out] errorcode
80 int get_int( const PARAMETER_COMPONENT_TAG, const std::string&, error_code& );
82 //! string value getter
83 //! @param[in] component tag
84 //! @param[in] keystring
85 //! @param[out] errorcode
86 //! @return string value
87 std::string get_string( const PARAMETER_COMPONENT_TAG, const std::string&, error_code& );
89 //! multistring value getter
90 //! @param[in] component tag
91 //! @param[in] keystring
92 //! @param[inout] multistring map
93 //! @param[out] errorcode
94 //! @return last foundstring value
95 std::string get_multistring( const PARAMETER_COMPONENT_TAG, const std::string&, multistring_map_type&, error_code& );
97 void setIntValue(const PARAMETER_COMPONENT_TAG comp, const std::string& key, const int value);
99 void setStringValue(const PARAMETER_COMPONENT_TAG comp, const std::string& key, const std::string& value);
101 void deleteIntValue(const PARAMETER_COMPONENT_TAG comp, const std::string& key);
102 void deleteStringValue(const PARAMETER_COMPONENT_TAG comp, const std::string& key);
107 #endif //__PARAMETER_IMPL_H__