GDCM_NAME_SPACE::DictSet Class Reference

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

#include <gdcmDictSet.h>

Inheritance diagram for GDCM_NAME_SPACE::DictSet:

Inheritance graph
[legend]
Collaboration diagram for GDCM_NAME_SPACE::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 42 of file gdcmDictSet.h.


Constructor & Destructor Documentation

GDCM_NAME_SPACE::DictSet::DictSet  )  [protected]
 

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

Definition at line 35 of file gdcmDictSet.cxx.

References BuildDictPath(), GDCM_NAME_SPACE::Global::DefaultPubDict, DictPath, Dicts, GDCM_NAME_SPACE::Dict::New(), PUB_DICT_FILENAME, and PUB_DICT_NAME.

00036 {
00037    DictPath = BuildDictPath();
00038    std::string pubDictFile(DictPath);
00039    pubDictFile += PUB_DICT_FILENAME;
00040    Dicts[PUB_DICT_NAME] = Dict::New(pubDictFile);
00041    // Stored redundantly to avoid at access HTable DictSet every time.
00042    Global::DefaultPubDict = Dicts[PUB_DICT_NAME];
00043 }

GDCM_NAME_SPACE::DictSet::~DictSet  )  [protected]
 

Destructor.

Definition at line 48 of file gdcmDictSet.cxx.

References GDCM_NAME_SPACE::Global::DefaultPubDict, GDCM_NAME_SPACE::RefCounter::Delete(), and Dicts.

00049 {
00050    Global::DefaultPubDict = 0; // just a pointer!
00051    // Remove dictionaries
00052    for (DictSetHT::iterator tag = Dicts.begin(); tag != Dicts.end(); ++tag) 
00053    {
00054       if ( tag->second )
00055          tag->second->Delete();
00056    }
00057    Dicts.clear();
00058 }


Member Function Documentation

std::string GDCM_NAME_SPACE::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 131 of file gdcmDictSet.cxx.

References gdcmStaticWarningMacro, and PUB_DICT_PATH.

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

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

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

Delete the object.

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

Definition at line 41 of file gdcmRefCounter.h.

Referenced by GDCM_NAME_SPACE::SerieHelper::AddFileName(), GDCM_NAME_SPACE::Document::Backtrack(), GDCM_NAME_SPACE::FileHelper::CheckMandatoryElements(), GDCM_NAME_SPACE::FileHelper::CheckMandatoryEntry(), GDCM_NAME_SPACE::FileHelper::CopyMandatoryEntry(), GDCM_NAME_SPACE::Dict::DoTheLoadingJob(), GDCM_NAME_SPACE::FillDefaultDataDict(), GDCM_NAME_SPACE::DicomDirObject::FillObject(), vtkGdcmReader::GetFileInformation(), GDCM_NAME_SPACE::DocEntrySet::InsertEntryBinArea(), GDCM_NAME_SPACE::DocEntrySet::InsertEntryString(), GDCM_NAME_SPACE::DocEntrySet::InsertSeqEntry(), vtkGdcmReader::LoadFileInformation(), GDCM_NAME_SPACE::DicomDir::NewMeta(), GDCM_NAME_SPACE::DicomDirStudy::NewVisit(), GDCM_NAME_SPACE::Document::ReadNextDocEntry(), GDCM_NAME_SPACE::DicomDir::SetElement(), GDCM_NAME_SPACE::FileHelper::SetMandatoryEntry(), GDCM_NAME_SPACE::FileHelper::SetWriteFileTypeToExplicitVR(), GDCM_NAME_SPACE::FileHelper::SetWriteFileTypeToImplicitVR(), GDCM_NAME_SPACE::FileHelper::SetWriteFileTypeToJPEG(), GDCM_NAME_SPACE::FileHelper::SetWriteFileTypeToJPEG2000(), GDCM_NAME_SPACE::FileHelper::SetWriteToLibido(), GDCM_NAME_SPACE::DicomDir::~DicomDir(), ~DictSet(), and GDCM_NAME_SPACE::Global::~Global().

00041 { Unregister(); }

GDCM_NAME_SPACE::DictSet::gdcmTypeMacro DictSet   )  [private]
 

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

Returns the default reference DICOM V3 public dictionary.

Definition at line 63 of file gdcmDictSet.h.

References GDCM_NAME_SPACE::Global::DefaultPubDict.

Referenced by GDCM_NAME_SPACE::DocEntrySet::GetDictEntry(), GDCM_NAME_SPACE::DocEntry::GetName(), GDCM_NAME_SPACE::DocEntry::GetVM(), GDCM_NAME_SPACE::Document::Initialize(), and GDCM_NAME_SPACE::DocEntrySet::InsertEntryString().

00063 { return Global::DefaultPubDict; } 

Dict * GDCM_NAME_SPACE::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 87 of file gdcmDictSet.cxx.

References Dicts.

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

00088 {
00089    DictSetHT::iterator dict = Dicts.find(dictName);
00090    if ( dict != Dicts.end() )
00091    {
00092       return dict->second;
00093    }
00094    return NULL;
00095 }

