Pol  Revision:cb584c9
multidefs.cpp
Go to the documentation of this file.
1 
9 #include "multidefs.h"
10 
11 #include <cstddef>
12 
13 #include "../multi/multidef.h"
14 
15 namespace Pol
16 {
17 namespace Multi
18 {
20 
21 MultiDefBuffer::MultiDefBuffer() : multidefs_by_multiid() {}
23 
25 {
26  Multi::MultiDefs::iterator iter = multidefs_by_multiid.begin();
27  for ( ; iter != multidefs_by_multiid.end(); ++iter )
28  {
29  if ( iter->second != nullptr )
30  delete iter->second;
31  iter->second = nullptr;
32  }
33  multidefs_by_multiid.clear();
34 }
35 
37 {
38  size_t size = 0;
39  for ( const auto& m_pair : multidefs_by_multiid )
40  {
41  size += ( sizeof( u16 ) + sizeof( MultiDef* ) + ( sizeof( void* ) * 3 + 1 ) / 2 );
42  if ( m_pair.second != nullptr )
43  size += m_pair.second->estimateSize();
44  }
45  return size;
46 }
47 }
48 }
MultiDefs multidefs_by_multiid
Definition: multidefs.h:35
unsigned short u16
Definition: rawtypes.h:26
size_t estimateSize() const
Definition: multidefs.cpp:36
Definition: berror.cpp:12
MultiDefBuffer multidef_buffer
Definition: multidefs.cpp:19