Panda3D
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
SimpleLruPage Class Reference

One atomic piece that may be managed by a SimpleLru chain. More...

#include "simpleLru.h"

Inheritance diagram for SimpleLruPage:
LinkedListNode GeomVertexArrayData SamplerContext VertexDataPage

Public Member Functions

 SimpleLruPage (const SimpleLruPage &copy)
 
 SimpleLruPage (size_t lru_size)
 
void dequeue_lru ()
 Removes the page from its SimpleLru.
 
void enqueue_lru (SimpleLru *lru)
 Adds the page to the LRU for the first time, or marks it recently-accessed if it has already been added.
 
virtual void evict_lru ()
 Evicts the page from the LRU.
 
SimpleLruget_lru () const
 Returns the LRU that manages this page, or NULL if it is not currently managed by any LRU.
 
size_t get_lru_size () const
 Returns the size of this page as reported to the LRU, presumably in bytes.
 
void mark_used_lru () const
 To be called when the page is used; this will move it to the tail of the SimpleLru queue it is already on.
 
void mark_used_lru (SimpleLru *lru)
 To be called when the page is used; this will move it to the tail of the specified SimpleLru queue.
 
void operator= (const SimpleLruPage &copy)
 
virtual void output (std::ostream &out) const
 
void set_lru_size (size_t lru_size)
 Specifies the size of this page, presumably in bytes, although any unit is possible.
 
virtual void write (std::ostream &out, int indent_level) const
 

Friends

class SimpleLru
 

Detailed Description

One atomic piece that may be managed by a SimpleLru chain.

To use this class, inherit from it and override evict_lru().

Definition at line 65 of file simpleLru.h.

Constructor & Destructor Documentation

◆ SimpleLruPage() [1/2]

SimpleLruPage::SimpleLruPage ( size_t lru_size)
inlineexplicit

Definition at line 95 of file simpleLru.I.

◆ SimpleLruPage() [2/2]

SimpleLruPage::SimpleLruPage ( const SimpleLruPage & copy)
inline

Definition at line 105 of file simpleLru.I.

◆ ~SimpleLruPage()

SimpleLruPage::~SimpleLruPage ( )
virtual

Definition at line 211 of file simpleLru.cxx.

Member Function Documentation

◆ dequeue_lru()

void SimpleLruPage::dequeue_lru ( )
inline

Removes the page from its SimpleLru.

Definition at line 133 of file simpleLru.I.

Referenced by GeomVertexArrayData::evict_lru(), and evict_lru().

◆ enqueue_lru()

void SimpleLruPage::enqueue_lru ( SimpleLru * lru)

Adds the page to the LRU for the first time, or marks it recently-accessed if it has already been added.

If lru is NULL, it means to remove this page from its LRU.

Definition at line 63 of file simpleLru.cxx.

Referenced by SimpleLru::begin_epoch(), and mark_used_lru().

◆ evict_lru()

void SimpleLruPage::evict_lru ( )
virtual

Evicts the page from the LRU.

Called internally when the LRU determines that it is full. May also be called externally when necessary to explicitly evict the page.

It is legal for this method to either evict the page as requested, do nothing (in which case the eviction will be requested again at the next epoch), or requeue itself on the tail of the queue (in which case the eviction will be requested again much later).

Reimplemented in GeomVertexArrayData.

Definition at line 228 of file simpleLru.cxx.

References dequeue_lru().

◆ get_lru()

SimpleLru * SimpleLruPage::get_lru ( ) const
inline

Returns the LRU that manages this page, or NULL if it is not currently managed by any LRU.

Definition at line 124 of file simpleLru.I.

◆ get_lru_size()

size_t SimpleLruPage::get_lru_size ( ) const
inline

Returns the size of this page as reported to the LRU, presumably in bytes.

Definition at line 170 of file simpleLru.I.

◆ mark_used_lru() [1/2]

void SimpleLruPage::mark_used_lru ( ) const
inline

To be called when the page is used; this will move it to the tail of the SimpleLru queue it is already on.

This method is const because it's not technically modifying the contents of the page itself.

Definition at line 151 of file simpleLru.I.

Referenced by VertexDataPage::get_page_data(), and GeomVertexArrayData::operator=().

◆ mark_used_lru() [2/2]

void SimpleLruPage::mark_used_lru ( SimpleLru * lru)
inline

To be called when the page is used; this will move it to the tail of the specified SimpleLru queue.

Definition at line 162 of file simpleLru.I.

References enqueue_lru().

◆ operator=()

void SimpleLruPage::operator= ( const SimpleLruPage & copy)
inline

Definition at line 115 of file simpleLru.I.

◆ output()

void SimpleLruPage::output ( std::ostream & out) const
virtual

Definition at line 236 of file simpleLru.cxx.

◆ set_lru_size()

void SimpleLruPage::set_lru_size ( size_t lru_size)
inline

Specifies the size of this page, presumably in bytes, although any unit is possible.

Definition at line 179 of file simpleLru.I.

◆ write()

void SimpleLruPage::write ( std::ostream & out,
int indent_level ) const
virtual

Definition at line 244 of file simpleLru.cxx.

Friends And Related Symbol Documentation

◆ SimpleLru

friend class SimpleLru
friend

Definition at line 94 of file simpleLru.h.


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