Builder component of Instance objects. Contains setter methods to configure the Instance parameters, such as Context (Logger, Scheduler, ModuleManager) and RootDevice. Contains a build
method that builds the Instance object.
More...
Builder component of Instance objects. Contains setter methods to configure the Instance parameters, such as Context (Logger, Scheduler, ModuleManager) and RootDevice. Contains a build
method that builds the Instance object.
The InstanceBuilder provides a fluent interface for setting various configuration options for an Instance object before its creation. It allows customization of the logger, module manager, scheduler and root device. Once configured, calling the build
method returns a fully initialized Instance object with the specified settings.
Methods:
The InstanceBuilder provides the following configuration methods:
- Logger: The custom Logger for the Instance. This logger will be used for logging messages related to the Instance and its components. If a custom logger is set, the
Logger sink
will be ignored since it is only used with the default Instance logger. If custom logger was not set, builder will generate Instance with default logger.
- Global log level: The Logger global log level for the Instance. All log messages with a severity level equal to or higher than the specified level will be processed. Default log level is LogLevel::Default
- Component log level: The Logger level for a specific component of the Instance. Log messages related to that component will be processed according to the specified log level. By default, each component uses the global log level.
- Logger sink: The logger sink to the default Instance logger. This sink will be responsible for processing log messages, such as writing them to a file or sending them to a remote server. If
Logger
has been set, configuring of the 'Logger sink' has no effect in building Instance. If logger sinks has not been configure, the Instance uses 'default sinks'.
- Module manager: The custom ModuleManager for the Instance. When configured, the default module manager path will be ignored. If module manager has not configured, the Instance uses built in manager
- Module path: The path for the default ModuleManager of the Instance. If a custom module manager has not been set, this path will be used to load modules. Default module path is empty string
- Scheduler: The custom scheduler for the Instance. If set, the number of worker threads will be ignored. If scheduler has not been configured, the Instance uses default schduler.
- Scheduler worker num: The number of worker threads in the scheduler of the Instance. if a scheduler has not been set and worker num is 0, which considers as maximum number of concurrent threads.
- Default root device local ID: The local id of the default client root device. Has no effect if
Root device
has been congigured.
- Default root device info: The information of default root device of the Instance such as serial number. Has no effect if
Root device
has been congigured.
- Root device: The connection string of a device that replaces the default openDAQ root device (virtual client). When the instance is created a connection to the device with the given connection string will be established, and the device will be placed at the root of the component tree structure. When configured, the
Default root device local ID
and Default root device info
will be ignored.
- Sink log level: The sink logger level of the default Instance logger. This level is ignored if a custom logger has been configured.
- Config provider: The config provider is expanding the local options of instance builder from json file or command lines. If value was set before, provider will override this with new one.
- Module options: Local options dictionary of instance builder has
modules
key which contains custom values for modules. By default this dictionary is empty, but can be populated from json file, env variables or command line arguments.
|
virtual ErrCode INTERFACE_FUNC | build (IInstance **instance)=0 |
| Builds and returns an Instance object using the currently set values of the Builder. More...
|
|
virtual ErrCode INTERFACE_FUNC | addConfigProvider (IConfigProvider *configProvider)=0 |
| Populates internal options dictionary with values from set config provider. More...
|
|
virtual ErrCode INTERFACE_FUNC | setContext (IContext *context)=0 |
| Sets the Context object of the instance. This overwrites other context related settings such as logger, scheduler and module manager settings. More...
|
|
virtual ErrCode INTERFACE_FUNC | getContext (IContext **context)=0 |
| Returns a context object of the instance. More...
|
|
virtual ErrCode INTERFACE_FUNC | setLogger (ILogger *logger)=0 |
| Sets the custom Logger for the Instance. This logger will be used for logging messages related to the Instance and its components. When configured, the Logger sink will be ignored, as it is in use only with the default Instance logger. More...
|
|
virtual ErrCode INTERFACE_FUNC | getLogger (ILogger **logger)=0 |
| Gets the Logger of the Instance. Returns nullptr if custom logger has not been set. More...
|
|
virtual ErrCode INTERFACE_FUNC | setGlobalLogLevel (LogLevel logLevel)=0 |
| Sets the Logger global log level for the Instance. All log messages with a severity level equal to or higher than the specified level will be processed. More...
|
|
virtual ErrCode INTERFACE_FUNC | getGlobalLogLevel (LogLevel *logLevel)=0 |
| Gets the default Logger global level of Instance. More...
|
|
virtual ErrCode INTERFACE_FUNC | setComponentLogLevel (IString *component, LogLevel logLevel)=0 |
| Sets The Logger level for a specific component of the Instance. Log messages related to that component will be processed according to the specified log level. More...
|
|
virtual ErrCode INTERFACE_FUNC | getComponentsLogLevel (IDict **components)=0 |
| Gets the dictionary of component names and log level which will be added to logger components. More...
|
|
virtual ErrCode INTERFACE_FUNC | addLoggerSink (ILoggerSink *sink)=0 |
| Adds the logger sink of the default Instance logger. If Logger has been set, configuring of the Logger sink has no effect in building Instance. More...
|
|
virtual ErrCode INTERFACE_FUNC | setSinkLogLevel (ILoggerSink *sink, LogLevel logLevel)=0 |
| Sets the sink logger level of the default Instance logger. If Logger has been set, configuring of the Logger sink has no effect in building Instance. More...
|
|
virtual ErrCode INTERFACE_FUNC | getLoggerSinks (IList **sinks)=0 |
| Gets the list of logger sinks for the default Instance logger. More...
|
|
virtual ErrCode INTERFACE_FUNC | setModulePath (IString *path)=0 |
| Sets the path for the default ModuleManager of the Instance. If Module manager has been set, configuring of Module path has no effect in building Instance. More...
|
|
virtual ErrCode INTERFACE_FUNC | getModulePath (IString **path)=0 |
| Gets the path for the default ModuleManager of Instance. More...
|
|
virtual ErrCode INTERFACE_FUNC | addModulePath (IString *path)=0 |
| Add the path for the default ModuleManager of the Instance. If Module manager has been set, configuring of Module path has no effect in building Instance. More...
|
|
virtual ErrCode INTERFACE_FUNC | getModulePathsList (IList **paths)=0 |
| Get the list of paths for the default ModuleManager of the Instance. If Module manager has been set, configuring of Module path has no effect in building Instance. More...
|
|
virtual ErrCode INTERFACE_FUNC | setModuleManager (IModuleManager *moduleManager)=0 |
| Sets The custom ModuleManager for the Instance. More...
|
|
virtual ErrCode INTERFACE_FUNC | getModuleManager (IModuleManager **moduleManager)=0 |
| Gets the custom ModuleManager of Instance. More...
|
|
virtual ErrCode INTERFACE_FUNC | setAuthenticationProvider (IAuthenticationProvider *authenticationProvider)=0 |
| Sets the AuthenticationProvider for the Instance. More...
|
|
virtual ErrCode INTERFACE_FUNC | getAuthenticationProvider (IAuthenticationProvider **authenticationProvider)=0 |
| Gets the AuthenticationProvider of Instance. More...
|
|
virtual ErrCode INTERFACE_FUNC | setSchedulerWorkerNum (SizeT numWorkers)=0 |
| Sets the number of worker threads in the scheduler of the Instance. If Scheduler has been set, configuring of Scheduler worker num has no effect in building Instance. More...
|
|
virtual ErrCode INTERFACE_FUNC | getSchedulerWorkerNum (SizeT *numWorkers)=0 |
| Gets the amount of worker threads in the scheduler of Instance. More...
|
|
virtual ErrCode INTERFACE_FUNC | setScheduler (IScheduler *scheduler)=0 |
| Sets the custom scheduler of Instance. More...
|
|
virtual ErrCode INTERFACE_FUNC | getScheduler (IScheduler **scheduler)=0 |
| Gets the custom scheduler of Instance. More...
|
|
virtual ErrCode INTERFACE_FUNC | setDefaultRootDeviceLocalId (IString *localId)=0 |
| Sets the local id for default device. Has no effect if Root device has been congigured. More...
|
|
virtual ErrCode INTERFACE_FUNC | getDefaultRootDeviceLocalId (IString **localId)=0 |
| Gets the default root device local id. More...
|
|
virtual ErrCode INTERFACE_FUNC | setRootDevice (IString *connectionString, IPropertyObject *config=nullptr)=0 |
| Sets the connection string for a device that replaces the default openDAQ root device. When the instance is created, a connection to the device with the given connection string will be established, and the device will be placed at the root of the component tree structure. More...
|
|
virtual ErrCode INTERFACE_FUNC | getRootDevice (IString **connectionString)=0 |
| Gets the connection string for the default root device of Instance. More...
|
|
virtual ErrCode INTERFACE_FUNC | getRootDeviceConfig (IPropertyObject **config)=0 |
| Gets the configuration property object for the default root device of Instance. More...
|
|
virtual ErrCode INTERFACE_FUNC | setDefaultRootDeviceInfo (IDeviceInfo *deviceInfo)=0 |
| Sets the default device info of Instance. If device info has been set, method getInfo of Instance will return set device info if Root Device has not been set. More...
|
|
virtual ErrCode INTERFACE_FUNC | getDefaultRootDeviceInfo (IDeviceInfo **deviceInfo)=0 |
| Gets the default device info of Instance. More...
|
|
virtual ErrCode INTERFACE_FUNC | getOptions (IDict **options)=0 |
| Gets the dictionary of instance options. More...
|
|
virtual ErrCode INTERFACE_FUNC | enableStandardProviders (Bool flag)=0 |
| Allows enabling or disabling standard configuration providers, including JsonConfigProvider, based on the specified flag. More...
|
|
virtual ErrCode INTERFACE_FUNC | getDiscoveryServers (IList **serverNames)=0 |
| Gets the dictionary of discovery servers. More...
|
|
virtual ErrCode INTERFACE_FUNC | addDiscoveryServer (IString *serverName)=0 |
| Adds a discovery server to the context. More...
|
|
virtual ErrCode INTERFACE_FUNC | borrowInterface (const IntfID &intfID, void **obj) const =0 |
| Returns another interface which is supported by the object without incrementing the reference count. More...
|
|
virtual ErrCode INTERFACE_FUNC | dispose ()=0 |
| Disposes all references held by the object. More...
|
|
virtual ErrCode INTERFACE_FUNC | getHashCode (SizeT *hashCode)=0 |
| Returns hash code of the object. More...
|
|
virtual ErrCode INTERFACE_FUNC | equals (IBaseObject *other, Bool *equal) const =0 |
| Compares object to another object for equality. More...
|
|
virtual ErrCode INTERFACE_FUNC | toString (CharPtr *str)=0 |
| Returns a string representation of the object. More...
|
|
virtual ErrCode INTERFACE_FUNC | queryInterface (const IntfID &intfID, void **obj)=0 |
| Returns another interface which is supported by the object and increments the reference count. More...
|
|
virtual int INTERFACE_FUNC | addRef ()=0 |
| Increments the reference count for an interface on an object. More...
|
|
virtual int INTERFACE_FUNC | releaseRef ()=0 |
| Decrements the reference count for an interface on an object. More...
|
|