GDCM 3.2.1

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 Global &operator=(const Global &_val) = delete;
56 Global(const Global &_val) = delete;
57
60 Dicts const &GetDicts() const;
61 Dicts &GetDicts();
62
65 Defs const &GetDefs() const;
66
68 static Global& GetInstance();
69
73 bool LoadResourcesFiles();
74
77 bool Append(const char *path);
78
81 bool Prepend(const char *path);
82
83 protected:
85 const char *Locate(const char *resfile) const;
86
87 private:
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
gdcm::Defs
FIXME I do not like the name 'Defs'.
Definition gdcmDefs.h:33
gdcm::Dicts
Class to manipulate the sum of knowledge (all the dict user load)
Definition gdcmDicts.h:29
gdcm::Global
Global.
Definition gdcmGlobal.h:50
gdcm::Global::GetDefs
Defs const & GetDefs() const
gdcm::Global::Prepend
bool Prepend(const char *path)
gdcm::Global::Append
bool Append(const char *path)
gdcm::Global::Global
Global(const Global &_val)=delete
gdcm::Global::GetDicts
Dicts const & GetDicts() const
gdcm::Global::GetDicts
Dicts & GetDicts()
gdcm::Global::Global
Global()
gdcm::Global::LoadResourcesFiles
bool LoadResourcesFiles()
gdcm::Global::Locate
const char * Locate(const char *resfile) const
Locate a resource file.
gdcm::Global::~Global
~Global()
gdcm::Global::operator=
Global & operator=(const Global &_val)=delete
gdcm::Global::GetInstance
static Global & GetInstance()
return the singleton instance
gdcm::Global::operator<<
friend std::ostream & operator<<(std::ostream &_os, const Global &g)
Definition gdcmGlobal.h:93
gdcmTypes.h
GDCM_EXPORT
#define GDCM_EXPORT
Definition gdcmWin32.h:34
gdcm
Definition gdcmASN1.h:21
gdcm::operator<<
std::ostream & operator<<(std::ostream &os, const Directory &d)
Definition gdcmDirectory.h:88
gdcm::GlobalInstance
static Global GlobalInstance
Definition gdcmGlobal.h:103