AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
SingletonManager.h
Go to the documentation of this file.
1/*
2Copyright 2007-2024. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16
17#pragma once
18
19#ifdef _MSC_VER
20# pragma warning(push)
21# pragma warning(disable: 4251) // warning C4251: class X needs to have dll-interface to be used by clients of class Y
22#endif
23
24
25#include <agx/agxCore_export.h>
26#include <agx/agx.h>
27#include <agx/Referenced.h>
29#include <agx/HashSet.h>
30#include <agx/DynamicLibrary.h>
31
33
34namespace agx
35{
36
37 class Singleton;
38
39
41 class AGXCORE_EXPORT SingletonManager : public agx::Referenced
42 {
43 public:
44
46 SingletonManager();
47
49 static SingletonManager* instance();
50
52 void registerSingleton( Singleton* );
53
54 bool unregisterSingleton( Singleton* singleton );
55
57 void shutdown();
58
60 void print( ) const;
61
62 void registerDynamicLibrary(agx::DynamicLibrary*);
63
64 void unregisterDynamicLibrary(agx::DynamicLibrary*);
65
66 protected:
67 virtual ~SingletonManager();
68
69 private:
70 typedef agx::Vector<Singleton*> SingletonQueue;
71 SingletonQueue m_singletons;
72 SingletonQueue m_addedSingletons;
73 bool m_dirty;
74 bool m_shutdownCalled;
75
77
79 };
80
81 AGX_DECLARE_POINTER_TYPES(SingletonManager);
82}
84
85#ifdef _MSC_VER
86# pragma warning(pop)
87#endif
#define AGX_DECLARE_POINTER_TYPES(type)
Definition Referenced.h:254
#define AGXCORE_EXPORT
Inheritance with partial specialization due to bug with ref_ptr containers.
Base class providing referencing counted objects.
Definition Referenced.h:120
Templated vector class.
Definition agx/Vector.h:53
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition macros.h:97
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition macros.h:96
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
std::mutex Mutex
Definition Referenced.h:99
void AGXPHYSICS_EXPORT shutdown()
Shutdown of the AGX Dynamics API will be done when the number of shutdown matches the number of calls...