# 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
flushThreads
getBook
getClassType
getFirstBlock
getGlobalLru
getNumPendingReads
getNumPendingWrites
getNumThreads
getPendingLru
getPendingRamClass
getRamClass
getSaveFile
output
requestResident
saveToDisk
stopThreads
write

## Methods of SimpleAllocator:

SimpleAllocator (Constructor)
alloc
getContiguous
getFirstBlock
getMaxSize
getTotalSize
isEmpty
output
setMaxSize
write

## Methods of SimpleLruPage:

SimpleLruPage (Constructor)
dequeueLru
enqueueLru
evictLru
getLru
getLruSize
markUsedLru
operator =
output
setLruSize
write

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

flushThreads static void VertexDataPage::flush_threads(void); Description: Waits for all of the pending thread tasks to finish before returning.

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.

getNumPendingReads static int VertexDataPage::get_num_pending_reads(void); Description: Returns the number of read requests that are waiting to be serviced by a thread.

getNumPendingWrites static int VertexDataPage::get_num_pending_writes(void); Description: Returns the number of write requests that are waiting to be serviced by a thread.

getNumThreads static int VertexDataPage::get_num_threads(void); Description: 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).

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

output virtual void VertexDataPage::output(ostream &out) const; Description:

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.

stopThreads static void VertexDataPage::stop_threads(void); Description: Call this to stop the paging threads, if they were started. This may block until all of the pending tasks have been completed.

write virtual void VertexDataPage::write(ostream &out, int indent_level) const; Description:

SimpleAllocator SimpleAllocator::SimpleAllocator(unsigned int max_size, Mutex &lock); Description:

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:

SimpleLruPage SimpleLruPage::SimpleLruPage(unsigned int lru_size); 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 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 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:

output virtual void SimpleLruPage::output(ostream &out) const; 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.

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