#ifndef __cpPlugins__Interface__Workspace__h__ #define __cpPlugins__Interface__Workspace__h__ #include #include #include #include #include class vtkRenderWindowInteractor; namespace cpPlugins { namespace Interface { /** \brief A complex pipeline */ class cpPlugins_EXPORT Workspace : public itk::Object { public: typedef Workspace Self; typedef itk::Object Superclass; typedef itk::SmartPointer< Self > Pointer; typedef itk::SmartPointer< const Self > ConstPointer; typedef cpPlugins::BaseObjects::ProcessObject TProcess; typedef cpPlugins::BaseObjects::Widget TWidget; typedef cpPlugins::Interface::Plugins TInterface; typedef std::map< std::string, TProcess::Pointer > TFilters; typedef std::map< std::string, std::pair< std::string, std::string > > TExposedPorts; public: itkNewMacro( Self ); itkTypeMacro( Workspace, itk::Object ); public: // Workspace IO void Load( const std::string& fname ); void Save( const std::string& fname ) const; // Memory management void Clear( ); // Filter management std::vector< std::string > GetFiltersNames( ) const; TProcess* GetFilter( const std::string& name ); const TProcess* GetFilter( const std::string& name ) const; TWidget* GetWidget( const std::string& name ); const TWidget* GetWidget( const std::string& name ) const; bool HasFilter( const std::string& name ) const; bool HasWidget( const std::string& name ) const; TProcess* CreateFilter( const std::string& category, const std::string& filter, const std::string& name ); bool RenameFilter( const std::string& old_name, const std::string& new_name ); bool RemoveFilter( const std::string& name ); void SetPrintExecution( bool b ); void PrintExecutionOn( ); void PrintExecutionOff( ); // Interactors void AddInteractor( vtkRenderWindowInteractor* iren ); // Exposed ports const TExposedPorts& GetExposedInputs( ) const; const TExposedPorts& GetExposedOutputs( ) const; cpPlugins::BaseObjects::DataObject* GetExposedOutput( const std::string& name ); const cpPlugins::BaseObjects::DataObject* GetExposedOutput( const std::string& name ) const; bool ExposeInput( const std::string& name, const std::string& filter, const std::string& filter_input ); bool ExposeOutput( const std::string& name, const std::string& filter, const std::string& filter_output ); void HideInput( const std::string& name ); void HideOutput( const std::string& name ); bool RenameExposedInput( const std::string& old_name, const std::string& new_name ); bool RenameExposedOutput( const std::string& old_name, const std::string& new_name ); // Connection management std::vector< std::pair< std::string, std::string > > GetConnections( const std::string& origin, const std::string& destination ) const; void Connect( const std::string& orig_filter, const std::string& dest_filter, const std::string& output_name, const std::string& input_name ); void Connect( cpPlugins::BaseObjects::DataObject* output, const std::string& dest_filter, const std::string& input_name ); void Connect( cpPlugins::BaseObjects::DataObject* output, const std::string& exposed_input_name ); void Disconnect( const std::string& orig_filter, const std::string& dest_filter, const std::string& output_name, const std::string& input_name ); void Disconnect( const std::string& dest_filter, const std::string& input_name ); void Disconnect( const std::string& dest_filter ); // Pipeline execution void Execute( ); void Execute( const std::string& name ); protected: Workspace( ); virtual ~Workspace( ); private: // Purposely not implemented Workspace( const Self& other ); Self& operator=( const Self& other ); protected: TFilters m_Filters; bool m_PrintExecution; TExposedPorts m_ExposedInputs; TExposedPorts m_ExposedOutputs; std::set< vtkRenderWindowInteractor* > m_Interactors; }; } // ecapseman } // ecapseman #endif // __cpPlugins__Interface__Workspace__h__ // eof - $RCSfile$