GDCM 2.0.17
|
00001 /*========================================================================= 00002 00003 Program: GDCM (Grassroots DICOM). A DICOM library 00004 Module: $URL$ 00005 00006 Copyright (c) 2006-2010 Mathieu Malaterre 00007 All rights reserved. 00008 See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00015 #ifndef GDCMMODULE_H 00016 #define GDCMMODULE_H 00017 00018 #include "gdcmTypes.h" 00019 #include "gdcmTag.h" 00020 #include "gdcmModuleEntry.h" 00021 00022 #include <map> 00023 00024 namespace gdcm 00025 { 00026 00027 class DataSet; 00028 class Usage; 00029 class Macros; 00037 class GDCM_EXPORT Module 00038 { 00039 public: 00040 typedef std::map<Tag, ModuleEntry> MapModuleEntry; 00041 typedef std::vector<std::string> ArrayIncludeMacrosType; 00042 00043 //typedef MapModuleEntry::const_iterator ConstIterator; 00044 //typedef MapModuleEntry::iterator Iterator; 00045 //ConstIterator Begin() const { return ModuleInternal.begin(); } 00046 //Iterator Begin() { return ModuleInternal.begin(); } 00047 //ConstIterator End() const { return ModuleInternal.end(); } 00048 //Iterator End() { return ModuleInternal.end(); } 00049 00050 Module() {} 00051 friend std::ostream& operator<<(std::ostream& _os, const Module &_val); 00052 00053 void Clear() { ModuleInternal.clear(); } 00054 00056 void AddModuleEntry(const Tag& tag, const ModuleEntry & module) 00057 { 00058 ModuleInternal.insert( 00059 MapModuleEntry::value_type(tag, module)); 00060 } 00061 00062 void AddMacro(const char *include) 00063 { 00064 ArrayIncludeMacros.push_back( include ); 00065 } 00066 00069 bool FindModuleEntryInMacros(Macros const ¯os, const Tag &tag) const; 00070 const ModuleEntry& GetModuleEntryInMacros(Macros const ¯os, const Tag &tag) const; 00071 00072 void SetName( const char *name) { Name = name; } 00073 const char *GetName() const { return Name.c_str(); } 00074 00075 // Verify will print on std::cerr for error 00076 // Upon success will return true, false otherwise 00077 bool Verify(const DataSet& ds, Usage const & usage) const; 00078 00079 private: 00080 //Module &operator=(const Module &_val); // purposely not implemented 00081 //Module(const Module &_val); // purposely not implemented 00082 00083 MapModuleEntry ModuleInternal; 00084 std::string Name; 00085 ArrayIncludeMacrosType ArrayIncludeMacros; 00086 }; 00087 //----------------------------------------------------------------------------- 00088 inline std::ostream& operator<<(std::ostream& _os, const Module &_val) 00089 { 00090 _os << _val.Name << '\n'; 00091 Module::MapModuleEntry::const_iterator it = _val.ModuleInternal.begin(); 00092 for(;it != _val.ModuleInternal.end(); ++it) 00093 { 00094 const Tag &t = it->first; 00095 const ModuleEntry &de = it->second; 00096 _os << t << " " << de << '\n'; 00097 } 00098 00099 return _os; 00100 } 00101 00102 } // end namespace gdcm 00103 00104 #endif //GDCMMODULE_H