32 #ifndef _QORE_FUNCTIONLIST_H
34 #define _QORE_FUNCTIONLIST_H
38 #include "qore/intern/Function.h"
43 class qore_ns_private;
47 friend class FunctionList;
51 FunctionEntry(
const FunctionEntry& old) =
delete;
58 DLLLOCAL ~FunctionEntry() {
63 DLLLOCAL FunctionEntry(QoreFunction* u, qore_ns_private* ns) : func(u), ns(ns) {
66 DLLLOCAL FunctionEntry(
const char* new_name, QoreFunction* u, qore_ns_private* ns)
67 : func(u), name(new_name), ns(ns) {
74 DLLLOCAL
bool deref() {
82 DLLLOCAL qore_ns_private* getNamespace()
const {
86 DLLLOCAL QoreFunction* getFunction()
const {
90 DLLLOCAL QoreFunction* getFunction(
bool runtime)
const {
91 if (runtime && func->committedEmpty())
96 DLLLOCAL
const char* getName()
const {
97 return name.empty() ? func->getName() : name.c_str();
100 DLLLOCAL
int parseInit() {
101 return func->parseInit(ns);
104 DLLLOCAL
void parseCommit() {
109 DLLLOCAL
int parseRollback() {
111 if (func->committedEmpty())
115 func->parseRollback();
121 DLLLOCAL
bool isPublic()
const {
122 return func->hasPublic();
125 DLLLOCAL
bool isUserPublic()
const {
126 return func->hasUserPublic();
129 DLLLOCAL
bool hasBuiltin()
const {
130 return func->hasBuiltin();
133 DLLLOCAL
void updateNs(qore_ns_private* ns) {
138 class ModuleImportedFunctionEntry :
public FunctionEntry {
140 DLLLOCAL ModuleImportedFunctionEntry(
const FunctionEntry& old, qore_ns_private* ns);
143 #ifdef HAVE_QORE_HASH_MAP
145 #include <qore/hash_map_include.h>
146 #include "qore/intern/xxhash.h"
148 typedef HASH_MAP<const char*, FunctionEntry*, qore_hash_str, eqstr> fl_map_t;
150 typedef std::map<const char*, FunctionEntry*> fl_map_t;
153 class FunctionList :
public fl_map_t {
155 DLLLOCAL FunctionList() {
158 DLLLOCAL FunctionList(
const FunctionList& old, qore_ns_private* ns,
int64 po);
160 DLLLOCAL ~FunctionList() {
164 DLLLOCAL FunctionEntry* add(QoreFunction* func, qore_ns_private* ns);
165 DLLLOCAL FunctionEntry*
import(QoreFunction* func, qore_ns_private* ns);
166 DLLLOCAL FunctionEntry*
import(
const char* new_name, QoreFunction* func, qore_ns_private* ns,
bool inject);
167 DLLLOCAL QoreFunction* find(
const char* name,
bool runtime)
const;
168 DLLLOCAL FunctionEntry* findNode(
const char* name,
bool runtime =
false)
const;
170 DLLLOCAL
void mergeUserPublic(
const FunctionList& src, qore_ns_private* ns) {
171 for (fl_map_t::const_iterator i = src.begin(), e = src.end(); i != e; ++i) {
172 if (!i->second->isUserPublic()) {
177 assert(!findNode(i->first));
178 FunctionEntry* fe =
new ModuleImportedFunctionEntry(*i->second, ns);
180 assert(!fe->isUserPublic());
181 insert(fl_map_t::value_type(fe->getName(), fe));
186 DLLLOCAL
int importSystemFunctions(
const FunctionList& src, qore_ns_private* ns,
ExceptionSink* xsink);
189 DLLLOCAL
int parseInit();
190 DLLLOCAL
void parseRollback();
191 DLLLOCAL
void parseCommit();
193 DLLLOCAL
void assimilate(FunctionList& fl, qore_ns_private* ns);
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:48
This is the list container type in Qore, dynamically allocated only, reference counted.
Definition: QoreListNode.h:52
provides atomic reference counting to Qore objects
Definition: QoreReferenceCounter.h:44
DLLEXPORT void ROreference() const
atomically increments the reference count
DLLEXPORT bool ROdereference() const
atomically decrements the reference count
base class for resolved call references
Definition: CallReferenceNode.h:109
long long int64
64bit integer type, cannot use int64_t here since it breaks the API on some 64-bit systems due to equ...
Definition: common.h:260