summaryrefslogtreecommitdiffstats
path: root/src/uml/qport.cpp
blob: 27e9d16ee32a0689fb58b4faf7f985b77c1737c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
/****************************************************************************
**
** Copyright (C) 2012 Sandro S. Andrade <sandroandrade@kde.org>
** Contact: http://www.qt-project.org/
**
** This file is part of the QtUml module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/

#include "qport.h"
#include "qport_p.h"

#include <QtUml/QProtocolStateMachine>
#include <QtUml/QInterface>

#include <QtWrappedObjects/QtWrappedObjectsNamespace>

QT_BEGIN_NAMESPACE_QTUML

QPortPrivate::QPortPrivate() :
    isConjugated(false),
    isBehavior(false),
    isService(true),
    protocol(0)
{
}

QPortPrivate::~QPortPrivate()
{
}

/*!
    \class QPort

    \inmodule QtUml

    \brief A port has an associated protocol state machine.A port is a property of a classifier that specifies a distinct interaction point between that classifier and its environment or between the (behavior of the) classifier and its internal parts. Ports are connected to properties of the classifier by connectors through which requests can be made to invoke the behavioral features of a classifier. A Port may specify the services a classifier provides (offers) to its environment as well as the services that a classifier expects (requires) of its environment.
 */

QPort::QPort(QWrappedObject *wrapper, QWrappedObject *parent) :
    QProperty(*new QPortPrivate, wrapper, parent)
{
    setPropertyData();
}

QPort::QPort(QPortPrivate &dd, QWrappedObject *wrapper, QWrappedObject *parent) :
    QProperty(dd, wrapper, parent)
{
    setPropertyData();
}

QPort::~QPort()
{
}

// ---------------------------------------------------------------
// ATTRIBUTES FROM QPort
// ---------------------------------------------------------------

/*!
    Specifies the way that the provided and required interfaces are derived from the Port’s Type. The default value is false.
 */
bool QPort::isConjugated() const
{
    // This is a read-write attribute

    Q_D(const QPort);
    return d->isConjugated;
}

void QPort::setConjugated(bool isConjugated)
{
    // This is a read-write attribute

    Q_D(QPort);
    if (d->isConjugated != isConjugated) {
        d->isConjugated = isConjugated;
    }
    d->modifiedResettableProperties << QString::fromLatin1("isConjugated");
}

void QPort::unsetConjugated()
{
    setConjugated(false);
    Q_D(QPort);
    d->modifiedResettableProperties.removeAll(QString::fromLatin1("isConjugated"));
}

/*!
    Specifies whether requests arriving at this port are sent to the classifier behavior of this classifier. Such ports are referred to as behavior port. Any invocation of a behavioral feature targeted at a behavior port will be handled by the instance of the owning classifier itself, rather than by any instances that this classifier may contain.
 */
bool QPort::isBehavior() const
{
    // This is a read-write attribute

    Q_D(const QPort);
    return d->isBehavior;
}

void QPort::setBehavior(bool isBehavior)
{
    // This is a read-write attribute

    Q_D(QPort);
    if (d->isBehavior != isBehavior) {
        d->isBehavior = isBehavior;
    }
    d->modifiedResettableProperties << QString::fromLatin1("isBehavior");
}

void QPort::unsetBehavior()
{
    setBehavior(false);
    Q_D(QPort);
    d->modifiedResettableProperties.removeAll(QString::fromLatin1("isBehavior"));
}

/*!
    If true indicates that this port is used to provide the published functionality of a classifier; if false, this port is used to implement the classifier but is not part of the essential externally-visible functionality of the classifier and can, therefore, be altered or deleted along with the internal implementation of the classifier and other properties that are considered part of its implementation.
 */
bool QPort::isService() const
{
    // This is a read-write attribute

    Q_D(const QPort);
    return d->isService;
}

void QPort::setService(bool isService)
{
    // This is a read-write attribute

    Q_D(QPort);
    if (d->isService != isService) {
        d->isService = isService;
    }
    d->modifiedResettableProperties << QString::fromLatin1("isService");
}

void QPort::unsetService()
{
    setService(true);
    Q_D(QPort);
    d->modifiedResettableProperties.removeAll(QString::fromLatin1("isService"));
}

// ---------------------------------------------------------------
// ASSOCIATION ENDS FROM QPort
// ---------------------------------------------------------------

/*!
    References an optional protocol state machine which describes valid interactions at this interaction point.
 */
