Belle II Software  release-08-01-10
MonitoringObject.cc
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 #include <dqm/core/MonitoringObject.h>
10 
11 #include <framework/utilities/KeyValuePrinter.h>
12 
13 #include <iostream>
14 #include <sstream>
15 
16 using namespace std;
17 using namespace Belle2;
18 
19 void MonitoringObject::print() const
20 {
21 
22  KeyValuePrinter printVar(false);
23  printVar.put("Name", GetName());
24  for (const auto& var : m_vars) {
25  printVar.put(var.first, var.second);
26  }
27  for (const auto& var : m_strVars) {
28  printVar.put(var.first, var.second);
29  }
30 
31  KeyValuePrinter printCanv(false);
32  for (const auto& canv : m_Canvases) {
33  printCanv.put(canv->GetName(), canv->GetTitle());
34  }
35 
36  std::cout << "=== MonitoringObject ===\n";
37  std::cout << printVar.string();
38  std::cout << "\n List of canvases: \n";
39  std::cout << printCanv.string();
40  std::cout << "========================\n";
41 }
create human-readable or JSON output for key value pairs.
void put(const std::string &key, const T &value)
Add one key-value pair.
std::string string() const
Return completed string.
Abstract base class for different kinds of events.