SCIRun  5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NetworkInterface.h
Go to the documentation of this file.
1 /*
2  For more information, please see: http://software.sci.utah.edu
3 
4  The MIT License
5 
6  Copyright (c) 2012 Scientific Computing and Imaging Institute,
7  University of Utah.
8 
9 
10  Permission is hereby granted, free of charge, to any person obtaining a
11  copy of this software and associated documentation files (the "Software"),
12  to deal in the Software without restriction, including without limitation
13  the rights to use, copy, modify, merge, publish, distribute, sublicense,
14  and/or sell copies of the Software, and to permit persons to whom the
15  Software is furnished to do so, subject to the following conditions:
16 
17  The above copyright notice and this permission notice shall be included
18  in all copies or substantial portions of the Software.
19 
20  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26  DEALINGS IN THE SOFTWARE.
27 */
28 
29 /// @todo Documentation Dataflow/Network/NetworkInterface.h
30 
31 
32 #ifndef DATAFLOW_NETWORK_NETWORK_INTERFACE_H
33 #define DATAFLOW_NETWORK_NETWORK_INTERFACE_H
34 
38 #include <string>
39 #include <vector>
40 #include <map>
41 #include <Dataflow/Network/share.h>
42 
43 namespace SCIRun {
44 namespace Dataflow {
45 namespace Networks {
46 
47  /// @todo: hacky duplication...
49  {
50  public:
51  virtual ~ExecutableLookup() {}
52  virtual ExecutableObject* lookupExecutable(const ModuleId& id) const = 0;
53  virtual int errorCode() const = 0;
54  };
55 
56  typedef std::pair<ModuleHandle, PortId> ModulePortIdPair;
57 
59  {
61 
62  /// @todo: only used in test code
63  ConnectionOutputPort(ModuleHandle m, size_t index);
64  };
65 
67  {
69 
70  /// @todo: only used in test code
71  ConnectionInputPort(ModuleHandle m, size_t index);
72  };
73 
75  {
76  public:
77  typedef std::vector<ConnectionDescription> ConnectionDescriptionList;
78 
79  virtual ~NetworkInterface() {}
80  virtual ModuleHandle add_module(const ModuleLookupInfo& info) = 0;
81  virtual bool remove_module(const ModuleId& id) = 0;
82  virtual size_t nmodules() const = 0;
83  virtual ModuleHandle module(size_t i) const = 0;
84  virtual ModuleHandle lookupModule(const ModuleId& id) const = 0;
85 
86  virtual ConnectionId connect(const ConnectionOutputPort&, const ConnectionInputPort&) = 0;
87  virtual bool disconnect(const ConnectionId&) = 0;
88  virtual size_t nconnections() const = 0;
89  virtual void disable_connection(const ConnectionId&) = 0;
90  virtual ConnectionDescriptionList connections() const = 0;
91  virtual void incrementErrorCode(const ModuleId& moduleId) = 0;
92  virtual NetworkGlobalSettings& settings() = 0;
93  virtual void setModuleExecutionState(ModuleInterface::ExecutionState state) = 0;
94  virtual void clear() = 0;
95 
96  virtual std::string toString() const = 0;
97  };
98 
100  {
101  public:
103  virtual void requestConnection(const PortDescriptionInterface* from, const PortDescriptionInterface* to) = 0;
104  };
105 
107  {
108  public:
110  virtual NetworkHandle getNetwork() const = 0;
111  virtual void setNetwork(NetworkHandle nh) = 0;
112  virtual ModuleHandle addModule(const ModuleLookupInfo& info) = 0;
113  virtual void enableSignals() = 0;
114  virtual void disableSignals() = 0;
115  };
116 
117 }}}
118 
119 
120 #endif
ExecutionState
Definition: ModuleInterface.h:90
std::vector< ConnectionDescription > ConnectionDescriptionList
Definition: NetworkInterface.h:77
Definition: ConnectionId.h:67
Definition: ModuleDescription.h:99
#define SCISHARE
Definition: share.h:39
virtual ~ExecutableLookup()
Definition: NetworkInterface.h:51
virtual ~NetworkEditorControllerInterface()
Definition: NetworkInterface.h:109
Definition: ExecutableObject.h:45
Definition: ModuleDescription.h:77
virtual ~ConnectionMakerService()
Definition: NetworkInterface.h:102
ConnectionOutputPort(ModuleHandle m, const PortId &p)
Definition: NetworkInterface.h:60
virtual ~NetworkInterface()
Definition: NetworkInterface.h:79
boost::shared_ptr< ModuleInterface > ModuleHandle
Definition: NetworkFwd.h:74
std::pair< ModuleHandle, PortId > ModulePortIdPair
Definition: NetworkInterface.h:56
Definition: NetworkInterface.h:58
Definition: ModuleDescription.h:45
Definition: NetworkInterface.h:74
boost::shared_ptr< NetworkInterface > NetworkHandle
Definition: NetworkFwd.h:71
ConnectionInputPort(ModuleHandle m, const PortId &p)
Definition: NetworkInterface.h:68
Definition: NetworkInterface.h:48
Definition: NetworkInterface.h:66