QProtocolStateMachine *QPort::protocol() const
{
    // This is a read-write association end

    Q_D(const QPort);
    return d->protocol;
}

void QPort::setProtocol(QProtocolStateMachine *protocol)
{
    // This is a read-write association end

    Q_D(QPort);
    if (d->protocol != protocol) {
        d->protocol = protocol;
    }
}

/*!
    References the interfaces specifying the set of operations and receptions that the classifier expects its environment to handle via this port. This association is derived according to the value of isConjugated. If isConjugated is false, required is derived as the union of the sets of interfaces used by the type of the port and its supertypes. If isConjugated is true, it is derived as the union of the sets of interfaces realized by the type of the port and its supertypes, or directly from the type of the port if the port is typed by an interface.
 */
QSet<QInterface *> QPort::required() const
{
    // This is a read-only derived association end

    qWarning("QPort::required: to be implemented (this is a derived associationend)");

    return QSet<QInterface *>(); // change here to your derived return
}

/*!
    References the interfaces specifying the set of operations and receptions that the classifier offers to its environment via this port, and which it will handle either directly or by forwarding it to a part of its internal structure. This association is derived according to the value of isConjugated. If isConjugated is false, provided is derived as the union of the sets of interfaces realized by the type of the port and its supertypes, or directly from the type of the port if the port is typed by an interface. If isConjugated is true, it is derived as the union of the sets of interfaces used by the type of the port and its supertypes.
 */
QSet<QInterface *> QPort::provided() const
{
    // This is a read-only derived association end

    qWarning("QPort::provided: to be implemented (this is a derived associationend)");

    return QSet<QInterface *>(); // change here to your derived return
}

/*!
    A port may be redefined when its containing classifier is specialized. The redefining port may have additional interfaces to those that are associated with the redefined port or it may replace an interface by one of its subtypes.
 */
QSet<QPort *> QPort::redefinedPorts() const
{
    // This is a read-write association end

    Q_D(const QPort);
    return d->redefinedPorts;
}

void QPort::addRedefinedPort(QPort *redefinedPort)
{
    // This is a read-write association end

    Q_D(QPort);
    if (!d->redefinedPorts.contains(redefinedPort)) {
        d->redefinedPorts.insert(redefinedPort);

        // Adjust subsetted property(ies)
        (qwrappedobject_cast<QProperty *>(this))->addRedefinedProperty(qwrappedobject_cast<QProperty *>(redefinedPort));
    }
}

void QPort::removeRedefinedPort(QPort *redefinedPort)
{
    // This is a read-write association end

    Q_D(QPort);
    if (d->redefinedPorts.contains(redefinedPort)) {
        d->redefinedPorts.remove(redefinedPort);

        // Adjust subsetted property(ies)
        (qwrappedobject_cast<QProperty *>(this))->removeRedefinedProperty(qwrappedobject_cast<QProperty *>(redefinedPort));
    }
}

