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