-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUBaseViewThread.pas
90 lines (75 loc) · 2.07 KB
/
UBaseViewThread.pas
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
unit UBaseViewThread;
interface
uses
UInterfaceWrapper, GrymCore_TLB, UBaseViewFrame, UGrymObjectFactory
, UBaseReference, UGrymDatabase;
type
TBaseViewThread = class(TInterfaceWrapper<IBaseViewThread>)
FFrame: TBaseViewFrame;
FFactory: TGrymObjectFactory;
FBaseReference: TBaseReference;
FDatabase: TGrymDatabase;
public
destructor Destroy; override;
function GetFrame: TBaseViewFrame;
function GetFactory: TGrymObjectFactory;
function GetBaseReference: TBaseReference;
function GetDatabase: TGrymDatabase;
end;
implementation
uses
SysUtils, ComObj;
{ TBaseViewThread }
destructor TBaseViewThread.Destroy;
begin
FreeAndNil(Self.FFrame);
FreeAndNil(Self.FFactory);
FreeAndNil(Self.FBaseReference);
FreeAndNil(Self.FDatabase);
inherited;
end;
function TBaseViewThread.GetBaseReference: TBaseReference;
var
BaseReference: IBaseReference;
begin
if not Assigned(Self.FBaseReference) then
begin
OleCheck(Self.GetInterface.Get_BaseReference(BaseReference));
Self.FBaseReference := TBaseReference.Create(BaseReference);
end;
Result := Self.FBaseReference;
end;
function TBaseViewThread.GetDatabase: TGrymDatabase;
var
pDatabase: IDatabase;
begin
if not Assigned(Self.FDatabase) then
begin
OleCheck(Self.GetInterface.Get_Database(pDatabase));
Self.FDatabase := TGrymDatabase.Create(pDatabase);
end;
Result := Self.FDatabase;
end;
function TBaseViewThread.GetFactory: TGrymObjectFactory;
var
pFactory: IGrymObjectFactory;
begin
if not Assigned(Self.FFactory) then
begin
OleCheck(Self.GetInterface.Get_Factory(pFactory));
Self.FFactory := TGrymObjectFactory.Create(pFactory);
end;
Result := Self.FFactory;
end;
function TBaseViewThread.GetFrame: TBaseViewFrame;
var
pBaseViewFrame: IBaseViewFrame;
begin
if not Assigned(Self.FFrame) then
begin
OleCheck(Self.GetInterface.Get_Frame(pBaseViewFrame));
Self.FFrame := TBaseViewFrame.Create(pBaseViewFrame);
end;
Result := Self.FFrame;
end;
end.