Panda3D

Loading...
Searching...
No Matches
vertexDataBlock.I
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file vertexDataBlock.I
10 * @author drose
11 * @date 2007-06-04
12 */
13
14/**
15 *
16 */
17INLINE VertexDataBlock::
18VertexDataBlock(VertexDataPage *page, size_t start, size_t size) :
19 SimpleAllocatorBlock(page, start, size)
20{
21}
22
23/**
24 * Returns the page from which this buffer was allocated.
25 */
26INLINE VertexDataPage *VertexDataBlock::
27 get_page() const {
28 return (VertexDataPage *)get_allocator();
29}
30
31/**
32 * Returns a pointer to the start of the allocated memory for this buffer, or
33 * NULL if the data is not currently resident. If the data is not currently
34 * resident, this will implicitly request it to become resident soon.
35 *
36 * If force is true, this method will never return NULL, but may block until
37 * the data is available.
38 */
39INLINE unsigned char *VertexDataBlock::
40 get_pointer(bool force) const {
41 nassertr(get_page() != nullptr, nullptr);
42 unsigned char *page_data = get_page()->get_page_data(force);
43 if (page_data == nullptr) {
44 return nullptr;
45 } else {
46 return page_data + get_start();
47 }
48}
49
50/**
51 * Returns a pointer to the next allocated block in the chain, or NULL if
52 * there are no more allocated blocks.
53 */
54INLINE VertexDataBlock *VertexDataBlock::
55 get_next_block() const {
56 return (VertexDataBlock *)SimpleAllocatorBlock::get_next_block();
57}
SimpleAllocatorBlock
A single block as returned from SimpleAllocator::alloc().
Definition simpleAllocator.h:90
SimpleAllocatorBlock::get_allocator
SimpleAllocator * get_allocator() const
Returns the SimpleAllocator object that owns this block.
Definition simpleAllocator.I:215
SimpleAllocatorBlock::get_next_block
SimpleAllocatorBlock * get_next_block() const
Returns a pointer to the next allocated block in the chain, or NULL if there are no more allocated bl...
Definition simpleAllocator.I:274
SimpleAllocatorBlock::get_start
size_t get_start() const
Returns the starting point of this block.
Definition simpleAllocator.I:224
VertexDataBlock::get_page
VertexDataPage * get_page() const
Returns the page from which this buffer was allocated.
Definition vertexDataBlock.I:27
VertexDataBlock::get_next_block
VertexDataBlock * get_next_block() const
Returns a pointer to the next allocated block in the chain, or NULL if there are no more allocated bl...
Definition vertexDataBlock.I:55
VertexDataBlock::get_pointer
unsigned char * get_pointer(bool force) const
Returns a pointer to the start of the allocated memory for this buffer, or NULL if the data is not cu...
Definition vertexDataBlock.I:40
VertexDataPage
A block of bytes that holds one or more VertexDataBlocks.
Definition vertexDataPage.h:37
VertexDataPage::get_page_data
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.
Definition vertexDataPage.I:170