0

I am having a series of c++ functions to be executed in C++ in one text file

LHAPDF::alphasPDF(pow(1* 0.25471686e+03,0))
LHAPDF::alphasPDF(1*0.18014950e+03)
LHAPDF::xfx(0.86084175E-01,0.17014950e+03,0)
LHAPDF::xfx(0.39435938E-01,0.25471686e+03,0)
LHAPDF::xfx(0.29,1*0.15,0)

How can I parse them in C++ and execute the line ? my C++ knows what LHAPDF::xfx is, I just want to repeatedly execute the lines parsed from the text file.

Kate Gregory
  • 18,808
  • 8
  • 56
  • 85
Alex
  • 191
  • 1
  • 9

1 Answers1

1

C++ Does not provide and idea of calling function or using code from a separate file read in. Though another idea could be rewording the text file using a keyword then values, and call the function by finding the keyword of the string:

xfx  0.29  1.15  0      //call xfx func
alp  1*0.18014950e+03   //call alphasPDF

somewhere in main.cpp
//Grab the first variable and read into string
//are the first three letters xfx?
    read in the remaining values
    call xfx using the parameters
//else are the first three letters alp?
    read the remaining values into a string(really small values)
    manipulate the string until desired value is reached
    call function
Syntactic Fructose
  • 18,936
  • 23
  • 91
  • 177