ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
CVShareable.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 // Local
11 #include "CVCoreLib.h"
12 
13 // system
14 #include <cassert>
15 
16 // Activate shared objects tracking (for debug purposes)
17 #ifdef CV_DEBUG
18 // #define CV_TRACK_ALIVE_SHARED_OBJECTS
19 #endif
20 
21 // CCShareable object (with counter)
23 public:
25  CCShareable();
26 
28 
30  virtual void link();
31 
33 
35  virtual void release();
36 
38 
40  inline virtual unsigned getLinkCount() const { return m_linkCount; }
41 
42 #ifdef CV_TRACK_ALIVE_SHARED_OBJECTS
44  static unsigned GetAliveCount();
45 #endif
46 
47 protected:
49 
51  virtual ~CCShareable();
52 
54  unsigned m_linkCount;
55 };
#define CV_CORE_LIB_API
Definition: CVCoreLibWin.h:15
virtual unsigned getLinkCount() const
Returns the current link count.
Definition: CVShareable.h:40
unsigned m_linkCount
Links counter.
Definition: CVShareable.h:54