13 {
14 std::string sParam = "";
15 std::string sMessage = "";
16
17 for (size_t i=0; i<buffer.size(); i++) {
18 if (buffer[i].
find(varName.c_str())!=std::string::npos) {
19 std::istringstream iss(buffer[i]);
20 std::string s;
21 bool chkParam = false;
22 bool chkMessage = false;
23 while (iss >> s) {
24 if (s.find("{{")!=std::string::npos) {
25 sParam += s.substr(2,s.length());
26 chkParam = true;
27 }
28 else if (s.find("},")!=std::string::npos) {
29 sParam += s.substr(0,s.length()-2);
30 sParam += ",";
31 }
32 else if (
s.find(
"}}")!=std::string::npos) {
33 sParam +=
s.substr(0,
s.length()-2);
34 chkParam = false;
35 chkMessage = true;
36 }
37 else if (
s.find(
"{")!=std::string::npos &&
s.find(
"}")!=std::string::npos) {
38 sParam +=
s.substr(1,
s.length()-1);
39 }
40 else if (
s.find(
"{")!=std::string::npos) {
41 sParam +=
s.substr(1,
s.length());
42 chkParam = true;
43 }
44 else if (
s.find(
"}")!=std::string::npos) {
45 sParam +=
s.substr(0,
s.length()-1);
46 chkParam = false;
47 chkMessage = true;
48 }
49 else if (chkParam==true) {
51 }
52 else if (chkMessage==true) {
54 }
55 }
56 }
57 }
58 if (sParam.empty()) {
59 throw std::runtime_error ("PixelConfigCondAlg::getParameterString() Input variable " + varName + " was not found. " );
60 }
61
62 std::vector<std::string> vParam;
64 for (;;) {
65 auto pos = sParam.find(
",",offset);
66 if (pos==std::string::npos) {
67 vParam.push_back(sParam.substr(offset,pos));
68 break;
69 }
70 vParam.push_back(sParam.substr(offset,pos-offset));
72 }
73
74 std::vector<std::string> vvParam;
75 for (const auto & param : vParam) {
76 if (param.find("\"")!=std::string::npos) {
77 if (vParam.size()==1) {
78 vvParam.push_back(param.substr(1,param.length()-3));
79 } else {
80 vvParam.push_back(param.substr(1,param.length()-2));
81 }
82 } else {
83 vvParam.push_back(param);
84 }
85 }
86 return vvParam;
87 }
std::string find(const std::string &s)
return a remapped string