Belle II Software development
Callback.h
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#ifndef _Belle2_Callback_hh
9#define _Belle2_Callback_hh
10
11#include "daq/slc/nsm/NSMVar.h"
12#include "daq/slc/nsm/NSMVHandler.h"
13
14#include "daq/slc/database/DBObject.h"
15
16#include <cstring>
17
18namespace Belle2 {
24 class Callback {
25
26 friend class AbstractNSMCallback;
27 friend class NSMCallback;
28
29 public:
30 Callback() : m_revision(1) {}
31 virtual ~Callback() {}
32
33 public:
34 virtual void notify(const NSMVar& var) = 0;
35 int reset();
36 int add(NSMVHandler* handler, bool overwrite = true, bool isdump = true);
37 void remove(const std::string& node, const std::string& name);
38 void remove(const std::string& name) { remove("", name); }
39 void remove(const DBObject& obj);
40 StringList& getHandlerNames() { return m_hnames; }
41 NSMVHandlerList& getHandlers() { return m_handler; }
42 NSMVHandler& getHandler(const std::string& name)
43 {
44 return getHandler("", name);
45 }
46 NSMVHandler& getHandler(const std::string& node, const std::string& name)
47 ;
48 void setUseGet(const std::string& name, bool use)
49 {
50 getHandler(name).setUseGet(use);
51 }
52 void setUseSet(const std::string& name, bool use)
53 {
54 getHandler(name).setUseSet(use);
55 }
56
57 public:
58 void setRevision(int revision) { m_revision = revision; }
59 int getRevision() const { return m_revision; }
60
61 private:
62 NSMVHandler* getHandler_p(const std::string& node, const std::string& name);
63
64 private:
65 int m_revision;
66 NSMVHandlerList m_handler;
67 StringList m_hnames;
68
69 };
70
72};
73
74#endif
Abstract base class for different kinds of events.