Source code repo: http://github.com/khizmax/libcds/
Download: http://sourceforge.net/projects/libcds/files/
-
+
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef CDSLIB_INTRUSIVE_DETAILS_ELLEN_BINTREE_BASE_H
: base_class( true )
, m_pLeft( nullptr )
, m_pRight( nullptr )
- , m_pUpdate( update_ptr() )
+ , m_pUpdate( update_ptr())
, m_nEmptyUpdate(0)
{}
//@cond
update_ptr null_update_desc()
{
- return update_ptr( reinterpret_cast<update_desc_type *>( (++m_nEmptyUpdate << 2) & 0xFFFF ) );
+ return update_ptr( reinterpret_cast<update_desc_type *>( (++m_nEmptyUpdate << 2) & 0xFFFF ));
}
base_class * get_child( bool bRight, atomics::memory_order mo ) const
event_counter m_nInsertSuccess ; ///< Count of success insertion
event_counter m_nInsertFailed ; ///< Count of failed insertion
event_counter m_nInsertRetries ; ///< Count of unsuccessful retries of insertion
- event_counter m_nEnsureExist ; ///< Count of \p ensure call for existed node
- event_counter m_nEnsureNew ; ///< Count of \p ensure call for new node
- event_counter m_nEnsureRetries ; ///< Count of unsuccessful retries of ensuring
+ event_counter m_nUpdateExist ; ///< Count of \p update() call for existed node
+ event_counter m_nUpdateNew ; ///< Count of \p update() call for new node
+ event_counter m_nUpdateRetries ; ///< Count of unsuccessful retries of ensuring
event_counter m_nEraseSuccess ; ///< Count of successful call of \p erase and \p unlink
event_counter m_nEraseFailed ; ///< Count of failed call of \p erase and \p unlink
event_counter m_nEraseRetries ; ///< Count of unsuccessful retries inside erasing/unlinking
void onInsertSuccess() { ++m_nInsertSuccess ; }
void onInsertFailed() { ++m_nInsertFailed ; }
void onInsertRetry() { ++m_nInsertRetries ; }
- void onEnsureExist() { ++m_nEnsureExist ; }
- void onEnsureNew() { ++m_nEnsureNew ; }
- void onEnsureRetry() { ++m_nEnsureRetries ; }
+ void onUpdateExist() { ++m_nUpdateExist ; }
+ void onUpdateNew() { ++m_nUpdateNew ; }
+ void onUpdateRetry() { ++m_nUpdateRetries ; }
void onEraseSuccess() { ++m_nEraseSuccess ; }
void onEraseFailed() { ++m_nEraseFailed ; }
void onEraseRetry() { ++m_nEraseRetries ; }
void onInsertSuccess() const {}
void onInsertFailed() const {}
void onInsertRetry() const {}
- void onEnsureExist() const {}
- void onEnsureNew() const {}
- void onEnsureRetry() const {}
+ void onUpdateExist() const {}
+ void onUpdateNew() const {}
+ void onUpdateRetry() const {}
void onEraseSuccess() const {}
void onEraseFailed() const {}
void onEraseRetry() const {}
template <typename LeafNode>
int operator()( internal_node<key_type, LeafNode> const& n1, internal_node<key_type, LeafNode> const& n2 ) const
{
- if ( n1.infinite_key() )
+ if ( n1.infinite_key())
return n2.infinite_key() ? n1.infinite_key() - n2.infinite_key() : 1;
- else if ( n2.infinite_key() )
+ else if ( n2.infinite_key())
return -1;
return operator()( n1.m_Key, n2.m_Key );
}
template <typename LeafNode, typename Q>
int operator()( internal_node<key_type, LeafNode> const& n, Q const& v ) const
{
- if ( n.infinite_key() )
+ if ( n.infinite_key())
return 1;
return operator()( n.m_Key, v );
}
template <typename LeafNode, typename Q>
int operator()( Q const& v, internal_node<key_type, LeafNode> const& n ) const
{
- if ( n.infinite_key() )
+ if ( n.infinite_key())
return -1;
return operator()( v, n.m_Key );
}
template <typename GC, typename Tag>
int operator()( node<GC, Tag> const& n1, node<GC, Tag> const& n2 ) const
{
- if ( n1.infinite_key() != n2.infinite_key() )
+ if ( n1.infinite_key() != n2.infinite_key())
return n1.infinite_key() - n2.infinite_key();
return operator()( *node_traits::to_value_ptr( n1 ), *node_traits::to_value_ptr( n2 ));
}
template <typename GC, typename Tag, typename Q>
int operator()( node<GC, Tag> const& n, Q const& v ) const
{
- if ( n.infinite_key() )
+ if ( n.infinite_key())
return 1;
return operator()( *node_traits::to_value_ptr( n ), v );
}
template <typename GC, typename Tag, typename Q>
int operator()( Q const& v, node<GC, Tag> const& n ) const
{
- if ( n.infinite_key() )
+ if ( n.infinite_key())
return -1;
- return operator()( v, *node_traits::to_value_ptr( n ) );
+ return operator()( v, *node_traits::to_value_ptr( n ));
}
template <typename GC>
int operator()( base_node<GC> const& n1, base_node<GC> const& n2 ) const
{
- if ( n1.infinite_key() != n2.infinite_key() )
+ if ( n1.infinite_key() != n2.infinite_key())
return n1.infinite_key() - n2.infinite_key();
- if ( n1.is_leaf() ) {
- if ( n2.is_leaf() )
+ if ( n1.is_leaf()) {
+ if ( n2.is_leaf())
return operator()( node_traits::to_leaf_node( n1 ), node_traits::to_leaf_node( n2 ));
else
return operator()( node_traits::to_leaf_node( n1 ), node_traits::to_internal_node( n2 ));
}
- if ( n2.is_leaf() )
+ if ( n2.is_leaf())
return operator()( node_traits::to_internal_node( n1 ), node_traits::to_leaf_node( n2 ));
else
return operator()( node_traits::to_internal_node( n1 ), node_traits::to_internal_node( n2 ));
{
if ( n.infinite_key())
return 1;
- if ( n.is_leaf() )
+ if ( n.is_leaf())
return operator()( node_traits::to_leaf_node( n ), v );
return operator()( node_traits::to_internal_node( n ), v );
}
template <typename GC, typename LeafNode >
int operator()( base_node<GC> const& i, internal_node<key_type, LeafNode> const& n ) const
{
- if ( i.is_leaf() )
+ if ( i.is_leaf())
return operator()( static_cast<LeafNode const&>(i), n );
return operator()( static_cast<internal_node<key_type, LeafNode> const&>(i), n );
}
template <typename GC, typename Tag >
int operator()( node<GC, Tag> const& n, internal_node<key_type, node<GC, Tag> > const& i ) const
{
- if ( !n.infinite_key() ) {
- if ( i.infinite_key() )
+ if ( !n.infinite_key()) {
+ if ( i.infinite_key())
return -1;
return operator()( n, i.m_Key );
}