Container for datalog strings.
More...
#include <JDatalogString.hh>
Container for datalog strings.
Definition at line 173 of file JDatalogString.hh.
◆ JDatalogs_t() [1/2]
Constructor.
- Parameters
-
buffer | list of valid source names |
Definition at line 181 of file JDatalogString.hh.
181 {}) :
183 {}
std::set< std::string > sources
◆ JDatalogs_t() [2/2]
JDB::JDatalogs_t::JDatalogs_t |
( |
const std::set< std::string > & | buffer | ) |
|
|
inline |
Constructor.
- Parameters
-
buffer | list of valid source names |
Definition at line 191 of file JDatalogString.hh.
◆ load()
void JDB::JDatalogs_t::load |
( |
const std::string & | file_name | ) |
|
|
inline |
Load message from input file.
- Parameters
-
Definition at line 201 of file JDatalogString.hh.
202 {
205
206 if (getFilenameExtension(file_name) == "log" ||
207 getFilenameExtension(file_name) == "txt") {
208
209 ifstream in(file_name.c_str());
210
211 in.ignore(numeric_limits<std::streamsize>::max(), '\n');
212
213 in >> *this;
214
215 in.close();
216
217 } else if (getFilenameExtension(file_name) == "gz") {
218
220
221 in.ignore(numeric_limits<std::streamsize>::max(), '\n');
222
223 in >> *this;
224
225 in.close();
226
227 } else {
228
230 }
231 }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Exception for opening of file.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
◆ operator>>
std::istream & operator>> |
( |
std::istream & | in, |
|
|
JDatalogs_t & | object ) |
|
friend |
Read message from input.
- Parameters
-
in | input stream |
object | messages |
- Returns
- input stream
Definition at line 241 of file JDatalogString.hh.
242 {
244
245 JDatalogString datalog;
246
247 bool append = false;
248
249 for (
string buffer;
getline(in, buffer); ) {
250
251 istringstream is(buffer);
252
253 if (is >> datalog.run >> datalog.utc >> datalog.source >> datalog.parameter) {
254
255 append = false;
256
258
259 while (is.peek() != EOF && isspace((char) is.peek())) { is.ignore(1); }
260
262
263
264
265 if (
object.
sources.empty() ||
object.sources.count(datalog.source) != 0) {
266
267 object.push_back(datalog);
268
269 append = true;
270 }
271 }
272
273 } else if (append) {
274
275
276
277 if (!object.empty()) {
278 object.rbegin()->data.append(" " + buffer);
279 }
280 }
281 }
282 return in;
283 }
const JKeywords IGNORED_PARAMETER_NAMES
Ignored parameter names.
const JKeywords SOURCE_NAMES
Valid source names.
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line.
◆ sources
std::set<std::string> JDB::JDatalogs_t::sources |
|
protected |
The documentation for this struct was generated from the following file: