Kind-of worked on the R-Tree; not really enough time to do much.
[aesalon.git] / src / monitor / DataOutputController.cpp
blob6d966a320e48a050541c7a4627fa77b21a056191
1 /** Aesalon, a tool to visualize program behaviour in real time.
2 Copyright (C) 2009-2011, Aesalon development team.
4 Aesalon is distributed under the terms of the GNU GPLv3. See
5 the included file LICENSE for more information.
7 @file src/monitor/DataOutputController.cpp
8 */
10 #include "monitor/DataOutputController.h"
11 #include "config/GlobalVault.h"
12 #include "monitor/LogOutput.h"
14 #include "util/MessageSystem.h"
16 namespace Monitor {
18 DataOutputController::DataOutputController() {
19 std::vector<std::string> outputVector;
21 Config::GlobalVault::instance()->get("monitor:output", outputVector);
23 for(int i = 0; i < int(outputVector.size()); i ++) {
24 DataOutput *output = createOutput(outputVector[i]);
25 if(output != NULL) m_dataOutputVector.push_back(output);
28 if(outputVector.size() == 0) Message(Warning, "No data outputs specified!");
31 DataOutputController::~DataOutputController() {
32 for(int i = 0; i < int(m_dataOutputVector.size()); i ++) {
33 delete m_dataOutputVector[i];
37 void DataOutputController::output(Comm::Packet *packet) {
38 for(int i = 0; i < int(m_dataOutputVector.size()); i ++) {
39 m_dataOutputVector[i]->output(packet);
43 DataOutput *DataOutputController::createOutput(const std::string &spec) {
44 std::string type, content;
45 std::string::size_type index = spec.find(":");
46 type = spec.substr(0, index);
47 content = spec.substr(index+1);
49 if(type == "tcp") {
50 Message(Fatal, "TCP data output NYI.");
52 else if(type == "log") {
53 return new LogOutput(content);
55 else Message(Warning, "Unknown output type \"" << type << "\"");
56 return NULL;
59 } // namespace Monitor