GDCM 3.0.24
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
35namespace gdcm
36{
37class GlobalInternal;
38class Dicts;
39class Defs;
49class 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);
52public:
55 Global &operator=(const Global &_val) = delete;
56 Global(const Global &_val) = delete;
57
60 Dicts const &GetDicts() const;
62
65 Defs const &GetDefs() const;
66
69
74
77 bool Append(const char *path);
78
81 bool Prepend(const char *path);
82
83protected:
85 const char *Locate(const char *resfile) const;
86
87private:
88 // PIMPL:
89 // but we could have also directly exposed a Dicts *Internals;
90 static GlobalInternal *Internals;
91};
92//-----------------------------------------------------------------------------
93inline 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.
104
105} // end namespace gdcm
106
107#endif //GDCMGLOBAL_H
FIXME I do not like the name 'Defs'.
Definition gdcmDefs.h:33
Class to manipulate the sum of knowledge (all the dict user load)
Definition gdcmDicts.h:29
Global.
Definition gdcmGlobal.h:50
Defs const & GetDefs() const
bool Prepend(const char *path)
bool Append(const char *path)
Global(const Global &_val)=delete
Dicts const & GetDicts() const
Dicts & GetDicts()
bool LoadResourcesFiles()
const char * Locate(const char *resfile) const
Locate a resource file.
Global & operator=(const Global &_val)=delete
static Global & GetInstance()
return the singleton instance
#define GDCM_EXPORT
Definition gdcmWin32.h:34
Definition gdcmASN1.h:21
std::ostream & operator<<(std::ostream &os, const Directory &d)
Definition gdcmDirectory.h:88
static Global GlobalInstance
Definition gdcmGlobal.h:103