source: src/Potentials/RegistrySerializer.hpp@ ff4fff9

CombiningParticlePotentialParsing
Last change on this file since ff4fff9 was ff4fff9, checked in by Frederik Heber <heber@…>, 9 years ago

RegistrySerializer now places potentials into certain sections.

  • Property mode set to 100644
File size: 1.4 KB
Line 
1/*
2 * RegistrySerializer.hpp
3 *
4 * Created on: 09.05.2013
5 * Author: heber
6 */
7
8#ifndef REGISTRYSERIALIZER_HPP_
9#define REGISTRYSERIALIZER_HPP_
10
11// include config.h
12#ifdef HAVE_CONFIG_H
13#include <config.h>
14#endif
15
16#include <iosfwd>
17
18#include "CodePatterns/Registry.hpp"
19
20class EmpiricalPotential;
21class Particle;
22
23/** This template class can serialize items contained in a general Registry
24 * that contain function stream_to().
25 */
26template <class T>
27class RegistrySerializer
28{
29public:
30 /** Constructor for class RegistrySerializer.
31 *
32 * \param _to_serialize stream to serialize to
33 * \param _instance registry instance to serialize
34 * \param _name optional name for debugging
35 */
36 RegistrySerializer(
37 std::ostream &_to_serialize,
38 Registry<T> &_instance,
39 const std::string _name = "item") :
40 to_serialize(_to_serialize),
41 instance(_instance),
42 name(_name)
43 {}
44
45 /** Destructor for class RegistrySerializer.
46 *
47 */
48 ~RegistrySerializer()
49 {}
50
51 /** Function to stream all potentials present in PotentialRegistry to
52 * internally stored stream.
53 *
54 */
55 void operator()();
56
57private:
58 std::ostream &to_serialize;
59 const Registry<T> &instance;
60 const std::string name;
61};
62
63#include "RegistrySerializer_impl.hpp"
64
65template <>
66void RegistrySerializer<EmpiricalPotential>::operator()();
67
68template <>
69void RegistrySerializer<Particle>::operator()();
70
71#endif /* REGISTRYSERIALIZER_HPP_ */
Note: See TracBrowser for help on using the repository browser.