From da7cadeecad8bf04551591e9cb9e86977e2cbb47 Mon Sep 17 00:00:00 2001 From: Leonardo Florez-Valencia Date: Fri, 22 Jan 2016 18:21:19 -0500 Subject: [PATCH] ... --- appli/bash/cpPlugins_createHost.cxx | 41 ++++++++++++-- lib/cpPlugins/Interface/Interface.cxx | 1 + lib/cpPlugins/Interface/Interface.h | 3 + lib/cpPlugins/Interface/Macros.h | 44 --------------- lib/cpPlugins/Interface/ProcessObject.cxx | 3 - lib/cpPlugins/Interface/ProcessObject.h | 5 -- .../Interface/ProcessObjectProvider.cxx | 6 ++ .../Interface/ProcessObjectProvider.h | 55 +++++++++++++++++++ .../BasicFilters/BinaryErodeImageFilter.h | 3 - .../BasicFilters/BinaryThresholdImageFilter.h | 3 - lib/cpPlugins/Plugins/BasicFilters/Cutter.h | 3 - .../BasicFilters/DoubleFloodImageFilter.h | 3 - .../BasicFilters/ExtractSliceImageFilter.h | 3 - .../BasicFilters/FloodFillImageFilter.h | 3 - .../Plugins/BasicFilters/MacheteFilter.h | 3 - .../Plugins/BasicFilters/MacheteImageFilter.h | 3 - .../Plugins/BasicFilters/MarchingCubes.h | 3 - .../Plugins/BasicFilters/MedianImageFilter.h | 3 - .../BasicFilters/OtsuThresholdImageFilter.h | 3 - .../RGBImageToOtherChannelsFilter.h | 3 - .../SignedMaurerDistanceMapImageFilter.h | 3 - .../Plugins/BasicFilters/SphereMeshSource.h | 3 - lib/cpPlugins/Plugins/IO/DicomSeriesReader.h | 3 - lib/cpPlugins/Plugins/IO/ImageReader.h | 3 - lib/cpPlugins/Plugins/IO/ImageWriter.h | 3 - lib/cpPlugins/Plugins/IO/MeshReader.h | 3 - lib/cpPlugins/Plugins/IO/MeshWriter.h | 3 - lib/cpPlugins/Plugins/Widgets/SeedWidget.h | 3 - 28 files changed, 101 insertions(+), 117 deletions(-) create mode 100644 lib/cpPlugins/Interface/ProcessObjectProvider.cxx create mode 100644 lib/cpPlugins/Interface/ProcessObjectProvider.h diff --git a/appli/bash/cpPlugins_createHost.cxx b/appli/bash/cpPlugins_createHost.cxx index 4f46211..d752927 100644 --- a/appli/bash/cpPlugins_createHost.cxx +++ b/appli/bash/cpPlugins_createHost.cxx @@ -1,6 +1,7 @@ #include #include #include +#include #include // ------------------------------------------------------------------------- @@ -25,7 +26,7 @@ std::string GetFileName( const std::string& path ) std::size_t pos = fname.find_last_of( "." ); if( pos != std::string::npos ) fname = fname.substr( 0, pos ); - + return( fname ); } @@ -53,18 +54,46 @@ int main( int argc, char* argv[] ) } // fi output_code << "#include " << std::endl; + output_code + << "#include " + << std::endl; + for( int i = 3; i < argc; ++i ) + output_code << "#include \"" << argv[ i ] << "\"" << std::endl; + output_code << std::endl; + + std::istringstream nspaces( argv[ 2 ] ); + std::string nspace; + unsigned int number_of_nspaces = 0; + while( std::getline( nspaces, nspace, ':' ) ) + { + if( nspace != "" ) + { + output_code << "namespace " << nspace << std::endl << "{" << std::endl; + number_of_nspaces++; + + } // fi + + } // elihw + for( int i = 3; i < argc; ++i ) - output_code << "#include <" << argv[ i ] << ">" << std::endl; + output_code + << "CPPLUGINS_INHERIT_PROVIDER( " + << GetFileName( argv[ i ] ) << " );" << std::endl; + + for( unsigned int i = 0; i < number_of_nspaces; ++i ) + output_code << "}" << std::endl; + output_code << std::endl; + + output_code - << std::endl << "PLUMA_CONNECTOR" << std::endl << "bool connect( pluma::Host& host )" << std::endl - << "{" << std::endl - << " using namespace " << argv[ 2 ] << ";" << std::endl; + << "{" << std::endl; for( int i = 3; i < argc; ++i ) output_code << " host.add( new " + << argv[ 2 ] << "::" << GetFileName( argv[ i ] ) << "Provider( ) );" << std::endl; @@ -73,6 +102,8 @@ int main( int argc, char* argv[] ) << " return( true );" << std::endl << "}" << std::endl; + output_code << std::endl << "// eof - $RCSfile$" << std::endl << std::endl; + // Finish output_code.close( ); return( 0 ); diff --git a/lib/cpPlugins/Interface/Interface.cxx b/lib/cpPlugins/Interface/Interface.cxx index 4576f84..65b7e0f 100644 --- a/lib/cpPlugins/Interface/Interface.cxx +++ b/lib/cpPlugins/Interface/Interface.cxx @@ -1,4 +1,5 @@ #include +#include #include #include #include diff --git a/lib/cpPlugins/Interface/Interface.h b/lib/cpPlugins/Interface/Interface.h index 94718f8..6dbcb4c 100644 --- a/lib/cpPlugins/Interface/Interface.h +++ b/lib/cpPlugins/Interface/Interface.h @@ -19,6 +19,9 @@ namespace cpPlugins { namespace Interface { + // Some forward declarations + class ProcessObjectProvider; + /** */ class cpPlugins_Interface_EXPORT Interface diff --git a/lib/cpPlugins/Interface/Macros.h b/lib/cpPlugins/Interface/Macros.h index 790a997..922d036 100644 --- a/lib/cpPlugins/Interface/Macros.h +++ b/lib/cpPlugins/Interface/Macros.h @@ -1,7 +1,6 @@ #ifndef __CPPLUGINS__INTERFACE__MACROS__H__ #define __CPPLUGINS__INTERFACE__MACROS__H__ -#include #include #include @@ -11,49 +10,6 @@ virtual const char* GetClassName( ) const { return( #N ); } \ virtual const char* GetClassCategory( ) const { return( #C ); } -// ------------------------------------------------------------------------- -#define CPPLUGINS_PROVIDER_HEADER_BEGIN( TYPE ) \ - class cpPlugins_Interface_EXPORT TYPE##Provider \ - : public pluma::Provider \ - { \ -private: \ - friend class pluma::Pluma; \ - static const unsigned int PLUMA_INTERFACE_VERSION; \ - static const unsigned int PLUMA_INTERFACE_LOWEST_VERSION; \ - static const std::string PLUMA_PROVIDER_TYPE; \ - std::string plumaGetType( ) const \ - { return( PLUMA_PROVIDER_TYPE ); } \ -public: \ - unsigned int getVersion( ) const \ - { return( PLUMA_INTERFACE_VERSION ); } - -// ------------------------------------------------------------------------- -#define CPPLUGINS_PROVIDER_HEADER_END }; - -// ------------------------------------------------------------------------- -#define CPPLUGINS_PROVIDER_HEADER( TYPE ) \ - CPPLUGINS_PROVIDER_HEADER_BEGIN( TYPE ) \ - virtual TYPE::Pointer create( ) const = 0; \ - CPPLUGINS_PROVIDER_HEADER_END - -// ------------------------------------------------------------------------- -#define CPPLUGINS_PROVIDER_SOURCE( TYPE, Version, LowestVersion ) \ - PLUMA_PROVIDER_SOURCE( TYPE, Version, LowestVersion ) - -// ------------------------------------------------------------------------- -#define CPPLUGINS_INHERIT_PROVIDER( TYPE ) \ - class TYPE##Provider \ - : public cpPlugins::Interface::ProcessObjectProvider \ - { \ - public: \ - cpPlugins::Interface::ProcessObject::Pointer create( ) const \ - { \ - TYPE::Pointer a = TYPE::New( ); \ - cpPlugins::Interface::ProcessObject::Pointer b = a.GetPointer( ); \ - return( b ); \ - } \ - }; - /** * Based upon: http://www.itk.org/Wiki/Proposals:Explicit_Instantiation */ diff --git a/lib/cpPlugins/Interface/ProcessObject.cxx b/lib/cpPlugins/Interface/ProcessObject.cxx index f665e09..c710a8f 100644 --- a/lib/cpPlugins/Interface/ProcessObject.cxx +++ b/lib/cpPlugins/Interface/ProcessObject.cxx @@ -194,7 +194,4 @@ _AddInput( const std::string& name ) this->Modified( ); } -// ------------------------------------------------------------------------- -CPPLUGINS_PROVIDER_SOURCE( cpPlugins::Interface::ProcessObject, 1, 1 ); - // eof - $RCSfile$ diff --git a/lib/cpPlugins/Interface/ProcessObject.h b/lib/cpPlugins/Interface/ProcessObject.h index ddd1c21..b9deb92 100644 --- a/lib/cpPlugins/Interface/ProcessObject.h +++ b/lib/cpPlugins/Interface/ProcessObject.h @@ -122,11 +122,6 @@ namespace cpPlugins _TDataContainer m_Outputs; }; - /** - * Plugin provider - */ - CPPLUGINS_PROVIDER_HEADER( ProcessObject ); - } // ecapseman } // ecapseman diff --git a/lib/cpPlugins/Interface/ProcessObjectProvider.cxx b/lib/cpPlugins/Interface/ProcessObjectProvider.cxx new file mode 100644 index 0000000..5a3308c --- /dev/null +++ b/lib/cpPlugins/Interface/ProcessObjectProvider.cxx @@ -0,0 +1,6 @@ +#include + +// ------------------------------------------------------------------------- +PLUMA_PROVIDER_SOURCE( cpPlugins::Interface::ProcessObject, 1, 1 ); + +// eof - $RCSfile$ diff --git a/lib/cpPlugins/Interface/ProcessObjectProvider.h b/lib/cpPlugins/Interface/ProcessObjectProvider.h new file mode 100644 index 0000000..5ca1282 --- /dev/null +++ b/lib/cpPlugins/Interface/ProcessObjectProvider.h @@ -0,0 +1,55 @@ +#ifndef __CPPLUGINS__INTERFACE__PROCESSOBJECTPROVIDER__H__ +#define __CPPLUGINS__INTERFACE__PROCESSOBJECTPROVIDER__H__ + +#include +#include +#include +#include + +// ------------------------------------------------------------------------- +#define CPPLUGINS_INHERIT_PROVIDER( T ) \ + class T##Provider \ + : public cpPlugins::Interface::ProcessObjectProvider \ + { \ + public: \ + cpPlugins::Interface::ProcessObject::Pointer create( ) const \ + { \ + T::Pointer a = T::New( ); \ + cpPlugins::Interface::ProcessObject::Pointer b = a.GetPointer( ); \ + return( b ); \ + } \ + }; + +// ------------------------------------------------------------------------- +namespace cpPlugins +{ + namespace Interface + { + /** + */ + class cpPlugins_Interface_EXPORT ProcessObjectProvider + : public pluma::Provider + { + friend class pluma::Pluma; + + private: + static const unsigned int PLUMA_INTERFACE_VERSION; + static const unsigned int PLUMA_INTERFACE_LOWEST_VERSION; + static const std::string PLUMA_PROVIDER_TYPE; + std::string plumaGetType( ) const + { return( PLUMA_PROVIDER_TYPE ); } + + public: + unsigned int getVersion( ) const + { return( PLUMA_INTERFACE_VERSION ); } + + virtual ProcessObject::Pointer create( ) const = 0; + }; + + } // ecapseman + +} // ecapseman + +#endif // __CPPLUGINS__INTERFACE__PROCESSOBJECTPROVIDER__H__ + +// eof - $RCSfile$ diff --git a/lib/cpPlugins/Plugins/BasicFilters/BinaryErodeImageFilter.h b/lib/cpPlugins/Plugins/BasicFilters/BinaryErodeImageFilter.h index 92151bb..d0c3191 100644 --- a/lib/cpPlugins/Plugins/BasicFilters/BinaryErodeImageFilter.h +++ b/lib/cpPlugins/Plugins/BasicFilters/BinaryErodeImageFilter.h @@ -48,9 +48,6 @@ namespace cpPlugins Self& operator=( const Self& ); }; - // --------------------------------------------------------------------- - CPPLUGINS_INHERIT_PROVIDER( BinaryErodeImageFilter ); - } // ecapseman } // ecapseman diff --git a/lib/cpPlugins/Plugins/BasicFilters/BinaryThresholdImageFilter.h b/lib/cpPlugins/Plugins/BasicFilters/BinaryThresholdImageFilter.h index 38ec83a..76b725b 100644 --- a/lib/cpPlugins/Plugins/BasicFilters/BinaryThresholdImageFilter.h +++ b/lib/cpPlugins/Plugins/BasicFilters/BinaryThresholdImageFilter.h @@ -48,9 +48,6 @@ namespace cpPlugins Self& operator=( const Self& ); }; - // --------------------------------------------------------------------- - CPPLUGINS_INHERIT_PROVIDER( BinaryThresholdImageFilter ); - } // ecapseman } // ecapseman diff --git a/lib/cpPlugins/Plugins/BasicFilters/Cutter.h b/lib/cpPlugins/Plugins/BasicFilters/Cutter.h index 8f67a48..f0045af 100644 --- a/lib/cpPlugins/Plugins/BasicFilters/Cutter.h +++ b/lib/cpPlugins/Plugins/BasicFilters/Cutter.h @@ -38,9 +38,6 @@ namespace cpPlugins Self& operator=( const Self& ); }; - // --------------------------------------------------------------------- - CPPLUGINS_INHERIT_PROVIDER( Cutter ); - } // ecapseman } // ecapseman diff --git a/lib/cpPlugins/Plugins/BasicFilters/DoubleFloodImageFilter.h b/lib/cpPlugins/Plugins/BasicFilters/DoubleFloodImageFilter.h index 0383c0f..bcaf84c 100644 --- a/lib/cpPlugins/Plugins/BasicFilters/DoubleFloodImageFilter.h +++ b/lib/cpPlugins/Plugins/BasicFilters/DoubleFloodImageFilter.h @@ -94,9 +94,6 @@ namespace cpPlugins }; - // --------------------------------------------------------------------- - CPPLUGINS_INHERIT_PROVIDER( DoubleFloodImageFilter ); - } // ecapseman } // ecapseman diff --git a/lib/cpPlugins/Plugins/BasicFilters/ExtractSliceImageFilter.h b/lib/cpPlugins/Plugins/BasicFilters/ExtractSliceImageFilter.h index e28ea6c..4138bbe 100644 --- a/lib/cpPlugins/Plugins/BasicFilters/ExtractSliceImageFilter.h +++ b/lib/cpPlugins/Plugins/BasicFilters/ExtractSliceImageFilter.h @@ -47,9 +47,6 @@ namespace cpPlugins Self& operator=( const Self& ); }; - // --------------------------------------------------------------------- - CPPLUGINS_INHERIT_PROVIDER( ExtractSliceImageFilter ); - } // ecapseman } // ecapseman diff --git a/lib/cpPlugins/Plugins/BasicFilters/FloodFillImageFilter.h b/lib/cpPlugins/Plugins/BasicFilters/FloodFillImageFilter.h index 1f70e93..aa770ec 100644 --- a/lib/cpPlugins/Plugins/BasicFilters/FloodFillImageFilter.h +++ b/lib/cpPlugins/Plugins/BasicFilters/FloodFillImageFilter.h @@ -48,9 +48,6 @@ namespace cpPlugins Self& operator=( const Self& ); }; - // --------------------------------------------------------------------- - CPPLUGINS_INHERIT_PROVIDER( FloodFillImageFilter ); - } // ecapseman } // ecapseman diff --git a/lib/cpPlugins/Plugins/BasicFilters/MacheteFilter.h b/lib/cpPlugins/Plugins/BasicFilters/MacheteFilter.h index a7461e1..75e52cd 100644 --- a/lib/cpPlugins/Plugins/BasicFilters/MacheteFilter.h +++ b/lib/cpPlugins/Plugins/BasicFilters/MacheteFilter.h @@ -106,9 +106,6 @@ namespace cpPlugins #endif // cpPlugins_Interface_QT4 }; - // --------------------------------------------------------------------- - CPPLUGINS_INHERIT_PROVIDER( MacheteFilter ); - } // ecapseman } // ecapseman diff --git a/lib/cpPlugins/Plugins/BasicFilters/MacheteImageFilter.h b/lib/cpPlugins/Plugins/BasicFilters/MacheteImageFilter.h index 1ac3df9..faf1b34 100644 --- a/lib/cpPlugins/Plugins/BasicFilters/MacheteImageFilter.h +++ b/lib/cpPlugins/Plugins/BasicFilters/MacheteImageFilter.h @@ -48,9 +48,6 @@ namespace cpPlugins Self& operator=( const Self& ); }; - // --------------------------------------------------------------------- - CPPLUGINS_INHERIT_PROVIDER( MacheteImageFilter ); - } // ecapseman } // ecapseman diff --git a/lib/cpPlugins/Plugins/BasicFilters/MarchingCubes.h b/lib/cpPlugins/Plugins/BasicFilters/MarchingCubes.h index d4b45b1..176b6dd 100644 --- a/lib/cpPlugins/Plugins/BasicFilters/MarchingCubes.h +++ b/lib/cpPlugins/Plugins/BasicFilters/MarchingCubes.h @@ -38,9 +38,6 @@ namespace cpPlugins Self& operator=( const Self& ); }; - // --------------------------------------------------------------------- - CPPLUGINS_INHERIT_PROVIDER( MarchingCubes ); - } // ecapseman } // ecapseman diff --git a/lib/cpPlugins/Plugins/BasicFilters/MedianImageFilter.h b/lib/cpPlugins/Plugins/BasicFilters/MedianImageFilter.h index f7034d3..fa7d601 100644 --- a/lib/cpPlugins/Plugins/BasicFilters/MedianImageFilter.h +++ b/lib/cpPlugins/Plugins/BasicFilters/MedianImageFilter.h @@ -48,9 +48,6 @@ namespace cpPlugins Self& operator=( const Self& ); }; - // --------------------------------------------------------------------- - CPPLUGINS_INHERIT_PROVIDER( MedianImageFilter ); - } // ecapseman } // ecapseman diff --git a/lib/cpPlugins/Plugins/BasicFilters/OtsuThresholdImageFilter.h b/lib/cpPlugins/Plugins/BasicFilters/OtsuThresholdImageFilter.h index 2e6f852..dd37f13 100644 --- a/lib/cpPlugins/Plugins/BasicFilters/OtsuThresholdImageFilter.h +++ b/lib/cpPlugins/Plugins/BasicFilters/OtsuThresholdImageFilter.h @@ -48,9 +48,6 @@ namespace cpPlugins Self& operator=( const Self& ); }; - // --------------------------------------------------------------------- - CPPLUGINS_INHERIT_PROVIDER( OtsuThresholdImageFilter ); - } // ecapseman } // ecapseman diff --git a/lib/cpPlugins/Plugins/BasicFilters/RGBImageToOtherChannelsFilter.h b/lib/cpPlugins/Plugins/BasicFilters/RGBImageToOtherChannelsFilter.h index 9440cd0..1d035e4 100644 --- a/lib/cpPlugins/Plugins/BasicFilters/RGBImageToOtherChannelsFilter.h +++ b/lib/cpPlugins/Plugins/BasicFilters/RGBImageToOtherChannelsFilter.h @@ -48,9 +48,6 @@ namespace cpPlugins Self& operator=( const Self& ); }; - // --------------------------------------------------------------------- - CPPLUGINS_INHERIT_PROVIDER( RGBImageToOtherChannelsFilter ); - } // ecapseman } // ecapseman diff --git a/lib/cpPlugins/Plugins/BasicFilters/SignedMaurerDistanceMapImageFilter.h b/lib/cpPlugins/Plugins/BasicFilters/SignedMaurerDistanceMapImageFilter.h index 2d87c76..cf40665 100644 --- a/lib/cpPlugins/Plugins/BasicFilters/SignedMaurerDistanceMapImageFilter.h +++ b/lib/cpPlugins/Plugins/BasicFilters/SignedMaurerDistanceMapImageFilter.h @@ -48,9 +48,6 @@ namespace cpPlugins Self& operator=( const Self& ); }; - // --------------------------------------------------------------------- - CPPLUGINS_INHERIT_PROVIDER( SignedMaurerDistanceMapImageFilter ); - } // ecapseman } // ecapseman diff --git a/lib/cpPlugins/Plugins/BasicFilters/SphereMeshSource.h b/lib/cpPlugins/Plugins/BasicFilters/SphereMeshSource.h index ef180ff..abaabcd 100644 --- a/lib/cpPlugins/Plugins/BasicFilters/SphereMeshSource.h +++ b/lib/cpPlugins/Plugins/BasicFilters/SphereMeshSource.h @@ -38,9 +38,6 @@ namespace cpPlugins Self& operator=( const Self& ); }; - // --------------------------------------------------------------------- - CPPLUGINS_INHERIT_PROVIDER( SphereMeshSource ); - } // ecapseman } // ecapseman diff --git a/lib/cpPlugins/Plugins/IO/DicomSeriesReader.h b/lib/cpPlugins/Plugins/IO/DicomSeriesReader.h index 33295bf..1d619d0 100644 --- a/lib/cpPlugins/Plugins/IO/DicomSeriesReader.h +++ b/lib/cpPlugins/Plugins/IO/DicomSeriesReader.h @@ -47,9 +47,6 @@ namespace cpPlugins Self& operator=( const Self& ); }; - // --------------------------------------------------------------------- - CPPLUGINS_INHERIT_PROVIDER( DicomSeriesReader ); - } // ecapseman } // ecapseman diff --git a/lib/cpPlugins/Plugins/IO/ImageReader.h b/lib/cpPlugins/Plugins/IO/ImageReader.h index 340c5db..882ab04 100644 --- a/lib/cpPlugins/Plugins/IO/ImageReader.h +++ b/lib/cpPlugins/Plugins/IO/ImageReader.h @@ -55,9 +55,6 @@ namespace cpPlugins Self& operator=( const Self& ); }; - // --------------------------------------------------------------------- - CPPLUGINS_INHERIT_PROVIDER( ImageReader ); - } // ecapseman } // ecapseman diff --git a/lib/cpPlugins/Plugins/IO/ImageWriter.h b/lib/cpPlugins/Plugins/IO/ImageWriter.h index bfde61b..20c519e 100644 --- a/lib/cpPlugins/Plugins/IO/ImageWriter.h +++ b/lib/cpPlugins/Plugins/IO/ImageWriter.h @@ -48,9 +48,6 @@ namespace cpPlugins Self& operator=( const Self& ); }; - // --------------------------------------------------------------------- - CPPLUGINS_INHERIT_PROVIDER( ImageWriter ); - } // ecapseman } // ecapseman diff --git a/lib/cpPlugins/Plugins/IO/MeshReader.h b/lib/cpPlugins/Plugins/IO/MeshReader.h index 48c1164..e86e36b 100644 --- a/lib/cpPlugins/Plugins/IO/MeshReader.h +++ b/lib/cpPlugins/Plugins/IO/MeshReader.h @@ -44,9 +44,6 @@ namespace cpPlugins Self& operator=( const Self& ); }; - // --------------------------------------------------------------------- - CPPLUGINS_INHERIT_PROVIDER( MeshReader ); - } // ecapseman } // ecapseman diff --git a/lib/cpPlugins/Plugins/IO/MeshWriter.h b/lib/cpPlugins/Plugins/IO/MeshWriter.h index c1f4a7e..26c92d5 100644 --- a/lib/cpPlugins/Plugins/IO/MeshWriter.h +++ b/lib/cpPlugins/Plugins/IO/MeshWriter.h @@ -38,9 +38,6 @@ namespace cpPlugins Self& operator=( const Self& ); }; - // --------------------------------------------------------------------- - CPPLUGINS_INHERIT_PROVIDER( MeshWriter ); - } // ecapseman } // ecapseman diff --git a/lib/cpPlugins/Plugins/Widgets/SeedWidget.h b/lib/cpPlugins/Plugins/Widgets/SeedWidget.h index 709a9c6..9c37af7 100644 --- a/lib/cpPlugins/Plugins/Widgets/SeedWidget.h +++ b/lib/cpPlugins/Plugins/Widgets/SeedWidget.h @@ -42,9 +42,6 @@ namespace cpPlugins bool m_Configured; }; - // --------------------------------------------------------------------- - CPPLUGINS_INHERIT_PROVIDER( SeedWidget ); - } // ecapseman } // ecapseman -- 2.47.1