[opengtl-commits] [208] add a function which tell if all channels of a PixelDescription have the same type

[ Thread Index | Date Index | More lists.tuxfamily.org/opengtl-commits Archives ]


Revision: 208
Author:   cyrille
Date:     2008-06-21 00:55:45 +0200 (Sat, 21 Jun 2008)

Log Message:
-----------
add a function which tell if all channels of a PixelDescription have the same type

Modified Paths:
--------------
    trunk/OpenGTL/OpenGTL/GTLCore/PixelDescription.cpp
    trunk/OpenGTL/OpenGTL/GTLCore/PixelDescription.h


Modified: trunk/OpenGTL/OpenGTL/GTLCore/PixelDescription.cpp
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/PixelDescription.cpp	2008-06-20 22:46:39 UTC (rev 207)
+++ trunk/OpenGTL/OpenGTL/GTLCore/PixelDescription.cpp	2008-06-20 22:55:45 UTC (rev 208)
@@ -78,6 +78,18 @@
   return d->channelsType.size();
 }
 
+bool PixelDescription::sameTypeChannels() const
+{
+  const Type* _type = *d->channelsType.begin();
+  for( std::vector<const Type*>::const_iterator it = d->channelsType.begin();
+       it != d->channelsType.end(); ++it)
+  {
+    if( _type != *it )
+      return false;
+  }
+  return true;
+}
+
 int PixelDescription::bitsSize() const
 {
   return d->bitsSize;

Modified: trunk/OpenGTL/OpenGTL/GTLCore/PixelDescription.h
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/PixelDescription.h	2008-06-20 22:46:39 UTC (rev 207)
+++ trunk/OpenGTL/OpenGTL/GTLCore/PixelDescription.h	2008-06-20 22:55:45 UTC (rev 208)
@@ -54,6 +54,10 @@
        */
       int channels() const;
       /**
+       * @return true if all channels have the same type
+       */
+      bool sameTypeChannels() const;
+      /**
        * @return the size of a pixel in bits
        */
       int bitsSize() const;


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/