From e9fee33d4fe77ece33a62f08f30d7b144af0a45b Mon Sep 17 00:00:00 2001 From: malaterre Date: Mon, 25 Oct 2004 03:03:44 +0000 Subject: [PATCH] STYLE: ivars should start with a capital letter. Accessors should be const to avoid people starting modifying stuff (since this is a ref). remove virtual as style specify sub class shouldn't reuse the keyword --- src/gdcmDocument.cxx | 8 +++---- src/gdcmSeqEntry.cxx | 51 ++++++++++++++++++++++++++------------------ src/gdcmSeqEntry.h | 23 ++++++++++---------- src/gdcmValEntry.h | 10 ++++----- 4 files changed, 51 insertions(+), 41 deletions(-) diff --git a/src/gdcmDocument.cxx b/src/gdcmDocument.cxx index 25fac9de..0147cc47 100644 --- a/src/gdcmDocument.cxx +++ b/src/gdcmDocument.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDocument.cxx,v $ Language: C++ - Date: $Date: 2004/10/24 03:33:40 $ - Version: $Revision: 1.111 $ + Date: $Date: 2004/10/25 03:03:44 $ + Version: $Revision: 1.112 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -2940,7 +2940,7 @@ void Document::BuildFlatHashTableRecurse( TagDocEntryHT& builtHT, DocEntry* entry = i->second; if ( SeqEntry* seqEntry = dynamic_cast(entry) ) { - ListSQItem& items = seqEntry->GetSQItems(); + const ListSQItem& items = seqEntry->GetSQItems(); for( ListSQItem::const_iterator item = items.begin(); item != items.end(); ++item) @@ -2964,7 +2964,7 @@ void Document::BuildFlatHashTableRecurse( TagDocEntryHT& builtHT, DocEntry* entry = *i; if ( SeqEntry* seqEntry = dynamic_cast(entry) ) { - ListSQItem& items = seqEntry->GetSQItems(); + const ListSQItem& items = seqEntry->GetSQItems(); for( ListSQItem::const_iterator item = items.begin(); item != items.end(); ++item) diff --git a/src/gdcmSeqEntry.cxx b/src/gdcmSeqEntry.cxx index bb513559..88e79a62 100644 --- a/src/gdcmSeqEntry.cxx +++ b/src/gdcmSeqEntry.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmSeqEntry.cxx,v $ Language: C++ - Date: $Date: 2004/10/22 03:05:42 $ - Version: $Revision: 1.32 $ + Date: $Date: 2004/10/25 03:03:45 $ + Version: $Revision: 1.33 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -42,8 +42,8 @@ SeqEntry::SeqEntry( DictEntry* e ) ReadLength = 0xffffffff; SQDepthLevel = -1; - delimitor_mode = false; - seq_term = NULL; + DelimitorMode = false; + SeqTerm = NULL; } /** @@ -65,13 +65,16 @@ SeqEntry::SeqEntry( DocEntry* e, int depth ) /** * \brief Canonical destructor. */ -SeqEntry::~SeqEntry() { - for(ListSQItem::iterator cc = items.begin();cc != items.end();++cc) +SeqEntry::~SeqEntry() +{ + for(ListSQItem::iterator cc = Items.begin(); cc != Items.end(); ++cc) { delete *cc; } - if (!seq_term) - delete seq_term; + if (!SeqTerm) + { + delete SeqTerm; + } } /** @@ -88,20 +91,21 @@ void SeqEntry::Print( std::ostream &os ) return; // Then, Print each SQ Item - for(ListSQItem::iterator cc = items.begin();cc != items.end();++cc) + for(ListSQItem::iterator cc = Items.begin(); cc != Items.end(); ++cc) { (*cc)->Print(os); } // at end, print the sequence terminator item, if any - if (delimitor_mode) { + if (DelimitorMode) + { for ( int i = 0; i < SQDepthLevel; i++ ) { os << " | " ; } - if (seq_term != NULL) + if (SeqTerm != NULL) { - seq_term->Print(os); + SeqTerm->Print(os); os << std::endl; } else @@ -125,8 +129,8 @@ void SeqEntry::Write(std::ofstream* fp, FileType filetype) //uint16_t item_term_el = 0xe00d; DocEntry::Write(fp, filetype); - for(ListSQItem::iterator cc = GetSQItems().begin(); - cc != GetSQItems().end(); + for(ListSQItem::iterator cc = Items.begin(); + cc != Items.end(); ++cc) { (*cc)->Write(fp, filetype); @@ -146,7 +150,7 @@ void SeqEntry::Write(std::ofstream* fp, FileType filetype) void SeqEntry::AddEntry(SQItem *sqItem, int itemNumber) { sqItem->SetSQItemNumber(itemNumber); - items.push_back(sqItem); + Items.push_back(sqItem); } /** @@ -158,15 +162,20 @@ void SeqEntry::AddEntry(SQItem *sqItem, int itemNumber) SQItem* SeqEntry::GetSQItemByOrdinalNumber(int nb) { if (nb<0) - return (*(items.begin())); + { + return *(Items.begin()); + } int count = 0 ; - for(ListSQItem::iterator cc = items.begin(); - cc != items.end(); - count ++, ++cc){ - if (count==nb) + for(ListSQItem::iterator cc = Items.begin(); + cc != Items.end(); + count ++, ++cc) + { + if (count == nb) + { return *cc; + } } - return (*(items.end())); // Euhhhhh ?!? Is this the last one . FIXME + return *(Items.end()); // Euhhhhh ?!? Is this the last one . FIXME } //----------------------------------------------------------------------------- // Protected diff --git a/src/gdcmSeqEntry.h b/src/gdcmSeqEntry.h index fd016fe0..e23657f9 100644 --- a/src/gdcmSeqEntry.h +++ b/src/gdcmSeqEntry.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmSeqEntry.h,v $ Language: C++ - Date: $Date: 2004/10/22 03:05:42 $ - Version: $Revision: 1.21 $ + Date: $Date: 2004/10/25 03:03:45 $ + Version: $Revision: 1.22 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -34,41 +34,42 @@ class GDCM_EXPORT SeqEntry : public DocEntry public: SeqEntry( DictEntry* ); SeqEntry(DocEntry* d, int depth); - virtual ~SeqEntry(); + ~SeqEntry(); virtual void Print(std::ostream &os = std::cout); virtual void Write(std::ofstream *fp, FileType); /// returns the SQITEM chained List for this SeQuence. - ListSQItem &GetSQItems() { return items; } + ListSQItem const & GetSQItems() const { return Items; } /// Sets the delimitor mode - void SetDelimitorMode(bool dm) { delimitor_mode = dm;} + void SetDelimitorMode(bool dm) { DelimitorMode = dm;} /// Sets the Sequence Delimitation Item - void SetSequenceDelimitationItem(DocEntry * e) { seq_term = e;} + void SetSequenceDelimitationItem(DocEntry * e) { SeqTerm = e;} void AddEntry(SQItem *it, int itemNumber); SQItem *GetSQItemByOrdinalNumber(int itemNumber); /// Gets the depth level - int GetDepthLevel() { return SQDepthLevel; } - + int GetDepthLevel() const { return SQDepthLevel; } + /// Sets the depth level of a Sequence Entry embedded in a SeQuence void SetDepthLevel(int depth) { SQDepthLevel = depth; } + protected: private: // Variables /// If this Sequence is in delimitor mode (length =0xffffffff) or not - bool delimitor_mode; + bool DelimitorMode; /// Chained list of SQ Items - ListSQItem items; + ListSQItem Items; /// sequence terminator item - DocEntry *seq_term; + DocEntry *SeqTerm; /// \brief Defines the depth level of this \ref SeqEntry inside /// the (optionaly) nested sequences. \ref SQDepthLevel diff --git a/src/gdcmValEntry.h b/src/gdcmValEntry.h index 653abadf..a249dbd2 100644 --- a/src/gdcmValEntry.h +++ b/src/gdcmValEntry.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmValEntry.h,v $ Language: C++ - Date: $Date: 2004/10/22 03:05:42 $ - Version: $Revision: 1.27 $ + Date: $Date: 2004/10/25 03:03:45 $ + Version: $Revision: 1.28 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -21,9 +21,9 @@ #include "gdcmDocEntry.h" #include + namespace gdcm { - //----------------------------------------------------------------------------- /** * \ingroup ValEntry @@ -40,7 +40,7 @@ public: /// \brief Returns the 'Value' (e.g. "Dupond Marcel") converted into a /// 'string', if it's stored as an integer in the header of the /// current Dicom Document Entry - std::string & GetValue() { return Value; }; + std::string const & GetValue() const { return Value; }; /// Sets the value (string) of the current Dicom Document Entry void SetValue(std::string const & val) { Value = val; }; @@ -56,7 +56,7 @@ private: /// \brief Document Entry value, internaly represented as a std::string /// The Value Representation (\ref VR) is independently used /// in order to interpret (decode) this field. - std::string Value; + std::string Value; }; } // end namespace gdcm -- 2.48.1