summaryrefslogtreecommitdiff
path: root/ACE/ace/UUID.inl
blob: 12541cb543a6e9f685ff5818766eeb8141b9ca64 (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
// -*- C++ -*-
//
ACE_BEGIN_VERSIONED_NAMESPACE_DECL

namespace ACE_Utils
{
  ACE_INLINE
  const UUID_Node::Node_ID & UUID_Node::node_ID () const
  {
    return this->node_ID_;
  }

  ACE_INLINE
  UUID_Node::Node_ID & UUID_Node::node_ID ()
  {
    return this->node_ID_;
  }

  ACE_INLINE
  UUID::UUID ()
  {
    this->init ();
  }

  ACE_INLINE
  UUID::UUID (const UUID &right)
    : thr_id_ (right.thr_id_),
      pid_ (right.pid_)
  {
    ACE_OS::memcpy (&this->uuid_, &right.uuid_, BINARY_SIZE);
  }

  ACE_INLINE
  UUID::~UUID ()
  {

  }

  ACE_INLINE void
  UUID::init ()
  {
    ACE_OS::memset (&this->uuid_, 0, BINARY_SIZE);
  }

  ACE_INLINE unsigned long
  UUID::hash () const
  {
    return ACE::hash_pjw (reinterpret_cast <const char *> (&this->uuid_),
                          UUID::BINARY_SIZE);
  }

  ACE_INLINE ACE_UINT32
  UUID::time_low () const
  {
    return this->uuid_.time_low_;
  }

  ACE_INLINE void
  UUID::time_low (ACE_UINT32 timelow)
  {
    this->uuid_.time_low_ = timelow;
  }

  ACE_INLINE ACE_UINT16
  UUID::time_mid () const
  {
    return this->uuid_.time_mid_;
  }

  ACE_INLINE void
  UUID::time_mid (ACE_UINT16 time_mid)
  {
    this->uuid_.time_mid_ = time_mid;
  }

  ACE_INLINE ACE_UINT16
  UUID::time_hi_and_version () const
  {
    return this->uuid_.time_hi_and_version_;
  }

  ACE_INLINE void
  UUID::time_hi_and_version (ACE_UINT16 time_hi_and_version)
  {
    this->uuid_.time_hi_and_version_ = time_hi_and_version;
  }

  ACE_INLINE u_char
  UUID::clock_seq_hi_and_reserved () const
  {
    return this->uuid_.clock_seq_hi_and_reserved_;
  }

  ACE_INLINE void
  UUID::clock_seq_hi_and_reserved (u_char clock_seq_hi_and_reserved)
  {
    this->uuid_.clock_seq_hi_and_reserved_ = clock_seq_hi_and_reserved;
  }

  ACE_INLINE u_char
  UUID::clock_seq_low () const
  {
    return this->uuid_.clock_seq_low_;
  }

  ACE_INLINE void
  UUID::clock_seq_low (u_char clock_seq_low)
  {
    this->uuid_.clock_seq_low_ = clock_seq_low;
  }

  ACE_INLINE const UUID_Node &
  UUID::node () const
  {
    return this->uuid_.node_;
  }

  ACE_INLINE UUID_Node &
  UUID::node ()
  {
    return this->uuid_.node_;
  }

  ACE_INLINE void
  UUID::node (const UUID_Node & node)
  {
    ACE_OS::memcpy (&this->uuid_.node_,
                    node.node_ID (),
                    UUID_Node::NODE_ID_SIZE);
  }

  ACE_INLINE ACE_CString*
  UUID::thr_id ()
  {
    return &this->thr_id_;
  }

  ACE_INLINE void
  UUID::thr_id (char* thr_id)
  {
    this->thr_id_ = thr_id;
  }

  ACE_INLINE ACE_CString*
  UUID::pid ()
  {
    return &this->pid_;
  }

  ACE_INLINE void
  UUID::pid (char* pid)
  {
    this->pid_ = pid;
  }

#ifndef ACE_LACKS_SSCANF
  ACE_INLINE void
  UUID::from_string (const ACE_CString& uuidString)
  {
    this->from_string_i (uuidString);
  }
#endif

  ACE_INLINE bool
  UUID::operator == (const UUID &right) const
  {
    return 0 == ACE_OS::memcmp (&this->uuid_, &right.uuid_, BINARY_SIZE);
  }

  ACE_INLINE bool
  UUID::operator != (const UUID &right) const
  {
    return 0 != ACE_OS::memcmp (&this->uuid_, &right.uuid_, BINARY_SIZE);
  }

  ACE_INLINE bool
  UUID_Node::operator == (const UUID_Node& rt) const
  {
    for (size_t i = 0; i < NODE_ID_SIZE; ++i)
      if (node_ID_ [i] != rt.node_ID_ [i])
        return false;

    return true;
  }

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

//  ACE_INLINE bool
//  UUID_node::operator < (const UUID_node& rt) const
//  {
//    UUID_node right = rt;
//    for (size_t i = 0; i < NODE_ID_SIZE; ++i)
//      if (nodeID_ [i] < right.nodeID ()[i])
//      return true;
//
//    return false;
//  }
}

ACE_END_VERSIONED_NAMESPACE_DECL