aboutsummaryrefslogtreecommitdiff
path: root/src/deep.hpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/deep.hpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/deep.hpp b/src/deep.hpp
index 6bc3b20..8196e66 100644
--- a/src/deep.hpp
+++ b/src/deep.hpp
@@ -50,6 +50,10 @@ class DeepPrelude
50// external C modules should create a single object implementing that interface for each Deep userdata class they want to expose 50// external C modules should create a single object implementing that interface for each Deep userdata class they want to expose
51class DeepFactory 51class DeepFactory
52{ 52{
53 private:
54 // the current count of deep object instances
55 mutable std::atomic<int> deepObjectCount{};
56
53 protected: 57 protected:
54 // protected non-virtual destructor: Lanes won't manage the Factory's lifetime 58 // protected non-virtual destructor: Lanes won't manage the Factory's lifetime
55 DeepFactory() = default; 59 DeepFactory() = default;
@@ -80,6 +84,8 @@ class DeepFactory
80 // NVI: public interface 84 // NVI: public interface
81 static void DeleteDeepObject(lua_State* L_, DeepPrelude* o_); 85 static void DeleteDeepObject(lua_State* L_, DeepPrelude* o_);
82 [[nodiscard]] 86 [[nodiscard]]
87 int getObjectCount() const { return deepObjectCount.load(std::memory_order_relaxed); }
88 [[nodiscard]]
83 static bool IsDeepUserdata(lua_State* const L_, StackIndex const idx_); 89 static bool IsDeepUserdata(lua_State* const L_, StackIndex const idx_);
84 [[nodiscard]] 90 [[nodiscard]]
85 static DeepFactory* LookupFactory(lua_State* L_, StackIndex index_, LookupMode mode_); 91 static DeepFactory* LookupFactory(lua_State* L_, StackIndex index_, LookupMode mode_);