Panda3D

- Main Page
- Packages
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions

# AdaptiveLruPage Class Reference

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

Inheritance diagram for AdaptiveLruPage:

List of all members.

## Public Member Functions
| AdaptiveLruPage (AdaptiveLruPage const copy)
| AdaptiveLruPage (unsigned int lru_size)
| dequeueLru ()
| Removes the page from its AdaptiveLru.
| enqueueLru (AdaptiveLru lru)
| Adds the page to the LRU for the first time, or marks it recently-accessed if it has already been added.
| evictLru ()
| Evicts the page from the LRU.
AdaptiveLru | getLru ()
| Returns the LRU that manages this page, or NULL if it is not currently managed by any LRU.
unsigned int | getLruSize ()
| Returns the size of this page as reported to the LRU, presumably in bytes.
unsigned int | getNumFrames ()
| Returns the number of frames since the page was first added to its LRU.
unsigned int | getNumInactiveFrames ()
| Returns the number of frames since the page was last accessed on its LRU.
| markUsedLru (AdaptiveLru lru)
| To be called when the page is used; this will move it to the tail of the specified AdaptiveLru queue.
| markUsedLru ()
| To be called when the page is used; this will move it to the tail of the AdaptiveLru queue it is already on.
AdaptiveLruPage | operator= (AdaptiveLruPage const copy)
| output (ostream out)
| setLruSize (unsigned int lru_size)
| Specifies the size of this page, presumably in bytes, although any unit is possible.
| write (ostream out, int indent_level)

## Detailed Description

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

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

This class multiply inherits from two classes which in turn both inherit from LinkedListNode. This is just a sneaky C++ trick to allow this class to inherit from LinkedListNode twice, so that pages can be stored on two different linked lists simultaneously. The AdaptiveLru class depends on this; it maintains its pages in two different lists, one grouped by priority, and one in order by next partial update needs.

## Constructor & Destructor Documentation

AdaptiveLruPage | ( | AdaptiveLruPage const | copy | ) |

AdaptiveLruPage | ( | unsigned int | lru_size | ) |

## Member Function Documentation

dequeueLru | ( |  | ) |

Removes the page from its AdaptiveLru.

enqueueLru | ( | AdaptiveLru | 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.

evictLru | ( |  | ) |

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).

AdaptiveLru getLru | ( |  | ) |

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

unsigned int getLruSize | ( |  | ) |

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

unsigned int getNumFrames | ( |  | ) |

Returns the number of frames since the page was first added to its LRU.

Returns 0 if it does not have an LRU.

unsigned int getNumInactiveFrames | ( |  | ) |

Returns the number of frames since the page was last accessed on its LRU.

Returns 0 if it does not have an LRU.

markUsedLru | ( | AdaptiveLru | lru | ) |

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

markUsedLru | ( |  | ) |

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

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

AdaptiveLruPage operator= | ( | AdaptiveLruPage const | copy | ) |

output | ( | ostream | out | ) |

setLruSize | ( | unsigned int | lru_size | ) |

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

write | ( | ostream | out,
|  | int | indent_level
| ) |  |

All Classes Namespaces Functions Variables Enumerations Enumerator Properties