| 1 | 
< | 
 /* | 
| 1 | 
> | 
/* | 
| 2 | 
  | 
 * Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. | 
| 3 | 
  | 
 * | 
| 4 | 
  | 
 * The University of Notre Dame grants you ("Licensee") a | 
| 39 | 
  | 
 * such damages. | 
| 40 | 
  | 
 */ | 
| 41 | 
  | 
  | 
| 42 | 
< | 
#ifndef LATTICE_LATTICECREATOR_HPP | 
| 42 | 
> | 
#ifndef LATTICE_LATTICECREATOR_HPP  | 
| 43 | 
  | 
#define LATTICE_LATTICECREATOR_HPP | 
| 44 | 
+ | 
 | 
| 45 | 
  | 
#include <string> | 
| 45 | 
– | 
#include "lattice/BaseLattice.hpp" | 
| 46 | 
  | 
 | 
| 47 | 
– | 
 | 
| 47 | 
  | 
namespace oopse { | 
| 48 | 
  | 
 | 
| 49 | 
< | 
class BaseLatticeCreator{ | 
| 49 | 
> | 
  class Lattice; | 
| 50 | 
> | 
 | 
| 51 | 
> | 
  /** | 
| 52 | 
> | 
   * @class Lattice | 
| 53 | 
> | 
   * @todo document | 
| 54 | 
> | 
   */ | 
| 55 | 
> | 
  class LatticeCreator { | 
| 56 | 
  | 
  public: | 
| 57 | 
< | 
    virtual BaseLattice* createLattice() = 0; | 
| 58 | 
< | 
    const std::string& getType() {return latticeType;} | 
| 59 | 
< | 
     | 
| 60 | 
< | 
  protected: | 
| 61 | 
< | 
    BaseLatticeCreator(const std::string& latType); | 
| 57 | 
> | 
    LatticeCreator(const std::string& ident) : ident_(ident) {} | 
| 58 | 
> | 
    virtual ~LatticeCreator() {} | 
| 59 | 
> | 
         | 
| 60 | 
> | 
    const std::string& getIdent() const { return ident_; } | 
| 61 | 
> | 
 | 
| 62 | 
> | 
    virtual Lattice* create() const = 0; | 
| 63 | 
> | 
             | 
| 64 | 
  | 
  private: | 
| 65 | 
< | 
     std::string latticeType; | 
| 66 | 
< | 
}; | 
| 65 | 
> | 
    std::string ident_; | 
| 66 | 
> | 
  }; | 
| 67 | 
  | 
 | 
| 68 | 
< | 
template<class LatticeClass> | 
| 69 | 
< | 
class LatticeCreator : public BaseLatticeCreator | 
| 70 | 
< | 
{ | 
| 71 | 
< | 
public: | 
| 72 | 
< | 
        LatticeCreator(const std::string& latticeType): BaseLatticeCreator(latticeType) {} | 
| 73 | 
< | 
        virtual BaseLattice* createLattice()  { return new LatticeClass();} | 
| 74 | 
< | 
}; | 
| 68 | 
> | 
  /** | 
| 69 | 
> | 
   * @class LatticeBuilder | 
| 70 | 
> | 
   * @todo document | 
| 71 | 
> | 
   */ | 
| 72 | 
> | 
  template<class ConcreteLattice> | 
| 73 | 
> | 
  class LatticeBuilder : public LatticeCreator { | 
| 74 | 
> | 
  public: | 
| 75 | 
> | 
    LatticeBuilder(const std::string& ident) : LatticeCreator(ident) {} | 
| 76 | 
> | 
    virtual  Lattice* create() const {return new ConcreteLattice();} | 
| 77 | 
> | 
  }; | 
| 78 | 
  | 
 | 
| 79 | 
  | 
} | 
| 80 | 
< | 
#endif | 
| 80 | 
> | 
 | 
| 81 | 
> | 
#endif //USETHEFORCE_FORCEFIELDCREATOR_HPP |