1 | /*
|
---|
2 | * AtomFragmentsMap.hpp
|
---|
3 | *
|
---|
4 | * Created on: Mar 7, 2016
|
---|
5 | * Author: heber
|
---|
6 | */
|
---|
7 |
|
---|
8 |
|
---|
9 | #ifndef ATOMFRAGMENTSMAP_HPP_
|
---|
10 | #define ATOMFRAGMENTSMAP_HPP_
|
---|
11 |
|
---|
12 | // include config.h
|
---|
13 | #ifdef HAVE_CONFIG_H
|
---|
14 | #include <config.h>
|
---|
15 | #endif
|
---|
16 |
|
---|
17 | #include "CodePatterns/Singleton.hpp"
|
---|
18 |
|
---|
19 | #include <list>
|
---|
20 | #include <map>
|
---|
21 |
|
---|
22 | #include <boost/serialization/export.hpp>
|
---|
23 | #include <boost/serialization/set.hpp>
|
---|
24 | #include <boost/serialization/list.hpp>
|
---|
25 | #include <boost/serialization/map.hpp>
|
---|
26 | #include <boost/serialization/version.hpp>
|
---|
27 |
|
---|
28 | #include "types.hpp"
|
---|
29 |
|
---|
30 | class KeySet;
|
---|
31 | class Graph;
|
---|
32 |
|
---|
33 | /** This class creates in instantiation a map connecting each atom with
|
---|
34 | * the (known) fragments it takes part in.
|
---|
35 | *
|
---|
36 | * In the HomologyGraph and its -Container we do not have this information
|
---|
37 | * any longer. However, we need this in order to make statements about atomic
|
---|
38 | * properties from calculated fragment properties.
|
---|
39 | *
|
---|
40 | */
|
---|
41 | class AtomFragmentsMap : public Singleton<AtomFragmentsMap>
|
---|
42 | {
|
---|
43 | public:
|
---|
44 | //** Function to insert new fragments into storage container.
|
---|
45 | void insert(
|
---|
46 | const Graph &_graph,
|
---|
47 | size_t _MaxOrder);
|
---|
48 |
|
---|
49 | /** Function to clear the container.
|
---|
50 | *
|
---|
51 | */
|
---|
52 | void clear()
|
---|
53 | { atommap.clear(); }
|
---|
54 |
|
---|
55 | typedef std::list<KeySet> keysets_t;
|
---|
56 | //!> typedef for the internal map
|
---|
57 | typedef std::map<atomId_t, keysets_t> AtomFragmentsMap_t;
|
---|
58 |
|
---|
59 | const AtomFragmentsMap_t& getMap() const
|
---|
60 | { return atommap; }
|
---|
61 |
|
---|
62 | private:
|
---|
63 | //!> grant singleton pattern access to private cstor/dstor
|
---|
64 | friend class Singleton<AtomFragmentsMap>;
|
---|
65 |
|
---|
66 | /** Private default cstor.
|
---|
67 | *
|
---|
68 | */
|
---|
69 | AtomFragmentsMap() {}
|
---|
70 |
|
---|
71 | /** Private default dstor.
|
---|
72 | *
|
---|
73 | */
|
---|
74 | ~AtomFragmentsMap() {}
|
---|
75 |
|
---|
76 | private:
|
---|
77 | //!> internal map filled on instantiation
|
---|
78 | AtomFragmentsMap_t atommap;
|
---|
79 |
|
---|
80 | private:
|
---|
81 | friend class boost::serialization::access;
|
---|
82 | // serialization
|
---|
83 | template <typename Archive>
|
---|
84 | void serialize(Archive& ar, const unsigned int version)
|
---|
85 | {
|
---|
86 | ar & atommap;
|
---|
87 | }
|
---|
88 | };
|
---|
89 |
|
---|
90 |
|
---|
91 | #endif /* ATOMFRAGMENTSMAP_HPP_ */
|
---|