[opengtl-commits] [593] * assert for nb of channels

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


Revision: 593
Author:   cyrille
Date:     2009-03-09 11:01:15 +0100 (Mon, 09 Mar 2009)

Log Message:
-----------
* assert for nb of channels
* fix bug in KernelsCollection when number of channels was set after kernels get loaded

Modified Paths:
--------------
    trunk/OpenGTL/OpenGTL/GTLCore/TypesManager.cpp
    trunk/OpenGTL/OpenShiva/OpenShiva/KernelsCollection.cpp
    trunk/OpenGTL/OpenShiva/OpenShiva/Library.cpp
    trunk/OpenGTL/OpenShiva/OpenShiva/Wrapper_p.cpp


Modified: trunk/OpenGTL/OpenGTL/GTLCore/TypesManager.cpp
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/TypesManager.cpp	2009-03-07 20:12:39 UTC (rev 592)
+++ trunk/OpenGTL/OpenGTL/GTLCore/TypesManager.cpp	2009-03-09 10:01:15 UTC (rev 593)
@@ -77,6 +77,7 @@
 const GTLCore::Type* TypesManager::getVector( const GTLCore::Type* _type, int _size )
 {
   GTL_ASSERT( _type );
+  GTL_ASSERT( _size > 0 );
   std::map< const GTLCore::Type*, std::map< int, const GTLCore::Type* > >::const_iterator it
       = TypesManager::Private::knownVectors.find( _type );
   const GTLCore::Type*& type = TypesManager::Private::knownVectors[ _type ][ _size ];

Modified: trunk/OpenGTL/OpenShiva/OpenShiva/KernelsCollection.cpp
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/KernelsCollection.cpp	2009-03-07 20:12:39 UTC (rev 592)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/KernelsCollection.cpp	2009-03-09 10:01:15 UTC (rev 593)
@@ -26,6 +26,7 @@
 #include "GTLCore/Macros_p.h"
 #include "GTLCore/Utils_p.h"
 
+#include "Debug.h"
 #include "Kernel.h"
 
 using namespace OpenShiva;
@@ -54,8 +55,9 @@
 
 KernelsCollection::KernelsCollection(int _channelsNb ) : d(new Private)
 {
+  GTL_ASSERT( _channelsNb > 0);
+  d->channelsNb = _channelsNb;
   addDirectory( _OPENSHIVA_SHIVA_KERNELS_DIR_ );
-  d->channelsNb = _channelsNb;
   d->addDirectory( llvm::sys::Path::GetUserHomeDirectory() );
 }
 

Modified: trunk/OpenGTL/OpenShiva/OpenShiva/Library.cpp
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/Library.cpp	2009-03-07 20:12:39 UTC (rev 592)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/Library.cpp	2009-03-09 10:01:15 UTC (rev 593)
@@ -102,6 +102,7 @@
 
 Library::Library( bool _isKernel , int _channelsNb) : d(new Private)
 {
+  GTL_ASSERT(_channelsNb > 0);
   d->name = "";
   d->compiled = false;
   d->moduleProvider = 0;

Modified: trunk/OpenGTL/OpenShiva/OpenShiva/Wrapper_p.cpp
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/Wrapper_p.cpp	2009-03-07 20:12:39 UTC (rev 592)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/Wrapper_p.cpp	2009-03-09 10:01:15 UTC (rev 593)
@@ -103,6 +103,7 @@
 
 void Wrapper::fillTypesManager( GTLCore::ModuleData* _module, GTLCore::TypesManager* _typesManager, GTLCore::ConvertCenter* _convertCenter, int _channels )
 {
+  GTL_ASSERT(_channels > 0 );
   SHIVA_DEBUG("fillTypesManager");
   _convertCenter->addConvertExpressionFactory(new PixelConvertExpressionFactory);
   for( int i = 1; i <= 5; ++i)


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