FileLogReader
class FileLogReader : public DataLogReader
A reader for data logs stored in text files by the class karabo::devices::FileDataLogger.
Functions
| Name | Description |
|---|---|
| readToHash | Internal helper: Place 'value' interpreted as 'type' (and with given 'timestamp') into 'hashOut' at 'path'. |
| findLoggerIndexTimepoint | Retrieves, from the logger index, the event of type "device became online" that is closest, but not after a given timepoint. |
| findNearestLoggerIndex | Find logger closest index from archive_index.txt file that is before/after (according to 'before') 'timepoint'. If there is none before (after) but that is asked for, take the one just after (before). |
| findPositionOfEpochstamp | Find index of that MetaData::Record in 'f' (between indices 'left' and 'right') that matches the Epochstamp 'stamp'. In case no exact match (within 1 ms) is found, 'preferBefore' decides whether the index with a smaller or larger time stamp is returned. |
| extractTailOfArchiveIndex | Helper to extract DataLoggerIndex values out of the tail of a line in archive_index.txt. The tail is everything after event, timestampAsIso8061 and timestampAsDouble. The entry has to be partly filled (m_event and m_epoch) and partly serves as output (m_train, m_position, m_user and m_fileindex). Works for lines written to archive_index.txt by >= 1.5 |
Function Details
extractTailOfArchiveIndex
void extractTailOfArchiveIndex(const std::string& tail, FileLoggerIndex& entry) const
Helper to extract DataLoggerIndex values out of the tail of a line in archive_index.txt.
The tail is everything after event, timestampAsIso8061 and timestampAsDouble.
The entry has to be partly filled (m_event and m_epoch) and partly serves as output
(m_train, m_position, m_user and m_fileindex).
Works for lines written to archive_index.txt by >= 1.5
findLoggerIndexTimepoint
std::pair<bool, FileLoggerIndex> findLoggerIndexTimepoint(const std::string& deviceId, const std::string& timepoint)
Retrieves, from the logger index, the event of type "device became online" that is closest, but not after a given timepoint. The retrieved logger index event can be used as a starting point for sweeping the device log for the last known given configuration at that timepoint.
deviceId
: the device whose logger index event should be retrieved.
timepoint
: the timepoint that will be used as the reference to find the logger index event.
Return : a pair whose 'first' is a boolean that indicates whether configuration was active at the timepoint (true) or whether it is a configuration from the most recent activation of the device prior to the timepoint because the device was not active logging at the timepoint. The pair's 'second' value is the logger index of the given device that is the closest "device became online" event that is not after the given timepoint.
findNearestLoggerIndex
FileLoggerIndex findNearestLoggerIndex(const std::string& deviceId, const karabo::data::Epochstamp& timepoint, const bool before)
Find logger closest index from archive_index.txt file that is before/after (according to 'before')
'timepoint'. If there is none before (after) but that is asked for, take the one just after (before).
findPositionOfEpochstamp
size_t findPositionOfEpochstamp(std::ifstream& f, double stamp, size_t left, size_t right, bool preferBefore)
Find index of that MetaData::Record in 'f' (between indices 'left' and 'right')
that matches the Epochstamp 'stamp'. In case no exact match (within 1 ms) is found,
'preferBefore' decides whether the index with a smaller or larger time stamp is returned.
readToHash
void readToHash(karabo::data::Hash& hashOut, const std::string& path, const karabo::data::Timestamp& timestamp, const std::string& type, const std::string& value) const
Internal helper: Place 'value' interpreted as 'type' (and with given 'timestamp') into 'hashOut' at 'path'.