MADARA  3.4.1
madara::knowledge::VariableReferenceMapReader Class Reference

Helper class for iterating over VariableReferenceMaps, optionally including history of changed records, since a given TOI. More...

#include <VariableReference.h>

Classes

class  const_iterator
 Constant Input Iterator over values in the map. More...
 

Public Member Functions

 VariableReferenceMapReader (const VariableReferenceMap &map, bool history=false, uint64_t min_toi=0)
 Primary constructor. More...
 
const_iterator begin () const
 
const_iterator end () const
 

Private Attributes

bool history_ = false
 True if iteration should include history. More...
 
const VariableReferenceMapmap_
 Map to iterate over. More...
 
uint64_t min_toi_ = 0
 Only iterate updates with TOI > this value. More...
 

Detailed Description

Helper class for iterating over VariableReferenceMaps, optionally including history of changed records, since a given TOI.

This is NOT thread safe. Only use this reader if the KnowledgeBase the map points into is locked by the current thread. Do not modify the map, or the KnowledgeBase, while using this reader.

// Example to iterate over full recorded history of records in map
VariableReferenceMapReader reader(map, true);
for (auto cur : reader) {
const char *name = cur.first;
const KnowledgeRecord *rec = cur.second;
...
}
This class encapsulates an entry in a KnowledgeBase.
VariableReferenceMapReader(const VariableReferenceMap &map, bool history=false, uint64_t min_toi=0)
Primary constructor.

Definition at line 120 of file VariableReference.h.

Constructor & Destructor Documentation

◆ VariableReferenceMapReader()

madara::knowledge::VariableReferenceMapReader::VariableReferenceMapReader ( const VariableReferenceMap map,
bool  history = false,
uint64_t  min_toi = 0 
)
inline

Primary constructor.

Keeps a reference to map, so ensure this reader doesn't outlive it.

Parameters
mapthe map to iterate over
historyif true, include historical values. Otherwise, only iterate over latest value of any records.
min_toionly iterate over historical values of TOI > this. If a record has no history capacity, it will always be included.

Definition at line 133 of file VariableReference.h.

Member Function Documentation

◆ begin()

const_iterator madara::knowledge::VariableReferenceMapReader::begin ( ) const
inline

Definition at line 292 of file VariableReference.h.

◆ end()

const_iterator madara::knowledge::VariableReferenceMapReader::end ( ) const
inline

Definition at line 297 of file VariableReference.h.

Member Data Documentation

◆ history_

bool madara::knowledge::VariableReferenceMapReader::history_ = false
private

True if iteration should include history.

Definition at line 307 of file VariableReference.h.

◆ map_

const VariableReferenceMap& madara::knowledge::VariableReferenceMapReader::map_
private

Map to iterate over.

Definition at line 304 of file VariableReference.h.

◆ min_toi_

uint64_t madara::knowledge::VariableReferenceMapReader::min_toi_ = 0
private

Only iterate updates with TOI > this value.

Definition at line 310 of file VariableReference.h.


The documentation for this class was generated from the following file: