# VertexDataPage

from pandac.PandaModules import VertexDataPage

Class : VertexDataPage
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.

## Inheritance:

VertexDataPage: SimpleAllocator SimpleLruPage
SimpleAllocator: LinkedListNode
LinkedListNode:
SimpleLruPage: LinkedListNode

## Methods of VertexDataPage:

alloc
getBook
getClassType
getFirstBlock
getGlobalLru
getPendingLru
getPendingRamClass
getRamClass
getSaveFile
hasThread
requestResident
saveToDisk
stopThread

## Methods of SimpleAllocator:

alloc
getContiguous
getFirstBlock
getMaxSize
getTotalSize
isEmpty
output
setMaxSize
write

## Methods of SimpleLruPage:

dequeueLru
enqueueLru
evictLru
getLru
getLruSize
markUsedLru
operator =
setLruSize

## Constants in VertexDataPage:

RCResident | (RamClass)
RCCompressed | (RamClass)
RCDisk | (RamClass)
RCEndOfList | (RamClass)

alloc VertexDataBlock *VertexDataPage::alloc(unsigned int size); Description: 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.

getBook VertexDataBook *VertexDataPage::get_book(void) const; Description: Returns a pointer to the book that owns this page.

getClassType static TypeHandle VertexDataPage::get_class_type(void); Undocumented function.

getFirstBlock VertexDataBlock *VertexDataPage::get_first_block(void) const; Description: Returns a pointer to the first allocated block, or NULL if there are no allocated blocks.

getGlobalLru static SimpleLru *VertexDataPage::get_global_lru(VertexDataPage::RamClass rclass); Description: Returns a pointer to the global LRU object that manages the VertexDataPage's with the indicated RamClass.

getPendingLru static SimpleLru *VertexDataPage::get_pending_lru(void); Description: Returns a pointer to the global LRU object that manages the VertexDataPage's that are pending processing by the thread.

getPendingRamClass VertexDataPage::RamClass VertexDataPage::get_pending_ram_class(void) const; Description: 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.

getRamClass VertexDataPage::RamClass VertexDataPage::get_ram_class(void) const; Filename: vertexDataPage.I Created by: drose (04Jun07) PANDA 3D SOFTWARE Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved All use of this software is subject to the terms of the Panda 3d Software license. You should have received a copy of this license along with this source code; you will also find a current copy of the license at http://etc.cmu.edu/panda3d/docs/license/ . To contact the maintainers of this program write to panda3d-general@lists.sourceforge.net . Description: Returns the current ram class of the array. If this is other than RC_resident, the array data is not resident in memory.

getSaveFile static VertexDataSaveFile *VertexDataPage::get_save_file(void); Description: Returns the global VertexDataSaveFile that will be used to save vertex data buffers to disk when necessary.

hasThread static bool VertexDataPage::has_thread(void); Description: Returns true if a thread has been spawned to service vertex paging requests, or false if it has not (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).

requestResident void VertexDataPage::request_resident(void); Description: Ensures that the page will become resident soon. Future calls to get_page_data() will eventually return non-NULL.

saveToDisk bool VertexDataPage::save_to_disk(void); Description: 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.

stopThread static void VertexDataPage::stop_thread(void); Description: Call this to stop the paging thread, if it was started. This may block until all of the thread's pending tasks have been completed.

alloc SimpleAllocatorBlock *SimpleAllocator::alloc(unsigned int size); Description: 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.

getContiguous unsigned int SimpleAllocator::get_contiguous(void) const; Description: Returns an upper-bound estimate of the size of the largest contiguous block that may be allocated. It is guaranteed that an attempt to allocate a block larger than this will fail, though it is not guaranteed that an attempt to allocate a block this size or smaller will succeed.

getFirstBlock SimpleAllocatorBlock *SimpleAllocator::get_first_block(void) const; Description: Returns a pointer to the first allocated block, or NULL if there are no allocated blocks.

getMaxSize unsigned int SimpleAllocator::get_max_size(void) const; Description: Returns the available space for allocated objects.

getTotalSize unsigned int SimpleAllocator::get_total_size(void) const; Description: Returns the total size of allocated objects.

isEmpty bool SimpleAllocator::is_empty(void) const; Description: Returns true if there are no blocks allocated on this page, or false if there is at least one.

output void SimpleAllocator::output(ostream &out) const; Description:

setMaxSize void SimpleAllocator::set_max_size(unsigned int max_size); Description: Changes the available space for allocated objects. This will not affect any already-allocated objects, but will have an effect on future calls to alloc().

write void SimpleAllocator::write(ostream &out) const; Description:

dequeueLru void SimpleLruPage::dequeue_lru(void); Description: Removes the page from its SimpleLru.

enqueueLru void SimpleLruPage::enqueue_lru(SimpleLru *lru); Description: Adds the page to the tail of the SimpleLru. When it reaches the head, it will be the next to be evicted.

evictLru virtual void SimpleLruPage::evict_lru(void); Description: 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).

getLru SimpleLru *SimpleLruPage::get_lru(void) const; Description: Returns the LRU that manages this page, or NULL if it is not currently managed by any LRU.

getLruSize unsigned int SimpleLruPage::get_lru_size(void) const; Description: Returns the size of this page as reported to the LRU, presumably in bytes.

markUsedLru void SimpleLruPage::mark_used_lru(void) const; Description: 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. Description: To be called when the page is used; this will move it to the tail of the specified SimpleLru queue.

operator = void SimpleLruPage::operator =(SimpleLruPage const &copy); Description:

setLruSize void SimpleLruPage::set_lru_size(unsigned int lru_size); Description: Specifies the size of this page, presumably in bytes, although any unit is possible.