ROOT  6.06/09
Reference Guide
TUUID.cxx
Go to the documentation of this file.
1 // @(#)root/base:$Id$
2 // Author: Fons Rademakers 30/9/2001
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2001, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 /** \class TUUID
13 
14 This class defines a UUID (Universally Unique IDentifier), also
15 known as GUIDs (Globally Unique IDentifier). A UUID is 128 bits
16 long, and if generated according to this algorithm, is either
17 guaranteed to be different from all other UUIDs/GUIDs generated
18 until 3400 A.D. or extremely likely to be different. UUIDs were
19 originally used in the Network Computing System (NCS) and
20 later in the Open Software Foundation's (OSF) Distributed Computing
21 Environment (DCE).
22 
23 Structure of universal unique IDs (UUIDs).
24 
25 Depending on the network data representation, the multi-
26 octet unsigned integer fields are subject to byte swapping
27 when communicated between dissimilar endian machines.
28 ~~~ {.cpp}
29 +-----------------------------------+
30 | low 32 bits of time | 0-3 .fTimeLow
31 +-------------------------------+----
32 | mid 16 bits of time | 4-5 .fTimeMid
33 +-------+-----------------------+
34 | vers. | hi 12 bits of time | 6-7 .fTimeHiAndVersion
35 +-------+-------+---------------+
36 |Res | clkSeqHi | 8 .fClockSeqHiAndReserved
37 +---------------+
38 | clkSeqLow | 9 .fClockSeqLow
39 +---------------+------------------+
40 | node ID | 10-15 .fNode
41 +----------------------------------+
42 ~~~
43 
44 The adjusted time stamp is split into three fields, and the
45 clockSeq is split into two fields.
46 
47 The timestamp is a 60-bit value. For UUID version 1, this
48 is represented by Coordinated Universal Time (UTC/GMT) as
49 a count of 100-nanosecond intervals since 00:00:00.00,
50 15 October 1582 (the date of Gregorian reform to the
51 Christian calendar).
52 
53 The version number is multiplexed in the 4 most significant
54 bits of the 'fTimeHiAndVersion' field. There are two defined
55 versions:
56 ~~~ {.cpp}
57  MSB <---
58 Version 4-Bit Code Description
59 ------------------------------------------------------------
60 | 1 0 0 0 1 DCE version, as specified herein.
61 | 2 0 0 1 0 DCE Security version, with
62 | embedded POSIX UIDs.
63 | 3 0 0 1 1 node id is a random value
64 ------------------------------------------------------------
65 ~~~
66 
67 ## Clock Sequence
68 
69 The clock sequence value must be changed whenever:
70 
71  The UUID generator detects that the local value of UTC
72  has gone backward; this may be due to re-syncing of the system
73  clock.
74 
75 While a node is operational, the UUID service always saves
76 the last UTC used to create a UUID. Each time a new UUID
77 is created, the current UTC is compared to the saved value
78 and if either the current value is less or the saved value
79 was lost, then the clock sequence is incremented modulo
80 16,384, thus avoiding production of duplicated UUIDs.
81 
82 The clock sequence must be initialized to a random number
83 to minimize the correlation across system. This provides
84 maximum protection against node identifiers that may move
85 or switch from system to system rapidly.
86 
87 ## Clock Adjustment
88 
89 UUIDs may be created at a rate greater than the system clock
90 resolution. Therefore, the system must also maintain an
91 adjustment value to be added to the lower-order bits of the
92 time. Logically, each time the system clock ticks, the
93 adjustment value is cleared. Every time a UUID is generated,
94 the current adjustment value is read and incremented, and
95 then added to the UTC time field of the UUID.
96 
97 ## Clock Overrun
98 
99 The 100-nanosecond granularity of time should prove sufficient
100 even for bursts of UUID production in the next generation of
101 high-performance multiprocessors. If a system overruns the
102 clock adjustment by requesting too many UUIDs within a single
103 system clock tick, the UUID generator will stall until the
104 system clock catches up.
105 */
106 
107 #include "TROOT.h"
108 #include "TUUID.h"
109 #include "TError.h"
110 #include "TSystem.h"
111 #include "TInetAddress.h"
112 #include "TMD5.h"
113 #include "Bytes.h"
114 #include "TVirtualMutex.h"
115 #include "ThreadLocalStorage.h"
116 #include <string.h>
117 #include <stdlib.h>
118 #ifdef R__WIN32
119 #include "Windows4Root.h"
120 #include <Iphlpapi.h>
121 #else
122 #include <unistd.h>
123 #include <sys/time.h>
124 #if defined(R__LINUX) && !defined(R__WINGCC)
125 #include <sys/sysinfo.h>
126 #endif
127 #endif
128 
129 
131 
132 ////////////////////////////////////////////////////////////////////////////////
133 /// Create a UUID.
134 
135 TUUID::TUUID()
136 {
137  TTHREAD_TLS(uuid_time_t) time_last;
138  TTHREAD_TLS(UShort_t) clockseq(0);
139  TTHREAD_TLS(Bool_t) firstTime(kTRUE);
140  uuid_time_t *time_last_ptr = TTHREAD_TLS_PTR(time_last);
141 
142  if (firstTime) {
143  R__LOCKGUARD2(gROOTMutex); // rand and random are not thread safe.
144 
145  if (gSystem) {
146  // try to get a unique seed per process
147  UInt_t seed = (UInt_t) (Long64_t(gSystem->Now()) + gSystem->GetPid());
148 #ifdef R__WIN32
149  srand(seed);
150 #else
151  srandom(seed);
152 #endif
153  }
154  GetCurrentTime(time_last_ptr);
155 #ifdef R__WIN32
156  clockseq = 1+(UShort_t)(65536*rand()/(RAND_MAX+1.0));
157 #else
158  clockseq = 1+(UShort_t)(65536*random()/(RAND_MAX+1.0));
159 #endif
160  firstTime = kFALSE;
161  }
162 
163  uuid_time_t timestamp;
164 
165  // get current time
166  GetCurrentTime(&timestamp);
167 
168  // if clock went backward change clockseq
169  if (CmpTime(&timestamp, time_last_ptr) == -1) {
170  clockseq = (clockseq + 1) & 0x3FFF;
171  if (clockseq == 0) clockseq++;
172  }
173 
174  Format(clockseq, timestamp);
175 
176  time_last = timestamp;
177  fUUIDIndex = 1<<30;
178 }
179 
180 ////////////////////////////////////////////////////////////////////////////////
181 /// delete this TUUID
182 
184 {
185  //gROOT->GetUUIDs()->RemoveUUID(fUUIDIndex);
186 }
187 
188 ////////////////////////////////////////////////////////////////////////////////
189 /// Compare two time values.
190 
192 {
193  if (t1->high < t2->high) return -1;
194  if (t1->high > t2->high) return 1;
195  if (t1->low < t2->low) return -1;
196  if (t1->low > t2->low) return 1;
197  return 0;
198 }
199 
200 ////////////////////////////////////////////////////////////////////////////////
201 /// Set this UUID to the value specified in uuid ((which must be in
202 /// TUUID::AsString() format).
203 
204 void TUUID::SetFromString(const char *uuid)
205 {
206  // Format is tttttttt-tttt-cccc-cccc-nnnnnnnnnnnn.
207  Long_t timeLo;
208  int timeMid;
209  int timeHiAndVersion;
210  int clockSeqHiAndRes;
211  int clockSeqLo;
212  int node[6];
213 
214  sscanf(uuid, "%8lx-%4x-%4x-%2x%2x-%2x%2x%2x%2x%2x%2x",
215  &timeLo,
216  &timeMid,
217  &timeHiAndVersion,
218  &clockSeqHiAndRes,
219  &clockSeqLo,
220  &node[0], &node[1], &node[2], &node[3], &node[4], &node[5]);
221 
222  // Note that we're going through this agony because scanf is
223  // defined to know only to scan into "int"s or "long"s.
224  fTimeLow = (UInt_t) timeLo;
225  fTimeMid = (UShort_t) timeMid;
226  fTimeHiAndVersion = (UShort_t) timeHiAndVersion;
227  fClockSeqHiAndReserved = (UChar_t) clockSeqHiAndRes;
228  fClockSeqLow = (UChar_t) clockSeqLo;
229  fNode[0] = (UChar_t) node[0];
230  fNode[1] = (UChar_t) node[1];
231  fNode[2] = (UChar_t) node[2];
232  fNode[3] = (UChar_t) node[3];
233  fNode[4] = (UChar_t) node[4];
234  fNode[5] = (UChar_t) node[5];
235  fUUIDIndex = 1<<30;
236 }
237 
238 ////////////////////////////////////////////////////////////////////////////////
239 /// Initialize a TUUID with uuid (which must be in TUUID::AsString() format).
240 
241 TUUID::TUUID(const char *uuid)
242 {
243  fTimeLow = 0;
244  fTimeMid = 0;
245  fTimeHiAndVersion = 0;
247  fClockSeqLow = 0;
248  fNode[0] = 0;
249  fUUIDIndex = 0;
250 
251  if (!uuid || !*uuid)
252  Error("TUUID", "null string not allowed");
253  else
254  SetFromString(uuid);
255 }
256 
257 ////////////////////////////////////////////////////////////////////////////////
258 /// Stream UUID into output buffer.
259 
260 void TUUID::FillBuffer(char *&buffer)
261 {
262  Version_t version = TUUID::Class_Version();
263  tobuf(buffer, version);
264  tobuf(buffer, fTimeLow);
265  tobuf(buffer, fTimeMid);
266  tobuf(buffer, fTimeHiAndVersion);
267  tobuf(buffer, fClockSeqHiAndReserved);
268  tobuf(buffer, fClockSeqLow);
269  for (Int_t i = 0; i < 6; i++)
270  tobuf(buffer, fNode[i]);
271 }
272 
273 ////////////////////////////////////////////////////////////////////////////////
274 /// Stream UUID from input buffer.
275 
276 void TUUID::ReadBuffer(char *&buffer)
277 {
278  Version_t version;
279  frombuf(buffer, &version);
280  frombuf(buffer, &fTimeLow);
281  frombuf(buffer, &fTimeMid);
282  frombuf(buffer, &fTimeHiAndVersion);
284  frombuf(buffer, &fClockSeqLow);
285  for (Int_t i = 0; i < 6; i++)
286  frombuf(buffer, &fNode[i]);
287 }
288 
289 ////////////////////////////////////////////////////////////////////////////////
290 /// Stream UUID from input buffer.
291 /// This function is for the exclusive use of TDirectory::Streamer() to
292 /// read a non-versioned version of TUUID.
293 
295 {
296  b >> fTimeLow;
297  b >> fTimeMid;
298  b >> fTimeHiAndVersion;
300  b >> fClockSeqLow;
301  for (UInt_t i = 0; i < 6; i++) {
302  b >> fNode[i];
303  }
304 }
305 
306 ////////////////////////////////////////////////////////////////////////////////
307 /// Make a UUID from timestamp, clockseq and node id.
308 
310 {
311  fTimeLow = ts.low;
312  fTimeMid = (UShort_t)(ts.high & 0xFFFF);
313  fTimeHiAndVersion = (UShort_t)((ts.high >> 16) & 0x0FFF);
314  fTimeHiAndVersion |= (1 << 12);
315  fClockSeqLow = clockseq & 0xFF;
316  fClockSeqHiAndReserved = (clockseq & 0x3F00) >> 8;
317  fClockSeqHiAndReserved |= 0x80;
319 }
320 
321 ////////////////////////////////////////////////////////////////////////////////
322 /// Get current time as 60 bit 100ns ticks since whenever.
323 /// Compensate for the fact that real clock resolution is less
324 /// than 100ns.
325 
327 {
328  const UShort_t uuids_per_tick = 1024;
329 
330  TTHREAD_TLS(uuid_time_t) time_last;
331  TTHREAD_TLS(UShort_t) uuids_this_tick(0);
332  TTHREAD_TLS(Bool_t) init(kFALSE);
333 
334  uuid_time_t *time_last_ptr = TTHREAD_TLS_PTR(time_last);
335 
336  if (!init) {
337  GetSystemTime(time_last_ptr);
338  uuids_this_tick = uuids_per_tick;
339  init = kTRUE;
340  }
341 
342  uuid_time_t time_now;
343 
344  while (1) {
345  GetSystemTime(&time_now);
346 
347  // if clock reading changed since last UUID generated
348  if (CmpTime(time_last_ptr, &time_now)) {
349  // reset count of uuid's generated with this clock reading
350  uuids_this_tick = 0;
351  break;
352  }
353  if (uuids_this_tick < uuids_per_tick) {
354  uuids_this_tick++;
355  break;
356  }
357  // going too fast for our clock; spin
358  }
359 
360  time_last = time_now;
361 
362  if (uuids_this_tick != 0) {
363  if (time_now.low & 0x80000000) {
364  time_now.low += uuids_this_tick;
365  if (!(time_now.low & 0x80000000))
366  time_now.high++;
367  } else
368  time_now.low += uuids_this_tick;
369  }
370 
371  timestamp->high = time_now.high;
372  timestamp->low = time_now.low;
373 }
374 
375 ////////////////////////////////////////////////////////////////////////////////
376 /// Get system time with 100ns precision. Time is since Oct 15, 1582.
377 
379 {
380 #ifdef R__WIN32
381  ULARGE_INTEGER time;
382  GetSystemTimeAsFileTime((FILETIME *)&time);
383  // NT keeps time in FILETIME format which is 100ns ticks since
384  // Jan 1, 1601. UUIDs use time in 100ns ticks since Oct 15, 1582.
385  // The difference is 17 Days in Oct + 30 (Nov) + 31 (Dec)
386  // + 18 years and 5 leap days.
387  time.QuadPart +=
388  (unsigned __int64) (1000*1000*10) // seconds
389  * (unsigned __int64) (60 * 60 * 24) // days
390  * (unsigned __int64) (17+30+31+365*18+5); // # of days
391 
392  timestamp->high = time.HighPart;
393  timestamp->low = time.LowPart;
394 #else
395  struct timeval tp;
396  gettimeofday(&tp, 0);
397  // Offset between UUID formatted times and Unix formatted times.
398  // UUID UTC base time is October 15, 1582.
399  // Unix base time is January 1, 1970.
400  ULong64_t uuid_time = ((ULong64_t)tp.tv_sec * 10000000) + (tp.tv_usec * 10) +
401  0x01B21DD213814000LL;
402  timestamp->high = (UInt_t) (uuid_time >> 32);
403  timestamp->low = (UInt_t) (uuid_time & 0xFFFFFFFF);
404 #endif
405 }
406 
407 ////////////////////////////////////////////////////////////////////////////////
408 /// Get node identifier. Try first to get network address, if no
409 /// network interface try random info based on some machine parameters.
410 
412 {
413  static UInt_t adr = 0;
414 
415  if (gSystem) {
416 #ifndef R__WIN32
417  if (!adr) {
419  if (addr.IsValid())
420  adr = addr.GetAddress();
421  else
422  adr = 1; // illegal address
423  }
424 #else
425  // this way to get the machine's IP address is needed because
426  // GetHostByName() on Win32 contacts the DNS which we don't want
427  // as firewall tools like ZoneAlarm are likely to catch it and
428  // alarm the user
429  if (!adr) {
430  PIP_ADAPTER_INFO ainfo = (PIP_ADAPTER_INFO) malloc(sizeof(IP_ADAPTER_INFO));
431  ULONG buflen = sizeof(IP_ADAPTER_INFO);
432  DWORD stat = GetAdaptersInfo(ainfo, &buflen);
433  if (stat == ERROR_BUFFER_OVERFLOW) {
434  free(ainfo);
435  ainfo = (PIP_ADAPTER_INFO) malloc(buflen);
436  stat = GetAdaptersInfo(ainfo, &buflen);
437  }
438  if (stat != ERROR_SUCCESS)
439  adr = 1; // illegal address
440  else {
441  // take address of first adapter
442  PIP_ADAPTER_INFO adapter = ainfo;
443  int a, b, c, d;
444  sscanf(adapter->IpAddressList.IpAddress.String, "%d.%d.%d.%d",
445  &a, &b, &c, &d);
446  adr = (a << 24) | (b << 16) | (c << 8) | d;
447  }
448  free(ainfo);
449  }
450 #endif
451  if (adr > 2) {
452  memcpy(fNode, &adr, 4);
453  fNode[4] = 0xbe;
454  fNode[5] = 0xef;
455  return;
456  }
457  }
458  static UChar_t seed[16];
459  if (adr < 2) {
460  GetRandomInfo(seed);
461  seed[0] |= 0x80;
462  if (gSystem) adr = 2; // illegal address
463  }
464  memcpy(fNode, seed, sizeof(fNode));
465  fTimeHiAndVersion |= (3 << 12); // version == 3: random node info
466 }
467 
468 ////////////////////////////////////////////////////////////////////////////////
469 /// Get random info based on some machine parameters.
470 
472 {
473 #ifdef R__WIN32
474  struct randomness {
475  MEMORYSTATUS m;
476  SYSTEM_INFO s;
477  FILETIME t;
478  LARGE_INTEGER pc;
479  DWORD tc;
480  DWORD l;
481  char hostname[MAX_COMPUTERNAME_LENGTH + 1];
482  };
483  randomness r;
484  memset(&r, 0, sizeof(r)); // zero also padding bytes
485 
486  // memory usage stats
487  GlobalMemoryStatus(&r.m);
488  // random system stats
489  GetSystemInfo(&r.s);
490  // 100ns resolution time of day
491  GetSystemTimeAsFileTime(&r.t);
492  // high resolution performance counter
493  QueryPerformanceCounter(&r.pc);
494  // milliseconds since last boot
495  r.tc = GetTickCount();
496  r.l = MAX_COMPUTERNAME_LENGTH + 1;
497  GetComputerName(r.hostname, &r.l);
498 #else
499  struct randomness {
500 #if defined(R__LINUX) && !defined(R__WINGCC)
501  struct sysinfo s;
502 #endif
503  struct timeval t;
504  char hostname[257];
505  };
506  randomness r;
507  memset(&r, 0, sizeof(r)); // zero also padding bytes
508 
509 #if defined(R__LINUX) && !defined(R__WINGCC)
510  sysinfo(&r.s);
511 #endif
512  gettimeofday(&r.t, 0);
513  gethostname(r.hostname, 256);
514 #endif
515  TMD5 md5;
516  md5.Update((UChar_t *)&r, sizeof(randomness));
517  md5.Final(seed);
518 }
519 
520 ////////////////////////////////////////////////////////////////////////////////
521 /// Print UUID.
522 
523 void TUUID::Print() const
524 {
525  printf("%s\n", AsString());
526 }
527 
528 ////////////////////////////////////////////////////////////////////////////////
529 /// Return UUID as string. Copy string immediately since it will be reused.
530 
531 const char *TUUID::AsString() const
532 {
533  static char uuid[40];
534 
535  snprintf(uuid,40, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
537  fClockSeqLow, fNode[0], fNode[1], fNode[2], fNode[3], fNode[4],
538  fNode[5]);
539 
540  return uuid;
541 }
542 
543 ////////////////////////////////////////////////////////////////////////////////
544 /// Compute 16-bit hash value of the UUID.
545 
547 {
548  Short_t c0 = 0, c1 = 0, x, y;
549  char *c = (char *) &fTimeLow;
550 
551  // For speed lets unroll the following loop:
552  // for (i = 0; i < 16; i++) {
553  // c0 += *c++;
554  // c1 += c0;
555  // }
556 
557  c0 += *c++; c1 += c0;
558  c0 += *c++; c1 += c0;
559  c0 += *c++; c1 += c0;
560  c0 += *c++; c1 += c0;
561 
562  c0 += *c++; c1 += c0;
563  c0 += *c++; c1 += c0;
564  c0 += *c++; c1 += c0;
565  c0 += *c++; c1 += c0;
566 
567  c0 += *c++; c1 += c0;
568  c0 += *c++; c1 += c0;
569  c0 += *c++; c1 += c0;
570  c0 += *c++; c1 += c0;
571 
572  c0 += *c++; c1 += c0;
573  c0 += *c++; c1 += c0;
574  c0 += *c++; c1 += c0;
575  c0 += *c++; c1 += c0;
576 
577  // Calculate the value for "First octet" of the hash
578  x = -c1 % 255;
579  if (x < 0)
580  x += 255;
581 
582  // Calculate the value for "second octet" of the hash
583  y = (c1 - c0) % 255;
584  if (y < 0)
585  y += 255;
586 
587  return UShort_t((y << 8) + x);
588 }
589 
590 ////////////////////////////////////////////////////////////////////////////////
591 /// Compare two UUIDs "lexically" and return
592 /// - -1 this is lexically before u
593 /// - 0 this is equal to u
594 /// - 1 this is lexically after u
595 
596 Int_t TUUID::Compare(const TUUID &u) const
597 {
598 #define CHECK(f1, f2) if (f1 != f2) return f1 < f2 ? -1 : 1;
604  for (int i = 0; i < 6; i++) {
605  if (fNode[i] < u.fNode[i])
606  return -1;
607  if (fNode[i] > u.fNode[i])
608  return 1;
609  }
610  return 0;
611 }
612 
613 ////////////////////////////////////////////////////////////////////////////////
614 /// Get address of host encoded in UUID. If host id is not an ethernet
615 /// address, but random info, then the returned TInetAddress is not valid.
616 
618 {
619  if ((fTimeHiAndVersion >> 12) == 1) {
620  UInt_t addr;
621  memcpy(&addr, fNode, 4);
622  return TInetAddress("????", addr, 0);
623  }
624  return TInetAddress();
625 }
626 
627 ////////////////////////////////////////////////////////////////////////////////
628 /// Get time from UUID.
629 
631 {
632  TDatime dt;
633  uuid_time_t ts;
634 
635  ts.low = fTimeLow;
636  ts.high = (UInt_t)fTimeMid;
637  ts.high |= (UInt_t)((fTimeHiAndVersion & 0x0FFF) << 16);
638 
639  // Offset between UUID formatted times and Unix formatted times.
640  // UUID UTC base time is October 15, 1582.
641  // Unix base time is January 1, 1970.
642  ULong64_t high = ts.high;
643  ULong64_t uuid_time = (high << 32) + ts.low;
644  uuid_time -= 0x01B21DD213814000LL;
645  uuid_time /= 10000000LL;
646  UInt_t tt = (UInt_t) uuid_time;
647  dt.Set(tt);
648 
649  return dt;
650 }
651 
652 ////////////////////////////////////////////////////////////////////////////////
653 /// Return uuid in specified buffer (16 byte = 128 bits).
654 
655 void TUUID::GetUUID(UChar_t uuid[16]) const
656 {
657  memcpy(uuid, &fTimeLow, 16);
658 }
659 
660 ////////////////////////////////////////////////////////////////////////////////
661 /// Set this UUID to the value specified in uuid ((which must be in
662 /// TUUID::AsString() format).
663 
664 void TUUID::SetUUID(const char *uuid)
665 {
666  if (!uuid || !*uuid)
667  Error("SetUUID", "null string not allowed");
668  else
669  SetFromString(uuid);
670 }
671 
672 ////////////////////////////////////////////////////////////////////////////////
673 /// Input operator. Delegate to Streamer.
674 
675 TBuffer &operator<<(TBuffer &buf, const TUUID &uuid)
676 {
677  R__ASSERT( buf.IsWriting() );
678 
679  const_cast<TUUID&>(uuid).Streamer(buf);
680  return buf;
681 }
TDatime GetTime() const
Get time from UUID.
Definition: TUUID.cxx:630
virtual ~TUUID()
delete this TUUID
Definition: TUUID.cxx:183
void frombuf(char *&buf, Bool_t *x)
Definition: Bytes.h:282
virtual int GetPid()
Get process id.
Definition: TSystem.cxx:711
long long Long64_t
Definition: RtypesCore.h:69
void Set()
Set Date/Time to current time as reported by the system.
Definition: TDatime.cxx:286
UInt_t low
Definition: TUUID.h:57
void Final()
MD5 finalization, ends an MD5 message-digest operation, writing the the message digest and zeroizing ...
Definition: TMD5.cxx:165
short Version_t
Definition: RtypesCore.h:61
TCanvas * c1
Definition: legend1.C:2
unsigned short UShort_t
Definition: RtypesCore.h:36
typedef ULONG
This class represents an Internet Protocol (IP) address.
Definition: TInetAddress.h:40
void ReadBuffer(char *&buffer)
Stream UUID from input buffer.
Definition: TUUID.cxx:276
UInt_t fTimeLow
index in the list of UUIDs in TProcessUUID
Definition: TUUID.h:48
Buffer base class used for serializing objects.
Definition: TBuffer.h:40
#define R__ASSERT(e)
Definition: TError.h:98
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
TArc * a
Definition: textangle.C:12
R__EXTERN TVirtualMutex * gROOTMutex
Definition: TROOT.h:63
const Bool_t kFALSE
Definition: Rtypes.h:92
UInt_t fUUIDIndex
Definition: TUUID.h:47
TLatex * t1
Definition: textangle.C:20
Int_t CmpTime(uuid_time_t *t1, uuid_time_t *t2)
Compare two time values.
Definition: TUUID.cxx:191
TBuffer & operator<<(TBuffer &buf, const TUUID &uuid)
Input operator. Delegate to Streamer.
Definition: TUUID.cxx:675
This class defines a UUID (Universally Unique IDentifier), also known as GUIDs (Globally Unique IDent...
Definition: TUUID.h:44
Double_t x[n]
Definition: legend1.C:17
Vc_ALWAYS_INLINE void free(T *p)
Frees memory that was allocated with Vc::malloc.
Definition: memory.h:94
Bool_t IsValid() const
Definition: TInetAddress.h:80
TText * tt
Definition: textangle.C:16
This code implements the MD5 message-digest algorithm.
Definition: TMD5.h:46
UShort_t fTimeHiAndVersion
Definition: TUUID.h:50
UChar_t mod R__LOCKGUARD2(gSrvAuthenticateMutex)
void Print() const
Print UUID.
Definition: TUUID.cxx:523
void tobuf(char *&buf, Bool_t x)
Definition: Bytes.h:59
virtual TInetAddress GetHostByName(const char *server)
Get Internet Protocol (IP) address of host.
Definition: TSystem.cxx:2245
void Error(const char *location, const char *msgfmt,...)
UInt_t GetAddress() const
Definition: TInetAddress.h:72
Bool_t IsWriting() const
Definition: TBuffer.h:82
virtual TTime Now()
Get current time in milliseconds since 0:00 Jan 1 1995.
Definition: TSystem.cxx:467
ROOT::R::TRInterface & r
Definition: Object.C:4
void Update(const UChar_t *buf, UInt_t len)
Update TMD5 object to reflect the concatenation of another buffer full of bytes.
Definition: TMD5.cxx:106
R__EXTERN TSystem * gSystem
Definition: TSystem.h:549
UShort_t Hash() const
Compute 16-bit hash value of the UUID.
Definition: TUUID.cxx:546
#define CHECK(f1, f2)
unsigned int UInt_t
Definition: RtypesCore.h:42
TMarker * m
Definition: textangle.C:8
const char * AsString() const
Return UUID as string. Copy string immediately since it will be reused.
Definition: TUUID.cxx:531
short Short_t
Definition: RtypesCore.h:35
TLine * l
Definition: textangle.C:4
void GetUUID(UChar_t uuid[16]) const
Return uuid in specified buffer (16 byte = 128 bits).
Definition: TUUID.cxx:655
UChar_t fNode[6]
Definition: TUUID.h:53
long Long_t
Definition: RtypesCore.h:50
TInetAddress GetHostAddress() const
Get address of host encoded in UUID.
Definition: TUUID.cxx:617
UInt_t high
Definition: TUUID.h:56
void Format(UShort_t clockseq, uuid_time_t ts)
Make a UUID from timestamp, clockseq and node id.
Definition: TUUID.cxx:309
static Int_t init()
virtual const char * HostName()
Return the system's host name.
Definition: TSystem.cxx:307
void StreamerV1(TBuffer &b)
Stream UUID from input buffer.
Definition: TUUID.cxx:294
unsigned long long ULong64_t
Definition: RtypesCore.h:70
ClassImp(TMCParticle) void TMCParticle printf(": p=(%7.3f,%7.3f,%9.3f) ;", fPx, fPy, fPz)
Double_t y[n]
Definition: legend1.C:17
UShort_t fTimeMid
Definition: TUUID.h:49
ClassImp(TUUID) TUUID
Create a UUID.
Definition: TUUID.cxx:130
void SetUUID(const char *uuid_str)
Set this UUID to the value specified in uuid ((which must be in TUUID::AsString() format)...
Definition: TUUID.cxx:664
UChar_t fClockSeqHiAndReserved
Definition: TUUID.h:51
Int_t Compare(const TUUID &u) const
Compare two UUIDs "lexically" and return.
Definition: TUUID.cxx:596
void GetRandomInfo(UChar_t seed[16])
Get random info based on some machine parameters.
Definition: TUUID.cxx:471
void GetNodeIdentifier()
Get node identifier.
Definition: TUUID.cxx:411
void FillBuffer(char *&buffer)
Stream UUID into output buffer.
Definition: TUUID.cxx:260
UChar_t fClockSeqLow
Definition: TUUID.h:52
unsigned char UChar_t
Definition: RtypesCore.h:34
const Bool_t kTRUE
Definition: Rtypes.h:91
void GetSystemTime(uuid_time_t *timestamp)
Get system time with 100ns precision. Time is since Oct 15, 1582.
Definition: TUUID.cxx:378
Vc_ALWAYS_INLINE_L T *Vc_ALWAYS_INLINE_R malloc(size_t n)
Allocates memory on the Heap with alignment and padding suitable for vectorized access.
Definition: memory.h:67
void SetFromString(const char *uuid_str)
Set this UUID to the value specified in uuid ((which must be in TUUID::AsString() format)...
Definition: TUUID.cxx:204
void GetCurrentTime(uuid_time_t *timestamp)
Get current time as 60 bit 100ns ticks since whenever.
Definition: TUUID.cxx:326
This class stores the date and time with a precision of one second in an unsigned 32 bit word (950130...
Definition: TDatime.h:39
static char * Format(const char *format, va_list ap)
Format a string in a circular formatting buffer (using a printf style format descriptor).
Definition: TString.cxx:2398