gdcmModule.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
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;
00036 class GDCM_EXPORT Module
00037 {
00038 public:
00039 typedef std::map<Tag, ModuleEntry> MapModuleEntry;
00040 typedef MapModuleEntry::const_iterator ConstIterator;
00041 typedef MapModuleEntry::iterator Iterator;
00042 ConstIterator Begin() const { return ModuleInternal.begin(); }
00043 Iterator Begin() { return ModuleInternal.begin(); }
00044 ConstIterator End() const { return ModuleInternal.end(); }
00045 Iterator End() { return ModuleInternal.end(); }
00046
00047 Module() {}
00048 friend std::ostream& operator<<(std::ostream& _os, const Module &_val);
00049
00050 void Clear() { ModuleInternal.clear(); }
00051
00052 void AddModuleEntry(const Tag& tag, const ModuleEntry & module )
00053 {
00054 ModuleInternal.insert(
00055 MapModuleEntry::value_type(tag, module));
00056 }
00057 bool FindModuleEntry(const Tag &tag) const
00058 {
00059 MapModuleEntry::const_iterator it = ModuleInternal.find(tag);
00060 return it != ModuleInternal.end();
00061 }
00062 const ModuleEntry& GetModuleEntry(const Tag &tag) const
00063 {
00064 MapModuleEntry::const_iterator it = ModuleInternal.find(tag);
00065 assert( it->first == tag );
00066 return it->second;
00067 }
00068 void SetName( const char *name) { Name = name; }
00069 const char *GetName() const { return Name.c_str(); }
00070
00071
00072
00073 bool Verify(const DataSet& ds, Usage const & usage) const;
00074
00075 private:
00076
00077
00078
00079 MapModuleEntry ModuleInternal;
00080 std::string Name;
00081 };
00082
00083 inline std::ostream& operator<<(std::ostream& _os, const Module &_val)
00084 {
00085 Module::MapModuleEntry::const_iterator it = _val.ModuleInternal.begin();
00086 for(;it != _val.ModuleInternal.end(); ++it)
00087 {
00088 const Tag &t = it->first;
00089 const ModuleEntry &de = it->second;
00090 _os << t << " " << de << '\n';
00091 }
00092
00093 return _os;
00094 }
00095
00096 typedef Module Macro;
00097
00098
00099 }
00100
00101 #endif //__gdcmModule_h
00102