# gdcmModuleEntry.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-2009 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 __gdcmModuleEntry_h
    00016 #define __gdcmModuleEntry_h
    00017
    00018 #include "gdcmTypes.h"
    00019 #include "gdcmType.h"
    00020
    00021 #include <string>
    00022
    00023 namespace gdcm
    00024 {
    00030 class GDCM_EXPORT ModuleEntry
    00031 {
    00032 public:
    00033   ModuleEntry(const char *name = "", const char *type = "3", const char *description = ""):Name(name)/*,Type(type)*/,DescriptionField(description) {
    00034     DataElementType = Type::GetTypeType(type);
    00035   }
    00036   virtual ~ModuleEntry() {} // important
    00037   friend std::ostream& operator<<(std::ostream& _os, const ModuleEntry &_val);
    00038
    00039   void SetName(const char *name) { Name = name; }
    00040   const char *GetName() const { return Name.c_str(); }
    00041
    00042   void SetType(const Type &type) { DataElementType = type; }
    00043   const Type &GetType() const { return DataElementType; }
    00044
    00045   /*
    00046    * WARNING: 'Description' is currently a std::string, but it might change in the future
    00047    * do not expect it to remain the same, and always use the ModuleEntry::Description typedef
    00048    * instead.
    00049    */
    00050   typedef std::string Description;
    00051   void SetDescription(const char *d) { DescriptionField = d; }
    00052   const Description & GetDescription() const { return DescriptionField; }
    00053
    00054 protected:
    00055   // PS 3.3 repeats the name of an attribute, but often contains typos
    00056   // for now we will not use this info, but instead access the DataDict instead
    00057   std::string Name;
    00058
    00059   // An attribute, encoded as a Data Element, may or may not be required in a
    00060   // Data Set, depending on that Attribute's Data Element Type.
    00061   Type DataElementType;
    00062
    00063   // TODO: for now contains the raw description (with enumerated values, defined terms...)
    00064   Description DescriptionField;
    00065 };
    00066 //-----------------------------------------------------------------------------
    00067 inline std::ostream& operator<<(std::ostream& _os, const ModuleEntry &_val)
    00068 {
    00069   _os << _val.Name << "\t" << _val.DataElementType << "\t" << _val.DescriptionField;
    00070   return _os;
    00071 }
    00072
    00073 typedef ModuleEntry MacroEntry;
    00074
    00075
    00076 } // end namespace gdcm
    00077
    00078 #endif //__gdcmModuleEntry_h