]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/Interface/ProcessObject.h
...
[cpPlugins.git] / lib / cpPlugins / Interface / ProcessObject.h
index ec6cb2a53bb7a69fe96d3d166691f2ec8d58666c..862da18b48a949f46fcd4b033ec9928d6846d701 100644 (file)
@@ -1,20 +1,15 @@
 #ifndef __CPPLUGINS__INTERFACE__PROCESSOBJECT__H__
 #define __CPPLUGINS__INTERFACE__PROCESSOBJECT__H__
 
+#include <map>
 #include <set>
 
 #include <itkDataObject.h>
-
-#include <cpPlugins/Interface/DataObject.h>
+#include <cpPlugins/Interface/ProcessObjectPort.h>
 #include <cpPlugins/Interface/Parameters.h>
 
 // Some forward declarations
 class vtkRenderWindowInteractor;
-#ifdef cpPlugins_Interface_QT4
-class QWidget;
-#else
-typedef char QWidget;
-#endif // cpPlugins_Interface_QT4
 
 namespace cpPlugins
 {
@@ -48,75 +43,55 @@ namespace cpPlugins
       itkTypeMacro( ProcessObject, Object );
       cpPlugins_Id_Macro( ProcessObject, BaseObject );
 
-      itkBooleanMacro( Interactive );
-      itkGetConstMacro( Interactive, bool );
-      itkSetMacro( Interactive, bool );
-
       itkGetConstObjectMacro( Parameters, TParameters );
+
       itkGetObjectMacro( Parameters, TParameters );
+      itkGetMacro( ParametersDialog, ParametersQtDialog* );
+      itkGetMacro( SingleInteractor, vtkRenderWindowInteractor* );
+      itkGetMacro( MPRViewer, SimpleMPRWidget* );
+
+      itkSetObjectMacro( ParametersDialog, ParametersQtDialog );
+      itkSetObjectMacro( SingleInteractor, vtkRenderWindowInteractor );
+      itkSetObjectMacro( MPRViewer, SimpleMPRWidget );
 
     public:
-      virtual std::set< std::string > GetInputsNames( ) const;
-      virtual std::set< std::string > GetOutputsNames( ) const;
+      // IO management
+      std::set< std::string > GetInputsNames( ) const;
+      std::set< std::string > GetOutputsNames( ) const;
       unsigned int GetNumberOfInputs( ) const;
       unsigned int GetNumberOfOutputs( ) const;
 
-      virtual bool SetInput( const std::string& id, DataObject::Pointer* dobj );
-
-      virtual std::string Update( );
-      virtual void DisconnectOutputs( );
-
-      // Widgets management
-      vtkRenderWindowInteractor* GetSingleInteractor( );
-      const vtkRenderWindowInteractor* GetSingleInteractor( ) const;
-      void SetSingleInteractor( vtkRenderWindowInteractor* interactor );
-      SimpleMPRWidget* GetMPRViewer( );
-      const SimpleMPRWidget* GetMPRViewer( ) const;
-      void SetMPRViewer( SimpleMPRWidget* wdg );
-      virtual bool ExecConfigurationDialog( QWidget* parent );
+      ProcessObjectPort& GetOutput( const std::string& id );
+      const ProcessObjectPort& GetOutput( const std::string& id ) const;
 
       template< class T >
         inline T* GetInputData( const std::string& id );
-
       template< class T >
         inline const T* GetInputData( const std::string& id ) const;
-
       template< class T >
         inline T* GetOutputData( const std::string& id );
-
       template< class T >
         inline const T* GetOutputData( const std::string& id ) const;
 
-      DataObject::Pointer* GetOutputPort( const std::string& id )
-      {
-        auto i = this->m_Outputs.find( id );
-        if( i != this->m_Outputs.end( ) )
-          return( i->second );
-        else
-          return( NULL );
-      }
-
-      const DataObject::Pointer* GetOutputPort( const std::string& id ) const
-      {
-        auto i = this->m_Outputs.find( id );
-        if( i != this->m_Outputs.end( ) )
-          return( i->second );
-        else
-          return( NULL );
-      }
+      bool SetInput( const std::string& id, const ProcessObjectPort& port );
+
+      void DisconnectInputs( );
+      void DisconnectOutputs( );
+      void Disconnect( );
+
+      // Pipeline execution
+      virtual itk::ModifiedTimeType GetMTime( ) const;
+      virtual std::string Update( );
 
     protected:
       ProcessObject( );
       virtual ~ProcessObject( );
 
-      virtual void _AddInput( const std::string& name );
-
+      void _AddInput( const std::string& name );
       template< class O >
-        inline void _AddOutput( const std::string& id );
-
+        inline void _AddOutput( const std::string& name );
       template< class F >
         inline F* _CreateITK( );
-
       template< class F >
         inline F* _CreateVTK( );
 
@@ -128,16 +103,16 @@ namespace cpPlugins
       Self& operator=( const Self& );
 
     protected:
+      typedef std::map< std::string, ProcessObjectPort > _TDataContainer;
+      _TDataContainer     m_Inputs;
+      _TDataContainer     m_Outputs;
       Parameters::Pointer m_Parameters;
-      ParametersQtDialog* m_ParametersDialog;
 
-      vtkSmartPointer< vtkRenderWindowInteractor > m_SingleInteractor;
-      SimpleMPRWidget*                             m_MPRViewer;
-      bool                                         m_Interactive;
+      itk::ModifiedTimeType m_LastExecutionTime;
 
-      typedef std::map< std::string, DataObject::Pointer* > _TDataContainer;
-      _TDataContainer m_Inputs;
-      _TDataContainer m_Outputs;
+      ParametersQtDialog*        m_ParametersDialog;
+      vtkRenderWindowInteractor* m_SingleInteractor;
+      SimpleMPRWidget*           m_MPRViewer;
     };
 
   } // ecapseman