The Gaudi Framework  v33r1 (b1225454)
createGuidAsString.cpp
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 
12 // External include(s):
13 #include <boost/format.hpp>
14 #include <uuid/uuid.h>
15 
16 // Local include(s):
17 #include "createGuidAsString.h"
18 
20  uuid_t uuid;
21  ::uuid_generate_time( uuid );
22  struct Guid {
23  unsigned int Data1;
24  unsigned short Data2;
25  unsigned short Data3;
26  unsigned char Data4[8];
27  }* g = (Guid*)&uuid;
28 
29  boost::format text( "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X" );
30  text % g->Data1 % g->Data2 % g->Data3;
31  for ( int i = 0; i < 8; ++i ) text % (unsigned short)g->Data4[i];
32  return text.str();
33 }
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
Definition: MsgStream.cpp:119
STL class.
std::string createGuidAsString()
Helper function creating file identifier using the UUID mechanism.
dictionary g
Definition: gaudirun.py:542