a Code for the Combination of Indirect and Direct Constraints on High Energy Physics Models Logo
JustSingleValueBlock.hpp
Go to the documentation of this file.
1/*
2 * JustSingleValueBlock.hpp
3 *
4 * Created on: Mar 12, 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 JUSTSINGLEVALUEBLOCK_HPP_
15#define JUSTSINGLEVALUEBLOCK_HPP_
16
17#include "../SlhaBlock.hpp"
19
20namespace LHPC
21{
22 namespace SLHA
23 {
24 // this template class interprets all the blocks with the same name, though
25 // differing scale values, which are interpreted as having a single value.
26 template< class ValueClass >
27 class JustSingleValueBlock : public SlhaBlock< ValueClass,
28 InterpreterClass::JustSingleValue< ValueClass > >
29 {
30 public:
31 JustSingleValueBlock( std::string const& blockName,
32 ValueClass const& defaultUnsetValue,
33 bool const isVerbose = false );
34 virtual
36
37 ValueClass&
38 operator()();
39 // this returns operator() of the lowest-scale interpreter.
40 ValueClass const&
41 operator()() const;
42 // const version of above.
43 bool
44 hasEntry() const;
45 // this returns hasEntry() of the lowest-scale interpreter.
46 };
47
48
49
50
51
52 template< class ValueClass >
53 inline
55 std::string const& blockName,
56 ValueClass const& defaultUnsetValue,
57 bool const isVerbose ) :
58 SlhaBlock< ValueClass,
59 InterpreterClass::JustSingleValue< ValueClass > >(
60 blockName,
61 defaultUnsetValue,
62 isVerbose )
63 {
64 // just an initialization list.
65 }
66
67 template< class ValueClass >
68 inline
70 {
71 // does nothing.
72 }
73
74
75 template< class ValueClass >
76 inline ValueClass&
78 // this returns operator() of the lowest-scale interpreter.
79 {
80 return this->dataBlocks[ this->lowestScaleIndex ]();
81 }
82
83 template< class ValueClass >
84 inline ValueClass const&
86 // const version of above.
87 {
88 return this->dataBlocks[ this->lowestScaleIndex ]();
89 }
90
91 template< class ValueClass >
92 inline bool
94 // this returns hasEntry() of the lowest-scale interpreter.
95 {
96 return this->dataBlocks[ this->lowestScaleIndex ].hasEntry();
97 }
98
99 } // end of SLHA namespace
100
101} // end of LHPC namespace
102
103#endif /* JUSTSINGLEVALUEBLOCK_HPP_ */
JustSingleValueBlock(std::string const &blockName, ValueClass const &defaultUnsetValue, bool const isVerbose=false)