1 |
/* |
2 |
* GeometryCreator.hpp |
3 |
* OOPSE-2.0 |
4 |
* |
5 |
* Created by Charles F. Vardeman II on 5/3/05. |
6 |
* Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. |
7 |
* |
8 |
* The University of Notre Dame grants you ("Licensee") a |
9 |
* non-exclusive, royalty free, license to use, modify and |
10 |
* redistribute this software in source and binary code form, provided |
11 |
* that the following conditions are met: |
12 |
* |
13 |
* 1. Acknowledgement of the program authors must be made in any |
14 |
* publication of scientific results based in part on use of the |
15 |
* program. An acceptable form of acknowledgement is citation of |
16 |
* the article in which the program was described (Matthew |
17 |
* A. Meineke, Charles F. Vardeman II, Teng Lin, Christopher |
18 |
* J. Fennell and J. Daniel Gezelter, "OOPSE: An Object-Oriented |
19 |
* Parallel Simulation Engine for Molecular Dynamics," |
20 |
* J. Comput. Chem. 26, pp. 252-271 (2005)) |
21 |
* |
22 |
* 2. Redistributions of source code must retain the above copyright |
23 |
* notice, this list of conditions and the following disclaimer. |
24 |
* |
25 |
* 3. Redistributions in binary form must reproduce the above copyright |
26 |
* notice, this list of conditions and the following disclaimer in the |
27 |
* documentation and/or other materials provided with the |
28 |
* distribution. |
29 |
* |
30 |
* This software is provided "AS IS," without a warranty of any |
31 |
* kind. All express or implied conditions, representations and |
32 |
* warranties, including any implied warranty of merchantability, |
33 |
* fitness for a particular purpose or non-infringement, are hereby |
34 |
* excluded. The University of Notre Dame and its licensors shall not |
35 |
* be liable for any damages suffered by licensee as a result of |
36 |
* using, modifying or distributing the software or its |
37 |
* derivatives. In no event will the University of Notre Dame or its |
38 |
* licensors be liable for any lost revenue, profit or data, or for |
39 |
* direct, indirect, special, consequential, incidental or punitive |
40 |
* damages, however caused and regardless of the theory of liability, |
41 |
* arising out of the use of or inability to use software, even if the |
42 |
* University of Notre Dame has been advised of the possibility of |
43 |
* such damages. |
44 |
*/ |
45 |
|
46 |
#ifndef NANORODBUILDER_GEOMETRYCREATOR_HPP |
47 |
#define NANORODBUILDER_GEOMETRYCREATOR_HPP |
48 |
|
49 |
#include <string> |
50 |
|
51 |
namespace oopse { |
52 |
|
53 |
class Geometry; |
54 |
|
55 |
/** |
56 |
* @class Geometry |
57 |
* @todo document |
58 |
*/ |
59 |
class GeometryCreator { |
60 |
public: |
61 |
GeometryCreator(const std::string& ident) : ident_(ident) {} |
62 |
virtual ~GeometryCreator() {} |
63 |
|
64 |
const std::string& getIdent() const { return ident_; } |
65 |
|
66 |
virtual Geometry* create() const = 0; |
67 |
|
68 |
private: |
69 |
std::string ident_; |
70 |
}; |
71 |
|
72 |
/** |
73 |
* @class GeometryBuilder |
74 |
* @todo document |
75 |
*/ |
76 |
template<class ConcreteGeometry> |
77 |
class GeometryBuilder : public GeometryCreator { |
78 |
public: |
79 |
GeometryBuilder(const std::string& ident) : GeometryCreator(ident) {} |
80 |
virtual Geometry* create() const {return new ConcreteGeometry();} |
81 |
}; |
82 |
|
83 |
} |
84 |
|
85 |
#endif //NANORODBUILDER_GEOMETRYCREATOR_HPP |