/
flu.h
131 lines (104 loc) · 2.86 KB
/
flu.h
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
/*
* PROGRAM: JRD Access Method
* MODULE: flu.h
* DESCRIPTION: Function lookup definitions
*
* The contents of this file are subject to the Interbase Public
* License Version 1.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy
* of the License at http://www.Inprise.com/IPL.html
*
* Software distributed under the License is distributed on an
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
* or implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code was created by Inprise Corporation
* and its predecessors. Portions created by Inprise Corporation are
* Copyright (C) Inprise Corporation.
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
*
* 2002.10.28 Sean Leyne - Completed removal of obsolete "HP700" port
*
*/
#ifndef JRD_FLU_H
#define JRD_FLU_H
// External modules for UDFs/BLOB filters/y-valve loader
#include "../common/classes/objects_array.h"
#include "../common/os/mod_loader.h"
#include "../common/classes/RefCounted.h"
namespace Jrd
{
class Module
{
private:
class InternalModule : public Firebird::RefCounted
{
private:
InternalModule(const InternalModule &im);
void operator=(const InternalModule &im);
public:
ModuleLoader::Module* handle;
Firebird::PathName originalName, loadName;
void* findSymbol(const Firebird::string& name)
{
if (! handle)
{
return 0;
}
return handle->findSymbol(name);
}
InternalModule(MemoryPool& p,
ModuleLoader::Module* h,
const Firebird::PathName& on,
const Firebird::PathName& ln)
: handle(h),
originalName(p, on),
loadName(p, ln)
{ }
~InternalModule();
bool operator==(const Firebird::PathName &pn) const
{
return originalName == pn || loadName == pn;
}
};
Firebird::RefPtr<InternalModule> interMod;
explicit Module(InternalModule* h)
: interMod(h)
{ }
static Module lookupModule(const char*);
static InternalModule* scanModule(const Firebird::PathName& name);
public:
typedef Firebird::Array<InternalModule*> LoadedModules;
Module() : interMod(0) { }
explicit Module(MemoryPool&)
: interMod(NULL)
{ }
Module(MemoryPool&, const Module& m)
: interMod(m.interMod)
{ }
Module(const Module& m)
: interMod(m.interMod)
{ }
~Module();
// used for UDF/BLOB Filter
static FPTR_INT lookup(const char*, const char*, Firebird::SortedObjectsArray<Module>&);
bool operator>(const Module &im) const;
void *lookupSymbol(const Firebird::string& name)
{
if (! interMod)
{
return 0;
}
return interMod->findSymbol(name);
}
operator bool() const
{
return interMod;
}
};
typedef Firebird::SortedObjectsArray<Module> DatabaseModules;
} // namespace Jrd
#endif // JRD_FLU_H