gdcmModules.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef __gdcmModules_h
00016 #define __gdcmModules_h
00017
00018 #include "gdcmTypes.h"
00019 #include "gdcmModule.h"
00020
00021 #include <map>
00022
00023 namespace gdcm
00024 {
00030 class GDCM_EXPORT Modules
00031 {
00032 public:
00033 typedef std::map<std::string, Module> ModuleMapType;
00034
00035 Modules() {}
00036 friend std::ostream& operator<<(std::ostream& _os, const Modules &_val);
00037
00038 void Clear() { ModulesInternal.clear(); }
00039
00040
00041 void AddModule(const char *ref, const Module & module )
00042 {
00043 ModulesInternal.insert(
00044 ModuleMapType::value_type(ref, module));
00045 }
00046 const Module &GetModule(const char *name) const
00047 {
00048 ModuleMapType::const_iterator it = ModulesInternal.find( name );
00049 assert( it != ModulesInternal.end() );
00050 assert( it->first == name );
00051 return it->second;
00052 }
00053
00054 bool IsEmpty() const { return ModulesInternal.empty(); }
00055
00056 private:
00057 ModuleMapType ModulesInternal;
00058 };
00059
00060 inline std::ostream& operator<<(std::ostream& _os, const Modules &_val)
00061 {
00062 Modules::ModuleMapType::const_iterator it = _val.ModulesInternal.begin();
00063 for(;it != _val.ModulesInternal.end(); ++it)
00064 {
00065 const std::string &name = it->first;
00066 const Module &m = it->second;
00067 _os << name << " " << m << '\n';
00068 }
00069
00070 return _os;
00071 }
00072
00073 typedef Modules Macros;
00074
00075
00076 }
00077
00078 #endif //__gdcmModules_h
00079