ObjectModelParser.h
Go to the documentation of this file.
1 /*
2  * ObjectModelParser.h
3  *
4  * Created on: Mar 6, 2012
5  * Author: sdries
6  */
7 
8 #ifndef OBJECTMODELPARSER_H_
9 #define OBJECTMODELPARSER_H_
10 
12 
13 // xml parser
14 #include <tinyxml2.h>
15 
16 #include <pluginlib/class_loader.h>
17 
18 #include <map>
19 
20 namespace mhf {
21 
22 class ClassModel;
23 class KnowledgeDatabase;
24 
26 
27 public:
28 
29  ObjectModelParser(const std::string& filename);
30 
31  virtual ~ObjectModelParser();
32 
33  bool parse(KnowledgeDatabase& obj_models);
34 
35  std::string getErrorMessage() const;
36 
37 protected:
38 
39  std::string filename_;
40 
41  std::stringstream parse_errors_;
42 
44 
45  std::string getPropertyValue(const tinyxml2::XMLElement* elem, std::string prop_name, double& value, std::stringstream& error, bool optional = false);
46 
47  bool getAttributeValue(const tinyxml2::XMLElement* elem, std::string att_name, std::string& att_value, std::stringstream& error);
48 
49  bool getAttributeValue(const tinyxml2::XMLElement* elem, std::string att_name, double& att_value, std::stringstream& error);
50 
51  bool hasAttributeValue(const tinyxml2::XMLElement* elem, std::string att_name, std::string att_value);
52 
53  bool parseStateEstimator(ClassModel* obj_model, const tinyxml2::XMLElement* elem, std::stringstream& error);
54 
55  pbl::PDF* parsePDF(const tinyxml2::XMLElement* elem, std::stringstream& error);
56 
57  bool getStateEstimatorParameter(const tinyxml2::XMLElement* elem, const std::string& param_name, double& value);
58 
59 };
60 
61 }
62 
63 #endif /* OBJECTMODELPARSER_H_ */
std::string getPropertyValue(const tinyxml2::XMLElement *elem, std::string prop_name, double &value, std::stringstream &error, bool optional=false)
bool parseStateEstimator(ClassModel *obj_model, const tinyxml2::XMLElement *elem, std::stringstream &error)
std::string getErrorMessage() const
eT value() const
filename
pbl::PDF * parsePDF(const tinyxml2::XMLElement *elem, std::stringstream &error)
pluginlib::ClassLoader< IStateEstimator > * object_model_loader_
bool getAttributeValue(const tinyxml2::XMLElement *elem, std::string att_name, std::string &att_value, std::stringstream &error)
bool getStateEstimatorParameter(const tinyxml2::XMLElement *elem, const std::string &param_name, double &value)
bool hasAttributeValue(const tinyxml2::XMLElement *elem, std::string att_name, std::string att_value)
Contains knowledge about a specific object class on where to expect new objects of that class (new) a...
Definition: ClassModel.h:57
bool parse(KnowledgeDatabase &obj_models)
arma_inline subview_elem1< eT, T1 > elem(const Base< uword, T1 > &a)
ObjectModelParser(const std::string &filename)
std::stringstream parse_errors_
Definition: ClassModel.h:44


wire_core
Author(s): Sjoerd van den Dries, Jos Elfring
autogenerated on Fri Apr 16 2021 02:32:27