MeVisLab Toolbox Reference
mlConnectors.h
Go to the documentation of this file.
1 /*************************************************************************************
2 **
3 ** Copyright 2007, MeVis Medical Solutions AG
4 **
5 ** The user may use this file in accordance with the license agreement provided with
6 ** the Software or, alternatively, in accordance with the terms contained in a
7 ** written agreement between the user and MeVis Medical Solutions AG.
8 **
9 ** For further information use the contact form at https://www.mevislab.de/contact
10 **
11 **************************************************************************************/
12 
13 #ifndef ML_CONNECTORS_H
14 #define ML_CONNECTORS_H
15 
18 
19 // ML-includes
20 #include "mlInitSystemML.h"
21 #include "mlRuntimeSubClass.h"
22 #include "mlPagedImage.h"
23 
24 #if ML_DEPRECATED_SINCE(3,5,0)
25 #include "mlModule.h"
26 #endif
27 
28 
29 // Namespace ML. It is recommended that all ML classes and modules are in this
30 // name space to avoid collisions with types of other libraries.
31 ML_START_NAMESPACE
32 
34 class Module;
35 class InputConnector;
37 
38 //-------------------------------------------------------------------------
50 //-------------------------------------------------------------------------
52 {
53 
54 public:
55 
58  OutputConnector(Module& module, MLint index);
59 
61  virtual ~OutputConnector();
62 
64  Module& getModule() const;
65 
67  MLint getIndex() const;
68 
71 
74 
77 
78 private:
79 
82 
85  OutputConnector& operator=(const OutputConnector &);
86 
88  void _addLink(InputConnector& link);
89 
91  MLint _removeLink(InputConnector& link);
92 
95  MLint _isLink(const InputConnector& link) const;
96 
97 
98  // --- Members:
99 
101  Module *_module;
102 
104  MLint _thisIndex;
105 
107  PagedImage _pagedImg;
108 
110  std::vector <InputConnector*> _inLinkList;
111 
113  friend class InputConnector;
114 
115 
116 #if ML_DEPRECATED_SINCE(3,5,0)
117 
120 
121 public:
122 
125  inline ML_DEPRECATED BaseOp& getOp() const { return *static_cast<BaseOp*>(&getModule()); }
128  inline ML_DEPRECATED InputConnector* getLink(MLint i) const { return getConnector(i); }
131  inline ML_DEPRECATED MLint getLinkNum() const { return getNumConnectors(); }
134  inline ML_DEPRECATED PagedImg& getPagedImg() { return getImage(); }
135 
137 #endif
138 
139 };
140 
141 
142 
143 
144 //-------------------------------------------------------------------------
146 
153 //-------------------------------------------------------------------------
155 {
156 
157 public:
158 
161  InputConnector(Module& module, MLint index);
162 
166  InputConnector(Module& module, MLint index, OutputConnector& outputConnector);
167 
169  virtual ~InputConnector();
170 
172  Module& getModule() const;
173 
175  MLint getIndex() const;
176 
179 
182  void connect(OutputConnector& connector);
183 
185  void disconnect();
186 
189  bool isValidConnection() const;
190 
191 private:
192  friend class OutputConnector;
193 
196 
199  InputConnector& operator=(const InputConnector &);
200 
201 
202  // --- Members:
203 
205  Module *_module;
206 
208  MLint _thisIndex;
209 
211  OutputConnector *_outLink;
212 
213 
214 #if ML_DEPRECATED_SINCE(3,5,0)
215 
218 
219 public:
222  inline ML_DEPRECATED BaseOp &getOp() const { return *static_cast<BaseOp*>(&getModule()); }
225  inline ML_DEPRECATED OutputConnector* getLink() const { return getConnector(); }
227 
228 #endif
229 
230 };
231 
232 ML_END_NAMESPACE
233 
234 
235 #endif
236 
237 
#define ML_DEPRECATED
Definition: CSOGroup.h:371
Class to manage an input connection of a Module module.
Definition: mlConnectors.h:155
OutputConnector * getConnector() const
Returns the connected OutputConnector. Could be NULL.
void disconnect()
Disconnects this connector from the OutputConnector bidirectionally if it exists.
virtual ~InputConnector()
Destructor: Destroys this and its connection to the OutputConnector bidirectionally.
bool isValidConnection() const
Returns true if bidirectional connection is valid, otherwise false.
void connect(OutputConnector &connector)
Creates connection between this and the OutputConnector connector bidirectionally.
Module & getModule() const
Returns the Module to which this connector belongs to.
InputConnector(Module &module, MLint index, OutputConnector &outputConnector)
Constructor: Creates input connection for module module at input index and connect bidirectionally wi...
MLint getIndex() const
Returns index of input connection which is represented by this connector.
InputConnector(Module &module, MLint index)
Constructor: Creates input connection for module module at input index.
Base class for an image processing module of the ML.
Definition: mlModule.h:156
Class to manage an output connection for a Module module.
Definition: mlConnectors.h:52
virtual ~OutputConnector()
Destructor: Destroy this and disconnects connections from all InputConnectors.
Module & getModule() const
Returns module to which this connector belongs to.
OutputConnector(Module &module, MLint index)
Constructor: Create output image connection for module module and output index index.
InputConnector * getConnector(MLint i) const
Returns InputConnector with index i.
MLint getIndex() const
Returns output index of of this connector on the Module.
PagedImage & getImage()
Returns the paged image of this connector.
MLint getNumConnectors() const
Returns number of connected InputConnectors.
Class which represents an image, which manages properties of an image and image data which is located...
Definition: mlPagedImage.h:70
#define MLEXPORT
To export symbols from a dll/shared object, we need to mark them with the MLEXPORT symbol.
MLint64 MLint
A signed ML integer type with at least 64 bits used for index calculations on very large images even ...
Definition: mlTypeDefs.h:578