From 49509bcba4c65b1fb0c5a1eb8c3eae25e9bbdcd8 Mon Sep 17 00:00:00 2001 From: schaerer Date: Tue, 9 Feb 2010 14:40:55 +0000 Subject: [PATCH] move the ImageTypeManager on the stack, warning still there --- common/clitkImageToImageGenericFilter.h | 11 +++++------ common/clitkImageToImageGenericFilter.txx | 23 +++++++++++------------ 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/common/clitkImageToImageGenericFilter.h b/common/clitkImageToImageGenericFilter.h index caf25f6..eb244b8 100644 --- a/common/clitkImageToImageGenericFilter.h +++ b/common/clitkImageToImageGenericFilter.h @@ -3,8 +3,8 @@ Program: clitk Module: $RCSfile: clitkImageToImageGenericFilter.h,v $ Language: C++ - Date: $Date: 2010/02/09 14:19:28 $ - Version: $Revision: 1.6 $ + Date: $Date: 2010/02/09 14:40:55 $ + Version: $Revision: 1.7 $ Author : Joel Schaerer David Sarrut @@ -131,7 +131,6 @@ namespace clitk { // constructor - destructor ImageToImageGenericFilter(std::string filterName); - virtual ~ImageToImageGenericFilter() { delete mImageTypesManager; } // Main function to call for using the filter. virtual bool Update(); @@ -142,14 +141,14 @@ namespace clitk { protected: // Object that will manage the list of templatized function for // each image type. - ImageTypesManager * mImageTypesManager; + ImageTypesManager mImageTypesManager; }; // end class clitk::ImageToImageGenericFilter // #define ADD_IMAGE_DIMENSION(DIM) Initialize(); -#define ADD_VEC_IMAGE_TYPE(DIM, COMP, PT) this->mImageTypesManager->template AddNewDimensionAndPixelType(); -#define ADD_IMAGE_TYPE(DIM, PT) this->mImageTypesManager->template AddNewDimensionAndPixelType(); +#define ADD_VEC_IMAGE_TYPE(DIM, COMP, PT) this->mImageTypesManager.template AddNewDimensionAndPixelType(); +#define ADD_IMAGE_TYPE(DIM, PT) this->mImageTypesManager.template AddNewDimensionAndPixelType(); #include "clitkImageToImageGenericFilter.txx" diff --git a/common/clitkImageToImageGenericFilter.txx b/common/clitkImageToImageGenericFilter.txx index f68ff21..93f486f 100644 --- a/common/clitkImageToImageGenericFilter.txx +++ b/common/clitkImageToImageGenericFilter.txx @@ -3,8 +3,8 @@ Program: vv Module: $RCSfile: clitkImageToImageGenericFilter.txx,v $ Language: C++ - Date: $Date: 2010/02/09 14:19:28 $ - Version: $Revision: 1.3 $ + Date: $Date: 2010/02/09 14:40:55 $ + Version: $Revision: 1.4 $ Author : Joel Schaerer David Sarrut @@ -56,11 +56,10 @@ typename ImageType::Pointer clitk::ImageToImageGenericFilterBase::GetInput(unsig //-------------------------------------------------------------------- template -clitk::ImageToImageGenericFilter::ImageToImageGenericFilter(std::string filterName) - :ImageToImageGenericFilterBase(filterName){ - // Create main function manager - this->mImageTypesManager = new - ImageTypesManager(static_cast(this)); +clitk::ImageToImageGenericFilter::ImageToImageGenericFilter(std::string filterName) : + ImageToImageGenericFilterBase(filterName), + mImageTypesManager(static_cast(this)) +{ } //-------------------------------------------------------------------- @@ -78,20 +77,20 @@ bool clitk::ImageToImageGenericFilter::Update() { } // Go ! Call the right templatized function - mImageTypesManager->DoIt(mDim, mNbOfComponents, mPixelTypeName); + mImageTypesManager.DoIt(mDim, mNbOfComponents, mPixelTypeName); return true; } //-------------------------------------------------------------------- template bool clitk::ImageToImageGenericFilter::CheckImageType(unsigned int dim,unsigned int ncomp, std::string pixeltype) { - return static_cast(mImageTypesManager->mMapOfImageTypeToFunction[dim][ncomp][pixeltype]); + return static_cast(mImageTypesManager.mMapOfImageTypeToFunction[dim][ncomp][pixeltype]); } template bool clitk::ImageToImageGenericFilter::CheckImageType() { - return static_cast(mImageTypesManager->mMapOfImageTypeToFunction[mDim][mNbOfComponents][mPixelTypeName]); + return static_cast(mImageTypesManager.mMapOfImageTypeToFunction[mDim][mNbOfComponents][mPixelTypeName]); } template @@ -102,8 +101,8 @@ std::string clitk::ImageToImageGenericFilter::GetAvailableImageTypes typedef typename ImageTypesManager::MapOfImageComponentsToFunctionType::const_iterator MCompItType; typedef typename ImageTypesManager::MapOfImageDimensionToFunctionType::const_iterator MDimItType; typedef typename ImageTypesManager::MapOfPixelTypeToFunctionType::const_iterator MPixelItType; - for (MDimItType i=mImageTypesManager->mMapOfImageTypeToFunction.begin(); - i!=mImageTypesManager->mMapOfImageTypeToFunction.end(); + for (MDimItType i=mImageTypesManager.mMapOfImageTypeToFunction.begin(); + i!=mImageTypesManager.mMapOfImageTypeToFunction.end(); i++) { for (MCompItType j=(*i).second.begin(); j!= (*i).second.end(); j++) { for (MPixelItType k=(*j).second.begin(); k!= (*j).second.end(); k++) { -- 2.47.1