gdcmDictEntry.cxx

Go to the documentation of this file.
00001 /*=========================================================================
00002                                                                                 
00003   Program:   gdcm
00004   Module:    $RCSfile: gdcmDictEntry.cxx,v $
00005   Language:  C++
00006   Date:      $Date: 2007/05/23 14:18:09 $
00007   Version:   $Revision: 1.61 $
00008                                                                                 
00009   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
00010   l'Image). All rights reserved. See Doc/License.txt or
00011   http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
00012                                                                                 
00013      This software is distributed WITHOUT ANY WARRANTY; without even
00014      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00015      PURPOSE.  See the above copyright notices for more information.
00016                                                                                 
00017 =========================================================================*/
00018 
00019 #include "gdcmDictEntry.h"
00020 #include "gdcmDebug.h"
00021 #include "gdcmUtil.h"
00022 
00023 #include <iomanip> // for std::ios::left, ...
00024 #include <fstream>
00025 #include <stdio.h> // for sprintf
00026 
00027 namespace GDCM_NAME_SPACE 
00028 {
00029 //-----------------------------------------------------------------------------
00030 // Constructor / Destructor
00039 DictEntry::DictEntry(uint16_t group, uint16_t elem,
00040                      VRKey const &vr, 
00041                      TagName const &vm,
00042                      TagName const &name)
00043 {
00044    Tag.SetGroup(group);
00045    Tag.SetElement(elem);
00046    VR      = vr;
00047    VM      = vm;
00048    Name    = name;
00049 }
00050 
00054 DictEntry::~DictEntry()
00055 {
00056 }
00057 //-----------------------------------------------------------------------------
00058 // Public
00067 DictEntry *DictEntry::New(uint16_t group, uint16_t elem,
00068                           VRKey const &vr,
00069                           TagName const &vm,
00070                           TagName const &name)
00071 {
00072    return new DictEntry(group,elem,vr,vm,name);
00073 }
00074 
00082 TagKey DictEntry::TranslateToKey(uint16_t group, uint16_t elem)
00083 {
00084    // according to 'Purify', TranslateToKey is one of the most
00085    // time consuming methods.
00086    // Let's try to shorten it !
00087    return TagKey(group,elem);
00088 }
00089 
00090 //-----------------------------------------------------------------------------
00091 // Protected
00092 
00093 //-----------------------------------------------------------------------------
00094 // Private
00095 
00096 //-----------------------------------------------------------------------------
00097 // Print
00103 void DictEntry::Print(std::ostream &os, std::string const & )
00104 {
00105    os << GetKey(); 
00106    os << " [" << VR  << "] ";
00107 
00108    std::ostringstream s;
00109 
00110    if ( PrintLevel >= 1 )
00111    {
00112       s.setf(std::ios::left);
00113       s << std::setw(66-GetName().length()) << " ";
00114    }
00115 
00116    s << "[" << GetName()<< "]";
00117    os << s.str() << std::endl;
00118 }
00119 
00120 //-----------------------------------------------------------------------------
00121 } // end namespace gdcm
00122 

Generated on Fri Aug 24 12:53:13 2007 for gdcm by  doxygen 1.4.6