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

Public Types

using ElementType = typename TElementTraits::ElementType
 
using SetType = typename TSetTraits::SetType
 
using KeyType = typename TSetTraits::KeyType
 
using FindTraits = FindTraitsT< ElementType, TSetTraits::AllowsNativeValueModification >
 
using DeltaType = BaseSetDelta< TElementTraits, TSetTraits >
 
using FindConstIterator = BaseSetFindIterator< FindTraits, TSetTraits >
 

Public Member Functions

template<typename... TArgs>
 BaseSet (TArgs &&... args)
 
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
 
bool contains (const KeyType &key) const
 
std::shared_ptr< DeltaTyperebase ()
 Returns a delta based on the same original elements as this set. More...
 
std::shared_ptr< DeltaTyperebaseDetached () const
 
template<typename... TArgs>
void commit (TArgs &&... args)
 
- Public Member Functions inherited from catapult::utils::MoveOnly
constexpr MoveOnly ()=default
 Default constructor. More...
 
 ~MoveOnly ()=default
 Default destructor. More...
 
 MoveOnly (const NonCopyable &)=delete
 Disabled copy constructor. More...
 
 MoveOnly (MoveOnly &&)=default
 Default move constructor. More...
 
MoveOnlyoperator= (const MoveOnly &)=delete
 Disabled assignment operator. More...
 
MoveOnlyoperator= (MoveOnly &&)=default
 Default move assignment operator. More...
 

Private Attributes

SetType m_elements
 
std::weak_ptr< DeltaTypem_pWeakDelta
 

Friends

template<typename TElementTraits2 , typename TSetTraits2 , typename TCommitPolicy2 >
bool IsBaseSetIterable (const BaseSet< TElementTraits2, TSetTraits2, TCommitPolicy2 > &set)
 
template<typename TElementTraits2 , typename TSetTraits2 , typename TCommitPolicy2 >
BaseSetIterationView< TSetTraits2 > MakeIterableView (const BaseSet< TElementTraits2, TSetTraits2, TCommitPolicy2 > &set)
 

Detailed Description

template<typename TElementTraits, typename TSetTraits, typename TCommitPolicy = BaseSetCommitPolicy<TSetTraits>>
class catapult::deltaset::BaseSet< TElementTraits, TSetTraits, TCommitPolicy >

A base set.

Template Parameters
TElementTraitsTraits describing the type of element.
TSetTraitsTraits describing the underlying set.
TCommitPolicyThe policy for committing changes to a base set.
Note
: 1) this class is not thread safe. 2) if TSetTraits::SetType is an unordered set, the element must implement operator == 3) if MutableTypeTraits are used, the element must implement a (deep) copy

Member Typedef Documentation

◆ DeltaType

template<typename TElementTraits, typename TSetTraits, typename TCommitPolicy = BaseSetCommitPolicy<TSetTraits>>
using catapult::deltaset::BaseSet< TElementTraits, TSetTraits, TCommitPolicy >::DeltaType = BaseSetDelta<TElementTraits, TSetTraits>

◆ ElementType

template<typename TElementTraits, typename TSetTraits, typename TCommitPolicy = BaseSetCommitPolicy<TSetTraits>>
using catapult::deltaset::BaseSet< TElementTraits, TSetTraits, TCommitPolicy >::ElementType = typename TElementTraits::ElementType

◆ FindConstIterator

template<typename TElementTraits, typename TSetTraits, typename TCommitPolicy = BaseSetCommitPolicy<TSetTraits>>
using catapult::deltaset::BaseSet< TElementTraits, TSetTraits, TCommitPolicy >::FindConstIterator = BaseSetFindIterator<FindTraits, TSetTraits>

◆ FindTraits

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

◆ KeyType

template<typename TElementTraits, typename TSetTraits, typename TCommitPolicy = BaseSetCommitPolicy<TSetTraits>>
using catapult::deltaset::BaseSet< TElementTraits, TSetTraits, TCommitPolicy >::KeyType = typename TSetTraits::KeyType

◆ SetType

template<typename TElementTraits, typename TSetTraits, typename TCommitPolicy = BaseSetCommitPolicy<TSetTraits>>
using catapult::deltaset::BaseSet< TElementTraits, TSetTraits, TCommitPolicy >::SetType = typename TSetTraits::SetType

Constructor & Destructor Documentation

