| 1 | 
gezelter | 
1447 | 
#ifndef _LATTICECREATOR_H_ | 
| 2 | 
  | 
  | 
#define _LATTICECREATOR_H_ | 
| 3 | 
  | 
  | 
#include <string> | 
| 4 | 
  | 
  | 
#include "BaseLattice.hpp" | 
| 5 | 
  | 
  | 
 | 
| 6 | 
  | 
  | 
using namespace std; | 
| 7 | 
  | 
  | 
 | 
| 8 | 
  | 
  | 
class BaseLatticeCreator{ | 
| 9 | 
  | 
  | 
  public: | 
| 10 | 
  | 
  | 
    virtual BaseLattice* createLattice() = 0; | 
| 11 | 
  | 
  | 
    const string& getType() {return latticeType;} | 
| 12 | 
  | 
  | 
     | 
| 13 | 
  | 
  | 
  protected: | 
| 14 | 
  | 
  | 
    BaseLatticeCreator(const string& latType); | 
| 15 | 
  | 
  | 
  private: | 
| 16 | 
  | 
  | 
    string latticeType; | 
| 17 | 
  | 
  | 
}; | 
| 18 | 
  | 
  | 
 | 
| 19 | 
  | 
  | 
template<class LatticeClass> | 
| 20 | 
  | 
  | 
class LatticeCreator : public BaseLatticeCreator | 
| 21 | 
  | 
  | 
{ | 
| 22 | 
  | 
  | 
public: | 
| 23 | 
  | 
  | 
        LatticeCreator(const string& latticeType): BaseLatticeCreator(latticeType) {} | 
| 24 | 
  | 
  | 
        virtual BaseLattice* createLattice()  { return new LatticeClass();} | 
| 25 | 
  | 
  | 
}; | 
| 26 | 
  | 
  | 
 | 
| 27 | 
  | 
  | 
#endif |