Pointwise Plugin SDK
apiUtils.h
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * Pointwise Plugin utility functions
4  *
5  * Proprietary software product of Pointwise, Inc.
6  * Copyright (c) 1995-2018 Pointwise, Inc.
7  * All rights reserved.
8  *
9  ***************************************************************************/
10 
11 #ifndef _APIUTILS_H_
12 #define _APIUTILS_H_
13 
14 #include<cassert>
15 
16 #include "site.h"
17 
18 
19 extern "C" {
20 
21 
29 /*************************************************
30  GUID macros
31 **************************************************/
32 
33 /*-----------------------------------------------------*/
49 #define MAKEGUID2(hi16,low16) \
50  (PWP_UINT32)( (((hi16) & 0x0000FFFFUL) << 16) | \
51  ((low16) & 0x0000FFFFUL))
52 
53 
54 /*-----------------------------------------------------*/
64 #define PWP_GRPID_USER (PWP_UINT32)(63000UL)
65 
66 /*-----------------------------------------------------*/
74 #define PWP_GROUPNAME_DEFAULT "PWP_SITE_GROUPNAME"
75 
76 
78 /*-----------------------------------------------------*/
91 #if !defined(PWP_SITE_GROUPID)
92  #define PWP_SITE_GROUPID PWP_GRPID_USER
93 #endif
94  // sdkINTERNALS
95 
96 
97 /*-----------------------------------------------------*/
110 #define MAKEGUID(usr_id) MAKEGUID2(PWP_SITE_GROUPID,usr_id)
111 
112 
114 /*-----------------------------------------------------*/
127 #if !defined(PWP_SITE_GROUPNAME)
128  #define PWP_SITE_GROUPNAME PWP_GROUPNAME_DEFAULT
129 #endif
130  // sdkINTERNALS
131 
132 
133 /*-----------------------------------------------------*/
166 #define ARRAYSIZE(arrname) (PWP_UINT32)(sizeof(arrname)/sizeof(arrname[0]))
167 
168 } /* extern "C" */
169 
170 
171 /*-----------------------------------------------------*/
191 #ifdef DEBUG
192 # define ASSERT(expr) assert(expr)
193 #else
194 # define ASSERT(expr) ((void)0)
195 #endif /* DEBUG */
196 
197 
198 /*-----------------------------------------------------*/
221 #ifdef __cplusplus
222  namespace staticAssert {
223  template <bool> struct STATIC_ASSERT_FAILURE;
224  template <> struct STATIC_ASSERT_FAILURE<true> { enum { val = 1 }; };
225  template<int x> struct static_assert_test{};
226  }
227  #define ASSERT_COMPILE_JOIN( X, Y ) ASSERT_COMPILE_JOIN2(X,Y)
228  #define ASSERT_COMPILE_JOIN2( X, Y ) X##Y
229  #define ASSERT_COMPILE(x) \
230  typedef ::staticAssert::static_assert_test<\
231  sizeof(::staticAssert::STATIC_ASSERT_FAILURE< (bool)( x ) >)>\
232  ASSERT_COMPILE_JOIN(_static_assert_typedef, __LINE__)
233 
234 #else // __cplusplus
235 
236  #define ASSERT_COMPILE(x) extern char __dummy[-1 + (2 * (int)(x))]
237 
238 #endif // __cplusplus
239 
240 /*-----------------------------------------------------*/
253 #define VERIFY_EXPLICIT_CAST(from,to) ASSERT_COMPILE(sizeof(from) == sizeof(to))
254 
255 
256 #endif /* _APIUTILS_H_ */
Site Build Configuration Settings.