Configuration files

Back to PastelSys

In Pastel, a configuration file is a text file which contains definitions of variables and has a certain context-free grammar. Such a file can be automatically parsed by the Boost's Spirit sub-library. Here's an example of a configuration file.

Pastel Config File

// This is a config file for the performance 
// measurement of nearest neighbor searching
// using various data structures.

// Data structures to include in the measurement.

integer include_pastel_kdtree = 1
integer include_xxx_kdtree = 1
integer include_xxx_bdtree = 1
integer include_brute_force = 1

// Parameters for searching.

real max_relative_error = 0
integer use_dynamic_vectors = 1
integer use_multi_threading = 1

// Reporting.

integer output_latex_table = 0

// Parameter set.

integer * points_set = 2500, 5000, 10000, 20000, 40000
integer fixed_points = 10000

integer * neighbors_set = 1, 2, 4, 8, 16
integer fixed_neighbors = 4

integer * dimension_set = 1, 2, 4, 8, 16, 32
integer fixed_dimension = 8

Config file format

Everything after a % or a // symbol to the end of the row will be ignored. /* */ can be used for multi-line comments. Here is the config file syntax in BNF (Backus-Naur Form).

<File> := 'Pastel Config File' <VariableDeclaration>*
<VariableDeclaration> := <IntegerDeclaration> | <RealDeclaration> | <StringDeclaration>

<IntegerDeclaration> := 'integer' [<VariableSize>] <VariableName> '=' <IntegerList>
<RealDeclaration> := 'real' [<VariableSize>] <VariableName> '=' <RealList>
<StringDeclaration> := 'string' [<VariableSize>] <VariableName> '=' <StringList>

<VariableSize> := <PositiveInteger> | '*'
<VariableName> := <String>

<IntegerList> := <Integer> | <IntegerList> ',' <Integer>
<RealList> := <Real> | <RealList> ',' <Real>
<StringList> := <String> | <StringList> ',' <String>

Files

Algorithms for Config class

config_tools.cpp

config_tools.h

config_tools.hpp

An aggregate file for configuration

configuration.h

Config class

Stores configuration properties

config.cpp

config.h

config.hpp

Loading and saving of configuration files

configfile.cpp

configfile.h

Testing for Config

test_config.cpp