DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
defs.hpp
Go to the documentation of this file.
1// DUNE DAQ modification notice:
2// This file has been modified from the original ATLAS oks source for the DUNE DAQ project.
3// Fork baseline commit: oks-08-03-04 (2022-04-14).
4// Renamed since fork: yes (from oks/defs.h to include/oks/defs.hpp).
5
6#ifndef OKS_DEFS_H
7#define OKS_DEFS_H
8
9#include <iosfwd>
10#include <string>
11
12#include "ers/ers.hpp"
13
14#include "oks/exceptions.hpp"
15
24
25namespace dunedaq {
26namespace oks {
30
31const std::string
32strerror(int error);
33
35
41
42class Oks
43{
44
45public:
46 static std::ostream& error_msg(const char*);
47 static std::ostream& warning_msg(const char*);
48 static std::ostream& error_msg(const std::string& s) { return error_msg(s.c_str()); }
49 static std::ostream& warning_msg(const std::string& s) { return warning_msg(s.c_str()); }
50
51 static void substitute_variables(std::string&);
52 static bool real_path(std::string&, bool ignore_errors);
53
57
59 {
60
61 public:
62 Tokenizer(const std::string& s, const char* separator);
63 const std::string next();
64 bool next(std::string&);
65
66 private:
67 std::string p_string;
68 const char* p_delimeters;
69 std::string::size_type p_idx;
70
71 static std::string s_empty;
72 };
73};
74
75} // namespace oks
76} // namespace dunedaq
77
78// defines MACRO and CONSTANTS for verbose report
79
80#ifndef ERS_NO_DEBUG
81#include <boost/date_time/posix_time/posix_time_types.hpp>
82#include <boost/date_time/posix_time/time_formatters.hpp>
83#define OSK_VERBOSE_REPORT(MSG) \
84 if (p_verbose) { \
85 boost::posix_time::ptime now = boost::posix_time::second_clock::universal_time(); \
86 std::cout << "[OKS " << boost::posix_time::to_simple_string(now) << "]: " << MSG << std::endl; \
87 std::cout.flush(); \
88 }
89#else
90#define OSK_VERBOSE_REPORT(MSG) ;
91#endif
92
93// defines MACRO for OKS profiler
94
95#ifndef ERS_NO_DEBUG
96#define OSK_PROFILING(FID, K) OksFunctionProfiler yyy(FID, K);
97#else
98#define OSK_PROFILING(FID, K) ;
99#endif
100
101#endif
std::string::size_type p_idx
Definition defs.hpp:69
const std::string next()
Definition time.cpp:190
const char * p_delimeters
Definition defs.hpp:68
Tokenizer(const std::string &s, const char *separator)
Definition time.cpp:182
static std::string s_empty
Definition defs.hpp:71
Class contains common OKS classes and methods.
Definition defs.hpp:43
static std::ostream & warning_msg(const std::string &s)
Definition defs.hpp:49
static std::ostream & error_msg(const std::string &s)
Definition defs.hpp:48
static void substitute_variables(std::string &)
Definition kernel.cpp:525
static std::ostream & warning_msg(const char *)
Definition kernel.cpp:518
static bool real_path(std::string &, bool ignore_errors)
Definition kernel.cpp:546
static std::ostream & error_msg(const char *)
Definition kernel.cpp:511
const std::string strerror(int error)
Convert C error number to string.
Definition kernel.cpp:111
The DUNE-DAQ namespace.
CIB Buffer std::string descriptor Message from std::string descriptor CIB process error