Pointwise Plugin SDK
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
apiUtils.h
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * Pointwise Plugin utility functions
4  *
5  * (C) 2021 Cadence Design Systems, Inc. All rights reserved worldwide.
6  *
7  ***************************************************************************/
8 
9 #ifndef _APIUTILS_H_
10 #define _APIUTILS_H_
11 
12 #include<cassert>
13 
14 #include "site.h"
15 
16 
17 extern "C" {
18 
19 
27 /*************************************************
28  GUID macros
29 **************************************************/
30 
31 /*-----------------------------------------------------*/
47 #define MAKEGUID2(hi16,low16) \
48  (PWP_UINT32)( (((hi16) & 0x0000FFFFUL) << 16) | \
49  ((low16) & 0x0000FFFFUL))
50 
51 
52 /*-----------------------------------------------------*/
62 #define PWP_GRPID_USER (PWP_UINT32)(63000UL)
63 
64 /*-----------------------------------------------------*/
72 #define PWP_GROUPNAME_DEFAULT "PWP_SITE_GROUPNAME"
73 
74 
76 /*-----------------------------------------------------*/
89 #if !defined(PWP_SITE_GROUPID)
90  #define PWP_SITE_GROUPID PWP_GRPID_USER
91 #endif
92  // sdkINTERNALS
93 
94 
95 /*-----------------------------------------------------*/
108 #define MAKEGUID(usr_id) MAKEGUID2(PWP_SITE_GROUPID,usr_id)
109 
110 
112 /*-----------------------------------------------------*/
125 #if !defined(PWP_SITE_GROUPNAME)
126  #define PWP_SITE_GROUPNAME PWP_GROUPNAME_DEFAULT
127 #endif
128  // sdkINTERNALS
129 
130 
131 /*-----------------------------------------------------*/
164 #define ARRAYSIZE(arrname) (PWP_UINT32)(sizeof(arrname)/sizeof(arrname[0]))
165 
166 } /* extern "C" */
167 
168 
169 /*-----------------------------------------------------*/
189 #ifdef DEBUG
190 # define ASSERT(expr) assert(expr)
191 #else
192 # define ASSERT(expr) ((void)0)
193 #endif /* DEBUG */
194 
195 
196 /*-----------------------------------------------------*/
219 #ifdef __cplusplus
220  namespace staticAssert {
221  template <bool> struct STATIC_ASSERT_FAILURE;
222  template <> struct STATIC_ASSERT_FAILURE<true> { enum { val = 1 }; };
223  template<int x> struct static_assert_test{};
224  }
225  #define ASSERT_COMPILE_JOIN( X, Y ) ASSERT_COMPILE_JOIN2(X,Y)
226  #define ASSERT_COMPILE_JOIN2( X, Y ) X##Y
227  #define ASSERT_COMPILE(x) \
228  typedef ::staticAssert::static_assert_test<\
229  sizeof(::staticAssert::STATIC_ASSERT_FAILURE< (bool)( x ) >)>\
230  ASSERT_COMPILE_JOIN(_static_assert_typedef, __LINE__)
231 
232 #else // __cplusplus
233 
234  #define ASSERT_COMPILE(x) extern char __dummy[-1 + (2 * (int)(x))]
235 
236 #endif // __cplusplus
237 
238 /*-----------------------------------------------------*/
251 #define VERIFY_EXPLICIT_CAST(from,to) ASSERT_COMPILE(sizeof(from) == sizeof(to))
252 
253 
254 #endif /* _APIUTILS_H_ */
Site Build Configuration Settings.