a Code for the Combination of Indirect and Direct Constraints on High Energy Physics Models Logo
BlockInterpreter.hpp
Go to the documentation of this file.
1/*
2 * BlockInterpreter.hpp
3 *
4 * Created on: Mar 11, 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 BLOCKINTERPRETER_HPP_
15#define BLOCKINTERPRETER_HPP_
16
18#include "../BaseStringBlock.hpp"
19
20namespace LHPC
21{
22 namespace SLHA
23 {
24 // this abstract base class provides a base class for interpreting
25 // BaseStringBlock instances.
27 {
28 public:
32 static bool const defaultVerbosity;
33
35 virtual
37
38 void
40 BlockClass::BaseStringBlock const& stringsToInterpret );
41 std::string
42 getLineWithoutComment( int const whichLine ) const;
43 std::string
44 getLineWithComment( int const whichLine ) const;
45 /* information in comments can be decoded by someone else's code, because
46 * putting important information in comments is an entirely unacceptably
47 * stupid idea, in my humble opinion.
48 */
49 double
50 getScale() const;
51 virtual std::string const&
53 // derived classes should return their block as a single string of
54 // re-formatted interpreted values.
55 virtual void
57 // derived classes should clear their interpreted values.
58
59
60 protected:
63
64 virtual void
66 };
67
68
69
70
71
72 inline void
74 BlockClass::BaseStringBlock const& stringsToInterpret )
75 {
77 currentStringBlock = &stringsToInterpret;
79 }
80
81 inline std::string
82 BlockInterpreter::getLineWithoutComment( int const whichLine ) const
83 {
84 if( NULL == currentStringBlock )
85 {
86 std::string lineReturnString;
87 lineReturnString.assign( "LHPC::error! this block has not been" );
88 lineReturnString.append( " registered with an SlhaParser properly!" );
89 return lineReturnString;
90 }
91 else
92 {
93 return (*currentStringBlock)[ whichLine ].first;
94 }
95 }
96
97 inline std::string
98 BlockInterpreter::getLineWithComment( int const whichLine ) const
99 /* information in comments can be decoded by someone else's code, because
100 * putting important information in comments is an entirely unacceptably
101 * stupid idea, in my humble opinion.
102 */
103 {
104 std::string lineReturnString;
105 if( NULL == currentStringBlock )
106 {
107 lineReturnString.assign( "LHPC::error! this block has not been" );
108 lineReturnString.append( " registered with an SlhaParser properly!" );
109 }
110 else
111 {
112 lineReturnString.assign( (*currentStringBlock)[ whichLine ].first );
113 lineReturnString.append( (*currentStringBlock)[ whichLine ].second );
114 }
115 return lineReturnString;
116 }
117
118 inline double
120 {
121 if( NULL != currentStringBlock )
122 {
124 }
125 else
126 {
127 return 0.0;
128 }
129 }
130
131 }
132
133}
134
135#endif /* BLOCKINTERPRETER_HPP_ */
static BOL::StringParser const slhaIntHelper
BlockClass::BaseStringBlock const * currentStringBlock
virtual void interpretCurrentStringBlock()=0
static BOL::StringParser const particleCodeMaker
static BOL::StringParser const slhaDoubleMaker
void interpretStringBlock(BlockClass::BaseStringBlock const &stringsToInterpret)
std::string getLineWithoutComment(int const whichLine) const
static bool const defaultVerbosity
std::string getLineWithComment(int const whichLine) const
virtual std::string const & getAsString()=0
virtual void clearEntries()=0