-
Notifications
You must be signed in to change notification settings - Fork 131
Expand file tree
/
Copy pathinstMgrHelper.h
More file actions
61 lines (49 loc) · 1.65 KB
/
instMgrHelper.h
File metadata and controls
61 lines (49 loc) · 1.65 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
57
58
59
60
#ifndef INSTMGRHELPER_H
#define INSTMGRHELPER_H
#include <sc_export.h>
#include <mgrnode.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 SC_LAZYFILE_EXPORT mgrNodeHelper: public MgrNodeBase {
protected:
lazyInstMgr * _lim;
instanceID _id;
public:
mgrNodeHelper( lazyInstMgr * lim ) {
_lim = lim;
_id = 0;
prev = next = 0;
}
inline void setInstance( instanceID id ) {
_id = id;
}
inline SDAI_Application_instance * GetSTEPentity() {
return _lim->loadInstance( _id, true );
}
};
/**
* 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 SC_LAZYFILE_EXPORT instMgrAdapter: public InstMgrBase {
protected:
mgrNodeHelper _mn;
public:
instMgrAdapter( lazyInstMgr * lim ): InstMgrBase(), _mn( lim ) {}
inline mgrNodeHelper * FindFileId( int fileId ) {
//TODO check if fileId exists. if not, return null
_mn.setInstance( fileId );
return &_mn;
}
};
#endif //INSTMGRHELPER_H