a Code for the Combination of Indirect and Direct Constraints on High Energy Physics Models Logo
ObjectLine.cpp
Go to the documentation of this file.
1/*
2 * ObjectLine.cpp
3 *
4 * Created on: Jun 25, 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 "LHCO.hpp"
15
16namespace LHPC
17{
18 namespace LHCO
19 {
21 // this is the minimum number of numbers expected for a valid line.
22
24 lineNumber( -1 ),
25 objectType( -1 ),
26 valueVector( 11,
27 BOL::UsefulStuff::notANumber )
28 {
29 // just an initialization list.
30 }
31
32 ObjectLine::ObjectLine( ObjectLine const& copySource ) :
33 lineNumber( copySource.lineNumber ),
34 objectType( copySource.objectType ),
35 valueVector( copySource.valueVector )
36 {
37 // just an initialization list.
38 }
39
41 {
42 // does nothing.
43 }
44
45
46 ObjectLine const*
47 ObjectLine::recordLine( int const lineNumber,
48 BOL::VectorlikeArray< std::string > const& lineAsStrings )
49 // this interprets a string as the data it is meant to correspond to. it
50 // assumes that it has been given enough numbers.
51 {
52 if( minimumNumberOfEntries <= lineAsStrings.getSize() )
53 {
54 valueVector.assign( lineAsStrings.getSize(),
56 }
57 else
58 {
61 }
62 this->lineNumber = lineNumber;
63 valueVector[ 0 ] = (double)lineNumber;
64 objectType = BOL::StringParser::stringToInt( lineAsStrings[ 1 ] );
65 valueVector[ 1 ] = (double)objectType;
66 for( int whichElement( 2 );
67 lineAsStrings.getLastIndex() >= whichElement;
68 ++whichElement )
69 {
70 valueVector[ whichElement ]
71 = BOL::StringParser::stringToDouble( lineAsStrings[ whichElement ] );
72 }
73 return this;
74 }
75
76 }
77
78}
static double stringToDouble(std::string const &stringToInterpret)
static int stringToInt(std::string const &stringToInterpret)
static double const notANumber
Definition: UsefulStuff.hpp:28
static int const minimumNumberOfEntries
Definition: ObjectLine.hpp:118
ObjectLine const * recordLine(int const lineNumber, BOL::VectorlikeArray< std::string > const &lineAsStrings)
Definition: ObjectLine.cpp:47
std::vector< double > valueVector
Definition: ObjectLine.hpp:132