Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int Parse()
- {
- xml_document<> detectorsOutput;
- string inputPath = projectPath + "\\vehout.xml";
- ifstream iFile(inputPath);
- if (!iFile.is_open())
- {
- cout << "Bledna sciezka" << endl;
- return -1;
- }
- vector<double> values(0);
- vector<char> bufferC((istreambuf_iterator<char>(iFile)), istreambuf_iterator<char>());
- bufferC.push_back('\0');
- detectorsOutput.parse<0>(&bufferC[0]);
- iFile.close();
- xml_node<> *mainNode = detectorsOutput.first_node();
- for (xml_node<> *timestepNode = mainNode->first_node("tripinfo"); timestepNode != nullptr; timestepNode = timestepNode->next_sibling("tripinfo"))
- {
- double val = stod(timestepNode->first_attribute("duration")->value());
- values.push_back(val);
- }
- string outputPath = projectPath + "\\OutSCP.txt";
- ofstream oFile(outputPath);
- double functionValue = Function(values);
- oFile.open(outputPath, ios::app);
- oFile << functionValue << endl;
- oFile.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment