BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bdlcc::StripedUnorderedContainerImpl_Bucket< KEY, VALUE > Class Template Reference

#include <bdlcc_stripedunorderedcontainerimpl.h>

Public Types

enum  BucketScope { e_BUCKETSCOPE_FIRST = 0 , e_BUCKETSCOPE_ALL }
 

Public Member Functions

 BSLMF_NESTED_TRAIT_DECLARATION (StripedUnorderedContainerImpl_Bucket, bslma::UsesBslmaAllocator)
 
 StripedUnorderedContainerImpl_Bucket (bslma::Allocator *basicAllocator=0)
 
 StripedUnorderedContainerImpl_Bucket (bslmf::MovableRef< StripedUnorderedContainerImpl_Bucket< KEY, VALUE > > original, bslma::Allocator *)
 
 ~StripedUnorderedContainerImpl_Bucket ()
 Destroy this object.
 
void addNode (StripedUnorderedContainerImpl_Node< KEY, VALUE > *nodePtr)
 Add the specified nodePtr node at the end of this bucket.
 
void clear ()
 Empty StripedUnorderedContainerImpl_Bucket and delete all nodes.
 
StripedUnorderedContainerImpl_Node< KEY, VALUE > ** headAddress ()
 Return the address of the head (node) of this bucket list.
 
void incrementSize (int amount)
 
void setHead (StripedUnorderedContainerImpl_Node< KEY, VALUE > *value)
 
void setSize (bsl::size_t value)
 Set the size attribute of this bucket to the specified value.
 
void setTail (StripedUnorderedContainerImpl_Node< KEY, VALUE > *value)
 
template<class EQUAL >
bsl::size_t setValue (const KEY &key, const EQUAL &equal, const VALUE &value, BucketScope scope)
 
template<class EQUAL >
bsl::size_t setValue (const KEY &key, const EQUAL &equal, bslmf::MovableRef< VALUE > value)
 
bool empty () const
 
StripedUnorderedContainerImpl_Node< KEY, VALUE > * head () const
 Return the head (node) of this bucket list.
 
bsl::size_t size () const
 Return the current number of elements in this bucket.
 
StripedUnorderedContainerImpl_Node< KEY, VALUE > * tail () const
 Return address of the tail (node) of this bucket list.
 
bslma::Allocatorallocator () const
 

Detailed Description

template<class KEY, class VALUE>
class bdlcc::StripedUnorderedContainerImpl_Bucket< KEY, VALUE >

This class represents a bucket of the hash map. This class template represents the head of in the singly-linked list of (KEY, VALUE) elements in a hash map.

See bdlcc_stripedunorderedcontainerimpl

Member Enumeration Documentation

◆ BucketScope

template<class KEY , class VALUE >
enum bdlcc::StripedUnorderedContainerImpl_Bucket::BucketScope

Enumeration to differentiate between processing all elements with the same key, or just the first one (and typically the only one).

Enumerator
e_BUCKETSCOPE_FIRST 
e_BUCKETSCOPE_ALL 

Constructor & Destructor Documentation

◆ StripedUnorderedContainerImpl_Bucket() [1/2]

template<class KEY , class VALUE >
bdlcc::StripedUnorderedContainerImpl_Bucket< KEY, VALUE >::StripedUnorderedContainerImpl_Bucket ( bslma::Allocator basicAllocator = 0)
inlineexplicit

Create an empty bdlcc::StripedUnorderedContainerImpl_Bucket object. Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0, the currently installed default allocator is used.

◆ StripedUnorderedContainerImpl_Bucket() [2/2]

template<class KEY , class VALUE >
bdlcc::StripedUnorderedContainerImpl_Bucket< KEY, VALUE >::StripedUnorderedContainerImpl_Bucket ( bslmf::MovableRef< StripedUnorderedContainerImpl_Bucket< KEY, VALUE > >  original,
bslma::Allocator  
)
inline

Create a bdlcc::StripedUnorderedContainerImpl_Bucket object having the same value as the specified original object. The original object is left in a valid but unspecified state.

◆ ~StripedUnorderedContainerImpl_Bucket()

template<class KEY , class VALUE >
bdlcc::StripedUnorderedContainerImpl_Bucket< KEY, VALUE >::~StripedUnorderedContainerImpl_Bucket ( )
inline

Member Function Documentation

◆ addNode()

template<class KEY , class VALUE >
void bdlcc::StripedUnorderedContainerImpl_Bucket< KEY, VALUE >::addNode ( StripedUnorderedContainerImpl_Node< KEY, VALUE > *  nodePtr)
inline

◆ allocator()

template<class KEY , class VALUE >
bslma::Allocator * bdlcc::StripedUnorderedContainerImpl_Bucket< KEY, VALUE >::allocator ( ) const
inline

Return the allocator used by StripedUnorderedContainerImpl_Bucket to allocate memory.

◆ BSLMF_NESTED_TRAIT_DECLARATION()

template<class KEY , class VALUE >
bdlcc::StripedUnorderedContainerImpl_Bucket< KEY, VALUE >::BSLMF_NESTED_TRAIT_DECLARATION ( StripedUnorderedContainerImpl_Bucket< KEY, VALUE >  ,
bslma::UsesBslmaAllocator   
)

◆ clear()

template<class KEY , class VALUE >
void bdlcc::StripedUnorderedContainerImpl_Bucket< KEY, VALUE >::clear ( )
inline

◆ empty()

template<class KEY , class VALUE >
bool bdlcc::StripedUnorderedContainerImpl_Bucket< KEY, VALUE >::empty ( ) const
inline

Return true if this bucket contains no elements, and false otherwise.

◆ head()

template<class KEY , class VALUE >
StripedUnorderedContainerImpl_Node< KEY, VALUE > * bdlcc::StripedUnorderedContainerImpl_Bucket< KEY, VALUE >::head ( ) const
inline

◆ headAddress()

template<class KEY , class VALUE >
StripedUnorderedContainerImpl_Node< KEY, VALUE > ** bdlcc::StripedUnorderedContainerImpl_Bucket< KEY, VALUE >::headAddress ( )
inline

◆ incrementSize()

template<class KEY , class VALUE >
void bdlcc::StripedUnorderedContainerImpl_Bucket< KEY, VALUE >::incrementSize ( int  amount)
inline

Increment the size attribute of this bucket by the specified amount.

◆ setHead()

template<class KEY , class VALUE >
void bdlcc::StripedUnorderedContainerImpl_Bucket< KEY, VALUE >::setHead ( StripedUnorderedContainerImpl_Node< KEY, VALUE > *  value)
inline

Set the address of the head of this bucket list to the specified value.

◆ setSize()

template<class KEY , class VALUE >
void bdlcc::StripedUnorderedContainerImpl_Bucket< KEY, VALUE >::setSize ( bsl::size_t  value)
inline

◆ setTail()

template<class KEY , class VALUE >
void bdlcc::StripedUnorderedContainerImpl_Bucket< KEY, VALUE >::setTail ( StripedUnorderedContainerImpl_Node< KEY, VALUE > *  value)
inline

Set the pointer of the tail of this bucket list to the specified value.

◆ setValue() [1/2]

template<class KEY , class VALUE >
template<class EQUAL >
bsl::size_t bdlcc::StripedUnorderedContainerImpl_Bucket< KEY, VALUE >::setValue ( const KEY &  key,
const EQUAL &  equal,
bslmf::MovableRef< VALUE >  value 
)

Set the value attribute of the element in this bucket having the specified key to the specified value, using the specified equal to compare keys. If no such element exists, insert (key, value). If there are multiple elements in this hash map having key then set the value of the first such element found. Return the number of elements found having key that had their value set. Note that, when there are multiple elements having key, the selection of "first" is unspecified and subject to change.

◆ setValue() [2/2]

template<class KEY , class VALUE >
template<class EQUAL >
bsl::size_t bdlcc::StripedUnorderedContainerImpl_Bucket< KEY, VALUE >::setValue ( const KEY &  key,
const EQUAL &  equal,
const VALUE &  value,
BucketScope  scope 
)

Set the value attribute of the element in this bucket having the specified key to the specified value, using the specified equal to compare keys. If no such element exists, insert (key, value). The behavior with respect to duplicate key values in the bucket depends on the specified scope:

: e_BUCKETSCOPE_ALL: : Set value to every element in the bucket having key. : : e_BUCKETSCOPE_FIRST: : Set value to the first element found having key.

Return the number of elements found having key that had their value set. Note that, when there are multiple elements having key, the selection of "first" is unspecified and subject to change. Also note that specifying e_BUCKETSCOPE_FIRST is more performant when there is a single element in the bucket having key.

◆ size()

template<class KEY , class VALUE >
bsl::size_t bdlcc::StripedUnorderedContainerImpl_Bucket< KEY, VALUE >::size ( ) const
inline

◆ tail()

template<class KEY , class VALUE >
StripedUnorderedContainerImpl_Node< KEY, VALUE > * bdlcc::StripedUnorderedContainerImpl_Bucket< KEY, VALUE >::tail ( ) const
inline

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