*/
int l7vs::Parameter::get_int( const l7vs::PARAMETER_COMPONENT_TAG comp,
const std::string& key,
- l7vs::parameter::error_code& err ){
+ l7vs::error_code& err ){
ParameterImpl& impl = ParameterImpl::get_instance();
return impl.get_int( comp, key, err );
}
*/
std::string l7vs::Parameter::get_string( const l7vs::PARAMETER_COMPONENT_TAG comp,
const std::string& key,
- l7vs::parameter::error_code& err ){
+ l7vs::error_code& err ){
ParameterImpl& impl = ParameterImpl::get_instance();
return impl.get_string( comp, key, err );
}
#include <string>
#include "parameter_enum.h"
+#include "error_code.h"
namespace l7vs{
//! @param[in] parameter key
//! @param[out] error code
//! @return intvalue
- int get_int(const PARAMETER_COMPONENT_TAG, const std::string&, parameter::error_code& );
+ int get_int(const PARAMETER_COMPONENT_TAG, const std::string&, error_code& );
//! parameter string value getter
//! @param[in] parametercategory
//! @param[in] parameter key
//! @param[out] error code
//! @return string value
- std::string get_string(const PARAMETER_COMPONENT_TAG, const std::string&, parameter::error_code& );
+ std::string get_string(const PARAMETER_COMPONENT_TAG, const std::string&, error_code& );
};
} //namespace l7vs
namespace l7vs{
-namespace parameter{
-
-//! @class error_code
-//! @brief getValue error
-//! @brief this class is POD
-class error_code{
-protected:
- bool flag; //!< errorcode_flag
-public:
- error_code() : flag(false){} //!< constractor
- bool operator==( const bool in )const { return ( flag == in ); } //!< operator== orverload
- bool operator!=( const bool in )const { return ( flag != in ); } //!< operator!= orverload
- bool operator!() const { return !flag; } //!< operator! orverload
- typedef void (*unspecified_bool_type)(); //!< if return function
- static void unspecified_bool_true() {} //!< if true orverload function
- operator unspecified_bool_type() const { return flag == 0 ? 0 : unspecified_bool_true; } //!< if() orverload
- void set_flag( bool in ){ flag = in; } //!< flag setter
-};
-} //namespace parameter
-
//! @enum PARAMTER_COMPONENT_TAG
//! @brief parameter key tags
enum PARAMETER_COMPONENT_TAG {
//! @return integer value
int l7vs::ParameterImpl::get_int( const l7vs::PARAMETER_COMPONENT_TAG comp,
const std::string& key,
- l7vs::parameter::error_code& err ){
+ l7vs::error_code& err ){
boost::mutex::scoped_lock lock( param_mutex );
std::map< PARAMETER_COMPONENT_TAG, std::string >::iterator section_table_iterator = tag_section_table_map.find( comp );
int_map_type::iterator intmap_iterator = intMap.find( section_table_iterator->second + "." + key );
if( intmap_iterator != intMap.end() )
return intmap_iterator->second;
else
- err.set_flag( true );
+ err.setter( true, "don't find key" );
return 0;
}
std::string l7vs::ParameterImpl::get_string( const l7vs::PARAMETER_COMPONENT_TAG comp,
const std::string& key,
- l7vs::parameter::error_code& err ){
+ l7vs::error_code& err ){
boost::mutex::scoped_lock lock( param_mutex );
std::map< PARAMETER_COMPONENT_TAG, std::string >::iterator section_table_iterator = tag_section_table_map.find( comp );
string_map_type::iterator strmap_iterator = stringMap.find( section_table_iterator->second + "." + key );
if( strmap_iterator != stringMap.end() )
return strmap_iterator->second;
else
- err.set_flag( true );
+ err.setter( true, "don't find key" );
return std::string("");
}
#define PARAMETER_IMPL_H
#include "parameter_enum.h"
+#include "error_code.h"
#include <string>
#include <map>
#include <boost/function.hpp>
//! @param[in] keystring
//! @param[out] errorcode
//! @return int value
- int get_int( const PARAMETER_COMPONENT_TAG, const std::string&, parameter::error_code& );
+ int get_int( const PARAMETER_COMPONENT_TAG, const std::string&, error_code& );
//! string value getter
//! @param[in] component tag
//! @param[in] keystring
//! @param[out] errorcode
//! @return string value
- std::string get_string( const PARAMETER_COMPONENT_TAG, const std::string&, parameter::error_code& );
+ std::string get_string( const PARAMETER_COMPONENT_TAG, const std::string&, error_code& );
};
}