X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmSegmentedPalette.h;h=1a53fa745138d9a1fed40664b61a0f49f156a7b0;hb=6278320cc85da00d2d56ffbf07806e84966892c3;hp=8ece56e685d9a61e15608c228e583d2662ed4b3c;hpb=7d053a1c9687bb325d83693279417ec0215d943a;p=gdcm.git diff --git a/src/gdcmSegmentedPalette.h b/src/gdcmSegmentedPalette.h index 8ece56e6..1a53fa74 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/26 09:00:31 $ - Version: $Revision: 1.13 $ + Date: $Date: 2007/11/13 09:37:22 $ + Version: $Revision: 1.20 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -36,7 +36,7 @@ // And both were coming from a ALOKA SSD-4000 station // // JPRx : -// It compiles fine under gcc 4.1.2 and msvc 7 +// It compiles fine under gcc 4.1.2, msvc 7 and DarwinG5-g++ // It doesn't compile on msvc 6, borland and SunOS // Any fix welcome ! @@ -54,13 +54,26 @@ #define GDCM_TYPENAME typename #endif +// Hack for Borland +#if (defined(_MSC_VER) && (_MSC_VER < 1310)) || defined(__BORLANDC__) +#define GDCM_TYPENAME2 +#else +#define GDCM_TYPENAME2 typename +#endif + + namespace GDCM_NAME_SPACE { -// Long stody short: Sun compiler only provide the second interface of std::distance, since the implemenation -// is so trivial, I'd rather redo it myself. +// Long stody short: Sun compiler only provide the second interface of +// std::distance, since the implementation is so trivial, I'd rather redo it myself. // Ref: // http://www.sgi.com/tech/stl/distance.html#2 -// The second version of distance was the one defined in the original STL, and the first version is the one defined in the draft C++ standard; the definition was changed because the older interface was clumsy and error-prone. The older interface required the use of a temporary variable, and it has semantics that are somewhat nonintuitive: it increments n by the distance from first to last, rather than storing that distance in n +// The second version of distance was the one defined in the original STL, and +// the first version is the one defined in the draft C++ standard; the definition +// was changed because the older interface was clumsy and error-prone. +// The older interface required the use of a temporary variable, and it has semantics +// that are somewhat nonintuitive: it increments n by the distance from first to last, +// rather than storing that distance in n template inline int32_t mydistance(InputIterator first, InputIterator last) @@ -78,11 +91,11 @@ namespace GDCM_NAME_SPACE template class Segment { public: - typedef std::map SegmentMap; + typedef std::map SegmentMap; virtual bool Expand(const SegmentMap& instances, std::vector& expanded) const = 0; const EntryType* First() const { return _first; } - const EntryType* Last() const { return _last; } + const EntryType* Last() const { return _last; } struct ToMap { typename SegmentMap::value_type operator()(const Segment* segment) const @@ -100,7 +113,9 @@ namespace GDCM_NAME_SPACE template class DiscreteSegment : public Segment { public: +#if !defined(__sun__) typedef typename Segment::SegmentMap SegmentMap; +#endif DiscreteSegment(const EntryType* first) : Segment(first, first+2+*(first+1)) {} virtual bool Expand(const SegmentMap&, @@ -115,7 +130,9 @@ namespace GDCM_NAME_SPACE template class LinearSegment : public Segment { public: +#if !defined(__sun__) typedef typename Segment::SegmentMap SegmentMap; +#endif LinearSegment(const EntryType* first) : Segment(first, first+3) {} virtual bool Expand(const SegmentMap&, @@ -144,7 +161,9 @@ namespace GDCM_NAME_SPACE template class IndirectSegment : public Segment { public: +#if !defined(__sun__) typedef typename Segment::SegmentMap SegmentMap; +#endif IndirectSegment(const EntryType* first) : Segment(first, first+2+4/sizeof(EntryType)) {} virtual bool Expand(const SegmentMap& instances, @@ -206,7 +225,7 @@ namespace GDCM_NAME_SPACE } GDCM_TYPENAME Segment::SegmentMap instances; std::transform(segments.begin(), segments.end(), - std::inserter(instances, instances.end()), GDCM_TYPENAME Segment::ToMap()); + std::inserter(instances, instances.end()), GDCM_TYPENAME2 Segment::ToMap()); GDCM_TYPENAME SegmentList::iterator ppSeg = segments.begin(); GDCM_TYPENAME SegmentList::iterator endOfSegments = segments.end(); for ( ; ppSeg != endOfSegments; ++ppSeg ) {