27#pragma warning( push )
28#pragma warning( disable : 4251 )
66 if (m_data.ab < rhs.
m_data.
ab)
return true;
67 if (m_data.ab > rhs.
m_data.
ab)
return false;
68 if (m_data.cd < rhs.
m_data.
cd)
return true;
74 if (m_data.ab > rhs.
m_data.
ab)
return true;
75 if (m_data.ab < rhs.
m_data.
ab)
return false;
76 if (m_data.cd > rhs.
m_data.
cd)
return true;
86 return (m_data.ab == m_data.cd) && (m_data.ab == 0);
90 static size_t size() {
return 2 *
sizeof(uint64_t); }
109 return (_Left->getUuid() < _Right->getUuid());
131 friend class UuidGenerator2;
134 Data(uint64_t xab, uint64_t xcd) : ab(xab), cd(xcd) {}
150 template <
typename ch,
typename char_traits>
151 std::basic_istream<ch, char_traits>&
operator>>(std::basic_istream<ch, char_traits> &is,
Uuid &u)
153 const typename std::basic_istream<ch, char_traits>::sentry ok(is);
155 unsigned char data[16] = {0};
157 typedef std::ctype<ch> ctype_t;
158 ctype_t
const& ctype = std::use_facet<ctype_t>(is.getloc());
162 char szdigits[] =
"0123456789ABCDEF";
163 ctype.widen(szdigits, szdigits + 16, xdigits);
165 ch*
const xdigits_end = xdigits + 16;
168 for (std::size_t i = 0; i<u.
size() && is; ++i) {
170 c = ctype.toupper(c);
172 ch* f = std::find(xdigits, xdigits_end, c);
173 if (f == xdigits_end) {
174 is.setstate(std::ios_base::failbit);
178 unsigned char byte =
static_cast<unsigned char>(std::distance(&xdigits[0], f));
181 c = ctype.toupper(c);
182 f = std::find(xdigits, xdigits_end, c);
183 if (f == xdigits_end) {
184 is.setstate(std::ios_base::failbit);
188 byte =
static_cast<unsigned char>(
byte << 4);
189 byte =
static_cast<unsigned char>(
byte |
static_cast<unsigned char>(std::distance(&xdigits[0], f)));
194 if (i == 3 || i == 5 || i == 7 || i == 9) {
196 if (c != is.widen(
'-')) is.setstate(std::ios_base::failbit);
202 memcpy(u.
data(), data, 16);
210#pragma warning( push )
211#pragma warning( disable : 4127 )
215 if (
sizeof(
size_t) > 4) {
220 return agx::hash(
size_t(uint32_t(hash64 >> 32) ^ uint32_t(hash64)));
224#pragma warning( pop )
244 std::uniform_int_distribution<uint64_t> m_dist;
258#pragma warning( pop )
#define AGX_TYPE_BINDING(_Type, _Name)
std::ostream & operator<<(std::ostream &o, const agx::Vec6 &v)
Generator of UUID values based on V4 http://en.wikipedia.org/wiki/Universally_unique_identifier.
UuidGenerator()
Constructor.
~UuidGenerator()
Destructor.
A UUID, or Universally unique identifier, is intended to uniquely identify information in a distribut...
const agx::UInt8 * data() const
bool operator<(const Uuid &rhs) const
bool operator>(const Uuid &rhs) const
bool isNil() const
If this method returns true, the str() method will return a string of zeros.
Uuid(const agx::String &uuidString)
Constructor, will construct a uuid based on the given Uuis formatted string.
bool operator==(const Uuid &rhs) const
bool operator!=(const Uuid &rhs) const
static Uuid generateFromString(const agx::String &seedString)
Generate a valid UUID string from a specified input string.
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
UInt32 hash(const T &key)
std::istream & operator>>(std::istream &input, Vec2 &vec)
std::ostream & operator<<(std::ostream &os, const agx::AddedMassInteraction::Matrix6x6 &m)
Data(uint64_t xab, uint64_t xcd)
Sorting functor of an uuid.
bool operator()(const T &_Left, const T &_Right) const