Panda3D
vertexDataBook.h
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 vertexDataBook.h
10  * @author drose
11  * @date 2007-05-16
12  */
13 
14 #ifndef VERTEXDATABOOK_H
15 #define VERTEXDATABOOK_H
16 
17 #include "pandabase.h"
18 #include "pmutex.h"
19 #include "mutexHolder.h"
20 #include "vertexDataPage.h"
21 #include "indirectLess.h"
22 #include "plist.h"
23 
24 class VertexDataBlock;
25 
26 /**
27  * A collection of VertexDataPages, which can be used to allocate new
28  * VertexDataBlock objects.
29  */
30 class EXPCL_PANDA_GOBJ VertexDataBook {
31 PUBLISHED:
32  explicit VertexDataBook(size_t block_size);
33  ~VertexDataBook();
34 
35  INLINE VertexDataBlock *alloc(size_t size);
36 
37  INLINE size_t get_num_pages() const;
38 
39  size_t count_total_page_size() const;
40  size_t count_total_page_size(VertexDataPage::RamClass ram_class) const;
41  size_t count_allocated_size() const;
42  size_t count_allocated_size(VertexDataPage::RamClass ram_class) const;
43 
44  void save_to_disk();
45 
46 public:
47  void reorder_page(VertexDataPage *page);
48 
49 private:
50  INLINE VertexDataPage *create_new_page(size_t size);
51  VertexDataBlock *do_alloc(size_t size);
52 
53 private:
54  size_t _block_size;
55 
57  Pages _pages;
58 
59  Mutex _lock;
60  friend class VertexDataPage;
61 };
62 
63 #include "vertexDataBook.I"
64 
65 #endif
A block of bytes that holds one or more VertexDataBlocks.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A standard mutex, or mutual exclusion lock.
Definition: pmutex.h:38
A block of bytes that stores the actual raw vertex data referenced by a GeomVertexArrayData object.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A collection of VertexDataPages, which can be used to allocate new VertexDataBlock objects.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is our own Panda specialization on the default STL set.
Definition: pset.h:49