1 #ifndef __CPPLUGINS__INTERFACE__WORKSPACE__H__
2 #define __CPPLUGINS__INTERFACE__WORKSPACE__H__
4 #include <cpExtensions/DataStructures/Graph.h>
5 #include <cpPlugins/Interface/Interface.h>
6 #include <cpPlugins/Interface/DataObject.h>
7 #include <cpPlugins/Interface/ProcessObject.h>
12 // Some forward declarations
19 /** \brief A complex pipeline
21 class cpPlugins_Interface_EXPORT Workspace
24 typedef cpPlugins::Interface::Interface TPlugins;
25 typedef cpPlugins::Interface::Object TObject;
26 typedef cpPlugins::Interface::ProcessObject TFilter;
27 typedef cpPlugins::Interface::DataObject TData;
28 typedef TFilter::TParameters TParameters;
31 typedef std::set< std::string > TStringContainer;
32 typedef std::pair< std::string, std::string > TExposedPort;
33 typedef std::map< std::string, TExposedPort > TExposedPorts;
36 typedef std::pair< std::string, std::string > TConnection;
38 cpExtensions::DataStructures::
39 Graph< TObject::Pointer, TConnection, std::string > TGraph;
43 virtual ~Workspace( );
46 TPlugins* GetPlugins( );
47 const TPlugins* GetPlugins( ) const;
48 void SetPlugins( TPlugins* i );
51 std::string LoadWorkspace( const std::string& fname );
52 std::string SaveWorkspace( const std::string& fname ) const;
56 const TGraph* GetGraph( ) const;
59 void ClearConnections( );
62 TFilter* GetFilter( const std::string& name );
63 const TFilter* GetFilter( const std::string& name ) const;
64 bool HasFilter( const std::string& name ) const;
65 bool CreateFilter( const std::string& filter, const std::string& name );
67 const std::string& old_name, const std::string& new_name
69 void RemoveFilter( const std::string& name );
71 // Connection management
73 const std::string& orig_filter, const std::string& dest_filter,
74 const std::string& output_name, const std::string& input_name
76 bool Connect( TData* input_object, const std::string& exposed_port );
77 void RemoveConnection(
78 const std::string& dest_filter, const std::string& input_name
80 void RemoveConnection( const std::string& exposed_port );
81 void RemoveConnections( const std::string& dest_filter );
84 bool Reduce( const std::string& name );
86 const std::string& name,
87 const std::string& filter, const std::string& filter_input
89 void ExposeOutputPort(
90 const std::string& name,
91 const std::string& filter, const std::string& filter_output
93 void HideInputPort( const std::string& name );
94 void HideOutputPort( const std::string& name );
96 bool RenameExposedInputPort(
97 const std::string& old_name,
98 const std::string& new_name
100 bool RenameExposedOutputPort(
101 const std::string& old_name,
102 const std::string& new_name
105 const TExposedPorts& GetExposedInputPorts( ) const;
106 const TExposedPorts& GetExposedOutputPorts( ) const;
108 TData* GetExposedInput( const std::string& name );
109 const TData* GetExposedInput( const std::string& name ) const;
110 TData* GetExposedOutput( const std::string& name );
111 const TData* GetExposedOutput( const std::string& name ) const;
113 // Pipeline execution
114 std::string Execute( QWidget* p = NULL );
115 std::string Execute( const std::string& name, QWidget* p = NULL );
122 typename TGraph::Pointer m_Graph;
123 TExposedPorts m_ExposedInputPorts;
124 TExposedPorts m_ExposedOutputPorts;
131 #endif // __CPPLUGINS__INTERFACE__WORKSPACE__H__