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
}
//-----------------------------------------------------------------------------
-// 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<SeqEntry*>(Entry) )
- {
- PrintEndLine = false;
- }
- if (PrintEndLine)
- {
- os << std::endl;
- }
- }
-}
-
+// Public
/*
* \brief canonical Writer
* @param fp file pointer to an already open file.
}
-//-----------------------------------------------------------------------------
-// Public
/**
* \brief Remove all entry in the Sequence Item
*/
}
/**
- * \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;
}
* @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();
* @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();
* \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())
*/
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
*/
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;
//-----------------------------------------------------------------------------
// 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<SeqEntry*>(Entry) )
+ {
+ PrintEndLine = false;
+ }
+ if (PrintEndLine)
+ {
+ os << std::endl;
+ }
+ }
+}
+
+//-----------------------------------------------------------------------------
} // end namespace gdcm