#include <ExpressionEvaluator.h>
Definition at line 9 of file ExpressionEvaluator.h.
reco::ExpressionEvaluator::ExpressionEvaluator |
( |
const char * |
pkg, |
|
|
const char * |
iname, |
|
|
const std::string & |
iexpr |
|
) |
| |
Definition at line 54 of file ExpressionEvaluator.cc.
References COUT, Exception, reco::exprEvalDetails::execSysCommand(), mergeVDriftHistosByStation::file, edm::getEnvironmentVariable(), m_expr, m_name, checklumidiff::ofile, source, contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, and tmp.
55 m_name(
"VI_"+generateName())
76 std::ifstream
ss(file.c_str());
77 COUT <<
"local file: " << file << std::endl;
79 std::getline(
ss,cxxf);
80 incDir = baseDir + incDir;
83 std::string file = relDir + incDir + pch +
".cxxflags";
84 COUT <<
"file in release area: " << file << std::endl;
85 std::ifstream
ss(file.c_str());
87 std::getline(
ss,cxxf);
88 incDir = relDir + incDir;
91 auto paDir = patchArea();
92 if (paDir.empty())
throw cms::Exception(
"ExpressionEvaluator",
"error in opening patch area for "+ baseDir);
93 std::string file = paDir + incDir + pch +
".cxxflags";
94 COUT <<
"file in base release area: " << file << std::endl;
95 std::ifstream
ss(file.c_str());
96 if (!
ss)
throw cms::Exception(
"ExpressionEvaluator", pch +
" file not found neither in " + baseDir +
" nor in " + relDir +
" nor in " + paDir);
97 std::getline(
ss,cxxf);
98 incDir = paDir + incDir;
102 { std::regex rq(
"-I[^ ]+"); cxxf = std::regex_replace(cxxf,rq,
std::string(
"")); }
103 { std::regex rq(
"=\""); cxxf = std::regex_replace(cxxf,rq,
std::string(
"='\"")); }
104 { std::regex rq(
"\" "); cxxf = std::regex_replace(cxxf,rq,
std::string(
"\"' ")); }
105 COUT <<
'|' << cxxf <<
"|\n" << std::endl;
109 std::string cpp =
"c++ -H -Wall -shared -Winvalid-pch "; cpp+=cxxf;
110 cpp +=
" -I" + incDir;
111 cpp +=
" -o " + ofile +
' ' + sfile+
" 2>&1\n";
113 COUT << cpp << std::endl;
120 source+=
"struct "+
m_name+
" final : public "+iname +
"{\n";
125 source +=
"extern " + quote+
'C'+quote+
' ' +
std::string(iname) +
"* "+factory+
"() {\n";
126 source +=
"static "+
m_name+
" local;\n";
127 source +=
"return &local;\n}\n";
130 COUT << source << std::endl;
133 std::ofstream
tmp(sfile.c_str());
134 tmp<<source << std::endl;
143 void * dl = dlopen(ofile.c_str(),RTLD_LAZY);
150 m_expr = dlsym(dl,factory.c_str());
std::string execSysCommand(const std::string &cmdline)
std::vector< std::vector< double > > tmp
static std::string const source
std::string getEnvironmentVariable(std::string const &name, std::string const &defaultValue=std::string())
reco::ExpressionEvaluator::~ExpressionEvaluator |
( |
| ) |
|
template<typename EXPR , typename... CArgs>
EXPR* reco::ExpressionEvaluator::expr |
( |
| ) |
const |
|
inline |
void* reco::ExpressionEvaluator::m_expr |
|
private |
std::string reco::ExpressionEvaluator::m_name |
|
private |