15#ifndef SIMO_COLLECTION_HH
16#define SIMO_COLLECTION_HH
23#include "Simo/module/Module.h"
25#define SIMO_COLLECTION_FUNCTION_NAME_SYMBOL "SIMO_COLLECTION_FUNCTION"
27#define SIMO_COLLECTION_FUNCTION_NAME_DEFAULT "simo_get_collection"
33namespace SIMO_PUBLIC Collections {
35 [[nodiscard]] std::string_view get_name()
const noexcept;
37 [[nodiscard]]
Module* get_module_unsafe()
const;
39 [[nodiscard]]
Parameters* get_parameters_unsafe()
const;
41 [[nodiscard]] std::unique_ptr<Module> get_module()
const;
43 [[nodiscard]] std::unique_ptr<Parameters> get_parameters()
const;
46 Module* (*get_module_function)();
62 unsigned factory_list_size;
64 void check()
const noexcept;
66 [[nodiscard]]
const Factory* get_factory(
67 const std::string_view& factory_name)
const noexcept;
69 [[nodiscard]] std::vector<std::pair<std::string_view, const Factory*>>
70 get_factory_pairs()
const noexcept;
76class SIMO_PUBLIC CollectionWithLib {
78 CollectionWithLib(
const std::filesystem::path& path,
80 void* lib_handle)
noexcept;
82 CollectionWithLib(
const CollectionWithLib&) =
delete;
83 CollectionWithLib& operator=(
const CollectionWithLib&) =
delete;
85 CollectionWithLib(CollectionWithLib&& other)
noexcept;
87 CollectionWithLib& operator=(CollectionWithLib&& other)
noexcept;
91 [[nodiscard]]
const SimoCollection* get_collection()
const noexcept;
94 std::filesystem::path path;
96 void* lib_handle =
nullptr;
99enum struct SIMO_PUBLIC GET_COLLECTION_ERROR : std::uint8_t {
103 ALREADY_LOADED_LIBRARY
107 GET_COLLECTION_ERROR error_code;
108 std::string error_message;
112[[nodiscard]] std::expected<CollectionWithLib, GetCollectionError> SIMO_PUBLIC
113simo_get_collection(
const std::filesystem::path& path_to_collection);
117 simo_get_collection_from_folder(
const std::filesystem::path& folder_path);
Collects parameters that are then passed to a Module instance.
Definition Module.h:30
Definition Collection.h:34
Definition Collection.h:106
Definition Collection.h:50
Definition Collection.h:58