aGrUM
0.20.2
a C++ library for (probabilistic) graphical models
PRMInterface_tpl.h
Go to the documentation of this file.
1
/**
2
*
3
* Copyright 2005-2020 Pierre-Henri WUILLEMIN(@LIP6) & Christophe GONZALES(@AMU)
4
* info_at_agrum_dot_org
5
*
6
* This library is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU Lesser General Public License as published by
8
* the Free Software Foundation, either version 3 of the License, or
9
* (at your option) any later version.
10
*
11
* This library is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU Lesser General Public License for more details.
15
*
16
* You should have received a copy of the GNU Lesser General Public License
17
* along with this library. If not, see <http://www.gnu.org/licenses/>.
18
*
19
*/
20
21
22
/**
23
* @file
24
* @brief Inline implementation of gum::prm::PRMInterface
25
*
26
* @author Lionel TORTI and Pierre-Henri WUILLEMIN(@LIP6)
27
*/
28
#
include
<
agrum
/
PRM
/
elements
/
PRMInterface
.
h
>
29
30
#
include
<
agrum
/
PRM
/
elements
/
PRMClass
.
h
>
31
32
namespace
gum
{
33
namespace
prm
{
34
35
template
<
typename
GUM_SCALAR >
36
PRMInterface< GUM_SCALAR >::PRMInterface(
const
std::string& name) :
37
PRMClassElementContainer< GUM_SCALAR >(name), superInterface__(0) {
38
GUM_CONSTRUCTOR(PRMInterface);
39
}
40
41
template
<
typename
GUM_SCALAR
>
42
PRMInterface
<
GUM_SCALAR
>::
PRMInterface
(
const
std
::
string
&
name
,
43
PRMInterface
<
GUM_SCALAR
>&
super
,
44
bool
delayInheritance
) :
45
PRMClassElementContainer
<
GUM_SCALAR
>(
name
),
46
superInterface__
(&
super
) {
47
GUM_CONSTRUCTOR
(
PRMInterface
);
48
if
(!
delayInheritance
) {
inheritInterface__
(
super
); }
49
}
50
51
template
<
typename
GUM_SCALAR
>
52
PRMInterface
<
GUM_SCALAR
>::
PRMInterface
(
53
const
PRMInterface
<
GUM_SCALAR
>&
source
) :
54
PRMClassElementContainer
<
GUM_SCALAR
>(
source
.
name
()),
55
dag__
(
source
.
dag__
),
superInterface__
(
source
.
superInterface__
) {
56
GUM_CONS_CPY
(
PRMInterface
);
57
GUM_ERROR
(
FatalError
,
"don't copy an interface"
);
58
}
59
60
template
<
typename
GUM_SCALAR
>
61
PRMInterface
<
GUM_SCALAR
>::~
PRMInterface
() {
62
GUM_DESTRUCTOR
(
PRMInterface
);
63
64
for
(
const
auto
&
elt
:
nodeIdMap__
) {
65
delete
elt
.
second
;
66
}
67
}
68
69
template
<
typename
GUM_SCALAR
>
70
void
PRMInterface
<
GUM_SCALAR
>::
inheritInterface
() {
71
if
(
superInterface__
!=
nullptr
) {
inheritInterface__
(*
superInterface__
); }
72
}
73
74
template
<
typename
GUM_SCALAR
>
75
void
PRMInterface
<
GUM_SCALAR
>::
inheritInterface__
(
76
const
PRMInterface
<
GUM_SCALAR
>&
i
) {
77
// Copying attributes
78
for
(
const
auto
i_attr
:
i
.
attributes__
) {
79
auto
attr
80
=
new
PRMScalarAttribute
<
GUM_SCALAR
>(
i_attr
->
name
(),
i_attr
->
type
());
81
attr
->
setId
(
i_attr
->
id
());
82
nodeIdMap__
.
insert
(
attr
->
id
(),
attr
);
83
attributes__
.
insert
(
attr
);
84
85
if
(
i
.
nameMap__
[
i_attr
->
name
()] ==
i
.
nameMap__
[
i_attr
->
safeName
()]) {
86
nameMap__
.
insert
(
attr
->
name
(),
attr
);
87
}
88
89
nameMap__
.
insert
(
attr
->
safeName
(),
attr
);
90
dag__
.
addNodeWithId
(
attr
->
id
());
91
}
92
93
// Copying reference slots
94
for
(
const
auto
i_ref
:
i
.
referenceSlots__
) {
95
auto
ref
=
new
PRMReferenceSlot
<
GUM_SCALAR
>(
96
i_ref
->
name
(),
97
const_cast
<
PRMClassElementContainer
<
GUM_SCALAR
>& >(
98
i_ref
->
slotType
()),
99
i_ref
->
isArray
());
100
101
ref
->
setId
(
i_ref
->
id
());
102
nodeIdMap__
.
insert
(
ref
->
id
(),
ref
);
103
referenceSlots__
.
insert
(
ref
);
104
105
if
(
i
.
nameMap__
.
exists
(
ref
->
name
())) {
106
nameMap__
.
insert
(
ref
->
name
(),
ref
);
107
}
108
109
nameMap__
.
insert
(
ref
->
safeName
(),
ref
);
110
dag__
.
addNodeWithId
(
ref
->
id
());
111
}
112
}
113
114
template
<
typename
GUM_SCALAR
>
115
NodeId
PRMInterface
<
GUM_SCALAR
>::
add
(
PRMClassElement
<
GUM_SCALAR
>*
elt
) {
116
if
(
nameMap__
.
exists
(
elt
->
name
())) {
117
GUM_ERROR
(
DuplicateElement
,
118
"name '"
<<
elt
->
name
()
119
<<
"' is already used by another ClassElement"
);
120
}
121
122
if
(
PRMClassElement
<
GUM_SCALAR
>::
isAttribute
(*
elt
)) {
123
PRMAttribute
<
GUM_SCALAR
>*
attr
124
=
static_cast
<
PRMAttribute
<
GUM_SCALAR
>* >(
elt
);
125
nameMap__
.
insert
(
attr
->
name
(),
attr
);
126
127
while
(
true
) {
128
attr
->
setId
(
nextNodeId
());
129
dag__
.
addNodeWithId
(
attr
->
id
());
130
nodeIdMap__
.
insert
(
attr
->
id
(),
attr
);
131
nameMap__
.
insert
(
attr
->
safeName
(),
attr
);
132
attributes__
.
insert
(
attr
);
133
134
if
(
attr
->
type
().
isSubType
()) {
135
attr
=
attr
->
getCastDescendant
();
136
}
else
{
137
break
;
138
}
139
}
140
}
else
if
(
PRMClassElement
<
GUM_SCALAR
>::
isReferenceSlot
(*
elt
)) {
141
elt
->
setId
(
nextNodeId
());
142
dag__
.
addNodeWithId
(
elt
->
id
());
143
nodeIdMap__
.
insert
(
elt
->
id
(),
elt
);
144
referenceSlots__
.
insert
(
145
static_cast
<
PRMReferenceSlot
<
GUM_SCALAR
>* >(
elt
));
146
nameMap__
.
insert
(
elt
->
name
(),
elt
);
147
nameMap__
.
insert
(
elt
->
safeName
(),
elt
);
148
}
else
{
149
GUM_ERROR
(
WrongClassElement
,
150
"illegal ClassElement<GUM_SCALAR> for an Interface"
);
151
}
152
153
return
elt
->
id
();
154
}
155
156
template
<
typename
GUM_SCALAR
>
157
NodeId
PRMInterface
<
GUM_SCALAR
>::
overload
(
158
PRMClassElement
<
GUM_SCALAR
>*
overloader
) {
159
try
{
160
if
(!
super
().
exists
(
overloader
->
name
())) {
161
GUM_ERROR
(
OperationNotAllowed
,
162
"found no ClassElement<GUM_SCALAR> to overload"
);
163
}
164
}
catch
(
NotFound
&) {
165
GUM_ERROR
(
OperationNotAllowed
,
166
"overload is possible only with sub interfaces"
);
167
}
168
169
PRMClassElement
<
GUM_SCALAR
>*
overloaded
=
nameMap__
[
overloader
->
name
()];
170
if
(
overloaded
==
overloader
) {
171
GUM_ERROR
(
DuplicateElement
,
172
"duplicate ClassElement '"
<<
overloader
->
name
() <<
"'"
);
173
}
174
if
(!
checkOverloadLegality__
(
overloaded
,
overloader
)) {
175
GUM_ERROR
(
OperationNotAllowed
,
"illegal overload"
);
176
}
177
178
switch
(
overloader
->
elt_type
()) {
179
case
PRMClassElement
<
GUM_SCALAR
>::
prm_attribute
: {
180
auto
attr_overloader
181
=
static_cast
<
PRMAttribute
<
GUM_SCALAR
>* >(
overloader
);
182
auto
attr_overloaded
183
=
static_cast
<
PRMAttribute
<
GUM_SCALAR
>* >(
overloaded
);
184
overloadAttribute__
(
attr_overloader
,
attr_overloaded
);
185
break
;
186
}
187
188
case
PRMClassElement
<
GUM_SCALAR
>::
prm_refslot
: {
189
auto
ref_overloader
190
=
static_cast
<
PRMReferenceSlot
<
GUM_SCALAR
>* >(
overloader
);
191
auto
ref_overloaded
192
=
static_cast
<
PRMReferenceSlot
<
GUM_SCALAR
>* >(
overloaded
);
193
overloadReferenceSlot__
(
ref_overloader
,
ref_overloaded
);
194
break
;
195
}
196
197
case
PRMClassElement
<
GUM_SCALAR
>::
prm_aggregate
:
198
case
PRMClassElement
<
GUM_SCALAR
>::
prm_slotchain
: {
199
auto
msg
=
"element can ! be overloaded"
;
200
GUM_ERROR
(
OperationNotAllowed
,
msg
);
201
break
;
202
}
203
204
default
: {
205
GUM_ERROR
(
FatalError
,
"unknown ClassElement<GUM_SCALAR> type"
);
206
}
207
}
208
209
return
overloader
->
id
();
210
}
211
212
template
<
typename
GUM_SCALAR
>
213
void
PRMInterface
<
GUM_SCALAR
>::
overloadAttribute__
(
214
PRMAttribute
<
GUM_SCALAR
>*
overloader
,
215
PRMAttribute
<
GUM_SCALAR
>*
overloaded
) {
216
if
(
overloader
->
type
() !=
overloaded
->
type
()) {
217
overloader
->
setId
(
nextNodeId
());
218
dag__
.
addNodeWithId
(
overloader
->
id
());
219
nodeIdMap__
.
insert
(
overloader
->
id
(),
overloader
);
220
nameMap__
[
overloader
->
name
()] =
overloader
;
221
nameMap__
.
insert
(
overloader
->
safeName
(),
overloader
);
222
attributes__
.
insert
(
overloader
);
223
addCastDescendants__
(
overloader
,
overloaded
);
224
}
else
{
225
overloader
->
setId
(
overloaded
->
id
());
226
nodeIdMap__
[
overloader
->
id
()] =
overloader
;
227
nameMap__
[
overloader
->
name
()] =
overloader
;
228
nameMap__
[
overloader
->
safeName
()] =
overloader
;
229
attributes__
.
erase
(
overloaded
);
230
attributes__
.
insert
(
overloader
);
231
// Swapping types, ugly but necessary to preserve the
232
// PRMType<GUM_SCALAR>
233
// pointer of overloaded
234
overloader
->
overload
(
overloaded
);
235
delete
overloaded
;
236
}
237
}
238
239
template
<
typename
GUM_SCALAR
>
240
void
PRMInterface
<
GUM_SCALAR
>::
overloadReferenceSlot__
(
241
PRMReferenceSlot
<
GUM_SCALAR
>*
overloader
,
242
PRMReferenceSlot
<
GUM_SCALAR
>*
overloaded
) {
243
// Adding overloading reference
244
overloader
->
setId
(
overloaded
->
id
());
245
nodeIdMap__
[
overloader
->
id
()] =
overloader
;
246
nameMap__
[
overloader
->
name
()] =
overloader
;
247
nameMap__
.
insert
(
overloader
->
safeName
(),
overloader
);
248
referenceSlots__
.
insert
(
overloader
);
249
// Removing overloaded PRMReferenceSlot<GUM_SCALAR>
250
referenceSlots__
.
erase
(
overloaded
);
251
nameMap__
.
erase
(
overloaded
->
safeName
());
252
delete
overloaded
;
253
}
254
255
template
<
typename
GUM_SCALAR
>
256
void
PRMInterface
<
GUM_SCALAR
>::
addCastDescendants__
(
257
PRMAttribute
<
GUM_SCALAR
>*
start
,
258
PRMAttribute
<
GUM_SCALAR
>*
end
) {
259
PRMAttribute
<
GUM_SCALAR
>*
parent
=
start
;
260
PRMAttribute
<
GUM_SCALAR
>*
child
=
nullptr
;
261
262
while
(
parent
->
type
().
superType
() !=
end
->
type
()) {
263
child
=
parent
->
getCastDescendant
();
264
child
->
setId
(
nextNodeId
());
265
dag__
.
addNodeWithId
(
child
->
id
());
266
nodeIdMap__
.
insert
(
child
->
id
(),
child
);
267
// Only use child's safe name when adding to the name map!
268
nameMap__
.
insert
(
child
->
safeName
(),
child
);
269
attributes__
.
insert
(
child
);
270
// Do ! use Class<GUM_SCALAR>::insertArc(), child's CPF is already
271
// initialized properly
272
parent
=
child
;
273
}
274
275
parent
->
setAsCastDescendant
(
end
);
276
}
277
278
template
<
typename
GUM_SCALAR
>
279
bool
PRMInterface
<
GUM_SCALAR
>::
checkOverloadLegality__
(
280
const
PRMClassElement
<
GUM_SCALAR
>*
overloaded
,
281
const
PRMClassElement
<
GUM_SCALAR
>*
overloader
) {
282
if
(
overloaded
->
elt_type
() !=
overloader
->
elt_type
()) {
return
false
; }
283
284
if
(
overloaded
->
elt_type
() ==
PRMClassElement
<
GUM_SCALAR
>::
prm_attribute
) {
285
if
(!
overloader
->
type
().
isSubTypeOf
(
overloaded
->
type
())) {
return
false
; }
286
}
else
if
(
overloaded
->
elt_type
()
287
==
PRMClassElement
<
GUM_SCALAR
>::
prm_refslot
) {
288
auto
ref_overloader
289
=
static_cast
<
const
PRMReferenceSlot
<
GUM_SCALAR
>* >(
overloader
);
290
auto
ref_overloaded
291
=
static_cast
<
const
PRMReferenceSlot
<
GUM_SCALAR
>* >(
overloaded
);
292
if
(!
ref_overloader
->
slotType
().
isSubTypeOf
(
ref_overloaded
->
slotType
())) {
293
return
false
;
294
}
295
}
else
{
296
return
false
;
297
}
298
return
true
;
299
}
300
301
template
<
typename
GUM_SCALAR
>
302
bool
PRMInterface
<
GUM_SCALAR
>::
isSubTypeOf
(
303
const
PRMClassElementContainer
<
GUM_SCALAR
>&
cec
)
const
{
304
switch
(
cec
.
obj_type
()) {
305
case
PRMClassElement
<
GUM_SCALAR
>::
prm_type
::
CLASS
: {
306
return
false
;
307
}
308
309
case
PRMClassElement
<
GUM_SCALAR
>::
prm_type
::
PRM_INTERFACE
: {
310
const
PRMInterface
*
current
=
this
;
311
312
while
(
current
!= 0) {
313
if
(
current
== &(
cec
))
return
true
;
314
315
current
=
current
->
superInterface__
;
316
}
317
318
return
false
;
319
}
320
321
default
: {
322
GUM_ERROR
(
FatalError
,
"unknown ClassElementContainer<GUM_SCALAR>"
);
323
}
324
}
325
}
326
327
template
<
typename
GUM_SCALAR
>
328
void
PRMInterface
<
GUM_SCALAR
>::
updateDescendants_
(
329
const
PRMClassElement
<
GUM_SCALAR
>&
elt
) {
330
// for ( const auto ext : extensions__ )
331
// if ( !ext->isOutputNode( elt ) ) ext->setOutputNode( elt, true );
332
333
// for ( const auto impl : implementations__ ) {
334
// // Because of cyclic dependencies we must use a reinterpret cast.
335
// PRMClassElementContainer<GUM_SCALAR>* c =
336
// reinterpret_cast<PRMClassElementContainer<GUM_SCALAR>*>( impl );
337
338
// if ( ! c->isOutputNode( elt ) ) c->setOutputNode( elt, true );
339
//}
340
}
341
342
template
<
typename
GUM_SCALAR
>
343
INLINE
typename
PRMInterface
<
GUM_SCALAR
>::
ClassEltIterator
344
PRMInterface
<
GUM_SCALAR
>::
begin
() {
345
return
nodeIdMap__
.
begin
();
346
}
347
348
template
<
typename
GUM_SCALAR
>
349
INLINE
const
typename
PRMInterface
<
GUM_SCALAR
>::
ClassEltIterator
&
350
PRMInterface
<
GUM_SCALAR
>::
end
() {
351
return
nodeIdMap__
.
end
();
352
}
353
354
template
<
typename
GUM_SCALAR
>
355
INLINE
typename
PRMInterface
<
GUM_SCALAR
>::
const_ClassEltIterator
356
PRMInterface
<
GUM_SCALAR
>::
begin
()
const
{
357
return
nodeIdMap__
.
begin
();
358
}
359
360
template
<
typename
GUM_SCALAR
>
361
INLINE
const
typename
PRMInterface
<
GUM_SCALAR
>::
const_ClassEltIterator
&
362
PRMInterface
<
GUM_SCALAR
>::
end
()
const
{
363
return
nodeIdMap__
.
end
();
364
}
365
366
template
<
typename
GUM_SCALAR
>
367
INLINE
void
PRMInterface
<
GUM_SCALAR
>::
addArc
(
const
std
::
string
&
tail
,
368
const
std
::
string
&
head
) {
369
GUM_ERROR
(
OperationNotAllowed
,
"an Interface does ! have arcs"
);
370
}
371
372
template
<
typename
GUM_SCALAR
>
373
INLINE
PRMInterface
<
GUM_SCALAR
>&
PRMInterface
<
GUM_SCALAR
>::
super
() {
374
if
(
superInterface__
)
375
return
*
superInterface__
;
376
else
377
GUM_ERROR
(
NotFound
,
"this Interface is ! a sub interface"
);
378
}
379
380
template
<
typename
GUM_SCALAR
>
381
INLINE
const
PRMInterface
<
GUM_SCALAR
>&
382
PRMInterface
<
GUM_SCALAR
>::
super
()
const
{
383
if
(
superInterface__
)
384
return
*
superInterface__
;
385
else
386
GUM_ERROR
(
NotFound
,
"this Interface is ! a sub interface"
);
387
}
388
389
template
<
typename
GUM_SCALAR
>
390
INLINE
void
391
PRMInterface
<
GUM_SCALAR
>::
addImplementation__
(
PRMClass
<
GUM_SCALAR
>*
c
) {
392
implementations__
.
insert
(
c
);
393
}
394
395
template
<
typename
GUM_SCALAR
>
396
INLINE
void
397
PRMInterface
<
GUM_SCALAR
>::
addExtension__
(
PRMInterface
<
GUM_SCALAR
>*
i
) {
398
extensions__
.
insert
(
i
);
399
}
400
401
template
<
typename
GUM_SCALAR
>
402
INLINE
PRMClassElement
<
GUM_SCALAR
>&
403
PRMInterface
<
GUM_SCALAR
>::
operator
[](
NodeId
id
) {
404
return
get
(
id
);
405
}
406
407
template
<
typename
GUM_SCALAR
>
408
INLINE
const
PRMClassElement
<
GUM_SCALAR
>&
409
PRMInterface
<
GUM_SCALAR
>::
operator
[](
NodeId
id
)
const
{
410
return
get
(
id
);
411
}
412
413
template
<
typename
GUM_SCALAR
>
414
INLINE
PRMClassElement
<
GUM_SCALAR
>&
415
PRMInterface
<
GUM_SCALAR
>::
operator
[](
const
std
::
string
&
name
) {
416
return
get
(
name
);
417
}
418
419
template
<
typename
GUM_SCALAR
>
420
INLINE
const
PRMClassElement
<
GUM_SCALAR
>&
421
PRMInterface
<
GUM_SCALAR
>::
operator
[](
const
std
::
string
&
name
)
const
{
422
return
get
(
name
);
423
}
424
425
template
<
typename
GUM_SCALAR
>
426
INLINE
typename
PRMObject
::
prm_type
427
PRMInterface
<
GUM_SCALAR
>::
obj_type
()
const
{
428
return
PRMObject
::
prm_type
::
PRM_INTERFACE
;
429
}
430
431
template
<
typename
GUM_SCALAR
>
432
INLINE
const
DAG
&
PRMInterface
<
GUM_SCALAR
>::
dag_
()
const
{
433
return
dag__
;
434
}
435
436
template
<
typename
GUM_SCALAR
>
437
INLINE
DAG
&
PRMInterface
<
GUM_SCALAR
>::
dag_
() {
438
return
dag__
;
439
}
440
441
template
<
typename
GUM_SCALAR
>
442
INLINE
PRMClassElement
<
GUM_SCALAR
>&
443
PRMInterface
<
GUM_SCALAR
>::
get
(
NodeId
id
) {
444
try
{
445
return
*(
nodeIdMap__
[
id
]);
446
}
catch
(
NotFound
&) {
447
GUM_ERROR
(
NotFound
,
"no ClassElement<GUM_SCALAR> with the given NodeId"
);
448
}
449
}
450
451
template
<
typename
GUM_SCALAR
>
452
INLINE
const
PRMClassElement
<
GUM_SCALAR
>&
453
PRMInterface
<
GUM_SCALAR
>::
get
(
NodeId
id
)
const
{
454
try
{
455
return
*(
nodeIdMap__
[
id
]);
456
}
catch
(
NotFound
&) {
457
GUM_ERROR
(
NotFound
,
"no ClassElement<GUM_SCALAR> with the given NodeId"
);
458
}
459
}
460
461
template
<
typename
GUM_SCALAR
>
462
INLINE
PRMClassElement
<
GUM_SCALAR
>&
463
PRMInterface
<
GUM_SCALAR
>::
get
(
const
std
::
string
&
name
) {
464
try
{
465
return
*(
nameMap__
[
name
]);
466
}
catch
(
NotFound
&) {
467
GUM_ERROR
(
NotFound
,
"no ClassElement<GUM_SCALAR> with the given name"
);
468
}
469
}
470
471
template
<
typename
GUM_SCALAR
>
472
INLINE
const
PRMClassElement
<
GUM_SCALAR
>&
473
PRMInterface
<
GUM_SCALAR
>::
get
(
const
std
::
string
&
name
)
const
{
474
try
{
475
return
*(
nameMap__
[
name
]);
476
}
catch
(
NotFound
&) {
477
GUM_ERROR
(
NotFound
,
"no ClassElement<GUM_SCALAR> with the given name"
);
478
}
479
}
480
481
template
<
typename
GUM_SCALAR
>
482
INLINE
const
Set
<
PRMAttribute
<
GUM_SCALAR
>* >&
483
PRMInterface
<
GUM_SCALAR
>::
attributes
()
const
{
484
return
attributes__
;
485
}
486
487
template
<
typename
GUM_SCALAR
>
488
INLINE
const
Set
<
PRMReferenceSlot
<
GUM_SCALAR
>* >&
489
PRMInterface
<
GUM_SCALAR
>::
referenceSlots
()
const
{
490
return
referenceSlots__
;
491
}
492
493
template
<
typename
GUM_SCALAR
>
494
INLINE
Set
<
PRMClass
<
GUM_SCALAR
>* >&
495
PRMInterface
<
GUM_SCALAR
>::
implementations
() {
496
return
implementations__
;
497
}
498
499
template
<
typename
GUM_SCALAR
>
500
INLINE
const
Set
<
PRMClass
<
GUM_SCALAR
>* >&
501
PRMInterface
<
GUM_SCALAR
>::
implementations
()
const
{
502
return
implementations__
;
503
}
504
505
template
<
typename
GUM_SCALAR
>
506
void
PRMInterface
<
GUM_SCALAR
>::
findAllSubtypes_
(
507
Set
<
PRMClassElementContainer
<
GUM_SCALAR
>* >&
set
) {
508
for
(
const
auto
impl
:
implementations__
) {
509
set
.
insert
(
impl
);
510
impl
->
findAllSubtypes_
(
set
);
511
}
512
513
for
(
const
auto
ext
:
extensions__
) {
514
set
.
insert
(
ext
);
515
ext
->
findAllSubtypes_
(
set
);
516
}
517
}
518
519
template
<
typename
GUM_SCALAR
>
520
INLINE
bool
PRMInterface
<
GUM_SCALAR
>::
isOutputNode
(
521
const
PRMClassElement
<
GUM_SCALAR
>&
elt
)
const
{
522
try
{
523
if
(!
this
->
getIOFlag_
(
elt
).
second
) {
524
for
(
auto
i
:
implementations__
) {
525
if
(
i
->
isOutputNode
(
elt
)) {
return
true
; }
526
}
527
528
if
(
superInterface__
&&
superInterface__
->
isOutputNode
(
elt
)) {
529
return
true
;
530
}
531
532
}
else
{
533
return
true
;
534
}
535
}
catch
(
NotFound
&) {}
536
return
false
;
537
}
538
}
/* namespace prm */
539
}
/* namespace gum */
gum::Set::emplace
INLINE void emplace(Args &&... args)
Definition:
set_tpl.h:669
gum::prm::ParamScopeData::ParamScopeData
ParamScopeData(const std::string &s, const PRMReferenceSlot< GUM_SCALAR > &ref, Idx d)
Definition:
PRMClass_tpl.h:1101