AnimalsFactory.h
Go to the documentation of this file.
1 #ifndef __ANIMALSFACTORY_H
2 #define __ANIMALSFACTORY_H
3 
5 
6 #include <string>
7 
8 class Animal;
9 
10 class AnimalFactory : public te::common::AbstractFactory<Animal, std::string>
11 {
12  public:
13 
14  /* Note: destructor must be public! */
15  virtual ~AnimalFactory() {}
16 
17  protected:
18 
19  /* Note: constructor must be protected! */
20  AnimalFactory(const std::string& factoryKey);
21 };
22 
24 {
25  public:
26 
27  /* Note: destructor must be public! */
29 
30  /* Note: create a static member to initialize the factory in some place of your application! */
31  static void initialize();
32 
33  /* Note: create a static member to finalize the factory in some place of your application! */
34  static void finalize();
35 
36  protected:
37 
38  /* Note: constructor must be protected! */
40 
41  /* Note: This is the mandatory method for all subclasses of AnimalFactory! */
42  Animal* build();
43 
44  private:
45 
46  /* try to keep a singleton concrete factory for KillerWhale object */
48 };
49 
51 {
52  public:
53 
54  /* Note: destructor must be public! */
56 
57  /* Note: create a static member to initialize the factory in some place of your application! */
58  static void initialize();
59 
60  /* Note: create a static member to finalize the factory in some place of your application! */
61  static void finalize();
62 
63  protected:
64 
65  /* Note: constructor must be protected! */
67 
68  /* Note: This is the mandatory method for all subclasses of AnimalFactory! */
69  Animal* build();
70 
71  private:
72 
73  /* try to keep a singleton concrete factory for Platypus object */
75 };
76 
78 {
79  public:
80 
81  /* Note: destructor must be public! */
83 
84  /* Note: create a static member to initialize the factory in some place of your application! */
85  static void initialize();
86 
87  /* Note: create a static member to finalize the factory in some place of your application! */
88  static void finalize();
89 
90  protected:
91 
92  /* Note: constructor must be protected! */
94 
95  /* Note: This is the mandatory method for all subclasses of AnimalFactory! */
96  Animal* build();
97 
98  private:
99 
100  /* try to keep a singleton concrete factory for Myrmecophagidae object */
102 };
103 
104 #endif // __ANIMALSFACTORY_H
105 
This class defines the interface of abstract factories without initializing parameters.
static MyrmecophagidaeFactory * sm_factory
static PlatypusFactory * sm_factory
AnimalFactory(const std::string &factoryKey)
A class that defines the interface of an abstract factory.
Definition: Animals.h:6
static KillerWhaleFactory * sm_factory
virtual ~AnimalFactory()
virtual Animal * build()=0
Concrete factories (derived from this one) must implement this method in order to create objects...