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 FBX_Detail; \
34  friend struct UT::DefaultClearer<TYPE>; \
35  }; \
36  inline size_t hash_value(TYPE id) { return id.hash(); } \
37  SYS_DECLARE_IS_POD(TYPE); \
38  namespace UT { \
39  template <typename T> struct DefaultClearer; \
40  template <> \
41  struct DefaultClearer<TYPE> \
42  { \
43  using VoidP = void*; \
44  static void clear(TYPE& v) { v.myPtr = VoidP(-1LL); } \
45  static bool isClear(const TYPE& v) { return v.myPtr==VoidP(-1LL); } \
46  static void clearConstruct(TYPE* p) { clear(*p); } \
47  static const bool clearNeedsDestruction = false; \
48  }; \
49  } \
50  /**/
51 
52 #endif // __FBX_SCENEPROXYSUPPORT_H_INCLUDED__