diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:10:11 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:10:11 +0200 |
commit | c0cdb2ad99a1e2a6ade5ce76c91177a79258e669 (patch) | |
tree | 4701a015385d9a6a5a4ba99a8f1f5d400fff26b1 /shared/loki/Register.h | |
parent | 3.13 (diff) | |
download | FreeFileSync-c0cdb2ad99a1e2a6ade5ce76c91177a79258e669.tar.gz FreeFileSync-c0cdb2ad99a1e2a6ade5ce76c91177a79258e669.tar.bz2 FreeFileSync-c0cdb2ad99a1e2a6ade5ce76c91177a79258e669.zip |
3.14
Diffstat (limited to 'shared/loki/Register.h')
-rw-r--r-- | shared/loki/Register.h | 170 |
1 files changed, 85 insertions, 85 deletions
diff --git a/shared/loki/Register.h b/shared/loki/Register.h index 0ad014ab..0edf4a37 100644 --- a/shared/loki/Register.h +++ b/shared/loki/Register.h @@ -1,12 +1,12 @@ //////////////////////////////////////////////////////////////////////////////// // The Loki Library // Copyright (c) 2006 Peter Kümmel -// Permission to use, copy, modify, distribute and sell this software for any -// purpose is hereby granted without fee, provided that the above copyright -// notice appear in all copies and that both that copyright notice and this +// Permission to use, copy, modify, distribute and sell this software for any +// purpose is hereby granted without fee, provided that the above copyright +// notice appear in all copies and that both that copyright notice and this // permission notice appear in supporting documentation. -// The author makes no representations about the -// suitability of this software for any purpose. It is provided "as is" +// The author makes no representations about the +// suitability of this software for any purpose. It is provided "as is" // without express or implied warranty. //////////////////////////////////////////////////////////////////////////////// #ifndef LOKI_REGISTER_INC_ @@ -18,98 +18,98 @@ #include "TypeManip.h" #include "HierarchyGenerators.h" -/// \defgroup RegisterGroup Register +/// \defgroup RegisterGroup Register namespace Loki { - //////////////////////////////////////////////////////////////////////////////// - // - // Helper classes/functions for RegisterByCreateSet - // - //////////////////////////////////////////////////////////////////////////////// - - //////////////////////////////////////////////////////////////////////////////// - /// \ingroup RegisterGroup - /// Must be specialized be the user - //////////////////////////////////////////////////////////////////////////////// - template<class t> bool RegisterFunction(); - - //////////////////////////////////////////////////////////////////////////////// - /// \ingroup RegisterGroup - /// Must be specialized be the user - //////////////////////////////////////////////////////////////////////////////// - template<class t> bool UnRegisterFunction(); - - namespace Private - { - template<class T> - struct RegisterOnCreate - { - RegisterOnCreate() { RegisterFunction<T>(); } - }; - - template<class T> - struct UnRegisterOnDelete - { - ~UnRegisterOnDelete() { UnRegisterFunction<T>(); } - }; - - template<class T> - struct RegisterOnCreateElement - { - RegisterOnCreate<T> registerObj; - }; - - template<class T> - struct UnRegisterOnDeleteElement - { - UnRegisterOnDelete<T> unregisterObj; - }; - } - - //////////////////////////////////////////////////////////////////////////////// - /// \class RegisterOnCreateSet - /// - /// \ingroup RegisterGroup - /// Implements a generic register class which registers classes of a typelist - /// - /// \par Usage - /// see test/Register - //////////////////////////////////////////////////////////////////////////////// - - template<typename ElementList> - struct RegisterOnCreateSet +//////////////////////////////////////////////////////////////////////////////// +// +// Helper classes/functions for RegisterByCreateSet +// +//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// \ingroup RegisterGroup +/// Must be specialized be the user +//////////////////////////////////////////////////////////////////////////////// +template<class t> bool RegisterFunction(); + +//////////////////////////////////////////////////////////////////////////////// +/// \ingroup RegisterGroup +/// Must be specialized be the user +//////////////////////////////////////////////////////////////////////////////// +template<class t> bool UnRegisterFunction(); + +namespace Private +{ +template<class T> +struct RegisterOnCreate +{ + RegisterOnCreate() { RegisterFunction<T>(); } +}; + +template<class T> +struct UnRegisterOnDelete +{ + ~UnRegisterOnDelete() { UnRegisterFunction<T>(); } +}; + +template<class T> +struct RegisterOnCreateElement +{ + RegisterOnCreate<T> registerObj; +}; + +template<class T> +struct UnRegisterOnDeleteElement +{ + UnRegisterOnDelete<T> unregisterObj; +}; +} + +//////////////////////////////////////////////////////////////////////////////// +/// \class RegisterOnCreateSet +/// +/// \ingroup RegisterGroup +/// Implements a generic register class which registers classes of a typelist +/// +/// \par Usage +/// see test/Register +//////////////////////////////////////////////////////////////////////////////// + +template<typename ElementList> +struct RegisterOnCreateSet : GenScatterHierarchy<ElementList, Private::RegisterOnCreateElement> {}; - //////////////////////////////////////////////////////////////////////////////// - /// \class UnRegisterOnDeleteSet - /// - /// \ingroup RegisterGroup - /// Implements a generic register class which unregisters classes of a typelist - /// - /// \par Usage - /// see test/Register - //////////////////////////////////////////////////////////////////////////////// - template<typename ElementList> - struct UnRegisterOnDeleteSet +//////////////////////////////////////////////////////////////////////////////// +/// \class UnRegisterOnDeleteSet +/// +/// \ingroup RegisterGroup +/// Implements a generic register class which unregisters classes of a typelist +/// +/// \par Usage +/// see test/Register +//////////////////////////////////////////////////////////////////////////////// +template<typename ElementList> +struct UnRegisterOnDeleteSet : GenScatterHierarchy<ElementList, Private::UnRegisterOnDeleteElement> {}; - //////////////////////////////////////////////////////////////////////////////// - /// \def LOKI_CHECK_CLASS_IN_LIST( CLASS , LIST ) - /// - /// \ingroup RegisterGroup - /// Check if CLASS is in the typelist LIST. - /// - /// \par Usage - /// see test/Register - //////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +/// \def LOKI_CHECK_CLASS_IN_LIST( CLASS , LIST ) +/// +/// \ingroup RegisterGroup +/// Check if CLASS is in the typelist LIST. +/// +/// \par Usage +/// see test/Register +//////////////////////////////////////////////////////////////////////////////// + - -#define LOKI_CONCATE(a,b,c,d) a ## b ## c ## d +#define LOKI_CONCATE(a,b,c,d) a ## b ## c ## d #define LOKI_CONCAT(a,b,c,d) LOKI_CONCATE(a,b,c,d) #define LOKI_CHECK_CLASS_IN_LIST( CLASS , LIST ) \ |