8#ifndef _Belle2_NSMData_hh
9#define _Belle2_NSMData_hh
11#include <daq/slc/base/AbstractDBObject.h>
15#if NSM_PACKAGE_VERSION >= 1914
16#include <nsm2/nsmparse.h>
29 class NSMCommunicator;
33 typedef std::vector<NSMData> NSMDataList;
34 typedef std::map<std::string, NSMDataList> NSMDataListMap;
43 typedef std::vector<NameValue> NameValueList;
46 NSMData(
const std::string& dataname,
47 const std::string& format,
int revision);
59 NSMData(
void* pdata,
const std::string& dataname,
60 const std::string& format,
int revision);
63 int getRevision()
const {
return m_revision; }
64 const std::string& getFormat()
const {
return m_format; }
65 int getSize()
const {
return m_size; }
66 void setRevision(
int revision) { m_revision = revision; }
67 void setFormat(
const std::string& format) { m_format = format; }
68 void setSize(
int size) { m_size = size; }
69 bool isAvailable() {
return (m_pdata != NULL); }
70 void* open(NSMCommunicator& comm);
71 void* allocate(NSMCommunicator& comm,
int interval = 2);
73 void* get() {
return m_pdata; }
74 const void* get()
const {
return m_pdata; }
75 void* parse(
const char* inc_dir = NULL,
bool allocated =
false);
77 int getNObjects(
const std::string& name)
const;
78 const NSMDataList& getObjects(
const std::string& name)
const;
79 NSMDataList& getObjects(
const std::string& name);
80 const NSMData& getObject(
const std::string& name,
int index = 0)
const;
81 NSMData& getObject(
const std::string& name,
int index = 0);
83 void print(
const std::string& name_in =
"")
const;
84 void printPV(
const std::string& name_in =
"")
const;
85 const void* find(
const std::string& name_in, DBField::Type& type,
int& length)
const;
86 void search(NameValueList& map,
const std::string& name =
"")
const;
89 void* getValue(
const std::string& name);
90 const void* getValue(
const std::string& name)
const override;
91 void setValue(
const std::string& name,
const void* value,
int size)
override;
92 void addValue(
const std::string& name,
const void* value,
93 DBField::Type type,
int length = 0)
override;
94 const std::string& getText(
const std::string&)
const override {
return m_empty; }
95 void addText(
const std::string&,
const std::string&)
override {}
98 void readObject(Reader& reader)
override;
99 void writeObject(Writer& writer)
const override;
102 void reset()
override;
105 void set(
void* pdata) { m_pdata = pdata; }
106 int initProperties();
107#if NSM_PACKAGE_VERSION >= 1914
109 std::string& name_in);
117 std::string m_format;
119 NSMDataListMap m_data_v_m;
121 NSMCommunicator* m_com;
126 typedef std::vector<NSMData> NSMDataList;
127 typedef std::map<std::string, NSMDataList> NSMDataListMap;
const NSMData & operator=(const NSMData &data)
Operator =.
Abstract base class for different kinds of events.