8#ifndef _Belle2_NSMCallback_hh
9#define _Belle2_NSMCallback_hh
11#include "daq/slc/nsm/AbstractNSMCallback.h"
12#include "daq/slc/nsm/NSMCommand.h"
13#include "daq/slc/nsm/NSMData.h"
25 class NSMCommunicator;
28 typedef std::map<std::string, NSMNode> NSMNodeMap;
29 typedef std::map<std::string, NSMData> NSMDataMap;
42 virtual void term() {}
45 virtual void ok(
const char* ,
const char* ) {}
46 virtual void fatal(
const char* ,
const char* ) {}
47 virtual void error(
const char* ,
const char* ) {}
49 virtual void vget(
const std::string& nodename,
50 const std::string& vname);
58 void log(LogFile::Priority pri,
const char* format, ...);
59 void log(LogFile::Priority pri,
const std::string& msg);
63 NSMDataMap& getDataMap() {
return m_datas; }
64 NSMData& getData(
const std::string& name);
65 NSMData& getData() {
return m_data; }
66 void openData(
const std::string& name,
const std::string& format,
68 void allocData(
const std::string& name,
const std::string& format,
70 const std::string& getCategory()
const {
return m_category; }
71 void setCategory(
const std::string& category) { m_category = category; }
74 void notify(
const NSMVar& var)
override;
75 void reg(
const NSMCommand& cmd) { m_cmd_v.push_back(cmd); }
76 void addNode(
const NSMNode& node);
77 const NSMNodeMap& getNodes() {
return m_nodes; }
78 void setLogNode(
const NSMNode& node) { m_lognode = node; }
79 const NSMNode& getLogNode() {
return m_lognode; }
82 typedef std::vector<NSMCommand> NSMCommandList;
85 int addDefaultHandlers();
87 NSMCommandList& getCommandList() {
return m_cmd_v; }
91 NSMCommandList m_cmd_v;
96 std::string m_category;
100 inline NSMData& NSMCallback::getData(
const std::string& name)
102 if (m_datas.find(name) != m_datas.end()) {
103 return m_datas[name];
105 throw (std::out_of_range(
"nodata registered : " + name));
108 inline void NSMCallback::openData(
const std::string& name,
109 const std::string& format,
112 if (m_datas.find(name) == m_datas.end()) {
113 m_datas.insert(NSMDataMap::value_type(name, NSMData(name, format, revision)));
117 inline void NSMCallback::allocData(
const std::string& name,
118 const std::string& format,
121 m_data = NSMData(name, format, revision);
Abstract base class for different kinds of events.