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...
Inherits ObjectPtr< IInstanceBuilder >.
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.
|
daq::InstancePtr | build () const |
| Builds and returns an Instance object using the currently set values of the Builder. More...
|
|
InstanceBuilderPtr | addConfigProvider (const daq::ConfigProviderPtr &configProvider) const |
| Populates internal options dictionary with values from set config provider. More...
|
|
InstanceBuilderPtr | setContext (const daq::ContextPtr &context) const |
| Sets the Context object of the instance. This overwrites other context related settings such as logger, scheduler and module manager settings. More...
|
|
daq::ContextPtr | getContext () const |
| Returns a context object of the instance. More...
|
|
InstanceBuilderPtr | setLogger (const daq::LoggerPtr &logger) const |
| 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...
|
|
daq::LoggerPtr | getLogger () const |
| Gets the Logger of the Instance. Returns nullptr if custom logger has not been set. More...
|
|
InstanceBuilderPtr | setGlobalLogLevel (daq::LogLevel logLevel) const |
| 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...
|
|
daq::LogLevel | getGlobalLogLevel () const |
| Gets the default Logger global level of Instance. More...
|
|
InstanceBuilderPtr | setComponentLogLevel (const daq::StringPtr &component, daq::LogLevel logLevel) const |
| 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...
|
|
daq::DictPtr< daq::IString, daq::INumber > | getComponentsLogLevel () const |
| Gets the dictionary of component names and log level which will be added to logger components. More...
|
|
InstanceBuilderPtr | addLoggerSink (const daq::LoggerSinkPtr &sink) const |
| 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...
|
|
InstanceBuilderPtr | setSinkLogLevel (const daq::LoggerSinkPtr &sink, daq::LogLevel logLevel) const |
| 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...
|
|
daq::ListPtr< daq::ILoggerSink > | getLoggerSinks () const |
| Gets the list of logger sinks for the default Instance logger. More...
|
|
InstanceBuilderPtr | setModulePath (const daq::StringPtr &path) const |
| 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...
|
|
daq::StringPtr | getModulePath () const |
| Gets the path for the default ModuleManager of Instance. More...
|
|
InstanceBuilderPtr | addModulePath (const daq::StringPtr &path) const |
| 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...
|
|
daq::ListPtr< daq::IString > | getModulePathsList () const |
| 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...
|
|
InstanceBuilderPtr | setModuleManager (const daq::ModuleManagerPtr &moduleManager) const |
| Sets The custom ModuleManager for the Instance. More...
|
|
daq::ModuleManagerPtr | getModuleManager () const |
| Gets the custom ModuleManager of Instance. More...
|
|
InstanceBuilderPtr | setAuthenticationProvider (const daq::AuthenticationProviderPtr &authenticationProvider) const |
| Sets the AuthenticationProvider for the Instance. More...
|
|
daq::AuthenticationProviderPtr | getAuthenticationProvider () const |
| Gets the AuthenticationProvider of Instance. More...
|
|
InstanceBuilderPtr | setSchedulerWorkerNum (daq::SizeT numWorkers) const |
| 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...
|
|
daq::SizeT | getSchedulerWorkerNum () const |
| Gets the amount of worker threads in the scheduler of Instance. More...
|
|
InstanceBuilderPtr | setScheduler (const daq::SchedulerPtr &scheduler) const |
| Sets the custom scheduler of Instance. More...
|
|
daq::SchedulerPtr | getScheduler () const |
| Gets the custom scheduler of Instance. More...
|
|
InstanceBuilderPtr | setDefaultRootDeviceLocalId (const daq::StringPtr &localId) const |
| Sets the local id for default device. Has no effect if Root device has been congigured. More...
|
|
daq::StringPtr | getDefaultRootDeviceLocalId () const |
| Gets the default root device local id. More...
|
|
InstanceBuilderPtr | setRootDevice (const daq::StringPtr &connectionString, const daq::PropertyObjectPtr &config=nullptr) const |
| 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...
|
|
daq::StringPtr | getRootDevice () const |
| Gets the connection string for the default root device of Instance. More...
|
|
daq::PropertyObjectPtr | getRootDeviceConfig () const |
| Gets the configuration property object for the default root device of Instance. More...
|
|
InstanceBuilderPtr | setDefaultRootDeviceInfo (const daq::DeviceInfoPtr &deviceInfo) const |
| 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...
|
|
daq::DeviceInfoPtr | getDefaultRootDeviceInfo () const |
| Gets the default device info of Instance. More...
|
|
daq::DictPtr< daq::IString, daq::IBaseObject > | getOptions () const |
| Gets the dictionary of instance options. More...
|
|
InstanceBuilderPtr | enableStandardProviders (daq::Bool flag) const |
| Allows enabling or disabling standard configuration providers, including JsonConfigProvider, based on the specified flag. More...
|
|
daq::ListPtr< daq::IString > | getDiscoveryServers () const |
| Gets the dictionary of discovery servers. More...
|
|
InstanceBuilderPtr | addDiscoveryServer (const daq::StringPtr &serverName) const |
| Adds a discovery server to the context. More...
|
|