OpenDDS  Snapshot(2023/04/28-20:55)
SafetyProfilePool.cpp
Go to the documentation of this file.
1 /*
2  *
3  *
4  * Distributed under the OpenDDS License.
5  * See: http://www.opendds.org/license.html
6  */
7 
8 #include "DCPS/DdsDcps_pch.h" ////Only the _pch include should start with DCPS/
9 #include "SafetyProfilePool.h"
10 #include "debug.h"
11 #include <stdexcept>
12 
13 #ifdef OPENDDS_SAFETY_PROFILE
14 namespace OpenDDS { namespace DCPS {
15 
17 : main_pool_(0)
18 {
19 }
20 
21 SafetyProfilePool::~SafetyProfilePool()
22 {
23  // Never delete, because this is always a SAFETY_PROFILE build
24  //delete main_pool_;
25 }
26 
27 void
28 SafetyProfilePool::configure_pool(size_t size, size_t granularity)
29 {
31 
32  if (main_pool_ == NULL) {
33  main_pool_ = new MemoryPool(size, granularity);
34  }
35 }
36 
37 void
38 SafetyProfilePool::install()
39 {
40  if (ACE_Allocator::instance () != this) {
42  }
43 }
44 
46 SafetyProfilePool::instance() {
47  return instance_;
48 }
49 
50 SafetyProfilePool* SafetyProfilePool::instance_ = 0;
51 
52 struct InstanceMaker {
53  InstanceMaker() {
54  SafetyProfilePool::instance_ = new SafetyProfilePool();
55  }
56 
57  ~InstanceMaker() {
58  if (DCPS_debug_level) {
59  if (SafetyProfilePool::instance_->main_pool_) {
60  ACE_DEBUG((LM_INFO, "LWM: main pool: %d bytes\n",
61  SafetyProfilePool::instance_->main_pool_->lwm_free_bytes()));
62  }
63  }
64  }
65 
66 };
67 
68 InstanceMaker instance_maker_;
69 
70 }}
71 
72 #endif
#define ACE_DEBUG(X)
#define ACE_GUARD(MUTEX, OBJ, LOCK)
ACE_Guard< ACE_Thread_Mutex > lock_
static ACE_Allocator * instance(void)
ACE_Allocator SafetyProfilePool
OpenDDS_Dcps_Export unsigned int DCPS_debug_level
Definition: debug.cpp:30
The Internal API and Implementation of OpenDDS.
Definition: AddressCache.h:28