Panda3D
 All Classes Functions Variables Enumerations
windowsGuid.I
1 // Filename: windowsGuid.I
2 // Created by: drose (03Oct04)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 
16 ////////////////////////////////////////////////////////////////////
17 // Function: WindowsGuid::Constructor
18 // Access: Public
19 // Description:
20 ////////////////////////////////////////////////////////////////////
21 INLINE WindowsGuid::
22 WindowsGuid() {
23  memset(this, 0, sizeof(WindowsGuid));
24 }
25 
26 ////////////////////////////////////////////////////////////////////
27 // Function: WindowsGuid::Constructor
28 // Access: Public
29 // Description:
30 ////////////////////////////////////////////////////////////////////
31 INLINE WindowsGuid::
32 WindowsGuid(unsigned long data1,
33  unsigned short data2, unsigned short data3,
34  unsigned char b1, unsigned char b2, unsigned char b3,
35  unsigned char b4, unsigned char b5, unsigned char b6,
36  unsigned char b7, unsigned char b8) :
37  _data1(data1),
38  _data2(data2),
39  _data3(data3),
40  _b1(b1),
41  _b2(b2),
42  _b3(b3),
43  _b4(b4),
44  _b5(b5),
45  _b6(b6),
46  _b7(b7),
47  _b8(b8)
48 {
49 }
50 
51 ////////////////////////////////////////////////////////////////////
52 // Function: WindowsGuid::Copy Constructor
53 // Access: Public
54 // Description:
55 ////////////////////////////////////////////////////////////////////
56 INLINE WindowsGuid::
57 WindowsGuid(const WindowsGuid &copy) {
58  (*this) = copy;
59 }
60 
61 ////////////////////////////////////////////////////////////////////
62 // Function: WindowsGuid::Copy Assignment Operator
63 // Access: Public
64 // Description:
65 ////////////////////////////////////////////////////////////////////
66 INLINE void WindowsGuid::
67 operator = (const WindowsGuid &copy) {
68  memcpy(this, &copy, sizeof(WindowsGuid));
69 }
70 
71 ////////////////////////////////////////////////////////////////////
72 // Function: WindowsGuid::operator ==
73 // Access: Published
74 // Description:
75 ////////////////////////////////////////////////////////////////////
76 INLINE bool WindowsGuid::
77 operator == (const WindowsGuid &other) const {
78  return compare_to(other) == 0;
79 }
80 
81 ////////////////////////////////////////////////////////////////////
82 // Function: WindowsGuid::operator !=
83 // Access: Published
84 // Description:
85 ////////////////////////////////////////////////////////////////////
86 INLINE bool WindowsGuid::
87 operator != (const WindowsGuid &other) const {
88  return compare_to(other) != 0;
89 }
90 
91 ////////////////////////////////////////////////////////////////////
92 // Function: WindowsGuid::operator <
93 // Access: Published
94 // Description:
95 ////////////////////////////////////////////////////////////////////
96 INLINE bool WindowsGuid::
97 operator < (const WindowsGuid &other) const {
98  return compare_to(other) < 0;
99 }
100 
101 ////////////////////////////////////////////////////////////////////
102 // Function: WindowsGuid::compare_to
103 // Access: Published
104 // Description: Returns a number less than zero if this WindowsGuid
105 // sorts before the other one, greater than zero if it
106 // sorts after, or zero if they are equivalent.
107 ////////////////////////////////////////////////////////////////////
108 INLINE int WindowsGuid::
109 compare_to(const WindowsGuid &other) const {
110  return memcmp(this, &other, sizeof(WindowsGuid));
111 }
112 
113 INLINE ostream &
114 operator << (ostream &out, const WindowsGuid &guid) {
115  guid.output(out);
116  return out;
117 }
118 
This is an implementation of the Windows GUID object, used everywhere as a world-unique identifier fo...
Definition: windowsGuid.h:29
int compare_to(const WindowsGuid &other) const
Returns a number less than zero if this WindowsGuid sorts before the other one, greater than zero if ...
Definition: windowsGuid.I:109
void output(ostream &out) const
Outputs a hex representation of the GUID.
Definition: windowsGuid.cxx:80