Developer Documentation
element.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 * *
44 * $Revision$ *
45 * $LastChangedBy$ *
46 * $Date$ *
47 * *
48 \*===========================================================================*/
49 
50 #ifndef VSI_ELEMENT_HH_
51 #define VSI_ELEMENT_HH_
52 
53 //== INCLUDES =================================================================
54 #include <QString>
55 #include <QVector>
56 
57 //== NAMESPACES ===============================================================
58 namespace VSI {
59 
60 //== FORWARDDECLARATIONS ======================================================
61 class Input;
62 class Output;
63 class InOut;
64 class Context;
65 class Function;
66 
67 #define ELEMENT_FLAG_NO_DELETE 0x1
68 #define ELEMENT_FLAG_SKIP_TOOLBOX 0x2
69 
70 //== CLASS DEFINITION =========================================================
71 
74 class Element {
75 
76  public:
77 
79  Element (Context *_context, QString _name);
80 
82  ~Element ();
83 
85  Context *context () const { return context_; };
86 
88  QString name () const { return name_; };
89 
91  const QString &category () const { return category_; };
92 
94  const QString &shortDescription () const { return shortDesc_; };
95 
97  const QString &longDescription () const { return longDesc_; };
98 
100  const QVector<Input *> &inputs () const { return inputs_; };
101 
103  const QVector<Output *> &outputs () const { return outputs_; };
104 
106  const QVector <Function*> &functions () const { return functions_; };
107 
109  Input *dataIn () { return dataIn_; };
110 
112  Output *dataOut () { return dataOut_; };
113 
115  unsigned int flags () const { return flags_; };
116 
118  QString precode () const { return precode_; };
119 
121  QString code () const { return code_; };
122 
124  unsigned int getNewId ();
125 
127  void setMinId (unsigned int _id);
128 
129  friend class Context;
130 
131  private:
132  Context *context_;
133 
134  QString name_;
135  QString category_;
136  QString shortDesc_;
137  QString longDesc_;
138 
139  QString precode_;
140  QString code_;
141 
142  QVector <Input*> inputs_;
143  QVector <Output*> outputs_;
144  QVector <Function*> functions_;
145 
146  Input *dataIn_;
147  Output *dataOut_;
148 
149  unsigned int flags_;
150 
151  unsigned int id_;
152 };
153 
154 //=============================================================================
155 }
156 //=============================================================================
157 
158 #endif
unsigned int flags() const
Flags.
Definition: element.hh:115
const QVector< Input * > & inputs() const
Inputs.
Definition: element.hh:100
const QString & shortDescription() const
Short description.
Definition: element.hh:94
const QString & category() const
Element category.
Definition: element.hh:91
void setMinId(unsigned int _id)
sets the minimum for an unused id
Definition: element.cc:106
~Element()
Destructor.
Definition: element.cc:80
Element(Context *_context, QString _name)
Constructor.
Definition: element.cc:65
Context * context() const
Context of element.
Definition: element.hh:85
const QString & longDescription() const
Long description.
Definition: element.hh:97
unsigned int getNewId()
Returns an unused id number.
Definition: element.cc:98
Output * dataOut()
Scenegraph output.
Definition: element.hh:112
const QVector< Output * > & outputs() const
Outputs.
Definition: element.hh:103
QString precode() const
Precode segment.
Definition: element.hh:118
const QVector< Function * > & functions() const
Functions.
Definition: element.hh:106
QString name() const
Element name.
Definition: element.hh:88
Input * dataIn()
Scenegraph input.
Definition: element.hh:109
QString code() const
Code segment.
Definition: element.hh:121