ReplicaNet and RNLobby  1
MinimalRTTI.h
1 /* START_LICENSE_HEADER
2 
3 Copyright (C) 2000 Martin Piper, original design and program code
4 Copyright (C) 2001 Replica Software
5 
6 This program file is copyright (C) Replica Software and can only be used under license.
7 For more information visit: http://www.replicanet.com/
8 Or email: info@replicanet.com
9 
10 END_LICENSE_HEADER */
11 #include "RNPlatform/Inc/MemoryTracking.h"
12 #ifndef _RN_MINIMAL_RTTI_H_
13 #define _RN_MINIMAL_RTTI_H_
14 
15 // Should be in the public section.
16 /* RN_CLASS_MINIMAL_RTTI macro starts here */
17 #define RN_CLASS_MINIMAL_RTTI() \
18  static int StaticThisClassType(void) \
19  { \
20  static int thisClassType = GetNewClassType(); \
21  return thisClassType; \
22  } \
23  virtual int GetThisClassType(void) \
24  { \
25  return StaticThisClassType(); \
26  }
27 /* RN_CLASS_MINIMAL_RTTI macro ends here */
28 
29 
30 // Should be in the public section of the base class.
31 /* RN_CLASS_MINIMAL_RTTI_BASE_CLASS macro starts here */
32 #define RN_CLASS_MINIMAL_RTTI_BASE_CLASS() \
33 bool IsClassType(const int targetClassType) \
34 { \
35  int thisType = GetThisClassType(); \
36  if (thisType == targetClassType) \
37  { \
38  return true; \
39  } \
40  return false; \
41 } \
42 protected: \
43 static int GetNewClassType(void) \
44 { \
45  static int classTypeCount = 0; \
46  return classTypeCount++; \
47 } \
48 public:
49 /* RN_CLASS_MINIMAL_RTTI_BASE_CLASS macro ends here */
50 
51 
52 namespace RNReplicaNet
53 {
54 
55 
56 } // namespace RNReplicaNet
57 
58 #endif