Cantera
2.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
include
cantera
base
FactoryBase.h
Go to the documentation of this file.
1
/**
2
* @file FactoryBase.h
3
* File contains the FactoryBase class declarations.
4
*/
5
#ifndef CT_FACTORY_BASE
6
#define CT_FACTORY_BASE
7
8
#include <vector>
9
10
namespace
Cantera
11
{
12
13
//! Base class for factories.
14
/*! This class maintains a registry of
15
* all factories that derive from it, and deletes them all when
16
* its static method deleteFactories is invoked.
17
*/
18
class
FactoryBase
19
{
20
public
:
21
22
//! destructor
23
virtual
~FactoryBase
() {
24
}
25
26
//! static function that deletes all factories
27
//! in the internal registry maintained in a static variable
28
static
void
deleteFactories
() {
29
std::vector< FactoryBase* >::iterator iter ;
30
for
(iter =
s_vFactoryRegistry
.begin();
31
iter !=
s_vFactoryRegistry
.end();
32
++iter) {
33
(*iter)->deleteFactory() ;
34
}
35
s_vFactoryRegistry
.clear() ;
36
}
37
38
protected
:
39
40
//! Constructor.
41
/*!
42
* Adds the current object to the current static list
43
*/
44
FactoryBase
() {
45
s_vFactoryRegistry
.push_back(
this
) ;
46
}
47
48
//! Virtual abstract function that deletes the factory
49
/*!
50
* This must be properly defined in child objects.
51
*/
52
virtual
void
deleteFactory
() = 0 ;
53
54
private
:
55
56
//! statically held list of Factories.
57
static
std::vector<FactoryBase*>
s_vFactoryRegistry
;
58
};
59
}
60
61
#endif
62
Generated by
1.8.2