Developer Documentation
elementInOut.hh
1 /*===========================================================================*\
2 * *
3 * OpenFlipper *
4  * Copyright (c) 2001-2015, RWTH-Aachen University *
5  * Department of Computer Graphics and Multimedia *
6  * All rights reserved. *
7  * www.openflipper.org *
8  * *
9  *---------------------------------------------------------------------------*
10  * This file is part of OpenFlipper. *
11  *---------------------------------------------------------------------------*
12  * *
13  * Redistribution and use in source and binary forms, with or without *
14  * modification, are permitted provided that the following conditions *
15  * are met: *
16  * *
17  * 1. Redistributions of source code must retain the above copyright notice, *
18  * this list of conditions and the following disclaimer. *
19  * *
20  * 2. Redistributions in binary form must reproduce the above copyright *
21  * notice, this list of conditions and the following disclaimer in the *
22  * documentation and/or other materials provided with the distribution. *
23  * *
24  * 3. Neither the name of the copyright holder nor the names of its *
25  * contributors may be used to endorse or promote products derived from *
26  * this software without specific prior written permission. *
27  * *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39 * *
40 \*===========================================================================*/
41 
42 
43 #ifndef VSI_ELEMENTINOUT_HH
44 #define VSI_ELEMENTINOUT_HH
45 
46 //== INCLUDES =================================================================
47 
48 #include <QList>
49 
50 //== FORWARDDECLARATIONS ======================================================
51 class QGraphicsItem;
52 
53 //== NAMESPACES ===============================================================
54 namespace VSI {
55 
56 //== FORWARDDECLARATIONS ======================================================
57 class Text;
58 class ConnectionPoint;
59 class Connection;
60 class InOut;
61 class GraphicsScene;
62 class SceneElement;
63 
64 //== CLASS DEFINITION =========================================================
65 
69 class ElementInOut {
70 
71  public:
72 
74  enum Type {
75  TypeInput,
76  TypeOutput
77  };
78 
80  ElementInOut (InOut *_io, SceneElement *_parent);
81 
83  virtual ~ElementInOut ();
84 
86  virtual Type type () const = 0;
87 
89  ConnectionPoint *connectionPointItem () const { return conn_; }
90 
92  Text *typeTextItem () const { return typeText_; }
93 
95  Text *descriptionTextItem () const { return descText_; }
96 
98  QList<Connection *> connections () const { return connections_; };
99 
101  virtual void addConnection (Connection *_conn);
102 
104  virtual void removeConnection (Connection *_conn);
105 
107  bool validConnection (ElementInOut *_e);
108 
110  InOut* inOut () const { return io_; };
111 
113  SceneElement* element() { return element_; };
114 
115  private:
116 
118  ElementInOut( const ElementInOut& _orig );
119 
120  InOut *io_;
121  SceneElement *element_;
122 
123  ConnectionPoint *conn_;
124  Text *typeText_;
125  Text *descText_;
126 
127  QList<Connection *> connections_;
128 };
129 
130 //=============================================================================
131 }
132 //=============================================================================
133 
134 #endif
InOut * inOut() const
InOut context object.
virtual void addConnection(Connection *_conn)
Add the connection.
virtual ~ElementInOut()
Destructor.
ConnectionPoint * connectionPointItem() const
Connection point widget.
Definition: elementInOut.hh:89
Text * descriptionTextItem() const
Short description widget.
Definition: elementInOut.hh:95
SceneElement * element()
Scene element.
Text * typeTextItem() const
Type text widget.
Definition: elementInOut.hh:92
ElementInOut(InOut *_io, SceneElement *_parent)
Constructor.
Definition: elementInOut.cc:68
virtual void removeConnection(Connection *_conn)
Remove the Connection.
bool validConnection(ElementInOut *_e)
Can this input/output be connected to _e.
virtual Type type() const =0
Type.
QList< Connection * > connections() const
Connections.
Definition: elementInOut.hh:98