OmniSketch  0.1
Oh my sketch!
data.h File Reference

Program-level representation of streaming data. More...

#include "flowkey.h"
#include "logger.h"
#include "utils.h"
#include <boost/bimap.hpp>
#include <boost/bimap/unordered_set_of.hpp>
#include <boost/bimap/vector_of.hpp>
#include <filesystem>
#include <fmt/core.h>
Include dependency graph for data.h:
This graph shows which files directly or indirectly include this file:

Classes

struct  OmniSketch::Data::Record< key_len >
 Struct of a single record (i.e., a packet in a segment of streaming data) More...
 
class  OmniSketch::Data::DataFormat
 Parse the format in config file. More...
 
class  OmniSketch::Data::StreamData< key_len >
 Store the formatted streaming data. More...
 
class  OmniSketch::Data::GndTruth< key_len, T >
 Ground truth of the streaming data. More...
 
class  OmniSketch::Data::Estimation< key_len, T >
 Output of sketch as estimation of ground truth. More...
 

Namespaces

 OmniSketch
 
 OmniSketch::Data
 Miscellaneous tools for processing data.
 

Macros

#define CHECK_CALLED_ONCE
 
#define ASSERT_AND_TRUNCATE_MYSELF_TO_THE_FIRST_K_ELEMENTS
 
#define ASSERT_AND_TRUNCATE_MYSELF_TO_ELEMENTS_WITH_GIVEN_VALUE
 

Enumerations

enum  OmniSketch::Data::CntMethod { OmniSketch::Data::InLength, OmniSketch::Data::InPacket }
 Specify the counting method. More...
 
enum  OmniSketch::Data::HXMethod { OmniSketch::Data::TopK, OmniSketch::Data::Percentile }
 Specify the defining rule of heavy X (X = [hitters|changers]) More...
 

Detailed Description

Program-level representation of streaming data.

Author
dromniscience (you@d.nosp@m.omai.nosp@m.n.com)

Macro Definition Documentation

◆ ASSERT_AND_TRUNCATE_MYSELF_TO_ELEMENTS_WITH_GIVEN_VALUE

#define ASSERT_AND_TRUNCATE_MYSELF_TO_ELEMENTS_WITH_GIVEN_VALUE
Value:
if (!(threshold >= 0.0 && threshold <= 1.0)) { \
throw std::invalid_argument("Invalid Argument: Threshold should be in " \
"[0,1] (Percentile), but got " + \
std::to_string(threshold) + " intsead."); \
} \
T thres = threshold * save; \
const auto end = \
std::lower_bound(my_map.right.begin(), my_map.right.end(), thres, \
[](const RightVal &p, const T &val) { \
return std::greater<T>()(p.first, val); \
}); \
my_map.right.erase(end, my_map.right.end()); \
for (auto ptr = my_map.begin(); ptr != my_map.end(); ptr++) { \
tot_value += ptr->get_right(); \
}

◆ ASSERT_AND_TRUNCATE_MYSELF_TO_THE_FIRST_K_ELEMENTS

#define ASSERT_AND_TRUNCATE_MYSELF_TO_THE_FIRST_K_ELEMENTS
Value:
if (threshold < 1.0) { \
throw std::invalid_argument( \
"Invalid Argument: Threshold should >= 1.0 (Top-K), but got " + \
std::to_string(threshold) + " intsead."); \
} \
auto size = my_map.size(); \
size_t no = std::min(size, static_cast<size_t>(threshold)); \
my_map.right.erase(my_map.right.begin() + no, my_map.right.end()); \
for (auto ptr = my_map.begin(); ptr != my_map.end(); ptr++) { \
tot_value += ptr->get_right(); \
}

◆ CHECK_CALLED_ONCE

#define CHECK_CALLED_ONCE
Value:
called++; \
if (called > 1) { \
LOG(WARNING, \
fmt::format("getXXX(...) is called for the {:d}{} " \
"time. The instance is left unmodified.", \
called, \
(called % 10 == 2) \
? "nd" \
: ((called % 10 == 3) \
? "rd" \
: ((called % 10 == 1) ? "st" : "th")))); \
return; \
}
WARNING
@ WARNING
potential error
Definition: logger.h:16