MCPcopy Create free account
hub / github.com/SICKAG/sick_scan_xd / createTestLaunchFile

Function createTestLaunchFile

test/src/sick_scan_test.cpp:364–413  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

362
363
364int createTestLaunchFile(std::string launchFileFullName, std::vector<paramEntryAscii> entryList, std::string& testLaunchFile)
365{
366 printf("Try loading launchfile :%s",launchFileFullName.c_str());
367 TiXmlDocument doc;
368 doc.LoadFile(launchFileFullName.c_str());
369
370 if (doc.Error() == true)
371 {
372 ROS_ERROR("ERROR parsing launch file %s\nRow: %d\nCol: %d", doc.ErrorDesc(), doc.ErrorRow(), doc.ErrorCol());
373 return(-1);
374 }
375 TiXmlNode *node = doc.FirstChild("launch");
376 if (node != NULL)
377 {
378 node = node->FirstChild("node");
379 std::vector<paramEntryAscii> paramOrgList = getParamList(node);
380 for (int i = 0; i < entryList.size(); i++)
381 {
382 bool replaceEntry = false;
383 for (int j = 0; j < paramOrgList.size(); j++)
384 {
385 if (entryList[i].getName().compare(paramOrgList[j].getName()) == 0)
386 {
387 paramOrgList[j].setValues(entryList[i].getName(), entryList[i].getType(), entryList[i].getValue());
388 replaceEntry = true;
389 }
390 }
391 if (replaceEntry == false) // add new one to list
392 {
393 paramEntryAscii tmp(entryList[i].getName(), entryList[i].getType(), entryList[i].getValue());
394 paramOrgList.push_back(tmp);
395 }
396 }
397 // delete all parameters and replace with new one
398 replaceParamList(node, paramOrgList);
399 }
400
401 // append source extension if any
402 size_t pos = launchFileFullName.rfind('.');
403 std::string resultFileName = "";
404 testLaunchFile = "";
405 if (pos != std::string::npos)
406 {
407 resultFileName = launchFileFullName.substr(0, pos);
408 resultFileName += "_test.launch";
409 doc.SaveFile(resultFileName.c_str());
410 testLaunchFile = resultFileName;
411 }
412 return(0);
413}
414
415int cloud_width = 0; // hacky
416int cloud_height = 0;

Callers 1

mainFunction · 0.85

Calls 10

replaceParamListFunction · 0.85
LoadFileMethod · 0.80
FirstChildMethod · 0.80
compareMethod · 0.80
getNameMethod · 0.80
push_backMethod · 0.80
SaveFileMethod · 0.80
getParamListFunction · 0.70
sizeMethod · 0.45
getValueMethod · 0.45

Tested by

no test coverage detected