fvretriever_plugin.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "fvretriever_plugin.h"
00024 #include "retriever_thread.h"
00025
00026 #include <core/exceptions/software.h>
00027
00028 using namespace fawkes;
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 FvRetrieverPlugin::FvRetrieverPlugin(Configuration *config)
00042 : Plugin(config)
00043 {
00044
00045 std::string prefix = "/firevision/retriever/camera/";
00046 Configuration::ValueIterator *vi = config->search(prefix.c_str());
00047
00048 while (vi->next()) {
00049 if ( ! vi->is_string() ) {
00050 throw TypeMismatchException("Only values of type string are valid for camera"
00051 " argument strings, but got %s for %s",
00052 vi->type(), vi->path());
00053 }
00054
00055 std::string id = std::string(vi->path()).substr(prefix.length());
00056
00057 thread_list.push_back(new FvRetrieverThread(vi->get_string().c_str(), id.c_str()));
00058 }
00059
00060 if ( thread_list.empty() ) {
00061 throw Exception("No cameras have been set for fvretriever");
00062 }
00063
00064 delete vi;
00065 }
00066
00067 PLUGIN_DESCRIPTION("Reads images from cameras and stores them in shared memory")
00068 EXPORT_PLUGIN(FvRetrieverPlugin)