| 9 |
|
} |
| 10 |
|
} |
| 11 |
|
|
| 12 |
< |
static LatticeFactory::LatticeFactory* getInstance(){ |
| 12 |
> |
LatticeFactory* LatticeFactory::getInstance(){ |
| 13 |
|
if (instance == NULL) |
| 14 |
|
instance = new LatticeFactory(); |
| 15 |
|
|
| 16 |
|
return instance; |
| 17 |
|
} |
| 18 |
|
|
| 19 |
< |
bool LatticeFactory::registerCreator( const LatticeCreator* latCreator ){ |
| 20 |
< |
string latticeType = latCreator->GetType(); |
| 19 |
> |
bool LatticeFactory::registerCreator( BaseLatticeCreator* latCreator ){ |
| 20 |
> |
string latticeType = latCreator->getType(); |
| 21 |
|
map<string, BaseLatticeCreator*>::iterator mapIter; |
| 22 |
|
|
| 23 |
|
mapIter = creatorMap.find(latticeType); |
| 33 |
|
} |
| 34 |
|
} |
| 35 |
|
|
| 36 |
< |
BaseLattice* LatticeFactory::createLattice( const string& latticeType ){ |
| 37 |
< |
string latticeType = latCreator->GetType(); |
| 38 |
< |
map<string, BaseLatticeCreator*>::iterator mapIter; |
| 39 |
< |
BaseLatticeCreator* creator; |
| 36 |
> |
BaseLattice* LatticeFactory::createLattice( const string& latticeType ){ |
| 37 |
> |
map<string, BaseLatticeCreator*>::iterator mapIter; |
| 38 |
|
|
| 39 |
|
mapIter = creatorMap.find(latticeType); |
| 40 |
|
|
| 41 |
|
if (mapIter != creatorMap.end()) { |
| 42 |
< |
creator = mapIter->second; |
| 45 |
< |
return creator->createLattice(); |
| 42 |
> |
return (mapIter->second)->createLattice(); |
| 43 |
|
} |
| 44 |
|
else |
| 45 |
|
return NULL; |