14 #ifndef LLVM_SUPPORT_REGISTRY_H
15 #define LLVM_SUPPORT_REGISTRY_H
24 const char *Name, *Desc;
29 : Name(N), Desc(D), Ctor(
C)
32 const char *
getName()
const {
return Name; }
33 const char *
getDesc()
const {
return Desc; }
57 template <
typename T,
typename U = RegistryTraits<T> >
61 typedef typename U::entry
entry;
70 static
void Announce(const
entry &E) {
71 for (
listener *Cur = ListenerHead; Cur; Cur = Cur->Next)
76 static node *Head, *Tail;
79 static listener *ListenerHead, *ListenerTail;
193 template <
typename V>
198 static T *CtorFn() {
return new V(); }
202 : Entry(Name, Desc, CtorFn), Node(Entry) {}
212 template <
typename T,
typename U>
213 typename Registry<T,U>::node *Registry<T,U>::Head;
215 template <
typename T,
typename U>
216 typename Registry<T,U>::node *Registry<T,U>::Tail;
218 template <
typename T,
typename U>
219 typename Registry<T,U>::listener *Registry<T,U>::ListenerHead;
221 template <
typename T,
typename U>
222 typename Registry<T,U>::listener *Registry<T,U>::ListenerTail;
const entry & operator*() const
virtual void registered(const entry &)=0
SimpleRegistryEntry< T > entry
Add(const char *Name, const char *Desc)
const char * getName() const
bool operator!=(const iterator &That) const
const char * getDesc() const
bool operator==(const iterator &That) const
static const char * nameof(const entry &Entry)
nameof/descof - Accessors for name and description of entries. These are
#define LLVM_DELETED_FUNCTION
const entry * operator->() const
friend void Registry::Announce(const entry &E)
SimpleRegistryEntry(const char *N, const char *D, T *(*C)())
static const char * descof(const entry &Entry)