8#ifndef _Belle2_NSMVHandler_h
9#define _Belle2_NSMVHandler_h
11#include <daq/slc/nsm/NSMVar.h>
32 NSMVHandler(
const std::string& node,
const std::string& name,
33 bool useget,
bool useset)
34 : m_id(0), m_timestamp(0), m_node(node), m_name(name),
35 m_useget(useget), m_useset(useset), m_var(name) {}
39 virtual bool handleGet(
NSMVar& var)
44 virtual bool handleSet(
const NSMVar& var)
51 const std::string& getNode()
const {
return m_node; }
52 const std::string& getName()
const {
return m_name; }
53 bool useGet()
const {
return m_useget; }
54 bool useSet()
const {
return m_useset; }
55 void setUseGet(
bool use) { m_useget = use; }
56 void setUseSet(
bool use) { m_useset = use; }
57 int getTimeStamp()
const {
return m_timestamp; }
58 int getId()
const {
return m_id; }
59 void setNode(
const std::string& node) { m_node = node; }
60 void setId(
int id) { m_id = id; }
61 void set(
const NSMVar& var) { m_var = var; }
62 void set(
int val) { m_var = val; }
63 void set(
float val) { m_var = val; }
64 void set(
const std::string& val) { m_var = val; }
65 void set(
const std::vector<int>& val) { m_var = val; }
66 void set(
const std::vector<float>& val) { m_var = val; }
67 const NSMVar& get()
const {
return m_var; }
68 NSMVar& get() {
return m_var; }
69 NSMVar::Type getType()
const {
return m_var.getType(); }
70 const char* getTypeLabel()
const {
return m_var.getTypeLabel(); }
71 bool isDumped()
const {
return m_isdump; }
72 void setDumped(
bool isdump) { m_isdump = isdump; }
86 typedef std::map<std::string, NSMVHandler*> NSMVHandlerList;
92 bool useget,
bool useset,
int val = 0)
98 bool useget,
bool useset,
int val = 0)
106 bool handleGet(
NSMVar& var)
override;
107 bool handleSet(
const NSMVar& var)
override;
110 virtual bool handleGetInt(
int& val)
112 val = m_var.getInt();
115 virtual bool handleSetInt(
int val)
127 bool useget,
bool useset,
float val = 0)
133 bool useget,
bool useset,
float val = 0)
141 bool handleGet(
NSMVar& var)
override;
142 bool handleSet(
const NSMVar& var)
override;
145 virtual bool handleGetFloat(
float& val)
147 val = m_var.getFloat();
150 virtual bool handleSetFloat(
float val)
162 bool useget,
bool useset,
const std::string& val =
"")
168 bool useget,
bool useset,
const std::string& val =
"")
176 bool handleGet(
NSMVar& var)
override;
177 bool handleSet(
const NSMVar& var)
override;
180 virtual bool handleGetText(std::string& val)
182 val = m_var.getText();
185 virtual bool handleSetText(
const std::string& val)
197 bool useget,
bool useset,
198 const std::vector<int>& val = std::vector<int>())
204 bool useget,
bool useset,
205 const std::vector<int>& val = std::vector<int>())
213 bool handleGet(
NSMVar& var)
override;
214 bool handleSet(
const NSMVar& var)
override;
217 virtual bool handleGetIntArray(std::vector<int>& val);
218 virtual bool handleSetIntArray(
const std::vector<int>& val)
230 bool useget,
bool useset,
231 const std::vector<float>& val = std::vector<float>())
237 bool useget,
bool useset,
238 const std::vector<float>& val = std::vector<float>())
246 bool handleGet(
NSMVar& var)
override;
247 bool handleSet(
const NSMVar& var)
override;
250 virtual bool handleGetFloatArray(std::vector<float>& val);
251 virtual bool handleSetFloatArray(
const std::vector<float>& val)
265 const std::string& name,
266 const std::string& refname)
268 m_callback(callback), m_refname(refname) {}
272 bool handleGet(
NSMVar& var)
override;
273 bool handleSet(
const NSMVar& var)
override;
277 std::string m_refname;
Abstract base class for different kinds of events.