API Documentation
Loading...
Searching...
No Matches
ModuleManager.h
Go to the documentation of this file.
1#pragma once
2#include "DLLInfo.h"
3#if defined(_WIN32)
4// On Windows, NDEVR commands use the stdcall convention
5#define NDEVRAPI_ATTR
6#define NDEVRAPI_CALL __stdcall
7#define NDEVRAPI_PTR NDEVRAPI_CALL
8#elif !QT_BUILD && defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH < 7
9#error "NDEVR isn't supported for the 'armeabi' NDK ABI"
10#elif !QT_BUILD && defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7 && defined(__ARM_32BIT_STATE)
11// On Android 32-bit ARM targets, NDEVR functions use the "hardfloat"
12// calling convention, i.e. float parameters are passed in registers. This
13// is true even if the rest of the application passes floats on the stack,
14// as it does by default when compiling for the armeabi-v7a NDK ABI.
15#define NDEVRAPI_ATTR __attribute__((pcs("aapcs-vfp")))
16#define NDEVRAPI_CALL
17#define NDEVRAPI_PTR VKAPI_ATTR
18#else
19// On other platforms, use the default calling convention
20#define NDEVRAPI_ATTR
21#define NDEVRAPI_CALL
22#define NDEVRAPI_PTR
23#endif
24#include <NDEVR/SoftwareService.h>
25#include <NDEVR/String.h>
26#include <NDEVR/Dictionary.h>
27#include <NDEVR/File.h>
28#include <NDEVR/TranslatedString.h>
29typedef void (NDEVRAPI_PTR* PFN_NDEVRVoidFunction)(void);
30namespace NDEVR
31{
32 struct Module;
33 class QTModelManager;
34 class QTWindowManager;
35 class Exception;
36 class ModuleResourceManager;
37}
43typedef PFN_NDEVRVoidFunction(NDEVRAPI_PTR* PFN_SetupFactoriesForNDEVR)();//SetupFileStructureForNDEVR
44typedef PFN_NDEVRVoidFunction(NDEVRAPI_PTR* PFN_SetUpdateCheckerForNDEVR)();//SetupFileStructureForNDEVR
48typedef void(*PFN_SetupUIForNDEVR)(NDEVR::QTModelManager* model_manager, NDEVR::QTWindowManager* window_manager);
51
52namespace NDEVR
53{
54 /**--------------------------------------------------------------------------------------------------
55 \brief Base class for extensions, typically added as external DLL's that can modify or enhance the
56 behavior of the software.
57 **/
59 {
61 {
62 e_application
63 , e_utility
64 , e_library_dependency
66 };
77 bool allow_user_toggle_active = false;
78 bool is_active = true;
79 ModuleType type = ModuleType::e_undefined;
81 Module(const String& name);
82 Module(const String& name, const File& library);
83 bool isValid() const;
84 void initialize();
85 void callModuleFunction(const String& function) const;
86 void callModuleFunction(const String& function, QTModelManager* model_manager, QTWindowManager* window_manager) const;
88 protected:
89 void* module_ptr = nullptr;
90 };
91
92 /**--------------------------------------------------------------------------------------------------
93 \brief Logic for the program-wide storage and execution of Modules. Called in software setup
94 to allow modules to perform actions to modify or enhance the software.
95 **/
97 {
98 public:
100 static void SetMainProgramModuleName(const String& name);
101 static void FindModules(const File& module_folder);
102 static void FindModules(const Buffer<String>& module_list, const File& module_folder);
103 static void FindModules(const File& module_list, const File& module_folder);
104 static void AddModule(const File& module_file);
105 static void CallModuleFunction(const String& function);
106 static void CallModuleFunction(const String& function, QTModelManager* model_manager, QTWindowManager* window_manager);
107 static void DefineModuleResources(const String& module_name, ModuleResourceManager* resources);
108 static void AddModule(const Module& module);
109 static void SaveModuleSettings();
111 static void OnExit();
112 static bool HasActiveModule(const String& module_name);
113 static bool IsModuleActive(const String& module_name);
114 static void ReadModuleSettings();
115 static void SetErrorCallback(const std::function<void(const Exception& e)>& callback);
116 static void* LoadDynamicLibrary(const String& library);
117 static void* LoadFromDynamicLibrary(void* library, const String& function);
118 static void* LoadFromDynamicLibrary(const String& library, const String& function);
124 };
126}
#define NDEVR_BASE_API
Definition DLLInfo.h:57
#define NDEVRAPI_PTR
Definition ModuleManager.h:7
PFN_NDEVRVoidFunction(__stdcall * PFN_SetupFactoriesForNDEVR)()
Definition ModuleManager.h:43
PFN_NDEVRVoidFunction(__stdcall * PFN_FactoryResetNDEVR)()
Definition ModuleManager.h:47
PFN_NDEVRVoidFunction(__stdcall * PFN_SetupUIThemesForNDEVR)()
Definition ModuleManager.h:46
PFN_NDEVRVoidFunction(__stdcall * PFN_SetupMetatypesForNDEVR)()
Definition ModuleManager.h:40
void(__stdcall * PFN_NDEVRVoidFunction)(void)
Definition ModuleManager.h:29
PFN_NDEVRVoidFunction(__stdcall * PFN_SetupRegistrationForNDEVR)()
Definition ModuleManager.h:39
PFN_NDEVRVoidFunction(__stdcall * PFN_SetUpdateCheckerForNDEVR)()
Definition ModuleManager.h:44
PFN_NDEVRVoidFunction(__stdcall * PFN_InitializeForNDEVR)(NDEVR::Module &module)
Definition ModuleManager.h:38
PFN_NDEVRVoidFunction(__stdcall * PFN_SetupManualsForNDEVR)()
Definition ModuleManager.h:45
void(* PFN_SetupUIForNDEVR)(NDEVR::QTModelManager *model_manager, NDEVR::QTWindowManager *window_manager)
Definition ModuleManager.h:48
PFN_NDEVRVoidFunction(__stdcall * PFN_RegisterUserSettingsForNDEVR)()
Definition ModuleManager.h:41
PFN_NDEVRVoidFunction(__stdcall * PFN_OnNDEVRExit)()
Definition ModuleManager.h:50
PFN_NDEVRVoidFunction(__stdcall * PFN_DefineModuleResourcesForNDEVR)(NDEVR::ModuleResourceManager *resources)
Definition ModuleManager.h:49
PFN_NDEVRVoidFunction(__stdcall * PFN_SetupFileStructureForNDEVR)()
Definition ModuleManager.h:42
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:56
A hash-based key-value store, useful for quick associative lookups. Key features include:
Definition Dictionary.h:61
Provides consistent interface to handle errors through the throw expression. All exceptions generated...
Definition Exception.hpp:47
Logic for reading or writing to a file as well as navigating filesystems.
Definition File.h:48
Logic for the program-wide storage and execution of Modules. Called in software setup to allow module...
Definition ModuleManager.h:97
static File MainModuleFolder()
static void SetupModuleRegistration()
static void CallModuleFunction(const String &function, QTModelManager *model_manager, QTWindowManager *window_manager)
static void CallModuleFunction(const String &function)
static void AddModule(const Module &module)
static void SetErrorCallback(const std::function< void(const Exception &e)> &callback)
static void * LoadFromDynamicLibrary(void *library, const String &function)
static void SetMainProgramModuleName(const String &name)
static Dictionary< String, Dictionary< String, void * > > functions
Definition ModuleManager.h:122
static bool IsModuleActive(const String &module_name)
static void * LoadDynamicLibrary(const String &library)
static void FindModules(const File &module_list, const File &module_folder)
static void FindModules(const File &module_folder)
static void FindModules(const Buffer< String > &module_list, const File &module_folder)
static Dictionary< String, bool > module_active_list
Definition ModuleManager.h:121
static void OnExit()
static Buffer< String > ordered_modules
Definition ModuleManager.h:119
static void AddModule(const File &module_file)
static bool HasActiveModule(const String &module_name)
static void DefineModuleResources(const String &module_name, ModuleResourceManager *resources)
static void ReadModuleSettings()
static String main_program_module_name
Definition ModuleManager.h:123
static void SaveModuleSettings()
static Dictionary< String, Module > modules
Definition ModuleManager.h:120
static void * LoadFromDynamicLibrary(const String &library, const String &function)
Stores all dependencies for a combination of modules that make up a complete software package.
Definition ModuleResourceManager.h:239
A wrapper around DesignObjectLookup that provides signal and slot functionality and adds rendering ca...
Definition QTModelManager.h:105
Software Services provide an interface for adding to or changing the software behavior via functional...
Definition SoftwareService.h:9
Software Service Managers take a Software service to modify the behavior of the software.
Definition SoftwareService.h:15
The core String class for the NDEVR API.
Definition String.h:69
Logic for reading or writing to a string or a user friendly, TranslatedString.
Definition StringStream.h:230
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
Definition TranslatedString.h:13
Definition ACIColor.h:37
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:96
Base class for extensions, typically added as external DLL's that can modify or enhance the behavior ...
Definition ModuleManager.h:59
TranslatedString display_name
Definition ModuleManager.h:71
String activation_id
Definition ModuleManager.h:76
String icon
Definition ModuleManager.h:72
void initialize()
Module(const String &name)
bool isValid() const
TranslatedString description
Definition ModuleManager.h:73
void callModuleFunction(const String &function) const
String version
Definition ModuleManager.h:69
Dictionary< String, void * > loaded_functions
Definition ModuleManager.h:67
File library
Definition ModuleManager.h:70
String name
Definition ModuleManager.h:68
void callModuleFunction(const String &function, QTModelManager *model_manager, QTWindowManager *window_manager) const
String license_agreement
Definition ModuleManager.h:74
void defineModuleResources(ModuleResourceManager *resources) const
String website
Definition ModuleManager.h:75
Module(const String &name, const File &library)
ModuleType
Definition ModuleManager.h:61