diff options
Diffstat (limited to 'src/factory.h')
| -rw-r--r-- | src/factory.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/factory.h b/src/factory.h index 495db5474..ca90a6e9a 100644 --- a/src/factory.h +++ b/src/factory.h @@ -1,9 +1,21 @@ -#pragma once +#ifndef FACTORY_H_SEEN +#define FACTORY_H_SEEN #include <exception> #include <map> #include <string> +/** + * A simple singleton implementation. + */ +template<class T> +struct Singleton { + static T& instance() { + static T inst; + return inst; + } +}; + namespace FactoryExceptions { class TypeNotRegistered : public std::exception { public: @@ -78,3 +90,6 @@ struct NodeTraits { return name; } }; + +#endif + |
