Program: gdcm
Module: $RCSfile: gdcmDictSet.cxx,v $
Language: C++
- Date: $Date: 2004/08/31 14:24:47 $
- Version: $Revision: 1.35 $
+ Date: $Date: 2004/10/12 04:35:45 $
+ Version: $Revision: 1.38 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
- http://www.creatis.insa-lyon.fr/Public/Gdcm/License.htm for details.
+ http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
#include "gdcmDebug.h"
#include <fstream>
#include <stdlib.h> // For getenv
+namespace gdcm
+{
//-----------------------------------------------------------------------------
// Constructor / Destructor
/**
- * \ingroup gdcmDictSet
+ * \ingroup DictSet
* \brief The Dictionnary Set obtained with this constructor simply
* contains the Default Public dictionnary.
*/
-gdcmDictSet::gdcmDictSet()
+DictSet::DictSet()
{
DictPath = BuildDictPath();
std::string pubDictFile(DictPath);
pubDictFile += PUB_DICT_FILENAME;
- Dicts[PUB_DICT_NAME] = new gdcmDict(pubDictFile);
+ Dicts[PUB_DICT_NAME] = new Dict(pubDictFile);
}
/**
- * \ingroup gdcmDictSet
+ * \ingroup DictSet
* \brief Destructor
*/
-gdcmDictSet::~gdcmDictSet()
+DictSet::~DictSet()
{
// Remove dictionnaries
for (DictSetHT::iterator tag = Dicts.begin(); tag != Dicts.end(); ++tag)
{
- gdcmDict *entryToDelete = tag->second;
+ Dict *entryToDelete = tag->second;
if ( entryToDelete )
{
delete entryToDelete;
Dicts.clear();
// Remove virtual dictionnary entries
- std::map<std::string,gdcmDictEntry *>::iterator it;
+ std::map<std::string,DictEntry *>::iterator it;
for(it = VirtualEntry.begin(); it != VirtualEntry.end(); ++it)
{
- gdcmDictEntry *entry = it->second;
+ DictEntry *entry = it->second;
if ( entry )
{
delete entry;
//-----------------------------------------------------------------------------
// Print
/**
- * \ingroup gdcmDictSet
+ * \ingroup DictSet
* \brief Print, in an informal fashion, the list of all the dictionaries
- * contained is this gdcmDictSet, along with their respective content.
+ * contained is this DictSet, along with their respective content.
* @param os Output stream used for printing.
*/
-void gdcmDictSet::Print(std::ostream& os)
+void DictSet::Print(std::ostream& os)
{
for (DictSetHT::iterator dict = Dicts.begin(); dict != Dicts.end(); ++dict)
{
//-----------------------------------------------------------------------------
// Public
/**
- * \ingroup gdcmDictSet
+ * \ingroup DictSet
* \brief Consider all the entries of the public dicom dictionnary.
* Build all list of all the tag names of all those entries.
- * \sa gdcmDictSet::GetPubDictTagNamesByCategory
+ * \sa DictSet::GetPubDictTagNamesByCategory
* @return A list of all entries of the public dicom dictionnary.
*/
-std::list<std::string> *gdcmDictSet::GetPubDictEntryNames()
+std::list<std::string> *DictSet::GetPubDictEntryNames()
{
return GetDefaultPubDict()->GetDictEntryNames();
}
/**
- * \ingroup gdcmDictSet
+ * \ingroup DictSet
* \brief
* - Consider all the entries of the public dicom dictionnary.
* - Build an hashtable whose keys are the names of the groups
* among that group.
*/
std::map<std::string, std::list<std::string> > *
- gdcmDictSet::GetPubDictEntryNamesByCategory()
+ DictSet::GetPubDictEntryNamesByCategory()
{
return GetDefaultPubDict()->GetDictEntryNamesByCategory();
}
/**
- * \ingroup gdcmDictSet
+ * \ingroup DictSet
* \brief Loads a dictionary from a specified file, and add it
- * to already the existing ones contained in this gdcmDictSet.
+ * to already the existing ones contained in this DictSet.
* @param fileName Absolute or relative filename containing the
* dictionary to load.
* @param name Symbolic name that be used as identifier of the newly
* created dictionary.
*/
-gdcmDict *gdcmDictSet::LoadDictFromFile(std::string const & fileName,
+Dict *DictSet::LoadDictFromFile(std::string const & fileName,
DictKey const & name)
{
- gdcmDict *newDict = new gdcmDict(fileName);
+ Dict *newDict = new Dict(fileName);
AppendDict(newDict, name);
return newDict;
}
/**
- * \ingroup gdcmDictSet
+ * \ingroup DictSet
* \brief Retrieve the specified dictionary (when existing) from this
- * gdcmDictSet.
+ * DictSet.
* @param dictName The symbolic name of the searched dictionary.
* \result The retrieved dictionary.
*/
-gdcmDict *gdcmDictSet::GetDict(DictKey const & dictName)
+Dict *DictSet::GetDict(DictKey const & dictName)
{
DictSetHT::iterator dict = Dicts.find(dictName);
if(dict != Dicts.end())
}
/**
- * \brief Retrieve the default reference DICOM V3 public dictionary.
- * \result The retrieved default dictionary.
- */
-gdcmDict *gdcmDictSet::GetDefaultPubDict()
-{
- return GetDict(PUB_DICT_NAME);
-}
-
-/**
- * \brief Create a gdcmDictEntry which will be reference
+ * \brief Create a DictEntry which will be reference
* in no dictionnary
* @return virtual entry
*/
-gdcmDictEntry *gdcmDictSet::NewVirtualDictEntry(uint16_t group,
+DictEntry *DictSet::NewVirtualDictEntry(uint16_t group,
uint16_t element,
std::string vr,
std::string fourth,
std::string name)
{
- gdcmDictEntry* entry;
- const std::string tag = gdcmDictEntry::TranslateToKey(group,element)
+ DictEntry* entry;
+ const std::string tag = DictEntry::TranslateToKey(group,element)
+ "#" + vr + "#" + fourth + "#" + name;
- std::map<std::string,gdcmDictEntry *>::iterator it;
+ std::map<std::string,DictEntry *>::iterator it;
it = VirtualEntry.find(tag);
if(it != VirtualEntry.end())
}
else
{
- entry = new gdcmDictEntry(group, element, vr, fourth, name);
+ entry = new DictEntry(group, element, vr, fourth, name);
VirtualEntry[tag] = entry;
}
* to "../Dicts/".
* @return path to directory containing the dictionnaries
*/
-std::string gdcmDictSet::BuildDictPath()
+std::string DictSet::BuildDictPath()
{
std::string resultPath;
const char *envPath = 0;
{
resultPath += '/';
}
- dbg.Verbose(1, "gdcmDictSet::BuildDictPath:",
+ dbg.Verbose(1, "DictSet::BuildDictPath:",
"Dictionary path set from environnement");
}
else
//-----------------------------------------------------------------------------
// Protected
-bool gdcmDictSet::AppendDict(gdcmDict *newDict, DictKey const & name)
+bool DictSet::AppendDict(Dict *newDict, DictKey const & name)
{
Dicts[name] = newDict;
//-----------------------------------------------------------------------------
-
+} // end namespace gdcm