mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
Loading...
Searching...
No Matches
mx::app Namespace Reference

Classes

struct  appConfigurator
 Class to manage a set of configurable values, and read their values from config/ini files and the command line. More...
 
class  application
 A class for managing application configuration and execution. More...
 
struct  clOptions
 Command line options parser. More...
 
struct  configTarget
 A configuration target. More...
 
struct  iniFile
 A wrapper for the ini functions. More...
 

Enumerations

enum  argType {
  None , False , True , Optional ,
  Required
}
 Argument types. More...
 

Functions

template int appConfigurator::get< std::string > (std::string &v, const std::string &name, size_t i, std::unordered_map< std::string, configTarget > &targets)
 
template int appConfigurator::get< std::string > (std::string &v, const std::string &name, size_t i)
 
template int appConfigurator::get< std::string > (std::string &v, const std::string &name, std::unordered_map< std::string, configTarget > &targets)
 
template int appConfigurator::get< std::string > (std::string &v, const std::string &name)
 
template int appConfigurator::get< std::string > (std::vector< std::string > &v, const std::string &name, size_t i, std::unordered_map< std::string, configTarget > &targets)
 
template int appConfigurator::get< std::string > (std::vector< std::string > &v, const std::string &name, size_t i)
 
template int appConfigurator::get< std::string > (std::vector< std::string > &v, const std::string &name, std::unordered_map< std::string, configTarget > &targets)
 
template int appConfigurator::get< std::string > (std::vector< std::string > &v, const std::string &name)
 
template int appConfigurator::configUnused< std::string > (std::string &v, const std::string &key)
 
template int appConfigurator::configUnused< std::string > (std::string &v, const std::string &section, const std::string &keyword)
 
void writeConfigFile (const std::string &fname, const std::vector< std::string > &sections, const std::vector< std::string > &keywords, const std::vector< std::string > &values)
 A simple config file writing function, useful for testing.
 
static option::ArgStatus Arg_Required (const option::Option &option, bool msg)
 

Variables

static const char * falseStr = "false"
 
static const char * trueStr = "true"
 
static const char * blankStr = ""
 

Enumeration Type Documentation

◆ argType

Argument types.

Enumerator
None 
False 
True 
Optional 
Required 

Definition at line 43 of file clOptions.hpp.

Function Documentation

◆ appConfigurator::configUnused< std::string >() [1/2]

template int mx::app::appConfigurator::configUnused< std::string > ( std::string &  v,
const std::string &  key 
)
extern

◆ appConfigurator::configUnused< std::string >() [2/2]

template int mx::app::appConfigurator::configUnused< std::string > ( std::string &  v,
const std::string &  section,
const std::string &  keyword 
)
extern

◆ appConfigurator::get< std::string >() [1/8]

template int mx::app::appConfigurator::get< std::string > ( std::string &  v,
const std::string &  name 
)
extern

◆ appConfigurator::get< std::string >() [2/8]

template int mx::app::appConfigurator::get< std::string > ( std::string &  v,
const std::string &  name,
size_t  i 
)
extern

◆ appConfigurator::get< std::string >() [3/8]

template int mx::app::appConfigurator::get< std::string > ( std::string &  v,
const std::string &  name,
size_t  i,
std::unordered_map< std::string, configTarget > &  targets 
)
extern

◆ appConfigurator::get< std::string >() [4/8]

template int mx::app::appConfigurator::get< std::string > ( std::string &  v,
const std::string &  name,
std::unordered_map< std::string, configTarget > &  targets 
)
extern

◆ appConfigurator::get< std::string >() [5/8]

template int mx::app::appConfigurator::get< std::string > ( std::vector< std::string > &  v,
const std::string &  name 
)
extern

◆ appConfigurator::get< std::string >() [6/8]

template int mx::app::appConfigurator::get< std::string > ( std::vector< std::string > &  v,
const std::string &  name,
size_t  i 
)
extern

◆ appConfigurator::get< std::string >() [7/8]

template int mx::app::appConfigurator::get< std::string > ( std::vector< std::string > &  v,
const std::string &  name,
size_t  i,
std::unordered_map< std::string, configTarget > &  targets 
)
extern

◆ appConfigurator::get< std::string >() [8/8]

template int mx::app::appConfigurator::get< std::string > ( std::vector< std::string > &  v,
const std::string &  name,
std::unordered_map< std::string, configTarget > &  targets 
)
extern

◆ Arg_Required()

static option::ArgStatus mx::app::Arg_Required ( const option::Option &  option,
bool  msg 
)
static

Definition at line 38 of file clOptions.cpp.

Referenced by mx::app::clOptions::add().

◆ writeConfigFile()

void mx::app::writeConfigFile ( const std::string &  fname,
const std::vector< std::string > &  sections,
const std::vector< std::string > &  keywords,
const std::vector< std::string > &  values 
)

A simple config file writing function, useful for testing.

Write a config file to the path specified by fname. Each of the parameters is a vector, and each component is required of each vector.

Example:

writeConfigFile( "/tmp/test.conf", {"", "", "sect1", "sect1", "sect2", "sect2"},
{"key0", "key1", "key2", "key3", "key4", "key5"},
{"val0", "val1", "val2", "val3", "val4", "val5"} );
void writeConfigFile(const std::string &fname, const std::vector< std::string > &sections, const std::vector< std::string > &keywords, const std::vector< std::string > &values)
A simple config file writing function, useful for testing.

results in the file ‘/tmp/test.conf’ containing

key0=val0
key1=val1

[sect1]
key2=val2
key3=val3

[sect2]
key4=val4
key5=val5

* 

No error checking is done.

Parameters
[in]fnamethe complete path for the output file.
[in]sectionssections, one per config value
[in]keywordskeywords, one per config value
[in]valuesthe values

Definition at line 892 of file appConfigurator.cpp.

Referenced by SCENARIO(), SCENARIO(), SCENARIO(), and SCENARIO().

Variable Documentation

◆ blankStr

const char* mx::app::blankStr = ""
static

Definition at line 36 of file clOptions.cpp.

Referenced by mx::app::clOptions::operator[]().

◆ falseStr

const char* mx::app::falseStr = "false"
static

Definition at line 34 of file clOptions.cpp.

Referenced by mx::app::clOptions::getAll(), and mx::app::clOptions::operator[]().

◆ trueStr

const char* mx::app::trueStr = "true"
static

Definition at line 35 of file clOptions.cpp.

Referenced by mx::app::clOptions::getAll(), and mx::app::clOptions::operator[]().