1 #ifndef __CPPLUGINS__PROCESSOBJECT__H__
2 #define __CPPLUGINS__PROCESSOBJECT__H__
6 #include <cpPlugins/Object.h>
7 #include <cpPlugins/Parameters.h>
8 #include <cpPlugins/Port.h>
14 class cpPlugins_EXPORT ProcessObject
18 typedef ProcessObject Self;
19 typedef Object Superclass;
20 typedef itk::SmartPointer< Self > Pointer;
21 typedef itk::SmartPointer< const Self > ConstPointer;
24 itkTypeMacro( ProcessObject, Object );
25 cpPlugins_Id_Macro( ProcessObject, Object );
27 itkBooleanMacro( PrintExecution );
28 itkGetConstMacro( LastExecutionSpan, long );
29 itkGetConstMacro( PrintExecution, bool );
30 itkSetMacro( PrintExecution, bool );
31 itkSetObjectMacro( PrintExecutionStream, std::ofstream );
34 Parameters* GetParameters( );
35 const Parameters* GetParameters( ) const;
37 virtual void SetITK( itk::LightObject* o ) final;
38 virtual void SetVTK( vtkObjectBase* o ) final;
41 std::set< std::string > GetInputsNames( ) const;
42 std::set< std::string > GetOutputsNames( ) const;
43 unsigned int GetNumberOfInputs( ) const;
44 unsigned int GetNumberOfOutputs( ) const;
46 OutputPort& GetOutputPort( const std::string& id );
47 const OutputPort& GetOutputPort( const std::string& id ) const;
49 template< class _TType = DataObject >
50 inline _TType* GetInput( const std::string& id );
52 template< class _TType = DataObject >
53 inline const _TType* GetInput( const std::string& id ) const;
55 template< class _TType = DataObject >
56 inline _TType* GetOutput( const std::string& id );
58 template< class _TType = DataObject >
59 inline const _TType* GetOutput( const std::string& id ) const;
61 template< class _TType >
62 inline _TType* GetInputData( const std::string& name );
64 template< class _TType >
65 inline _TType* GetOutputData( const std::string& name );
67 bool SetInputPort( const std::string& id, const OutputPort& port );
69 void DisconnectInputs( );
70 void DisconnectOutputs( );
74 virtual void Modified( ) const ITK_OVERRIDE;
75 virtual itk::ModifiedTimeType GetMTime( ) const ITK_OVERRIDE;
76 virtual void Update( );
79 virtual ParametersQtDialog* CreateQtDialog( );
80 virtual bool IsInteractive( );
81 virtual void SetInteractionObjects( const std::vector< void* >& objs );
85 virtual ~ProcessObject( );
87 void _AddInput( const std::string& name, bool required = true );
88 void _Error( const std::string& error );
91 inline void _AddOutput( const std::string& name );
94 inline F* _CreateITK( );
96 inline F* _CreateVTK( );
98 virtual void _GenerateData( ) = 0;
101 // Purposely not implemented
102 ProcessObject( const Self& );
103 Self& operator=( const Self& );
106 Parameters m_Parameters;
108 typedef std::map< std::string, InputPort > _TInputs;
109 typedef std::map< std::string, OutputPort > _TOutputs;
113 itk::ModifiedTimeType m_LastExecutionTime;
114 mutable long m_LastExecutionSpan;
116 bool m_PrintExecution;
117 std::ostream* m_PrintExecutionStream;
122 #include <cpPlugins/ProcessObject.hxx>
124 #endif // __CPPLUGINS__PROCESSOBJECT__H__