23 #ifndef ICL_CORE_CONFIG_MEMBER_VALUE_H_INCLUDED 24 #define ICL_CORE_CONFIG_MEMBER_VALUE_H_INCLUDED 34 #include <boost/function.hpp> 35 #include <boost/lambda/bind.hpp> 37 #define MEMBER_VALUE_1(suffix, cls, member1) \ 38 (new icl_core::config::MemberValue< \ 39 icl_core::RemoveMemberPointer<ICL_CORE_CONFIG_TYPEOF(&cls::member1)>::Type, cls>( \ 41 boost::lambda::bind(&cls::member1, boost::lambda::_1))) 43 #define MEMBER_VALUE_2(suffix, cls, member1, member2) \ 44 (new icl_core::config::MemberValue< \ 45 icl_core::RemoveMemberPointer<ICL_CORE_CONFIG_TYPEOF( \ 46 &icl_core::RemoveMemberPointer<ICL_CORE_CONFIG_TYPEOF( \ 47 &cls::member1)>::Type::member2)>::Type, cls>( \ 49 boost::lambda::bind( \ 50 &icl_core::RemoveMemberPointer<ICL_CORE_CONFIG_TYPEOF(&cls::member1)>::Type::member2, \ 51 boost::lambda::bind(&cls::member1, boost::lambda::_1)))) 53 #define MEMBER_VALUE_3(suffix, cls, member1, member2, member3) \ 54 (new icl_core::config::MemberValue< \ 55 icl_core::RemoveMemberPointer<ICL_CORE_CONFIG_TYPEOF( \ 56 &icl_core::RemoveMemberPointer<ICL_CORE_CONFIG_TYPEOF( \ 57 &icl_core::RemoveMemberPointer<ICL_CORE_CONFIG_TYPEOF( \ 58 &cls::member1)>::Type::member2)>::Type::member3)>::Type, cls>( \ 60 boost::lambda::bind( \ 61 &icl_core::RemoveMemberPointer<ICL_CORE_CONFIG_TYPEOF( \ 62 &icl_core::RemoveMemberPointer<ICL_CORE_CONFIG_TYPEOF( \ 63 &cls::member1)>::Type::member2)>::Type::member3, \ 64 boost::lambda::bind( \ 65 &icl_core::RemoveMemberPointer<ICL_CORE_CONFIG_TYPEOF(&cls::member1)>::Type::member2, \ 66 boost::lambda::bind(&cls::member1, boost::lambda::_1))))) 71 template<
typename T,
typename Q>
76 boost::function<T&(Q&)> accessor)
83 virtual bool get(std::string
const & key,
121 boost::function<
bool&(Q&)> accessor)
128 virtual bool get(std::string
const & key,
Helper definitions for template programming.
MemberValue(std::string const &config_suffix, boost::function< T &(Q &)> accessor)
static ConfigManager & instance()
virtual std::string getSuffix() const
boost::function< bool &(Q &)> m_accessor
virtual std::string getStringValue() const
virtual std::string getSuffix() const
virtual std::string getStringValue() const
MemberValue(std::string const &config_suffix, boost::function< bool &(Q &)> accessor)
bool strict_bool_cast(U input)
std::string m_config_suffix
boost::function< T &(Q &)> m_accessor
bool get(const String &key, typename ConvertToRef< T >::ToRef value) const
Utility functions for the configuration framework.
std::string m_config_suffix