#include <PagedMemory.h>
Public Member Functions | |
uint32_t | at (size_t pos) const |
uint32_t | at (size_t pos) const |
const_iterator (const const_iterator &other) | |
const_iterator () | |
const_iterator (const const_iterator &other) | |
const_iterator () | |
uint32_t | operator * (void) const |
uint32_t | operator * (void) const |
bool | operator!= (const const_iterator &other) const |
bool | operator!= (const const_iterator &other) const |
const_iterator & | operator++ (void) |
const_iterator & | operator++ (void) |
const_iterator & | operator+= (size_t offset) |
const_iterator & | operator+= (size_t offset) |
int32_t | operator- (const const_iterator &other) const |
int32_t | operator- (const const_iterator &other) const |
const_iterator & | operator-- () |
const_iterator & | operator-- () |
const_iterator & | operator-= (size_t offset) |
const_iterator & | operator-= (size_t offset) |
bool | operator< (const const_iterator &other) const |
bool | operator< (const const_iterator &other) const |
const_iterator & | operator= (const const_iterator &other) |
const_iterator & | operator= (const const_iterator &other) |
bool | operator== (const const_iterator &other) const |
bool | operator== (const const_iterator &other) const |
bool | operator> (const const_iterator &other) const |
bool | operator> (const const_iterator &other) const |
uint32_t | operator[] (size_t pos) const |
uint32_t | operator[] (size_t pos) const |
~const_iterator () | |
~const_iterator () | |
Private Member Functions | |
const_iterator (const node_t *node, size_t offset) | |
const_iterator (const node_t *node, size_t offset) | |
Private Attributes | |
const node_t * | m_node |
base address of the index table | |
const node_t * | m_node |
base address of the index table | |
size_t | m_off |
the current offset, in 32-bit words | |
Friends | |
class | PagedMemory |
|
Builds a new iterator giving an index and an offset inside that index.
|
|
Returns an iterator that points nowhere, to fake similar behaviour as the normal pointers.
|
|
Copies the value of an iterator
|
|
Destroys an iterator 00138 {}
|
|
Builds a new iterator giving an index and an offset inside that index.
|
|
Returns an iterator that points nowhere, to fake similar behaviour as the normal pointers.
|
|
Copies the value of an iterator
|
|
Destroys an iterator 00138 {}
|
|
Gets a value away N positions from this iterator, checked and may throw an exception
|
|
Gets a value away N positions from this iterator, checked and may throw an exception
00331 { 00332 //immediate return (most of the cases) 00333 if (m_off + pos < m_node->end) { //trying to reach data on the current page 00334 return CAST32(m_node->page->iov_base)[(m_off+pos)-m_node->start]; 00335 } 00336 00337 //immediate points of failure 00338 if (!m_node || (m_node->next == 0 && (m_off+pos) >= m_node->end)) 00339 throw EFORMAT_OUT_OF_BOUNDS(0, pos << 2); 00340 00341 //if I get here, the data is on another page and the request might still be 00342 //out of bounds, so watch. 00343 const_iterator it = *this; 00344 it += pos; 00345 return it.at(0); 00346 }
|
|
Gets the current value for the pointed position, as a 32-bit integer. This is unchecked so you have to make sure you are before end().
|
|
Gets the current value for the pointed position, as a 32-bit integer. This is unchecked so you have to make sure you are before end().
|
|
Compares two pointers
|
|
Compares two pointers
|
|
Advances forward on the pointing place, 4 bytes or 1 word. This is the prefix operator. |
|
Advances forward on the pointing place, 4 bytes or 1 word. This is the prefix operator. 00350 { 00351 ++m_off; 00352 if ( m_off >= (m_node->end) ) { 00353 if (!m_node->next) { //it was the last 00354 m_off = m_node->end; 00355 return *this; 00356 } 00357 m_node = m_node->next; 00358 m_off = m_node->start; 00359 } 00360 return *this; 00361 }
|
|
Advances forward on the pointing place, by a number of (32-bit) words
|
|
Advances forward on the pointing place, by a number of (32-bit) words
00380 { 00381 size_t aim = offset + m_off; 00382 while (aim >= (m_node->end)) { 00383 if (m_node->next) m_node = m_node->next; 00384 else { //it was the last 00385 m_off = m_node->end; 00386 return *this; 00387 } 00388 } 00389 m_off = aim; 00390 return *this; 00391 }
|
|
Returns the difference in position between two iterators
|
|
Returns the difference in position between two iterators
|
|
Step back on the pointing place, 4 bytes or 1 word. This is the prefix operator. |
|
Step back on the pointing place, 4 bytes or 1 word. This is the prefix operator. 00365 { 00366 --m_off; 00367 if ( m_off < (m_node->start) ) { 00368 if (!m_node->previous) { //it was the last 00369 m_off = m_node->start; 00370 return *this; 00371 } 00372 m_node = m_node->previous; 00373 m_off = m_node->end - 1; 00374 } 00375 return *this; 00376 }
|
|
Retrocesses on the pointing place, by a number of (32-bit) words
|
|
Retrocesses on the pointing place, by a number of (32-bit) words
00395 { 00396 size_t aim = m_off - offset; 00397 while (aim < (m_node->start)) { 00398 if (m_node->previous) m_node = m_node->previous; 00399 else { //it was the first 00400 m_off = m_node->start; 00401 return *this; 00402 } 00403 } 00404 m_off = aim; 00405 return *this; 00406 }
|
|
Compares two operators (offset comparison)
|
|
Compares two operators (offset comparison)
|
|
Copies the value of an iterator
|
|
Copies the value of an iterator
|
|
Compares two pointers
00160 { return !(*this != other); }
|
|
Compares two pointers
00160 { return !(*this != other); }
|
|
Compares two operators (offset comparison)
|
|
Compares two operators (offset comparison)
|
|
Gets a value away N positions from this iterator, unchecked
|
|
Gets a value away N positions from this iterator, unchecked
00319 { 00320 if (m_off + pos < m_node->end) { //trying to reach data on the current page 00321 return CAST32(m_node->page->iov_base)[(m_off+pos)-m_node->start]; 00322 } 00323 //otherwise it is not on this page, I have to find the page 00324 const_iterator it = *this; 00325 it += pos; 00326 return *it; 00327 }
|
|
|
|
base address of the index table
|
|
base address of the index table
|
|
the current offset, in 32-bit words
|