summaryrefslogtreecommitdiff
path: root/trunk/TAO/orbsvcs/orbsvcs/FtRtEvent/Utils/UUID.inl
blob: e1238a12ff1517aa636fd342aac7e926bee8554d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// -*- C++ -*-
//
// $Id$

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

ACE_INLINE
UUID::UUID()
{
  create(rep_.uuid);
}

ACE_INLINE
UUID::UUID(int)
{
}

/// construct an UUID from the binary represetation
ACE_INLINE
UUID::UUID(const unsigned char* id)
{
  memcpy(rep_.uuid, id, 16);
}

ACE_INLINE
bool UUID::operator == (const UUID& other) const
{
  return memcmp(this->rep_.uuid, other.rep_.uuid, BINRARY_LENGTH) == 0;
}

ACE_INLINE
bool UUID::operator != (const UUID& other) const
{
  return !(*this == other);
}


ACE_INLINE
bool UUID::is_valid() const
{
  return !this->rep_.timestamp.hi;
}


ACE_INLINE
void UUID::to_binary(unsigned char* binary_rep) const
{
  memcpy(binary_rep, rep_.uuid, 16);
}

ACE_INLINE
void UUID::to_string(ACE_CString& string) const
{
  string.resize(STRING_LENGTH-1);
  this->to_string(&string[0]);
}

TAO_END_VERSIONED_NAMESPACE_DECL