X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmDocEntrySet.cxx;h=a054d86e7f990360c22b91aa1d123403f9bdb4fc;hb=97945d8b11b86924800fe1d78dcbf8a54be75927;hp=19b7d39d15e54d2e2a1eb1ebbe551642e6bc37d6;hpb=9ca0e4bb2208be93bebf21d0c5d75c8018e7605a;p=gdcm.git diff --git a/src/gdcmDocEntrySet.cxx b/src/gdcmDocEntrySet.cxx index 19b7d39d..a054d86e 100644 --- a/src/gdcmDocEntrySet.cxx +++ b/src/gdcmDocEntrySet.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDocEntrySet.cxx,v $ Language: C++ - Date: $Date: 2005/06/24 10:55:59 $ - Version: $Revision: 1.57 $ + Date: $Date: 2005/09/06 15:28:49 $ + Version: $Revision: 1.59 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -25,12 +25,16 @@ #include "gdcmSeqEntry.h" #include "gdcmValEntry.h" #include "gdcmBinEntry.h" +#include "gdcmUtil.h" namespace gdcm { //----------------------------------------------------------------------------- // Constructor / Destructor - +DocEntrySet::DocEntrySet() +{ + PreviousDocEntry = 0; +} //----------------------------------------------------------------------------- // Public /** @@ -38,7 +42,7 @@ namespace gdcm * @param group Group number of the searched tag. * @param elem Element number of the searched tag. * @return Corresponding element value when it exists, - * and the string GDCM_UNFOUND ("gdcm::Unfound") otherwise. + * and the string GDCM_UNFOUND otherwise. */ std::string DocEntrySet::GetEntryValue(uint16_t group, uint16_t elem) { @@ -62,6 +66,34 @@ void *DocEntrySet::GetEntryBinArea(uint16_t group, uint16_t elem) return 0; } +/** + * \brief Return the value of the BinEntry if it's "std::string representable" + * @param group Group number of the searched tag. + * @param elem Element number of the searched tag. + * @return Corresponding element value when it's "std::string representable" + * and the string GDCM_NOTASCII otherwise. + */ +std::string DocEntrySet::GetEntryForcedAsciiValue(uint16_t group, uint16_t elem) +{ + DocEntry *d = GetDocEntry(group,elem); + if ( !d ) + return GDCM_UNFOUND; + + if (ValEntry *v = dynamic_cast(d)) + return v->GetValue(); + + if (BinEntry *b = dynamic_cast(d)) + { + uint8_t *a = b->GetBinArea(); + if (!b) + return GDCM_NOTLOADED; + // TODO : unify those two methods. + if (Util::IsCleanArea(a, b->GetLength()) ) + return Util::CreateCleanString(a, b->GetLength()); + } + return GDCM_NOTASCII; +} + /** * \brief Searches within Header Entries (Dicom Elements) parsed with * the public and private dictionaries