ObjectDatabaseConfig.cpp
Go to the documentation of this file.
00001 
00021 #include <iostream>
00022 #include <ros/ros.h>
00023 #include <stdlib.h>
00024 #include <boost/foreach.hpp>
00025 #include "object_database/ObjectDatabaseConfig.h"
00026 #include "object_database/ObjectDatabaseRecognizer.h"
00027 
00028 namespace object_database {
00029         ObjectDatabaseConfig::ObjectDatabaseConfig(const fs::path configFile) {
00030                 if (configFile != fs::path()) {
00031                         this->read(configFile);
00032                 }
00033         }
00034 
00035         bool ObjectDatabaseConfig::read(const fs::path configFile) {
00036                 try {
00037             std::unique_ptr<configuration> config = configuration_(configFile.string());
00038 
00039                         for (configuration::database_iterator iter = config->database().begin(); iter != config->database().end(); iter++) {
00040                                 database db = *iter;
00041 
00042                                 ObjectDatabaseRecognizerPtr recognizerItemPtr(new ObjectDatabaseRecognizer(db));
00043 
00044                                 mObjectCategories[db.uniqueName()] = recognizerItemPtr;
00045                         }
00046                 } catch (xml_schema::exception& e) {
00047                         std::cerr << e << std::endl;
00048                         return false;
00049                 }
00050                 return true;
00051         }
00052 
00053         const ObjectDatabaseRecognizerPtrMap ObjectDatabaseConfig::getObjectCategories() {
00054                 return mObjectCategories;
00055         }
00056 
00057         const ObjectDatabaseRecognizerPtr ObjectDatabaseConfig::getRecognizer(const std::string recognizerName) {
00058                 ObjectDatabaseRecognizerPtr ptr = mObjectCategories[recognizerName];
00059                 return ptr;
00060         }
00061 }


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 Thu Jun 6 2019 21:11:02