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 DataObject* GetInput( const std::string& id );
50 const DataObject* GetInput( const std::string& id ) const;
51 DataObject* GetOutput( const std::string& id );
52 const DataObject* GetOutput( const std::string& id ) const;
54 template< class _TType >
55 _TType* GetInputData( const std::string& name );
57 template< class _TType >
58 _TType* GetOutputData( const std::string& name );
60 bool SetInputPort( const std::string& id, const OutputPort& port );
62 void DisconnectInputs( );
63 void DisconnectOutputs( );
67 virtual void Modified( ) const ITK_OVERRIDE;
68 virtual itk::ModifiedTimeType GetMTime( ) const ITK_OVERRIDE;
69 virtual void Update( );
72 virtual ParametersQtDialog* CreateQtDialog( );
73 virtual bool IsInteractive( );
74 virtual void SetInteractionObjects( const std::vector< void* >& objs );
78 virtual ~ProcessObject( );
80 void _AddInput( const std::string& name, bool required = true );
81 void _Error( const std::string& error );
84 inline void _AddOutput( const std::string& name );
87 inline F* _CreateITK( );
89 inline F* _CreateVTK( );
91 virtual void _GenerateData( ) = 0;
94 // Purposely not implemented
95 ProcessObject( const Self& );
96 Self& operator=( const Self& );
99 Parameters m_Parameters;
101 typedef std::map< std::string, InputPort > _TInputs;
102 typedef std::map< std::string, OutputPort > _TOutputs;
106 itk::ModifiedTimeType m_LastExecutionTime;
107 mutable long m_LastExecutionSpan;
109 bool m_PrintExecution;
110 std::ostream* m_PrintExecutionStream;
115 #include <cpPlugins/ProcessObject.hxx>
117 #endif // __CPPLUGINS__PROCESSOBJECT__H__