Kaspersky Neuromorphic Platform  1.0.0
API Reference
Loading...
Searching...
No Matches
backend_loader.h
Go to the documentation of this file.
1
22#pragma once
23
24#include <knp/core/backend.h>
25#include <knp/core/impexp.h>
26
27#include <filesystem>
28#include <memory>
29#include <string>
30#include <unordered_map>
31
32
37{
38
42class KNP_DECLSPEC BackendLoader
43{
44public:
50 std::shared_ptr<core::Backend> load(const std::filesystem::path &backend_path);
56 static bool is_backend(const std::filesystem::path &backend_path);
57
58public:
63 typedef std::shared_ptr<core::Backend>(BackendCreateFunction)();
64
65protected:
71 std::function<BackendCreateFunction> make_creator(const std::filesystem::path &backend_path);
72
73private:
74 // std::filesystem::path doesn't work on any compilers.
75 std::unordered_map<std::string, std::function<BackendCreateFunction>> creators_;
76};
77
78} // namespace knp::framework
The BackendLoader class is a definition of a backend loader.
std::function< BackendCreateFunction > make_creator(const std::filesystem::path &backend_path)
Create a backend loader that will load and create a backend instance.
static bool is_backend(const std::filesystem::path &backend_path)
Check if the specified path points to a backend.
std::shared_ptr< core::Backend > load(const std::filesystem::path &backend_path)
Load backend.
Class definition for backend base.
Framework namespace.