Jpp  master_rocky-40-g5f0272dcd
the software that should make you happy
JRunQuality.cc
Go to the documentation of this file.
1 #include <string>
2 #include <exception>
3 
6 #include "JLang/JNullStream.hh"
7 #include "JLang/JLangToolkit.hh"
8 
10 #include "JROOT/JRootStreamer.hh"
11 
12 #include "JDB/JDB.hh"
13 #include "JDB/JDBToolkit.hh"
14 #include "JDB/JRunQuality.hh"
15 
16 
17 namespace JDATABASE {
18 
19  /**
20  * Put value at given key.
21  *
22  * \param key key
23  * \param value value
24  */
25  void JRunQuality::put(const std::string& key,
26  const std::string& value)
27  {
28  using namespace std;
29  using namespace JPP;
30 
31  const JEquationParameters parameters(":", "\n", "", "");
32 
33  JRootReader reader(null, parameters, JRootDictionary::getInstance());
34  JRootReadableClass cls(*this);
35 
36  const string buffer = replace(key, "-", "_");
37 
38  for (string::size_type il = 0, ir = 0; ir != string::npos && cls.is_valid(); il = ir + 1) {
39  ir = buffer.substr(il).find(parameters.getDefaultDivision());
40  cls = cls.find(buffer.substr(il, ir - il).c_str());
41  }
42 
43  if (cls.is_valid()) {
44 
45  JRedirectString redirect(reader, value);
46 
47  reader.getObject(cls);
48  }
49  }
50 }
TString replace(const TString &target, const TRegexp &regexp, const T &replacement)
Replace regular expression in input by given replacement.
Definition: JPrintResult.cc:63
ASCII I/O of objects with ROOT dictionary.
Simple data structure to support I/O of equations (see class JLANG::JEquation).
const char getDefaultDivision() const
Get default division character.
This class can be used to temporarily redirect an input stream to an input string.
Implementation for ASCII input of objects with ROOT dictionary.
JRootReader & getObject(T &object)
Read object.
Auxiliary classes and methods for database I/O.
Definition: JAHRS.hh:14
T & getInstance(const T &object)
Get static instance from temporary object.
Definition: JObject.hh:75
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JSTDTypes.hh:14
double value
setup identifier (see JRunsetups)
Definition: JRunQuality.hh:183
void put(const std::string &key, const std::string &value)
Put value at given key.
Definition: JRunQuality.cc:25
bool is_valid() const
Check validity of this addressable class.
Definition: JRootClass.hh:471
JRootAddressableClass find(const char *const name) const
Find addressable base class or data member with given name within current class.
Definition: JRootClass.hh:483
ROOT class for reading object.
Definition: JRootClass.hh:544