OmniSketch  0.1
Oh my sketch!
OmniSketch::Sketch::SketchBase< key_len, T > Class Template Reference

Base sketch. More...

#include <sketch.h>

Inheritance diagram for OmniSketch::Sketch::SketchBase< key_len, T >:

Public Member Functions

virtual size_t size () const
 Return the size of the sketch. More...
 
virtual void insert (const FlowKey< key_len > &flowkey)
 Insert a flowkey without value. More...
 
virtual void update (const FlowKey< key_len > &flowkey, T value)
 Update a flowkey with certain value. More...
 
virtual T query (const FlowKey< key_len > &flowkey) const
 Query the sketch for the estimated size of a flowkey. More...
 
virtual bool lookup (const FlowKey< key_len > &flowkey) const
 Look up a flowkey in the sketch. More...
 
virtual Data::Estimation< key_len, T > getHeavyHitter (double threshold) const
 Get all the heavy hitters. More...
 
virtual Data::Estimation< key_len, T > getHeavyChanger (std::unique_ptr< SketchBase< key_len, T >> &ptr_sketch, double threshold) const
 Get all the heavy changers. More...
 
virtual Data::Estimation< key_len, T > decode ()
 Decode all flowkeys along with their values. More...
 

Detailed Description

template<int32_t key_len, typename T = int64_t>
class OmniSketch::Sketch::SketchBase< key_len, T >

Base sketch.

This class is provided for the sake of testing. By virtue of polymorphism, testing class is able to call overriden methods in subclasses. Thus, it is suggested that you put override specifier at your overriden method in the derived class (cf. files in sketch/ folder). If the signature mismatches, Test::TestBase may complain by prompting an error.

Template Parameters
Ttype of the counter
key_lenlength of flowkey
Attention
Write your method in subclass with the same signature if it is functionally equivalent to one of the following:
Functional Description Partial Signature (Click the links to see more)
query sketch size size() const
insert flowkey without value insert(const FlowKey<key_len> &)
insert flowkey with value update(const FlowKey<key_len> &, T)
look up a flowkey (if exists) lookup(const FlowKey<key_len> &) const
heavy hitter getHeavyHitter(double) const
heavy changer getHeavyChanger(std::unique_ptr<SketchBase<key_len,T>> &, double) const
decode flowkeys with values decode()

Member Function Documentation

◆ decode()

template<int32_t key_len, typename T = int64_t>
virtual Data::Estimation<key_len, T> OmniSketch::Sketch::SketchBase< key_len, T >::decode ( )
inlinevirtual

Decode all flowkeys along with their values.

Returns
An Estimation that contains all decoded flowkeys with estimated value. Particularly useful for reversible sketches.

Reimplemented in OmniSketch::Sketch::FlowRadar< key_len, T, hash_t >, and MySketch< key_len, T >.

◆ getHeavyChanger()

template<int32_t key_len, typename T = int64_t>
virtual Data::Estimation<key_len, T> OmniSketch::Sketch::SketchBase< key_len, T >::getHeavyChanger ( std::unique_ptr< SketchBase< key_len, T >> &  ptr_sketch,
double  threshold 
) const
inlinevirtual

Get all the heavy changers.

Returns
See Data::Estimation for more info.

Reimplemented in MySketch< key_len, T >.

◆ getHeavyHitter()

template<int32_t key_len, typename T = int64_t>
virtual Data::Estimation<key_len, T> OmniSketch::Sketch::SketchBase< key_len, T >::getHeavyHitter ( double  threshold) const
inlinevirtual

Get all the heavy hitters.

Returns
See Data::Estimation for more info.

Reimplemented in OmniSketch::Sketch::HashPipe< key_len, T, hash_t >, and MySketch< key_len, T >.

◆ insert()

template<int32_t key_len, typename T = int64_t>
virtual void OmniSketch::Sketch::SketchBase< key_len, T >::insert ( const FlowKey< key_len > &  flowkey)
inlinevirtual

◆ lookup()

template<int32_t key_len, typename T = int64_t>
virtual bool OmniSketch::Sketch::SketchBase< key_len, T >::lookup ( const FlowKey< key_len > &  flowkey) const
inlinevirtual

◆ query()

template<int32_t key_len, typename T = int64_t>
virtual T OmniSketch::Sketch::SketchBase< key_len, T >::query ( const FlowKey< key_len > &  flowkey) const
inlinevirtual

◆ size()

◆ update()