From: malaterre Date: Wed, 24 Oct 2007 07:15:32 +0000 (+0000) Subject: ENH: second attempt at getting VS6 to compile templated code X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=4249e0d6fb6942a1b221a74f42bff4acd773105d;p=gdcm.git ENH: second attempt at getting VS6 to compile templated code --- diff --git a/src/gdcmSegmentedPalette.h b/src/gdcmSegmentedPalette.h index a0f1ac2d..2a7d7119 100644 --- a/src/gdcmSegmentedPalette.h +++ b/src/gdcmSegmentedPalette.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmSegmentedPalette.h,v $ Language: C++ - Date: $Date: 2007/10/23 14:48:26 $ - Version: $Revision: 1.10 $ + Date: $Date: 2007/10/24 07:15:32 $ + Version: $Revision: 1.11 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -23,7 +23,7 @@ #include "gdcmTagKey.h" #include "gdcmDataEntry.h" -// Ref: +// Notepad from Satomi Takeo: // http://blog.goo.ne.jp/satomi_takeo/e/3643e5249b2a9650f9e10ef1c830e8b8 // I bet the code was compiled on VS6. Make it compile on other platform: // * typedef are not inherited @@ -49,7 +49,7 @@ // Hack for VS6 #if defined(_MSC_VER) && (_MSC_VER < 1310) -#define GDCM_TYPENAME class +#define GDCM_TYPENAME #else #define GDCM_TYPENAME typename #endif @@ -57,7 +57,7 @@ namespace GDCM_NAME_SPACE { // abstract class for segment. - template + template class Segment { public: typedef std::map SegmentMap; @@ -82,7 +82,7 @@ namespace GDCM_NAME_SPACE }; // discrete segment (opcode = 0) - template + template class DiscreteSegment : public Segment { public: typedef typename Segment::SegmentMap SegmentMap; @@ -97,7 +97,7 @@ namespace GDCM_NAME_SPACE }; // linear segment (opcode = 1) - template + template class LinearSegment : public Segment { public: typedef typename Segment::SegmentMap SegmentMap; @@ -126,7 +126,7 @@ namespace GDCM_NAME_SPACE }; // indirect segment (opcode = 2) - template + template class IndirectSegment : public Segment { public: typedef typename Segment::SegmentMap SegmentMap; @@ -146,13 +146,13 @@ namespace GDCM_NAME_SPACE = (*pOffset) | (static_cast(*(pOffset + 1)) << 16); const EntryType* copied_part_head = first_segment + offsetBytes / sizeof(EntryType); - typename SegmentMap::const_iterator ppHeadSeg = instances.find(copied_part_head); + GDCM_TYPENAME SegmentMap::const_iterator ppHeadSeg = instances.find(copied_part_head); if ( ppHeadSeg == instances.end() ) { // referred segment not found return false; } EntryType nNumCopies = *(this->_first + 1); - typename SegmentMap::const_iterator ppSeg = ppHeadSeg; + GDCM_TYPENAME SegmentMap::const_iterator ppSeg = ppHeadSeg; while ( std::distance(ppHeadSeg, ppSeg) < nNumCopies ) { assert( ppSeg != instances.end() ); ppSeg->second->Expand(instances, expanded); @@ -162,7 +162,7 @@ namespace GDCM_NAME_SPACE } }; - template + template void ExpandPalette(const EntryType* raw_values, uint32_t length, std::vector& palette) { @@ -186,11 +186,11 @@ namespace GDCM_NAME_SPACE break; } } - typename Segment::SegmentMap instances; + GDCM_TYPENAME Segment::SegmentMap instances; std::transform(segments.begin(), segments.end(), - std::inserter(instances, instances.end()), typename Segment::ToMap()); - typename SegmentList::iterator ppSeg = segments.begin(); - typename SegmentList::iterator endOfSegments = segments.end(); + std::inserter(instances, instances.end()), GDCM_TYPENAME Segment::ToMap()); + GDCM_TYPENAME SegmentList::iterator ppSeg = segments.begin(); + GDCM_TYPENAME SegmentList::iterator endOfSegments = segments.end(); for ( ; ppSeg != endOfSegments; ++ppSeg ) { (*ppSeg)->Expand(instances, palette); }