trikRuntime
trikKernel::Configurer Class Reference

Generic configuration helper, parses configuration XML files and presents configuration as a set of attributes with their values for each configurable device. More...

#include <configurer.h>

Public Member Functions

 Configurer (const QString &systemConfig, const QString &modelConfig)
 Constructor. More...
 
QString attributeByDevice (const QString &deviceClass, const QString &attributeName) const
 Returns value of given attribute of given device. More...
 
QString attributeByPort (const QString &port, const QString &attributeName) const
 Returns value of given attribute of a device on given port. More...
 
bool isEnabled (const QString &deviceName) const
 Returns true if device is enabled in current configuration (either explicitly enabled in model configuration or can not be disabled at all). More...
 
QStringList ports () const
 Ports configured in model config. More...
 
QString deviceClass (const QString &port) const
 Returns class of a device configured on given port. More...
 
QStringList initScripts () const
 Returns init scripts defined in config files, first from system config then from model config. More...
 
void configure (const QString &portName, const QString &deviceName)
 Changes configuration by configuring given device on given port. More...
 
QString version () const
 Returns version of the config file which shall correspond to casing model. More...
 

Detailed Description

Generic configuration helper, parses configuration XML files and presents configuration as a set of attributes with their values for each configurable device.

Respects configuration overriding rules: Model config > device type config > device-port pair config > device class config

Constructor & Destructor Documentation

Configurer::Configurer ( const QString &  systemConfig,
const QString &  modelConfig 
)

Constructor.

Parameters
systemConfig- file name (with path) of system config, absolute or relative to current directory.
modelConfig- file name (with path) of model config, absolute or relative to current directory.

Member Function Documentation

QString Configurer::attributeByDevice ( const QString &  deviceClass,
const QString &  attributeName 
) const

Returns value of given attribute of given device.

QString Configurer::attributeByPort ( const QString &  port,
const QString &  attributeName 
) const

Returns value of given attribute of a device on given port.

void Configurer::configure ( const QString &  portName,
const QString &  deviceName 
)

Changes configuration by configuring given device on given port.

Port must be listed in model-config.xml, device shall be listed in system-config.xml, and device shall be able to be configured on a port (it is also described in system-config.xml).

QString Configurer::deviceClass ( const QString &  port) const

Returns class of a device configured on given port.

QStringList Configurer::initScripts ( ) const

Returns init scripts defined in config files, first from system config then from model config.

bool Configurer::isEnabled ( const QString &  deviceName) const

Returns true if device is enabled in current configuration (either explicitly enabled in model configuration or can not be disabled at all).

QStringList Configurer::ports ( ) const

Ports configured in model config.

QString Configurer::version ( ) const

Returns version of the config file which shall correspond to casing model.


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