GDCM  2.0.18
gdcmCSAHeaderDictEntry.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program: GDCM (Grassroots DICOM). A DICOM library
00004 
00005   Copyright (c) 2006-2011 Mathieu Malaterre
00006   All rights reserved.
00007   See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
00008 
00009      This software is distributed WITHOUT ANY WARRANTY; without even
00010      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00011      PURPOSE.  See the above copyright notice for more information.
00012 
00013 =========================================================================*/
00014 #ifndef GDCMCSAHEADERDICTENTRY_H
00015 #define GDCMCSAHEADERDICTENTRY_H
00016 
00017 #include "gdcmVR.h"
00018 #include "gdcmVM.h"
00019 
00020 #include <string>
00021 #include <iostream>
00022 #include <iomanip>
00023 
00024 #include <cstring>
00025 
00026 namespace gdcm
00027 {
00038 class GDCM_EXPORT CSAHeaderDictEntry
00039 {
00040 public:
00041   CSAHeaderDictEntry(const char *name = "", VR const &vr = VR::INVALID, VM const &vm = VM::VM0, const char *desc = ""):Name(name),ValueRepresentation(vr),ValueMultiplicity(vm),Description(desc) {
00042   }
00043 
00044   friend std::ostream& operator<<(std::ostream& _os, const CSAHeaderDictEntry &_val);
00045 
00047   const VR &GetVR() const { return ValueRepresentation; }
00048   void SetVR(const VR & vr) { ValueRepresentation = vr; }
00049 
00051   const VM &GetVM() const { return ValueMultiplicity; }
00052   void SetVM(VM const & vm) { ValueMultiplicity = vm; }
00053 
00055   const char *GetName() const { return Name.c_str(); }
00056   void SetName(const char* name) { Name = name; }
00057 
00059   const char *GetDescription() const { return Description.c_str(); }
00060   void SetDescription(const char* desc) { Description = desc; }
00061 
00062   bool operator<(const CSAHeaderDictEntry &entry) const
00063     {
00064     return strcmp(GetName(),entry.GetName()) < 0;
00065     }
00066 
00067 private:
00068   std::string Name;
00069   VR ValueRepresentation;
00070   VM ValueMultiplicity;
00071   std::string Description;
00072   std::string Type; // TODO
00073 };
00074 
00075 
00076 //-----------------------------------------------------------------------------
00077 inline std::ostream& operator<<(std::ostream& os, const CSAHeaderDictEntry &val)
00078 {
00079   if( val.Name.empty() )
00080     {
00081     os << "[No name]";
00082     }
00083   else
00084     {
00085     os << val.Name;
00086     }
00087   os << "\t" << val.ValueRepresentation << "\t" << val.ValueMultiplicity;
00088   if( !val.Description.empty() )
00089     {
00090     os << "\t" << val.Description;
00091     }
00092   return os;
00093 }
00094 
00095 } // end namespace gdcm
00096 
00097 #endif //GDCMCSAHEADERDICTENTRY_H

Generated on Tue Dec 6 2011 20:36:26 for GDCM by doxygen 1.7.5.1
SourceForge.net Logo