OmniSketch  0.1
Oh my sketch!
OmniSketch::Data::Estimation< key_len, T > Class Template Reference

Output of sketch as estimation of ground truth. More...

#include <data.h>

Inheritance diagram for OmniSketch::Data::Estimation< key_len, T >:

Public Member Functions

GndTruth< key_len, T >::RightConstIterator begin () const
 Return a random access iterator pointed to the first element. More...
 
GndTruth< key_len, T >::RightConstIterator end () const
 Return a random access iterator pointed to the very end. More...
 
bool insert (const FlowKey< key_len > &flowkey)
 Insert a flowkey. More...
 
bool update (const FlowKey< key_len > &flowkey, T val)
 Update a flowkey with a value specified. More...
 
T & operator[] (const FlowKey< key_len > &flowkey)
 A more user-friendly interface. More...
 
size_t count (const FlowKey< key_len > &flowkey) const
 Return whether the flowkey exists in this estimate. More...
 
const T & at (const FlowKey< key_len > &flowkey) const
 Get the value of a certain key. More...
 
size_t size () const
 Return the number of flows. More...
 

Detailed Description

template<int32_t key_len, typename T = int64_t>
class OmniSketch::Data::Estimation< key_len, T >

Output of sketch as estimation of ground truth.

This class provides an interface of bidirectional map similar to a C++ hash table. What's more, right view need not to be a sorted vector, reducing the algorithmic complexity.

Template Parameters
Ttype of counter
key_lenlength of flowkey

Member Function Documentation

◆ at()

template<int32_t key_len, typename T >
const T & OmniSketch::Data::Estimation< key_len, T >::at ( const FlowKey< key_len > &  flowkey) const

Get the value of a certain key.

If the key does not exist, an out-of-range exception would be thrown.

◆ begin()

template<int32_t key_len, typename T = int64_t>
GndTruth<key_len, T>::RightConstIterator OmniSketch::Data::Estimation< key_len, T >::begin ( ) const
inline

Return a random access iterator pointed to the first element.

See also
GndTruth::begin()

◆ count()

template<int32_t key_len, typename T >
size_t OmniSketch::Data::Estimation< key_len, T >::count ( const FlowKey< key_len > &  flowkey) const

Return whether the flowkey exists in this estimate.

Always 0 or 1 in this case

◆ end()

template<int32_t key_len, typename T = int64_t>
GndTruth<key_len, T>::RightConstIterator OmniSketch::Data::Estimation< key_len, T >::end ( ) const
inline

Return a random access iterator pointed to the very end.

See also
GndTruth::end()

◆ insert()

template<int32_t key_len, typename T >
bool OmniSketch::Data::Estimation< key_len, T >::insert ( const FlowKey< key_len > &  flowkey)

Insert a flowkey.

Calling this function implies that values are uninterested. If the flowkey does not exists yet, counters are initialized to zero by default.

Returns
false if the flowkey has already existed; true otherwise.

◆ operator[]()

template<int32_t key_len, typename T >
T & OmniSketch::Data::Estimation< key_len, T >::operator[] ( const FlowKey< key_len > &  flowkey)

A more user-friendly interface.

It serves as a substitute for insert() and update() methods. For methods invocable on a const object, use at() instead.

Examples

using namespace OmniSketch;
Data::Estimate<13> est;
FlowKey<13> flowkey;
est[flowkey]; // Equivalent to: est.insert(flowkey);
est[flowkey] += 5; // Equivalent to: est.update(flowkey, 5);
est[flowkey] = 5; // No equivalence

◆ size()

template<int32_t key_len, typename T >
size_t OmniSketch::Data::Estimation< key_len, T >::size

Return the number of flows.

◆ update()

template<int32_t key_len, typename T >
bool OmniSketch::Data::Estimation< key_len, T >::update ( const FlowKey< key_len > &  flowkey,
val 
)

Update a flowkey with a value specified.

If the flowkey does not exists yet, counters are initialized to zero by default.

Returns
false if the flowkey has already existed; true otherwise.
OmniSketch::FlowKey
Template class for flowkey.
Definition: flowkey.h:61
OmniSketch
Definition: data.h:24