| 1 | /*
 | 
|---|
| 2 |  * StreamFactory_EmpiricalPotential.hpp
 | 
|---|
| 3 |  *
 | 
|---|
| 4 |  *  Created on: Feb 28, 2016
 | 
|---|
| 5 |  *      Author: heber
 | 
|---|
| 6 |  */
 | 
|---|
| 7 | 
 | 
|---|
| 8 | 
 | 
|---|
| 9 | #ifndef STREAMFACTORY_EMPIRICALPOTENTIAL_HPP_
 | 
|---|
| 10 | #define STREAMFACTORY_EMPIRICALPOTENTIAL_HPP_
 | 
|---|
| 11 | 
 | 
|---|
| 12 | // include config.h
 | 
|---|
| 13 | #ifdef HAVE_CONFIG_H
 | 
|---|
| 14 | #include <config.h>
 | 
|---|
| 15 | #endif
 | 
|---|
| 16 | 
 | 
|---|
| 17 | #include "StreamFactory.hpp"
 | 
|---|
| 18 | 
 | 
|---|
| 19 | #include <string>
 | 
|---|
| 20 | 
 | 
|---|
| 21 | #include "Potentials/EmpiricalPotential.hpp"
 | 
|---|
| 22 | 
 | 
|---|
| 23 | /** This implements the StreamFactory (template) interface for EmpiricalPotentials.
 | 
|---|
| 24 |  *
 | 
|---|
| 25 |  * This has to be inherited by a higher class that may actually instantiate
 | 
|---|
| 26 |  * default constructed potentials, i.e. who is friend with EmpiricalPotential.
 | 
|---|
| 27 |  */
 | 
|---|
| 28 | template <>
 | 
|---|
| 29 | struct StreamFactory<EmpiricalPotential>
 | 
|---|
| 30 | {
 | 
|---|
| 31 |   /** Destructor of class StreamFactory<EmpiricalPotential>.
 | 
|---|
| 32 |    *
 | 
|---|
| 33 |    */
 | 
|---|
| 34 |   virtual ~StreamFactory<EmpiricalPotential>();
 | 
|---|
| 35 | 
 | 
|---|
| 36 |   /** Creates an instance of the requested potential.
 | 
|---|
| 37 |    *
 | 
|---|
| 38 |    * \param potentialtype key of potential to create
 | 
|---|
| 39 |    * \param serialized stream to parser SerializablePotential from
 | 
|---|
| 40 |    */
 | 
|---|
| 41 |   EmpiricalPotential *createInstance(
 | 
|---|
| 42 |       const std::string &potentialtype,
 | 
|---|
| 43 |       std::istream &serialized) const;
 | 
|---|
| 44 | 
 | 
|---|
| 45 | private:
 | 
|---|
| 46 | 
 | 
|---|
| 47 |   /** Getter for a default constructed potential.
 | 
|---|
| 48 |    *
 | 
|---|
| 49 |    * This has to be implemented in inheriting factory class.
 | 
|---|
| 50 |    */
 | 
|---|
| 51 |   virtual EmpiricalPotential* getDefaultPotential(const std::string &_name) const=0;
 | 
|---|
| 52 | 
 | 
|---|
| 53 |   virtual EmpiricalPotential *createInstance(
 | 
|---|
| 54 |       const std::string &potentialtype,
 | 
|---|
| 55 |       const SerializablePotential::ParticleTypes_t &charges) const=0;
 | 
|---|
| 56 | 
 | 
|---|
| 57 |   virtual EmpiricalPotential *createInstance(
 | 
|---|
| 58 |       const std::string &potentialtype,
 | 
|---|
| 59 |       const SerializablePotential::ParticleTypes_t &charges,
 | 
|---|
| 60 |                         const FunctionModel::parameters_t ¶ms) const=0;
 | 
|---|
| 61 | 
 | 
|---|
| 62 | };
 | 
|---|
| 63 | 
 | 
|---|
| 64 | #endif /* STREAMFACTORY_EMPIRICALPOTENTIAL_HPP_ */
 | 
|---|