HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FBX_SceneProxySupport.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: FBX_SceneSupport.h (FBX Library, C++)
7  *
8  * COMMENTS:
9  *
10  */
11 
12 #ifndef __FBX_SCENEPROXYSUPPORT_H_INCLUDED__
13 #define __FBX_SCENEPROXYSUPPORT_H_INCLUDED__
14 
15 #include <SYS/SYS_Compiler.h>
16 #include <SYS/SYS_Hash.h>
17 #include <SYS/SYS_TypeDecorate.h>
18 
19 #define FBX_SCENEPROXY_DECLARE_ID(TYPE) \
20  class TYPE \
21  { \
22  public: \
23  TYPE() : myPtr(nullptr) { } \
24  SYS_SAFE_BOOL operator bool() const { return myPtr!=nullptr; } \
25  bool operator==(const TYPE& x) const { return myPtr == x.myPtr; } \
26  bool operator!=(const TYPE& x) const { return !(*this == x); } \
27  size_t hash() const { return SYShash(myPtr); } \
28  protected: \
29  TYPE(void *p) : myPtr(p) { } \
30  private: \
31  void* myPtr; \
32  friend class FBX_SceneProxy; \
33  friend struct UT::DefaultClearer<TYPE>; \
34  }; \
35  inline size_t hash_value(TYPE id) { return id.hash(); } \
36  SYS_DECLARE_IS_POD(TYPE); \
37  namespace UT { \
38  template <typename T> struct DefaultClearer; \
39  template <> \
40  struct DefaultClearer<TYPE> \
41  { \
42  using VoidP = void*; \
43  static void clear(TYPE& v) { v.myPtr = VoidP(-1LL); } \
44  static bool isClear(const TYPE& v) { return v.myPtr==VoidP(-1LL); } \
45  static void clearConstruct(TYPE* p) { clear(*p); } \
46  static const bool clearNeedsDestruction = false; \
47  }; \
48  } \
49  /**/
50 
51 #endif // __FBX_SCENEPROXYSUPPORT_H_INCLUDED__