AJA NTV2 SDK  18.1.0.2145
NTV2 SDK 18.1.0.2145
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 /**************************************************************************************************************
127  NTV2_CHECK_SDRAM_COLLISIONS When defined (the default), calls made to StartAudioInput, StartAudioOutput,
128  AutoCirculateInitForInput or AutoCirculateInitForOutput that result in
129  SDRAM collisions will be logged.
130 
131  When undefined, SDRAM collision checking will not be performed for the
132  aforementioned function calls.
133 
134  Introduced in SDK 18.1.
135 **************************************************************************************************************/
136 #define NTV2_CHECK_SDRAM_COLLISIONS
137 
138 
139 
143 #define AJA_VIRTUAL virtual // Force use of virtual functions in CNTV2Card, etc.
144 #define AJA_STATIC static // Do not change this.
145 #define NTV2_UNUSED(__p__) (void)__p__
146 
147 #if defined(__CPLUSPLUS__) || defined(__cplusplus)
148  #if defined(AJAMac)
149  #if defined(__clang__)
150  #ifndef __has_feature
151  #define __has_feature(__x__) 0
152  #endif
153  #if __has_feature(cxx_nullptr)
154  #define AJA_CXX11_NULLPTR_AVAILABLE
155  #endif
156  #endif
157  #elif defined(AJALinux)
158  #if defined(__clang__)
159  #ifndef __has_feature
160  #define __has_feature(__x__) 0
161  #endif
162  #if __has_feature(cxx_nullptr)
163  #define AJA_CXX11_NULLPTR_AVAILABLE
164  #endif
165  #elif defined(__GNUC__)
166  #if __cplusplus >= 201103L // C++11 or later
167  #define AJA_CXX11_NULLPTR_AVAILABLE
168  #endif
169  #endif
170  #elif defined(MSWindows)
171  #if defined(_MSC_VER) && _MSC_VER >= 1700 // VS2012 or later:
172  #define AJA_CXX11_NULLPTR_AVAILABLE
173  #endif
174  #endif
175 #endif
176 
177 #if defined(AJA_CXX11_NULLPTR_AVAILABLE)
178  #define AJA_NULL nullptr
179 #else
180  #define AJA_NULL NULL
181 #endif
182 
183 #if defined(__clang__)
184  #ifndef __has_cpp_attribute
185  #define __has_cpp_attribute(__x__) 0
186  #endif
187 
188  #if __has_cpp_attribute(clang::fallthrough)
189  #define AJA_FALL_THRU [[clang::fallthrough]]
190  #else
191  #define AJA_FALL_THRU
192  #endif
193 #elif defined(__GNUC__)
194  #if __GNUC__ >= 5
195  #define AJA_FALL_THRU [[gnu::fallthrough]]
196  #else
197  #define AJA_FALL_THRU
198  #endif
199 #else
200  #define AJA_FALL_THRU
201 #endif
202 
203 
204 #if defined (NTV2_USE_STDINT)
205  #if defined (MSWindows)
206  #define _WINSOCK_DEPRECATED_NO_WARNINGS 1
207  #if (_MSC_VER < 1300)
208  typedef signed char int8_t;
209  typedef signed short int16_t;
210  typedef signed int int32_t;
211  typedef unsigned char uint8_t;
212  typedef unsigned short uint16_t;
213  typedef unsigned int uint32_t;
214  #else
215  #if defined (NTV2_BUILDING_DRIVER)
216  typedef signed __int8 int8_t;
217  typedef signed __int16 int16_t;
218  typedef signed __int32 int32_t;
219  typedef unsigned __int8 uint8_t;
220  typedef unsigned __int16 uint16_t;
221  typedef unsigned __int32 uint32_t;
222  #else
223  #include <stdint.h>
224  #endif
225  #endif
226  typedef signed __int64 int64_t;
227  typedef unsigned __int64 uint64_t;
228  #else
229  #include <stdint.h>
230  #endif
231  typedef uint8_t UByte;
232  typedef int8_t SByte;
233  typedef int16_t Word;
234  typedef uint16_t UWord;
235  typedef int32_t LWord;
236  typedef uint32_t ULWord;
237  typedef uint32_t * PULWord;
238  typedef int64_t LWord64;
239  typedef uint64_t ULWord64;
240  typedef uint64_t Pointer64;
241 #else
242  typedef int LWord;
243  typedef unsigned int ULWord;
244  typedef unsigned int * PULWord;
245  typedef short Word;
246  typedef unsigned short UWord;
247  typedef unsigned char UByte;
248  typedef char SByte;
249 #endif
250 
251 // Platform dependent
253 #if defined (MSWindows)
254  #define _WINSOCK_DEPRECATED_NO_WARNINGS 1
256 
257  #if !defined (NTV2_BUILDING_DRIVER)
258  #ifndef WIN32_LEAN_AND_MEAN
259  #define WIN32_LEAN_AND_MEAN
260  #endif
261 
262  #include <Windows.h>
263 
264  #if defined(DeviceCapabilities)
265  #undef DeviceCapabilities
266  #endif
267  #endif
268  #include <Basetsd.h>
269  typedef unsigned char Boolean;
270  typedef __int64 LWord64;
271  typedef unsigned __int64 ULWord64;
272  typedef unsigned __int64 Pointer64;
273  typedef LWord Fixed_;
274  typedef bool BOOL_;
275  typedef UWord UWord_;
276 
277  typedef signed __int8 int8_t;
278  typedef signed __int16 int16_t;
279  typedef signed __int32 int32_t;
280  typedef signed __int64 int64_t;
281  typedef unsigned __int8 uint8_t;
282  typedef unsigned __int16 uint16_t;
283  typedef unsigned __int32 uint32_t;
284  typedef unsigned __int64 uint64_t;
285 
286  typedef UINT_PTR AJASocket;
287 
288  #define AJATargetBigEndian 0
289  #define AJAFUNC __FUNCTION__
290  #define NTV2_CPP_MIN(__x__,__y__) min((__x__),(__y__))
291  #define NTV2_CPP_MAX(__x__,__y__) max((__x__),(__y__))
292  #pragma warning(disable:4996) // Sadly MSVC bitches about DECLARING a deprecated function but not about USING one.
293 
295 #elif defined (AJAMac)
296  #include <stdint.h>
298  typedef short HANDLE;
299  typedef void* PVOID;
300  typedef unsigned int BOOL_;
301  typedef ULWord UWord_;
302  typedef int Fixed_;
303  typedef int AJASocket;
304 
305  #define AJATargetBigEndian 0
306  #define AJAFUNC __func__
307  #define NTV2_CPP_MIN(__x__,__y__) std::min((__x__),(__y__))
308  #define NTV2_CPP_MAX(__x__,__y__) std::max((__x__),(__y__))
309 
310  #define MAX_PATH 4096
311 
312  #define INVALID_HANDLE_VALUE (0)
313 
314  #if !defined (NTV2_DEPRECATE)
315  typedef struct {
316  int cx;
317  int cy;
318  } SIZE;
319  #endif // !defined (NTV2_DEPRECATE)
320 
321  #define POINTER_32
322 
324 #elif defined (AJALinux)
325  /* As of kernel 2.6.19, the C type _Bool is typedefed to bool to allow
327  * generic booleans in the kernel. Unfortunately, we #define bool
328  * here and true and false there, so this fixes it ... until next time
329  * -JAC 3/6/2007 */
330  #ifdef __KERNEL__
331  #include "linux/version.h"
332  #include "linux/kernel.h"
333  #if defined (RHEL5) || (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,19))
334  #include "linux/types.h"
335  #else/* LINUX_VERSION_CODE */
336  typedef unsigned char bool;
337  #endif /* LINUX_VERSION_CODE */
338  #endif /* __KERNEL__ */
339 
340  #if defined (MODULE)
341  #define NTV2_BUILDING_DRIVER
342  #undef NTV2_USE_CPLUSPLUS11
343  #endif
344 
345  #if !defined (NTV2_BUILDING_DRIVER)
346  #include <stdint.h>
347  typedef int64_t HANDLE;
348  typedef uint64_t ULWord64;
349  typedef uint64_t Pointer64;
350  typedef int64_t LWord64;
351  typedef void * PVOID;
352  typedef void * LPVOID;
353  typedef int32_t Fixed_;
354  typedef bool BOOL_;
355  typedef bool BOOL;
356  typedef UWord UWord_;
357  typedef uint32_t DWORD; /* 32 bits on 32 or 64 bit CPUS */
358 
359  typedef int32_t AJASocket;
360  #define NTV2_CPP_MIN(__x__,__y__) std::min((__x__),(__y__))
361  #define NTV2_CPP_MAX(__x__,__y__) std::max((__x__),(__y__))
362  #else
363  #if defined (AJAVirtual)
364  #include <stdbool.h>
365  #include <stdint.h>
366  #endif
367  typedef long HANDLE;
368  // this is what is is in Windows:
369  // typedef void * HANDLE;
370  typedef unsigned long long ULWord64;
371  typedef unsigned long long Pointer64;
372  typedef signed long long LWord64;
373  typedef void * PVOID;
374  typedef void * LPVOID;
375  typedef LWord Fixed_;
376  typedef bool BOOL_;
377  typedef bool BOOL;
378  typedef UWord UWord_;
379  typedef unsigned int DWORD; /* 32 bits on 32 or 64 bit CPUS */
380 
381  typedef int AJASocket;
382  #endif
383 
384  #define AJATargetBigEndian 0
385  #define AJAFUNC __func__
386 
387  #if !defined (NTV2_DEPRECATE)
388  typedef struct {
389  int cx;
390  int cy;
391  } SIZE;
392  #endif // !defined (NTV2_DEPRECATE)
393 
394  typedef struct {
395  int left;
396  int right;
397  int top;
398  int bottom;
399  } RECT;
400 
401  #ifndef INVALID_HANDLE_VALUE
402  #define INVALID_HANDLE_VALUE (-1L)
403  #endif
404  #define WINAPI
405  #define POINTER_32
406  #define MAX_PATH 4096
407 #elif defined (AJA_BAREMETAL)
409  #include <stdint.h>
411  typedef short HANDLE;
412  typedef void* PVOID;
413  typedef unsigned int BOOL_;
414  typedef ULWord UWord_;
415  typedef int Fixed_;
416  typedef int AJASocket;
417 
418  #define AJATargetBigEndian 0
419  #define AJAFUNC __func__
420  #define NTV2_CPP_MIN(__x__,__y__) std::min((__x__),(__y__))
421  #define NTV2_CPP_MAX(__x__,__y__) std::max((__x__),(__y__))
422 
423  #define MAX_PATH 4096
424 
425  #undef NTV2_WRITEREG_PROFILING // disable register write profiling
426 
427  #define INVALID_HANDLE_VALUE (0)
428 
429  #if !defined (NTV2_DEPRECATE)
430  typedef struct {
431  int cx;
432  int cy;
433  } SIZE;
434  #endif // !defined (NTV2_DEPRECATE)
435 
436  #define POINTER_32
437 
438 #else
439  #error "IMPLEMENT OTHER PLATFORM"
441 
442 #endif // end OTHER PLATFORM
443 
444 #if defined (NTV2_BUILDING_DRIVER)
445  // The AJA NTV2 driver is always built without any deprecated types or functions:
446  #if !defined(NTV2_DEPRECATE_16_0)
447  #define NTV2_DEPRECATE_16_0
448  #endif
449  #if !defined(NTV2_DEPRECATE_16_1)
450  #define NTV2_DEPRECATE_16_1
451  #endif
452  #if !defined(NTV2_DEPRECATE_16_2)
453  #define NTV2_DEPRECATE_16_2
454  #endif
455  #if !defined(NTV2_DEPRECATE_16_3)
456  #define NTV2_DEPRECATE_16_3
457  #endif
458 #endif // defined (NTV2_BUILDING_DRIVER)
459 
460 
464 #if !defined (NTV2_ASSERT)
465  #if defined (NTV2_BUILDING_DRIVER)
466  // Kernel space NTV2_ASSERTs
467  #if defined (AJA_DEBUG) || defined (_DEBUG)
468  #if defined (MSWindows)
469  #define NTV2_ASSERT(_expr_) ASSERT (#_expr_)
470  #elif defined (AJAMac)
471  #define NTV2_ASSERT(_expr_) assert (_expr_)
472  #elif defined (AJALinux)
473  #define NTV2_ASSERT(_expr_) do {if (#_expr_) break; \
474  printk (KERN_EMERG "### NTV2_ASSERT '%s': %s: line %d: %s\n", \
475  __FILE__, __func__, __LINE__, #_expr_); dump_stack(); \
476  } while (0)
477  #else
478  #define NTV2_ASSERT(_expr_)
479  #endif
480  #else
481  #define NTV2_ASSERT(_expr_)
482  #endif
483  #else
484  // User space NTV2_ASSERTs
485  #if defined (AJA_DEBUG) || defined (_DEBUG)
486  #include <assert.h>
487  #define NTV2_ASSERT(_expr_) assert (_expr_)
488  #else
489  #define NTV2_ASSERT(_expr_) (void) (_expr_)
490  #endif
491  #endif // else !defined (NTV2_BUILDING_DRIVER)
492 #endif // if NTV2_ASSERT undefined
493 
494 
498 // These implement compile-time warnings for use of deprecated variables and functions
499 #define NTV2_DEPRECATED_INLINE // Just a marker/reminder
500 #define NTV2_DEPRECATED_FIELD // Just a marker/reminder
501 #define NTV2_DEPRECATED_VARIABLE // Just a marker/reminder
502 #define NTV2_DEPRECATED_TYPEDEF // Just a marker/reminder
503 #define NTV2_DEPRECATED_CLASS // Just a marker/reminder
504 #define NTV2_SHOULD_BE_DEPRECATED(__f__) __f__
505 #define NTV2_SHOULD_DEPRECATE(__f__) __f__
506 #define NTV2_MUST_DEPRECATE(__f__) __f__
507 #define NTV2_WILL_BE_DEPRECATED(__f__) __f__
508 #if defined(NTV2_BUILDING_DRIVER)
509  // Disable deprecation warnings in driver builds
510  #define NTV2_DEPRECATED_f(__f__) __f__
511  #define NTV2_DEPRECATED_v(__v__) __v__
512  #define NTV2_DEPRECATED_vi(__v__, __i__) __v__ = (__i__)
513 #elif defined(_MSC_VER) && _MSC_VER >= 1600
514  // Use __declspec(deprecated) for MSVC
515  #define NTV2_DEPRECATED_f(__f__) __declspec(deprecated) __f__
516  #define NTV2_DEPRECATED_v(__v__) __v__
517  #define NTV2_DEPRECATED_vi(__v__, __i__) __v__ = (__i__)
518 #elif defined(__clang__)
519  // Use __attribute__((deprecated)) for LLVM/Clang
520  #define NTV2_DEPRECATED_f(__f__) __f__ __attribute__((deprecated))
521  #define NTV2_DEPRECATED_v(__v__) __v__
522  #define NTV2_DEPRECATED_vi(__v__, __i__) __v__ = (__i__)
523 #elif defined(__GNUC__)
524  #if __GNUC__ >= 4
525  // Use __attribute__((deprecated)) for GCC 4 or later
526  #define NTV2_DEPRECATED_f(__f__) __f__ __attribute__ ((deprecated))
527  #define NTV2_DEPRECATED_v(__v__) __v__
528  #define NTV2_DEPRECATED_vi(__v__, __i__) __v__ = (__i__)
529  #else
530  // Disable deprecation warnings in GCC prior to GCC 4
531  #define NTV2_DEPRECATED_f(__f__) __f__
532  #define NTV2_DEPRECATED_v(__v__) __v__
533  #define NTV2_DEPRECATED_vi(__v__, __i__) __v__ = (__i__)
534  #endif
535 #else
536  // Disable deprecation warnings
537  #define NTV2_DEPRECATED_f(__f__) __f__
538  #define NTV2_DEPRECATED_v(__v__) __v__
539  #define NTV2_DEPRECATED_vi(__v__, __i__) __v__ = (__i__)
540 #endif
541 
542 #define NTV2_DEPRECATED_16_0(__f__) NTV2_DEPRECATED_f(__f__)
543 #if defined(NTV2_DEPRECATE_16_0)
544  #define NTV2_DEPRECATED_16_1(__f__) NTV2_DEPRECATED_f(__f__)
545 #else//NTV2_DEPRECATE_16_0
546  #define NTV2_DEPRECATED_16_1(__f__) NTV2_WILL_BE_DEPRECATED(__f__)
547 #endif//NTV2_DEPRECATE_16_0
548 #if defined(NTV2_DEPRECATE_16_1)
549  #define NTV2_DEPRECATED_16_2(__f__) NTV2_DEPRECATED_f(__f__)
550 #else//NTV2_DEPRECATE_16_1
551  #define NTV2_DEPRECATED_16_2(__f__) NTV2_WILL_BE_DEPRECATED(__f__)
552 #endif//NTV2_DEPRECATE_16_1
553 #if defined(NTV2_DEPRECATE_16_2)
554  #define NTV2_DEPRECATED_16_3(__f__) NTV2_DEPRECATED_f(__f__)
555 #else//NTV2_DEPRECATE_16_2
556  #define NTV2_DEPRECATED_16_3(__f__) NTV2_WILL_BE_DEPRECATED(__f__)
557 #endif//NTV2_DEPRECATE_16_2
558 #if defined(NTV2_DEPRECATE_16_3)
559  #define NTV2_DEPRECATED_17_0(__f__) NTV2_DEPRECATED_f(__f__)
560 #else//NTV2_DEPRECATE_16_3
561  #define NTV2_DEPRECATED_17_0(__f__) NTV2_WILL_BE_DEPRECATED(__f__)
562 #endif//NTV2_DEPRECATE_16_3
563 #if defined(NTV2_DEPRECATE_17_0)
564  #define NTV2_DEPRECATED_17_1(__f__) NTV2_DEPRECATED_f(__f__)
565 #else//NTV2_DEPRECATE_17_0
566  #define NTV2_DEPRECATED_17_1(__f__) NTV2_WILL_BE_DEPRECATED(__f__)
567 #endif//NTV2_DEPRECATE_17_0
568 #if defined(NTV2_DEPRECATE_17_1)
569  #define NTV2_DEPRECATED_17_2(__f__) NTV2_DEPRECATED_f(__f__)
570 #else//NTV2_DEPRECATE_17_1
571  #define NTV2_DEPRECATED_17_2(__f__) NTV2_WILL_BE_DEPRECATED(__f__)
572 #endif//NTV2_DEPRECATE_17_1
573 #if defined(NTV2_DEPRECATE_17_2)
574  #define NTV2_DEPRECATED_17_5(__f__) NTV2_DEPRECATED_f(__f__)
575 #else//NTV2_DEPRECATE_17_2
576  #define NTV2_DEPRECATED_17_5(__f__) NTV2_WILL_BE_DEPRECATED(__f__)
577 #endif//NTV2_DEPRECATE_17_2
578 #if defined(NTV2_DEPRECATE_17_5)
579  #define NTV2_DEPRECATED_17_6(__f__) NTV2_DEPRECATED_f(__f__)
580 #else//NTV2_DEPRECATE_17_5
581  #define NTV2_DEPRECATED_17_6(__f__) NTV2_WILL_BE_DEPRECATED(__f__)
582 #endif//NTV2_DEPRECATE_17_5
583 #if defined(NTV2_DEPRECATE_17_6)
584  #define NTV2_DEPRECATED_18_0(__f__) NTV2_DEPRECATED_f(__f__)
585 #else//NTV2_DEPRECATE_17_6
586  #define NTV2_DEPRECATED_18_0(__f__) NTV2_WILL_BE_DEPRECATED(__f__)
587 #endif//NTV2_DEPRECATE_17_6
588 #if defined(NTV2_DEPRECATE_18_0)
589  #define NTV2_DEPRECATED_18_1(__f__) NTV2_DEPRECATED_f(__f__)
590 #else//NTV2_DEPRECATE_18_0
591  #define NTV2_DEPRECATED_18_1(__f__) NTV2_WILL_BE_DEPRECATED(__f__)
592 #endif//NTV2_DEPRECATE_18_0
593 
594 #if !defined(BIT)
595  #if !defined(AJALinux)
596  #define BIT(_x_) (1u << (_x_))
597  #else // Linux:
598  // As of kernel 2.6.24, BIT is defined in the kernel source (linux/bitops.h).
599  // By making that definition match the one in the kernel source *exactly*
600  // we supress compiler warnings (thanks Shaun)
601  #define BIT(nr) (1UL << (nr))
602  #endif // AJALinux
603 #endif
604 #if 1
605  #define BIT_0 (1u<<0)
606  #define BIT_1 (1u<<1)
607  #define BIT_2 (1u<<2)
608  #define BIT_3 (1u<<3)
609  #define BIT_4 (1u<<4)
610  #define BIT_5 (1u<<5)
611  #define BIT_6 (1u<<6)
612  #define BIT_7 (1u<<7)
613  #define BIT_8 (1u<<8)
614  #define BIT_9 (1u<<9)
615  #define BIT_10 (1u<<10)
616  #define BIT_11 (1u<<11)
617  #define BIT_12 (1u<<12)
618  #define BIT_13 (1u<<13)
619  #define BIT_14 (1u<<14)
620  #define BIT_15 (1u<<15)
621  #define BIT_16 (1u<<16)
622  #define BIT_17 (1u<<17)
623  #define BIT_18 (1u<<18)
624  #define BIT_19 (1u<<19)
625  #define BIT_20 (1u<<20)
626  #define BIT_21 (1u<<21)
627  #define BIT_22 (1u<<22)
628  #define BIT_23 (1u<<23)
629  #define BIT_24 (1u<<24)
630  #define BIT_25 (1u<<25)
631  #define BIT_26 (1u<<26)
632  #define BIT_27 (1u<<27)
633  #define BIT_28 (1u<<28)
634  #define BIT_29 (1u<<29)
635  #define BIT_30 (1u<<30)
636  #define BIT_31 (1u<<31)
637 #endif // 1
638 
639 #if 0
640 // Check at compile time if all the defined types are the correct size
641 // must support C++11 for this to work
642 static_assert(sizeof(bool) == 1, "bool: size is not correct");
643 static_assert(sizeof(int8_t) == 1, "int8_t: size is not correct");
644 static_assert(sizeof(int16_t) == 2, "int16_t: size is not correct");
645 static_assert(sizeof(int32_t) == 4, "int32_t: size is not correct");
646 static_assert(sizeof(int64_t) == 8, "int64_t: size is not correct");
647 static_assert(sizeof(uint8_t) == 1, "uint8_t: size is not correct");
648 static_assert(sizeof(uint16_t) == 2, "uint16_t: size is not correct");
649 static_assert(sizeof(uint32_t) == 4, "uint32_t: size is not correct");
650 static_assert(sizeof(uint64_t) == 8, "uint64_t: size is not correct");
651 
652 static_assert(sizeof(LWord) == 4, "LWord: size is not correct");
653 static_assert(sizeof(ULWord) == 4, "ULWord: size is not correct");
654 static_assert(sizeof(PULWord) == 8, "PULWord: size is not correct");
655 static_assert(sizeof(Word) == 2, "Word: size is not correct");
656 static_assert(sizeof(UWord) == 2, "UWord: size is not correct");
657 static_assert(sizeof(UByte) == 1, "UByte: size is not correct");
658 static_assert(sizeof(SByte) == 1, "SByte: size is not correct");
659 
660 static_assert(sizeof(ULWord64) == 8, "ULWord64: size is not correct");
661 static_assert(sizeof(Pointer64) == 8, "Pointer64: size is not correct");
662 static_assert(sizeof(LWord64) == 8, "LWord64: size is not correct");
663 static_assert(sizeof(PVOID) == 8, "PVOID: size is not correct");
664 static_assert(sizeof(Fixed_) == 4, "Fixed_: size is not correct");
665 
666 // ideally these whould be the same across the platforms but historically they have not been
667 #if defined(MSWindows)
668 static_assert(sizeof(HANDLE) == 8, "HANDLE: size is not correct");
669 static_assert(sizeof(BOOL) == 4, "BOOL: size is not correct");
670 static_assert(sizeof(BOOL_) == 1, "BOOL_: size is not correct");
671 static_assert(sizeof(AJASocket) == 8, "AJASocket: size is not correct");
672 static_assert(sizeof(UWord_) == 2, "UWord_: size is not correct");
673 static_assert(sizeof(LPVOID) == 8, "LPVOID: size is not correct");
674 static_assert(sizeof(DWORD) == 4, "DWORD: size is not correct");
675 #elif defined(AJAMac)
676 static_assert(sizeof(HANDLE) == 2, "HANDLE: size is not correct");
677 //static_assert(sizeof(BOOL) == 1, "BOOL: size is not correct");
678 static_assert(sizeof(BOOL_) == 4, "BOOL_: size is not correct");
679 static_assert(sizeof(AJASocket) == 4, "AJASocket: size is not correct");
680 static_assert(sizeof(UWord_) == 4, "UWord_: size is not correct");
681 //static_assert(sizeof(LPVOID) == 8, "LPVOID: size is not correct");
682 //static_assert(sizeof(DWORD) == 4, "DWORD: size is not correct");
683 #elif defined(AJALinux)
684 static_assert(sizeof(HANDLE) == 8, "HANDLE: size is not correct");
685 static_assert(sizeof(BOOL) == 1, "BOOL: size is not correct");
686 static_assert(sizeof(BOOL_) == 1, "BOOL_: size is not correct");
687 static_assert(sizeof(AJASocket) == 4, "AJASocket: size is not correct");
688 static_assert(sizeof(UWord_) == 2, "UWord_: size is not correct");
689 static_assert(sizeof(LPVOID) == 8, "LPVOID: size is not correct");
690 static_assert(sizeof(DWORD) == 4, "DWORD: size is not correct");
691 #endif
692 
693 #endif
694 
695 #endif // AJATYPES_H
uint32_t * PULWord
Definition: ajatypes.h:237
int Fixed_
Definition: ajatypes.h:302
unsigned int BOOL_
Definition: ajatypes.h:300
int32_t LWord
Definition: ajatypes.h:235
uint32_t ULWord
Definition: ajatypes.h:236
short HANDLE
Definition: ajatypes.h:298
uint64_t Pointer64
Definition: ajatypes.h:240
void * PVOID
Definition: ajatypes.h:299
int16_t Word
Definition: ajatypes.h:233
ULWord UWord_
Definition: ajatypes.h:301
Deprecation control macros.
int64_t LWord64
Definition: ajatypes.h:238
int AJASocket
Definition: ajatypes.h:303
uint64_t ULWord64
Definition: ajatypes.h:239
uint8_t UByte
Definition: ajatypes.h:231
uint16_t UWord
Definition: ajatypes.h:234
int8_t SByte
Definition: ajatypes.h:232