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