Panda3D
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
VertexDataPage Class Reference

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

Inheritance diagram for VertexDataPage:
SimpleAllocator SimpleLruPage

Public Types

enum  RamClass { RC_resident = 0, RC_compressed = 1, RC_disk = 2, RC_end_of_list = 3 }
 

Public Member Functions

VertexDataBlock alloc (int size)
 Allocates a new block. More...
 
VertexDataBook getBook ()
 Returns a pointer to the book that owns this page. More...
 
VertexDataBlock getFirstBlock ()
 Returns a pointer to the first allocated block, or NULL if there are no allocated blocks. More...
 
VertexDataPage::RamClass getPendingRamClass ()
 Returns the pending ram class of the array. More...
 
VertexDataPage::RamClass getRamClass ()
 Returns the current ram class of the array. More...
 
 output (Ostream out)
 
 requestResident ()
 Ensures that the page will become resident soon. More...
 
bool saveToDisk ()
 Writes the page to disk, but does not evict it from memory or affect its LRU status. More...
 
 write (Ostream out, int indent_level)
 
- Public Member Functions inherited from SimpleAllocator
 __init__ (SimpleAllocator from)
 Move constructor. More...
 
 __init__ (int max_size, Mutex lock)
 
SimpleAllocatorBlock alloc (int size, int alignment)
 Allocates a new block. More...
 
int getContiguous ()
 Returns an upper-bound estimate of the size of the largest contiguous block that may be allocated. More...
 
SimpleAllocatorBlock getFirstBlock ()
 Returns a pointer to the first allocated block, or NULL if there are no allocated blocks. More...
 
int getMaxSize ()
 Returns the available space for allocated objects. More...
 
int getTotalSize ()
 Returns the total size of allocated objects. More...
 
bool isEmpty ()
 Returns true if there are no blocks allocated on this page, or false if there is at least one. More...
 
 output (Ostream out)
 
 setMaxSize (int max_size)
 Changes the available space for allocated objects. More...
 
 write (Ostream out)
 
- Public Member Functions inherited from SimpleLruPage
 __init__ (const SimpleLruPage copy)
 
 __init__ (int lru_size)
 
 dequeueLru ()
 Removes the page from its SimpleLru. More...
 
 enqueueLru (SimpleLru lru)
 Adds the page to the LRU for the first time, or marks it recently-accessed if it has already been added. More...
 
 evictLru ()
 Evicts the page from the LRU. More...
 
SimpleLru getLru ()
 Returns the LRU that manages this page, or NULL if it is not currently managed by any LRU. More...
 
int getLruSize ()
 Returns the size of this page as reported to the LRU, presumably in bytes. More...
 
 markUsedLru ()
 To be called when the page is used; this will move it to the tail of the SimpleLru queue it is already on. More...
 
 markUsedLru (SimpleLru lru)
 To be called when the page is used; this will move it to the tail of the specified SimpleLru queue. More...
 
SimpleLruPage operator= (const SimpleLruPage copy)
 
 output (Ostream out)
 
 setLruSize (int lru_size)
 Specifies the size of this page, presumably in bytes, although any unit is possible. More...
 
 write (Ostream out, int indent_level)
 

Static Public Member Functions

static flushThreads ()
 Waits for all of the pending thread tasks to finish before returning. More...
 
static TypeHandle getClassType ()
 
static SimpleLru getGlobalLru (VertexDataPage::RamClass rclass)
 Returns a pointer to the global LRU object that manages the VertexDataPage's with the indicated RamClass. More...
 
static int getNumPendingReads ()
 Returns the number of read requests that are waiting to be serviced by a thread. More...
 
static int getNumPendingWrites ()
 Returns the number of write requests that are waiting to be serviced by a thread. More...
 
static int getNumThreads ()
 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). More...
 
static SimpleLru getPendingLru ()
 Returns a pointer to the global LRU object that manages the VertexDataPage's that are pending processing by the thread. More...
 
static VertexDataSaveFile getSaveFile ()
 Returns the global VertexDataSaveFile that will be used to save vertex data buffers to disk when necessary. More...
 
static stopThreads ()
 Call this to stop the paging threads, if they were started. More...
 

Public Attributes

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

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.

Member Enumeration Documentation

◆ RamClass

enum RamClass
Enumerator
RC_resident 
RC_compressed 
RC_disk 
RC_end_of_list 

list marker; do not use

Member Function Documentation

◆ alloc()

VertexDataBlock alloc ( int  size)

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 flushThreads ( )
static

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

◆ getBook()

VertexDataBook getBook ( )

Returns a pointer to the book that owns this page.

◆ getClassType()

static TypeHandle getClassType ( )
static

◆ getFirstBlock()

VertexDataBlock getFirstBlock ( )

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

◆ getGlobalLru()

static SimpleLru getGlobalLru ( VertexDataPage::RamClass  rclass)
static

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

◆ getNumPendingReads()

static int getNumPendingReads ( )
static

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

◆ getNumPendingWrites()

static int getNumPendingWrites ( )
static

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

◆ getNumThreads()

static int getNumThreads ( )
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).

◆ getPendingLru()

static SimpleLru getPendingLru ( )
static

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

◆ getPendingRamClass()

VertexDataPage::RamClass getPendingRamClass ( )

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 getRamClass ( )

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 getSaveFile ( )
static

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

◆ output()

output ( Ostream  out)

◆ requestResident()

requestResident ( )

Ensures that the page will become resident soon.

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

◆ saveToDisk()

bool saveToDisk ( )

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 stopThreads ( )
static

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

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

◆ write()

write ( Ostream  out,
int  indent_level 
)

Member Data Documentation

◆ save_file

VertexDataSaveFile save_file

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