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_CONTAINER_MICHAEL_KVLIST_NOGC_H
typedef typename base_class::item_counter item_counter; ///< Item counting policy used
typedef typename maker::key_comparator key_comparator; ///< key comparison functor
typedef typename base_class::memory_model memory_model; ///< Memory ordering. See cds::opt::memory_model option
+ typedef typename base_class::stat stat; ///< Internal statistics
+
+ //@cond
+ // Rebind traits (split-list support)
+ template <typename... Options>
+ struct rebind_traits {
+ typedef MichaelKVList<
+ gc
+ , key_type, mapped_type
+ , typename cds::opt::make_options< traits, Options...>::type
+ > type;
+ };
+
+ // Stat selector
+ template <typename Stat>
+ using select_stat_wrapper = typename base_class::template select_stat_wrapper< Stat >;
+ //@endcond
protected:
//@cond
typedef typename maker::intrusive_traits::compare intrusive_key_comparator;
typedef typename base_class::atomic_node_ptr head_type;
- //@endcond
-
- protected:
- //@cond
- template <typename K>
- static node_type * alloc_node(const K& key)
- {
- return cxx_allocator().New( key );
- }
-
- template <typename K, typename V>
- static node_type * alloc_node( const K& key, const V& val )
- {
- return cxx_allocator().New( key, val );
- }
-
- template <typename K, typename... Args>
- static node_type * alloc_node( K&& key, Args&&... args )
- {
- return cxx_allocator().MoveNew( std::forward<K>(key), std::forward<Args>(args)... );
- }
-
- static void free_node( node_type * pNode )
- {
- cxx_allocator().Delete( pNode );
- }
struct node_disposer {
void operator()( node_type * pNode )
}
};
typedef std::unique_ptr< node_type, node_disposer > scoped_node_ptr;
-
- head_type& head()
- {
- return base_class::m_pHead;
- }
-
- head_type const& head() const
- {
- return base_class::m_pHead;
- }
//@endcond
protected:
}
//@}
- protected:
- //@cond
- iterator node_to_iterator( node_type * pNode )
- {
- if ( pNode )
- return iterator( *pNode );
- return end();
- }
- //@endcond
-
public:
/// Default constructor
/**
MichaelKVList()
{}
- /// List desctructor
+ //@cond
+ template <typename Stat, typename = std::enable_if<std::is_same<stat, michael_list::wrapped_stat<Stat>>::value >>
+ explicit MichaelKVList( Stat& st )
+ : base_class( st )
+ {}
+ //@endcond
+
+ /// List destructor
/**
Clears the list
*/
return base_class::size();
}
+ /// Returns const reference to internal statistics
+ stat const& statistics() const
+ {
+ return base_class::statistics();
+ }
+
/// Clears the list
void clear()
{
{
return base_class::find_at( refHead, key, cmp );
}
+
+ template <typename K>
+ static node_type * alloc_node( const K& key )
+ {
+ return cxx_allocator().New( key );
+ }
+
+ template <typename K, typename V>
+ static node_type * alloc_node( const K& key, const V& val )
+ {
+ return cxx_allocator().New( key, val );
+ }
+
+ template <typename K, typename... Args>
+ static node_type * alloc_node( K&& key, Args&&... args )
+ {
+ return cxx_allocator().MoveNew( std::forward<K>( key ), std::forward<Args>( args )... );
+ }
+
+ static void free_node( node_type * pNode )
+ {
+ cxx_allocator().Delete( pNode );
+ }
+
+ head_type& head()
+ {
+ return base_class::m_pHead;
+ }
+
+ head_type const& head() const
+ {
+ return base_class::m_pHead;
+ }
+
+ iterator node_to_iterator( node_type * pNode )
+ {
+ if ( pNode )
+ return iterator( *pNode );
+ return end();
+ }
//@endcond
};