Panda3D
vertexDataBook.h
1 // Filename: vertexDataBook.h
2 // Created by: drose (16May07)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef VERTEXDATABOOK_H
16 #define VERTEXDATABOOK_H
17 
18 #include "pandabase.h"
19 #include "pmutex.h"
20 #include "mutexHolder.h"
21 #include "vertexDataPage.h"
22 #include "indirectLess.h"
23 #include "plist.h"
24 
25 class VertexDataBlock;
26 
27 ////////////////////////////////////////////////////////////////////
28 // Class : VertexDataBook
29 // Description : A collection of VertexDataPages, which can be used to
30 // allocate new VertexDataBlock objects.
31 ////////////////////////////////////////////////////////////////////
32 class EXPCL_PANDA_GOBJ VertexDataBook {
33 PUBLISHED:
34  VertexDataBook(size_t block_size);
35  ~VertexDataBook();
36 
37  INLINE VertexDataBlock *alloc(size_t size);
38 
39  INLINE int get_num_pages() const;
40 
41  size_t count_total_page_size() const;
42  size_t count_total_page_size(VertexDataPage::RamClass ram_class) const;
43  size_t count_allocated_size() const;
44  size_t count_allocated_size(VertexDataPage::RamClass ram_class) const;
45 
46  void save_to_disk();
47 
48 public:
49  void reorder_page(VertexDataPage *page);
50 
51 private:
52  INLINE VertexDataPage *create_new_page(size_t size);
53  VertexDataBlock *do_alloc(size_t size);
54 
55 private:
56  size_t _block_size;
57 
59  Pages _pages;
60 
61  Mutex _lock;
62  friend class VertexDataPage;
63 };
64 
65 #include "vertexDataBook.I"
66 
67 #endif
A block of bytes that holds one or more VertexDataBlocks.
A standard mutex, or mutual exclusion lock.
Definition: pmutex.h:44
A block of bytes that stores the actual raw vertex data referenced by a GeomVertexArrayData object...
A collection of VertexDataPages, which can be used to allocate new VertexDataBlock objects...
This is our own Panda specialization on the default STL set.
Definition: pset.h:52