source: src/Potentials/Particles/ParticleFactory.hpp

Candidate_v1.6.1
Last change on this file was 086e30, checked in by Frederik Heber <heber@…>, 9 years ago

Added ParticleFactory and general StreamFactory.

  • Property mode set to 100644
File size: 1.5 KB
Line 
1/*
2 * ParticleFactory.hpp
3 *
4 * Created on: Feb 27, 2016
5 * Author: heber
6 */
7
8
9#ifndef PARTICLEFACTORY_HPP_
10#define PARTICLEFACTORY_HPP_
11
12// include config.h
13#ifdef HAVE_CONFIG_H
14#include <config.h>
15#endif
16
17#include <string>
18
19#include "CodePatterns/Singleton.hpp"
20
21#include "Potentials/Particles/Particle.hpp"
22#include "Potentials/Particles/StreamFactory_Particle.hpp"
23#include "types.hpp"
24
25class ParticleFactory :
26 public Singleton<ParticleFactory>,
27 public StreamFactory<Particle>
28{
29 //!> make Singleton template friend
30 friend class Singleton<ParticleFactory>;
31
32protected:
33
34 /** Implementing function for constructing default particle, required for
35 * StreamFactory specialization.
36 *
37 * \return default constructed particle
38 */
39 virtual Particle* getDefaultParticle() const;
40
41public:
42
43 /** Static function to create a single particle instance.
44 *
45 * \param _type this is not needed for particles
46 * \param _input stream from which to take parameters to instantiate
47 */
48 Particle * createInstance(
49 const std::string &,
50 std::istream &_input) const;
51
52 /** Static function to create a single particle instance.
53 *
54 * \param _name name of particle
55 * \param _element represented element
56 * \param _charge (partial) charge of this particle
57 */
58 Particle * createInstance(
59 const std::string &_name,
60 const atomicNumber_t _element,
61 const double _charge) const;
62
63private:
64 ParticleFactory () {}
65 virtual ~ParticleFactory () {}
66};
67
68#endif /* PARTICLEFACTORY_HPP_ */
Note: See TracBrowser for help on using the repository browser.