Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 <ROOT/RCryptoRandom.hxx>
117
118#include "TROOT.h"
119#include "TDatime.h"
120#include "TUUID.h"
121#include "TBuffer.h"
122#include "TError.h"
123#include "TSystem.h"
124#include "TInetAddress.h"
125#include "TMD5.h"
126#include "Bytes.h"
127#include "TVirtualMutex.h"
128#include "ThreadLocalStorage.h"
129#include <cassert>
130#include <cstring>
131#include <cstdlib>
132#ifdef R__WIN32
133#include "Windows4Root.h"
134#include <Iphlpapi.h>
135#include <process.h>
136#define getpid() _getpid()
137#define srandom(seed) srand(seed)
138#define random() rand()
139#else
140#include <unistd.h>
141#include <sys/socket.h>
142#include <sys/time.h>
143#if defined(R__LINUX) && !defined(R__WINGCC)
144#include <sys/sysinfo.h>
145#endif
146#include <ifaddrs.h>
147#include <netinet/in.h>
148#endif
149#include <chrono>
150
151////////////////////////////////////////////////////////////////////////////////
152/// Create a UUID version 4 (variant 1) UUID according to RFC 4122.
153/// The UUIDv4 also has 16 octets but all but the version and variant information is random.
154/// This leaves 122 random bits, which are filled by the system's cryptographic random number generator.
155/// For all intents and purposes, the resulting UUIDs are actually globally unique.
156
158{
159 return TUUID{TV4Marker()};
160}
161
162////////////////////////////////////////////////////////////////////////////////
163/// Create a version 4 UUID.
164
166{
167 // Ensure we can treat the memory starting at uuid.fTimeLow as an array of 16 octets
168 assert(&fNode[5] - reinterpret_cast<unsigned char *>(&fTimeLow) + 1 == 16);
169
171 R__ASSERT(rv);
172 // Fix up variant
174 // Fix up version
175 fTimeHiAndVersion = (fTimeHiAndVersion & 0x0FFF) | (4 << 12);
176
177 // TODO(jblomer): we do what the default constructor does but is this still used? Can it be deprecated?
178 fUUIDIndex = 1 << 30;
179}
180
181////////////////////////////////////////////////////////////////////////////////
182/// Create a UUID.
183
185{
190
191 if (firstTime) {
192 R__LOCKGUARD(gROOTMutex); // rand and random are not thread safe.
193
194 UInt_t seed;
195 if (gSystem) {
196 // try to get a unique seed per process
197 seed = (UInt_t)(Long64_t(gSystem->Now()) + gSystem->GetPid());
198 } else {
199 using namespace std::chrono;
200 system_clock::time_point today = system_clock::now();
201 seed = (UInt_t)(system_clock::to_time_t ( today )) + ::getpid();
202 }
203 srandom(seed);
205 clockseq = 1+(UShort_t)(65536*random()/(RAND_MAX+1.0));
207 }
208
210
211 // get current time
213
214 // if clock went backward change clockseq
215 if (CmpTime(&timestamp, time_last_ptr) == -1) {
216 clockseq = (clockseq + 1) & 0x3FFF;
217 if (clockseq == 0) clockseq++;
218 }
219
221
223 fUUIDIndex = 1<<30;
224}
225
226////////////////////////////////////////////////////////////////////////////////
227/// delete this TUUID
228
230{
231 //gROOT->GetUUIDs()->RemoveUUID(fUUIDIndex);
232}
233
234////////////////////////////////////////////////////////////////////////////////
235/// Compare two time values.
236
238{
239 if (t1->high < t2->high) return -1;
240 if (t1->high > t2->high) return 1;
241 if (t1->low < t2->low) return -1;
242 if (t1->low > t2->low) return 1;
243 return 0;
244}
245
246////////////////////////////////////////////////////////////////////////////////
247/// Set this UUID to the value specified in uuid ((which must be in
248/// TUUID::AsString() format).
249
250void TUUID::SetFromString(const char *uuid)
251{
252 // Format is tttttttt-tttt-cccc-cccc-nnnnnnnnnnnn.
254 int timeMid;
257 int clockSeqLo;
258 int node[6];
259
260 sscanf(uuid, "%8lx-%4x-%4x-%2x%2x-%2x%2x%2x%2x%2x%2x",
261 &timeLo,
262 &timeMid,
265 &clockSeqLo,
266 &node[0], &node[1], &node[2], &node[3], &node[4], &node[5]);
267
268 // Note that we're going through this agony because scanf is
269 // defined to know only to scan into "int"s or "long"s.
275 fNode[0] = (UChar_t) node[0];
276 fNode[1] = (UChar_t) node[1];
277 fNode[2] = (UChar_t) node[2];
278 fNode[3] = (UChar_t) node[3];
279 fNode[4] = (UChar_t) node[4];
280 fNode[5] = (UChar_t) node[5];
281 fUUIDIndex = 1<<30;
282}
283
284////////////////////////////////////////////////////////////////////////////////
285/// Initialize a TUUID with uuid (which must be in TUUID::AsString() format).
286
287TUUID::TUUID(const char *uuid)
288{
289 fTimeLow = 0;
290 fTimeMid = 0;
293 fClockSeqLow = 0;
294 fNode[0] = 0;
295 fUUIDIndex = 0;
296
297 if (!uuid || !*uuid)
298 Error("TUUID", "null string not allowed");
299 else
300 SetFromString(uuid);
301}
302
303////////////////////////////////////////////////////////////////////////////////
304/// Stream UUID into output buffer.
305
306void TUUID::FillBuffer(char *&buffer)
307{
309 tobuf(buffer, version);
310 tobuf(buffer, fTimeLow);
311 tobuf(buffer, fTimeMid);
312 tobuf(buffer, fTimeHiAndVersion);
314 tobuf(buffer, fClockSeqLow);
315 for (Int_t i = 0; i < 6; i++)
316 tobuf(buffer, fNode[i]);
317}
318
319////////////////////////////////////////////////////////////////////////////////
320/// Stream UUID from input buffer.
321
322void TUUID::ReadBuffer(char *&buffer)
323{
325 frombuf(buffer, &version);
326 frombuf(buffer, &fTimeLow);
327 frombuf(buffer, &fTimeMid);
328 frombuf(buffer, &fTimeHiAndVersion);
330 frombuf(buffer, &fClockSeqLow);
331 for (Int_t i = 0; i < 6; i++)
332 frombuf(buffer, &fNode[i]);
333}
334
335////////////////////////////////////////////////////////////////////////////////
336/// Stream UUID from input buffer.
337/// This function is for the exclusive use of TDirectory::Streamer() to
338/// read a non-versioned version of TUUID.
339
341{
342 b >> fTimeLow;
343 b >> fTimeMid;
346 b >> fClockSeqLow;
347 for (UInt_t i = 0; i < 6; i++) {
348 b >> fNode[i];
349 }
350}
351
352////////////////////////////////////////////////////////////////////////////////
353/// Make a UUID from timestamp, clockseq and node id.
354
356{
357 fTimeLow = ts.low;
358 fTimeMid = (UShort_t)(ts.high & 0xFFFF);
359 fTimeHiAndVersion = (UShort_t)((ts.high >> 16) & 0x0FFF);
360 fTimeHiAndVersion |= (1 << 12);
361 fClockSeqLow = clockseq & 0xFF;
362 fClockSeqHiAndReserved = (clockseq & 0x3F00) >> 8;
365}
366
367////////////////////////////////////////////////////////////////////////////////
368/// Get current time as 60 bit 100ns ticks since whenever.
369/// Compensate for the fact that real clock resolution is less
370/// than 100ns.
371
373{
374 const UShort_t uuids_per_tick = 1024;
375
379
381
382 if (!init) {
385 init = kTRUE;
386 }
387
389
390 while (1) {
392
393 // if clock reading changed since last UUID generated
395 // reset count of uuid's generated with this clock reading
396 uuids_this_tick = 0;
397 break;
398 }
401 break;
402 }
403 // going too fast for our clock; spin
404 }
405
407
408 if (uuids_this_tick != 0) {
409 if (time_now.low & 0x80000000) {
411 if (!(time_now.low & 0x80000000))
412 time_now.high++;
413 } else
415 }
416
417 timestamp->high = time_now.high;
418 timestamp->low = time_now.low;
419}
420
421////////////////////////////////////////////////////////////////////////////////
422/// Get system time with 100ns precision. Time is since Oct 15, 1582.
423
425{
426#ifdef R__WIN32
427 ULARGE_INTEGER time;
429 // NT keeps time in FILETIME format which is 100ns ticks since
430 // Jan 1, 1601. UUIDs use time in 100ns ticks since Oct 15, 1582.
431 // The difference is 17 Days in Oct + 30 (Nov) + 31 (Dec)
432 // + 18 years and 5 leap days.
433 time.QuadPart +=
434 (unsigned __int64) (1000*1000*10) // seconds
435 * (unsigned __int64) (60 * 60 * 24) // days
436 * (unsigned __int64) (17+30+31+365*18+5); // # of days
437
438 timestamp->high = time.HighPart;
439 timestamp->low = time.LowPart;
440#else
441 struct timeval tp;
442 gettimeofday(&tp, nullptr);
443 // Offset between UUID formatted times and Unix formatted times.
444 // UUID UTC base time is October 15, 1582.
445 // Unix base time is January 1, 1970.
446 ULong64_t uuid_time = ((ULong64_t)tp.tv_sec * 10000000) + (tp.tv_usec * 10) +
447 0x01B21DD213814000LL;
448 timestamp->high = (UInt_t) (uuid_time >> 32);
449 timestamp->low = (UInt_t) (uuid_time & 0xFFFFFFFF);
450#endif
451}
452
453////////////////////////////////////////////////////////////////////////////////
454/// Get node identifier. Try first to get network address, if no
455/// network interface try random info based on some machine parameters.
456
458{
459 static UInt_t adr = 0;
460
461 if (gSystem) {
462#ifndef R__WIN32
463 if (!adr) {
464 UInt_t addr = 0;
465
466 struct ifaddrs *ifAddrStruct = nullptr;
467 struct ifaddrs *ifa = nullptr;
468
469 if (getifaddrs(&ifAddrStruct) != 0) {
470 adr = 1;
471 } else {
472 for (ifa = ifAddrStruct; ifa != nullptr; ifa = ifa->ifa_next) {
473 if (!ifa->ifa_addr) {
474 continue;
475 }
476 if (ifa->ifa_addr->sa_family != AF_INET) { // check only IP4
477 continue;
478 }
479 if (strncmp(ifa->ifa_name,"lo",2) == 0) { // skip loop back.
480 continue;
481 }
482 addr = ntohl(((struct sockaddr_in *)ifa->ifa_addr)->sin_addr.s_addr);
483 break;
484 }
485 }
486
487 if (ifAddrStruct != nullptr)
489
490 if (addr)
491 adr = addr;
492 else
493 adr = 1; // illegal address
494 }
495#else
496 // this way to get the machine's IP address is needed because
497 // GetHostByName() on Win32 contacts the DNS which we don't want
498 // as firewall tools like ZoneAlarm are likely to catch it and
499 // alarm the user
500 if (!adr) {
502 ULONG buflen = sizeof(IP_ADAPTER_INFO);
503 DWORD stat = GetAdaptersInfo(ainfo, &buflen);
504 if (stat == ERROR_BUFFER_OVERFLOW) {
505 free(ainfo);
506 ainfo = (PIP_ADAPTER_INFO) malloc(buflen);
507 stat = GetAdaptersInfo(ainfo, &buflen);
508 }
509 if (stat != ERROR_SUCCESS)
510 adr = 1; // illegal address
511 else {
512 // take address of first adapter
514 int a, b, c, d;
515 sscanf(adapter->IpAddressList.IpAddress.String, "%d.%d.%d.%d",
516 &a, &b, &c, &d);
517 adr = (a << 24) | (b << 16) | (c << 8) | d;
518 }
519 free(ainfo);
520 }
521#endif
522 if (adr > 2) {
523 memcpy(fNode, &adr, 4);
524 fNode[4] = 0xbe;
525 fNode[5] = 0xef;
526 return;
527 }
528 }
529 static UChar_t seed[16];
530 if (adr < 2) {
531 GetRandomInfo(seed);
532 seed[0] |= 0x80;
533 if (gSystem) adr = 2; // illegal address
534 }
535 memcpy(fNode, seed, sizeof(fNode));
536 fTimeHiAndVersion |= (3 << 12); // version == 3: random node info
537}
538
539////////////////////////////////////////////////////////////////////////////////
540/// Get random info based on some machine parameters.
541
543{
544#ifdef R__WIN32
545 struct randomness {
547 SYSTEM_INFO s;
548 FILETIME t;
549 LARGE_INTEGER pc;
550 DWORD tc;
551 DWORD l;
553 };
555 memset(&r, 0, sizeof(r)); // zero also padding bytes
556
557 // memory usage stats
559 // random system stats
560 GetSystemInfo(&r.s);
561 // 100ns resolution time of day
563 // high resolution performance counter
565 // milliseconds since last boot
566 r.tc = GetTickCount();
568 GetComputerName(r.hostname, &r.l);
569#else
570 struct randomness {
571#if defined(R__LINUX) && !defined(R__WINGCC)
572 struct sysinfo s;
573#endif
574 struct timeval t;
575 char hostname[257];
576 };
578 memset(&r, 0, sizeof(r)); // zero also padding bytes
579
580#if defined(R__LINUX) && !defined(R__WINGCC)
581 sysinfo(&r.s);
582#endif
583 gettimeofday(&r.t, nullptr);
584 gethostname(r.hostname, 256);
585#endif
586 TMD5 md5;
587 md5.Update((UChar_t *)&r, sizeof(randomness));
588 md5.Final(seed);
589}
590
591////////////////////////////////////////////////////////////////////////////////
592/// Print UUID.
593
594void TUUID::Print() const
595{
596 printf("%s\n", AsString());
597}
598
599////////////////////////////////////////////////////////////////////////////////
600/// Return UUID as string. Copy string immediately since it will be reused.
601
602const char *TUUID::AsString() const
603{
604 TTHREAD_TLS(char) uuid[40];
605
606 snprintf(uuid,40, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
608 fClockSeqLow, fNode[0], fNode[1], fNode[2], fNode[3], fNode[4],
609 fNode[5]);
610
611 return uuid;
612}
613
614////////////////////////////////////////////////////////////////////////////////
615/// Compute 16-bit hash value of the UUID.
616
618{
619 Short_t c0 = 0, c1 = 0, x, y;
620 char *c = (char *) &fTimeLow;
621
622 // For speed lets unroll the following loop:
623 // for (i = 0; i < 16; i++) {
624 // c0 += *c++;
625 // c1 += c0;
626 // }
627
628 c0 += *c++; c1 += c0;
629 c0 += *c++; c1 += c0;
630 c0 += *c++; c1 += c0;
631 c0 += *c++; c1 += c0;
632
633 c0 += *c++; c1 += c0;
634 c0 += *c++; c1 += c0;
635 c0 += *c++; c1 += c0;
636 c0 += *c++; c1 += c0;
637
638 c0 += *c++; c1 += c0;
639 c0 += *c++; c1 += c0;
640 c0 += *c++; c1 += c0;
641 c0 += *c++; c1 += c0;
642
643 c0 += *c++; c1 += c0;
644 c0 += *c++; c1 += c0;
645 c0 += *c++; c1 += c0;
646 c0 += *c++; c1 += c0;
647
648 // Calculate the value for "First octet" of the hash
649 x = -c1 % 255;
650 if (x < 0)
651 x += 255;
652
653 // Calculate the value for "second octet" of the hash
654 y = (c1 - c0) % 255;
655 if (y < 0)
656 y += 255;
657
658 return UShort_t((y << 8) + x);
659}
660
661////////////////////////////////////////////////////////////////////////////////
662/// Compare two UUIDs "lexically" and return
663/// - -1 this is lexically before u
664/// - 0 this is equal to u
665/// - 1 this is lexically after u
666
668{
669#define CHECK(f1, f2) if (f1 != f2) return f1 < f2 ? -1 : 1;
670 CHECK(fTimeLow, u.fTimeLow)
671 CHECK(fTimeMid, u.fTimeMid)
672 CHECK(fTimeHiAndVersion, u.fTimeHiAndVersion)
673 CHECK(fClockSeqHiAndReserved, u.fClockSeqHiAndReserved)
674 CHECK(fClockSeqLow, u.fClockSeqLow)
675 for (int i = 0; i < 6; i++) {
676 if (fNode[i] < u.fNode[i])
677 return -1;
678 if (fNode[i] > u.fNode[i])
679 return 1;
680 }
681 return 0;
682}
683
684////////////////////////////////////////////////////////////////////////////////
685/// Get address of host encoded in UUID. If host id is not an ethernet
686/// address, but random info, then the returned TInetAddress is not valid.
687
689{
690 if ((fTimeHiAndVersion >> 12) == 1) {
691 UInt_t addr;
692 memcpy(&addr, fNode, 4);
693 return TInetAddress("????", addr, 0);
694 }
695 return TInetAddress();
696}
697
698////////////////////////////////////////////////////////////////////////////////
699/// Get time from UUID.
700
702{
703 TDatime dt;
705
706 ts.low = fTimeLow;
707 ts.high = (UInt_t)fTimeMid;
708 ts.high |= (UInt_t)((fTimeHiAndVersion & 0x0FFF) << 16);
709
710 // Offset between UUID formatted times and Unix formatted times.
711 // UUID UTC base time is October 15, 1582.
712 // Unix base time is January 1, 1970.
713 ULong64_t high = ts.high;
714 ULong64_t uuid_time = (high << 32) + ts.low;
715 uuid_time -= 0x01B21DD213814000LL;
716 uuid_time /= 10000000LL;
718 dt.Set(tt);
719
720 return dt;
721}
722
723////////////////////////////////////////////////////////////////////////////////
724/// Return uuid in specified buffer (16 byte = 128 bits).
725
726void TUUID::GetUUID(UChar_t uuid[16]) const
727{
728 memcpy(uuid, &fTimeLow, 16);
729}
730
731////////////////////////////////////////////////////////////////////////////////
732/// Set this UUID to the value specified in uuid ((which must be in
733/// TUUID::AsString() format).
734
735void TUUID::SetUUID(const char *uuid)
736{
737 if (!uuid || !*uuid)
738 Error("SetUUID", "null string not allowed");
739 else
740 SetFromString(uuid);
741}
742
743////////////////////////////////////////////////////////////////////////////////
744/// Input operator. Delegate to Streamer.
745
746TBuffer &operator<<(TBuffer &buf, const TUUID &uuid)
747{
748 R__ASSERT( buf.IsWriting() );
749
750 const_cast<TUUID&>(uuid).Streamer(buf);
751 return buf;
752}
void frombuf(char *&buf, Bool_t *x)
Definition Bytes.h:278
void tobuf(char *&buf, Bool_t x)
Definition Bytes.h:55
#define d(i)
Definition RSha256.hxx:102
#define b(i)
Definition RSha256.hxx:100
#define c(i)
Definition RSha256.hxx:101
#define a(i)
Definition RSha256.hxx:99
unsigned short UShort_t
Unsigned Short integer 2 bytes (unsigned short)
Definition RtypesCore.h:54
short Version_t
Class version identifier (short)
Definition RtypesCore.h:79
unsigned char UChar_t
Unsigned Character 1 byte (unsigned char)
Definition RtypesCore.h:52
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
Definition RtypesCore.h:68
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int)
Definition RtypesCore.h:60
short Short_t
Signed Short integer 2 bytes (short)
Definition RtypesCore.h:53
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
long long Long64_t
Portable signed long integer 8 bytes.
Definition RtypesCore.h:83
unsigned long long ULong64_t
Portable unsigned long integer 8 bytes.
Definition RtypesCore.h:84
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
Definition TError.h:125
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:208
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
R__EXTERN TVirtualMutex * gROOTMutex
Definition TROOT.h:63
void Streamer(TBuffer &) override
R__EXTERN TSystem * gSystem
Definition TSystem.h:572
#define CHECK(f1, f2)
TBuffer & operator<<(TBuffer &buf, const TUUID &uuid)
Input operator. Delegate to Streamer.
Definition TUUID.cxx:746
#define R__LOCKGUARD(mutex)
#define free
Definition civetweb.c:1578
#define snprintf
Definition civetweb.c:1579
#define malloc
Definition civetweb.c:1575
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
This class represents an Internet Protocol (IP) address.
This code implements the MD5 message-digest algorithm.
Definition TMD5.h:44
virtual int GetPid()
Get process id.
Definition TSystem.cxx:720
virtual TTime Now()
Get current time in milliseconds since 0:00 Jan 1 1995.
Definition TSystem.cxx:465
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:372
static constexpr Version_t Class_Version()
Definition TUUID.h:92
Int_t CmpTime(uuid_time_t *t1, uuid_time_t *t2)
Compare two time values.
Definition TUUID.cxx:237
void GetSystemTime(uuid_time_t *timestamp)
Get system time with 100ns precision. Time is since Oct 15, 1582.
Definition TUUID.cxx:424
virtual ~TUUID()
delete this TUUID
Definition TUUID.cxx:229
void ReadBuffer(char *&buffer)
Stream UUID from input buffer.
Definition TUUID.cxx:322
static TUUID UUIDv4()
Create a UUID version 4 (variant 1) UUID according to RFC 4122.
Definition TUUID.cxx:157
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:250
void Format(UShort_t clockseq, uuid_time_t ts)
Make a UUID from timestamp, clockseq and node id.
Definition TUUID.cxx:355
TDatime GetTime() const
Get time from UUID.
Definition TUUID.cxx:701
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:602
void GetUUID(UChar_t uuid[16]) const
Return uuid in specified buffer (16 byte = 128 bits).
Definition TUUID.cxx:726
TInetAddress GetHostAddress() const
Get address of host encoded in UUID.
Definition TUUID.cxx:688
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:735
UShort_t Hash() const
Compute 16-bit hash value of the UUID.
Definition TUUID.cxx:617
UShort_t fTimeHiAndVersion
Definition TUUID.h:48
TUUID()
Create a UUID.
Definition TUUID.cxx:184
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:542
void Print() const
Print UUID.
Definition TUUID.cxx:594
Int_t Compare(const TUUID &u) const
Compare two UUIDs "lexically" and return.
Definition TUUID.cxx:667
void FillBuffer(char *&buffer)
Stream UUID into output buffer.
Definition TUUID.cxx:306
void GetNodeIdentifier()
Get node identifier.
Definition TUUID.cxx:457
void StreamerV1(TBuffer &b)
Stream UUID from input buffer.
Definition TUUID.cxx:340
Double_t y[n]
Definition legend1.C:17
return c1
Definition legend1.C:41
Double_t x[n]
Definition legend1.C:17
bool GetCryptoRandom(void *buf, unsigned int len)
Get random bytes from the operating system's cryptographic random number generator The requested numb...
TMarker m
Definition textangle.C:8
TLine l
Definition textangle.C:4
auto * tt
Definition textangle.C:16
auto * t1
Definition textangle.C:20