Dict * GDCM_NAME_SPACE::DictSet::GetFirstDict  ) 
 

Get the first dictionary while visiting the DictSet.

Returns:
The first Dict if found, otherwhise NULL

Definition at line 101 of file gdcmDictSet.cxx.

References Dicts, and ItDictHt.

00102 {
00103    ItDictHt = Dicts.begin();
00104    if ( ItDictHt != Dicts.end() )
00105       return ItDictHt->second;
00106    return NULL;
00107 }

Dict * GDCM_NAME_SPACE::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 114 of file gdcmDictSet.cxx.

References Dicts, gdcmAssertMacro, and ItDictHt.

00115 {
00116    gdcmAssertMacro (ItDictHt != Dicts.end());
00117   
00118    ++ItDictHt;
00119    if ( ItDictHt != Dicts.end() )
00120       return ItDictHt->second;
00121    return NULL;
00122 }

int GDCM_NAME_SPACE::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_NAME_SPACE::RefCounter::GetRefCount  )  const [inline, inherited]
 

Get the reference counting.

Returns:
Reference count

Definition at line 59 of file gdcmRefCounter.h.

00060    {
00061       return RefCount;
00062    }

Dict * GDCM_NAME_SPACE::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.
Todo:
RemoveDict(name); when Dict already exist

Definition at line 70 of file gdcmDictSet.cxx.

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

00072 {
00073    assert(Dicts.find(name)==Dicts.end());
00075    Dict *newDict = Dict::New(filename);
00076    Dicts[name] = newDict;
00077 
00078    return newDict;
00079 }

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

Contructs a DictSet with a RefCounter.

Definition at line 48 of file gdcmDictSet.h.

Referenced by GDCM_NAME_SPACE::Global::Global().

00048 {return new DictSet();}

void GDCM_NAME_SPACE::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_NAME_SPACE::Base.

Definition at line 166 of file gdcmDictSet.cxx.

References Dicts.

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

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

Register the object.

Remarks:
It increments the reference counting

Definition at line 46 of file gdcmRefCounter.h.

Referenced by GDCM_NAME_SPACE::SQItem::AddEntry(), GDCM_NAME_SPACE::SeqEntry::AddSQItem(), GDCM_NAME_SPACE::SeqEntry::Copy(), GDCM_NAME_SPACE::DicomDir::Copy(), GDCM_NAME_SPACE::FileHelper::FileHelper(), GDCM_NAME_SPACE::DocEntrySet::GetDictEntry(), GDCM_NAME_SPACE::DocEntry::GetName(), GDCM_NAME_SPACE::DocEntry::GetVM(), GDCM_NAME_SPACE::DocEntrySet::InsertEntryString(), GDCM_NAME_SPACE::CommandManager::InSetCommand(), GDCM_NAME_SPACE::DocEntryArchive::Push(), and GDCM_NAME_SPACE::SeqEntry::SetDelimitationItem().

00046 { RefCount++; }

void GDCM_NAME_SPACE::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_NAME_SPACE::FileHelper::Print(), and GDCM_NAME_SPACE::DicomDir::Print().

00047 { PrintLevel = level; }

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

Unregister the object.

Remarks:
It decrements the reference counting

Definition at line 50 of file gdcmRefCounter.h.

Referenced by GDCM_NAME_SPACE::Document::ReadNextDocEntry(), GDCM_NAME_SPACE::SQItem::RemoveEntry(), GDCM_NAME_SPACE::ElementSet::RemoveEntry(), and GDCM_NAME_SPACE::FileHelper::~FileHelper().

00051    {
00052 //std::cout <<"================Unreg " << typeid(*this).name() << std::endl;
00053       RefCount--;
00054       if(RefCount<=0)
00055         delete this;
00056    }


Member Data Documentation

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

Directory path to dictionaries.

Definition at line 85 of file gdcmDictSet.h.

Referenced by DictSet().

DictSetHT GDCM_NAME_SPACE::DictSet::Dicts [private]
 

Hash table of all dictionaries contained in this DictSet.

Definition at line 80 of file gdcmDictSet.h.

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

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

Iterator to visit the Dictionaries of a given DictSet.

Definition at line 82 of file gdcmDictSet.h.

Referenced by GetFirstDict(), and GetNextDict().

int GDCM_NAME_SPACE::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_NAME_SPACE::SeqEntry::Print(), GDCM_NAME_SPACE::FileHelper::Print(), GDCM_NAME_SPACE::ElementSet::Print(), GDCM_NAME_SPACE::DocEntry::Print(), GDCM_NAME_SPACE::DictEntry::Print(), GDCM_NAME_SPACE::DicomDirStudy::Print(), GDCM_NAME_SPACE::DicomDirSerie::Print(), GDCM_NAME_SPACE::DicomDirPatient::Print(), GDCM_NAME_SPACE::DicomDirMeta::Print(), GDCM_NAME_SPACE::DicomDir::Print(), and GDCM_NAME_SPACE::DataEntry::Print().


The documentation for this class was generated from the following files:
Generated on Fri Aug 24 13:01:39 2007 for gdcm by  doxygen 1.4.6