Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

gdcm::DictSet Class Reference

Container for managing a set of loaded dictionaries (Dict). More...

#include <gdcmDictSet.h>

Inheritance diagram for gdcm::DictSet:

Inheritance graph
[legend]
Collaboration diagram for gdcm::DictSet:

Collaboration graph
[legend]
List of all members.

Public Member Functions

void Print (std::ostream &os=std::cout, std::string const &indent="")
 Print, in an informal fashion, the list of all the dictionaries contained is this DictSet, along with their respective content.
DictLoadDictFromFile (std::string const &fileName, DictKey const &name)
 Loads a dictionary from a specified file, and add it to already the existing ones contained in this DictSet.
DictGetDict (DictKey const &DictName)
 Retrieve the specified dictionary (when existing) from this DictSet.
DictGetDefaultPubDict ()
 Returns the default reference DICOM V3 public dictionary.
DictGetFirstDict ()
 Get the first dictionary while visiting the DictSet.
DictGetNextDict ()
 Get the next dictionary while visiting the Hash table (DictSetHT).
void Delete ()
 Delete the object.
void Register ()
 Register the object.
void Unregister ()
 Unregister the object.
const unsigned long & GetRefCount () const
 Get the reference counting.
void SetPrintLevel (int level)
 Sets the print level for the Dicom Header Elements.
int GetPrintLevel ()
 Gets the print level for the Dicom Entries.

Static Public Member Functions

static DictSetNew ()
 Contructs a DictSet with a RefCounter.
static std::string BuildDictPath ()
 Obtain from the GDCM_DICT_PATH environnement variable the path to directory containing the dictionaries. When the environnement variable is absent the path is defaulted to "../Dicts/".

Protected Member Functions

 DictSet ()
 The Dictionary Set obtained with this constructor simply contains the Default Public dictionary.
 ~DictSet ()
 Destructor.

Protected Attributes

int PrintLevel
 Amount of printed details for each Dicom Entries : 0 : stands for the least detail level.

Private Member Functions

 gdcmTypeMacro (DictSet)

Private Attributes

DictSetHT Dicts
 Hash table of all dictionaries contained in this DictSet.
DictSetHT::iterator ItDictHt
 Iterator to visit the Dictionaries of a given DictSet.
std::string DictPath
 Directory path to dictionaries.

Detailed Description

Container for managing a set of loaded dictionaries (Dict).

Note:
Hopefully, sharing dictionaries should avoid

Definition at line 41 of file gdcmDictSet.h.


Constructor & Destructor Documentation

gdcm::DictSet::DictSet  )  [protected]
 

The Dictionary Set obtained with this constructor simply contains the Default Public dictionary.

Definition at line 34 of file gdcmDictSet.cxx.

References BuildDictPath(), DictPath, Dicts, gdcm::Dict::New(), PUB_DICT_FILENAME, and PUB_DICT_NAME.

00035 {
00036    DictPath = BuildDictPath();
00037    std::string pubDictFile(DictPath);
00038    pubDictFile += PUB_DICT_FILENAME;
00039    Dicts[PUB_DICT_NAME] = Dict::New(pubDictFile);
00040 }

gdcm::DictSet::~DictSet  )  [protected]
 

Destructor.

Definition at line 45 of file gdcmDictSet.cxx.

References Dicts.

00046 {
00047    // Remove dictionaries
00048    for (DictSetHT::iterator tag = Dicts.begin(); tag != Dicts.end(); ++tag) 
00049    {
00050       if ( tag->second )
00051          tag->second->Delete();
00052    }
00053    Dicts.clear();
00054 }


Member Function Documentation

std::string gdcm::DictSet::BuildDictPath  )  [static]
 

Obtain from the GDCM_DICT_PATH environnement variable the path to directory containing the dictionaries. When the environnement variable is absent the path is defaulted to "../Dicts/".

Returns:
path to directory containing the dictionaries

Definition at line 125 of file gdcmDictSet.cxx.

References gdcmStaticWarningMacro, and PUB_DICT_PATH.

Referenced by gdcm::DicomDirElement::DicomDirElement(), gdcm::DictGroupName::DictGroupName(), DictSet(), and gdcm::VR::VR().

00126 {
00127    std::string resultPath;
00128    const char *envPath;
00129    envPath = getenv("GDCM_DICT_PATH");
00130 
00131    if (envPath && (strlen(envPath) != 0)) 
00132    {
00133       resultPath = envPath;
00134       gdcmStaticWarningMacro( "Dictionary path set from environnement");
00135    } 
00136    else
00137    {
00138       resultPath = PUB_DICT_PATH;
00139    }
00140    if ( resultPath[resultPath.length()-1] != '/' )
00141    {
00142       resultPath += '/';
00143    }
00144 
00145    return resultPath;
00146 }

void gdcm::RefCounter::Delete  )  [inline, inherited]
 

Delete the object.

Remarks:
The object is deleted only if its reference counting is to zero

