a Code for the Combination of Indirect and Direct Constraints on High Energy Physics Models Logo
DenseSinglyIndexedBlock.hpp
Go to the documentation of this file.
1/*
2 * DenseSinglyIndexedBlock.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 DENSESINGLYINDEXEDBLOCK_HPP_
15#define DENSESINGLYINDEXEDBLOCK_HPP_
16
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 int
26 * index which has to have entries for each value, beginning with index 1.
27 */
28 template< class ValueClass >
30 InterpreterClass::DenseSinglyIndexed< ValueClass > >
31 {
32 public:
33 DenseSinglyIndexedBlock( std::string const& blockName,
34 ValueClass const& defaultUnsetValue,
35 bool const isVerbose = false,
36 int const indexDigits = 5 );
37 virtual
39
40 ValueClass&
41 operator()( int const soughtIndex );
42 // this returns operator() of the lowest-scale interpreter.
43 ValueClass const&
44 operator()( int const soughtIndex ) const;
45 // const version of above.
46 bool
47 hasEntry( int const soughtIndex ) const;
48 // this returns hasEntry( soughtIndex ) of the lowest-scale interpreter.
49 };
50
51
52
53
54
55 template< class ValueClass >
56 inline
58 std::string const& blockName,
59 ValueClass const& defaultUnsetValue,
60 bool const isVerbose,
61 int const indexDigits ) :
62 IndexedBlockTemplate< ValueClass,
63 InterpreterClass::DenseSinglyIndexed< ValueClass > >(
64 blockName,
65 defaultUnsetValue,
66 isVerbose,
67 std::vector< int >( 1,
68 indexDigits ) )
69 {
70 // just an initialization list.
71 }
72
73 template< class ValueClass >
74 inline
76 {
77 // does nothing.
78 }
79
80
81 template< class ValueClass >
82 inline ValueClass&
84 // this returns operator() of the lowest-scale interpreter.
85 {
86 return this->dataBlocks[ this->lowestScaleIndex ]( soughtIndex );
87 }
88
89 template< class ValueClass >
90 inline ValueClass const&
92 int const soughtIndex ) const
93 // const version of above.
94 {
95 return this->dataBlocks[ this->lowestScaleIndex ]( soughtIndex );
96 }
97
98 template< class ValueClass >
99 inline bool
101 int const soughtIndex ) const
102 // derived classes over-ride this to interpret their data as a
103 // std::string.
104 {
105 return
106 this->dataBlocks[ this->lowestScaleIndex ].hasEntry( soughtIndex );
107 }
108
109 } // end of SLHA namespace
110
111} // end of LHPC namespace
112
113
114#endif /* DENSESINGLYINDEXEDBLOCK_HPP_ */
ValueClass & operator()(int const soughtIndex)
DenseSinglyIndexedBlock(std::string const &blockName, ValueClass const &defaultUnsetValue, bool const isVerbose=false, int const indexDigits=5)
bool hasEntry(int const soughtIndex) const
ValueClass const defaultUnsetValue
Definition: SlhaBlock.hpp:139