]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/Interface/Workspace.cxx
...
[cpPlugins.git] / lib / cpPlugins / Interface / Workspace.cxx
index 8eca62080671d2108b9bb02ec3c3faf6335bd201..4fbcb2bbf3b154e11332f29b0a32cd7201630f95 100644 (file)
@@ -1,34 +1,5 @@
 #include <cpPlugins/Interface/Workspace.h>
-#include <cpPlugins/BaseObjects/Widget.h>
-
-// -------------------------------------------------------------------------
-cpPlugins::Interface::Workspace::
-Pointer cpPlugins::Interface::Workspace::
-New( )
-{
-  Pointer smartPtr = new Self;
-  smartPtr->UnRegister( );
-  return( smartPtr );
-}
-
-// -------------------------------------------------------------------------
-itk::LightObject::Pointer cpPlugins::Interface::Workspace::
-CreateAnother( ) const
-{
-  itk::LightObject::Pointer smartPtr;
-  smartPtr = Self::New( ).GetPointer( );
-  return( smartPtr );
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Interface::Workspace::
-Pointer cpPlugins::Interface::Workspace::
-Clone( ) const
-{
-  Pointer rval =
-    dynamic_cast< Self* >( this->InternalClone( ).GetPointer( ) );
-  return( rval );
-}
+#include <cpPlugins/Pipeline/Widget.h>
 
 // -------------------------------------------------------------------------
 void cpPlugins::Interface::Workspace::
@@ -107,19 +78,22 @@ HasWidget( const std::string& name ) const
 // -------------------------------------------------------------------------
 cpPlugins::Interface::Workspace::
 TFilter* cpPlugins::Interface::Workspace::
-CreateFilter( const std::string& category, const std::string& filter )
+CreateFilter(
+  const std::string& category, const std::string& filter,
+  const std::string& name
+  )
 {
-  typedef cpPlugins::BaseObjects::Widget _TWidget;
+  typedef cpPlugins::Pipeline::Widget _TWidget;
 
-  TFilter::Pointer o = this->m_Plugins->CreateFilter( category, filter );
+  TFilter::Pointer o = this->m_Loader.CreateFilter( category, filter );
   if( o.IsNotNull( ) )
   {
     // Choose a name
-    std::string name = filter;
-    while( this->GetFilter( name ) != NULL )
-      name += std::string( "_" );
+    std::string real_name = name;
+    while( this->GetFilter( real_name ) != NULL )
+      real_name += std::string( "_" );
     o->SetPrintExecution( this->m_PrintExecution );
-    o->SetName( name );
+    o->SetName( real_name );
 
     // Interactors
     for(
@@ -130,12 +104,20 @@ CreateFilter( const std::string& category, const std::string& filter )
       o->AddInteractor( *i );
 
     // Finish association
-    this->m_Filters[ name ] = o;
+    this->m_Filters[ real_name ] = o;
 
   } // fi
   return( o.GetPointer( ) );
 }
 
+// -------------------------------------------------------------------------
+cpPlugins::Interface::Workspace::
+TFilter* cpPlugins::Interface::Workspace::
+CreateFilter( const std::string& category, const std::string& filter )
+{
+  return( this->CreateFilter( category, filter, filter ) );
+}
+
 // -------------------------------------------------------------------------
 bool cpPlugins::Interface::Workspace::
 RenameFilter( const std::string& old_name, const std::string& new_name )
@@ -361,7 +343,7 @@ GetExposedOutputs( ) const
 }
 
 // -------------------------------------------------------------------------
-cpPlugins::BaseObjects::DataObject* cpPlugins::Interface::Workspace::
+cpPlugins::Pipeline::DataObject* cpPlugins::Interface::Workspace::
 GetExposedOutput( const std::string& name )
 {
   auto i = this->m_ExposedOutputs.find( name );
@@ -378,7 +360,7 @@ GetExposedOutput( const std::string& name )
 }
 
 // -------------------------------------------------------------------------
-const cpPlugins::BaseObjects::DataObject* cpPlugins::Interface::Workspace::
+const cpPlugins::Pipeline::DataObject* cpPlugins::Interface::Workspace::
 GetExposedOutput( const std::string& name ) const
 {
   auto i = this->m_ExposedOutputs.find( name );
@@ -558,7 +540,7 @@ Connect(
 // -------------------------------------------------------------------------
 void cpPlugins::Interface::Workspace::
 Connect(
-  cpPlugins::BaseObjects::DataObject* output,
+  cpPlugins::Pipeline::DataObject* output,
   const std::string& dest_filter, const std::string& input_name
   )
 {
@@ -570,7 +552,7 @@ Connect(
 // -------------------------------------------------------------------------
 void cpPlugins::Interface::Workspace::
 Connect(
-  cpPlugins::BaseObjects::DataObject* output,
+  cpPlugins::Pipeline::DataObject* output,
   const std::string& exposed_input_name
   )
 {
@@ -594,7 +576,7 @@ Disconnect(
     auto in = dest->GetInput( input_name );
     if( out != NULL && out == in )
       dest->SetInput(
-        input_name, ( cpPlugins::BaseObjects::DataObject* )( NULL )
+        input_name, ( cpPlugins::Pipeline::DataObject* )( NULL )
         );
 
   } // fi
@@ -640,7 +622,6 @@ Workspace( )
   : Superclass( ),
     m_PrintExecution( false )
 {
-  this->m_Plugins = TPlugins::New( );
 }
 
 // -------------------------------------------------------------------------