Gateware Libraries  6.3.A
Beta Build
GDefines.h
1 #ifndef GDEFINES_H
2 #define GDEFINES_H
3 
14 namespace GW
16 {
17 // Ensure identical binary padding for structures on all platforms.
18 #pragma pack(push, 1)
19 
21 
25  struct GUUIID // ALL GUUIID are stored little endian.
26  {
27  union
28  {
29  struct
30  {
31  unsigned int byte4;
32  unsigned short byte2a;
33  unsigned short byte2b;
34  unsigned char byte8[8];
35  };
36  //For faster comparison.
37  unsigned long long parts[2];
38  };
39 
41  bool operator==(const GUUIID& _cmp) const
42  {
43  if (parts[0] != _cmp.parts[0] || parts[1] != _cmp.parts[1])
44  return false;
45 
46  return true;
47  }
48  }; // Gateware guuiid mimic microsoft GUID structure in byte pattern.
49  // Use built-in Visual Studio tools to generate unique ID for new interfaces.
50 #pragma pack(pop)
51 
53  enum GReturn
54  {
55  SUCCESS = 0xFFFFFFFF, /*< The function succeded. */
56  FAILURE = 0, /*< The function failed (Check function documentation for possible reasons).*/
57  INVALID_ARGUMENT = 1, /*< An invalid argument was passed into the function.*/
58  MEMORY_CORRUPTION = 2, /*< A memory corruption occurred in the function.*/
59  INTERFACE_UNSUPPORTED = 3, /*< The requested interface is not supported by the object.*/
60  FILE_NOT_FOUND = 4, /*< A requested file is not found.*/
61  REDUNDANT_OPERATION = 5, /*< The requested operation will not do anything.*/
62  FEATURE_UNSUPPORTED = 6, /*< Attempted an operation that is currently not supported.*/
63  };
64 };// end GW namespace
65 
67 
73 #define G_SUCCESS(_greturn_) ((~(_greturn_)) == 0x00000000)
74 
76 /*
77 * \param [in] _greturn_ The GReturn value to check.
78 *
79 * \retval true GReturn value passed in was a failure code.
80 * \retval false GReturn value passed in was SUCCESS.
81 */
82 #define G_FAIL(_greturn_) ((_greturn_) < 0xFFFFFFFF)
83 
84 // If the following symbol is defined by the compiler then you must also define the following DLL export symbols.
85 // ADD NON SYMBOLS FOR STANDARD BUILDS TO BE OVERRIDEN PER-PROJECT COMPILER SETTINGS.
86 #ifndef GATEWARE_EXPORT_IMPLICIT
87  #define GATEWARE_EXPORT_IMPLICIT
88 #endif
89 #ifndef GATEWARE_EXPORT_EXPLICIT
90  #define GATEWARE_EXPORT_EXPLICIT extern "C"
91 #endif
92 
93 #endif // end include guard
Gateware Universally Unique Interface IDentifier.
Definition: GDefines.h:25
bool operator==(const GUUIID &_cmp) const
Comparison operator overload.
Definition: GDefines.h:41
GReturn
Listing of common error codes returned by Gateware functions.
Definition: GDefines.h:53
The core namespace to which all Gateware interfaces/structures/defines must belong.
Definition: GAudio.h:20