]> Creatis software - cpPlugins.git/commitdiff
...
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Fri, 22 Jan 2016 23:21:19 +0000 (18:21 -0500)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Fri, 22 Jan 2016 23:21:19 +0000 (18:21 -0500)
28 files changed:
appli/bash/cpPlugins_createHost.cxx
lib/cpPlugins/Interface/Interface.cxx
lib/cpPlugins/Interface/Interface.h
lib/cpPlugins/Interface/Macros.h
lib/cpPlugins/Interface/ProcessObject.cxx
lib/cpPlugins/Interface/ProcessObject.h
lib/cpPlugins/Interface/ProcessObjectProvider.cxx [new file with mode: 0644]
lib/cpPlugins/Interface/ProcessObjectProvider.h [new file with mode: 0644]
lib/cpPlugins/Plugins/BasicFilters/BinaryErodeImageFilter.h
lib/cpPlugins/Plugins/BasicFilters/BinaryThresholdImageFilter.h
lib/cpPlugins/Plugins/BasicFilters/Cutter.h
lib/cpPlugins/Plugins/BasicFilters/DoubleFloodImageFilter.h
lib/cpPlugins/Plugins/BasicFilters/ExtractSliceImageFilter.h
lib/cpPlugins/Plugins/BasicFilters/FloodFillImageFilter.h
lib/cpPlugins/Plugins/BasicFilters/MacheteFilter.h
lib/cpPlugins/Plugins/BasicFilters/MacheteImageFilter.h
lib/cpPlugins/Plugins/BasicFilters/MarchingCubes.h
lib/cpPlugins/Plugins/BasicFilters/MedianImageFilter.h
lib/cpPlugins/Plugins/BasicFilters/OtsuThresholdImageFilter.h
lib/cpPlugins/Plugins/BasicFilters/RGBImageToOtherChannelsFilter.h
lib/cpPlugins/Plugins/BasicFilters/SignedMaurerDistanceMapImageFilter.h
lib/cpPlugins/Plugins/BasicFilters/SphereMeshSource.h
lib/cpPlugins/Plugins/IO/DicomSeriesReader.h
lib/cpPlugins/Plugins/IO/ImageReader.h
lib/cpPlugins/Plugins/IO/ImageWriter.h
lib/cpPlugins/Plugins/IO/MeshReader.h
lib/cpPlugins/Plugins/IO/MeshWriter.h
lib/cpPlugins/Plugins/Widgets/SeedWidget.h

index 4f46211900df09edbd6c78ff9c12555582947db0..d75292774d2501b52a0f5511355201f1ca7a98c1 100644 (file)
@@ -1,6 +1,7 @@
 #include <cstring>
 #include <fstream>
 #include <iostream>
+#include <sstream>
 #include <string>
 
 // -------------------------------------------------------------------------
@@ -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 <Pluma/Connector.hpp>" << std::endl;
+  output_code
+    << "#include <cpPlugins/Interface/ProcessObjectProvider.h>"
+    << 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 );
index 4576f84b0ed8398851dcd0188fa07ce43b411380..65b7e0f723c128bf329285f34be7f656f943bd19 100644 (file)
@@ -1,4 +1,5 @@
 #include <cpPlugins/Interface/Interface.h>
+#include <cpPlugins/Interface/ProcessObjectProvider.h>
 #include <algorithm>
 #include <cstdlib>
 #include <fstream>
index 94718f8a919d9558e67cf30822212b3d9f0da23b..6dbcb4c7ebd1b32f4c7da2be3403fcb20523e55a 100644 (file)
@@ -19,6 +19,9 @@ namespace cpPlugins
 {
   namespace Interface
   {
+    // Some forward declarations
+    class ProcessObjectProvider;
+
     /**
      */
     class cpPlugins_Interface_EXPORT Interface
index 790a99765c64d508ebfe0d0c32b97a0965e5d7c7..922d036c4a1bd422cabae919f985e1cd9bcee88f 100644 (file)
@@ -1,7 +1,6 @@
 #ifndef __CPPLUGINS__INTERFACE__MACROS__H__
 #define __CPPLUGINS__INTERFACE__MACROS__H__
 
-#include <Pluma/Pluma.hpp>
 #include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
 #include <cpPlugins/Interface/Config.h>
 
   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
  */
index f665e091ab89e06a12ed328ea8ac9e8e274d2acf..c710a8ff823a1cbb912c6389cddbb8a984e03fe5 100644 (file)
@@ -194,7 +194,4 @@ _AddInput( const std::string& name )
   this->Modified( );
 }
 
-// -------------------------------------------------------------------------
-CPPLUGINS_PROVIDER_SOURCE( cpPlugins::Interface::ProcessObject, 1, 1 );
-
 // eof - $RCSfile$
index ddd1c21aa150ad2cd38987e82ad1bfb4f76d3677..b9deb925802afd32f701699b414c0c451183fe46 100644 (file)
@@ -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 (file)
index 0000000..5a3308c
--- /dev/null
@@ -0,0 +1,6 @@
+#include <cpPlugins/Interface/ProcessObjectProvider.h>
+
+// -------------------------------------------------------------------------
+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 (file)
index 0000000..5ca1282
--- /dev/null
@@ -0,0 +1,55 @@
+#ifndef __CPPLUGINS__INTERFACE__PROCESSOBJECTPROVIDER__H__
+#define __CPPLUGINS__INTERFACE__PROCESSOBJECTPROVIDER__H__
+
+#include <Pluma/Pluma.hpp>
+#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
+#include <cpPlugins/Interface/Config.h>
+#include <cpPlugins/Interface/ProcessObject.h>
+
+// -------------------------------------------------------------------------
+#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$
index 92151bbfc030a4d9374b6747eccbc980bdbbfbef..d0c3191ff66fe4c5328ecf9015b596689e051597 100644 (file)
@@ -48,9 +48,6 @@ namespace cpPlugins
       Self& operator=( const Self& );
     };
 
