33 lines
828 B
C++
33 lines
828 B
C++
#pragma once
|
|
#include <Mod/Registration.hpp>
|
|
#include <functional>
|
|
#include <memory>
|
|
#include <string>
|
|
#include <string_view>
|
|
#include <vector>
|
|
|
|
namespace vl::mod {
|
|
|
|
class Registry {
|
|
public:
|
|
struct Entry {
|
|
std::string typeName;
|
|
std::string name; // from T::Name()
|
|
std::string version; // from T::Version()
|
|
std::function<std::unique_ptr<Base>(const Context&)> factory;
|
|
};
|
|
|
|
// Read registration entries from a loaded module (ELF .so handle)
|
|
// Returns number of entries found.
|
|
static std::size_t addFromModule(void* soHandle);
|
|
|
|
// Enumerate all known entries from all modules loaded so far
|
|
static const std::vector<Entry>& all();
|
|
static std::vector<Entry>& mutableAll();
|
|
|
|
private:
|
|
static std::vector<Entry>& storage_();
|
|
};
|
|
|
|
} // namespace vl::log
|