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
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720 | #ifndef MESHKIT_ITAPS_REL_HPP
#define MESHKIT_ITAPS_REL_HPP
/** \file iRel.hpp
*/
#include "iRel.h"
#include <string.h>
#include <stdlib.h>
#include <vector>
#include <limits>
#include <string>
#include <algorithm>
#include "assert.h"
#define IRELI irelInstance->mInstance
typedef void* iBase_Instance;
/** \class iRel
* \brief C++ interface to ITAPS iRel interface
*
* This class is a simple wrapper for the ITAPS %iRel interface. The primary benefit to using this class
* instead of %iRel directly is that lists of handles are passed as std::vectors instead of pointers to
* handle arrays. This file includes both declaration and definition of all iRel class functions, i.e.
* all functions are inlined. The class can be constructed and destructed in the standard C++ way; the
* implementation of those functions call into the standard %iRel C functions newRel and dtor.
*
* For complete documentation of these functions, see the
* [http://trac.mcs.anl.gov/projects/ITAPS/browser/Lasso/trunk/iRel.h iRel header] in the Lasso source
* (for now).
*/
class iRel {
public:
typedef iBase_ErrorType Error;
iRel( const char* options = 0 );
iRel( iRel_Instance instance );
~iRel();
iRel_Instance instance() { return mInstance; }
enum IfaceType
{IGEOM_IFACE = 0,
IMESH_IFACE,
IFIELD_IFACE,
IREL_IFACE,
FBIGEOM_IFACE};
enum RelationType
{ENTITY = 0,
SET,
BOTH};
enum RelationStatus
{ACTIVE = 0,
INACTIVE,
NOTEXIST};
inline iRel::IfaceType iface_type() const {
return iRel::IREL_IFACE;
}
/** \class PairHandle iRel.hpp "iRel.hpp"
* \brief Class for storing, querying and modifying relations data.
*
* This class encapsulates most of the functions for querying relations in the C++ version of %iRel.
*/
class PairHandle
{
public:
PairHandle(iRel *instance,
iBase_Instance iface1 = NULL,
RelationType rtype1 = ENTITY,
IfaceType itype1 = IREL_IFACE,
RelationStatus status1 = ACTIVE,
iBase_Instance iface2 = NULL,
RelationType rtype2 = ENTITY,
IfaceType itype2 = IREL_IFACE,
RelationStatus status2 = ACTIVE);
PairHandle(iRel *instance, iRel_PairHandle ph);
iRel_PairHandle instance() { return irelPair; }
~PairHandle();
friend class iRel;
iBase_Instance get_iface(int i);
IfaceType get_iface_type(int i);
RelationType get_rel_type(int i);
Error changeType (RelationType ent_or_set1,
RelationType ent_or_set2);
Error setEntEntRelation (
/*in*/ iBase_EntityHandle ent1,
/*in*/ iBase_EntityHandle ent2);
Error setEntSetRelation (
/*in*/ iBase_EntityHandle ent1,
/*in*/ iBase_EntitySetHandle entset2);
Error setSetEntRelation (
/*in*/ iBase_EntitySetHandle entset1,
/*in*/ iBase_EntityHandle ent2);
Error setSetSetRelation (
/*in*/ iBase_EntitySetHandle entset1,
/*in*/ iBase_EntitySetHandle entset2);
Error setEntArrEntArrRelation (
/*in*/ iBase_EntityHandle *ent_array_1,
/*in*/ int num_ent1,
/*in*/ iBase_EntityHandle *ent_array_2,
/*in*/ int num_ent2);
Error setSetArrEntArrRelation (
/*in*/ iBase_EntitySetHandle *entset_array_1,
/*in*/ int num_ent1,
/*in*/ iBase_EntityHandle *ent_array_2,
/*in*/ int num_ent2);
Error setEntArrSetArrRelation (
/*in*/ iBase_EntityHandle *ent_array_1,
/*in*/ int num_ent1,
/*in*/ iBase_EntitySetHandle *entset_array_2,
/*in*/ int num_ent2);
Error setSetArrSetArrRelation (
/*in*/ iBase_EntitySetHandle *entset_array_1,
/*in*/ int num_ent1,
/*in*/ iBase_EntitySetHandle *entset_array_2,
/*in*/ int num_ent2);
Error getEntEntRelation (
/*in*/ iBase_EntityHandle ent1,
/*in*/ bool switch_order,
/*out*/ iBase_EntityHandle &ent2);
Error getEntSetRelation (
/*in*/ iBase_EntityHandle ent1,
/*in*/ bool switch_order,
/*out*/ iBase_EntitySetHandle &entset2);
Error getSetEntRelation (
/*in*/ iBase_EntitySetHandle entset1,
/*in*/ bool switch_order,
/*out*/ iBase_EntityHandle &ent2);
Error getSetSetRelation (
/*in*/ iBase_EntitySetHandle entset1,
/*in*/ bool switch_order,
/*out*/ iBase_EntitySetHandle &entset2);
Error getEntSetIterRelation (
/*in*/ iBase_EntityHandle ent1,
/*in*/ bool switch_order,
/*out*/ iBase_EntityIterator &entset2);
Error getEntArrEntArrRelation (
/*in*/ iBase_EntityHandle *ent_array_1,
/*in*/ int ent_array_1_size,
/*in*/ bool switch_order,
/*inout*/ std::vector<iBase_EntityHandle> &ent_array_2);
Error getEntArrSetArrRelation (
/*in*/ iBase_EntityHandle *ent_array_1,
/*in*/ int ent_array_1_size,
/*in*/ bool switch_order,
/*inout*/ std::vector<iBase_EntitySetHandle> &entset_array_2);
Error getSetArrEntArrRelation (
/*in*/ iBase_EntitySetHandle *entset_array_1,
/*in*/ int entset_array_1_size,
/*in*/ bool switch_order,
/*inout*/ std::vector<iBase_EntityHandle> &ent_array_2);
Error getSetArrSetArrRelation (
/*in*/ iBase_EntitySetHandle *entset_array_1,
/*in*/ int entset_array_1_size,
/*in*/ bool switch_order,
/*inout*/ std::vector<iBase_EntitySetHandle> &entset_array_2);
Error getEntArrSetIterArrRelation (
/*in*/ iBase_EntityHandle *ent_array_1,
/*in*/ int ent_array_1_size,
/*in*/ bool switch_order,
/*inout*/ std::vector<iBase_EntityIterator> &entiter);
Error inferAllRelations ();
Error inferAllRelationsAndType ();
Error inferEntRelations (
/*in*/ iBase_EntityHandle entity,
/*in*/ int iface_no);
Error inferSetRelations (
/*in*/ iBase_EntitySetHandle entity_set,
/*in*/ int iface_no);
Error inferEntArrRelations (
/*in*/ iBase_EntityHandle *entities,
/*in*/ int entities_size,
/*in*/ int iface_no);
Error inferSetArrRelations (
/*in*/ iBase_EntitySetHandle *entity_sets,
/*in*/ int entities_size,
/*in*/ int iface_no);
private:
iRel *irelInstance;
iBase_Instance iFaces[2];
IfaceType iFaceTypes[2];
RelationType relTypes[2];
RelationStatus relStatuses[2];
iRel_PairHandle irelPair;
bool pairOwner;
};
Error getErrorType();
std::string getDescription();
Error createPair (
/*in*/ iBase_Instance iface1,
/*in*/ const RelationType ent_or_set1,
/*in*/ const IfaceType iface_type1,
/*in*/ const RelationStatus status1,
/*in*/ iBase_Instance iface2,
/*in*/ const RelationType ent_or_set2,
/*in*/ const IfaceType iface_type2,
/*in*/ const RelationStatus status2,
/*out*/ PairHandle *&pair);
template<typename T, typename U>
Error createPair (
/*in*/ T &iface1,
/*in*/ const RelationType ent_or_set1,
/*in*/ const RelationStatus status1,
/*in*/ U &iface2,
/*in*/ const RelationType ent_or_set2,
/*in*/ const RelationStatus status2,
/*out*/ PairHandle *&pair);
Error findPairs (
/*in*/ iBase_Instance iface,
/*inout*/ std::vector<PairHandle *> &pairs);
protected:
Error add_pair(PairHandle *pair);
Error remove_pair(PairHandle *pair);
private:
iRel_Instance mInstance;
bool iRelInstanceOwner;
std::vector<PairHandle*> relPairs;
// prohibit copying
iRel( const iRel& ) {}
void operator=(const iRel&) {}<--- Member variable 'iRel::iRelInstanceOwner' is not assigned a value in 'iRel::operator='.
};
inline
iRel::iRel( const char* options )
: iRelInstanceOwner(true)
{
int err, len = options ? strlen(options) : 0;
iRel_create( options, &mInstance, &err, len );
if (iBase_SUCCESS != err) {
mInstance = 0;
iRelInstanceOwner = false;
}
}
inline
iRel::iRel( iRel_Instance instance )
: iRelInstanceOwner(false)
{
mInstance = instance;
}
inline iRel::~iRel()
{
if (iRelInstanceOwner) {
int err;
iRel_destroy( mInstance, &err );
}
}
inline iRel::Error iRel::getErrorType()
{
int err;
iRel_getErrorType(mInstance, &err );
return (Error)err;
}
inline std::string iRel::getDescription()
{
std::vector<char> buffer(1024);
iRel_getDescription(mInstance, &buffer[0], buffer.size() );
return std::string(&buffer[0]);
}
inline iRel::Error iRel::createPair (
/*in*/ iBase_Instance iface1,
/*in*/ const RelationType ent_or_set1,
/*in*/ const IfaceType iface_type1,
/*in*/ const RelationStatus status1,
/*in*/ iBase_Instance iface2,
/*in*/ const RelationType ent_or_set2,
/*in*/ const IfaceType iface_type2,
/*in*/ const RelationStatus status2,
/*out*/ PairHandle *&pair)
{
pair = new PairHandle(this, iface1, ent_or_set1, iface_type1, status1,
iface2, ent_or_set2, iface_type2, status2);
return (Error)iBase_SUCCESS;
}
template<typename T, typename U>
inline iRel::Error iRel::createPair (
/*in*/ T &iface1,
/*in*/ const RelationType ent_or_set1,
/*in*/ const RelationStatus status1,
/*in*/ U &iface2,
/*in*/ const RelationType ent_or_set2,
/*in*/ const RelationStatus status2,
/*out*/ PairHandle *&pair)
{
pair = new PairHandle(this, iface1.instance(), ent_or_set1,
iface1.iface_type(), status1,
iface2.instance(), ent_or_set2,
iface2.iface_type(), status2);
return (Error)iBase_SUCCESS;
}
inline iRel::Error iRel::findPairs (
/*in*/ iBase_Instance iface,
/*inout*/ std::vector<PairHandle *> &pairs)
{
for (std::vector<PairHandle*>::iterator vit = relPairs.begin(); vit != relPairs.end(); vit++) {<--- Prefer prefix ++/-- operators for non-primitive types.
if ((*vit)->iFaces[0] == iface || (*vit)->iFaces[1] == iface)
pairs.push_back(*vit);
}
return (Error)iBase_SUCCESS;
}
inline iRel::Error iRel::add_pair(PairHandle *pair)
{
assert(std::find(relPairs.begin(), relPairs.end(), pair) == relPairs.end());
relPairs.push_back(pair);
return (Error)iBase_SUCCESS;
}
inline iRel::Error iRel::remove_pair(PairHandle *pair)
{
std::vector<PairHandle*>::iterator vit = std::find(relPairs.begin(), relPairs.end(), pair);
if (vit == relPairs.end()) return (Error)iBase_FAILURE;
else relPairs.erase(vit);
return (Error)iBase_SUCCESS;
}
inline iRel::PairHandle::PairHandle(iRel *instance,
iBase_Instance iface1,
RelationType rtype1,
IfaceType itype1,
RelationStatus status1,
iBase_Instance iface2,
RelationType rtype2,
IfaceType itype2,
RelationStatus status2)
: irelInstance(instance),
pairOwner(true)
{
iFaces[0] = iface1;
iFaces[1] = iface2;
iFaceTypes[0] = itype1;
iFaceTypes[1] = itype2;
relTypes[0] = rtype1;
relTypes[1] = rtype2;
relStatuses[0] = status1;
relStatuses[1] = status2;
int err;
iRel_createPair(IRELI, iface1, rtype1, itype1, status1, iface2, rtype2,
itype2, status2, &irelPair, &err);
instance->add_pair(this);
}
inline iRel::PairHandle::PairHandle(iRel *instance, iRel_PairHandle ph)
: irelInstance(instance), pairOwner(false)
{
int err;
int rtype1, rtype2, itype1, itype2, status1, status2;
iRel_getPairInfo(IRELI, ph, iFaces, &rtype1, &itype1, &status1,
iFaces+1, &rtype2, &itype2, &status2, &err);
if (iBase_SUCCESS == err) {
iFaceTypes[0] = (IfaceType)itype1;
iFaceTypes[1] = (IfaceType)itype2;
relTypes[0] = (RelationType)rtype1;
relTypes[1] = (RelationType)rtype2;
relStatuses[0] = (RelationStatus)status1;
relStatuses[1] = (RelationStatus)status2;
}
instance->add_pair(this);
}
inline iRel::PairHandle::~PairHandle()
{
irelInstance->remove_pair(this);
if (pairOwner) {
int err;
iRel_destroyPair(IRELI, irelPair, &err);
}
}
inline iBase_Instance iRel::PairHandle::get_iface(int i)
{
assert(i == 0 || i == 1);
return iFaces[i];
}
inline iRel::IfaceType iRel::PairHandle::get_iface_type(int i)
{
assert(i == 0 || i == 1);
return iFaceTypes[i];
}
inline iRel::RelationType iRel::PairHandle::get_rel_type(int i)
{
assert(i == 0 || i == 1);
return relTypes[i];
}
inline iRel::Error iRel::PairHandle::changeType (RelationType ent_or_set1,
RelationType ent_or_set2)
{
int err;
iRel_changePairType(IRELI, irelPair, ent_or_set1, ent_or_set2, &err);
return (Error)err;
}
inline iRel::Error iRel::PairHandle::setEntEntRelation (
/*in*/ iBase_EntityHandle ent1,
/*in*/ iBase_EntityHandle ent2)
{
int err;
iRel_setEntEntRelation (IRELI, irelPair, ent1, ent2, &err);
return (Error)err;
}
inline iRel::Error iRel::PairHandle::setEntSetRelation (
/*in*/ iBase_EntityHandle ent1,
/*in*/ iBase_EntitySetHandle entset2)
{
int err;
iRel_setEntSetRelation (IRELI, irelPair, ent1, entset2, &err);
return (Error)err;
}
inline iRel::Error iRel::PairHandle::setSetEntRelation (
/*in*/ iBase_EntitySetHandle entset1,
/*in*/ iBase_EntityHandle ent2)
{
int err;
iRel_setSetEntRelation (IRELI, irelPair, entset1, ent2, &err);
return (Error)err;
}
inline iRel::Error iRel::PairHandle::setSetSetRelation (
/*in*/ iBase_EntitySetHandle entset1,
/*in*/ iBase_EntitySetHandle entset2)
{
int err;
iRel_setSetSetRelation (IRELI, irelPair, entset1, entset2, &err);
return (Error)err;
}
inline iRel::Error iRel::PairHandle::setEntArrEntArrRelation (
/*in*/ iBase_EntityHandle *ent_array_1,
/*in*/ int num_ent1,
/*in*/ iBase_EntityHandle *ent_array_2,
/*in*/ int num_ent2)
{
int err;
iRel_setEntArrEntArrRelation (IRELI, irelPair, ent_array_1, num_ent1, ent_array_2, num_ent2, &err);
return (Error)err;
}
inline iRel::Error iRel::PairHandle::setSetArrEntArrRelation (
/*in*/ iBase_EntitySetHandle *entset_array_1,
/*in*/ int num_ent1,
/*in*/ iBase_EntityHandle *ent_array_2,
/*in*/ int num_ent2)
{
int err;
iRel_setSetArrEntArrRelation (IRELI, irelPair, entset_array_1, num_ent1, ent_array_2, num_ent2, &err);
return (Error)err;
}
inline iRel::Error iRel::PairHandle::setEntArrSetArrRelation (
/*in*/ iBase_EntityHandle *ent_array_1,
/*in*/ int num_ent1,
/*in*/ iBase_EntitySetHandle *entset_array_2,
/*in*/ int num_ent2)
{
int err;
iRel_setEntArrSetArrRelation (IRELI, irelPair, ent_array_1, num_ent1, entset_array_2, num_ent2, &err);
return (Error)err;
}
inline iRel::Error iRel::PairHandle::setSetArrSetArrRelation (
/*in*/ iBase_EntitySetHandle *entset_array_1,
/*in*/ int num_ent1,
/*in*/ iBase_EntitySetHandle *entset_array_2,
/*in*/ int num_ent2)
{
int err;
iRel_setSetArrSetArrRelation (IRELI, irelPair,
/*in*/ entset_array_1, num_ent1, entset_array_2, num_ent2, &err);
return (Error)err;
}
inline iRel::Error iRel::PairHandle::getEntEntRelation (
/*in*/ iBase_EntityHandle ent1,
/*in*/ bool switch_order,
/*out*/ iBase_EntityHandle &ent2)
{
int err;
iRel_getEntEntRelation (IRELI, irelPair, ent1, switch_order, &ent2, &err);
return (Error)err;
}
inline iRel::Error iRel::PairHandle::getEntSetRelation (
/*in*/ iBase_EntityHandle ent1,
/*in*/ bool switch_order,
/*out*/ iBase_EntitySetHandle &entset2)
{
int err;
iRel_getEntSetRelation (IRELI, irelPair, ent1, switch_order, &entset2, &err);
return (Error)err;
}
inline iRel::Error iRel::PairHandle::getSetEntRelation (
/*in*/ iBase_EntitySetHandle entset1,
/*in*/ bool switch_order,
/*out*/ iBase_EntityHandle &ent2)
{
int err;
iRel_getSetEntRelation (IRELI, irelPair, entset1, switch_order, &ent2, &err);
return (Error)err;
}
inline iRel::Error iRel::PairHandle::getSetSetRelation (
/*in*/ iBase_EntitySetHandle entset1,
/*in*/ bool switch_order,
/*out*/ iBase_EntitySetHandle &entset2)
{
int err;
iRel_getSetSetRelation (IRELI, irelPair, entset1, switch_order, &entset2, &err);
return (Error)err;
}
inline iRel::Error iRel::PairHandle::getEntSetIterRelation (
/*in*/ iBase_EntityHandle ent1,
/*in*/ bool switch_order,
/*out*/ iBase_EntityIterator &entset2)
{
int err;
iRel_getEntSetIterRelation (IRELI, irelPair, ent1, switch_order, &entset2, &err);
return (Error)err;
}
inline iRel::Error iRel::PairHandle::getEntArrEntArrRelation (
/*in*/ iBase_EntityHandle *ent_array_1,
/*in*/ int ent_array_1_size,
/*in*/ bool switch_order,
/*inout*/ std::vector<iBase_EntityHandle> &ent_array_2)
{
int err;
int dum1 = 0, dum2;
iBase_EntityHandle *dum_ptr = NULL;
iRel_getEntArrEntArrRelation (IRELI, irelPair, ent_array_1, ent_array_1_size, switch_order,
&dum_ptr, &dum1, &dum2, &err);
if (iBase_SUCCESS == err) {
ent_array_2.resize(dum1);
memcpy(&ent_array_2[0], dum_ptr, dum1*sizeof(iBase_EntityHandle));
}
return (Error)err;
}
inline iRel::Error iRel::PairHandle::getEntArrSetArrRelation (
/*in*/ iBase_EntityHandle *ent_array_1,
/*in*/ int ent_array_1_size,
/*in*/ bool switch_order,
/*inout*/ std::vector<iBase_EntitySetHandle> &entset_array_2)
{
int err;
int dum1 = 0, dum2;
iBase_EntitySetHandle *dum_ptr = NULL;
iRel_getEntArrSetArrRelation (IRELI, irelPair, ent_array_1, ent_array_1_size, switch_order,
&dum_ptr, &dum1, &dum2, &err);
if (iBase_SUCCESS == err) {
entset_array_2.resize(dum1);
memcpy(&entset_array_2[0], dum_ptr, dum1*sizeof(iBase_EntitySetHandle));
}
return (Error)err;
}
inline iRel::Error iRel::PairHandle::getSetArrEntArrRelation (
/*in*/ iBase_EntitySetHandle *entset_array_1,
/*in*/ int entset_array_1_size,
/*in*/ bool switch_order,
/*inout*/ std::vector<iBase_EntityHandle> &ent_array_2)
{
int err;
int dum1 = 0, dum2;
iBase_EntityHandle *dum_ptr = NULL;
iRel_getSetArrEntArrRelation (IRELI, irelPair, entset_array_1, entset_array_1_size, switch_order,
&dum_ptr, &dum1, &dum2, &err);
if (iBase_SUCCESS == err) {
ent_array_2.resize(dum1);
memcpy(&ent_array_2[0], dum_ptr, dum1*sizeof(iBase_EntityHandle));
}
return (Error)err;
}
inline iRel::Error iRel::PairHandle::getSetArrSetArrRelation (
/*in*/ iBase_EntitySetHandle *entset_array_1,
/*in*/ int entset_array_1_size,
/*in*/ bool switch_order,
/*inout*/ std::vector<iBase_EntitySetHandle> &entset_array_2)
{
int err;
int dum1 = 0, dum2;
iBase_EntitySetHandle *dum_ptr = NULL;
iRel_getSetArrSetArrRelation (IRELI, irelPair, entset_array_1, entset_array_1_size, switch_order,
&dum_ptr, &dum1, &dum2, &err);
if (iBase_SUCCESS == err) {
entset_array_2.resize(dum1);
memcpy(&entset_array_2[0], dum_ptr, dum1*sizeof(iBase_EntitySetHandle));
}
return (Error)err;
}
inline iRel::Error iRel::PairHandle::getEntArrSetIterArrRelation (
/*in*/ iBase_EntityHandle *ent_array_1,
/*in*/ int ent_array_1_size,
/*in*/ bool switch_order,
/*inout*/ std::vector<iBase_EntityIterator> &entiter)
{
int err;
int dum1 = 0, dum2;
iBase_EntityIterator *dum_ptr = NULL;
iRel_getEntArrSetIterArrRelation (IRELI, irelPair, ent_array_1, ent_array_1_size, switch_order,
&dum_ptr, &dum1, &dum2, &err);
if (iBase_SUCCESS == err) {
entiter.resize(dum1);
memcpy(&entiter[0], dum_ptr, dum1*sizeof(iBase_EntityIterator));
}
return (Error)err;
}
inline iRel::Error iRel::PairHandle::inferAllRelations ()
{
int err;
iRel_inferAllRelations (IRELI, irelPair, &err);
return (Error)err;
}
inline iRel::Error iRel::PairHandle::inferAllRelationsAndType ()
{
int err;
iRel_inferAllRelationsAndType (IRELI, &irelPair, &err);
return (Error)err;
}
inline iRel::Error iRel::PairHandle::inferEntRelations (
/*in*/ iBase_EntityHandle entity,
/*in*/ int iface_no)
{
int err;
iRel_inferEntRelations (IRELI, irelPair, entity, iface_no, &err);
return (Error)err;
}
inline iRel::Error iRel::PairHandle::inferSetRelations (
/*in*/ iBase_EntitySetHandle entity_set,
/*in*/ int iface_no)
{
int err;
iRel_inferSetRelations (IRELI, irelPair, entity_set, iface_no, &err);
return (Error)err;
}
inline iRel::Error iRel::PairHandle::inferEntArrRelations (
/*in*/ iBase_EntityHandle *entities,
/*in*/ int entities_size,
/*in*/ int iface_no)
{
int err;
iRel_inferEntArrRelations (IRELI, irelPair, entities, entities_size, iface_no, &err);
return (Error)err;
}
inline iRel::Error iRel::PairHandle::inferSetArrRelations (
/*in*/ iBase_EntitySetHandle *entity_sets,
/*in*/ int entities_size,
/*in*/ int iface_no)
{
int err;
iRel_inferSetArrRelations (IRELI, irelPair, entity_sets, entities_size, iface_no, &err);
return (Error)err;
}
#endif /* #ifndef ITAPS_REL_HH */
|