]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/Interface/ProcessObject.h
MAC compilation issues solved... Now some tests please
[cpPlugins.git] / lib / cpPlugins / Interface / ProcessObject.h
index ddd1c21aa150ad2cd38987e82ad1bfb4f76d3677..e139c994d5e86f9107963ae6acea31fcd626d564 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,57 +43,60 @@ 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;
+      virtual void SetITK( itk::LightObject* o );
+      virtual void SetVTK( vtkObjectBase* o );
+
+      // 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* 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 );
+      OutputProcessObjectPort& GetOutput( const std::string& id );
+      const OutputProcessObjectPort& GetOutput( const std::string& id ) const;
 
       template< class T >
-        inline T* GetInput( const std::string& id );
-
+        inline T* GetInputData( const std::string& id );
       template< class T >
-        inline const T* GetInput( const std::string& id ) const;
-
+        inline const T* GetInputData( const std::string& id ) const;
       template< class T >
-        inline T* GetOutput( const std::string& id );
-
+        inline T* GetOutputData( const std::string& id );
       template< class T >
-        inline const T* GetOutput( const std::string& id ) const;
+        inline const T* GetOutputData( const std::string& id ) const;
+
+      bool SetInput(
+        const std::string& id, const OutputProcessObjectPort& 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, bool required = true );
       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( );
 
@@ -110,23 +108,19 @@ namespace cpPlugins
       Self& operator=( const Self& );
 
     protected:
+      typedef std::map< std::string, InputProcessObjectPort >  _TInputs;
+      typedef std::map< std::string, OutputProcessObjectPort > _TOutputs;
+      _TInputs  m_Inputs;
+      _TOutputs 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;
     };
 
-    /**
-     * Plugin provider
-     */
-    CPPLUGINS_PROVIDER_HEADER( ProcessObject );
-
   } // ecapseman
 
 } // ecapseman