ML Reference
MeVis/Foundation/Sources/ML/include/mlConnectors.h
Go to the documentation of this file.
00001 // **InsertLicense** code
00002 //-------------------------------------------------------------------------
00010 //-------------------------------------------------------------------------
00011 #ifndef __mlConnectors_H
00012 #define __mlConnectors_H
00013 
00014 // ML-includes
00015 #ifndef __mlInitSystemML_H
00016 #include "mlInitSystemML.h"
00017 #endif
00018 #ifndef __mlRuntimeSubClass_H
00019 #include "mlRuntimeSubClass.h"
00020 #endif
00021 #ifndef __mlPagedImage_H
00022 #include "mlPagedImage.h"
00023 #endif
00024 
00025 #ifdef ML_DEPRECATED
00026 #include "mlModule.h"
00027 #endif // ML_DEPRECATED
00028 
00029 
00030 // Namespace ML. It is recommended that all ML classes and modules are in this
00031 // name space to avoid collisions with types of other libraries.
00032 ML_START_NAMESPACE
00033 
00035 class Module;
00036 class InputConnector;
00038 
00039 // Disable warnings on own usage of deprecation
00040 #ifdef _MSC_VER
00041 #pragma warning(push)
00042 #pragma warning(disable : 4996 )
00043 #endif
00044 
00045 //-------------------------------------------------------------------------
00057 //-------------------------------------------------------------------------
00058 class MLEXPORT OutputConnector
00059 {
00060 
00061 public:
00062 
00065   OutputConnector(Module& module, MLint index);
00066   
00068   virtual ~OutputConnector();
00069   
00071   Module& getModule() const;
00072   
00074   MLint getIndex() const;
00075   
00077   MLint getNumConnectors() const;
00078   
00080   InputConnector* getConnector(MLint i) const;
00081   
00083   PagedImage& getImage();
00084   
00085 private:
00086   
00088   OutputConnector(const OutputConnector &);
00089   
00092   OutputConnector& operator=(const OutputConnector &);
00093   
00095   void           _addLink(InputConnector& link);
00096   
00098   MLint          _removeLink(InputConnector& link);
00099   
00102   MLint          _isLink(const InputConnector& link) const;
00103   
00104   
00105   // --- Members:
00106   
00108   Module        *_module;
00109   
00111   MLint          _thisIndex;
00112   
00114   PagedImage       _pagedImg;
00115   
00117   std::vector <InputConnector*> _inLinkList;
00118   
00120   friend class InputConnector;
00121   
00122   
00123 #ifdef ML_DEPRECATED
00124 
00126 
00127   
00128 public:
00129   
00132   inline ML_DEPRECATED BaseOp& getOp() const { return *static_cast<BaseOp*>(&getModule()); }
00135   inline ML_DEPRECATED InputConnector* getLink(MLint i) const { return getConnector(i); }
00138   inline ML_DEPRECATED MLint getLinkNum() const { return getNumConnectors(); }
00141   inline ML_DEPRECATED PagedImg& getPagedImg() { return getImage(); }
00142   
00144 #endif // ML_DEPRECATED
00145   
00146 };
00147 
00148 
00149 
00150 
00151 //-------------------------------------------------------------------------
00153 
00160 //-------------------------------------------------------------------------
00161 class MLEXPORT InputConnector
00162 {
00163 
00164 public:
00165 
00168   InputConnector(Module& module, MLint index);
00169   
00173   InputConnector(Module& module, MLint index, OutputConnector& outputConnector);
00174   
00176   virtual ~InputConnector();
00177   
00179   Module& getModule() const;
00180   
00182   MLint getIndex() const;
00183   
00185   OutputConnector* getConnector() const;
00186   
00189   void connect(OutputConnector& connector);
00190   
00192   void disconnect();
00193   
00196   bool isValidConnection() const;
00197   
00198 private:
00199   friend class OutputConnector;
00200 
00202   InputConnector(const InputConnector &);
00203   
00206   InputConnector& operator=(const InputConnector &);
00207   
00208   
00209   // --- Members:
00210   
00212   Module          *_module;
00213   
00215   MLint            _thisIndex;
00216   
00218   OutputConnector *_outLink;
00219   
00220   
00221 #ifdef ML_DEPRECATED
00222 
00224 
00225   
00226 public:  
00229   inline ML_DEPRECATED BaseOp &getOp() const { return *static_cast<BaseOp*>(&getModule()); }
00232   inline ML_DEPRECATED OutputConnector* getLink() const { return getConnector(); }
00234   
00235 #endif // ML_DEPRECATED
00236   
00237 };
00238 
00239 // re-enable deprecation warnings
00240 #ifdef _MSC_VER
00241 #pragma warning(pop)
00242 #endif
00243 
00244 ML_END_NAMESPACE
00245 
00246 
00247 #endif // __mlConnectors_H
00248 
00249