blob: 3529fb3eceb2fc9c0ad961af7d1b811a54dad9ea (
plain) (
blame)
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
|
#include "syms.h"
#include <util/generic/vector.h>
#include <util/generic/string.h>
#include <util/generic/singleton.h>
using namespace NPrivate;
namespace {
struct TSym {
const char* Mod;
const char* Name;
void* Sym;
};
struct TSymbols: public TVector<TSym> {
static inline TSymbols* Instance() {
return Singleton<TSymbols>();
}
};
}
void NPrivate::RegisterSymbol(const char* mod, const char* name, void* sym) {
TSymbols::Instance()->push_back(TSym{mod, name, sym});
}
void NPrivate::ForEachSymbol(ICB& cb) {
for (auto& x : *TSymbols::Instance()) {
cb.Apply(x.Mod, x.Name, x.Sym);
}
}
|