a Code for the Combination of Indirect and Direct Constraints on High Energy Physics Models Logo
MapAndVectorAndBools.hpp
Go to the documentation of this file.
1/*
2 * MapAndVectorAndBools.hpp
3 *
4 * Created on: Jan 19, 2012
5 * Author: Ben O'Leary (benjamin.oleary@gmail.com)
6 * Copyright 2012 Ben O'Leary
7 *
8 * This file is part of LesHouchesParserClasses, released under the
9 * GNU General Public License. Please see the accompanying
10 * README.LHPC_CPP.txt file for a full list of files, brief documentation
11 * on how to use these classes, and further details on the license.
12 */
13
14#ifndef MAPANDVECTORANDBOOLS_HPP_
15#define MAPANDVECTORANDBOOLS_HPP_
16
17#include <map>
18#include <vector>
19
20namespace LHPC
21{
22 /* this is a class to hold a std::map of ints and pointers (intended to be
23 * MassEigenstate pointers) along with a std::vector of that type of pointer,
24 * and also a pointer to a std::vector< bool > (intended to hold whatever
25 * flags the MassEigenstate instances are meant to have) and a const
26 * reference to a bool (intended for a verbosity flag).
27 */
28 template< class PointerClass >
30 {
31 public:
32 typedef typename std::map< int,
33 PointerClass > PointerMap;
34 typedef typename std::vector< PointerClass > PointerVector;
35
38 bool const boolReference );
39 virtual
41
43 withBools( std::vector< bool > const* const boolVector );
44 // this sets this->boolVector to the given pointer & returns *this.
49 bool
51 std::vector< bool > const*
53
54
55 protected:
58 bool const boolReference;
59 std::vector< bool > const* boolVector;
60 };
61
62
63
64 template< class PointerClass >
65 inline
67 PointerMap& codeMap,
68 PointerVector& pointerGroup,
69 bool const boolReference ) :
70 codeMap( codeMap ),
71 pointerGroup( pointerGroup ),
72 boolReference( boolReference ),
73 boolVector( NULL )
74 {
75 // just an initialization list.
76 }
77
78 template< class PointerClass >
79 inline
81 {
82 // does nothing.
83 }
84
85
86 template< class PointerClass >
89 std::vector< bool > const* const boolVector )
90 // this sets this->boolVector to the given pointer & returns *this.
91 {
92 this->boolVector = boolVector;
93 return *this;
94 }
95
96 template< class PointerClass >
97 inline std::map< int,
98 PointerClass >&
100 {
101 return codeMap;
102 }
103
104 template< class PointerClass >
105 inline std::vector< PointerClass >&
107 {
108 return pointerGroup;
109 }
110
111 template< class PointerClass >
112 inline bool
114 {
115 return boolReference;
116 }
117
118 template< class PointerClass >
119 inline std::vector< bool > const*
121 {
122 return boolVector;
123 }
124
125}
126
127#endif /* MAPANDVECTORANDBOOLS_HPP_ */
std::vector< bool > const * getFlags()
std::map< int, PointerClass > PointerMap
std::vector< PointerClass > PointerVector
std::vector< bool > const * boolVector
MapAndVectorAndBools(PointerMap &codeMap, PointerVector &pointerGroup, bool const boolReference)
MapAndVectorAndBools< PointerClass > & withBools(std::vector< bool > const *const boolVector)