[opengtl-commits] [288] add debug stream function for Region and PixelDescription

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


Revision: 288
Author:   cyrille
Date:     2008-07-02 00:18:47 +0200 (Wed, 02 Jul 2008)

Log Message:
-----------
add debug stream function for Region and PixelDescription

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


Modified: trunk/OpenGTL/OpenGTL/GTLCore/Debug.cpp
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/Debug.cpp	2008-07-01 22:18:18 UTC (rev 287)
+++ trunk/OpenGTL/OpenGTL/GTLCore/Debug.cpp	2008-07-01 22:18:47 UTC (rev 288)
@@ -26,6 +26,8 @@
 #include <llvm/System/Path.h>
 
 #include "Macros_p.h"
+#include "PixelDescription.h"
+#include "Region.h"
 #include "ScopedName.h"
 #include "Token_p.h"
 #include "Type.h"
@@ -221,7 +223,32 @@
 #endif
 
 namespace GTLCore {
+  std::ostream& operator<< (std::ostream& _ostr, const PixelDescription& _pixelDescription)
+  {
+    _ostr << "[";
+    if( _pixelDescription.sameTypeChannels() )
+    {
+      _ostr << _pixelDescription.channels() << " x " << *_pixelDescription.channelTypes()[0];
+    } else {
+      for( int i = 0; i < _pixelDescription.channels(); ++i)
+      {
+        _ostr << *_pixelDescription.channelTypes()[i];
+        if( i != _pixelDescription.channels() - 1 )
+        {
+          _ostr << ", ";
+        }
+      }
+    }
+    _ostr << "]";
+    return _ostr;
+  }
   
+  std::ostream& operator<< (std::ostream& ostr, const Region& region)
+  {
+    ostr << "[" << region.x() << "," << region.y() << "," << region.width() << "," << region.height() << "]" ;
+    return ostr;
+  }
+  
   std::ostream& operator<< (std::ostream& ostr, const GTLCore::ScopedName& name)
   {
     return ostr <<name.toString() ;
@@ -293,3 +320,4 @@
   }
 
 }
+

Modified: trunk/OpenGTL/OpenGTL/GTLCore/Debug.h
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/Debug.h	2008-07-01 22:18:18 UTC (rev 287)
+++ trunk/OpenGTL/OpenGTL/GTLCore/Debug.h	2008-07-01 22:18:47 UTC (rev 288)
@@ -38,10 +38,14 @@
     private:
       struct Private;
   };
+  class PixelDescription;
+  class Region;
   class ScopedName;
   class Type;
   class Token;
 
+  std::ostream& operator<< (std::ostream& ostr, const PixelDescription& pixelDescription);
+  std::ostream& operator<< (std::ostream& ostr, const Region& region);
   std::ostream& operator<< (std::ostream& ostr, const ScopedName& name);
   std::ostream& operator<< (std::ostream& ostr, const Type& type);
   std::ostream& operator<< (std::ostream& ostr, const Token& token);


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