1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-04-09 21:50:45 +01:00

Namespace

This commit is contained in:
paboyle 2018-01-14 22:22:27 +00:00
parent 93f09818da
commit c978c88521

View File

@ -25,23 +25,23 @@ with this program; if not, write to the Free Software Foundation, Inc.,
See the full license in the file "LICENSE" in the top level distribution See the full license in the file "LICENSE" in the top level distribution
directory directory
*************************************************************************************/ *************************************************************************************/
/* END LEGAL */ /* END LEGAL */
#ifndef HMC_MODULES_H #ifndef HMC_MODULES_H
#define HMC_MODULES_H #define HMC_MODULES_H
/* /*
Define loadable, serializable modules Define loadable, serializable modules
for the HMC execution for the HMC execution
*/ */
namespace Grid { NAMESPACE_BEGIN(Grid);
// Empty class for no parameters // Empty class for no parameters
class NoParameters{}; class NoParameters{};
/* /*
Base class for modules with parameters Base class for modules with parameters
*/ */
template < class P > template < class P >
class Parametrized{ class Parametrized{
@ -56,7 +56,7 @@ public:
} }
void set_parameters(Parameters Par){ void set_parameters(Parameters Par){
Par_ = Par; Par_ = Par;
} }
void print_parameters(){ void print_parameters(){
@ -72,7 +72,7 @@ private:
template <> template <>
class Parametrized<NoParameters>{ class Parametrized<NoParameters>{
public: public:
typedef NoParameters Parameters; typedef NoParameters Parameters;
Parametrized(Parameters Par){}; Parametrized(Parameters Par){};
@ -93,7 +93,7 @@ class Parametrized<NoParameters>{
//////////////////////////////////////// ////////////////////////////////////////
template <class Prod> template <class Prod>
class HMCModuleBase { class HMCModuleBase {
public: public:
typedef Prod Product; typedef Prod Product;
virtual Prod* getPtr() = 0; virtual Prod* getPtr() = 0;
@ -110,21 +110,18 @@ class HMCModuleBase {
template <class T, class TheFactory> template <class T, class TheFactory>
class Registrar { class Registrar {
public: public:
Registrar(std::string className) { Registrar(std::string className) {
// register the class factory function // register the class factory function
TheFactory::getInstance().registerBuilder(className, TheFactory::getInstance().registerBuilder(className,
[&](typename TheFactory::TheReader Reader) [&](typename TheFactory::TheReader Reader)
{ {
return std::unique_ptr<T>(new T(Reader)); return std::unique_ptr<T>(new T(Reader));
} }
); );
} }
}; };
NAMESPACE_END(Grid);
#endif //HMC_MODULES_H
}
#endif //HMC_MODULES_H