11#ifndef logger_logMeta_hpp
12#define logger_logMeta_hpp
14#include <mx/ioutils/fits/fitsHeaderCard.hpp>
39 const std::string &memb,
42 const std::string &c )
68 logMetaDetail(
const std::string &k,
const std::string &c,
const std::string &f,
int vt,
int mt,
void *acc )
73 logMetaDetail(
const std::string &k,
const std::string &c,
const std::string &f,
int vt,
int mt,
void *acc,
bool h )
78 logMetaDetail(
const std::string &k,
const std::string &c,
int vt,
int mt,
void *acc,
bool h )
88 logMetaDetail(
const std::string &k,
int vt,
int mt,
void *acc,
bool h )
100template <
typename valT,
class verboseT = XWC_DEFAULT_VERBOSITY>
103 const std::string &appName,
107 valT ( *getter )(
void * ),
110 char *atprior =
nullptr;
111 char *stprior =
nullptr;
113 char *_hint =
nullptr;
121 std::cerr << __FILE__ <<
" " << __LINE__ <<
"\n";
124 if( lm.
getPriorLog( stprior, appName, ev, stime, _hint ) != 0 )
126 std::cerr << __FILE__ <<
" " << __LINE__ <<
" getPriorLog returned error for " << appName <<
":" << ev <<
"\n";
134 std::cerr << __FILE__ <<
" " << __LINE__ <<
"\n";
137 if( lm.
getNextLog( atprior, stprior, appName ) != 0 )
139 std::cerr << __FILE__ <<
" " << __LINE__ <<
" getNextLog returned error for " << appName <<
":" << ev <<
"\n";
144 std::cerr << __FILE__ <<
" " << __LINE__ <<
"\n";
158 if( lm.
getNextLog( atprior, stprior, appName ) != 0 )
160 std::cerr << __FILE__ <<
" " << __LINE__ <<
" getNextLog returned error for " << appName <<
":" << ev
173template <
typename valT,
class verboseT = XWC_DEFAULT_VERBOSITY>
176 const std::string &appName,
180 valT ( *getter )(
void * ),
195 if( lm.
getPriorLog( stprior, appName, ev, midexp, _hint ) != 0 )
197 std::cerr << __FILE__ <<
" " << __LINE__ <<
" getPriorLog returned error for " << appName <<
":" << ev <<
"\n";
203 if( lm.
getNextLog( atafter, stprior, appName ) != 0 )
205 std::cerr << __FILE__ <<
" " << __LINE__ <<
" getNextLog returned error for " << appName <<
":" << ev <<
"\n";
217 val = stprV + ( atprV - stprV ) / ( et - st ) * ( it - st );
238 String = mx::fits::fitsType<std::string>(),
239 Bool = mx::fits::fitsType<bool>(),
240 Char = mx::fits::fitsType<char>(),
241 UChar = mx::fits::fitsType<unsigned char>(),
242 Short = mx::fits::fitsType<short>(),
243 UShort = mx::fits::fitsType<unsigned short>(),
244 Int = mx::fits::fitsType<int>(),
245 UInt = mx::fits::fitsType<unsigned int>(),
246 Long = mx::fits::fitsType<long>(),
247 ULong = mx::fits::fitsType<unsigned long>(),
250 Float = mx::fits::fitsType<float>(),
286 const std::string &
device();
299 mx::fits::fitsHeaderCard<verboseT>
#define XWC_DEFAULT_VERBOSITY
uint16_t eventCodeT
The type of an event code (16-bit unsigned int).
static void * messageBuffer(bufferPtrT &logBuffer)
Get the message buffer address.
static int timespec(bufferPtrT &logBuffer, const timespecX &ts)
Set the timespec of a log entry.
Declares and defines the logMap class and related classes.
int getLogContVal(valT &val, logMap< verboseT > &lm, const std::string &appName, flatlogs::eventCodeT ev, const flatlogs::timespecX &stime, const flatlogs::timespecX &atime, valT(*getter)(void *), char **hint=0)
int getLogStateVal(valT &val, logMap< verboseT > &lm, const std::string &appName, flatlogs::eventCodeT ev, const flatlogs::timespecX &stime, const flatlogs::timespecX &atime, valT(*getter)(void *), char **hint=0)
Map of log entries by application name, mapping both to files and to loaded buffers.
int getPriorLog(char *&logBefore, const std::string &appName, const flatlogs::eventCodeT &ev, const flatlogs::timespecX &ts, char *hint=0)
Get the log for an event code which is the first prior to the supplied time.
int getNextLog(char *&logAfter, char *logCurrent, const std::string &appName)
Get the next log with the same event code which is after the supplied time.
A fixed-width timespec structure.
double asDouble()
Get the time as a double from a timespecX.