CatapultServer  v0.5.0.1 (Elephant)
catapult::deltaset::BaseSetDelta< TElementTraits, TSetTraits > Class Template Reference
Inheritance diagram for catapult::deltaset::BaseSetDelta< TElementTraits, TSetTraits >:
Collaboration diagram for catapult::deltaset::BaseSetDelta< TElementTraits, TSetTraits >:

Classes

struct  KeyGenerationIdMap
 
struct  KeyGenerationIdMap< T, utils::traits::is_type_expression_t< typename T::hasher > >
 

Public Types

using ElementType = typename TElementTraits::ElementType
 
using ElementMutabilityTag = typename TElementTraits::MutabilityTag
 
using SetType = typename TSetTraits::SetType
 
using MemorySetType = typename TSetTraits::MemorySetType
 
using KeyType = typename TSetTraits::KeyType
 
using FindTraits = FindTraitsT< ElementType, TSetTraits::AllowsNativeValueModification >
 
using SetTraits = TSetTraits
 
using FindIterator = std::conditional_t< std::is_same_v< ElementMutabilityTag, ImmutableTypeTag >, BaseSetDeltaFindConstIterator< FindTraits, TSetTraits >, BaseSetDeltaFindIterator< FindTraits, TSetTraits > >
 
using FindConstIterator = BaseSetDeltaFindConstIterator< FindTraits, TSetTraits >
 

Public Member Functions

 BaseSetDelta (const SetType &originalElements)
 Creates a delta around originalElements. More...
 
bool empty () const
 Gets a value indicating whether or not the set is empty. More...
 
size_t size () const
 Gets the size of this set. More...
 
FindConstIterator find (const KeyType &key) const
 
FindIterator find (const KeyType &key)
 
bool contains (const KeyType &key) const
 
InsertResult insert (const ElementType &element)
 
template<typename... TArgs>
InsertResult emplace (TArgs &&... args)
 Creates an element around the passed arguments (args) and inserts the element into this set. More...
 
RemoveResult remove (const KeyType &key)
 Removes the element identified by key from the delta. More...
 
DeltaElements< MemorySetType > deltas () const
 Gets const references to the pending modifications. More...
 
void reset ()
 Resets all pending modifications. More...
 
uint32_t generationId () const
 Gets the current generation id. More...
 
uint32_t generationId (const KeyType &key) const
 Gets the generation id associated with key. More...
 
void incrementGenerationId ()
 Increments the generation id. More...
 
- Public Member Functions inherited from catapult::utils::NonCopyable
constexpr NonCopyable ()=default
 Default constructor. More...
 
 ~NonCopyable ()=default
 Default destructor. More...
 
 NonCopyable (const NonCopyable &)=delete
 Disabled copy constructor. More...
 
NonCopyable & operator= (const NonCopyable &)=delete
 Disabled assignment operator. More...
 

Private Member Functions

FindIterator find (const KeyType &key, MutableTypeTag)
 
FindConstIterator find (const KeyType &key, MutableTypeTag) const
 
FindConstIterator find (const KeyType &key, ImmutableTypeTag) const
 
void markFoundElement (const KeyType &key, MutableTypeTag)
 
void markFoundElement (const KeyType &, ImmutableTypeTag)
 
InsertResult insert (const ElementType &element, MutableTypeTag)
 
InsertResult insert (const ElementType &element, ImmutableTypeTag)
 
RemoveResult remove (const KeyType &key, MutableTypeTag)
 
RemoveResult remove (const KeyType &key, ImmutableTypeTag)
 
void markKey (const KeyType &key)
 
void clearKey (const KeyType &key)
 

Static Private Member Functions

template<typename TResultIterator , typename TBaseSetDelta >
static TResultIterator Find (TBaseSetDelta &set, const KeyType &key)
 
template<typename TSet >
static constexpr bool Contains (const TSet &set, const KeyType &key)
 

Private Attributes

const SetType & m_originalElements
 
MemorySetType m_addedElements
 
MemorySetType m_removedElements
 
MemorySetType m_copiedElements
 
uint32_t m_generationId
 
KeyGenerationIdMap< SetType >::Type m_keyGenerationIdMap
 

Friends

template<typename TElementTraits2 , typename TSetTraits2 >
BaseSetDeltaIterationView< TSetTraits2 > MakeIterableView (const BaseSetDelta< TElementTraits2, TSetTraits2 > &set)
 

Detailed Description

template<typename TElementTraits, typename TSetTraits>
class catapult::deltaset::BaseSetDelta< TElementTraits, TSetTraits >

A delta on top of a base set that offers methods to insert/remove/update elements.

Template Parameters
TElementTraitsTraits describing the type of element.
TSetTraitsTraits describing the underlying set.
Note
This class is not thread safe.

Member Typedef Documentation

◆ ElementMutabilityTag

template<typename TElementTraits, typename TSetTraits>
using catapult::deltaset::BaseSetDelta< TElementTraits, TSetTraits >::ElementMutabilityTag = typename TElementTraits::MutabilityTag

◆ ElementType

template<typename TElementTraits, typename TSetTraits>
using catapult::deltaset::BaseSetDelta< TElementTraits, TSetTraits >::ElementType = typename TElementTraits::ElementType

◆ FindConstIterator

template<typename TElementTraits, typename TSetTraits>
using catapult::deltaset::BaseSetDelta< TElementTraits, TSetTraits >::FindConstIterator = BaseSetDeltaFindConstIterator<FindTraits, TSetTraits>

◆ FindIterator

template<typename TElementTraits, typename TSetTraits>
using catapult::deltaset::BaseSetDelta< TElementTraits, TSetTraits >::FindIterator = std::conditional_t< std::is_same_v<ElementMutabilityTag, ImmutableTypeTag>, BaseSetDeltaFindConstIterator<FindTraits, TSetTraits>, BaseSetDeltaFindIterator<FindTraits, TSetTraits> >

◆ FindTraits

template<typename TElementTraits, typename TSetTraits>
using catapult::deltaset::BaseSetDelta< TElementTraits, TSetTraits >::FindTraits = FindTraitsT<ElementType, TSetTraits::AllowsNativeValueModification>

◆ KeyType

template<typename TElementTraits, typename TSetTraits>
using catapult::deltaset::BaseSetDelta< TElementTraits, TSetTraits >::KeyType = typename TSetTraits::KeyType

◆ MemorySetType

template<typename TElementTraits, typename TSetTraits>
using catapult::deltaset::BaseSetDelta< TElementTraits, TSetTraits >::MemorySetType = typename TSetTraits::MemorySetType

◆ SetTraits

template<typename TElementTraits, typename TSetTraits>
using catapult::deltaset::BaseSetDelta< TElementTraits, TSetTraits >::SetTraits = TSetTraits

◆ SetType

template<typename TElementTraits, typename TSetTraits>
using catapult::deltaset::BaseSetDelta< TElementTraits, TSetTraits >::SetType = typename TSetTraits::SetType

Constructor & Destructor Documentation

◆ BaseSetDelta()

template<typename TElementTraits, typename TSetTraits>
catapult::deltaset::BaseSetDelta< TElementTraits, TSetTraits >::BaseSetDelta ( const SetType &  originalElements)
inlineexplicit

Creates a delta around originalElements.

Member Function Documentation

◆ clearKey()

template<typename TElementTraits, typename TSetTraits>
void catapult::deltaset::BaseSetDelta< TElementTraits, TSetTraits >::clearKey ( const KeyType &  key)
inlineprivate
Here is the caller graph for this function:

◆ contains()

template<typename TElementTraits, typename TSetTraits>
bool catapult::deltaset::BaseSetDelta< TElementTraits, TSetTraits >::contains ( const KeyType &  key) const
inline

Searches for key in this set. Returns true if it is found or false if it is not found.

Here is the call graph for this function:

◆ Contains()

template<typename TElementTraits, typename TSetTraits>
template<typename TSet >
static constexpr bool catapult::deltaset::BaseSetDelta< TElementTraits, TSetTraits >::Contains ( const TSet &  set,
const KeyType &  key 
)
inlinestaticconstexprprivate
Here is the caller graph for this function:

◆ deltas()

template<typename TElementTraits, typename TSetTraits>
DeltaElements<MemorySetType> catapult::deltaset::BaseSetDelta< TElementTraits, TSetTraits >::deltas ( ) const
inline

Gets const references to the pending modifications.

Here is the caller graph for this function:

◆ emplace()

template<typename TElementTraits, typename TSetTraits>
template<typename... TArgs>
InsertResult catapult::deltaset::BaseSetDelta< TElementTraits, TSetTraits >::emplace ( TArgs &&...  args)
inline

Creates an element around the passed arguments (args) and inserts the element into this set.

Here is the call graph for this function:

◆ empty()

template<typename TElementTraits, typename TSetTraits>
bool catapult::deltaset::BaseSetDelta< TElementTraits, TSetTraits >::empty ( ) const
inline

Gets a value indicating whether or not the set is empty.

Here is the call graph for this function:

◆ find() [1/5]

template<typename TElementTraits, typename TSetTraits>
FindIterator catapult::deltaset::BaseSetDelta< TElementTraits, TSetTraits >::find ( const KeyType &  key)
inline

Searches for key in this set. Returns a pointer to the matching element if it is found or nullptr if it is not found.

Here is the call graph for this function:

◆ find() [2/5]

template<typename TElementTraits, typename TSetTraits>
FindConstIterator catapult::deltaset::BaseSetDelta< TElementTraits, TSetTraits >::find ( const KeyType &  key) const
inline

Searches for key in this set. Returns a pointer to the matching element if it is found or nullptr if it is not found.

Here is the caller graph for this function:

◆ find() [3/5]

template<typename TElementTraits, typename TSetTraits>
FindConstIterator catapult::deltaset::BaseSetDelta< TElementTraits, TSetTraits >::find ( const KeyType &  key,
ImmutableTypeTag   
) const
inlineprivate

◆ find() [4/5]

template<typename TElementTraits, typename TSetTraits>
FindIterator catapult::deltaset::BaseSetDelta< TElementTraits, TSetTraits >::find ( const KeyType &  key,
MutableTypeTag   
)
inlineprivate
Here is the call graph for this function:

◆ find() [5/5]

template<typename TElementTraits, typename TSetTraits>
FindConstIterator catapult::deltaset::BaseSetDelta< TElementTraits, TSetTraits >::find ( const KeyType &  key,
MutableTypeTag   
) const
inlineprivate
Here is the call graph for this function:

◆ Find()

template<typename TElementTraits, typename TSetTraits>
template<typename TResultIterator , typename TBaseSetDelta >
static TResultIterator catapult::deltaset::BaseSetDelta< TElementTraits, TSetTraits >::Find ( TBaseSetDelta< TElementTraits, TSetTraits > &  set,
const KeyType &  key 
)
inlinestaticprivate
Here is the call graph for this function:

◆ generationId() [1/2]

template<typename TElementTraits, typename TSetTraits>
uint32_t catapult::deltaset::BaseSetDelta< TElementTraits, TSetTraits >::generationId ( ) const
inline

Gets the current generation id.

◆ generationId() [2/2]

template<typename TElementTraits, typename TSetTraits>
uint32_t catapult::deltaset::BaseSetDelta< TElementTraits, TSetTraits >::generationId ( const KeyType &  key) const
inline

Gets the generation id associated with key.

◆ incrementGenerationId()

template<typename TElementTraits, typename TSetTraits>
void catapult::deltaset::BaseSetDelta< TElementTraits, TSetTraits >::incrementGenerationId ( )
inline

Increments the generation id.

◆ insert() [1/3]

template<typename TElementTraits, typename TSetTraits>
InsertResult catapult::deltaset::BaseSetDelta< TElementTraits, TSetTraits >::insert ( const ElementType &  element)
inline

Inserts element into this set.

Note
The algorithm relies on the data used for comparing elements being immutable.
Here is the caller graph for this function:

◆ insert() [2/3]

