gdcmMacro.h

Go to the documentation of this file.
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 GDCMMACRO_H
00016 #define GDCMMACRO_H
00017 
00018 #include "gdcmTypes.h"
00019 #include "gdcmTag.h"
00020 #include "gdcmMacroEntry.h"
00021 
00022 #include <map>
00023 
00024 namespace gdcm
00025 {
00026 
00027 class DataSet;
00028 class Usage;
00036 class GDCM_EXPORT Macro
00037 {
00038 public:
00039   typedef std::map<Tag, MacroEntry> MapModuleEntry;
00040   typedef std::vector<std::string> ArrayIncludeMacrosType;
00041 
00042   //typedef MapModuleEntry::const_iterator ConstIterator;
00043   //typedef MapModuleEntry::iterator Iterator;
00044   //ConstIterator Begin() const { return ModuleInternal.begin(); }
00045   //Iterator Begin() { return ModuleInternal.begin(); }
00046   //ConstIterator End() const { return ModuleInternal.end(); }
00047   //Iterator End() { return ModuleInternal.end(); }
00048 
00049   Macro() {}
00050   friend std::ostream& operator<<(std::ostream& _os, const Macro&_val);
00051 
00052   void Clear() { ModuleInternal.clear(); }
00053 
00055   void AddMacroEntry(const Tag& tag, const MacroEntry & module)
00056     {
00057     ModuleInternal.insert(
00058       MapModuleEntry::value_type(tag, module));
00059     }
00060 
00063   bool FindMacroEntry(const Tag &tag) const;
00064   const MacroEntry& GetMacroEntry(const Tag &tag) const;
00065 
00066   void SetName( const char *name) { Name = name; }
00067   const char *GetName() const { return Name.c_str(); }
00068 
00069   // Verify will print on std::cerr for error
00070   // Upon success will return true, false otherwise
00071   bool Verify(const DataSet& ds, Usage const & usage) const;
00072 
00073 private:
00074   //Module &operator=(const Module &_val); // purposely not implemented
00075   //Module(const Module &_val); // purposely not implemented
00076 
00077   MapModuleEntry ModuleInternal;
00078   std::string Name;
00079 };
00080 //-----------------------------------------------------------------------------
00081 inline std::ostream& operator<<(std::ostream& _os, const Macro &_val)
00082 {
00083   _os << _val.Name << '\n';
00084   Macro::MapModuleEntry::const_iterator it = _val.ModuleInternal.begin();
00085   for(;it != _val.ModuleInternal.end(); ++it)
00086     {
00087     const Tag &t = it->first;
00088     const MacroEntry &de = it->second;
00089     _os << t << " " << de << '\n';
00090     }
00091 
00092   return _os;
00093 }
00094 
00095 } // end namespace gdcm
00096 
00097 #endif //GDCMMACRO_H
00098 

Generated on Sat Dec 4 2010 08:58:44 for GDCM by doxygen 1.7.2
SourceForge.net Logo