1 #ifndef PhysicsTools_Utilities_Variables_h 2 #define PhysicsTools_Utilities_Variables_h 6 #define DEFINE_VARIABLE_T(T, X, NAME) \ 11 X(const T& x) { set(x); } \ 12 inline operator T() const { return value; } \ 13 inline T operator()() const { return value; } \ 14 inline static const char* name() { static const char * name = NAME; return name; } \ 15 inline X operator=(const T& x) { set(x); return *this; } \ 16 inline static void set(const T& x) { value = x; } \ 23 inline std::ostream& operator<<(std::ostream& cout, const funct::X &) \ 24 { return cout << funct::X::name(); } \ 28 struct __useless_ignoreme 30 #define IMPLEMENT_VARIABLE_T(T, X) \ 35 struct __useless_ignoreme \ 37 #define DEFINE_VARIABLE(X, NAME) \ 38 DEFINE_VARIABLE_T(double, X, NAME) 40 #define IMPLEMENT_VARIABLE(X) \ 41 IMPLEMENT_VARIABLE_T(double, X) 43 #define DEFINE_INT_VARIABLE(X, NAME) \ 44 DEFINE_VARIABLE_T(int, X, NAME) 46 #define IMPLEMENT_INT_VARIABLE(X) \ 47 IMPLEMENT_VARIABLE_T(int, X)
#define DEFINE_VARIABLE(X, NAME)