Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Patterns/Registry.hpp

    re4afb4 rb2d8d0  
    22 * Registry.hpp
    33 *
    4  *  Based on initial ActionRegistry code by Till Crueger.
     4 *  Based on Registry<Action> by Till Crueger.
    55 *
    66 *  The registry pattern is basically just a singleton map, wherein instantiations
     
    2121 * <h1> Registry Howto </h1>
    2222 *
    23  * The Registry is a class where instances of other classes are stored and be retrieved
    24  * by a string token when desired. For this purpose a Registry should always be a singleton
    25  * (i.e. use both this Registry and the Singleton pattern to declare a Registry class). It
    26  * basically is simply a singleton container of a map, where the pointers to the class
    27  * instances are stored by a string key and can be retrieved thereby.
     23 * The registry is a class where instances of other classes are stored and be retrieved
     24 * when desired. For this purpose a registry should always be a singleton (i.e. use both
     25 * this registry and the singleton pattern to declare a registry class). It basically
     26 * is simply a singleton container of a map, where the pointers to the class instances are
     27 * stored by a string key and can be retrieved thereby.
    2828 *
    29  * The available functions are as follows if your class instances to be stored in Registry
    30  * are of type 'foo':
     29 * The available functions are, if your class to be stored in registry is foo :
    3130 *
    3231 * - <code>foo* Registry<foo>::getByName()</code> : returns the instance of a specific
     
    5958  ~Registry();
    6059
    61   typedef typename std::map<const std::string,T*> instance_map;
    62   typedef typename std::map<const std::string,T*>::iterator                  iterator;
    63   typedef typename std::map<const std::string,T*>::const_iterator            const_iterator;
    64 
    65   T* getByName(const std::string name) const;
    66   bool isPresentByName(const std::string name) const;
     60  T* getByName(const std::string name);
     61  bool isPresentByName(const std::string name);
    6762  void registerInstance(T*);
    6863  void unregisterInstance(T*);
    69   void cleanup();
    7064
    71   iterator getBeginIter();
    72   const_iterator getBeginIter() const;
    73   iterator getEndIter();
    74   const_iterator getEndIter() const;
     65  typename std::map<const std::string,T*>::iterator getBeginIter();
     66  typename std::map<const std::string,T*>::const_iterator getBeginIter() const;
     67  typename std::map<const std::string,T*>::iterator getEndIter();
     68  typename std::map<const std::string,T*>::const_iterator getEndIter() const;
    7569
    7670private:
    77   instance_map InstanceMap;
     71  typename std::map<const std::string,T*> InstanceMap;
    7872};
    7973
Note: See TracChangeset for help on using the changeset viewer.