Definition at line 39 of file gdcmRefCounter.h.

Referenced by gdcm::SerieHelper::AddFileName(), gdcm::Document::Backtrack(), gdcm::FileHelper::CheckMandatoryElements(), gdcm::FileHelper::CheckMandatoryEntry(), gdcm::FileHelper::CopyMandatoryEntry(), gdcm::DicomDir::CreateDicomDirChainedList(), gdcm::File::DoTheLoadingJob(), gdcm::Dict::DoTheLoadingJob(), gdcm::DicomDirObject::FillObject(), gdcm::DocEntrySet::InsertEntryBinArea(), gdcm::DocEntrySet::InsertEntryString(), gdcm::DocEntrySet::InsertSeqEntry(), vtkGdcmReader::LoadFileInformation(), vtkGdcmReader::LoadImageInMemory(), main(), gdcm::DicomDir::NewMeta(), gdcm::DicomDirStudy::NewVisit(), gdcm::Document::ParseDES(), gdcm::Document::ParseSQ(), gdcm::Document::ReadNextDocEntry(), gdcm::DicomDir::SetElement(), gdcm::FileHelper::SetMandatoryEntry(), gdcm::FileHelper::SetWriteFileTypeToExplicitVR(), gdcm::FileHelper::SetWriteFileTypeToImplicitVR(), gdcm::FileHelper::SetWriteFileTypeToJPEG(), gdcm::FileHelper::SetWriteToLibido(), gdcm::FileHelper::SetWriteToNoLibido(), gdcm::FileHelper::SetWriteToRaw(), gdcm::FileHelper::SetWriteToRGB(), vtkGdcmWriter::WriteDcmFile(), gdcm::DicomDir::~DicomDir(), and gdcm::Global::~Global().

00039 { Unregister(); }

gdcm::DictSet::gdcmTypeMacro DictSet   )  [private]
 

Dict* gdcm::DictSet::GetDefaultPubDict  )  [inline]
 

Returns the default reference DICOM V3 public dictionary.

Definition at line 61 of file gdcmDictSet.h.

References PUB_DICT_NAME.

Referenced by gdcm::DicomDirObject::FillObject(), gdcm::DocEntrySet::GetDictEntry(), and gdcm::Document::Initialize().

00061 { return GetDict(PUB_DICT_NAME); }

Dict * gdcm::DictSet::GetDict DictKey const &  dictName  ) 
 

Retrieve the specified dictionary (when existing) from this DictSet.

Parameters:
dictName The symbolic name of the searched dictionary.
Returns:
The retrieved dictionary.

Definition at line 81 of file gdcmDictSet.cxx.

References Dicts.

Referenced by gdcm::Document::SetShaDict().

00082 {
00083    DictSetHT::iterator dict = Dicts.find(dictName);
00084    if ( dict != Dicts.end() )
00085    {
00086       return dict->second;
00087    }
00088    return NULL;
00089 }

Dict * gdcm::DictSet::GetFirstDict  ) 
 

Get the first dictionary while visiting the DictSet.

Returns:
The first Dict if found, otherwhise NULL

Definition at line 95 of file gdcmDictSet.cxx.

References Dicts, and ItDictHt.

00096 {
00097    ItDictHt = Dicts.begin();
00098    if ( ItDictHt != Dicts.end() )
00099       return ItDictHt->second;
00100    return NULL;
00101 }

Dict * gdcm::DictSet::GetNextDict  ) 
 

Get the next dictionary while visiting the Hash table (DictSetHT).

Note:
: meaningfull only if GetFirstEntry already called
Returns:
The next Dict if found, otherwhise NULL

Definition at line 108 of file gdcmDictSet.cxx.

References Dicts, gdcmAssertMacro, and ItDictHt.

00109 {
00110    gdcmAssertMacro (ItDictHt != Dicts.end());
00111   
00112    ++ItDictHt;
00113    if ( ItDictHt != Dicts.end() )
00114       return ItDictHt->second;
00115    return NULL;
00116 }

int gdcm::Base::GetPrintLevel  )  [inline, inherited]
 

Gets the print level for the Dicom Entries.

Definition at line 50 of file gdcmBase.h.

00050 { return PrintLevel; }

const unsigned long& gdcm::RefCounter::GetRefCount  )  const [inline, inherited]
 

Get the reference counting.

Returns:
Reference count

Definition at line 56 of file gdcmRefCounter.h.

00057    {
00058       return RefCount;
00059    }

Dict * gdcm::DictSet::LoadDictFromFile std::string const &  filename,
DictKey const &  name
 

Loads a dictionary from a specified file, and add it to already the existing ones contained in this DictSet.

Parameters:
filename Absolute or relative filename containing the dictionary to load.
name Symbolic name that be used as identifier of the newly created dictionary.

Definition at line 66 of file gdcmDictSet.cxx.

References Dicts, and gdcm::Dict::New().

