Miscellaneous C++ Utilities
The following C++ utilities are provided by the Core Component:
“ifw-core/utils/bat”: A class and tools to manage CII Configuration Service, instance and schema files and providing a basic schema for the common configuration for IFW applications.
“ifw-core/utils/base”: Constant definitions of common nature.
“ifw-core/utils/string”: Small tools to facilitate string manipulation.
“ifw-core/utils/conversion”: Tools to convert between various type representations.
“ifw-core/utils/system”: Contains small ‘system level’ tools, for example to for obtaining time stamps, obtaining information about the OS platform, generating unique IDs, generating random numbers, fail safe mutex semaphore, and more.
“ifw-core/utils/time”: Contains utilities to handle time related aspects, like generating ISO 8601 timestamps.
“ifw-core/utils/param”: Tools to handle parameters.
“ifw-core/utils/file”: Provides small tools for handling files, for instance a function to locate files in the ELT ICS directory structure. Also provides a parameter set class to handle parameter files, and a specialization for YAML.
Basic Application Tools - BAT
The “bat” library provides some base definitions for C++ applications within the IFW.
Warning
BAT is obsolete/deprecated and will be removed in a future version og IFW. The services of BAT have been moved to RAD.
Base Configuration File
The bat module defines base configuration parameters for an IFW server application. This is a configuration file (“config/utils/bat/definitions.yaml”) that can be included in other applications.
!cfg.typedef Timeout(uint32):
default: 5000 #timeout in milliseconds
min: 1
!cfg.typedef IfwServer:
!cfg.required server_id : !cfg.type:string
!cfg.required req_endpoint : !cfg.type:string
!cfg.required pub_endpoint : !cfg.type:string
!cfg.optional db_timeout : !cfg.type:Timeout
!cfg.required scxml : !cfg.type:string # State machine XML file used by the server
!cfg.required log_properties : !cfg.type:string
!cfg.optional req_timeout : !cfg.type:Timeout # Timeout for req/rep.
!cfg.optional mon_timeout : !cfg.type:Timeout # Timeout for monitoring blocking calls
!cfg.optional dictionaries : !cfg.type:vector_string # List of dictionaries
!cfg.optional oldb_prefix : !cfg.type:string # OLDB prefix
!cfg.optional fits_prefix : !cfg.type:string # FITS prefix for metadata header
Base Configuration Class
Namespace: “ifw::core::utils::bat”.
Library: “coreBat”.
Header file: “utils/bat/config.hpp”.
This is a class (ifw::core::utils::bat::Config) that provide few services that can be used by IFW servers like the handling of command line parameters or the loading and checking of the configuration files using CII config-ng library.
The basic schema for the configuration is found in file definitions.yaml. The supported command line parameters are:
Options:
-h [ --help ] Print help messages
-i [ --server-id ] arg Server ID
-l [ --log-level ] arg Log level: ERROR, INFO, DEBUG, TRACE
-p [ --log-prop-file ] arg Log property filename
-c [ --config ] arg Configuration filename
-r [ --req-endpoint ] arg Req/Rep endpoint (zpb.rr://<ipaddr>:<port>/)
-d [ --db-endpoint ] arg Redis DB endpoint (<ipaddr>:<port>)
Warning
The command line parameters override the same parameters that can be found in the configuration. This means that regardless what it is in the configuration, the command line parameters have precedence.
Miscellaneous C++ Tools
Module: “ifw-core/utils/base”
Namespace: “ifw::core::utils::base”.
Library: “ifwCoreUtilsBase”.
Header file: “ifw/core/utils/base/base.hpp”.
Provides various basic definitions of constants and a few convenience functions.
Module: “ifw-hl/core/utils/string”
Namespace: “ifw::core::utils::string”.
Library: “ifwCoreString”.
Header file: “ifw/core/utils/string/string.hpp”.
Provides small convenience tools for string manipulation.
Module: “ifw-core/utils/conversion”
Namespace: “ifw::core::utils::conversion”.
Library: “ifwCoreConversion”.
Header file: “ifw/core/utils/conversion/conversion.hpp”.
Provides utilites to convert between different data types.
Module: “ifw-core/system”
Namespace: “ifw::core::utils::system”.
Library: “ifwCoreSystem”.
Header file: “ifw/core/utils/system/system.hpp”.
Provides various system level utilities (functions) and a scope based mutex semaphore class.
Doxygen documentation:
Module: “ifw-core/utils/time”
Namespace: “ifw::core::utils::time”.
Library: “ifwCoreTime”.
Header file: “ifw/core/utils/time/time.hpp”.
Provides small convenience functions for dealing with time aspects, e.g. generating ISO 8601 time stamps.
Doxygen documentation:
Module: “ifw-core/utils/param”
Namespace: “ifw::core::utils::param”.
Library: “ifwCoreParam”.
Header files:
“ifw/core/utils/param/parameter.hpp”: Contains class to handle one parameter.
“ifw/core/utils/param/parameterSet.hpp”: Contains class to handle a set of parameter class instances.
Provides two classes for handling parameter files in a generic way.
Note
This module is under evaluation. During the porting of ICS to CII, it will be evaluated whether to keep this.
Module: “ifw-core/utils/file”
Namespace: “ifw::core::utils::file”.
Library: “ifwCoreFile”.
Header files:
“ifw/core/utils/file/file.hpp”: Defines various constants to be used in the context of the ICS directory structure. Moreover, various utilities to handle files and filenames, e.g. a tool for locating files in the ICS directory structure.
“ifw/core/utils/file/parameterFile.hpp”: Provides a class, “ParameterFile”, based on “ifw::core::param::ParameterSet” to handle parameter files in a simple ASCII format.
“ifw/core/utils/file/yaml.hpp”: Provides a class, based on “ifw::core::utils::param::ParameterSet”, to handle YAML files in the ICS directory structure.
Note
Before, possibly, using the “ifw::core::utils::file::Yaml” class, it shall be considered if the CII Configuration Service could be used.