TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Vector2unorm16.h
Go to the documentation of this file.
1 
13 #ifndef Vector2unorm16_h
14 #define Vector2unorm16_h
15 
16 #include "G3D/platform.h"
17 #include "G3D/g3dmath.h"
18 #include "G3D/HashTrait.h"
19 #include "G3D/unorm16.h"
20 
21 namespace G3D {
22 
23 class Any;
34 private:
35  // Hidden operators
36  bool operator<(const Vector2unorm16&) const;
37  bool operator>(const Vector2unorm16&) const;
38  bool operator<=(const Vector2unorm16&) const;
39  bool operator>=(const Vector2unorm16&) const;
40 
41 public:
44 
46  Vector2unorm16(G3D::unorm16 _x, G3D::unorm16 _y) : x(_x), y(_y){}
47  Vector2unorm16(float _x, float _y) : x(_x), y(_y){}
48  explicit Vector2unorm16(const class Vector2& v);
49  explicit Vector2unorm16(class BinaryInput& bi);
50  explicit Vector2unorm16(const class Any& a);
51 
52  Any toAny() const;
53 
54  Vector2unorm16& operator=(const Any& a);
55 
56  inline G3D::unorm16& operator[] (int i) {
57  debugAssert(((unsigned int)i) <= 1);
58  return ((G3D::unorm16*)this)[i];
59  }
60 
61  inline const G3D::unorm16& operator[] (int i) const {
62  debugAssert(((unsigned int)i) <= 1);
63  return ((G3D::unorm16*)this)[i];
64  }
65 
66  inline bool operator== (const Vector2unorm16& rkVector) const {
67  return ((int32*)this)[0] == ((int32*)&rkVector)[0];
68  }
69 
70  inline bool operator!= (const Vector2unorm16& rkVector) const {
71  return ((int32*)this)[0] != ((int32*)&rkVector)[0];
72  }
73 
74  void serialize(class BinaryOutput& bo) const;
75  void deserialize(class BinaryInput& bi);
76  size_t hashCode() const {
77  return static_cast<size_t>(x.bits() + ((int)y.bits() << 16));
78  }
79 
80 }
82 
84 
85 }
86 
87 template<> struct HashTrait<G3D::Vector2unorm16> {
88  static size_t hashCode(const G3D::Vector2unorm16& key) { return key.hashCode(); }
89 };
90 
91 #endif
size_t hashCode() const
Definition: Vector2unorm16.h:76
class Any toAny() const
bool operator!=(const NetAddress &a, const NetAddress &b)
Definition: NetAddress.h:128
bool operator<=(const unorm16 other) const
Definition: unorm16.h:110
Definition: HashTrait.h:105
Definition: AABox.h:25
bool operator<(const unorm16 other) const
Definition: unorm16.h:102
void deserialize(std::string &s, BinaryInput &b)
Definition: serialize.h:16
bool operator==(const NetAddress &a, const NetAddress &b)
Definition: NetAddress.h:123
unorm16
Definition: unorm16.h:32
#define G3D_END_PACKED_CLASS(byteAlign)
Definition: platform.h:357
Vector2unorm16
Definition: Vector2unorm16.h:33
void serialize(const std::string &s, BinaryOutput &b)
Definition: serialize.h:12
#define debugAssert(exp)
Definition: debugAssert.h:160
Definition: Vector2unorm16.h:23
Vector2int16 & operator=(const Any &a)
G3D::int16 y
Definition: Vector2int16.h:38
G3D::int16 & operator[](int i)
Definition: Vector2int16.h:51
bool operator>=(const unorm16 other) const
Definition: unorm16.h:106
bool operator>(const unorm16 other) const
Definition: unorm16.h:98
#define G3D_BEGIN_PACKED_CLASS(byteAlign)
Definition: platform.h:345
int32_t int32
Definition: g3dmath.h:167
G3D::int16 x
Definition: Vector2int16.h:37
static size_t hashCode(const G3D::Vector2unorm16 &key)
Definition: Vector2unorm16.h:88