Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
chainbase::chainbase_node_allocator< T, S > Class Template Reference

#include <chainbase_node_allocator.hpp>

Public Types

using value_type = T
 
using pointer = bip::offset_ptr<T>
 
using segment_manager = pinnable_mapped_file::segment_manager
 

Public Member Functions

 chainbase_node_allocator (segment_manager *manager)
 
 chainbase_node_allocator (const chainbase_node_allocator &other)
 
template<typename U >
 chainbase_node_allocator (const chainbase_node_allocator< U, S > &other)
 
pointer allocate (std::size_t num)
 
void deallocate (const pointer &p, std::size_t num)
 
bool operator== (const chainbase_node_allocator &other) const
 
bool operator!= (const chainbase_node_allocator &other) const
 
segment_managerget_segment_manager () const
 

Friends

template<typename T2 , typename S2 >
class chainbase_node_allocator
 

Detailed Description

template<typename T, typename S>
class chainbase::chainbase_node_allocator< T, S >

Definition at line 218 of file undo_index.hpp.

Member Typedef Documentation

◆ pointer

template<typename T , typename S >
using chainbase::chainbase_node_allocator< T, S >::pointer = bip::offset_ptr<T>

Definition at line 16 of file chainbase_node_allocator.hpp.

◆ segment_manager

template<typename T , typename S >
using chainbase::chainbase_node_allocator< T, S >::segment_manager = pinnable_mapped_file::segment_manager

Definition at line 17 of file chainbase_node_allocator.hpp.

◆ value_type

template<typename T , typename S >
using chainbase::chainbase_node_allocator< T, S >::value_type = T

Definition at line 15 of file chainbase_node_allocator.hpp.

Constructor & Destructor Documentation

◆ chainbase_node_allocator() [1/3]

template<typename T , typename S >
chainbase::chainbase_node_allocator< T, S >::chainbase_node_allocator ( segment_manager * manager)
inline

Definition at line 18 of file chainbase_node_allocator.hpp.

18: _manager{manager} {}

◆ chainbase_node_allocator() [2/3]

template<typename T , typename S >
chainbase::chainbase_node_allocator< T, S >::chainbase_node_allocator ( const chainbase_node_allocator< T, S > & other)
inline

Definition at line 19 of file chainbase_node_allocator.hpp.

19: _manager(other._manager) {}

◆ chainbase_node_allocator() [3/3]

template<typename T , typename S >
template<typename U >
chainbase::chainbase_node_allocator< T, S >::chainbase_node_allocator ( const chainbase_node_allocator< U, S > & other)
inline

Definition at line 21 of file chainbase_node_allocator.hpp.

21: _manager(other._manager) {}

Member Function Documentation

◆ allocate()

template<typename T , typename S >
pointer chainbase::chainbase_node_allocator< T, S >::allocate ( std::size_t num)
inline

Definition at line 22 of file chainbase_node_allocator.hpp.

22 {
23 if (num == 1) {
24 if (_freelist == nullptr) {
25 get_some();
26 }
27 list_item* result = &*_freelist;
28 _freelist = _freelist->_next;
29 result->~list_item();
30 return pointer{(T*)result};
31 } else {
32 return pointer{(T*)_manager->allocate(num*sizeof(T))};
33 }
34 }
#define T(meth, val, expected)

◆ deallocate()

template<typename T , typename S >
void chainbase::chainbase_node_allocator< T, S >::deallocate ( const pointer & p,
std::size_t num )
inline

Definition at line 35 of file chainbase_node_allocator.hpp.

35 {
36 if (num == 1) {
37 _freelist = new (&*p) list_item{_freelist};
38 } else {
39 _manager->deallocate(&*p);
40 }
41 }
const mie::Vuint & p
Definition bn.cpp:27

◆ get_segment_manager()

template<typename T , typename S >
segment_manager * chainbase::chainbase_node_allocator< T, S >::get_segment_manager ( ) const
inline

Definition at line 44 of file chainbase_node_allocator.hpp.

44{ return _manager.get(); }

◆ operator!=()

template<typename T , typename S >
bool chainbase::chainbase_node_allocator< T, S >::operator!= ( const chainbase_node_allocator< T, S > & other) const
inline

Definition at line 43 of file chainbase_node_allocator.hpp.

43{ return this != &other; }

◆ operator==()

template<typename T , typename S >
bool chainbase::chainbase_node_allocator< T, S >::operator== ( const chainbase_node_allocator< T, S > & other) const
inline

Definition at line 42 of file chainbase_node_allocator.hpp.

42{ return this == &other; }

Friends And Related Symbol Documentation

◆ chainbase_node_allocator

template<typename T , typename S >
template<typename T2 , typename S2 >
friend class chainbase_node_allocator
friend

Definition at line 47 of file chainbase_node_allocator.hpp.


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