Medical Imaging Interaction Toolkit  2023.12.99-ed252ae7
Medical Imaging Interaction Toolkit
us::ModuleSettings Class Reference

#include <usModuleSettings.h>

Public Types

typedef std::vector< std::string > PathList
 

Static Public Member Functions

static std::string CURRENT_MODULE_PATH ()
 
static bool IsThreadingSupportEnabled ()
 
static bool IsAutoLoadingEnabled ()
 
static void SetAutoLoadingEnabled (bool enable)
 
static PathList GetAutoLoadPaths ()
 
static void SetAutoLoadPaths (const PathList &paths)
 
static void AddAutoLoadPath (const std::string &path)
 
static void SetStoragePath (const std::string &path)
 
static std::string GetStoragePath ()
 
static void SetLogLevel (MsgType level)
 
static MsgType GetLogLevel ()
 

Detailed Description

Query and set certain properties of the CppMicroServices library.

The following environment variables influence the runtime behavior of the CppMicroServices library:

  • US_DISABLE_AUTOLOADING If set, auto-loading of modules is disabled.
  • US_AUTOLOAD_PATHS A ':' (Unix) or ';' (Windows) separated list of paths from which modules should be auto-loaded.
Remarks
This class is thread safe.

Definition at line 47 of file usModuleSettings.h.

Member Typedef Documentation

◆ PathList

typedef std::vector<std::string> us::ModuleSettings::PathList

Definition at line 51 of file usModuleSettings.h.

Member Function Documentation

◆ AddAutoLoadPath()

static void us::ModuleSettings::AddAutoLoadPath ( const std::string &  path)
static

Add a path in the file-system to the list of paths from which modules will be auto-loaded.

Parameters
pathThe additional absolute auto-load path in the file-system.

◆ CURRENT_MODULE_PATH()

static std::string us::ModuleSettings::CURRENT_MODULE_PATH ( )
static

Returns a special string which can be used as an argument for a AddAutoLoadPath() call.

When a module is loaded and this string has been added as a path to the list of auto-load paths the CppMicroServices library will auto-load all modules from the currently being loaded module's auto-load directory.

Returns
A string to be used in AddAutoLoadPath().
Remarks
The returned string is contained in the default set of auto-load paths, unless a new set of paths is given by a call to SetAutoLoadPaths().
See also
MicroServices_AutoLoading
US_INITIALIZE_MODULE

◆ GetAutoLoadPaths()

static PathList us::ModuleSettings::GetAutoLoadPaths ( )
static
Returns
A list of paths in the file-system from which modules will be auto-loaded.

◆ GetLogLevel()

static MsgType us::ModuleSettings::GetLogLevel ( )
static

Get the current logging level.

Returns
The currently used logging level.

◆ GetStoragePath()

static std::string us::ModuleSettings::GetStoragePath ( )
static

Get the absolute path for persistent data. The returned path might be empty. If the path is non-empty, it is safe to assume that the path exists and is writable.

Returns
The absolute path to the persistent storage path.

◆ IsAutoLoadingEnabled()

static bool us::ModuleSettings::IsAutoLoadingEnabled ( )
static
Returns
true if support for module auto-loading is enabled, false otherwise.
Remarks
This method will always return false if support for auto-loading has not been configured into the CppMicroServices library or if it has been disabled by defining the US_DISABLE_AUTOLOADING environment variable.

◆ IsThreadingSupportEnabled()

static bool us::ModuleSettings::IsThreadingSupportEnabled ( )
static
Returns
true if threading support has been configured into the CppMicroServices library, false otherwise.

◆ SetAutoLoadingEnabled()

static void us::ModuleSettings::SetAutoLoadingEnabled ( bool  enable)
static

Enable or disable auto-loading support.

Parameters
enableIf true, enable auto-loading support, disable it otherwise.
Remarks
Calling this method will have no effect if support for auto-loading has not been configured into the CppMicroServices library of it it has been disabled by defining the US_DISABLE_AUTOLOADING envrionment variable.

◆ SetAutoLoadPaths()

static void us::ModuleSettings::SetAutoLoadPaths ( const PathList paths)
static

Set a list of paths in the file-system from which modules should be auto-loaded.

Parameters
pathsA list of absolute file-system paths.

◆ SetLogLevel()

static void us::ModuleSettings::SetLogLevel ( MsgType  level)
static

Set the logging level for log messages from CppMicroServices modules.

Higher logging levels will discard messages with lower priority. E.g. a logging level of WarningMsg will discard all messages of type DebugMsg and InfoMsg.

Parameters
levelThe new logging level.

◆ SetStoragePath()

static void us::ModuleSettings::SetStoragePath ( const std::string &  path)
static

Set a local storage path for persistend module data.

This path is used as a base directory for providing modules with a storage path for writing persistent data. The callee must ensure that the provided path exists and is writable.

See also
ModuleContext::GetDataFile(const std::string&)
Parameters
pathAn absolute path for writing persistent data.

The documentation for this class was generated from the following file: