CatapultServer  v0.5.0.1 (Elephant)
catapult::deltaset Namespace Reference

Namespaces

 detail
 

Classes

class  BaseSet
 
struct  BaseSetCommitPolicy
 Default policy for committing changes to a base set. More...
 
class  BaseSetDelta
 
class  BaseSetDeltaIterationView
 
class  BaseSetIterationView
 A view that provides iteration support to a base set. More...
 
class  ConditionalContainer
 A conditional container that delegates to either a storage or a memory backed container. More...
 
struct  DeltaElements
 Slim wrapper around changed elements. More...
 
class  DeltaElementsMixin
 Mixin that wraps BaseSetDelta and provides a facade on top of BaseSetDelta::deltas(). More...
 
struct  FindTraitsT
 Traits for customizing the behavior of find depending on element type. More...
 
struct  FindTraitsT< T, true >
 
struct  ImmutableTypeTag
 Tag that indicates a type is immutable. More...
 
struct  ImmutableTypeTraits
 Traits used for describing an immutable type. More...
 
struct  MapKeyTraits
 Key-related traits for stl map types. More...
 
struct  MapStorageTraits
 Base set compatible traits for stl map types. More...
 
struct  MutableTypeTag
 Tag that indicates a type is mutable. More...
 
struct  MutableTypeTraits
 Traits used for describing a mutable type. More...
 
class  OrderedSet
 A base set with ordered keys. More...
 
class  PruningBoundary
 Represents an optional pruning boundary. More...
 
struct  SetKeyTraits
 Key-related traits for stl set types. More...
 
struct  SetStorageTraits
 Base set compatible traits for stl set types. More...
 

Typedefs

template<typename TFindTraits , typename TSetTraits >
using BaseSetFindIterator = detail::BaseSetSingleIteratorWrapper< TFindTraits, TSetTraits, typename TSetTraits::SetType::const_iterator, typename TFindTraits::ConstResultType >
 Iterator that returns a find result from a base set. More...
 
template<typename TFindTraits , typename TSetTraits >
using BaseSetDeltaFindIterator = detail::BaseSetSingleIteratorWrapper< TFindTraits, TSetTraits, typename TSetTraits::MemorySetType::iterator, typename TFindTraits::ResultType >
 Iterator that returns a find result from a base set delta. More...
 
template<typename TFindTraits , typename TSetTraits >
using BaseSetDeltaFindConstIterator = detail::BaseSetConditionalIteratorWrapper< TFindTraits, TSetTraits, typename TSetTraits::SetType::const_iterator, typename TSetTraits::MemorySetType::const_iterator, typename TFindTraits::ConstResultType >
 Iterator that returns a find (const) result from a base set delta. More...
 
template<typename TElementTraits , typename TStorageTraits = SetStorageTraits<detail::OrderedSetType<TElementTraits>>>
using OrderedSetDelta = BaseSetDelta< TElementTraits, TStorageTraits >
 A delta on top of a base set with ordered keys. More...
 

Enumerations

enum  InsertResult { InsertResult::Unremoved, InsertResult::Updated, InsertResult::Redundant, InsertResult::Inserted }
 Possible results of an insert into a base set delta. More...
 
enum  RemoveResult {
  RemoveResult::None, RemoveResult::Unmodified_And_Removed, RemoveResult::Uninserted, RemoveResult::Redundant,
  RemoveResult::Removed
}
 Possible results of a remove from a base set delta. More...
 
enum  ConditionalContainerMode { ConditionalContainerMode::Storage, ConditionalContainerMode::Memory }
 Possible conditional container modes. More...
 

Functions

template<typename TKeyTraits , typename TStorageSet , typename TMemorySet >
void UpdateSet (TStorageSet &elements, const DeltaElements< TMemorySet > &deltas)
 Applies all changes in deltas to elements. More...
 
template<typename TElementTraits , typename TSetTraits >
BaseSetDeltaIterationView< TSetTraits > MakeIterableView (const BaseSetDelta< TElementTraits, TSetTraits > &delta)
 
template<typename TSet >
bool IsSetIterable (const TSet &)
 Returns true if set is iterable. More...
 
template<typename TSet >
const TSet & SelectIterableSet (const TSet &set)
 Selects the iterable set from set. More...
 
template<typename TElementTraits , typename TSetTraits , typename TCommitPolicy >
bool IsBaseSetIterable (const BaseSet< TElementTraits, TSetTraits, TCommitPolicy > &set)
 Returns true if set is iterable. More...
 
template<typename TElementTraits , typename TSetTraits , typename TCommitPolicy >
BaseSetIterationView< TSetTraits > MakeIterableView (const BaseSet< TElementTraits, TSetTraits, TCommitPolicy > &set)
 
template<typename TContainer , typename TElements >
bool ContainsAny (const TContainer &container, const TElements &elements)
 
template<typename TContainer , typename TElements >
void InsertAll (TContainer &container, const TElements &elements)
 
template<typename TContainer , typename TElements >
void RemoveAll (TContainer &container, const TElements &elements)
 Removes all elements from the container (pContainer). More...
 
template<typename TKeyTraits , typename TStorageSet , typename TMemorySet >
bool IsSetIterable (const ConditionalContainer< TKeyTraits, TStorageSet, TMemorySet > &set)
 
template<typename TKeyTraits , typename TStorageSet , typename TMemorySet >
const TMemorySet & SelectIterableSet (const ConditionalContainer< TKeyTraits, TStorageSet, TMemorySet > &set)
 
template<typename TKeyTraits , typename TStorageSet , typename TMemorySet >
void UpdateSet (ConditionalContainer< TKeyTraits, TStorageSet, TMemorySet > &container, const DeltaElements< TMemorySet > &deltas)
 
template<typename TKeyTraits , typename TStorageSet , typename TMemorySet , typename TPruningBoundary >
void PruneBaseSet (ConditionalContainer< TKeyTraits, TStorageSet, TMemorySet > &container, const TPruningBoundary &pruningBoundary)
 
template<typename TSet , typename X = decltype((*reinterpret_cast<TSet*>(0)).lower_bound(typename TSet::value_type()))>
void PruneBaseSet (TSet &elements, const PruningBoundary< typename TSet::value_type > &pruningBoundary)
 Optionally prunes elements using pruningBoundary, which indicates the upper bound of elements to remove. More...
 

Typedef Documentation

◆ BaseSetDeltaFindConstIterator

template<typename TFindTraits , typename TSetTraits >
using catapult::deltaset::BaseSetDeltaFindConstIterator = typedef detail::BaseSetConditionalIteratorWrapper< TFindTraits, TSetTraits, typename TSetTraits::SetType::const_iterator, typename TSetTraits::MemorySetType::const_iterator, typename TFindTraits::ConstResultType >

Iterator that returns a find (const) result from a base set delta.

◆ BaseSetDeltaFindIterator

template<typename TFindTraits , typename TSetTraits >
using catapult::deltaset::BaseSetDeltaFindIterator = typedef detail::BaseSetSingleIteratorWrapper< TFindTraits, TSetTraits, typename TSetTraits::MemorySetType::iterator, typename TFindTraits::ResultType >

Iterator that returns a find result from a base set delta.

◆ BaseSetFindIterator

template<typename TFindTraits , typename TSetTraits >
using catapult::deltaset::BaseSetFindIterator = typedef detail::BaseSetSingleIteratorWrapper< TFindTraits, TSetTraits, typename TSetTraits::SetType::const_iterator, typename TFindTraits::ConstResultType >

Iterator that returns a find result from a base set.

◆ OrderedSetDelta

template<typename TElementTraits , typename TStorageTraits = SetStorageTraits<detail::OrderedSetType<TElementTraits>>>
using catapult::deltaset::OrderedSetDelta = typedef BaseSetDelta<TElementTraits, TStorageTraits>

A delta on top of a base set with ordered keys.

Enumeration Type Documentation

◆ ConditionalContainerMode

Possible conditional container modes.

Enumerator
Storage 

Delegate to storage.

Memory 

Delegate to memory.

◆ InsertResult

Possible results of an insert into a base set delta.

Enumerator
Unremoved 

An element pending removal was reverted.

Updated 

An existing element was updated (mutable elements only).

Redundant 

Insert failed because the element already exists (immutable elements only).

Inserted 

A new element was inserted.

◆ RemoveResult

Possible results of a remove from a base set delta.

Enumerator
None 

No matching element was found.

Unmodified_And_Removed 

An element pending modification was reverted and removed (mutable elements only).

Uninserted 

An element pending insert was reverted.

Redundant 

Remove failed because the element already was removed.

Removed 

An existing element was removed.

Function Documentation

◆ ContainsAny()

template<typename TContainer , typename TElements >
bool catapult::deltaset::ContainsAny ( const TContainer &  container,
const TElements &  elements 
)

