Example program demonstrating the use of ArConfigThis program shows how to use ArConfig to store configuration parameters and load/save them from a file.
The ArNetworking library includes server classes that will let you use a remote client such as MobileEyes to view and change the configuration. See ArNetworking documentation and examples.
#include "Aria.h"
class ConfigExample
{
int myIntParam;
double myDoubleParam;
bool myBoolParam;
char myStringParam[256];
public:
ConfigExample():
myIntParam(0),
myDoubleParam(0.5),
myBoolParam(false),
myProcessConfigCB(this, &ConfigExample::processConfigFile)
{
config->
setSectionComment(
"Example Section",
"Contains parameters created by the configExample");
myStringParam[0] = '\0';
}
bool processConfigFile()
{
ArLog::log(
ArLog::Normal,
"configExample: Config changed. New values: int=%d, float=%f, bool=%s, string=\"%s\".", myIntParam, myDoubleParam, myBoolParam?
"true":
"false", myStringParam);
return true;
}
};
int main(int argc, char **argv)
{
{
ArLog::log(
ArLog::Terse,
"configExample usage: configExample <config file>.\nFor example, \"configExample examples/configExample.cfg\".");
return 1;
}
ConfigExample configExample;
char error[512];
const char* filename = argParser.
getArg(1);
if (! config->
parseFile(filename,
true,
false, error, 512) )
{
ArLog::log(
ArLog::Terse,
"configExample: Error loading configuration file \"%s\" %s. Try \"examples/configExample.cfg\".", filename, error);
return -1;
}
if (section)
{
if (arg)
{
{
}
else
{
}
}
}
{
}
return 0;
}