void QPort::setPropertyData()
{
    QWrappedObject::propertyDataHash[QString::fromLatin1("QPort")][QString::fromLatin1("isConjugated")][QtWrappedObjects::AggregationRole] = QString::fromLatin1("none");
    QWrappedObject::propertyDataHash[QString::fromLatin1("QPort")][QString::fromLatin1("isConjugated")][QtWrappedObjects::IsDerivedUnionRole] = false;
    QWrappedObject::propertyDataHash[QString::fromLatin1("QPort")][QString::fromLatin1("isConjugated")][QtWrappedObjects::DocumentationRole] = QString::fromLatin1("Specifies the way that the provided and required interfaces are derived from the Port’s Type. The default value is false.");
    QWrappedObject::propertyDataHash[QString::fromLatin1("QPort")][QString::fromLatin1("isConjugated")][QtWrappedObjects::RedefinedPropertiesRole] = QString::fromLatin1("");
    QWrappedObject::propertyDataHash[QString::fromLatin1("QPort")][QString::fromLatin1("isConjugated")][QtWrappedObjects::SubsettedPropertiesRole] = QString::fromLatin1("");
    QWrappedObject::propertyDataHash[QString::fromLatin1("QPort")][QString::fromLatin1("isConjugated")][QtWrappedObjects::OppositeEndRole] = QString::fromLatin1("");

    QWrappedObject::propertyDataHash[QString::fromLatin1("QPort")][QString::fromLatin1("isBehavior")][QtWrappedObjects::AggregationRole] = QString::fromLatin1("none");
    QWrappedObject::propertyDataHash[QString::fromLatin1("QPort")][QString::fromLatin1("isBehavior")][QtWrappedObjects::IsDerivedUnionRole] = false;
    QWrappedObject::propertyDataHash[QString::fromLatin1("QPort")][QString::fromLatin1("isBehavior")][QtWrappedObjects::DocumentationRole] = QString::fromLatin1("Specifies whether requests arriving at this port are sent to the classifier behavior of this classifier. Such ports are referred to as behavior port. Any invocation of a behavioral feature targeted at a behavior port will be handled by the instance of the owning classifier itself, rather than by any instances that this classifier may contain.");
    QWrappedObject::propertyDataHash[QString::fromLatin1("QPort")][QString::fromLatin1("isBehavior")][QtWrappedObjects::RedefinedPropertiesRole] = QString::fromLatin1("");
    QWrappedObject::propertyDataHash[QString::fromLatin1("QPort")][QString::fromLatin1("isBehavior")][QtWrappedObjects::SubsettedPropertiesRole] = QString::fromLatin1("");
    QWrappedObject::propertyDataHash[QString::fromLatin1("QPort")][QString::fromLatin1("isBehavior")][QtWrappedObjects::OppositeEndRole] = QString::fromLatin1("");

    QWrappedObject::propertyDataHash[QString::fromLatin1("QPort")][QString::fromLatin1("isService")][QtWrappedObjects::AggregationRole] = QString::fromLatin1("none");
    QWrappedObject::propertyDataHash[QString::fromLatin1("QPort")][QString::fromLatin1("isService")][QtWrappedObjects::IsDerivedUnionRole] = false;
    QWrappedObject::propertyDataHash[QString::fromLatin1("QPort")][QString::fromLatin1("isService")][QtWrappedObjects::DocumentationRole] = QString::fromLatin1("If true indicates that this port is used to provide the published functionality of a classifier; if false, this port is used to implement the classifier but is not part of the essential externally-visible functionality of the classifier and can, therefore, be altered or deleted along with the internal implementation of the classifier and other properties that are considered part of its implementation.");
    QWrappedObject::propertyDataHash[QString::fromLatin1("QPort")][QString::fromLatin1("isService")][QtWrappedObjects::RedefinedPropertiesRole] = QString::fromLatin1("");
    QWrappedObject::propertyDataHash[QString::fromLatin1("QPort")][QString::fromLatin1("isService")][QtWrappedObjects::SubsettedPropertiesRole] = QString::fromLatin1("");
    QWrappedObject::propertyDataHash[QString::fromLatin1("QPort")][QString::fromLatin1("isService")][QtWrappedObjects::OppositeEndRole] = QString::fromLatin1("");

    QWrappedObject::propertyDataHash[QString::fromLatin1("QPort")][QString::fromLatin1("protocol")][QtWrappedObjects::AggregationRole] = QString::fromLatin1("none");
    QWrappedObject::propertyDataHash[QString::fromLatin1("QPort")][QString::fromLatin1("protocol")][QtWrappedObjects::IsDerivedUnionRole] = false;
    QWrappedObject::propertyDataHash[QString::fromLatin1("QPort")][QString::fromLatin1("protocol")][QtWrappedObjects::DocumentationRole] = QString::fromLatin1("References an optional protocol state machine which describes valid interactions at this interaction point.");
    QWrappedObject::propertyDataHash[QString::fromLatin1("QPort")][QString::fromLatin1("protocol")][QtWrappedObjects::RedefinedPropertiesRole] = QString::fromLatin1("");
    QWrappedObject::propertyDataHash[QString::fromLatin1("QPort")][QString::fromLatin1("protocol")][QtWrappedObjects::SubsettedPropertiesRole] = QString::fromLatin1("");
    QWrappedObject::propertyDataHash[QString::fromLatin1("QPort")][QString::fromLatin1("protocol")][QtWrappedObjects::OppositeEndRole] = QString::fromLatin1("");

    QWrappedObject::propertyDataHash[QString::fromLatin1("QPort")][QString::fromLatin1("required")][QtWrappedObjects::AggregationRole] = QString::fromLatin1("none");
    QWrappedObject::propertyDataHash[QString::fromLatin1("QPort")][QString::fromLatin1("required")][QtWrappedObjects::IsDerivedUnionRole] = false;
    QWrappedObject::propertyDataHash[QString::fromLatin1("QPort")][QString::fromLatin1("required")][QtWrappedObjects::DocumentationRole] = QString::fromLatin1("References the interfaces specifying the set of operations and receptions that the classifier expects its environment to handle via this port. This association is derived according to the value of isConjugated. If isConjugated is false, required is derived as the union of the sets of interfaces used by the type of the port and its supertypes. If isConjugated is true, it is derived as the union of the sets of interfaces realized by the type of the port and its supertypes, or directly from the type of the port if the port is typed by an interface.");
    QWrappedObject::propertyDataHash[QString::fromLatin1("QPort")][QString::fromLatin1("required")][QtWrappedObjects::RedefinedPropertiesRole] = QString::fromLatin1("");
    QWrappedObject::propertyDataHash[QString::fromLatin1("QPort")][QString::fromLatin1("required")][QtWrappedObjects::SubsettedPropertiesRole] = QString::fromLatin1("");
    QWrappedObject::propertyDataHash[QString::fromLatin1("QPort")][QString::fromLatin1("required")][QtWrappedObjects::OppositeEndRole] = QString::fromLatin1("");

    QWrappedObject::propertyDataHash[QString::fromLatin1("QPort")][QString::fromLatin1("provided")][QtWrappedObjects::AggregationRole] = QString::fromLatin1("none");
    QWrappedObject::propertyDataHash[QString::fromLatin1("QPort")][QString::fromLatin1("provided")][QtWrappedObjects::IsDerivedUnionRole] = false;
    QWrappedObject::propertyDataHash[QString::fromLatin1("QPort")][QString::fromLatin1("provided")][QtWrappedObjects::DocumentationRole] = QString::fromLatin1("References the interfaces specifying the set of operations and receptions that the classifier offers to its environment via this port, and which it will handle either directly or by forwarding it to a part of its internal structure. This association is derived according to the value of isConjugated. If isConjugated is false, provided is derived as the union of the sets of interfaces realized by the type of the port and its supertypes, or directly from the type of the port if the port is typed by an interface. If isConjugated is true, it is derived as the union of the sets of interfaces used by the type of the port and its supertypes.");
    QWrappedObject::propertyDataHash[QString::fromLatin1("QPort")][QString::fromLatin1("provided")][QtWrappedObjects::RedefinedPropertiesRole] = QString::fromLatin1("");
    QWrappedObject::propertyDataHash[QString::fromLatin1("QPort")][QString::fromLatin1("provided")][QtWrappedObjects::SubsettedPropertiesRole] = QString::fromLatin1("");
    QWrappedObject::propertyDataHash[QString::fromLatin1("QPort")][QString::fromLatin1("provided")][QtWrappedObjects::OppositeEndRole] = QString::fromLatin1("");

    QWrappedObject::propertyDataHash[QString::fromLatin1("QPort")][QString::fromLatin1("redefinedPorts")][QtWrappedObjects::AggregationRole] = QString::fromLatin1("none");
    QWrappedObject::propertyDataHash[QString::fromLatin1("QPort")][QString::fromLatin1("redefinedPorts")][QtWrappedObjects::IsDerivedUnionRole] = false;
    QWrappedObject::propertyDataHash[QString::fromLatin1("QPort")][QString::fromLatin1("redefinedPorts")][QtWrappedObjects::DocumentationRole] = QString::fromLatin1("A port may be redefined when its containing classifier is specialized. The redefining port may have additional interfaces to those that are associated with the redefined port or it may replace an interface by one of its subtypes.");
    QWrappedObject::propertyDataHash[QString::fromLatin1("QPort")][QString::fromLatin1("redefinedPorts")][QtWrappedObjects::RedefinedPropertiesRole] = QString::fromLatin1("");
    QWrappedObject::propertyDataHash[QString::fromLatin1("QPort")][QString::fromLatin1("redefinedPorts")][QtWrappedObjects::SubsettedPropertiesRole] = QString::fromLatin1("QProperty::redefinedProperties");
    QWrappedObject::propertyDataHash[QString::fromLatin1("QPort")][QString::fromLatin1("redefinedPorts")][QtWrappedObjects::OppositeEndRole] = QString::fromLatin1("");

    QProperty::setPropertyData();
}

// Overriden methods for subsetted properties

void QPort::addRedefinedProperty(QWrappedObjectPointer<QPort> redefinedPort)
{
    addRedefinedPort(redefinedPort);
}

void QPort::removeRedefinedProperty(QWrappedObjectPointer<QPort> redefinedPort)
{
    removeRedefinedPort(redefinedPort);
}

#include "moc_qport.cpp"

QT_END_NAMESPACE_QTUML