a Code for the Combination of Indirect and Direct Constraints on High Energy Physics Models Logo
SameNameBlockSet.cpp
Go to the documentation of this file.
1/*
2 * SameNameBlockSet.cpp
3 *
4 * Created on: Mar 4, 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#include "SLHA.hpp"
15
16namespace LHPC
17{
18 namespace SLHA
19 {
20 SameNameBlockSet::SameNameBlockSet( std::string const& blockName ) :
22 blockNameInUppercase( BOL::StringParser::trimFromFrontAndBack(
23 blockName,
24 BOL::StringParser::whitespaceAndNewlineChars ) ),
25 stringBlocks(),
26 scaleOrderedIndices(),
27 scaleIndexIterator(),
28 lowestScaleIndex( -1 ),
29 currentStringBlock( NULL )
30 {
32 }
33
35 {
36 // does nothing.
37 }
38
39
40 void
41 SameNameBlockSet::recordHeader( std::string const& headerString,
42 std::string const& commentString,
43 double const blockScale )
44 // this prepares a new BaseBlockAsString for the impending block being
45 // read as strings.
46 {
47 currentStringBlock = stringBlocks.newEnd().recordHeader( headerString,
48 commentString,
49 blockScale );
50 if( 1 == stringBlocks.getSize() )
51 // if this is the only copy so far...
52 {
54 }
55 else if( blockScale < stringBlocks[ lowestScaleIndex ].getScale() )
56 /* otherwise, defaultDataBlockIndex is a valid index for stringBlocks,
57 * so the comparison is valid, & if true, defaultDataBlockIndex is set
58 * correctly.
59 */
60 {
61 lowestScaleIndex = stringBlocks.getLastIndex();
62 }
64 while( ( scaleIndexIterator != scaleOrderedIndices.end() )
65 &&
66 ( scaleIndexIterator->second < blockScale ) )
67 {
69 }
70 // now scaleIndexIterator should either be at the index with scale just
71 // above blockScale, or at the end of the list.
73 std::pair< int, double >( stringBlocks.getLastIndex(),
74 blockScale ) );
75 }
76
77 }
78
79}
static void transformToUppercase(std::string &stringToTransform)
void recordHeader(std::string const &headerString, std::string const &commentString, double const blockScale)
BlockClass::BaseStringBlock * currentStringBlock
std::list< std::pair< int, double > >::iterator scaleIndexIterator
std::list< std::pair< int, double > > scaleOrderedIndices
BOL::VectorlikeArray< BlockClass::BaseStringBlock > stringBlocks
SameNameBlockSet(std::string const &blockName)