# gdcmDictConverter.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
    00016 #ifndef __gdcmDictConverter_h
    00017 #define __gdcmDictConverter_h
    00018
    00019 #include "gdcmTypes.h"
    00020 #include "gdcmVR.h"
    00021 #include "gdcmVM.h"
    00022
    00023 #include <string>
    00024
    00025 namespace gdcm
    00026 {
    00027
    00028 class DictConverterInternal;
    00036 class GDCM_EXPORT DictConverter
    00037 {
    00038 public:
    00039   DictConverter();
    00040   ~DictConverter();
    00041   void SetInputFileName(const char* filename);
    00042   const std::string &GetInputFilename() const;
    00043   void SetOutputFileName(const char* filename);
    00044   const std::string &GetOutputFilename() const;
    00045
    00046   int GetOutputType() const {
    00047     return OutputType;
    00048   }
    00049   void SetOutputType(int type) {
    00050     OutputType = type;
    00051   }
    00052   const std::string &GetDictName() const;
    00053   void SetDictName(const char *name);
    00054
    00055   void Convert();
    00056
    00057   // Leaving them public for now. Not really user oriented but may be
    00058   // usefull
    00059   static bool ReadVR(const char *raw, VR::VRType &type);
    00060   static bool ReadVM(const char *raw, VM::VMType &type);
    00061   static bool Readuint16(const char *raw, uint16_t &ov);
    00062
    00063   enum OutputTypes {
    00064     DICT_DEFAULT = 0,
    00065     DICT_DEBUG,
    00066     DICT_XML
    00067   };
    00068
    00069 protected:
    00070   void WriteHeader();
    00071   void WriteFooter();
    00072   bool ConvertToXML(const char *raw, std::string &cxx);
    00073   bool ConvertToCXX(const char *raw, std::string &cxx);
    00074   void AddGroupLength();
    00075
    00076 private:
    00077   DictConverterInternal *Internal;
    00078
    00079   int OutputType;
    00080 };
    00081
    00082 } // end namespace gdcm
    00083
    00084 #endif //__gdcmDictConverter_h