ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 #include <chrono>
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  UInt_t seed;
146  if (gSystem) {
147  // try to get a unique seed per process
148  seed = (UInt_t)(Long64_t(gSystem->Now()) + gSystem->GetPid());
149  } else {
150  using namespace std::chrono;
151  system_clock::time_point today = system_clock::now();
152  seed = (UInt_t)(system_clock::to_time_t ( today )) + ::getpid();
153  }
154 #ifdef R__WIN32
155  srand(seed);
156 #else
157  srandom(seed);
158 #endif
159  GetCurrentTime(time_last_ptr);
160 #ifdef R__WIN32
161  clockseq = 1+(UShort_t)(65536*rand()/(RAND_MAX+1.0));
162 #else
163  clockseq = 1+(UShort_t)(65536*random()/(RAND_MAX+1.0));
164 #endif
165  firstTime = kFALSE;
166  }
167 
168  uuid_time_t timestamp;
169 
170  // get current time
171  GetCurrentTime(&timestamp);
172 
173  // if clock went backward change clockseq
174  if (CmpTime(&timestamp, time_last_ptr) == -1) {
175  clockseq = (clockseq + 1) & 0x3FFF;
176  if (clockseq == 0) clockseq++;
177  }
178 
179  Format(clockseq, timestamp);
180 
181  time_last = timestamp;
182  fUUIDIndex = 1<<30;
183 }
184 
185 ////////////////////////////////////////////////////////////////////////////////
186 /// delete this TUUID
187 
189 {
190  //gROOT->GetUUIDs()->RemoveUUID(fUUIDIndex);
191 }
192 
193 ////////////////////////////////////////////////////////////////////////////////
194 /// Compare two time values.
195 
197 {
198  if (t1->high < t2->high) return -1;
199  if (t1->high > t2->high) return 1;
200  if (t1->low < t2->low) return -1;
201  if (t1->low > t2->low) return 1;
202  return 0;
203 }
204 
205 ////////////////////////////////////////////////////////////////////////////////
206 /// Set this UUID to the value specified in uuid ((which must be in
207 /// TUUID::AsString() format).
208 
209 void TUUID::SetFromString(const char *uuid)
210 {
211  // Format is tttttttt-tttt-cccc-cccc-nnnnnnnnnnnn.
212  Long_t timeLo;
213  int timeMid;
214  int timeHiAndVersion;
215  int clockSeqHiAndRes;
216  int clockSeqLo;
217  int node[6];
218 
219  sscanf(uuid, "%8lx-%4x-%4x-%2x%2x-%2x%2x%2x%2x%2x%2x",
220  &timeLo,
221  &timeMid,
222  &timeHiAndVersion,
223  &clockSeqHiAndRes,
224  &clockSeqLo,
225  &node[0], &node[1], &node[2], &node[3], &node[4], &node[5]);
226 
227  // Note that we're going through this agony because scanf is
228  // defined to know only to scan into "int"s or "long"s.
229  fTimeLow = (UInt_t) timeLo;
230  fTimeMid = (UShort_t) timeMid;
231  fTimeHiAndVersion = (UShort_t) timeHiAndVersion;
232  fClockSeqHiAndReserved = (UChar_t) clockSeqHiAndRes;
233  fClockSeqLow = (UChar_t) clockSeqLo;
234  fNode[0] = (UChar_t) node[0];
235  fNode[1] = (UChar_t) node[1];
236  fNode[2] = (UChar_t) node[2];
237  fNode[3] = (UChar_t) node[3];
238  fNode[4] = (UChar_t) node[4];
239  fNode[5] = (UChar_t) node[5];
240  fUUIDIndex = 1<<30;
241 }
242 
243 ////////////////////////////////////////////////////////////////////////////////
244 /// Initialize a TUUID with uuid (which must be in TUUID::AsString() format).
245 
246 TUUID::TUUID(const char *uuid)
247 {
248  fTimeLow = 0;
249  fTimeMid = 0;
250  fTimeHiAndVersion = 0;
252  fClockSeqLow = 0;
253  fNode[0] = 0;
254  fUUIDIndex = 0;
255 
256  if (!uuid || !*uuid)
257  Error("TUUID", "null string not allowed");
258  else
259  SetFromString(uuid);
260 }
261 
262 ////////////////////////////////////////////////////////////////////////////////
263 /// Stream UUID into output buffer.
264 
266 {
267  Version_t version = TUUID::Class_Version();
268  tobuf(buffer, version);
269  tobuf(buffer, fTimeLow);
270  tobuf(buffer, fTimeMid);
271  tobuf(buffer, fTimeHiAndVersion);
272  tobuf(buffer, fClockSeqHiAndReserved);
273  tobuf(buffer, fClockSeqLow);
274  for (Int_t i = 0; i < 6; i++)
275  tobuf(buffer, fNode[i]);
276 }
277 
278 ////////////////////////////////////////////////////////////////////////////////
279 /// Stream UUID from input buffer.
280 
282 {
283  Version_t version;
284  frombuf(buffer, &version);
285  frombuf(buffer, &fTimeLow);
286  frombuf(buffer, &fTimeMid);
287  frombuf(buffer, &fTimeHiAndVersion);
289  frombuf(buffer, &fClockSeqLow);
290  for (Int_t i = 0; i < 6; i++)
291  frombuf(buffer, &fNode[i]);
292 }
293 
294 ////////////////////////////////////////////////////////////////////////////////
295 /// Stream UUID from input buffer.
296 /// This function is for the exclusive use of TDirectory::Streamer() to
297 /// read a non-versioned version of TUUID.
298 
300 {
301  b >> fTimeLow;
302  b >> fTimeMid;
303  b >> fTimeHiAndVersion;
305  b >> fClockSeqLow;
306  for (UInt_t i = 0; i < 6; i++) {
307  b >> fNode[i];
308  }
309 }
310 
311 ////////////////////////////////////////////////////////////////////////////////
312 /// Make a UUID from timestamp, clockseq and node id.
313 
315 {
316  fTimeLow = ts.low;
317  fTimeMid = (UShort_t)(ts.high & 0xFFFF);
318  fTimeHiAndVersion = (UShort_t)((ts.high >> 16) & 0x0FFF);
319  fTimeHiAndVersion |= (1 << 12);
320  fClockSeqLow = clockseq & 0xFF;
321  fClockSeqHiAndReserved = (clockseq & 0x3F00) >> 8;
322  fClockSeqHiAndReserved |= 0x80;
324 }
325 
326 ////////////////////////////////////////////////////////////////////////////////
327 /// Get current time as 60 bit 100ns ticks since whenever.
328 /// Compensate for the fact that real clock resolution is less
329 /// than 100ns.
330 
332 {
333  const UShort_t uuids_per_tick = 1024;
334 
335  TTHREAD_TLS(uuid_time_t) time_last;
336  TTHREAD_TLS(UShort_t) uuids_this_tick(0);
337  TTHREAD_TLS(Bool_t) init(kFALSE);
338 
339  uuid_time_t *time_last_ptr = TTHREAD_TLS_PTR(time_last);
340 
341  if (!init) {
342  GetSystemTime(time_last_ptr);
343  uuids_this_tick = uuids_per_tick;
344  init = kTRUE;
345  }
346 
347  uuid_time_t time_now;
348 
349  while (1) {
350  GetSystemTime(&time_now);
351 
352  // if clock reading changed since last UUID generated
353  if (CmpTime(time_last_ptr, &time_now)) {
354  // reset count of uuid's generated with this clock reading
355  uuids_this_tick = 0;
356  break;
357  }
358  if (uuids_this_tick < uuids_per_tick) {
359  uuids_this_tick++;
360  break;
361  }
362  // going too fast for our clock; spin
363  }
364 
365  time_last = time_now;
366 
367  if (uuids_this_tick != 0) {
368  if (time_now.low & 0x80000000) {
369  time_now.low += uuids_this_tick;
370  if (!(time_now.low & 0x80000000))
371  time_now.high++;
372  } else
373  time_now.low += uuids_this_tick;
374  }
375 
376  timestamp->high = time_now.high;
377  timestamp->low = time_now.low;
378 }
379 
380 ////////////////////////////////////////////////////////////////////////////////
381 /// Get system time with 100ns precision. Time is since Oct 15, 1582.
382 
384 {
385 #ifdef R__WIN32
386  ULARGE_INTEGER time;
387  GetSystemTimeAsFileTime((FILETIME *)&time);
388  // NT keeps time in FILETIME format which is 100ns ticks since
389  // Jan 1, 1601. UUIDs use time in 100ns ticks since Oct 15, 1582.
390  // The difference is 17 Days in Oct + 30 (Nov) + 31 (Dec)
391  // + 18 years and 5 leap days.
392  time.QuadPart +=
393  (unsigned __int64) (1000*1000*10) // seconds
394  * (unsigned __int64) (60 * 60 * 24) // days
395  * (unsigned __int64) (17+30+31+365*18+5); // # of days
396 
397  timestamp->high = time.HighPart;
398  timestamp->low = time.LowPart;
399 #else
400  struct timeval tp;
401  gettimeofday(&tp, 0);
402  // Offset between UUID formatted times and Unix formatted times.
403  // UUID UTC base time is October 15, 1582.
404  // Unix base time is January 1, 1970.
405  ULong64_t uuid_time = ((ULong64_t)tp.tv_sec * 10000000) + (tp.tv_usec * 10) +
406  0x01B21DD213814000LL;
407  timestamp->high = (UInt_t) (uuid_time >> 32);
408  timestamp->low = (UInt_t) (uuid_time & 0xFFFFFFFF);
409 #endif
410 }
411 
412 ////////////////////////////////////////////////////////////////////////////////
413 /// Get node identifier. Try first to get network address, if no
414 /// network interface try random info based on some machine parameters.
415 
417 {
418  static UInt_t adr = 0;
419 
420  if (gSystem) {
421 #ifndef R__WIN32
422  if (!adr) {
424  if (addr.IsValid())
425  adr = addr.GetAddress();
426  else
427  adr = 1; // illegal address
428  }
429 #else
430  // this way to get the machine's IP address is needed because
431  // GetHostByName() on Win32 contacts the DNS which we don't want
432  // as firewall tools like ZoneAlarm are likely to catch it and
433  // alarm the user
434  if (!adr) {
435  PIP_ADAPTER_INFO ainfo = (PIP_ADAPTER_INFO) malloc(sizeof(IP_ADAPTER_INFO));
436  ULONG buflen = sizeof(IP_ADAPTER_INFO);
437  DWORD stat = GetAdaptersInfo(ainfo, &buflen);
438  if (stat == ERROR_BUFFER_OVERFLOW) {
439  free(ainfo);
440  ainfo = (PIP_ADAPTER_INFO) malloc(buflen);
441  stat = GetAdaptersInfo(ainfo, &buflen);
442  }
443  if (stat != ERROR_SUCCESS)
444  adr = 1; // illegal address
445  else {
446  // take address of first adapter
447  PIP_ADAPTER_INFO adapter = ainfo;
448  int a, b, c, d;
449  sscanf(adapter->IpAddressList.IpAddress.String, "%d.%d.%d.%d",
450  &a, &b, &c, &d);
451  adr = (a << 24) | (b << 16) | (c << 8) | d;
452  }
453  free(ainfo);
454  }
455 #endif
456  if (adr > 2) {
457  memcpy(fNode, &adr, 4);
458  fNode[4] = 0xbe;
459  fNode[5] = 0xef;
460  return;
461  }
462  }
463  static UChar_t seed[16];
464  if (adr < 2) {
465  GetRandomInfo(seed);
466  seed[0] |= 0x80;
467  if (gSystem) adr = 2; // illegal address
468  }
469  memcpy(fNode, seed, sizeof(fNode));
470  fTimeHiAndVersion |= (3 << 12); // version == 3: random node info
471 }
472 
473 ////////////////////////////////////////////////////////////////////////////////
474 /// Get random info based on some machine parameters.
475 
477 {
478 #ifdef R__WIN32
479  struct randomness {
480  MEMORYSTATUS m;
481  SYSTEM_INFO s;
482  FILETIME t;
483  LARGE_INTEGER pc;
484  DWORD tc;
485  DWORD l;
486  char hostname[MAX_COMPUTERNAME_LENGTH + 1];
487  };
488  randomness r;
489  memset(&r, 0, sizeof(r)); // zero also padding bytes
490 
491  // memory usage stats
492  GlobalMemoryStatus(&r.m);
493  // random system stats
494  GetSystemInfo(&r.s);
495  // 100ns resolution time of day
496  GetSystemTimeAsFileTime(&r.t);
497  // high resolution performance counter
498  QueryPerformanceCounter(&r.pc);
499  // milliseconds since last boot
500  r.tc = GetTickCount();
501  r.l = MAX_COMPUTERNAME_LENGTH + 1;
502  GetComputerName(r.hostname, &r.l);
503 #else
504  struct randomness {
505 #if defined(R__LINUX) && !defined(R__WINGCC)
506  struct sysinfo s;
507 #endif
508  struct timeval t;
509  char hostname[257];
510  };
511  randomness r;
512  memset(&r, 0, sizeof(r)); // zero also padding bytes
513 
514 #if defined(R__LINUX) && !defined(R__WINGCC)
515  sysinfo(&r.s);
516 #endif
517  gettimeofday(&r.t, 0);
518  gethostname(r.hostname, 256);
519 #endif
520  TMD5 md5;
521  md5.Update((UChar_t *)&r, sizeof(randomness));
522  md5.Final(seed);
523 }
524 
525 ////////////////////////////////////////////////////////////////////////////////
526 /// Print UUID.
527 
528 void TUUID::Print() const
529 {
530  printf("%s\n", AsString());
531 }
532 
533 ////////////////////////////////////////////////////////////////////////////////
534 /// Return UUID as string. Copy string immediately since it will be reused.
535 
536 const char *TUUID::AsString() const
537 {
538  static char uuid[40];
539 
540  snprintf(uuid,40, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
542  fClockSeqLow, fNode[0], fNode[1], fNode[2], fNode[3], fNode[4],
543  fNode[5]);
544 
545  return uuid;
546 }
547 
548 ////////////////////////////////////////////////////////////////////////////////
549 /// Compute 16-bit hash value of the UUID.
550 
552 {
553  Short_t c0 = 0, c1 = 0, x, y;
554  char *c = (char *) &fTimeLow;
555 
556  // For speed lets unroll the following loop:
557  // for (i = 0; i < 16; i++) {
558  // c0 += *c++;
559  // c1 += c0;
560  // }
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  c0 += *c++; c1 += c0;
578  c0 += *c++; c1 += c0;
579  c0 += *c++; c1 += c0;
580  c0 += *c++; c1 += c0;
581 
582  // Calculate the value for "First octet" of the hash
583  x = -c1 % 255;
584  if (x < 0)
585  x += 255;
586 
587  // Calculate the value for "second octet" of the hash
588  y = (c1 - c0) % 255;
589  if (y < 0)
590  y += 255;
591 
592  return UShort_t((y << 8) + x);
593 }
594 
595 ////////////////////////////////////////////////////////////////////////////////
596 /// Compare two UUIDs "lexically" and return
597 /// - -1 this is lexically before u
598 /// - 0 this is equal to u
599 /// - 1 this is lexically after u
600 
601 Int_t TUUID::Compare(const TUUID &u) const
602 {
603 #define CHECK(f1, f2) if (f1 != f2) return f1 < f2 ? -1 : 1;
609  for (int i = 0; i < 6; i++) {
610  if (fNode[i] < u.fNode[i])
611  return -1;
612  if (fNode[i] > u.fNode[i])
613  return 1;
614  }
615  return 0;
616 }
617 
618 ////////////////////////////////////////////////////////////////////////////////
619 /// Get address of host encoded in UUID. If host id is not an ethernet
620 /// address, but random info, then the returned TInetAddress is not valid.
621 
623 {
624  if ((fTimeHiAndVersion >> 12) == 1) {
625  UInt_t addr;
626  memcpy(&addr, fNode, 4);
627  return TInetAddress("????", addr, 0);
628  }
629  return TInetAddress();
630 }
631 
632 ////////////////////////////////////////////////////////////////////////////////
633 /// Get time from UUID.
634 
636 {
637  TDatime dt;
638  uuid_time_t ts;
639 
640  ts.low = fTimeLow;
641  ts.high = (UInt_t)fTimeMid;
642  ts.high |= (UInt_t)((fTimeHiAndVersion & 0x0FFF) << 16);
643 
644  // Offset between UUID formatted times and Unix formatted times.
645  // UUID UTC base time is October 15, 1582.
646  // Unix base time is January 1, 1970.
647  ULong64_t high = ts.high;
648  ULong64_t uuid_time = (high << 32) + ts.low;
649  uuid_time -= 0x01B21DD213814000LL;
650  uuid_time /= 10000000LL;
651  UInt_t tt = (UInt_t) uuid_time;
652  dt.Set(tt);
653 
654  return dt;
655 }
656 
657 ////////////////////////////////////////////////////////////////////////////////
658 /// Return uuid in specified buffer (16 byte = 128 bits).
659 
660 void TUUID::GetUUID(UChar_t uuid[16]) const
661 {
662  memcpy(uuid, &fTimeLow, 16);
663 }
664 
665 ////////////////////////////////////////////////////////////////////////////////
666 /// Set this UUID to the value specified in uuid ((which must be in
667 /// TUUID::AsString() format).
668 
669 void TUUID::SetUUID(const char *uuid)
670 {
671  if (!uuid || !*uuid)
672  Error("SetUUID", "null string not allowed");
673  else
674  SetFromString(uuid);
675 }
676 
677 ////////////////////////////////////////////////////////////////////////////////
678 /// Input operator. Delegate to Streamer.
679 
680 TBuffer &operator<<(TBuffer &buf, const TUUID &uuid)
681 {
682  R__ASSERT( buf.IsWriting() );
683 
684  const_cast<TUUID&>(uuid).Streamer(buf);
685  return buf;
686 }
TDatime GetTime() const
Get time from UUID.
Definition: TUUID.cxx:635
virtual ~TUUID()
delete this TUUID
Definition: TUUID.cxx:188
void frombuf(char *&buf, Bool_t *x)
Definition: Bytes.h:282
virtual int GetPid()
Get process id.
Definition: TSystem.cxx:711
tuple buffer
Definition: tree.py:99
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
tuple random
Definition: hsimple.py:62
void Final()
MD5 finalization, ends an MD5 message-digest operation, writing the the message digest and zeroizing ...
Definition: TMD5.cxx:166
short Version_t
Definition: RtypesCore.h:61
return c
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:281
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:42
#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:196
TBuffer & operator<<(TBuffer &buf, const TUUID &uuid)
Input operator. Delegate to Streamer.
Definition: TUUID.cxx:680
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
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)
int d
Definition: tornado.py:11
void Print() const
Print UUID.
Definition: TUUID.cxx:528
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:2193
void Error(const char *location, const char *msgfmt,...)
UInt_t GetAddress() const
Definition: TInetAddress.h:72
Bool_t IsWriting() const
Definition: TBuffer.h:84
TThread * t[5]
Definition: threadsh1.C:13
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:107
R__EXTERN TSystem * gSystem
Definition: TSystem.h:545
UShort_t Hash() const
Compute 16-bit hash value of the UUID.
Definition: TUUID.cxx:551
#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:536
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:660
tuple free
Definition: fildir.py:30
UChar_t fNode[6]
Definition: TUUID.h:53
TText * t2
Definition: rootenv.C:28
long Long_t
Definition: RtypesCore.h:50
TInetAddress GetHostAddress() const
Get address of host encoded in UUID.
Definition: TUUID.cxx:622
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:314
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:299
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:669
UChar_t fClockSeqHiAndReserved
Definition: TUUID.h:51
Int_t Compare(const TUUID &u) const
Compare two UUIDs "lexically" and return.
Definition: TUUID.cxx:601
void GetRandomInfo(UChar_t seed[16])
Get random info based on some machine parameters.
Definition: TUUID.cxx:476
void GetNodeIdentifier()
Get node identifier.
Definition: TUUID.cxx:416
void FillBuffer(char *&buffer)
Stream UUID into output buffer.
Definition: TUUID.cxx:265
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:383
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:209
void GetCurrentTime(uuid_time_t *timestamp)
Get current time as 60 bit 100ns ticks since whenever.
Definition: TUUID.cxx:331
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:2385