-    // ---------------------------------------------------------------------
-    CPPLUGINS_INHERIT_PROVIDER( BinaryErodeImageFilter );
-
   } // ecapseman
 
 } // ecapseman
index 38ec83af2fa08961a6061362760a51cff902f1d1..76b725b95832beab58857d7df06f7daab435ec4c 100644 (file)
@@ -48,9 +48,6 @@ namespace cpPlugins
       Self& operator=( const Self& );
     };
 
-    // ---------------------------------------------------------------------
-    CPPLUGINS_INHERIT_PROVIDER( BinaryThresholdImageFilter );
-
   } // ecapseman
 
 } // ecapseman
index 8f67a48b6ac462cb17431d525c0026d01456bce7..f0045af52317de79a9591d4b461b609b04010282 100644 (file)
@@ -38,9 +38,6 @@ namespace cpPlugins
       Self& operator=( const Self& );
     };
 
-    // ---------------------------------------------------------------------
-    CPPLUGINS_INHERIT_PROVIDER( Cutter );
-
   } // ecapseman
 
 } // ecapseman
index 0383c0f86c692bf4c419fac172cd9608e351175b..bcaf84c99cac1b28567f138edfb72b56b9ac121f 100644 (file)
@@ -94,9 +94,6 @@ namespace cpPlugins
 
     };
 
-    // ---------------------------------------------------------------------
-    CPPLUGINS_INHERIT_PROVIDER( DoubleFloodImageFilter );
-
   } // ecapseman
 
 } // ecapseman
index e28ea6c3b6e9e8fde57dbc9958dadcddb45c9698..4138bbe8ed5abe4fb887eeb8b5155fa38f0516ea 100644 (file)
@@ -47,9 +47,6 @@ namespace cpPlugins
       Self& operator=( const Self& );
     };
 
-    // ---------------------------------------------------------------------
-    CPPLUGINS_INHERIT_PROVIDER( ExtractSliceImageFilter );
-
   } // ecapseman
 
 } // ecapseman
index 1f70e9381e8d3e6c1d8c2be437eb41b0bd7061b8..aa770ec4d55e543691cf54df2cc296dfc863f483 100644 (file)
@@ -48,9 +48,6 @@ namespace cpPlugins
       Self& operator=( const Self& );
     };
 
-    // ---------------------------------------------------------------------
-    CPPLUGINS_INHERIT_PROVIDER( FloodFillImageFilter );
-
   } // ecapseman
 
 } // ecapseman
index a7461e17a34a1281405a04c8373a10ec05da233f..75e52cd5e8563ea9496faa7accf7b246af4876d6 100644 (file)
@@ -106,9 +106,6 @@ namespace cpPlugins
 #endif // cpPlugins_Interface_QT4
     };
 
-    // ---------------------------------------------------------------------
-    CPPLUGINS_INHERIT_PROVIDER( MacheteFilter );
-
   } // ecapseman
 
 } // ecapseman
index 1ac3df9d62557fedf474e0980c4d8345b9d97f5c..faf1b341a675df4f3f042a5a0025916a8d4c31dd 100644 (file)
@@ -48,9 +48,6 @@ namespace cpPlugins
       Self& operator=( const Self& );
     };
 
-    // ---------------------------------------------------------------------
-    CPPLUGINS_INHERIT_PROVIDER( MacheteImageFilter );
-
   } // ecapseman
 
 } // ecapseman
index d4b45b167057c6d2c8f587ddaee5b023d51d920a..176b6ddf2ea1a5807a124565d4d5a216584dd533 100644 (file)
@@ -38,9 +38,6 @@ namespace cpPlugins
       Self& operator=( const Self& );
     };
 
-    // ---------------------------------------------------------------------
-    CPPLUGINS_INHERIT_PROVIDER( MarchingCubes );
-
   } // ecapseman
 
 } // ecapseman
