]> 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 4f46211..d752927 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 4576f84..65b7e0f 100644 (file)
@@ -1,4 +1,5 @@
 #include <cpPlugins/Interface/Interface.h>
+#include <cpPlugins/Interface/ProcessObjectProvider.h>
 #include <algorithm>
 #include <cstdlib>
 #include <fstream>
index 94718f8..6dbcb4c 100644 (file)
@@ -19,6 +19,9 @@ namespace cpPlugins
 {
   namespace Interface
   {
+    // Some forward declarations
+    class ProcessObjectProvider;
+
     /**
      */
     class cpPlugins_Interface_EXPORT Interface
index 790a997..922d036 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 f665e09..c710a8f 100644 (file)
@@ -194,7 +194,4 @@ _AddInput( const std::string& name )
   this->Modified( );
 }
 
-// -------------------------------------------------------------------------
-CPPLUGINS_PROVIDER_SOURCE( cpPlugins::Interface::ProcessObject, 1, 1 );
-
 // eof - $RCSfile$
index ddd1c21..b9deb92 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 92151bb..d0c3191 100644 (file)
@@ -48,9 +48,6 @@ namespace cpPlugins
       Self& operator=( const Self& );
     };
 
-    // ---------------------------------------------------------------------
-    CPPLUGINS_INHERIT_PROVIDER( BinaryErodeImageFilter );
-
   } // ecapseman
 
 } // ecapseman
index 38ec83a..76b725b 100644 (file)
@@ -48,9 +48,6 @@ namespace cpPlugins
       Self& operator=( const Self& );
     };
 
-    // ---------------------------------------------------------------------
-    CPPLUGINS_INHERIT_PROVIDER( BinaryThresholdImageFilter );
-
   } // ecapseman
 
 } // ecapseman
index 8f67a48..f0045af 100644 (file)
@@ -38,9 +38,6 @@ namespace cpPlugins
       Self& operator=( const Self& );
     };
 
-    // ---------------------------------------------------------------------
-    CPPLUGINS_INHERIT_PROVIDER( Cutter );
-
   } // ecapseman
 
 } // ecapseman
index 0383c0f..bcaf84c 100644 (file)
@@ -94,9 +94,6 @@ namespace cpPlugins
 
     };
 
-    // ---------------------------------------------------------------------
-    CPPLUGINS_INHERIT_PROVIDER( DoubleFloodImageFilter );
-
   } // ecapseman
 
 } // ecapseman
index e28ea6c..4138bbe 100644 (file)
@@ -47,9 +47,6 @@ namespace cpPlugins
       Self& operator=( const Self& );
     };
 
-    // ---------------------------------------------------------------------
-    CPPLUGINS_INHERIT_PROVIDER( ExtractSliceImageFilter );
-
   } // ecapseman
 
 } // ecapseman
index 1f70e93..aa770ec 100644 (file)
@@ -48,9 +48,6 @@ namespace cpPlugins
       Self& operator=( const Self& );
     };
 
-    // ---------------------------------------------------------------------
-    CPPLUGINS_INHERIT_PROVIDER( FloodFillImageFilter );
-
   } // ecapseman
 
 } // ecapseman
index a7461e1..75e52cd 100644 (file)
@@ -106,9 +106,6 @@ namespace cpPlugins
 #endif // cpPlugins_Interface_QT4
     };
 
-    // ---------------------------------------------------------------------
-    CPPLUGINS_INHERIT_PROVIDER( MacheteFilter );
-
   } // ecapseman
 
 } // ecapseman
index 1ac3df9..faf1b34 100644 (file)
@@ -48,9 +48,6 @@ namespace cpPlugins
       Self& operator=( const Self& );
     };
 
-    // ---------------------------------------------------------------------
-    CPPLUGINS_INHERIT_PROVIDER( MacheteImageFilter );
-
   } // ecapseman
 
 } // ecapseman
index d4b45b1..176b6dd 100644 (file)
@@ -38,9 +38,6 @@ namespace cpPlugins
       Self& operator=( const Self& );
     };
 
