00001 // Filename: vertexDataBlock.I 00002 // Created by: drose (04Jun07) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 00016 //////////////////////////////////////////////////////////////////// 00017 // Function: VertexDataBlock::Constructor 00018 // Access: Published 00019 // Description: 00020 //////////////////////////////////////////////////////////////////// 00021 INLINE VertexDataBlock:: 00022 VertexDataBlock(VertexDataPage *page, size_t start, size_t size) : 00023 SimpleAllocatorBlock(page, start, size) 00024 { 00025 } 00026 00027 //////////////////////////////////////////////////////////////////// 00028 // Function: VertexDataBlock::get_page 00029 // Access: Published 00030 // Description: Returns the page from which this buffer was 00031 // allocated. 00032 //////////////////////////////////////////////////////////////////// 00033 INLINE VertexDataPage *VertexDataBlock:: 00034 get_page() const { 00035 return (VertexDataPage *)get_allocator(); 00036 } 00037 00038 //////////////////////////////////////////////////////////////////// 00039 // Function: VertexDataBlock::get_pointer 00040 // Access: Public 00041 // Description: Returns a pointer to the start of the allocated 00042 // memory for this buffer, or NULL if the data is not 00043 // currently resident. If the data is not currently 00044 // resident, this will implicitly request it to become 00045 // resident soon. 00046 // 00047 // If force is true, this method will never return NULL, 00048 // but may block until the data is available. 00049 //////////////////////////////////////////////////////////////////// 00050 INLINE unsigned char *VertexDataBlock:: 00051 get_pointer(bool force) const { 00052 nassertr(get_page() != (VertexDataPage *)NULL, NULL); 00053 unsigned char *page_data = get_page()->get_page_data(force); 00054 if (page_data == (unsigned char *)NULL) { 00055 return NULL; 00056 } else { 00057 return page_data + get_start(); 00058 } 00059 } 00060 00061 //////////////////////////////////////////////////////////////////// 00062 // Function: VertexDataBlock::get_next_block 00063 // Access: Published 00064 // Description: Returns a pointer to the next allocated block in the 00065 // chain, or NULL if there are no more allocated blocks. 00066 //////////////////////////////////////////////////////////////////// 00067 INLINE VertexDataBlock *VertexDataBlock:: 00068 get_next_block() const { 00069 return (VertexDataBlock *)SimpleAllocatorBlock::get_next_block(); 00070 }