X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmDataEntry.cxx;h=106310443eca7167723e73e1f45ff1da4ff8cdc3;hb=b06cbd9177331d793223eac6bf8b2bccf874e7e3;hp=b46b6e7720b5271a183b458ca9d50c693a3a29ab;hpb=6aab4b42b524365bf70eaa80ad024f03a6a9b7bc;p=gdcm.git diff --git a/src/gdcmDataEntry.cxx b/src/gdcmDataEntry.cxx index b46b6e77..10631044 100644 --- a/src/gdcmDataEntry.cxx +++ b/src/gdcmDataEntry.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDataEntry.cxx,v $ Language: C++ - Date: $Date: 2007/06/04 13:40:01 $ - Version: $Revision: 1.43 $ + Date: $Date: 2007/09/14 08:22:19 $ + Version: $Revision: 1.48 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -82,15 +82,15 @@ DataEntry::~DataEntry () } -//----------------------------------------------------------------------------- -// Print - //----------------------------------------------------------------------------- // Public /** * \brief Sets the value (non string) of the current DataEntry * @param area area - * @param self self + * @param self self=true : The area : *belongs" to the DataEntry + * : will be delete with the DataEntry + * self=false The area *is not* deleted with the DataEntry + * */ void DataEntry::SetBinArea( uint8_t *area, bool self ) { @@ -118,7 +118,7 @@ void DataEntry::CopyBinArea( uint8_t *area, uint32_t length ) NewBinArea(); memcpy(BinArea,area,length); if( length!=lgh ) - BinArea[length]=0; + BinArea[length]=0; // padd with zero State = STATE_LOADED; } @@ -137,7 +137,7 @@ void DataEntry::SetValue(const uint32_t &id, const double &val) if( id > GetValueCount() ) { - gdcmErrorMacro("Index (" << id << ")is greater than the data size"); + gdcmErrorMacro("Index (" << id << ") is greater than the data size"); return; } @@ -172,7 +172,7 @@ void DataEntry::SetValue(const uint32_t &id, const double &val) } } /** - * \brief returns, as a double (?!?) one of the values + * \brief returns, as a double one of the values * (when entry is multivaluated), identified by its index. * Returns 0.0 if index is wrong * @param id id @@ -196,13 +196,11 @@ double DataEntry::GetValue(const uint32_t &id) const return 0.0; } - /// \todo FIX the API : user *knows* that entry contains a US - /// and he receives a double ?!? + // if user *knows* that entry contains a US, + // he just has to cast the double he receives const VRKey &vr = GetVR(); - /// \todo FIX the API : user *knows* that entry contains a US, - /// the method is supposed to return a double - /// but sends a US ?!? + if( vr == "US" || vr == "SS" ) return ((uint16_t *)BinArea)[id]; else if( vr == "UL" || vr == "SL" ) @@ -544,13 +542,15 @@ void DataEntry::Copy(DocEntry *doc) } /** - * \brief Writes the 'value' area of a DataEntry + * \brief Writes the 'common part' + the 'value' area of a DataEntry * @param fp already open ofstream pointer * @param filetype type of the file (ACR, ImplicitVR, ExplicitVR, ...) */ -void DataEntry::WriteContent(std::ofstream *fp, FileType filetype) +void DataEntry::WriteContent(std::ofstream *fp, FileType filetype, + bool insideMetaElements, bool insideSequence) { - DocEntry::WriteContent(fp, filetype); + // writes the 'common part' + DocEntry::WriteContent(fp, filetype, insideMetaElements, insideSequence); if ( GetGroup() == 0xfffe ) { @@ -651,6 +651,7 @@ uint32_t DataEntry::ComputeFullLength() //----------------------------------------------------------------------------- // Protected + /// \brief Creates a DataEntry owned BinArea /// (remove previous one if any and relevant StrArea if any) void DataEntry::NewBinArea( ) @@ -688,7 +689,9 @@ void DataEntry::DeleteBinArea(void) */ void DataEntry::Print(std::ostream &os, std::string const & ) { - os << "D "; + //os << "D "; + + // First, Print the common part (vr [length offset] name). DocEntry::Print(os); uint16_t g = GetGroup();