15#ifndef PSTSDK_NDB_PAGE_H
16#define PSTSDK_NDB_PAGE_H
27#pragma warning(disable:4250)
89template<
typename K,
typename V>
118template<
typename K,
typename V>
122 public std::enable_shared_from_this<bt_nonleaf_page<K,V> >
130#ifndef BOOST_NO_RVALUE_REFERENCES
132 :
bt_page<K,V>(
db,
pi, level), m_page_info(std::
move(
subpi)), m_child_pages(m_page_info.size()) { }
135 :
bt_page<K,V>(
db,
pi, level), m_page_info(
subpi), m_child_pages(m_page_info.size()) { }
145 std::vector<std::pair<K, page_info> > m_page_info;
146 mutable std::vector<std::shared_ptr<bt_page<K,V> > > m_child_pages;
153template<
typename K,
typename V>
157 public std::enable_shared_from_this<bt_leaf_page<K,V> >
164#ifndef BOOST_NO_RVALUE_REFERENCES
174 {
return m_page_data[
pos].second; }
176 {
return m_page_data[
pos].first; }
178 {
return m_page_data.size(); }
181 std::vector<std::pair<K,V> > m_page_data;
187 if(m_child_pages[pos] == NULL)
189 m_child_pages[pos] = this->get_db_ptr()->read_bbt_page(m_page_info[pos].second);
192 return m_child_pages[pos].get();
198 if(m_child_pages[pos] == NULL)
200 m_child_pages[pos] = this->get_db_ptr()->read_bbt_page(m_page_info[pos].second);
203 return m_child_pages[pos].get();
209 if(m_child_pages[pos] == NULL)
211 m_child_pages[pos] = this->get_db_ptr()->read_nbt_page(m_page_info[pos].second);
214 return m_child_pages[pos].get();
220 if(m_child_pages[pos] == NULL)
222 m_child_pages[pos] = this->get_db_ptr()->read_nbt_page(m_page_info[pos].second);
225 return m_child_pages[pos].get();
Generic BTree implementation.
Contains the actual key value pairs of the btree.
const V & get_value(uint pos) const
Returns the value at the associated position on this leaf node.
uint num_values() const
Returns the number of entries in this btree_node.
const K & get_key(uint pos) const
Returns the key at the specified position.
bt_leaf_page(const shared_db_ptr &db, const page_info &pi, std::vector< std::pair< K, V > > data)
Construct a leaf page from disk.
Contains references to other bt_pages.
const bt_page< K, V > * get_child(uint pos) const
Returns the child btree_node at the requested location.
bt_page< K, V > * get_child(uint pos)
Returns the child btree_node at the requested location.
bt_nonleaf_page(const shared_db_ptr &db, const page_info &pi, ushort level, std::vector< std::pair< K, page_info > > subpi)
Construct a bt_nonleaf_page from disk.
const K & get_key(uint pos) const
Returns the key at the specified position.
uint num_values() const
Returns the number of entries in this btree_node.
bt_page(const shared_db_ptr &db, const page_info &pi, ushort level)
Construct a bt_page from disk.
ushort get_level() const
Returns the level of this bt_page.
Contains references to other bth_node allocations.
Represents a leaf node in a BTree structure.
Represents a non-leaf node in a BTree structure.
Generic base class for all page typesA page which forms a node in the NBT or BBT.
ulonglong get_address() const
Get the physical address of this page.
page_id get_page_id() const
Get the page id.
shared_db_ptr get_db_ptr() const
page(const shared_db_ptr &db, const page_info &pi)
Construct a page from disk.
weak_db_ptr m_db
The database context we're a member of.
ulonglong m_address
Address of this page.
boost::uint64_t ulonglong
Contains the definition of all in memory representations of disk structures.
std::weak_ptr< db_context > weak_db_ptr
std::shared_ptr< db_context > shared_db_ptr
An in memory, database format agnostic version of disk::block_reference used specifically for the pag...
General utility functions and classes.