Fawkes API Fawkes Development Version
mongodb_log_plugin.cpp
1
2/***************************************************************************
3 * mongodb_log_plugin.cpp - Fawkes MongoDB Logging Plugin
4 *
5 * Created: Wed Dec 08 23:04:33 2010
6 * Copyright 2010-2012 Tim Niemueller [www.niemueller.de]
7 ****************************************************************************/
8
9/* This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Library General Public License for more details.
18 *
19 * Read the full text in the LICENSE.GPL file in the doc directory.
20 */
21
22#include "mongodb_log_bb_thread.h"
23#include "mongodb_log_image_thread.h"
24#include "mongodb_log_logger_thread.h"
25#include "mongodb_log_pcl_thread.h"
26#include "mongodb_log_tf_thread.h"
27
28#include <core/plugin.h>
29
30using namespace fawkes;
31
32/** MongoDB Logging Plugin.
33 * This plugin provides logging of BlackBoard data to MongoDB.
34 *
35 * @author Tim Niemueller
36 */
38{
39public:
40 /** Constructor.
41 * @param config Fawkes configuration
42 */
44 {
45 bool enable_bb = true;
46 try {
47 enable_bb = config->get_bool("/plugins/mongodb-log/enable-blackboard");
48 } catch (Exception &e) {
49 }
50 if (enable_bb) {
52 }
53
54 bool enable_pcls = true;
55 try {
56 enable_pcls = config->get_bool("/plugins/mongodb-log/enable-pointclouds");
57 } catch (Exception &e) {
58 }
59 if (enable_pcls) {
61 }
62
63 bool enable_images = true;
64 try {
65 enable_images = config->get_bool("/plugins/mongodb-log/enable-images");
66 } catch (Exception &e) {
67 }
68 if (enable_images) {
70 }
71
72 bool enable_logger = true;
73 try {
74 enable_logger = config->get_bool("/plugins/mongodb-log/enable-logger");
75 } catch (Exception &e) {
76 }
77 if (enable_logger) {
79 }
80
81 bool enable_tf = true;
82 try {
83 enable_tf = config->get_bool("/plugins/mongodb-log/enable-transforms");
84 } catch (Exception &e) {
85 }
86 if (enable_tf) {
88 }
89
90 if (thread_list.empty()) {
91 throw Exception("MongoLogPlugin: no logging thread enabled");
92 }
93
94 std::string database = config->get_string("/plugins/mongodb-log/database");
95 config->set_string("/plugins/mongorrd/databases/mongodb-log", database);
96 }
97
99 {
100 try {
101 config->erase("/plugins/mongorrd/databases/mongodb-log");
102 } catch (fawkes::Exception &e) {
103 } // ignore
104 }
105};
106
107PLUGIN_DESCRIPTION("Logging of BlackBoard data to MongoDB")
108EXPORT_PLUGIN(MongoLogPlugin)
MongoDB Logging Thread.
Thread to export Fawkes images to MongoDB.
Thread that provides a logger writing to MongoDB.
MongoDB Logging Plugin.
MongoLogPlugin(Configuration *config)
Constructor.
Thread to store point clouds to MongoDB.
MongoDB transforms logging thread.
Interface for configuration handling.
Definition: config.h:68
virtual bool get_bool(const char *path)=0
Get value from configuration which is of type bool.
virtual void set_string(const char *path, std::string &s)=0
Set new value in configuration of type string.
virtual std::string get_string(const char *path)=0
Get value from configuration which is of type string.
virtual void erase(const char *path)=0
Erase the given value from the configuration.
Base class for exceptions in Fawkes.
Definition: exception.h:36
Plugin interface class.
Definition: plugin.h:34
ThreadList thread_list
Thread list member.
Definition: plugin.h:53
Configuration * config
Fawkes configuration.
Definition: plugin.h:58
void push_back(Thread *thread)
Add thread to the end.
Fawkes library namespace.