Frapper  1.0a
Connection.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of FRAPPER
4 research.animationsinstitut.de
5 sourceforge.net/projects/frapper
6 
7 Copyright (c) 2008-2009 Filmakademie Baden-Wuerttemberg, Institute of Animation
8 
9 This program is free software; you can redistribute it and/or modify it under
10 the terms of the GNU Lesser General Public License as published by the Free Software
11 Foundation; version 2.1 of the License.
12 
13 This program is distributed in the hope that it will be useful, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
16 
17 You should have received a copy of the GNU Lesser General Public License along with
18 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
19 Place - Suite 330, Boston, MA 02111-1307, USA, or go to
20 http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
21 -----------------------------------------------------------------------------
22 */
23 
38 
39 #ifndef CONNECTION_H
40 #define CONNECTION_H
41 
42 #include "FrapperPrerequisites.h"
43 #include <QtCore/QMap>
44 #include "InstanceCounterMacros.h"
45 
46 namespace Frapper {
47 
51 class Parameter;
52 
56 class Node;
57 
58 
63 class FRAPPER_CORE_EXPORT Connection : public QObject
64 {
65 
66  Q_OBJECT
68 
69 public: // type definitions
70 
74  typedef unsigned int ID;
75 
79  typedef QMap<ID, Connection *> Map;
80 
81 private: // static data
82 
86  static ID s_currentId;
87 
88 public: // constructors and destructors
89 
96  Connection ( Parameter *sourceParameter, Parameter *targetParameter );
97 
101  ~Connection ();
102 
103 public: // functions
104 
110  ID getId () const;
111 
118  bool hasSource () const;
119 
125  Parameter * getSourceParameter () const;
126 
132  void setSourceParameter ( Parameter *sourceParameter );
133 
140  bool hasTarget () const;
141 
147  Parameter * getTargetParameter () const;
148 
154  void setTargetParameter ( Parameter *targetParameter );
155 
156 signals: //
157 
161  void destroyed (Connection *connection);
162 
163 private: // functions
164 
169  void updateName ();
170 
171 private: // attributes
172 
177 
182 
187 
188 };
189 
190 } // end namespace Frapper
191 
192 #endif