00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef VERTEXDATABOOK_H
00016 #define VERTEXDATABOOK_H
00017
00018 #include "pandabase.h"
00019 #include "pmutex.h"
00020 #include "mutexHolder.h"
00021 #include "vertexDataPage.h"
00022 #include "indirectLess.h"
00023 #include "plist.h"
00024
00025 class VertexDataBlock;
00026
00027
00028
00029
00030
00031
00032 class EXPCL_PANDA_GOBJ VertexDataBook {
00033 PUBLISHED:
00034 VertexDataBook(size_t block_size);
00035 ~VertexDataBook();
00036
00037 INLINE VertexDataBlock *alloc(size_t size);
00038
00039 INLINE int get_num_pages() const;
00040
00041 size_t count_total_page_size() const;
00042 size_t count_total_page_size(VertexDataPage::RamClass ram_class) const;
00043 size_t count_allocated_size() const;
00044 size_t count_allocated_size(VertexDataPage::RamClass ram_class) const;
00045
00046 void save_to_disk();
00047
00048 public:
00049 void reorder_page(VertexDataPage *page);
00050
00051 private:
00052 INLINE VertexDataPage *create_new_page(size_t size);
00053 VertexDataBlock *do_alloc(size_t size);
00054
00055 private:
00056 size_t _block_size;
00057
00058 typedef pset<VertexDataPage *, IndirectLess<VertexDataPage> > Pages;
00059 Pages _pages;
00060
00061 Mutex _lock;
00062 friend class VertexDataPage;
00063 };
00064
00065 #include "vertexDataBook.I"
00066
00067 #endif