index f7034d320b89aa0bdb2aa6cf10e360c5c77dc734..fa7d601046f8fe8e0c95252e6b0c2b72b60291ab 100644 (file)
@@ -48,9 +48,6 @@ namespace cpPlugins
       Self& operator=( const Self& );
     };
 
-    // ---------------------------------------------------------------------
-    CPPLUGINS_INHERIT_PROVIDER( MedianImageFilter );
-
   } // ecapseman
 
 } // ecapseman
index 2e6f852e551ea8e315f3838efed4677537025448..dd37f13532b98f20fd4c8e5e016ea992d44e9050 100644 (file)
@@ -48,9 +48,6 @@ namespace cpPlugins
       Self& operator=( const Self& );
     };
 
-    // ---------------------------------------------------------------------
-    CPPLUGINS_INHERIT_PROVIDER( OtsuThresholdImageFilter );
-
   } // ecapseman
 
 } // ecapseman
index 9440cd02e68fbda83e609047b408acc4ba00f7a3..1d035e4bf91ef3aac86171fa88dd557644baa354 100644 (file)
@@ -48,9 +48,6 @@ namespace cpPlugins
       Self& operator=( const Self& );
     };
 
-    // ---------------------------------------------------------------------
-    CPPLUGINS_INHERIT_PROVIDER( RGBImageToOtherChannelsFilter );
-
   } // ecapseman
 
 } // ecapseman
index 2d87c76b61515deff2866a59f3d4a96d3ba8aa39..cf406657fc4cf02491db580d357cab141656af53 100644 (file)
@@ -48,9 +48,6 @@ namespace cpPlugins
       Self& operator=( const Self& );
     };
 
-    // ---------------------------------------------------------------------
-    CPPLUGINS_INHERIT_PROVIDER( SignedMaurerDistanceMapImageFilter );
-
   } // ecapseman
 
 } // ecapseman
index ef180ff2bc09bab73922b56cfa9a0cefe00e1ef1..abaabcd9afa7b400360d2c3a7165f83315a110a7 100644 (file)
@@ -38,9 +38,6 @@ namespace cpPlugins
       Self& operator=( const Self& );
     };
 
-    // ---------------------------------------------------------------------
-    CPPLUGINS_INHERIT_PROVIDER( SphereMeshSource );
-
   } // ecapseman
 
 } // ecapseman
index 33295bfb1732e86f5f6ca5cb58fde5f07622f70f..1d619d0c1bf63e6cca15fa3017d4d5b9899b326b 100644 (file)
@@ -47,9 +47,6 @@ namespace cpPlugins
       Self& operator=( const Self& );
     };
 
-    // ---------------------------------------------------------------------
-    CPPLUGINS_INHERIT_PROVIDER( DicomSeriesReader );
-
   } // ecapseman
 
 } // ecapseman
index 340c5dbcf51220fae6acce76041689ff5387e61a..882ab04737cb0f1182596e8f6e084012cf594b17 100644 (file)
@@ -55,9 +55,6 @@ namespace cpPlugins
       Self& operator=( const Self& );
     };
 
-    // ---------------------------------------------------------------------
-    CPPLUGINS_INHERIT_PROVIDER( ImageReader );
-
   } // ecapseman
 
 } // ecapseman
index bfde61b5c40904363e5f423c9cc84dfb8dd4ec4a..20c519e9ad6425ff81c9df66fdfc05e266b62703 100644 (file)
@@ -48,9 +48,6 @@ namespace cpPlugins
       Self& operator=( const Self& );
     };
 
-    // ---------------------------------------------------------------------
-    CPPLUGINS_INHERIT_PROVIDER( ImageWriter );
-
   } // ecapseman
 
 } // ecapseman
index 48c116413ec03142e9c015dfb811a342e8a3a281..e86e36b9f8566b50870da9b4d1b80cec5e4eec06 100644 (file)
@@ -44,9 +44,6 @@ namespace cpPlugins
       Self& operator=( const Self& );
     };
 
-    // ---------------------------------------------------------------------
-    CPPLUGINS_INHERIT_PROVIDER( MeshReader );
-
   } // ecapseman
 
 } // ecapseman
index c1f4a7e598bae7af3bcafcb42a00c061610063da..26c92d5d9640bf4df689bc00f1de1b5ad5da5381 100644 (file)
@@ -38,9 +38,6 @@ namespace cpPlugins
       Self& operator=( const Self& );
     };
 
-    // ---------------------------------------------------------------------
-    CPPLUGINS_INHERIT_PROVIDER( MeshWriter );
-
   } // ecapseman
 
 } // ecapseman
index 709a9c6e6761a3a98b80e8223b12080c18dc069b..9c37af7eb5d5ebbbdea294ea3113e21877c8fa8f 100644 (file)
@@ -42,9 +42,6 @@ namespace cpPlugins
       bool m_Configured;
     };
 
-    // ---------------------------------------------------------------------
-    CPPLUGINS_INHERIT_PROVIDER( SeedWidget );
-
   } // ecapseman
 
 } // ecapseman