-
Notifications
You must be signed in to change notification settings - Fork 131
Expand file tree
/
Copy pathinstMgrHelper.h
More file actions
57 lines (46 loc) · 1.53 KB
/
instMgrHelper.h
File metadata and controls
57 lines (46 loc) · 1.53 KB
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
#ifndef INSTMGRHELPER_H
#define INSTMGRHELPER_H
#include <lazyInstMgr.h>
#include <instmgr.h>
/**
* \file instMgrHelper.h helper classes for the lazyInstMgr. Allows use of SDAI_Application_instance class
* without modification.
*/
/**
* This class is used when creating SDAI_Application_instance's and using a lazyInstMgr. It is returned
* by instMgrAdapter. SDAI_Application_instance only uses the GetSTEPentity function.
*/
class mgrNodeHelper: protected MgrNode {
protected:
lazyInstMgr * _lim;
instanceID _id;
public:
mgrNodeHelper( lazyInstMgr * lim ) {
_lim = lim;
_id = 0;
}
inline void setInstance( instanceID id ) {
_id = id;
}
inline SDAI_Application_instance * GetSTEPentity() {
// unsigned int c = _lim->countDataSections();
return _lim->loadInstance( _id );
}
};
/**
* This class is used when creating SDAI_Application_instance's and using a lazyInstMgr.
*
* Instances need an InstMgr to look up the instances they refer to. This class pretends to be a normal InstMgr;
* when an instance is looked up, this uses lazyInstMgr to load it, and then returns a pointer to it.
*/
class instMgrAdapter: public InstMgr {
protected:
mgrNodeHelper _mn;
public:
instMgrAdapter( lazyInstMgr * lim ): InstMgr( 0 ), _mn( lim ) {}
inline mgrNodeHelper * FindFileId( int fileId ) {
_mn.setInstance( fileId );
return &_mn;
}
};
#endif //INSTMGRHELPER_H