Started to implement the DataOutput system, a replacement for DataSink.
[aesalon.git] / src / monitor / DataOutputController.cpp
blob4ed8746ebbd0552165cb67c3fa20ddf3d9a1da8a
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/Vault.h"
12 #include "monitor/Coordinator.h"
13 #include "monitor/LogOutput.h"
15 #include "util/MessageSystem.h"
17 namespace Monitor {
19 DataOutputController::DataOutputController() {
20 std::vector<std::string> outputVector;
22 Coordinator::instance()->vault()->get("::output", outputVector);
24 for(int i = 0; i < int(outputVector.size()); i ++) {
25 m_dataOutputVector.push_back(createOutput(outputVector[i]));
28 if(outputVector.size() == 0) Message(Warning, "No data outputs specified!");
31 DataOutputController::~DataOutputController() {
35 void DataOutputController::output(Comm::Packet *packet) {
39 DataOutput *DataOutputController::createOutput(const std::string &spec) {
40 std::string type, content;
41 std::string::size_type index = spec.find(":");
42 type = spec.substr(0, index);
43 content = spec.substr(index+1);
45 if(type == "tcp") {
46 Message(Fatal, "TCP data output NYI.");
48 else if(type == "log") {
49 return new LogOutput(content);
51 return NULL;
54 } // namespace Monitor