11 #ifndef logger_logMeta_hpp
12 #define logger_logMeta_hpp
14 #include <mx/ioutils/fits/fitsHeaderCard.hpp>
40 const std::string & memb,
41 const std::string & k,
42 const std::string & f,
50 const std::string & memb
73 const std::string & c,
74 const std::string & f,
83 const std::string & c,
84 const std::string & f,
94 const std::string & c,
123 const std::string & memberName
126 template<
typename valT>
129 const std::string & appName,
133 valT (*getter)(
void *),
137 char * atprior =
nullptr;
138 char * stprior =
nullptr;
140 char * _hint =
nullptr;
142 if(hint) _hint = *hint;
146 std::cerr << __FILE__ <<
" " << __LINE__ <<
"\n";
149 if(lm.
getPriorLog(stprior, appName, ev, stime, _hint) != 0)
151 std::cerr << __FILE__ <<
" " << __LINE__ <<
" getPriorLog returned error for " << appName <<
":" << ev <<
"\n";
159 std::cerr << __FILE__ <<
" " << __LINE__ <<
"\n";
162 if(lm.
getNextLog(atprior, stprior, appName) != 0)
164 std::cerr << __FILE__ <<
" " << __LINE__ <<
" getNextLog returned error for " << appName <<
":" << ev <<
"\n";
169 std::cerr << __FILE__ <<
" " << __LINE__ <<
"\n";
178 if(hint) *hint = stprior;
182 if(lm.
getNextLog(atprior, stprior, appName) != 0)
184 std::cerr << __FILE__ <<
" " << __LINE__ <<
" getNextLog returned error for " << appName <<
":" << ev <<
"\n";
191 if(hint) *hint = stprior;
195 template<
typename valT>
198 const std::string & appName,
202 valT (*getter)(
void *),
210 if(hint) _hint = *hint;
216 if(lm.
getPriorLog(stprior, appName, ev, midexp, _hint)!=0)
218 std::cerr << __FILE__ <<
" " << __LINE__ <<
" getPriorLog returned error for " << appName <<
":" << ev <<
"\n";
224 if(lm.
getNextLog(atafter, stprior, appName)!=0)
226 std::cerr << __FILE__ <<
" " << __LINE__ <<
" getNextLog returned error for " << appName <<
":" << ev <<
"\n";
238 val = stprV + (atprV-stprV)/(et-st)*(
it-st);
240 if(hint) *hint = stprior;
257 String = mx::fits::fitsType<std::string>(),
258 Bool = mx::fits::fitsType<bool>(),
259 Char = mx::fits::fitsType<char>(),
260 UChar = mx::fits::fitsType<unsigned char>(),
261 Short = mx::fits::fitsType<short>(),
262 UShort = mx::fits::fitsType<unsigned short>(),
263 Int = mx::fits::fitsType<int>(),
264 UInt = mx::fits::fitsType<unsigned int>(),
265 Long = mx::fits::fitsType<long>(),
266 ULong = mx::fits::fitsType<unsigned long>(),
269 Float = mx::fits::fitsType<float>(),
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 getLogStateVal(valT &val, logMap &lm, const std::string &appName, flatlogs::eventCodeT ev, const flatlogs::timespecX &stime, const flatlogs::timespecX &atime, valT(*getter)(void *), char **hint=0)
logMetaDetail logMemberAccessor(flatlogs::eventCodeT ec, const std::string &memberName)
int getLogContVal(valT &val, logMap &lm, const std::string &appName, flatlogs::eventCodeT ev, const flatlogs::timespecX &stime, const flatlogs::timespecX &atime, valT(*getter)(void *), char **hint=0)
timespecX meanTimespecX(timespecX ts1, timespecX ts2)
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.