a Code for the Combination of Indirect and Direct Constraints on High Energy Physics Models Logo
DenseDoublyIndexedBlock.hpp
Go to the documentation of this file.
1/*
2 * DenseDoublyIndexedBlock.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 DENSEDOUBLYINDEXEDBLOCK_HPP_
15#define DENSEDOUBLYINDEXEDBLOCK_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 pair of int
26 * indices which have to have entries for each value, each index beginning
27 * at 1.
28 */
29 template< class ValueClass >
31 InterpreterClass::DenseDoublyIndexed< ValueClass > >
32 {
33 public:
34 DenseDoublyIndexedBlock( std::string const& blockName,
35 ValueClass const& defaultUnsetValue,
36 bool const isVerbose = false,
37 int const firstIndexDigits = 2,
38 int const secondIndexDigits = 2 );
39 virtual
41
42 ValueClass&
43 operator()( int const firstIndex,
44 int const secondIndex );
45 // this returns operator() of the lowest-scale interpreter.
46 ValueClass const&
47 operator()( int const firstIndex,
48 int const secondIndex ) const;
49 // const version of above.
50 ValueClass&
51 operator()( std::pair< int, int > const& indexPair )
52 { return (*this)( indexPair.first,
53 indexPair.second ); }
54 ValueClass const&
55 operator()( std::pair< int, int > const& indexPair ) const
56 { return (*this)( indexPair.first,
57 indexPair.second ); }
58 bool
59 hasEntry( int const firstIndex,
60 int const secondIndex ) const;
61 // this returns hasEntry( firstIndex, secondIndex ) of the
62 // lowest-scale interpreter.
63 bool
64 hasEntry( std::pair< int, int > const& indexPair ) const
65 { return hasEntry( indexPair.first,
66 indexPair.second ); }
67 };
68
69
70
71
72
73 template< class ValueClass >
74 inline
76 std::string const& blockName,
77 ValueClass const& defaultUnsetValue,
78 bool const isVerbose,
79 int const firstIndexDigits,
80 int const secondIndexDigits ) :
81 IndexedBlockTemplate< ValueClass,
82 InterpreterClass::DenseDoublyIndexed< ValueClass > >(
83 blockName,
84 defaultUnsetValue,
85 isVerbose,
86 BOL::Vi( firstIndexDigits ).e( secondIndexDigits ) )
87 {
88 // just an initialization list.
89 }
90
91 template< class ValueClass >
92 inline
94 {
95 // does nothing.
96 }
97
98
99 template< class ValueClass >
100 inline ValueClass&
102 int const secondIndex )
103 // this returns operator() of the lowest-scale interpreter.
104 {
105 return this->dataBlocks[ this->lowestScaleIndex ]( firstIndex,
106 secondIndex );
107 }
108
109 template< class ValueClass >
110 inline ValueClass const&
112 int const secondIndex ) const
113 // const version of above.
114 {
115 return this->dataBlocks[ this->lowestScaleIndex ]( firstIndex,
116 secondIndex );
117 }
118
119 template< class ValueClass >
120 inline bool
122 int const secondIndex ) const
123 // derived classes over-ride this to interpret their data as a
124 // std::string.
125 {
126 return this->dataBlocks[ this->lowestScaleIndex ].hasEntry( firstIndex,
127 secondIndex );
128 }
129
130 } // end of SLHA namespace
131
132} // end of LHPC namespace
133
134
135#endif /* DENSEDOUBLYINDEXEDBLOCK_HPP_ */
ValueClass & operator()(int const firstIndex, int const secondIndex)
ValueClass const & operator()(std::pair< int, int > const &indexPair) const
ValueClass & operator()(std::pair< int, int > const &indexPair)
bool hasEntry(std::pair< int, int > const &indexPair) const
DenseDoublyIndexedBlock(std::string const &blockName, ValueClass const &defaultUnsetValue, bool const isVerbose=false, int const firstIndexDigits=2, int const secondIndexDigits=2)
bool hasEntry(int const firstIndex, int const secondIndex) const
ValueClass const defaultUnsetValue
Definition: SlhaBlock.hpp:139
StdVectorFiller< int > Vi