GDCM 2.2.1

- Main Page
- Related Pages
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

gdcmGlobal.h
Go to the documentation of this file.
1 /*=========================================================================
2
3 Program: GDCM (Grassroots DICOM). A DICOM library
4
5 Copyright (c) 2006-2011 Mathieu Malaterre
6 All rights reserved.
7 See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
8
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the above copyright notice for more information.
12
13 =========================================================================*/
14 // Implementation detail was shamelessly borowed from the VTK excellent
15 // implementation of debug leak manager singleton:
16 /*=========================================================================
17
18 Program: Visualization Toolkit
19 Module: $RCSfile: vtkDebugLeaks.cxx,v $
20
21 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
22 All rights reserved.
23 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
24
25 This software is distributed WITHOUT ANY WARRANTY; without even
26 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
27 PURPOSE. See the above copyright notice for more information.
28
29 =========================================================================*/
30 #ifndef GDCMGLOBAL_H
31 #define GDCMGLOBAL_H
32
33 #include "gdcmTypes.h"
34
35 namespace gdcm
36 {
37 class GlobalInternal;
38 class Dicts;
39 class Defs;
49 class GDCM_EXPORT Global // why expose the symbol I think I only need to expose the instance...
50 {
51 friend std::ostream& operator<<(std::ostream &_os, const Global &g);
52 public:
53 Global();
54 ~Global();
55
58 Dicts const &GetDicts() const;
59 Dicts &GetDicts();
60
63 Defs const &GetDefs() const;
64
66 static Global& GetInstance();
67
71 bool LoadResourcesFiles();
72
75 bool Append(const char *path);
76
79 bool Prepend(const char *path);
80
81 protected:
83 const char *Locate(const char *resfile) const;
84
85 private:
86 Global &operator=(const Global &_val); // purposely not implemented
87 Global(const Global &_val); // purposely not implemented
88 // PIMPL:
89 // but we could have also directly exposed a Dicts *Internals;
90 static GlobalInternal *Internals;
91 };
92 //-----------------------------------------------------------------------------
93 inline std::ostream& operator<<(std::ostream &os, const Global &g)
94 {
95 (void)g;
96 return os;
97 }
98
99 // This instance will show up in any translation unit that uses
100 // Global or that has a singleton. It will make sure
101 // Global is initialized before it is used and is the last
102 // static object destroyed.
103 static Global GlobalInstance;
104
105 } // end namespace gdcm
106
107 #endif //GDCMGLOBAL_H