Multilevel Deduplication Engine (MDE)
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
mde::Deduplicator< PropertyT, PropertyHash, PropertyEqual, PropertyPrinter > Struct Template Reference

An straightforward deduplicator for scalar values. It does not implement any special operations besides deduplication. Unlike MDE, this does NOT enforce constness on the data items registered. However, a mutable access must always be marked. More...

#include <mde.hpp>

Collaboration diagram for mde::Deduplicator< PropertyT, PropertyHash, PropertyEqual, PropertyPrinter >:
Collaboration graph
[legend]

Classes

struct  Index
 Index returned by the class. Being defined inside the class ensures type safety and possible future extensions. More...
 
struct  PropertyPtrEqual
 
struct  PropertyPtrHash
 

Public Types

using PropertyMap = std::unordered_map< PropertyT *, IndexValue, PropertyPtrHash, PropertyPtrEqual >
 

Public Member Functions

Index register_value (PropertyT &c)
 Inserts a (or gets an existing) element into property storage.
 
Index register_value (PropertyT &&c)
 
Index register_ptr (PropertyT *c)
 
Size get_property_count () const
 
const PropertyT & get_value (Index id) const
 
const PropertyT * get_value_ptr (Index id) const
 
std::string dump () const
 

Public Attributes

Vector< UniquePointer< PropertyT > > property_list = {}
 
PropertyMap property_map = {}
 

Detailed Description

template<typename PropertyT, typename PropertyHash = DefaultHash<PropertyT>, typename PropertyEqual = DefaultEqual<PropertyT>, typename PropertyPrinter = DefaultPrinter<PropertyT>>
struct mde::Deduplicator< PropertyT, PropertyHash, PropertyEqual, PropertyPrinter >

An straightforward deduplicator for scalar values. It does not implement any special operations besides deduplication. Unlike MDE, this does NOT enforce constness on the data items registered. However, a mutable access must always be marked.

Template Parameters
PropertyTThe type of the property. The property type must satisfy the following:
  • It must be hashable with std::hash
  • It must be less-than comparable
  • It can be checked for equality
PropertyLessCustom less-than comparator (if required)
PropertyEqualCustom equality comaparator (if required)
PropertyPrinterPropertyT string representation generator

Definition at line 2463 of file mde.hpp.

Member Typedef Documentation

◆ PropertyMap

template<typename PropertyT , typename PropertyHash = DefaultHash<PropertyT>, typename PropertyEqual = DefaultEqual<PropertyT>, typename PropertyPrinter = DefaultPrinter<PropertyT>>
using mde::Deduplicator< PropertyT, PropertyHash, PropertyEqual, PropertyPrinter >::PropertyMap = std::unordered_map< PropertyT *, IndexValue, PropertyPtrHash, PropertyPtrEqual>

Definition at line 2521 of file mde.hpp.

Member Function Documentation

◆ dump()

template<typename PropertyT , typename PropertyHash = DefaultHash<PropertyT>, typename PropertyEqual = DefaultEqual<PropertyT>, typename PropertyPrinter = DefaultPrinter<PropertyT>>
std::string mde::Deduplicator< PropertyT, PropertyHash, PropertyEqual, PropertyPrinter >::dump ( ) const
inline

Definition at line 2610 of file mde.hpp.

◆ get_property_count()

template<typename PropertyT , typename PropertyHash = DefaultHash<PropertyT>, typename PropertyEqual = DefaultEqual<PropertyT>, typename PropertyPrinter = DefaultPrinter<PropertyT>>
Size mde::Deduplicator< PropertyT, PropertyHash, PropertyEqual, PropertyPrinter >::get_property_count ( ) const
inline

Definition at line 2592 of file mde.hpp.

◆ get_value()

template<typename PropertyT , typename PropertyHash = DefaultHash<PropertyT>, typename PropertyEqual = DefaultEqual<PropertyT>, typename PropertyPrinter = DefaultPrinter<PropertyT>>
const PropertyT & mde::Deduplicator< PropertyT, PropertyHash, PropertyEqual, PropertyPrinter >::get_value ( Index  id) const
inline

Definition at line 2596 of file mde.hpp.

◆ get_value_ptr()

template<typename PropertyT , typename PropertyHash = DefaultHash<PropertyT>, typename PropertyEqual = DefaultEqual<PropertyT>, typename PropertyPrinter = DefaultPrinter<PropertyT>>
const PropertyT * mde::Deduplicator< PropertyT, PropertyHash, PropertyEqual, PropertyPrinter >::get_value_ptr ( Index  id) const
inline

Ideally, this function should not be used at all, and is present only as a workaround for integration into existing systems.

Definition at line 2605 of file mde.hpp.

◆ register_ptr()

template<typename PropertyT , typename PropertyHash = DefaultHash<PropertyT>, typename PropertyEqual = DefaultEqual<PropertyT>, typename PropertyPrinter = DefaultPrinter<PropertyT>>
Index mde::Deduplicator< PropertyT, PropertyHash, PropertyEqual, PropertyPrinter >::register_ptr ( PropertyT *  c)
inline

This transfers ownership over to the deduplicator. DO NOT free or use the supplied pointer after this.

Ideally, this function should not be used at all, and is present only as a workaround for integration into existing systems.

Definition at line 2578 of file mde.hpp.

◆ register_value() [1/2]

template<typename PropertyT , typename PropertyHash = DefaultHash<PropertyT>, typename PropertyEqual = DefaultEqual<PropertyT>, typename PropertyPrinter = DefaultPrinter<PropertyT>>
Index mde::Deduplicator< PropertyT, PropertyHash, PropertyEqual, PropertyPrinter >::register_value ( PropertyT &&  c)
inline

Definition at line 2557 of file mde.hpp.

◆ register_value() [2/2]

template<typename PropertyT , typename PropertyHash = DefaultHash<PropertyT>, typename PropertyEqual = DefaultEqual<PropertyT>, typename PropertyPrinter = DefaultPrinter<PropertyT>>
Index mde::Deduplicator< PropertyT, PropertyHash, PropertyEqual, PropertyPrinter >::register_value ( PropertyT &  c)
inline

Inserts a (or gets an existing) element into property storage.

Parameters
[in]cThe single-element property set.
Returns
Index of the newly created/existing set.
Todo:
Check whether the cache hit check can be removed.

Definition at line 2543 of file mde.hpp.

Member Data Documentation

◆ property_list

template<typename PropertyT , typename PropertyHash = DefaultHash<PropertyT>, typename PropertyEqual = DefaultEqual<PropertyT>, typename PropertyPrinter = DefaultPrinter<PropertyT>>
Vector<UniquePointer<PropertyT> > mde::Deduplicator< PropertyT, PropertyHash, PropertyEqual, PropertyPrinter >::property_list = {}

Definition at line 2528 of file mde.hpp.

◆ property_map

template<typename PropertyT , typename PropertyHash = DefaultHash<PropertyT>, typename PropertyEqual = DefaultEqual<PropertyT>, typename PropertyPrinter = DefaultPrinter<PropertyT>>
PropertyMap mde::Deduplicator< PropertyT, PropertyHash, PropertyEqual, PropertyPrinter >::property_map = {}

Definition at line 2531 of file mde.hpp.


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