Searches for any of the given elements in the container (pContainer). Returns true if any element is found or false if none is found.

◆ InsertAll()

template<typename TContainer , typename TElements >
void catapult::deltaset::InsertAll ( TContainer &  container,
const TElements &  elements 
)

Inserts all elements into the container (pContainer).

Note
The algorithm relies on the data used for comparing elements being immutable.

◆ IsBaseSetIterable()

template<typename TElementTraits , typename TSetTraits , typename TCommitPolicy >
bool catapult::deltaset::IsBaseSetIterable ( const BaseSet< TElementTraits, TSetTraits, TCommitPolicy > &  set)

Returns true if set is iterable.

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

◆ IsSetIterable() [1/2]

template<typename TKeyTraits , typename TStorageSet , typename TMemorySet >
bool catapult::deltaset::IsSetIterable ( const ConditionalContainer< TKeyTraits, TStorageSet, TMemorySet > &  set)

Returns true if set is iterable.

Note
Specialization for ConditionalContainer.

◆ IsSetIterable() [2/2]

template<typename TSet >
bool catapult::deltaset::IsSetIterable ( const TSet &  )

Returns true if set is iterable.

Here is the caller graph for this function:

◆ MakeIterableView() [1/2]

template<typename TElementTraits , typename TSetTraits , typename TCommitPolicy >
BaseSetIterationView<TSetTraits> catapult::deltaset::MakeIterableView ( const BaseSet< TElementTraits, TSetTraits, TCommitPolicy > &  set)

Makes a base set iterable.

Note
This should only be supported for in memory views.
Here is the call graph for this function:

◆ MakeIterableView() [2/2]

template<typename TElementTraits , typename TSetTraits >
BaseSetDeltaIterationView<TSetTraits> catapult::deltaset::MakeIterableView ( const BaseSetDelta< TElementTraits, TSetTraits > &  delta)

Makes a base set delta iterable.

Note
This should only be supported for in memory views.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PruneBaseSet() [1/2]

template<typename TKeyTraits , typename TStorageSet , typename TMemorySet , typename TPruningBoundary >
void catapult::deltaset::PruneBaseSet ( ConditionalContainer< TKeyTraits, TStorageSet, TMemorySet > &  container,
const TPruningBoundary &  pruningBoundary 
)

Optionally prunes elements using pruningBoundary, which indicates the upper bound of elements to remove.

Note
Specialization for ConditionalContainer.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PruneBaseSet() [2/2]

template<typename TSet , typename X = decltype((*reinterpret_cast<TSet*>(0)).lower_bound(typename TSet::value_type()))>
void catapult::deltaset::PruneBaseSet ( TSet &  elements,
const PruningBoundary< typename TSet::value_type > &  pruningBoundary 
)

Optionally prunes elements using pruningBoundary, which indicates the upper bound of elements to remove.

Here is the call graph for this function:

◆ RemoveAll()

template<typename TContainer , typename TElements >
void catapult::deltaset::RemoveAll ( TContainer &  container,
const TElements &  elements 
)

Removes all elements from the container (pContainer).

Here is the caller graph for this function:

◆ SelectIterableSet() [1/2]

template<typename TKeyTraits , typename TStorageSet , typename TMemorySet >
const TMemorySet& catapult::deltaset::SelectIterableSet ( const ConditionalContainer< TKeyTraits, TStorageSet, TMemorySet > &  set)

Selects the iterable set from set.

Exceptions
catapult_invalid_argumentif the set is not memory-based.
Note
Specialization for ConditionalContainer.
Here is the call graph for this function:

◆ SelectIterableSet() [2/2]

template<typename TSet >
const TSet& catapult::deltaset::SelectIterableSet ( const TSet &  set)

Selects the iterable set from set.

Here is the caller graph for this function:

◆ UpdateSet() [1/2]

template<typename TKeyTraits , typename TStorageSet , typename TMemorySet >
void catapult::deltaset::UpdateSet ( ConditionalContainer< TKeyTraits, TStorageSet, TMemorySet > &  container,
const DeltaElements< TMemorySet > &  deltas 
)

Applies all changes in deltas to container.

Note
Specialization for ConditionalContainer.
Here is the call graph for this function:

◆ UpdateSet() [2/2]

template<typename TKeyTraits , typename TStorageSet , typename TMemorySet >
void catapult::deltaset::UpdateSet ( TStorageSet &  elements,
const DeltaElements< TMemorySet > &  deltas 
)

Applies all changes in deltas to elements.