summaryrefslogtreecommitdiff
path: root/Client/ThirdParty/StaticConstructor/StaticConstructorSample/MyClass.h
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-12-13 00:07:19 +0800
committerchai <chaifix@163.com>2021-12-13 00:07:19 +0800
commit60cbbdec07ab7a5636eac5b3c024ae44e937f4d4 (patch)
treeb2c7b0a868f18159dbc43d8954e1bd7668549a88 /Client/ThirdParty/StaticConstructor/StaticConstructorSample/MyClass.h
+init
Diffstat (limited to 'Client/ThirdParty/StaticConstructor/StaticConstructorSample/MyClass.h')
-rw-r--r--Client/ThirdParty/StaticConstructor/StaticConstructorSample/MyClass.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/Client/ThirdParty/StaticConstructor/StaticConstructorSample/MyClass.h b/Client/ThirdParty/StaticConstructor/StaticConstructorSample/MyClass.h
new file mode 100644
index 0000000..5f86f22
--- /dev/null
+++ b/Client/ThirdParty/StaticConstructor/StaticConstructorSample/MyClass.h
@@ -0,0 +1,36 @@
+// MyClass.h
+//
+#include <string>
+#include <StaticConstructor.h>
+
+
+class MyClass
+{
+protected:
+ // Declaration of protected static data members:
+ // Cannot be initialized here (C++ language limitation)
+ static void* mpStaticMemory;
+ static const double mPI;
+ static std::string mStaticStr;
+
+public:
+ // Static function members to get the static data members (to unify the Tests):
+ static const double& PI() { return mPI; };
+ static std::string& StaticStr() { return mStaticStr; };
+
+public:
+ // Default Constructor:
+ MyClass();
+
+ // Destructor:
+ virtual ~MyClass();
+
+ // Static Constructor:
+ // (Should be called by INVOKE_STATIC_CONSTRUCTOR macro in the CPP file)
+ STATIC_CONSTRUCTOR();
+
+ // Static Destructor:
+ // (Should be called by INVOKE_STATIC_CONSTRUCTOR macro in the CPP file)
+ STATIC_DESTRUCTOR();
+};
+