X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPlugins%2FInterface%2FProcessObject.h;h=82492db180639484e977f5fae5659c371b90781c;hb=94a44f4cdf4747eccc933df0a9c75ec86e825d2e;hp=a5404a890e91962279d07dbd61be11108815e6e2;hpb=46b59f108abf7e97de551cc4500ec1c1e3e58a59;p=cpPlugins.git diff --git a/lib/cpPlugins/Interface/ProcessObject.h b/lib/cpPlugins/Interface/ProcessObject.h index a5404a8..82492db 100644 --- a/lib/cpPlugins/Interface/ProcessObject.h +++ b/lib/cpPlugins/Interface/ProcessObject.h @@ -1,39 +1,41 @@ #ifndef __CPPLUGINS__INTERFACE__PROCESSOBJECT__H__ #define __CPPLUGINS__INTERFACE__PROCESSOBJECT__H__ -#include -#include -#include -#include #include +#include #include #include +#include + +#ifdef cpPlugins_Interface_QT4 +class QWidget; +#else +typedef char QWidget +#endif // cpPlugins_Interface_QT4 + +#include namespace cpPlugins { namespace Interface { - class DataObject; - /** */ class cpPlugins_Interface_EXPORT ProcessObject : public Object { public: - typedef ProcessObject Self; - typedef Object Superclass; - - typedef std::pair< std::string, std::string > TParameter; - typedef std::map< std::string, TParameter > TParameters; + typedef ProcessObject Self; + typedef Object Superclass; + typedef itk::SmartPointer< Self > Pointer; + typedef itk::SmartPointer< const Self > ConstPointer; public: - ProcessObject( ); - virtual ~ProcessObject( ); + itkTypeMacro( ProcessObject, Object ); - virtual std::string GetClassName( ) const; - virtual const TParameters& GetDefaultParameters( ) const; - virtual void SetParameters( const TParameters& params ); + public: + virtual const Parameters& GetDefaultParameters( ) const; + virtual void SetParameters( const Parameters& params ); virtual unsigned int GetNumberOfInputs( ) const; virtual unsigned int GetNumberOfOutputs( ) const; @@ -41,46 +43,54 @@ namespace cpPlugins virtual void SetNumberOfInputs( unsigned int n ); virtual void SetNumberOfOutputs( unsigned int n ); - virtual void SetInput( unsigned int idx, const DataObject* dobj ); - virtual DataObject* GetOutput( unsigned int idx ); + virtual void SetInput( unsigned int idx, DataObject* dobj ); virtual std::string Update( ); virtual void DisconnectOutputs( ); + virtual bool ExecConfigurationDialog( QWidget* parent ); + + template< class T > + inline T* GetInput( unsigned int idx ); + + template< class T > + inline const T* GetInput( unsigned int idx ) const; + + template< class T > + inline T* GetOutput( unsigned int idx ); + + template< class T > + inline const T* GetOutput( unsigned int idx ) const; + protected: - virtual itk::DataObject* _GetInput( unsigned int idx ); - virtual void _SetOutput( unsigned int idx, itk::DataObject* dobj ); - virtual void _DeleteOutputs( ); + ProcessObject( ); + virtual ~ProcessObject( ); template< class O > - void _MakeOutput( unsigned int idx ) - { - if( idx >= this->m_Outputs.size( ) ) - return; - - if( !( this->m_OutputsDisconnected ) ) - if( this->m_Outputs[ idx ] != NULL ) - delete this->m_Outputs[ idx ]; - - this->m_Outputs[ idx ] = new O( ); - this->m_Outputs[ idx ]->SetSource( this ); - } + inline void _MakeOutput( unsigned int idx ); virtual std::string _GenerateData( ) = 0; + private: + // Purposely not implemented + ProcessObject( const Self& ); + Self& operator=( const Self& ); + protected: - TParameters m_DefaultParameters; - TParameters m_Parameters; + itk::ProcessObject::Pointer m_RealProcessObject; + Parameters m_DefaultParameters; + Parameters m_Parameters; - std::vector< const DataObject* > m_Inputs; - std::vector< DataObject* > m_Outputs; - bool m_OutputsDisconnected; + std::vector< DataObject::Pointer > m_Inputs; + std::vector< DataObject::Pointer > m_Outputs; }; } // ecapseman } // ecapseman +#include + #endif // __CPPLUGINS__INTERFACE__PROCESSOBJECT__H__ // eof - $RCSfile$