LoveBrains  1.0.0
factory_object.h
1 /*
2 ** factory_object.h for LoveBrains in /home/robin_f/Programming/Git/CPP/LoveBrains
3 **
4 ** Made by Guillaume ROBIN
5 ** Login <robin_f@epitech.eu>
6 **
7 ** Started on Wed Jul 22 13:55:29 2015 Guillaume ROBIN
8 ** Last update Fri Aug 21 14:45:37 2015 Guillaume ROBIN
9 */
10 
11 #ifndef FACTORY_OBJECT_H_
12 # define FACTORY_OBJECT_H_
13 
14 # include <map>
15 # include "Graphics/i_object.h"
16 
17 namespace Graphics
18 {
24  {
25  public:
29  FactoryObjects(void);
33  ~FactoryObjects(void);
34 
40  static void Register(std::string const& key, IObject* obj);
44  static void DeleteAll(void);
49  IObject *Create(std::string const& key) const;
56  bool Contains(std::string const& key) const;
57 
58  private:
59  static std::map<std::string, IObject *> _map;
60  };
61 }
62 
63 #endif /* !FACTORY_OBJECT_H_ */
bool Contains(std::string const &key) const
Search if an object is contained in the factory.
Definition: factory_object.cc:67
FactoryObjects(void)
Constructor.
Definition: factory_object.cc:27
Define the interface of an object.
Definition: i_object.h:24
Define a factory of objects that will fill the environment in term of the environment file...
Definition: factory_object.h:23
Contains all the class that define the graphic environment.
IObject * Create(std::string const &key) const
Create a new object of the given key.
Definition: factory_object.cc:57
static void Register(std::string const &key, IObject *obj)
Register a new object in the factory.
Definition: factory_object.cc:38
~FactoryObjects(void)
Destructor.
Definition: factory_object.cc:31
static void DeleteAll(void)
Delete all the objects that have been registered in the factory.
Definition: factory_object.cc:51