Panda3D

Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
VertexDataPage Class Reference

A block of bytes that holds one or more VertexDataBlocks. More...

`#include "vertexDataPage.h"`

Inheritance diagram for VertexDataPage:

## Public Types
enum | RamClass { RC_resident , RC_compressed , RC_disk , RC_end_of_list }

## Public Member Functions
VertexDataBlock * | alloc (size_t size)
| Allocates a new block.
VertexDataBook * | get_book () const
| Returns a pointer to the book that owns this page.
VertexDataBlock * | get_first_block () const
| Returns a pointer to the first allocated block, or NULL if there are no allocated blocks.
unsigned char * | get_page_data (bool force)
| Returns a pointer to the page's data area, or NULL if the page is not currently resident.
RamClass | get_pending_ram_class () const
| Returns the pending ram class of the array.
RamClass | get_ram_class () const
| Returns the current ram class of the array.
bool | operator< (const VertexDataPage &other) const
| This comparison method is used to order pages within a book.
virtual void | output (std::ostream &out) const
void | request_resident ()
| Ensures that the page will become resident soon.
bool | save_to_disk ()
| Writes the page to disk, but does not evict it from memory or affect its LRU status.
virtual void | write (std::ostream &out, int indent_level) const
Public Member Functions inherited from SimpleAllocator
| SimpleAllocator (SimpleAllocator &&from) noexcept
| Move constructor.
| SimpleAllocator (size_t max_size, Mutex &lock)
SimpleAllocatorBlock * | alloc (size_t size, size_t alignment=1)
| Allocates a new block.
size_t | get_contiguous () const
| Returns an upper-bound estimate of the size of the largest contiguous block that may be allocated.
SimpleAllocatorBlock * | get_first_block () const
| Returns a pointer to the first allocated block, or NULL if there are no allocated blocks.
size_t | get_max_size () const
| Returns the available space for allocated objects.
size_t | get_total_size () const
| Returns the total size of allocated objects.
bool | is_empty () const
| Returns true if there are no blocks allocated on this page, or false if there is at least one.
void | output (std::ostream &out) const
void | set_max_size (size_t max_size)
| Changes the available space for allocated objects.
void | write (std::ostream &out) const
Public Member Functions inherited from SimpleLruPage
| 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.
SimpleLru * | get_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)
void | set_lru_size (size_t lru_size)
| Specifies the size of this page, presumably in bytes, although any unit is possible.

## Static Public Member Functions
static void | flush_threads ()
| Waits for all of the pending thread tasks to finish before returning.
static TypeHandle | get_class_type ()
static SimpleLru * | get_global_lru (RamClass rclass)
| Returns a pointer to the global LRU object that manages the VertexDataPage's with the indicated RamClass.
static int | get_num_pending_reads ()
| Returns the number of read requests that are waiting to be serviced by a thread.
static int | get_num_pending_writes ()
| Returns the number of write requests that are waiting to be serviced by a thread.
static int | get_num_threads ()
| Returns the number of threads that have been spawned to service vertex paging requests, or 0 if no threads have been spawned (which may mean either that all paging requests will be handled by the main thread, or simply that no paging requests have yet been issued).
static SimpleLru * | get_pending_lru ()
| Returns a pointer to the global LRU object that manages the VertexDataPage's that are pending processing by the thread.
static VertexDataSaveFile * | get_save_file ()
static void | init_type ()
static void | stop_threads ()
| Call this to stop the paging threads, if they were started.

## Public Attributes
| get_save_file
| Returns the global VertexDataSaveFile that will be used to save vertex data buffers to disk when necessary.

## Friends
class | PageThread
class | VertexDataBook

## Detailed Description

A block of bytes that holds one or more VertexDataBlocks.

The entire page may be paged out, in the form of in-memory compression or to an on-disk cache file, if necessary.

Definition at line 37 of file vertexDataPage.h.

## Member Enumeration Documentation

## ◆ RamClass

enum VertexDataPage::RamClass

Definition at line 47 of file vertexDataPage.h.

## Member Function Documentation

## ◆ alloc()

VertexDataBlock * VertexDataPage::alloc | ( | size_t | size | ) |
| inline

Allocates a new block.

Returns NULL if a block of the requested size cannot be allocated.

To free the allocated block, call block->free(), or simply delete the block pointer.

Definition at line 54 of file vertexDataPage.I.

## ◆ flush_threads()

void VertexDataPage::flush_threads | ( |  | ) |
| static

Waits for all of the pending thread tasks to finish before returning.

Definition at line 189 of file vertexDataPage.cxx.

References stop_threads().

## ◆ get_book()

VertexDataBook * VertexDataPage::get_book | ( |  | ) | const
| inline

Returns a pointer to the book that owns this page.

Definition at line 73 of file vertexDataPage.I.

## ◆ get_class_type()

static TypeHandle VertexDataPage::get_class_type | ( |  | ) |
| inline static

Definition at line 217 of file vertexDataPage.h.

## ◆ get_first_block()

VertexDataBlock * VertexDataPage::get_first_block | ( |  | ) | const
| inline

Returns a pointer to the first allocated block, or NULL if there are no allocated blocks.

Definition at line 64 of file vertexDataPage.I.

References SimpleAllocator::get_first_block().

## ◆ get_global_lru()

SimpleLru * VertexDataPage::get_global_lru | ( | RamClass | rclass | ) |
| inline static

Returns a pointer to the global LRU object that manages the VertexDataPage's with the indicated RamClass.

Definition at line 82 of file vertexDataPage.I.

Referenced by GeomVertexArrayData::lru_epoch(), and GraphicsEngine::render_frame().

## ◆ get_num_pending_reads()

int VertexDataPage::get_num_pending_reads | ( |  | ) |
| inline static

Returns the number of read requests that are waiting to be serviced by a thread.

Definition at line 139 of file vertexDataPage.I.

## ◆ get_num_pending_writes()

int VertexDataPage::get_num_pending_writes | ( |  | ) |
| inline static

Returns the number of write requests that are waiting to be serviced by a thread.

Definition at line 152 of file vertexDataPage.I.

## ◆ get_num_threads()

int VertexDataPage::get_num_threads | ( |  | ) |
| inline static

Returns the number of threads that have been spawned to service vertex paging requests, or 0 if no threads have been spawned (which may mean either that all paging requests will be handled by the main thread, or simply that no paging requests have yet been issued).

Definition at line 126 of file vertexDataPage.I.

## ◆ get_page_data()

unsigned char * VertexDataPage::get_page_data | ( | bool | force | ) |
| inline

Returns a pointer to the page's data area, or NULL if the page is not currently resident.

If the page is not currently resident, this will implicitly request it to become resident soon.

If force is true, this method will never return NULL, but may block until the page is available.

Definition at line 169 of file vertexDataPage.I.

References SimpleLruPage::mark_used_lru().

Referenced by VertexDataBlock::get_pointer().

## ◆ get_pending_lru()

SimpleLru * VertexDataPage::get_pending_lru | ( |  | ) |
| inline static

Returns a pointer to the global LRU object that manages the VertexDataPage's that are pending processing by the thread.

Definition at line 92 of file vertexDataPage.I.

Referenced by GraphicsEngine::render_frame().

## ◆ get_pending_ram_class()

VertexDataPage::RamClass VertexDataPage::get_pending_ram_class | ( |  | ) | const
| inline

Returns the pending ram class of the array.

If this is different from get_ram_class(), this page has been queued to be processed by the thread. Eventually the page will be set to this ram class.

Definition at line 29 of file vertexDataPage.I.

## ◆ get_ram_class()

VertexDataPage::RamClass VertexDataPage::get_ram_class | ( |  | ) | const
| inline

Returns the current ram class of the array.

If this is other than RC_resident, the array data is not resident in memory.

Definition at line 18 of file vertexDataPage.I.

## ◆ init_type()

static void VertexDataPage::init_type | ( |  | ) |
| inline static

Definition at line 220 of file vertexDataPage.h.

## ◆ operator<()

bool VertexDataPage::operator< | ( | const VertexDataPage & | other | ) | const
| inline

This comparison method is used to order pages within a book.

Definition at line 191 of file vertexDataPage.I.

## ◆ output()

void VertexDataPage::output | ( | std::ostream & | out | ) | const
| virtual

Reimplemented from SimpleLruPage.

Definition at line 213 of file vertexDataPage.cxx.

## ◆ request_resident()

void VertexDataPage::request_resident | ( |  | ) |
| inline

Ensures that the page will become resident soon.

Future calls to get_page_data() will eventually return non-NULL.

Definition at line 39 of file vertexDataPage.I.

## ◆ save_to_disk()

bool VertexDataPage::save_to_disk | ( |  | ) |
| inline

Writes the page to disk, but does not evict it from memory or affect its LRU status.

If it gets evicted later without having been modified, it will not need to write itself to disk again.

Definition at line 114 of file vertexDataPage.I.

## ◆ stop_threads()

void VertexDataPage::stop_threads | ( |  | ) |
| static

Call this to stop the paging threads, if they were started.

This may block until all of the pending tasks have been completed.

Definition at line 170 of file vertexDataPage.cxx.

Referenced by flush_threads(), and GraphicsEngine::remove_all_windows().

## ◆ write()

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

Reimplemented from SimpleLruPage.

Definition at line 221 of file vertexDataPage.cxx.

## Friends And Related Symbol Documentation

## ◆ PageThread

friend class PageThread
| friend

Definition at line 227 of file vertexDataPage.h.

## ◆ VertexDataBook

friend class VertexDataBook
| friend

Definition at line 228 of file vertexDataPage.h.

## Member Data Documentation

## ◆ get_save_file

VertexDataSaveFile * VertexDataPage::get_save_file
| inline

Returns the global VertexDataSaveFile that will be used to save vertex data buffers to disk when necessary.

Definition at line 67 of file vertexDataPage.h.

Referenced by GraphicsEngine::render_frame().

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

- panda/src/gobj/vertexDataPage.h
- panda/src/gobj/vertexDataPage.cxx
- panda/src/gobj/vertexDataPage.I