From: Leonardo Florez-Valencia Date: Wed, 31 Dec 2014 10:05:47 +0000 (+0100) Subject: Some syntax simplifations X-Git-Tag: v0.1~424^2 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=bc3afa8dc27d197bbe334c0b6f8650e7be435b6f;p=cpPlugins.git Some syntax simplifations --- diff --git a/cmake/cpPluginsConfig.cmake.in b/cmake/cpPluginsConfig.cmake.in index 23f0a89..e7ae468 100644 --- a/cmake/cpPluginsConfig.cmake.in +++ b/cmake/cpPluginsConfig.cmake.in @@ -31,10 +31,22 @@ FIND_PATH( @CMAKE_INSTALL_PREFIX@/include ) +FIND_PATH( + cpPlugins_INCLUDE_DIR4 + Pluma/cpPlugins_Pluma_Export.h + PATHS + /usr/include + /usr/local/include + @PROJECT_SOURCE_DIR@/lib/third_party + @PROJECT_BINARY_DIR@/lib/third_party + @CMAKE_INSTALL_PREFIX@/include + ) + INCLUDE_DIRECTORIES( ${cpPlugins_INCLUDE_DIR1} ${cpPlugins_INCLUDE_DIR2} ${cpPlugins_INCLUDE_DIR3} + ${cpPlugins_INCLUDE_DIR4} ) FIND_LIBRARY( diff --git a/lib/cpPlugins/Interface/Image.cxx b/lib/cpPlugins/Interface/Image.cxx index 23cea6e..c72663d 100644 --- a/lib/cpPlugins/Interface/Image.cxx +++ b/lib/cpPlugins/Interface/Image.cxx @@ -17,7 +17,9 @@ // ------------------------------------------------------------------------- #define cpPlugins_Image_RGB( p, d, o, f ) \ - if( dynamic_cast< itk::Image< itk::RGBPixel< p >, d >* >( o ) != NULL ) \ + if( \ + dynamic_cast< itk::Image< itk::RGBPixel< p >, d >* >( o ) != NULL \ + ) \ this->f< itk::RGBPixel< p >, d >( ) // ------------------------------------------------------------------------- diff --git a/lib/cpPlugins/Interface/Mesh.h b/lib/cpPlugins/Interface/Mesh.h index 241da35..a1f0677 100644 --- a/lib/cpPlugins/Interface/Mesh.h +++ b/lib/cpPlugins/Interface/Mesh.h @@ -47,10 +47,6 @@ namespace cpPlugins Self& operator=( const Self& ); protected: - /* - itk::ProcessObject::Pointer m_Mesh2VTKMeshData; - vtkMeshData* m_VTKMeshData; - */ vtkMapper* m_Mapper; }; diff --git a/lib/cpPlugins/Interface/Object.cxx b/lib/cpPlugins/Interface/Object.cxx index 3868b2c..1792a50 100644 --- a/lib/cpPlugins/Interface/Object.cxx +++ b/lib/cpPlugins/Interface/Object.cxx @@ -28,6 +28,6 @@ cpPlugins::Interface::Object:: } // ------------------------------------------------------------------------- -PLUMA_PROVIDER_SOURCE( cpPlugins::Interface::Object, 1, 1 ); +CPPLUGINS_PROVIDER_SOURCE( cpPlugins::Interface::Object, 1, 1 ); // eof - $RCSfile$ diff --git a/lib/cpPlugins/Interface/Object.h b/lib/cpPlugins/Interface/Object.h index b15d1f0..fe86f1b 100644 --- a/lib/cpPlugins/Interface/Object.h +++ b/lib/cpPlugins/Interface/Object.h @@ -8,7 +8,7 @@ #include // ------------------------------------------------------------------------- -#define PLUMA_PROVIDER_HEADER_BEGIN_CPPLUGINS( TYPE ) \ +#define CPPLUGINS_PROVIDER_HEADER_BEGIN( TYPE ) \ class cpPlugins_Interface_EXPORT TYPE##Provider \ : public pluma::Provider \ { \ @@ -24,26 +24,30 @@ { return( PLUMA_INTERFACE_VERSION ); } // ------------------------------------------------------------------------- -#define PLUMA_PROVIDER_HEADER_END_CPPLUGINS }; +#define CPPLUGINS_PROVIDER_HEADER_END }; // ------------------------------------------------------------------------- -#define PLUMA_PROVIDER_HEADER_CPPLUGINS( TYPE ) \ - PLUMA_PROVIDER_HEADER_BEGIN_CPPLUGINS( TYPE ) \ - virtual TYPE::Pointer create( ) const = 0; \ - PLUMA_PROVIDER_HEADER_END_CPPLUGINS +#define CPPLUGINS_PROVIDER_HEADER( TYPE ) \ + CPPLUGINS_PROVIDER_HEADER_BEGIN( TYPE ) \ + virtual TYPE::Pointer create( ) const = 0; \ + CPPLUGINS_PROVIDER_HEADER_END // ------------------------------------------------------------------------- -#define PLUMA_INHERIT_PROVIDER_CPPLUGINS( TYPE, SUPER ) \ - class TYPE##Provider \ - : public SUPER##Provider \ - { \ - public: \ - SUPER::Pointer create( ) const \ - { \ - TYPE::Pointer a = TYPE::New( ); \ - SUPER::Pointer b = a.GetPointer( ); \ - return( b ); \ - } \ +#define CPPLUGINS_PROVIDER_SOURCE( TYPE, Version, LowestVersion ) \ + PLUMA_PROVIDER_SOURCE( TYPE, Version, LowestVersion ) + +// ------------------------------------------------------------------------- +#define CPPLUGINS_INHERIT_PROVIDER( TYPE ) \ + class TYPE##Provider \ + : public cpPlugins::Interface::ObjectProvider \ + { \ + public: \ + cpPlugins::Interface::Object::Pointer create( ) const \ + { \ + TYPE::Pointer a = TYPE::New( ); \ + cpPlugins::Interface::Object::Pointer b = a.GetPointer( ); \ + return( b ); \ + } \ }; namespace cpPlugins @@ -79,8 +83,10 @@ namespace cpPlugins Self& operator=( const Self& ); }; - // TODO: doc - PLUMA_PROVIDER_HEADER_CPPLUGINS( Object ); + /** + * Plugin provider + */ + CPPLUGINS_PROVIDER_HEADER( Object ); } // ecapseman diff --git a/lib/cpPlugins/Interface/PolyLineParametricPath.cxx b/lib/cpPlugins/Interface/PolyLineParametricPath.cxx index 23fa0c7..37be8af 100644 --- a/lib/cpPlugins/Interface/PolyLineParametricPath.cxx +++ b/lib/cpPlugins/Interface/PolyLineParametricPath.cxx @@ -81,13 +81,13 @@ _VTK( itk::DataObject* ref_image ) image->TransformContinuousIndexToPhysicalPoint( idx, pnt ); x = double( pnt[ 0 ] ); y = double( pnt[ 1 ] ); - z = ( D == 3 )? double( pnt[ 2 ] ): double( 0 ); + z = ( D >= 3 )? double( pnt[ 2 ] ): double( 0 ); } else { x = double( idx[ 0 ] ); y = double( idx[ 1 ] ); - z = ( D == 3 )? double( idx[ 2 ] ): double( 0 ); + z = ( D >= 3 )? double( idx[ 2 ] ): double( 0 ); } // fi points->InsertNextPoint( x, y, z ); diff --git a/lib/cpPlugins/Plugins/ImageReader.h b/lib/cpPlugins/Plugins/ImageReader.h index 2c73d70..b16cf0e 100644 --- a/lib/cpPlugins/Plugins/ImageReader.h +++ b/lib/cpPlugins/Plugins/ImageReader.h @@ -49,10 +49,7 @@ namespace cpPlugins }; // --------------------------------------------------------------------- - PLUMA_INHERIT_PROVIDER_CPPLUGINS( - ImageReader, - cpPlugins::Interface::Object - ); + CPPLUGINS_INHERIT_PROVIDER( ImageReader ); } // ecapseman diff --git a/lib/cpPlugins/Plugins/ImageSeriesReader.h b/lib/cpPlugins/Plugins/ImageSeriesReader.h index 9bd9bc2..7577b67 100644 --- a/lib/cpPlugins/Plugins/ImageSeriesReader.h +++ b/lib/cpPlugins/Plugins/ImageSeriesReader.h @@ -49,10 +49,7 @@ namespace cpPlugins }; // --------------------------------------------------------------------- - PLUMA_INHERIT_PROVIDER_CPPLUGINS( - ImageSeriesReader, - cpPlugins::Interface::Object - ); + CPPLUGINS_INHERIT_PROVIDER( ImageSeriesReader ); } // ecapseman diff --git a/lib/cpPlugins/Plugins/ImageWriter.h b/lib/cpPlugins/Plugins/ImageWriter.h index 1dcd98f..4278ed7 100644 --- a/lib/cpPlugins/Plugins/ImageWriter.h +++ b/lib/cpPlugins/Plugins/ImageWriter.h @@ -49,10 +49,7 @@ namespace cpPlugins }; // --------------------------------------------------------------------- - PLUMA_INHERIT_PROVIDER_CPPLUGINS( - ImageWriter, - cpPlugins::Interface::Object - ); + CPPLUGINS_INHERIT_PROVIDER( ImageWriter ); } // ecapseman diff --git a/lib/cpPlugins/Plugins/MarchingCubes.h b/lib/cpPlugins/Plugins/MarchingCubes.h index cf616b0..7ce3afd 100644 --- a/lib/cpPlugins/Plugins/MarchingCubes.h +++ b/lib/cpPlugins/Plugins/MarchingCubes.h @@ -49,10 +49,7 @@ namespace cpPlugins }; // --------------------------------------------------------------------- - PLUMA_INHERIT_PROVIDER_CPPLUGINS( - MarchingCubes, - cpPlugins::Interface::Object - ); + CPPLUGINS_INHERIT_PROVIDER( MarchingCubes ); } // ecapseman diff --git a/lib/cpPlugins/Plugins/MeshReader.h b/lib/cpPlugins/Plugins/MeshReader.h index bfd9426..f16f843 100644 --- a/lib/cpPlugins/Plugins/MeshReader.h +++ b/lib/cpPlugins/Plugins/MeshReader.h @@ -49,10 +49,7 @@ namespace cpPlugins }; // --------------------------------------------------------------------- - PLUMA_INHERIT_PROVIDER_CPPLUGINS( - MeshReader, - cpPlugins::Interface::Object - ); + CPPLUGINS_INHERIT_PROVIDER( MeshReader ); } // ecapseman diff --git a/lib/cpPlugins/Plugins/RGBImageToHSVChannelsFilter.h b/lib/cpPlugins/Plugins/RGBImageToHSVChannelsFilter.h index d9fe353..f995835 100644 --- a/lib/cpPlugins/Plugins/RGBImageToHSVChannelsFilter.h +++ b/lib/cpPlugins/Plugins/RGBImageToHSVChannelsFilter.h @@ -51,10 +51,7 @@ namespace cpPlugins }; // --------------------------------------------------------------------- - PLUMA_INHERIT_PROVIDER_CPPLUGINS( - RGBImageToHSVChannelsFilter, - cpPlugins::Interface::Object - ); + CPPLUGINS_INHERIT_PROVIDER( RGBImageToHSVChannelsFilter ); } // ecapseman