AJA NTV2 SDK  18.0.0.2122
NTV2 SDK 18.0.0.2122
ajatypes.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MIT */
8 #ifndef AJATYPES_H
9 #define AJATYPES_H
10 
11 #if defined (AJAMac)
12  #define NTV2_USE_STDINT
13 #endif // if not MSWindows
14 
15 #include "ntv2deprecate.h"
16 
17 
22 
23 /**************************************************************************************************************
24  NTV2_NULL_DEVICE When undefined (the default), the platform-specific implementations of
25  OpenLocalPhysical are included in the build, making it possible to connect to
26  locally-attached physical devices via the NTV2 kernel driver.
27 
28  When defined, all platform-specific implementations of OpenLocalPhysical are
29  omitted from the build, making it impossible to connect to locally-attached
30  physical devices via the NTV2 kernel driver. (Only remote or software/virtual
31  devices will be able to be opened via OpenRemote.) Note that MacOS clients
32  built with this defined can be "sandboxed".
33 
34  See also NTV2_MACOS_SANDBOX macro (below).
35 
36  Introduced in SDK 12.4.
37 **************************************************************************************************************/
38 //#define NTV2_NULL_DEVICE
39 
40 
41 /**************************************************************************************************************
42  NTV2_NUB_CLIENT_SUPPORT Deprecated in SDK 17.1
43 
44  When defined (the default), the SDK will load and connect to AJA-authorized
45  plugins to support remote or software/virtual NTV2 devices.
46 
47  When undefined, the SDK cannot talk to remote or software/virtual devices.
48 
49  NOTE: In a future SDK, this macro will be eliminated, and it won't be possible
50  to build the SDK without the capability of connecting to AJA-authorized remote
51  or software/virtual NTV2 devices.
52 
53  SDK 16.x - 17.0: Defined by default. This allowed the SDK to connect to
54  unauthenticated remote or software/virtual NTV2 devices.
55 
56  SDK 12.4 - 15.5, this macro was defined by default, allowing the SDK to connect
57  (only) to remote devices via the TCP/IP "nub". (The SDK had no software/virtual
58  device capability before SDK 16.0.)
59 
60  Introduced in SDK 12.4.
61 **************************************************************************************************************/
62 #define NTV2_NUB_CLIENT_SUPPORT
63 
64 
65 /**************************************************************************************************************
66  NTV2_WRITEREG_PROFILING When defined (the default), calls to WriteRegister can be profiled, and
67  CNTV2Card's WriteRegister profiling API is available.
68 
69  When undefined, WriteRegister calls cannot be profiled, and CNTV2Card's
70  WriteRegister profiling API is unavailable.
71 
72  Introduced in SDK 15.1.
73 **************************************************************************************************************/
74 #define NTV2_WRITEREG_PROFILING
75 
76 
77 /**************************************************************************************************************
78  NTV2_USE_CPLUSPLUS11 When defined (the default), the 'ajantv2' portion of the SDK will use C++
79  language and/or STL features that require a C++11 compiler.
80 
81  When undefined, the 'ajantv2' portion of the SDK will not use C++11 features.
82 
83  NOTE: This macro will be deprecated in a future SDK, when it will no longer
84  be possible to build the SDK without a C++11-capable compiler.
85 
86  See also: AJA_USE_CPLUSPLUS11 in 'ajabase/include/types.h'
87 
88  Introduced in SDK 16.0.
89 **************************************************************************************************************/
90 #if !defined(NTV2_USE_CPLUSPLUS11)
91  #define NTV2_USE_CPLUSPLUS11
92 #endif // !defined(NTV2_USE_CPLUSPLUS11)
93 
94 
95 /**************************************************************************************************************
96  NTV2_ALLOW_OPEN_UNSUPPORTED When undefined (the default), unsupported physical devices (see the
97  NTV2GetSupportedDevices utility function) that are attached to the local
98  host cannot be opened (via OpenLocalPhysical).
99 
100  When defined, unsupported physical devices that are attached to the local
101  host will be opened (via OpenLocalPhysical).
102 
103  See also: AJA_USE_CPLUSPLUS11 in 'ajabase/include/types.h'
104 
105  Introduced in SDK 17.0.
106 **************************************************************************************************************/
107 //#define NTV2_ALLOW_OPEN_UNSUPPORTED
108 
109 
110 /**************************************************************************************************************
111  NTV2_MACOS_SANDBOX When undefined (the default), the MacOS implementation of OpenLocalPhysical
112  will open connected AJA devices using either AJA's IOKit kernel extension ('KEXT')
113  or AJA's newer DriverKit driver ('DEXT'), whichever is installed.
114 
115  When defined, MacDriverInterface::OpenLocalPhysical will open connected AJA
116  devices ONLY using the DriverKit driver ('DEXT'), making it possible to "sandbox"
117  the client executable/application.
118 
119  (NOTE: If NTV2_NULL_DEVICE is defined, this macro is irrelevant.)
120 
121  Introduced in SDK 18.0.
122 **************************************************************************************************************/
123 //#define NTV2_MACOS_SANDBOX
124 
125 
126 
130 #define AJA_VIRTUAL virtual // Force use of virtual functions in CNTV2Card, etc.
131 #define AJA_STATIC static // Do not change this.
132 #define NTV2_UNUSED(__p__) (void)__p__
133 
134 #if defined(__CPLUSPLUS__) || defined(__cplusplus)
135  #if defined(AJAMac)
136  #if defined(__clang__)
137  #ifndef __has_feature
138  #define __has_feature(__x__) 0
139  #endif
140  #if __has_feature(cxx_nullptr)
141  #define AJA_CXX11_NULLPTR_AVAILABLE
142  #endif
143  #endif
144  #elif defined(AJALinux)
145  #if defined(__clang__)
146  #ifndef __has_feature
147  #define __has_feature(__x__) 0
148  #endif
149  #if __has_feature(cxx_nullptr)
150  #define AJA_CXX11_NULLPTR_AVAILABLE
151  #endif
152  #elif defined(__GNUC__)
153  #if __cplusplus >= 201103L // C++11 or later
154  #define AJA_CXX11_NULLPTR_AVAILABLE
155  #endif
156  #endif
157  #elif defined(MSWindows)
158  #if defined(_MSC_VER) && _MSC_VER >= 1700 // VS2012 or later:
159  #define AJA_CXX11_NULLPTR_AVAILABLE
160  #endif
161  #endif
162 #endif
163 
164 #if defined(AJA_CXX11_NULLPTR_AVAILABLE)
165  #define AJA_NULL nullptr
166 #else
167  #define AJA_NULL NULL
168 #endif
169 
170 #if defined(__clang__)
171  #ifndef __has_cpp_attribute
172  #define __has_cpp_attribute(__x__) 0
173  #endif
174 
175  #if __has_cpp_attribute(clang::fallthrough)
176  #define AJA_FALL_THRU [[clang::fallthrough]]
177  #else
178  #define AJA_FALL_THRU
179  #endif
180 #elif defined(__GNUC__)
181  #if __GNUC__ >= 5
182  #define AJA_FALL_THRU [[gnu::fallthrough]]
183  #else
184  #define AJA_FALL_THRU
185  #endif
186 #else
187  #define AJA_FALL_THRU
188 #endif
189 
190 
191 #if defined (NTV2_USE_STDINT)
192  #if defined (MSWindows)
193  #define _WINSOCK_DEPRECATED_NO_WARNINGS 1
194  #if (_MSC_VER < 1300)
195  typedef signed char int8_t;
196  typedef signed short int16_t;
197  typedef signed int int32_t;
198  typedef unsigned char uint8_t;
199  typedef unsigned short uint16_t;
200  typedef unsigned int uint32_t;
201  #else
202  #if defined (NTV2_BUILDING_DRIVER)
203  typedef signed __int8 int8_t;
204  typedef signed __int16 int16_t;
205  typedef signed __int32 int32_t;
206  typedef unsigned __int8 uint8_t;
207  typedef unsigned __int16 uint16_t;
208  typedef unsigned __int32 uint32_t;
209  #else
210  #include <stdint.h>
211  #endif
212  #endif
213  typedef signed __int64 int64_t;
214  typedef unsigned __int64 uint64_t;
215  #else
216  #include <stdint.h>
217  #endif
218  typedef uint8_t UByte;
219  typedef int8_t SByte;
220  typedef int16_t Word;
221  typedef uint16_t UWord;
222  typedef int32_t LWord;
223  typedef uint32_t ULWord;
224  typedef uint32_t * PULWord;
225  typedef int64_t LWord64;
226  typedef uint64_t ULWord64;
227  typedef uint64_t Pointer64;
228 #else
229  typedef int LWord;
230  typedef unsigned int ULWord;
231  typedef unsigned int * PULWord;
232  typedef short Word;
233  typedef unsigned short UWord;
234  typedef unsigned char UByte;
235  typedef char SByte;
236 #endif
237 
238 // Platform dependent
240 #if defined (MSWindows)
241  #define _WINSOCK_DEPRECATED_NO_WARNINGS 1
243 
244  #if !defined (NTV2_BUILDING_DRIVER)
245  #ifndef WIN32_LEAN_AND_MEAN
246  #define WIN32_LEAN_AND_MEAN
247  #endif
248 
249  #include <Windows.h>
250 
251  #if defined(DeviceCapabilities)
252  #undef DeviceCapabilities
253  #endif
254  #endif
255  #include <Basetsd.h>
256  typedef unsigned char Boolean;
257  typedef __int64 LWord64;
258  typedef unsigned __int64 ULWord64;
259  typedef unsigned __int64 Pointer64;
260  typedef LWord Fixed_;
261  typedef bool BOOL_;
262  typedef UWord UWord_;
263 
264  typedef signed __int8 int8_t;
265  typedef signed __int16 int16_t;
266  typedef signed __int32 int32_t;
267  typedef signed __int64 int64_t;
268  typedef unsigned __int8 uint8_t;
269  typedef unsigned __int16 uint16_t;
270  typedef unsigned __int32 uint32_t;
271  typedef unsigned __int64 uint64_t;
272 
273  typedef UINT_PTR AJASocket;
274 
275  #define AJATargetBigEndian 0
276  #define AJAFUNC __FUNCTION__
277  #define NTV2_CPP_MIN(__x__,__y__) min((__x__),(__y__))
278  #define NTV2_CPP_MAX(__x__,__y__) max((__x__),(__y__))
279  #pragma warning(disable:4996) // Sadly MSVC bitches about DECLARING a deprecated function but not about USING one.
280 
282 #elif defined (AJAMac)
283  #include <stdint.h>
285  typedef short HANDLE;
286  typedef void* PVOID;
287  typedef unsigned int BOOL_;
288  typedef ULWord UWord_;
289  typedef int Fixed_;
290  typedef int AJASocket;
291 
292  #define AJATargetBigEndian 0
293  #define AJAFUNC __func__
294  #define NTV2_CPP_MIN(__x__,__y__) std::min((__x__),(__y__))
295  #define NTV2_CPP_MAX(__x__,__y__) std::max((__x__),(__y__))
296 
297  #define MAX_PATH 4096
298 
299  #define INVALID_HANDLE_VALUE (0)
300 
301  #if !defined (NTV2_DEPRECATE)
302  typedef struct {
303  int cx;
304  int cy;
305  } SIZE;
306  #endif // !defined (NTV2_DEPRECATE)
307 
308  #define POINTER_32
309 
311 #elif defined (AJALinux)
312  /* As of kernel 2.6.19, the C type _Bool is typedefed to bool to allow
314  * generic booleans in the kernel. Unfortunately, we #define bool
315  * here and true and false there, so this fixes it ... until next time
316  * -JAC 3/6/2007 */
317  #ifdef __KERNEL__
318  #include "linux/version.h"
319  #include "linux/kernel.h"
320  #if defined (RHEL5) || (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,19))
321  #include "linux/types.h"
322  #else/* LINUX_VERSION_CODE */
323  typedef unsigned char bool;
324  #endif /* LINUX_VERSION_CODE */
325  #endif /* __KERNEL__ */
326 
327  #if defined (MODULE)
328  #define NTV2_BUILDING_DRIVER
329  #undef NTV2_USE_CPLUSPLUS11
330  #endif
331 
332  #if !defined (NTV2_BUILDING_DRIVER)
333  #include <stdint.h>
334  typedef int64_t HANDLE;
335  typedef uint64_t ULWord64;
336  typedef uint64_t Pointer64;
337  typedef int64_t LWord64;
338  typedef void * PVOID;
339  typedef void * LPVOID;
340  typedef int32_t Fixed_;
341  typedef bool BOOL_;
342  typedef bool BOOL;
343  typedef UWord UWord_;
344  typedef uint32_t DWORD; /* 32 bits on 32 or 64 bit CPUS */
345 
346  typedef int32_t AJASocket;
347  #define NTV2_CPP_MIN(__x__,__y__) std::min((__x__),(__y__))
348  #define NTV2_CPP_MAX(__x__,__y__) std::max((__x__),(__y__))
349  #else
350  #if defined (AJAVirtual)
351  #include <stdbool.h>
352  #include <stdint.h>
353  #endif
354  typedef long HANDLE;
355  // this is what is is in Windows:
356  // typedef void * HANDLE;
357  typedef unsigned long long ULWord64;
358  typedef unsigned long long Pointer64;
359  typedef signed long long LWord64;
360  typedef void * PVOID;
361  typedef void * LPVOID;
362  typedef LWord Fixed_;
363  typedef bool BOOL_;
364  typedef bool BOOL;
365  typedef UWord UWord_;
366  typedef unsigned int DWORD; /* 32 bits on 32 or 64 bit CPUS */
367 
368  typedef int AJASocket;
369  #endif
370 
371  #define AJATargetBigEndian 0
372  #define AJAFUNC __func__
373 
374  #if !defined (NTV2_DEPRECATE)
375  typedef struct {
376  int cx;
377  int cy;
378  } SIZE;
379  #endif // !defined (NTV2_DEPRECATE)
380 
381  typedef struct {
382  int left;
383  int right;
384  int top;
385  int bottom;
386  } RECT;
387 
388  #ifndef INVALID_HANDLE_VALUE
389  #define INVALID_HANDLE_VALUE (-1L)
390  #endif
391  #define WINAPI
392  #define POINTER_32
393  #define MAX_PATH 4096
394 #elif defined (AJA_BAREMETAL)
396  #include <stdint.h>
398  typedef short HANDLE;
399  typedef void* PVOID;
400  typedef unsigned int BOOL_;
401  typedef ULWord UWord_;
402  typedef int Fixed_;
403  typedef int AJASocket;
404 
405  #define AJATargetBigEndian 0
406  #define AJAFUNC __func__
407  #define NTV2_CPP_MIN(__x__,__y__) std::min((__x__),(__y__))
408  #define NTV2_CPP_MAX(__x__,__y__) std::max((__x__),(__y__))
409 
410  #define MAX_PATH 4096
411 
412  #undef NTV2_WRITEREG_PROFILING // disable register write profiling
413 
414  #define INVALID_HANDLE_VALUE (0)
415 
416  #if !defined (NTV2_DEPRECATE)
417  typedef struct {
418  int cx;
419  int cy;
420  } SIZE;
421  #endif // !defined (NTV2_DEPRECATE)
422 
423  #define POINTER_32
424 
425 #else
426  #error "IMPLEMENT OTHER PLATFORM"
428 
429 #endif // end OTHER PLATFORM
430 
431 #if defined (NTV2_BUILDING_DRIVER)
432  // The AJA NTV2 driver is always built without any deprecated types or functions:
433  #if !defined(NTV2_DEPRECATE_16_0)
434  #define NTV2_DEPRECATE_16_0
435  #endif
436  #if !defined(NTV2_DEPRECATE_16_1)
437  #define NTV2_DEPRECATE_16_1
438  #endif
439  #if !defined(NTV2_DEPRECATE_16_2)
440  #define NTV2_DEPRECATE_16_2
441  #endif
442  #if !defined(NTV2_DEPRECATE_16_3)
443  #define NTV2_DEPRECATE_16_3
444  #endif
445 #endif // defined (NTV2_BUILDING_DRIVER)
446 
447 
451 #if !defined (NTV2_ASSERT)
452  #if defined (NTV2_BUILDING_DRIVER)
453  // Kernel space NTV2_ASSERTs
454  #if defined (AJA_DEBUG) || defined (_DEBUG)
455  #if defined (MSWindows)
456  #define NTV2_ASSERT(_expr_) ASSERT (#_expr_)
457  #elif defined (AJAMac)
458  #define NTV2_ASSERT(_expr_) assert (_expr_)
459  #elif defined (AJALinux)
460  #define NTV2_ASSERT(_expr_) do {if (#_expr_) break; \
461  printk (KERN_EMERG "### NTV2_ASSERT '%s': %s: line %d: %s\n", \
462  __FILE__, __func__, __LINE__, #_expr_); dump_stack(); \
463  } while (0)
464  #else
465  #define NTV2_ASSERT(_expr_)
466  #endif
467  #else
468  #define NTV2_ASSERT(_expr_)
469  #endif
470  #else
471  // User space NTV2_ASSERTs
472  #if defined (AJA_DEBUG) || defined (_DEBUG)
473  #include <assert.h>
474  #define NTV2_ASSERT(_expr_) assert (_expr_)
475  #else
476  #define NTV2_ASSERT(_expr_) (void) (_expr_)
477  #endif
478  #endif // else !defined (NTV2_BUILDING_DRIVER)
479 #endif // if NTV2_ASSERT undefined
480 
481 
485 // These implement compile-time warnings for use of deprecated variables and functions
486 #define NTV2_DEPRECATED_INLINE // Just a marker/reminder
487 #define NTV2_DEPRECATED_FIELD // Just a marker/reminder
488 #define NTV2_DEPRECATED_VARIABLE // Just a marker/reminder
489 #define NTV2_DEPRECATED_TYPEDEF // Just a marker/reminder
490 #define NTV2_DEPRECATED_CLASS // Just a marker/reminder
491 #define NTV2_SHOULD_BE_DEPRECATED(__f__) __f__
492 #define NTV2_SHOULD_DEPRECATE(__f__) __f__
493 #define NTV2_MUST_DEPRECATE(__f__) __f__
494 #define NTV2_WILL_BE_DEPRECATED(__f__) __f__
495 #if defined(NTV2_BUILDING_DRIVER)
496  // Disable deprecation warnings in driver builds
497  #define NTV2_DEPRECATED_f(__f__) __f__
498  #define NTV2_DEPRECATED_v(__v__) __v__
499  #define NTV2_DEPRECATED_vi(__v__, __i__) __v__ = (__i__)
500 #elif defined(_MSC_VER) && _MSC_VER >= 1600
501  // Use __declspec(deprecated) for MSVC
502  #define NTV2_DEPRECATED_f(__f__) __declspec(deprecated) __f__
503  #define NTV2_DEPRECATED_v(__v__) __v__
504  #define NTV2_DEPRECATED_vi(__v__, __i__) __v__ = (__i__)
505 #elif defined(__clang__)
506  // Use __attribute__((deprecated)) for LLVM/Clang
507  #define NTV2_DEPRECATED_f(__f__) __f__ __attribute__((deprecated))
508  #define NTV2_DEPRECATED_v(__v__) __v__
509  #define NTV2_DEPRECATED_vi(__v__, __i__) __v__ = (__i__)
510 #elif defined(__GNUC__)
511  #if __GNUC__ >= 4
512  // Use __attribute__((deprecated)) for GCC 4 or later
513  #define NTV2_DEPRECATED_f(__f__) __f__ __attribute__ ((deprecated))
514  #define NTV2_DEPRECATED_v(__v__) __v__
515  #define NTV2_DEPRECATED_vi(__v__, __i__) __v__ = (__i__)
516  #else
517  // Disable deprecation warnings in GCC prior to GCC 4
518  #define NTV2_DEPRECATED_f(__f__) __f__
519  #define NTV2_DEPRECATED_v(__v__) __v__
520  #define NTV2_DEPRECATED_vi(__v__, __i__) __v__ = (__i__)
521  #endif
522 #else
523  // Disable deprecation warnings
524  #define NTV2_DEPRECATED_f(__f__) __f__
525  #define NTV2_DEPRECATED_v(__v__) __v__
526  #define NTV2_DEPRECATED_vi(__v__, __i__) __v__ = (__i__)
527 #endif
528 
529 #define NTV2_DEPRECATED_16_0(__f__) NTV2_DEPRECATED_f(__f__)
530 #if defined(NTV2_DEPRECATE_16_0)
531  #define NTV2_DEPRECATED_16_1(__f__) NTV2_DEPRECATED_f(__f__)
532 #else//NTV2_DEPRECATE_16_0
533  #define NTV2_DEPRECATED_16_1(__f__) NTV2_WILL_BE_DEPRECATED(__f__)
534 #endif//NTV2_DEPRECATE_16_0
535 #if defined(NTV2_DEPRECATE_16_1)
536  #define NTV2_DEPRECATED_16_2(__f__) NTV2_DEPRECATED_f(__f__)
537 #else//NTV2_DEPRECATE_16_1
538  #define NTV2_DEPRECATED_16_2(__f__) NTV2_WILL_BE_DEPRECATED(__f__)
539 #endif//NTV2_DEPRECATE_16_1
540 #if defined(NTV2_DEPRECATE_16_2)
541  #define NTV2_DEPRECATED_16_3(__f__) NTV2_DEPRECATED_f(__f__)
542 #else//NTV2_DEPRECATE_16_2
543  #define NTV2_DEPRECATED_16_3(__f__) NTV2_WILL_BE_DEPRECATED(__f__)
544 #endif//NTV2_DEPRECATE_16_2
545 #if defined(NTV2_DEPRECATE_16_3)
546  #define NTV2_DEPRECATED_17_0(__f__) NTV2_DEPRECATED_f(__f__)
547 #else//NTV2_DEPRECATE_16_3
548  #define NTV2_DEPRECATED_17_0(__f__) NTV2_WILL_BE_DEPRECATED(__f__)
549 #endif//NTV2_DEPRECATE_16_3
550 #if defined(NTV2_DEPRECATE_17_0)
551  #define NTV2_DEPRECATED_17_1(__f__) NTV2_DEPRECATED_f(__f__)
552 #else//NTV2_DEPRECATE_17_0
553  #define NTV2_DEPRECATED_17_1(__f__) NTV2_WILL_BE_DEPRECATED(__f__)
554 #endif//NTV2_DEPRECATE_17_0
555 #if defined(NTV2_DEPRECATE_17_1)
556  #define NTV2_DEPRECATED_17_2(__f__) NTV2_DEPRECATED_f(__f__)
557 #else//NTV2_DEPRECATE_17_1
558  #define NTV2_DEPRECATED_17_2(__f__) NTV2_WILL_BE_DEPRECATED(__f__)
559 #endif//NTV2_DEPRECATE_17_1
560 #if defined(NTV2_DEPRECATE_17_2)
561  #define NTV2_DEPRECATED_17_5(__f__) NTV2_DEPRECATED_f(__f__)
562 #else//NTV2_DEPRECATE_17_2
563  #define NTV2_DEPRECATED_17_5(__f__) NTV2_WILL_BE_DEPRECATED(__f__)
564 #endif//NTV2_DEPRECATE_17_2
565 #if defined(NTV2_DEPRECATE_17_5)
566  #define NTV2_DEPRECATED_17_6(__f__) NTV2_DEPRECATED_f(__f__)
567 #else//NTV2_DEPRECATE_17_5
568  #define NTV2_DEPRECATED_17_6(__f__) NTV2_WILL_BE_DEPRECATED(__f__)
569 #endif//NTV2_DEPRECATE_17_5
570 #if defined(NTV2_DEPRECATE_17_6)
571  #define NTV2_DEPRECATED_18_0(__f__) NTV2_DEPRECATED_f(__f__)
572 #else//NTV2_DEPRECATE_17_6
573  #define NTV2_DEPRECATED_18_0(__f__) NTV2_WILL_BE_DEPRECATED(__f__)
574 #endif//NTV2_DEPRECATE_17_6
575 
576 #if !defined(BIT)
577  #if !defined(AJALinux)
578  #define BIT(_x_) (1u << (_x_))
579  #else // Linux:
580  // As of kernel 2.6.24, BIT is defined in the kernel source (linux/bitops.h).
581  // By making that definition match the one in the kernel source *exactly*
582  // we supress compiler warnings (thanks Shaun)
583  #define BIT(nr) (1UL << (nr))
584  #endif // AJALinux
585 #endif
586 #if 1
587  #define BIT_0 (1u<<0)
588  #define BIT_1 (1u<<1)
589  #define BIT_2 (1u<<2)
590  #define BIT_3 (1u<<3)
591  #define BIT_4 (1u<<4)
592  #define BIT_5 (1u<<5)
593  #define BIT_6 (1u<<6)
594  #define BIT_7 (1u<<7)
595  #define BIT_8 (1u<<8)
596  #define BIT_9 (1u<<9)
597  #define BIT_10 (1u<<10)
598  #define BIT_11 (1u<<11)
599  #define BIT_12 (1u<<12)
600  #define BIT_13 (1u<<13)
601  #define BIT_14 (1u<<14)
602  #define BIT_15 (1u<<15)
603  #define BIT_16 (1u<<16)
604  #define BIT_17 (1u<<17)
605  #define BIT_18 (1u<<18)
606  #define BIT_19 (1u<<19)
607  #define BIT_20 (1u<<20)
608  #define BIT_21 (1u<<21)
609  #define BIT_22 (1u<<22)
610  #define BIT_23 (1u<<23)
611  #define BIT_24 (1u<<24)
612  #define BIT_25 (1u<<25)
613  #define BIT_26 (1u<<26)
614  #define BIT_27 (1u<<27)
615  #define BIT_28 (1u<<28)
616  #define BIT_29 (1u<<29)
617  #define BIT_30 (1u<<30)
618  #define BIT_31 (1u<<31)
619 #endif // 1
620 
621 #if 0
622 // Check at compile time if all the defined types are the correct size
623 // must support C++11 for this to work
624 static_assert(sizeof(bool) == 1, "bool: size is not correct");
625 static_assert(sizeof(int8_t) == 1, "int8_t: size is not correct");
626 static_assert(sizeof(int16_t) == 2, "int16_t: size is not correct");
627 static_assert(sizeof(int32_t) == 4, "int32_t: size is not correct");
628 static_assert(sizeof(int64_t) == 8, "int64_t: size is not correct");
629 static_assert(sizeof(uint8_t) == 1, "uint8_t: size is not correct");
630 static_assert(sizeof(uint16_t) == 2, "uint16_t: size is not correct");
631 static_assert(sizeof(uint32_t) == 4, "uint32_t: size is not correct");
632 static_assert(sizeof(uint64_t) == 8, "uint64_t: size is not correct");
633 
634 static_assert(sizeof(LWord) == 4, "LWord: size is not correct");
635 static_assert(sizeof(ULWord) == 4, "ULWord: size is not correct");
636 static_assert(sizeof(PULWord) == 8, "PULWord: size is not correct");
637 static_assert(sizeof(Word) == 2, "Word: size is not correct");
638 static_assert(sizeof(UWord) == 2, "UWord: size is not correct");
639 static_assert(sizeof(UByte) == 1, "UByte: size is not correct");
640 static_assert(sizeof(SByte) == 1, "SByte: size is not correct");
641 
642 static_assert(sizeof(ULWord64) == 8, "ULWord64: size is not correct");
643 static_assert(sizeof(Pointer64) == 8, "Pointer64: size is not correct");
644 static_assert(sizeof(LWord64) == 8, "LWord64: size is not correct");
645 static_assert(sizeof(PVOID) == 8, "PVOID: size is not correct");
646 static_assert(sizeof(Fixed_) == 4, "Fixed_: size is not correct");
647 
648 // ideally these whould be the same across the platforms but historically they have not been
649 #if defined(MSWindows)
650 static_assert(sizeof(HANDLE) == 8, "HANDLE: size is not correct");
651 static_assert(sizeof(BOOL) == 4, "BOOL: size is not correct");
652 static_assert(sizeof(BOOL_) == 1, "BOOL_: size is not correct");
653 static_assert(sizeof(AJASocket) == 8, "AJASocket: size is not correct");
654 static_assert(sizeof(UWord_) == 2, "UWord_: size is not correct");
655 static_assert(sizeof(LPVOID) == 8, "LPVOID: size is not correct");
656 static_assert(sizeof(DWORD) == 4, "DWORD: size is not correct");
657 #elif defined(AJAMac)
658 static_assert(sizeof(HANDLE) == 2, "HANDLE: size is not correct");
659 //static_assert(sizeof(BOOL) == 1, "BOOL: size is not correct");
660 static_assert(sizeof(BOOL_) == 4, "BOOL_: size is not correct");
661 static_assert(sizeof(AJASocket) == 4, "AJASocket: size is not correct");
662 static_assert(sizeof(UWord_) == 4, "UWord_: size is not correct");
663 //static_assert(sizeof(LPVOID) == 8, "LPVOID: size is not correct");
664 //static_assert(sizeof(DWORD) == 4, "DWORD: size is not correct");
665 #elif defined(AJALinux)
666 static_assert(sizeof(HANDLE) == 8, "HANDLE: size is not correct");
667 static_assert(sizeof(BOOL) == 1, "BOOL: size is not correct");
668 static_assert(sizeof(BOOL_) == 1, "BOOL_: size is not correct");
669 static_assert(sizeof(AJASocket) == 4, "AJASocket: size is not correct");
670 static_assert(sizeof(UWord_) == 2, "UWord_: size is not correct");
671 static_assert(sizeof(LPVOID) == 8, "LPVOID: size is not correct");
672 static_assert(sizeof(DWORD) == 4, "DWORD: size is not correct");
673 #endif
674 
675 #endif
676 
677 #endif // AJATYPES_H
uint32_t * PULWord
Definition: ajatypes.h:224
int Fixed_
Definition: ajatypes.h:289
unsigned int BOOL_
Definition: ajatypes.h:287
int32_t LWord
Definition: ajatypes.h:222
uint32_t ULWord
Definition: ajatypes.h:223
short HANDLE
Definition: ajatypes.h:285
uint64_t Pointer64
Definition: ajatypes.h:227
void * PVOID
Definition: ajatypes.h:286
int16_t Word
Definition: ajatypes.h:220
ULWord UWord_
Definition: ajatypes.h:288
Deprecation control macros.
int64_t LWord64
Definition: ajatypes.h:225
int AJASocket
Definition: ajatypes.h:290
uint64_t ULWord64
Definition: ajatypes.h:226
uint8_t UByte
Definition: ajatypes.h:218
uint16_t UWord
Definition: ajatypes.h:221
int8_t SByte
Definition: ajatypes.h:219