◆ BaseSet()

template<typename TElementTraits, typename TSetTraits, typename TCommitPolicy = BaseSetCommitPolicy<TSetTraits>>
template<typename... TArgs>
catapult::deltaset::BaseSet< TElementTraits, TSetTraits, TCommitPolicy >::BaseSet ( TArgs &&...  args)
inlineexplicit

Creates a base set. args are forwarded to the underlying container.

Member Function Documentation

◆ commit()

template<typename TElementTraits, typename TSetTraits, typename TCommitPolicy = BaseSetCommitPolicy<TSetTraits>>
template<typename... TArgs>
void catapult::deltaset::BaseSet< TElementTraits, TSetTraits, TCommitPolicy >::commit ( TArgs &&...  args)
inline

Commits all changes in the rebased cache. args are forwarded to the commit policy.

Here is the caller graph for this function:

◆ contains()

template<typename TElementTraits, typename TSetTraits, typename TCommitPolicy = BaseSetCommitPolicy<TSetTraits>>
bool catapult::deltaset::BaseSet< TElementTraits, TSetTraits, TCommitPolicy >::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.

◆ empty()

template<typename TElementTraits, typename TSetTraits, typename TCommitPolicy = BaseSetCommitPolicy<TSetTraits>>
bool catapult::deltaset::BaseSet< TElementTraits, TSetTraits, TCommitPolicy >::empty ( ) const
inline

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

◆ find()

template<typename TElementTraits, typename TSetTraits, typename TCommitPolicy = BaseSetCommitPolicy<TSetTraits>>
FindConstIterator catapult::deltaset::BaseSet< TElementTraits, TSetTraits, TCommitPolicy >::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.

◆ rebase()

template<typename TElementTraits, typename TSetTraits, typename TCommitPolicy = BaseSetCommitPolicy<TSetTraits>>
std::shared_ptr<DeltaType> catapult::deltaset::BaseSet< TElementTraits, TSetTraits, TCommitPolicy >::rebase ( )
inline

Returns a delta based on the same original elements as this set.

Here is the caller graph for this function:

◆ rebaseDetached()

template<typename TElementTraits, typename TSetTraits, typename TCommitPolicy = BaseSetCommitPolicy<TSetTraits>>
std::shared_ptr<DeltaType> catapult::deltaset::BaseSet< TElementTraits, TSetTraits, TCommitPolicy >::rebaseDetached ( ) const
inline

Returns a delta based on the same original elements as this set but without the ability to commit any changes to the original set.

Here is the caller graph for this function:

◆ size()

template<typename TElementTraits, typename TSetTraits, typename TCommitPolicy = BaseSetCommitPolicy<TSetTraits>>
size_t catapult::deltaset::BaseSet< TElementTraits, TSetTraits, TCommitPolicy >::size ( ) const
inline

Gets the size of this set.

Friends And Related Function Documentation

◆ IsBaseSetIterable

template<typename TElementTraits, typename TSetTraits, typename TCommitPolicy = BaseSetCommitPolicy<TSetTraits>>
template<typename TElementTraits2 , typename TSetTraits2 , typename TCommitPolicy2 >
bool IsBaseSetIterable ( const BaseSet< TElementTraits2, TSetTraits2, TCommitPolicy2 > &  set)
friend

◆ MakeIterableView

template<typename TElementTraits, typename TSetTraits, typename TCommitPolicy = BaseSetCommitPolicy<TSetTraits>>
template<typename TElementTraits2 , typename TSetTraits2 , typename TCommitPolicy2 >
BaseSetIterationView<TSetTraits2> MakeIterableView ( const BaseSet< TElementTraits2, TSetTraits2, TCommitPolicy2 > &  set)
friend

Member Data Documentation

◆ m_elements

template<typename TElementTraits, typename TSetTraits, typename TCommitPolicy = BaseSetCommitPolicy<TSetTraits>>
SetType catapult::deltaset::BaseSet< TElementTraits, TSetTraits, TCommitPolicy >::m_elements
private

◆ m_pWeakDelta

template<typename TElementTraits, typename TSetTraits, typename TCommitPolicy = BaseSetCommitPolicy<TSetTraits>>
std::weak_ptr<DeltaType> catapult::deltaset::BaseSet< TElementTraits, TSetTraits, TCommitPolicy >::m_pWeakDelta
private

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