]> Creatis software - cpPlugins.git/blob - lib/cpPlugins/Interface/ProcessObject.h
...
[cpPlugins.git] / lib / cpPlugins / Interface / ProcessObject.h
1 #ifndef __CPPLUGINS__INTERFACE__PROCESSOBJECT__H__
2 #define __CPPLUGINS__INTERFACE__PROCESSOBJECT__H__
3
4 #include <set>
5
6 #include <itkDataObject.h>
7
8 #include <cpPlugins/Interface/DataObject.h>
9 #include <cpPlugins/Interface/Parameters.h>
10
11 // Some forward declarations
12 class vtkRenderWindowInteractor;
13 #ifdef cpPlugins_Interface_QT4
14 class QWidget;
15 #else
16 typedef char QWidget;
17 #endif // cpPlugins_Interface_QT4
18
19 namespace cpPlugins
20 {
21   namespace Interface
22   {
23     // Some forward declarations
24 #ifdef cpPlugins_Interface_QT4
25     class ParametersQtDialog;
26 #else
27     typedef char ParametersQtDialog;
28 #endif // cpPlugins_Interface_QT4
29
30     /**
31      */
32     class cpPlugins_Interface_EXPORT ProcessObject
33       : public Object
34     {
35     public:
36       typedef ProcessObject                   Self;
37       typedef Object                          Superclass;
38       typedef itk::SmartPointer< Self >       Pointer;
39       typedef itk::SmartPointer< const Self > ConstPointer;
40
41       typedef Parameters TParameters;
42       typedef std::set< vtkRenderWindowInteractor* > TInteractors;
43       typedef bool DialogResult;
44
45     public:
46       itkTypeMacro( ProcessObject, Object );
47       cpPlugins_Id_Macro( ProcessObject, BaseObject );
48
49       itkBooleanMacro( Interactive );
50       itkGetConstMacro( Interactive, bool );
51       itkSetMacro( Interactive, bool );
52
53       itkGetConstObjectMacro( Parameters, TParameters );
54       itkGetObjectMacro( Parameters, TParameters );
55
56     public:
57       virtual std::set< std::string > GetInputsNames( ) const;
58       virtual std::set< std::string > GetOutputsNames( ) const;
59       unsigned int GetNumberOfInputs( ) const;
60       unsigned int GetNumberOfOutputs( ) const;
61
62       virtual bool SetInput( const std::string& id, DataObject* dobj );
63
64       virtual std::string Update( );
65       virtual void DisconnectOutputs( );
66
67       virtual const TInteractors& GetInteractors( ) const;
68       virtual void AddInteractor( vtkRenderWindowInteractor* interactor );
69       virtual bool ExecConfigurationDialog( QWidget* parent );
70
71       template< class T >
72         inline T* GetInput( const std::string& id );
73
74       template< class T >
75         inline const T* GetInput( const std::string& id ) const;
76
77       template< class T >
78         inline T* GetOutput( const std::string& id );
79
80       template< class T >
81         inline const T* GetOutput( const std::string& id ) const;
82
83     protected:
84       ProcessObject( );
85       virtual ~ProcessObject( );
86
87       virtual void _AddInput( const std::string& name );
88
89       template< class O >
90         inline void _AddOutput( const std::string& id );
91
92       template< class F >
93         inline F* _CreateITK( );
94
95       template< class F >
96         inline F* _CreateVTK( );
97
98       virtual std::string _GenerateData( ) = 0;
99
100     private:
101       // Purposely not implemented
102       ProcessObject( const Self& );
103       Self& operator=( const Self& );
104
105     protected:
106       Parameters::Pointer m_Parameters;
107       ParametersQtDialog* m_ParametersDialog;
108
109       TInteractors m_Interactors;
110       bool         m_Interactive;
111
112       typedef std::map< std::string, DataObject::Pointer > _TDataContainer;
113       _TDataContainer m_Inputs;
114       _TDataContainer m_Outputs;
115     };
116
117     /**
118      * Plugin provider
119      */
120     CPPLUGINS_PROVIDER_HEADER( ProcessObject );
121
122   } // ecapseman
123
124 } // ecapseman
125
126 #include <cpPlugins/Interface/ProcessObject.hxx>
127
128 #endif // __CPPLUGINS__INTERFACE__PROCESSOBJECT__H__
129
130 // eof - $RCSfile$