Template Class Registry#
Defined in File plugin.h
Nested Relationships#
Nested Types#
Class Documentation#
-
template<typename T, typename U = RegistryTraits<T>>
class Registry# A global registry used in conjunction with static constructors to make pluggable components (like targets or garbage collectors) “just work” when linked with an executable.
Public Static Functions
-
static inline iterator_range<iterator> entries()#
-
template<typename V>
class Add# A static registration template. Use like such:
X(“fancy-gc”, “Newfangled garbage collector.”);
Use of this template requires that:
The registered subclass has a default constructor.
The registry entry type has a constructor compatible with this signature:
entry(const char *Name, const char *ShortDesc, T *(*Ctor)());
If you have more elaborate requirements, then copy and modify.
Public Functions
-
inline Add(const char *Name, const char *Desc)#
-
class iterator#
Iterators for registry entries.
-
class listener#
Abstract base class for registry listeners, which are informed when new entries are added to the registry. Simply subclass and instantiate:
class CollectorPrinter : public Registry<Collector>::listener { protected: void registered(const Registry<Collector>::entry &e) { cerr << "collector now available: " << e->getName() << "\n"; } public: CollectorPrinter() { init(); } // Print those already registered. }; CollectorPrinter Printer;
-
class node#
Node in linked list of entries.
-
static inline iterator_range<iterator> entries()#