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
30
using namespace
fawkes
;
31
32
/** MongoDB Logging Plugin.
33
* This plugin provides logging of BlackBoard data to MongoDB.
34
*
35
* @author Tim Niemueller
36
*/
37
class
MongoLogPlugin
:
public
fawkes::Plugin
38
{
39
public
:
40
/** Constructor.
41
* @param config Fawkes configuration
42
*/
43
explicit
MongoLogPlugin
(
Configuration
*config) :
Plugin
(config)
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) {
51
thread_list.push_back(
new
MongoLogBlackboardThread
());
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) {
60
thread_list.push_back(
new
MongoLogPointCloudThread
());
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) {
69
thread_list.push_back(
new
MongoLogImagesThread
());
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) {
78
thread_list.push_back(
new
MongoLogLoggerThread
());
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) {
87
thread_list.push_back(
new
MongoLogTransformsThread
());
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
98
~
MongoLogPlugin
()
99
{
100
try
{
101
config->
erase
(
"/plugins/mongorrd/databases/mongodb-log"
);
102
}
catch
(
fawkes::Exception
&e) {
103
}
// ignore
104
}
105
};
106
107
PLUGIN_DESCRIPTION(
"Logging of BlackBoard data to MongoDB"
)
108
EXPORT_PLUGIN(
MongoLogPlugin
)
fawkes::Configuration::set_string
virtual void set_string(const char *path, std::string &s)=0
MongoLogImagesThread
Definition:
mongodb_log_image_thread.h:55
fawkes::Configuration::get_bool
virtual bool get_bool(const char *path)=0
MongoLogPointCloudThread
Definition:
mongodb_log_pcl_thread.h:53
MongoLogTransformsThread
Definition:
mongodb_log_tf_thread.h:41
MongoLogPlugin
MongoDB Logging Plugin.
Definition:
mongodb_log_plugin.cpp:37
MongoLogPlugin::MongoLogPlugin
MongoLogPlugin(Configuration *config)
Constructor.
Definition:
mongodb_log_plugin.cpp:43
fawkes::Configuration
Definition:
config.h:70
fawkes::Configuration::erase
virtual void erase(const char *path)=0
fawkes
MongoLogLoggerThread
Definition:
mongodb_log_logger_thread.h:39
fawkes::Configuration::get_string
virtual std::string get_string(const char *path)=0
fawkes::Plugin
Definition:
plugin.h:39
MongoLogBlackboardThread
Definition:
mongodb_log_bb_thread.h:39
fawkes::Exception
Definition:
exception.h:41
src
plugins
mongodb_log
mongodb_log_plugin.cpp
Generated by
1.8.17