XMLScenarioParser Class Reference

This class provides different methods to parse and save scenario data in XML-Files. To save Scenario data between sessions, scenarios should be saved in XML-Files using the following format: More...

#include <ArmarXCore/util/ScenarioManagerCommon/parser/XMLScenarioParser.h>

Static Public Member Functions

static ScenarioManager::Data_Structure::ScenarioPtr createNewScenario (const std::string &name, ScenarioManager::Data_Structure::PackagePtr package)
 Creates a new scenario with the given name within the given package. More...
 
static std::string getPackageNameFromScx (const std::string &path)
 
static ScenarioManager::Data_Structure::PackagePtr getScenarioPackage (const ScenarioManager::Data_Structure::ScenarioPtr &scenario, const ScenarioManager::Data_Structure::PackageVectorPtr &packages)
 Finds the package that contains the given scenario. More...
 
static std::vector< std::string > getScenariosFromFolder (const std::string &folder)
 Finds all .xml scenario files in a folder and returns a list of paths to them. More...
 
static bool isScenarioexistent (const std::string &name, ScenarioManager::Data_Structure::PackagePtr package, const std::string &subPath="")
 isScenarioexistent More...
 
static ScenarioManager::Data_Structure::ScenarioPtr parseScenario (Data_Structure::PackagePtr package, std::string name, std::string subfolder="")
 Parses a .xml scenario file and creates a Scenario object out of it. More...
 
static ScenarioManager::Data_Structure::ScenarioPtr parseScenario (ScenarioManager::Data_Structure::ScenarioPtr scenario)
 
static void saveScenario (const Data_Structure::ScenarioWPtr &scenario, bool saveApplications)
 Saves a Scenario by recreating its .xml file based on its data. More...
 

Detailed Description

This class provides different methods to parse and save scenario data in XML-Files. To save Scenario data between sessions, scenarios should be saved in XML-Files using the following format:

<scenario name="name" lastChange="YYYY-MM-DD.hh:mm:ss" creation="YYYY-MM-DD.hh:mm:ss"> ... <application instance="instanceName" name="applicationName" execPath="./pathToExec"></application> ... </scenario>

This class only parses XML-Files of the specified format.

Definition at line 56 of file XMLScenarioParser.h.

Member Function Documentation

◆ createNewScenario()

ScenarioPtr createNewScenario ( const std::string &  name,
ScenarioManager::Data_Structure::PackagePtr  package 
)
static

Creates a new scenario with the given name within the given package.

Parameters
namename of the new scenario
packagepackage the new scenario is created in
Returns
new Scenario

Definition at line 280 of file XMLScenarioParser.cpp.

+ Here is the call graph for this function:

◆ getPackageNameFromScx()

std::string getPackageNameFromScx ( const std::string &  path)
static

Definition at line 369 of file XMLScenarioParser.cpp.

+ Here is the caller graph for this function:

◆ getScenarioPackage()

PackagePtr getScenarioPackage ( const ScenarioManager::Data_Structure::ScenarioPtr scenario,
const ScenarioManager::Data_Structure::PackageVectorPtr packages 
)
static

Finds the package that contains the given scenario.

Parameters
scenarioScenario whose package is to be searched
packageslist of packages which are searched for the scenario
Returns
the Package which contains the Scenario

Definition at line 355 of file XMLScenarioParser.cpp.

+ Here is the call graph for this function:

◆ getScenariosFromFolder()

std::vector< std::string > getScenariosFromFolder ( const std::string &  folder)
static

Finds all .xml scenario files in a folder and returns a list of paths to them.

Parameters
folderpath to the folder
Returns
list of paths of the scenario files

Definition at line 84 of file XMLScenarioParser.cpp.

+ Here is the call graph for this function:

◆ isScenarioexistent()

bool isScenarioexistent ( const std::string &  name,
ScenarioManager::Data_Structure::PackagePtr  package,
const std::string &  subPath = "" 
)
static

isScenarioexistent

Parameters
namename of the scenario
packagepackage the scenario is located in
Returns
returns true if the scenario exists in the file system else it returns false

Definition at line 273 of file XMLScenarioParser.cpp.

◆ parseScenario() [1/2]

static ScenarioManager::Data_Structure::ScenarioPtr parseScenario ( Data_Structure::PackagePtr  package,
std::string  name,
std::string  subfolder = "" 
)
static

Parses a .xml scenario file and creates a Scenario object out of it.

Parameters
pathto the scenario file
Returns
a new Scenario object containing the data parsed out of the file

◆ parseScenario() [2/2]

◆ saveScenario()

void saveScenario ( const Data_Structure::ScenarioWPtr scenario,
bool  saveApplications 
)
static

Saves a Scenario by recreating its .xml file based on its data.

Parameters
scenarioScenario which is to be saved

Definition at line 322 of file XMLScenarioParser.cpp.

+ Here is the call graph for this function:

The documentation for this class was generated from the following files: