Pol  Revision:f37d500
object_storage.h
Go to the documentation of this file.
1 #ifndef GLOBALS_OBJ_STORAGE_H
2 #define GLOBALS_OBJ_STORAGE_H
3 
4 
5 #include <boost/noncopyable.hpp>
6 #include <cstddef>
7 #include <map>
8 #include <unordered_map>
9 #include <vector>
10 
11 #include "../../clib/rawtypes.h"
12 #include "../objecthash.h"
13 #include "../poltype.h"
14 
15 namespace Pol
16 {
17 namespace Core
18 {
19 // if index is UINT_MAX, has been deleted
20 typedef std::unordered_map<pol_serial_t, unsigned> SerialIndexMap;
21 typedef std::multimap<pol_serial_t, UObject*> DeferList;
22 
23 class ObjectStorageManager : boost::noncopyable
24 {
25 public:
28 
29  void deinitialize();
30  struct MemoryUsage;
31 
32  MemoryUsage estimateSize() const;
33 
36  SerialIndexMap incremental_serial_index;
38  std::vector<u32> modified_serials;
39  std::vector<u32> deleted_serials;
40  unsigned int clean_objects;
41  unsigned int dirty_objects;
43 
45 
46  struct MemoryUsage
47  {
48  size_t misc;
49 
50  size_t objsize;
51  size_t objcount;
52 
53  size_t obj_item_size;
54  size_t obj_cont_size;
55  size_t obj_char_size;
56  size_t obj_npc_size;
63  size_t obj_npc_count;
67  };
68 };
69 
71 }
72 }
73 #endif
MemoryUsage estimateSize() const
std::unordered_map< pol_serial_t, unsigned > SerialIndexMap
std::vector< u32 > deleted_serials
std::multimap< pol_serial_t, UObject * > DeferList
std::vector< u32 > modified_serials
SerialIndexMap incremental_serial_index
ObjectStorageManager objStorageManager
Definition: berror.cpp:12