1 #ifndef __cpPlugins__Interface__Workspace__h__
2 #define __cpPlugins__Interface__Workspace__h__
4 #include <cpPlugins/Interface/Plugins.h>
5 #include <cpPlugins/BaseObjects/DataObject.h>
6 #include <cpPlugins/BaseObjects/ProcessObject.h>
7 #include <cpPlugins/BaseObjects/Widget.h>
10 class vtkRenderWindowInteractor;
16 /** \brief A complex pipeline
18 class cpPlugins_EXPORT Workspace
22 typedef Workspace Self;
23 typedef itk::Object Superclass;
24 typedef itk::SmartPointer< Self > Pointer;
25 typedef itk::SmartPointer< const Self > ConstPointer;
27 typedef cpPlugins::BaseObjects::DataObject TDataObject;
28 typedef cpPlugins::BaseObjects::ProcessObject TFilter;
29 typedef cpPlugins::BaseObjects::Widget TWidget;
30 typedef cpPlugins::Interface::Plugins TPlugins;
32 typedef std::map< std::string, TFilter::Pointer > TFilters;
36 std::map< std::string, std::pair< std::string, std::string > >
41 itkTypeMacro( Workspace, itk::Object );
45 static Pointer New( );
46 virtual itk::LightObject::Pointer CreateAnother( ) const cpPlugins_OVERRIDE;
47 Pointer Clone( ) const;
50 void Load( const std::string& fname );
51 void Save( const std::string& fname ) const;
57 std::vector< std::string > GetFiltersNames( ) const;
58 TFilter* GetFilter( const std::string& name );
59 const TFilter* GetFilter( const std::string& name ) const;
60 TWidget* GetWidget( const std::string& name );
61 const TWidget* GetWidget( const std::string& name ) const;
62 bool HasFilter( const std::string& name ) const;
63 bool HasWidget( const std::string& name ) const;
64 TFilter* CreateFilter(
65 const std::string& category, const std::string& filter
68 const std::string& old_name, const std::string& new_name
70 bool RemoveFilter( const std::string& name );
72 void SetPrintExecution( bool b );
73 void PrintExecutionOn( );
74 void PrintExecutionOff( );
77 void AddInteractor( vtkRenderWindowInteractor* iren );
79 // Connection management
81 const std::string& origin_filter,
82 const std::string& origin_output,
83 const std::string& destination_filter,
84 const std::string& destination_input
88 const std::string& destination_filter,
89 const std::string& destination_input
92 const std::string& origin_filter,
93 const std::string& origin_output,
94 const std::string& destination_filter,
95 const std::string& destination_input
99 std::vector< std::pair< std::string, std::string > > GetConnections(
100 const std::string& origin, const std::string& destination
103 const std::string& orig_filter, const std::string& dest_filter,
104 const std::string& output_name, const std::string& input_name
107 cpPlugins::BaseObjects::DataObject* output,
108 const std::string& dest_filter, const std::string& input_name
111 cpPlugins::BaseObjects::DataObject* output,
112 const std::string& exposed_input_name
115 const std::string& orig_filter, const std::string& dest_filter,
116 const std::string& output_name, const std::string& input_name
119 const std::string& dest_filter, const std::string& input_name
121 void Disconnect( const std::string& dest_filter );
124 // Pipeline execution
126 void Update( const std::string& name );
130 virtual ~Workspace( );
133 // Purposely not implemented
134 Workspace( const Self& other );
135 Self& operator=( const Self& other );
138 TPlugins::Pointer m_Plugins;
140 bool m_PrintExecution;
143 TExposedPorts m_ExposedInputs;
144 TExposedPorts m_ExposedOutputs;
147 std::set< vtkRenderWindowInteractor* > m_Interactors;
154 #endif // __cpPlugins__Interface__Workspace__h__