55 lines
1.4 KiB
C++
55 lines
1.4 KiB
C++
#ifndef E6D074E1_FEDB_4EFB_902B_95FF6BD2EB09
|
|
#define E6D074E1_FEDB_4EFB_902B_95FF6BD2EB09
|
|
/*
|
|
*******************************************************************************
|
|
* INCLUDE
|
|
*******************************************************************************
|
|
*/
|
|
#include "Configuration.h"
|
|
#include <unordered_set>
|
|
|
|
/*
|
|
*******************************************************************************
|
|
* MACROS
|
|
*******************************************************************************
|
|
*/
|
|
#define CONFIGURABLE_DECLARE_PARAMETER(name, type) \
|
|
type get##name() \
|
|
{ \
|
|
return config().getParameter<type>(#name); \
|
|
} \
|
|
void set##name(const type value) \
|
|
{ \
|
|
config().setParameter(#name, value); \
|
|
} \
|
|
const std::string _##name = (#name);
|
|
|
|
namespace Util
|
|
{
|
|
/*
|
|
*******************************************************************************
|
|
* CLASS DECLARE
|
|
*******************************************************************************
|
|
*/
|
|
class Configurable
|
|
{
|
|
public:
|
|
using ParameterNames = Configuration::ParameterNames;
|
|
|
|
public:
|
|
void commit();
|
|
Configuration& config();
|
|
|
|
protected:
|
|
virtual void onConfigChanged(ParameterNames& names) = 0;
|
|
|
|
private:
|
|
Configuration _config;
|
|
};
|
|
|
|
inline Configuration& Configurable::config()
|
|
{
|
|
return _config;
|
|
}
|
|
}
|
|
#endif
|