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