X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmSQItem.cxx;h=3180df8a39e0fe853f08ee3a331d24d18e09a98e;hb=7350639601914cd8ab02bfb0d6668c5bf56ce2f4;hp=0431202ca3bbf3c16c1f69236af1d0baa5c45fb6;hpb=ce8913daafe02955368fd2f07e777e86824467cc;p=gdcm.git diff --git a/src/gdcmSQItem.cxx b/src/gdcmSQItem.cxx index 0431202c..3180df8a 100644 --- a/src/gdcmSQItem.cxx +++ b/src/gdcmSQItem.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmSQItem.cxx,v $ Language: C++ - Date: $Date: 2005/01/25 15:44:24 $ - Version: $Revision: 1.60 $ + Date: $Date: 2005/02/01 10:29:56 $ + Version: $Revision: 1.64 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -50,45 +50,7 @@ SQItem::~SQItem() } //----------------------------------------------------------------------------- -// Print -/* - * \brief canonical Printer - * @param os Stream to print to. - * @param indent Indentation string to be prepended during printing. - */ -void SQItem::Print(std::ostream &os, std::string const &) -{ - std::ostringstream s; - - if (SQDepthLevel > 0) - { - for (int i = 0; i < SQDepthLevel; ++i) - { - s << " | " ; - } - } - os << s.str() << " --- SQItem number " << SQItemNumber << std::endl; - for (ListDocEntry::iterator i = DocEntries.begin(); - i != DocEntries.end(); - ++i) - { - DocEntry *Entry = *i; - bool PrintEndLine = true; - - os << s.str(); - Entry->SetPrintLevel(PrintLevel); - Entry->Print(os); - if ( dynamic_cast(Entry) ) - { - PrintEndLine = false; - } - if (PrintEndLine) - { - os << std::endl; - } - } -} - +// Public /* * \brief canonical Writer * @param fp file pointer to an already open file. @@ -138,8 +100,6 @@ void SQItem::WriteContent(std::ofstream *fp, FileType filetype) } -//----------------------------------------------------------------------------- -// Public /** * \brief Remove all entry in the Sequence Item */ @@ -155,13 +115,12 @@ void SQItem::ClearEntry() } /** - * \brief adds any Entry (Dicom Element) to the Sequence Item + * \brief Adds any Entry (Dicom Element) to the Sequence Item * @param entry Entry to add */ bool SQItem::AddEntry(DocEntry *entry) { DocEntries.push_back(entry); - //TODO : check if it worked return true; } @@ -170,7 +129,7 @@ bool SQItem::AddEntry(DocEntry *entry) * @param entryToRemove Entry to remove AND delete. * @return true if the entry was found and removed; false otherwise */ -bool SQItem::RemoveEntry( DocEntry* entryToRemove) +bool SQItem::RemoveEntry( DocEntry *entryToRemove) { for(ListDocEntry::iterator it = DocEntries.begin(); it != DocEntries.end(); @@ -193,7 +152,7 @@ bool SQItem::RemoveEntry( DocEntry* entryToRemove) * @param entryToRemove Entry to remove. * @return true if the entry was found and removed; false otherwise */ -bool SQItem::RemoveEntryNoDestroy(DocEntry* entryToRemove) +bool SQItem::RemoveEntryNoDestroy(DocEntry *entryToRemove) { for(ListDocEntry::iterator it = DocEntries.begin(); it != DocEntries.end(); @@ -216,7 +175,7 @@ bool SQItem::RemoveEntryNoDestroy(DocEntry* entryToRemove) * \brief Get the first Dicom entry while visiting the SQItem * \return The first DocEntry if found, otherwhise 0 */ -DocEntry * SQItem::GetFirstEntry() +DocEntry *SQItem::GetFirstEntry() { ItDocEntries = DocEntries.begin(); if (ItDocEntries != DocEntries.end()) @@ -230,18 +189,15 @@ DocEntry * SQItem::GetFirstEntry() */ DocEntry *SQItem::GetNextEntry() { - // gdcmAssertMacro (ItDocEntries != DocEntries.end()); - { - ++ItDocEntries; - if (ItDocEntries != DocEntries.end()) - return *ItDocEntries; - return NULL; - } + ++ItDocEntries; + if (ItDocEntries != DocEntries.end()) + return *ItDocEntries; + return NULL; } /** * \brief Gets a Dicom Element inside a SQ Item Entry - * @param group Group number of the Entry + * @param group Group number of the Entry * @param elem Element number of the Entry * @return Entry whose (group,elem) was passed. 0 if not found */ @@ -250,7 +206,7 @@ DocEntry *SQItem::GetDocEntry(uint16_t group, uint16_t elem) for(ListDocEntry::iterator i = DocEntries.begin(); i != DocEntries.end(); ++i) { - if ( (*i)->GetGroup()==group && (*i)->GetElement()==elem ) + if ( (*i)->GetGroup() == group && (*i)->GetElement() == elem ) return *i; } return NULL; @@ -262,7 +218,45 @@ DocEntry *SQItem::GetDocEntry(uint16_t group, uint16_t elem) //----------------------------------------------------------------------------- // Private - //----------------------------------------------------------------------------- +// Print +/* + * \brief canonical Printer + * @param os Stream to print to. + * @param indent Indentation string to be prepended during printing. + */ +void SQItem::Print(std::ostream &os, std::string const &) +{ + std::ostringstream s; + if (SQDepthLevel > 0) + { + for (int i = 0; i < SQDepthLevel; ++i) + { + s << " | " ; + } + } + os << s.str() << " --- SQItem number " << SQItemNumber << std::endl; + for (ListDocEntry::iterator i = DocEntries.begin(); + i != DocEntries.end(); + ++i) + { + DocEntry *Entry = *i; + bool PrintEndLine = true; + + os << s.str(); + Entry->SetPrintLevel(PrintLevel); + Entry->Print(os); + if ( dynamic_cast(Entry) ) + { + PrintEndLine = false; + } + if (PrintEndLine) + { + os << std::endl; + } + } +} + +//----------------------------------------------------------------------------- } // end namespace gdcm