GDCM
2.2.3
|
00001 /*========================================================================= 00002 00003 Program: GDCM (Grassroots DICOM). A DICOM library 00004 00005 Copyright (c) 2006-2011 Mathieu Malaterre 00006 All rights reserved. 00007 See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details. 00008 00009 This software is distributed WITHOUT ANY WARRANTY; without even 00010 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00011 PURPOSE. See the above copyright notice for more information. 00012 00013 =========================================================================*/ 00014 #ifndef GDCMUIDGENERATOR_H 00015 #define GDCMUIDGENERATOR_H 00016 00017 #include "gdcmTypes.h" 00018 00019 namespace gdcm 00020 { 00021 00029 class GDCM_EXPORT UIDGenerator 00030 { 00031 public: 00033 UIDGenerator():Unique() {} 00034 00035 // Function to override the GDCM root with a user one: 00036 // WARNING: This need to be a valid root, otherwise call will fail 00037 // Implementation note. According to DICOM standard PS 3.5, Section 9 : 00038 // Unique Identifiers (UIDs), we have: 00039 /* 00040 ... 00041 The <org root> portion of the UID uniquely identifies an organization, (i.e., manufacturer, research 00042 organization, NEMA, etc.), and is composed of a number of numeric components as defined by ISO 8824. 00043 The <suffix> portion of the UID is also composed of a number of numeric components, and shall be 00044 unique within the scope of the <org root>. This implies that the organization identified in the <org root> is 00045 responsible for guaranteeing <suffix> uniqueness by providing registration policies. These policies shall 00046 guarantee <suffix> uniqueness for all UID's created by that organization. Unlike the <org root>, which may 00047 be common for UID's in an organization, the <suffix> shall take different unique values between different 00048 UID's that identify different objects. 00049 ... 00050 */ 00056 static void SetRoot(const char * root); 00057 static const char *GetRoot(); 00058 00065 const char* Generate(); 00066 00069 static bool IsValid(const char *uid); 00070 00072 static const char *GetGDCMUID(); // who would want that in the public API ?? 00073 00074 protected: 00075 static bool GenerateUUID(unsigned char *uuid_data); 00076 00077 private: 00078 static const char GDCM_UID[]; 00079 static std::string Root; 00080 static std::string EncodedHardwareAddress; 00081 std::string Unique; // Buffer 00082 }; 00083 00084 00085 } // end namespace gdcm 00086 00087 #endif //GDCMUIDGENERATOR_H