server/dep/include/g3dlite/G3D/GUniqueID.h
Lynx3d ae3ad10bcf [10097] Update G3D up to v8.0b4
+ Got rid of zip lib requirement in G3D...
  Still can re-enable code by defining _HAVE_ZIP...

+ Remove silly X11 lib dependency from G3D
  Code doesn't seem to do anything yet anyway, and even if, we don't want it :p

+ Fix another weird G3D build problem...

+ Remove some __asm usage in g3d, which is not available on Win64
  My editor also decided to remove a ton of trailing white spaces...tss...

+ Reapply G3D fixes for 64bit VC

+ not use SSE specific header when SSE not enabled in *nix

+ Updated project files

+ New vmap_assembler VC90/VC80 Project

+ vmap assembler binaries updates

NOTE: Old vmap fikes expected work (as tests show) with new library version.
      But better use new generated versions. Its different in small parts to bad or good...

(based on Lynx3d's repo commit 44798d3)

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
2010-06-23 06:45:25 +04:00

69 lines
1.3 KiB
C++

/**
@file GUniqueID.h
@author Morgan McGuire, http://graphics.cs.williams.edu
*/
#ifndef G3D_GUNIQUEID_H
#define G3D_GUNIQUEID_H
#include "G3D/platform.h"
#include "G3D/g3dmath.h"
#include "G3D/Table.h"
namespace G3D {
/** Globally unique identifiers. The probability of two different
programs generating the same value from UniqueID::create is
vanishingly small.
UniqueIDs optionally contain a 10-bit application specific tag
that distinguishes their type.
*/
class GUniqueID {
private:
uint64 id;
public:
GUniqueID() : id(0) {}
bool uninitialized() const {
return id == 0;
}
uint16 tag() const {
return id >> 54;
}
operator uint64() const {
return id;
}
bool operator==(const GUniqueID& other) const {
return id == other.id;
}
bool operator!=(const GUniqueID& other) const {
return id != other.id;
}
void serialize(class BinaryOutput& b) const;
void deserialize(class BinaryInput& b);
void serialize(class TextOutput& t) const;
void deserialize(class TextInput& t);
/** Create a new ID */
static GUniqueID create(uint16 tag = 0);
};
} // G3D
/** For Table and Set */
template<> struct HashTrait<class G3D::GUniqueID> {
static size_t hashCode(G3D::GUniqueID id) { return (size_t)(G3D::uint64)id; }
};
#endif