ImFusion SDK 4.3
InitConfig Struct Reference

#include <ImFusion/Base/Framework.h>

Record to configure the initialization of the ImFusion SDK. More...

Detailed Description

Record to configure the initialization of the ImFusion SDK.

It provides a central place where you can configure all SDK initialization options and also shows the default settings if you simply call Framework::init().

Logging-related settings

bool initLogging = true
 Flag whether to initialize logging.
 
Log::Level minimumLogLevel = Log::Level::Info
 Minimum log level/severity to set during Log::init()
 
Log::Mode loggingMode = Log::Mode::Synchronous
 Operation mode of the logging framework.
 
bool addConsoleSink = true
 Flag whether to add a console logger (Log::ConsoleSink)
 
Flags< Log::ConsoleSink::OptionsconsoleSinkOptions
 
bool addFileSink = false
 Flag whether to add a file logger (Log::FileSink)
 
std::string fileSinkFilename = ""
 Filename to use for the file logger (must not be empty if enabled)
 
Flags< Log::FileSink::OptionsfileSinkOptions = Log::FileSink::None
 < Configuration options of created FileSink if enabled
 
ByteSize fileSinkMaxFileSize = ByteSize(0)
 Maximum log file size for log rotation, 0 to disable.
 

OpenGL-related settings

bool initOpenGL = true
 Flag whether to initialize OpenGL (GlContextManager)
 
std::unique_ptr< GL::ContextglContext
 Optional OpenGL context to use as main context for the framework.
 

Plugin loading-related settings

bool loadPlugins = false
 Flag whether to search for plugins using Framework::loadPlugins().
 
std::vector< std::stringpluginSearchFolders
 Search paths that are passed to Framework::loadPlugins() if loadPlugins is true.
 

Other settings

std::function< void()> licenseInitFunction = defaultLicenseInitFunction()
 Function will be called once during framework initialization just before checking the license state.
 
std::function< void(const std::string &errMsg, int gracePeriodSec)> licenseExpirationHandler
 Optional function to handle the case when a license expiration happens during runtime.
 
std::optional< bool > installCrashHandler = std::nullopt
 Flag whether to install platform-specific crash handlers (cf.
 
bool installSignalHandler = true
 Flag whether to install platform-specific signal handlers (cf. Framework::installSignalHandlers()).
 
bool initSettings = true
 Flag whether to initialize GlobalSettings.
 
std::string organizationName = "ImFusion"
 Name of the organization to use for settings storage and other contexts.
 
std::string applicationName = "ImFusionLib"
 Name of the application to use for settings storage and other contexts.
 

Member Data Documentation

◆ consoleSinkOptions

Flags<Log::ConsoleSink::Options> consoleSinkOptions
Initial value:
= {
}
@ UseColor
Use colored console output.
Definition ConsoleSink.h:24
@ Utf8ConsoleCodepage
Set console code page to UTF-8 (Windows only, ignored on Linux) https://docs.microsoft....
Definition ConsoleSink.h:25

◆ glContext

Optional OpenGL context to use as main context for the framework.

Use this for instance to enable context sharing with a context of your host application.

◆ licenseInitFunction

std::function<void()> licenseInitFunction = defaultLicenseInitFunction()

Function will be called once during framework initialization just before checking the license state.

Enables you to implement a custom license-initialization function. The default tries to use the environment variable IMFUSION_LICENSE_KEY if no license is active (cf. Framework::defaultLicenseInitFunction()).

◆ licenseExpirationHandler

std::function<void(const std::string& errMsg, int gracePeriodSec)> licenseExpirationHandler

Optional function to handle the case when a license expiration happens during runtime.

Please use this to terminate your application gracefully within a given grace period (handler parameter in seconds). After the grace period expires ImFusion::Framework will be forcefully de-initialized, which could tier down your application un-gracefully.

Note
This handler function will be called from a separate thread.

Example code for a Qt application:

initConfig.licenseExpirationHandler = [](const std::string& errMsg, int gracePeriodSec) {
QMetaObject::invokeMethod(
qApp,
[errMsg, gracePeriodSec]() {
ss << "License issue! Quitting application gracefully before ImFusion::Framework will be de-initialized in " << gracePeriodSec << " seconds. Details: " << errMsg;
LOG_ERROR(ss.str());
qApp->quit();
},
Qt::QueuedConnection); // put it in the event queue of the main thread because Qt windowing is not thread-safe
};
Framework::init(std::move(initConfig));
#define LOG_ERROR(...)
Emits a log message of Log::Level::Error, optionally with a category.
Definition Log.h:257
void init(InitConfig &&initializationSettings={})
Performs general initialization of the framework.
T str(T... args)
Record to configure the initialization of the ImFusion SDK.
Definition Framework.h:35
std::function< void(const std::string &errMsg, int gracePeriodSec)> licenseExpirationHandler
Optional function to handle the case when a license expiration happens during runtime.
Definition Framework.h:77

◆ installCrashHandler

std::optional<bool> installCrashHandler = std::nullopt

Flag whether to install platform-specific crash handlers (cf.

Platform::installCrashHandler()). If it contains std::nullopt, it will fall back toinstallSignalHandlers. This is done to maintain backwards compatibility.


The documentation for this struct was generated from the following file:
Search Tab / S to search, Esc to close