-    // ---------------------------------------------------------------------
-    CPPLUGINS_INHERIT_PROVIDER( MarchingCubes );
-
   } // ecapseman
 
 } // ecapseman
index f7034d3..fa7d601 100644 (file)
@@ -48,9 +48,6 @@ namespace cpPlugins
       Self& operator=( const Self& );
     };
 
-    // ---------------------------------------------------------------------
-    CPPLUGINS_INHERIT_PROVIDER( MedianImageFilter );
-
   } // ecapseman
 
 } // ecapseman
index 2e6f852..dd37f13 100644 (file)
@@ -48,9 +48,6 @@ namespace cpPlugins
       Self& operator=( const Self& );
     };
 
-    // ---------------------------------------------------------------------
-    CPPLUGINS_INHERIT_PROVIDER( OtsuThresholdImageFilter );
-
   } // ecapseman
 
 } // ecapseman
index 9440cd0..1d035e4 100644 (file)
@@ -48,9 +48,6 @@ namespace cpPlugins
       Self& operator=( const Self& );
     };
 
-    // ---------------------------------------------------------------------
-    CPPLUGINS_INHERIT_PROVIDER( RGBImageToOtherChannelsFilter );
-
   } // ecapseman
 
 } // ecapseman
index 2d87c76..cf40665 100644 (file)
@@ -48,9 +48,6 @@ namespace cpPlugins
       Self& operator=( const Self& );
     };
 
-    // ---------------------------------------------------------------------
-    CPPLUGINS_INHERIT_PROVIDER( SignedMaurerDistanceMapImageFilter );
-
   } // ecapseman
 
 } // ecapseman
index ef180ff..abaabcd 100644 (file)
@@ -38,9 +38,6 @@ namespace cpPlugins
       Self& operator=( const Self& );
     };
 
-    // ---------------------------------------------------------------------
-    CPPLUGINS_INHERIT_PROVIDER( SphereMeshSource );
-
   } // ecapseman
 
 } // ecapseman
index 33295bf..1d619d0 100644 (file)
@@ -47,9 +47,6 @@ namespace cpPlugins
       Self& operator=( const Self& );
     };
 
-    // ---------------------------------------------------------------------
-    CPPLUGINS_INHERIT_PROVIDER( DicomSeriesReader );
-
   } // ecapseman
 
 } // ecapseman
index 340c5db..882ab04 100644 (file)
@@ -55,9 +55,6 @@ namespace cpPlugins
       Self& operator=( const Self& );
     };
 
-    // ---------------------------------------------------------------------
-    CPPLUGINS_INHERIT_PROVIDER( ImageReader );
-
   } // ecapseman
 
 } // ecapseman
index bfde61b..20c519e 100644 (file)
@@ -48,9 +48,6 @@ namespace cpPlugins
       Self& operator=( const Self& );
     };
 
-    // ---------------------------------------------------------------------
-    CPPLUGINS_INHERIT_PROVIDER( ImageWriter );
-
   } // ecapseman
 
 } // ecapseman
index 48c1164..e86e36b 100644 (file)
@@ -44,9 +44,6 @@ namespace cpPlugins
       Self& operator=( const Self& );
     };
 
-    // ---------------------------------------------------------------------
-    CPPLUGINS_INHERIT_PROVIDER( MeshReader );
-
   } // ecapseman
 
 } // ecapseman
index c1f4a7e..26c92d5 100644 (file)
@@ -38,9 +38,6 @@ namespace cpPlugins
       Self& operator=( const Self& );
     };
 
-    // ---------------------------------------------------------------------
-    CPPLUGINS_INHERIT_PROVIDER( MeshWriter );
-
   } // ecapseman
 
 } // ecapseman
index 709a9c6..9c37af7 100644 (file)
@@ -42,9 +42,6 @@ namespace cpPlugins
       bool m_Configured;
     };
 
-    // ---------------------------------------------------------------------
-    CPPLUGINS_INHERIT_PROVIDER( SeedWidget );
-
   } // ecapseman
 
 } // ecapseman