ML 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 // Namespace ML. It is recommended that all ML classes and modules reside in this
25 // namespace to avoid collisions with types from other libraries.
26 ML_START_NAMESPACE
27 
29 class Module;
30 class InputConnector;
32 
33 //-------------------------------------------------------------------------
45 //-------------------------------------------------------------------------
47 {
48 
49 public:
50 
53  OutputConnector(Module& module, MLint index);
54 
56  virtual ~OutputConnector();
57 
59  Module& getModule() const;
60 
62  MLint getIndex() const;
63 
66 
69 
72 
73 private:
74 
77 
80  OutputConnector& operator=(const OutputConnector &);
81 
83  void _addLink(InputConnector& link);
84 
86  MLint _removeLink(InputConnector& link);
87 
90  MLint _isLink(const InputConnector& link) const;
91 
92 
93  // --- Members:
94 
96  Module *_module;
97 
99  MLint _thisIndex;
100 
102  PagedImage _pagedImg;
103 
105  std::vector <InputConnector*> _inLinkList;
106 
108  friend class InputConnector;
109 };
110 
111 
112 
113 
114 //-------------------------------------------------------------------------
116 
123 //-------------------------------------------------------------------------
125 {
126 
127 public:
128 
131  InputConnector(Module& module, MLint index);
132 
136  InputConnector(Module& module, MLint index, OutputConnector& outputConnector);
137 
139  virtual ~InputConnector();
140 
142  Module& getModule() const;
143 
145  MLint getIndex() const;
146 
149 
152  void connect(OutputConnector& connector);
153 
155  void disconnect();
156 
159  bool isValidConnection() const;
160 
161 private:
162  friend class OutputConnector;
163 
166 
169  InputConnector& operator=(const InputConnector &);
170 
171 
172  // --- Members:
173 
175  Module *_module;
176 
178  MLint _thisIndex;
179 
181  OutputConnector *_outLink;
182 };
183 
184 ML_END_NAMESPACE
185 
186 
187 #endif
188 
189 
Class to manage an input connection of a Module module.
Definition: mlConnectors.h:125
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, it returns false.
void connect(OutputConnector &connector)
Creates a 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 an input connection for the module module at input index and connect bidirection...
MLint getIndex() const
Returns the index of the input connection that is represented by this connector.
InputConnector(Module &module, MLint index)
Constructor: Creates an input connection for module module at input index.
Base class for an image processing module of the ML.
Definition: mlModule.h:151
Class to manage an output connection for a Module module.
Definition: mlConnectors.h:47
virtual ~OutputConnector()
Destructor: Destroys this and disconnects connections from all InputConnectors.
Module & getModule() const
Returns the 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 the InputConnector with index i.
MLint getIndex() const
Returns the output index of of this connector on the Module.
PagedImage & getImage()
Returns the paged image of this connector.
MLint getNumConnectors() const
Returns the number of connected InputConnectors.
The class PagedImage, representing a fragmented image that manages properties and data of an image lo...
Definition: mlPagedImage.h:66
#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:490