00068 {
00069    Dict *newDict = Dict::New(filename);
00070    Dicts[name] = newDict;
00071 
00072    return newDict;
00073 }

static DictSet* gdcm::DictSet::New  )  [inline, static]
 

Contructs a DictSet with a RefCounter.

Definition at line 47 of file gdcmDictSet.h.

Referenced by gdcm::Global::Global().

00047 {return new DictSet();}

void gdcm::DictSet::Print std::ostream &  os = std::cout,
std::string const &  indent = ""
[virtual]
 

Print, in an informal fashion, the list of all the dictionaries contained is this DictSet, along with their respective content.

Parameters:
os Output stream used for printing.
indent Indentation string to be prepended during printing

Reimplemented from gdcm::Base.

Definition at line 162 of file gdcmDictSet.cxx.

References Dicts.

00163 {
00164    for (DictSetHT::iterator dict = Dicts.begin(); dict != Dicts.end(); ++dict)
00165    {
00166       os << "Printing dictionary " << dict->first << std::endl;
00167       dict->second->Print(os);
00168    }
00169 }

void gdcm::RefCounter::Register  )  [inline, inherited]
 

Register the object.

Remarks:
It increments the reference counting

Definition at line 44 of file gdcmRefCounter.h.

Referenced by gdcm::SQItem::AddEntry(), gdcm::ElementSet::AddEntry(), gdcm::Dict::AddEntry(), gdcm::SeqEntry::AddSQItem(), gdcm::SeqEntry::Copy(), gdcm::DicomDir::Copy(), gdcm::DocEntry::DocEntry(), gdcm::FileHelper::FileHelper(), gdcm::DocEntrySet::GetDictEntry(), gdcm::CommandManager::InSetCommand(), gdcm::DocEntryArchive::Push(), gdcm::Dict::ReplaceEntry(), and gdcm::SeqEntry::SetDelimitationItem().

00044 { RefCount++; }

void gdcm::Base::SetPrintLevel int  level  )  [inline, inherited]
 

Sets the print level for the Dicom Header Elements.

Note:
0 for Light Print; 1 for 'medium' Print, 2 for Heavy Print

Definition at line 47 of file gdcmBase.h.

Referenced by gdcm::SQItem::Print(), gdcm::SeqEntry::Print(), gdcm::FileHelper::Print(), gdcm::ElementSet::Print(), and gdcm::DicomDir::Print().

00047 { PrintLevel = level; }

void gdcm::RefCounter::Unregister  )  [inline, inherited]
 

Unregister the object.

Remarks:
It decrements the reference counting

Definition at line 48 of file gdcmRefCounter.h.

Referenced by gdcm::SeqEntry::ClearSQItem(), gdcm::DicomDir::Copy(), gdcm::DocEntrySet::GetDictEntry(), gdcm::CommandManager::InSetCommand(), gdcm::DocEntrySet::NewDataEntry(), gdcm::DocEntrySet::NewSeqEntry(), gdcm::Document::ReadNextDocEntry(), gdcm::SQItem::RemoveEntry(), gdcm::ElementSet::RemoveEntry(), gdcm::SeqEntry::SetDelimitationItem(), gdcm::DocEntry::~DocEntry(), and gdcm::FileHelper::~FileHelper().

00049    {
00050       RefCount--;
00051       if(RefCount<=0)
00052          delete this;
00053    }


Member Data Documentation

std::string gdcm::DictSet::DictPath [private]
 

Directory path to dictionaries.

Definition at line 83 of file gdcmDictSet.h.

Referenced by DictSet().

DictSetHT gdcm::DictSet::Dicts [private]
 

Hash table of all dictionaries contained in this DictSet.

Definition at line 78 of file gdcmDictSet.h.

Referenced by DictSet(), GetDict(), GetFirstDict(), GetNextDict(), LoadDictFromFile(), Print(), and ~DictSet().

DictSetHT::iterator gdcm::DictSet::ItDictHt [private]
 

Iterator to visit the Dictionaries of a given DictSet.

Definition at line 80 of file gdcmDictSet.h.

Referenced by GetFirstDict(), and GetNextDict().

int gdcm::Base::PrintLevel [protected, inherited]
 

Amount of printed details for each Dicom Entries : 0 : stands for the least detail level.

Definition at line 55 of file gdcmBase.h.

Referenced by gdcm::SQItem::Print(), gdcm::SeqEntry::Print(), gdcm::FileHelper::Print(), gdcm::ElementSet::Print(), gdcm::DocEntry::Print(), gdcm::DictEntry::Print(), gdcm::DicomDirStudy::Print(), gdcm::DicomDirSerie::Print(), gdcm::DicomDirPatient::Print(), gdcm::DicomDirMeta::Print(), gdcm::DicomDir::Print(), and gdcm::DataEntry::Print().


The documentation for this class was generated from the following files:
Generated on Fri Jan 20 10:15:04 2006 for gdcm by  doxygen 1.4.4