template<typename TElementTraits, typename TSetTraits>
InsertResult catapult::deltaset::BaseSetDelta< TElementTraits, TSetTraits >::insert ( const ElementType &  element,
ImmutableTypeTag   
)
inlineprivate
Here is the call graph for this function:

◆ insert() [3/3]

template<typename TElementTraits, typename TSetTraits>
InsertResult catapult::deltaset::BaseSetDelta< TElementTraits, TSetTraits >::insert ( const ElementType &  element,
MutableTypeTag   
)
inlineprivate
Here is the call graph for this function:

◆ markFoundElement() [1/2]

template<typename TElementTraits, typename TSetTraits>
void catapult::deltaset::BaseSetDelta< TElementTraits, TSetTraits >::markFoundElement ( const KeyType &  ,
ImmutableTypeTag   
)
inlineprivate

◆ markFoundElement() [2/2]

template<typename TElementTraits, typename TSetTraits>
void catapult::deltaset::BaseSetDelta< TElementTraits, TSetTraits >::markFoundElement ( const KeyType &  key,
MutableTypeTag   
)
inlineprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ markKey()

template<typename TElementTraits, typename TSetTraits>
void catapult::deltaset::BaseSetDelta< TElementTraits, TSetTraits >::markKey ( const KeyType &  key)
inlineprivate
Here is the caller graph for this function:

◆ remove() [1/3]

template<typename TElementTraits, typename TSetTraits>
RemoveResult catapult::deltaset::BaseSetDelta< TElementTraits, TSetTraits >::remove ( const KeyType &  key)
inline

Removes the element identified by key from the delta.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ remove() [2/3]

template<typename TElementTraits, typename TSetTraits>
RemoveResult catapult::deltaset::BaseSetDelta< TElementTraits, TSetTraits >::remove ( const KeyType &  key,
ImmutableTypeTag   
)
inlineprivate
Here is the call graph for this function:

◆ remove() [3/3]

template<typename TElementTraits, typename TSetTraits>
RemoveResult catapult::deltaset::BaseSetDelta< TElementTraits, TSetTraits >::remove ( const KeyType &  key,
MutableTypeTag   
)
inlineprivate
Here is the call graph for this function:

◆ reset()

template<typename TElementTraits, typename TSetTraits>
void catapult::deltaset::BaseSetDelta< TElementTraits, TSetTraits >::reset ( )
inline

Resets all pending modifications.

◆ size()

template<typename TElementTraits, typename TSetTraits>
size_t catapult::deltaset::BaseSetDelta< TElementTraits, TSetTraits >::size ( ) const
inline

Gets the size of this set.

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ MakeIterableView

template<typename TElementTraits, typename TSetTraits>
template<typename TElementTraits2 , typename TSetTraits2 >
BaseSetDeltaIterationView<TSetTraits2> MakeIterableView ( const BaseSetDelta< TElementTraits2, TSetTraits2 > &  set)
friend

Member Data Documentation

◆ m_addedElements

template<typename TElementTraits, typename TSetTraits>
MemorySetType catapult::deltaset::BaseSetDelta< TElementTraits, TSetTraits >::m_addedElements
private

◆ m_copiedElements

template<typename TElementTraits, typename TSetTraits>
MemorySetType catapult::deltaset::BaseSetDelta< TElementTraits, TSetTraits >::m_copiedElements
private

◆ m_generationId

template<typename TElementTraits, typename TSetTraits>
uint32_t catapult::deltaset::BaseSetDelta< TElementTraits, TSetTraits >::m_generationId
private

◆ m_keyGenerationIdMap

template<typename TElementTraits, typename TSetTraits>
KeyGenerationIdMap<SetType>::Type catapult::deltaset::BaseSetDelta< TElementTraits, TSetTraits >::m_keyGenerationIdMap
private

◆ m_originalElements

template<typename TElementTraits, typename TSetTraits>
const SetType& catapult::deltaset::BaseSetDelta< TElementTraits, TSetTraits >::m_originalElements
private

◆ m_removedElements

template<typename TElementTraits, typename TSetTraits>
MemorySetType catapult::deltaset::BaseSetDelta< TElementTraits, TSetTraits >::m_removedElements
private

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