1 #ifndef _Belle2_DBObject_hh
2 #define _Belle2_DBObject_hh
4 #include <daq/slc/base/AbstractDBObject.h>
5 #include <daq/slc/base/StringUtil.h>
6 #include <daq/slc/base/Date.h>
17 typedef std::vector<DBObject> DBObjectList;
18 typedef std::map<std::string, void*> FieldValueList;
19 typedef std::map<std::string, std::string> FieldTextList;
20 typedef std::map<std::string, DBObjectList> FieldObjectList;
29 typedef std::vector<NameValue> NameValueList;
39 int getNObjects(
const std::string& name)
const;
40 DBObjectList& getObjects(
const std::string& name);
41 const DBObjectList& getObjects(
const std::string& name)
const;
42 DBObject& getObject(
const std::string& name,
int i = 0);
43 const DBObject& getObject(
const std::string& name,
int i = 0)
const;
44 void addObjects(
const std::string& name,
const DBObjectList& obj);
45 void addObject(
const std::string& name,
const DBObject& obj);
48 DBObject& operator()(
const std::string& name,
int index = 0)
50 return getObject(name, index);
52 const DBObject& operator()(
const std::string& name,
int index = 0)
const
54 return getObject(name, index);
58 StringList getNameList(
bool isfull)
const;
59 void print(
bool isfull =
true)
const;
60 const std::string sprint(
bool isfull)
const;
61 void printHTML(
bool isfull =
true)
const;
62 const std::string printSQL(
const std::string& table,
int id)
const;
63 void search(NameValueList& map,
const std::string& name =
"",
bool isfull =
true)
const;
64 int getDate()
const {
return m_date; }
65 void setDate(
const Date& date) { m_date = date.get(); }
66 void setDate(
int date) { m_date = date; }
69 virtual const void* getValue(
const std::string& name)
const;
70 virtual const std::string& getText(
const std::string& name)
const;
71 virtual void addText(
const std::string& name,
const std::string& value);
72 virtual void addValue(
const std::string& name,
const void* value,
73 DBField::Type type,
int length);
74 virtual void setValue(
const std::string& name,
const void* value,
int length);
77 virtual void readObject(Reader& reader);
78 virtual void writeObject(Writer& writer)
const;
81 FieldValueList m_value_m;
82 FieldTextList m_text_m;
83 FieldObjectList m_obj_v_m;
91 void copy(
const DBObject& obj);
95 typedef std::vector<DBObject> DBObjectList;