ObjectDatabaseConfig.cpp
Go to the documentation of this file.
1 
21 #include <iostream>
22 #include <ros/ros.h>
23 #include <stdlib.h>
24 #include <boost/foreach.hpp>
27 
28 namespace object_database {
29  ObjectDatabaseConfig::ObjectDatabaseConfig(const fs::path configFile) {
30  if (configFile != fs::path()) {
31  this->read(configFile);
32  }
33  }
34 
35  bool ObjectDatabaseConfig::read(const fs::path configFile) {
36  try {
37  std::unique_ptr<configuration> config = configuration_(configFile.string());
38 
39  for (configuration::database_iterator iter = config->database().begin(); iter != config->database().end(); iter++) {
40  database db = *iter;
41 
42  ObjectDatabaseRecognizerPtr recognizerItemPtr(new ObjectDatabaseRecognizer(db));
43 
44  mObjectCategories[db.uniqueName()] = recognizerItemPtr;
45  }
46  } catch (xml_schema::exception& e) {
47  std::cerr << e << std::endl;
48  return false;
49  }
50  return true;
51  }
52 
54  return mObjectCategories;
55  }
56 
58  ObjectDatabaseRecognizerPtr ptr = mObjectCategories[recognizerName];
59  return ptr;
60  }
61 }
database_sequence::iterator database_iterator
std::map< std::string, ObjectDatabaseRecognizerPtr > ObjectDatabaseRecognizerPtrMap
Definition: typedef.h:34
const uniqueName_type & uniqueName() const
::std::unique_ptr< ::asr_object_database::configuration > configuration_(const ::std::string &u,::xml_schema::flags f, const ::xml_schema::properties &p)
const ObjectDatabaseRecognizerPtr getRecognizer(const std::string recognizerName)
::xsd::cxx::tree::exception< char > exception
bool read(const fs::path config_file)
::xsd::cxx::tree::string< char, simple_type > string
ObjectDatabaseConfig(const fs::path configFile=fs::path())
ObjectDatabaseRecognizerPtrMap mObjectCategories
const ObjectDatabaseRecognizerPtrMap getObjectCategories()


asr_object_database
Author(s): Allgeyer Tobias, Aumann Florian, Borella Jocelyn, Braun Kai, Heizmann Heinrich, Heller Florian, Kasper Alexander, Marek Felix, Mehlhaus Jonas, Meißner Pascal, Schleicher Ralf, Stöckle Patrick, Walter Milena
autogenerated on Wed Jan 8 2020 03:12:13