Aria
2.8.0
|
Argument class for ArConfig. More...
#include <ArConfigArg.h>
Public Types | |
enum | { DEFAULT_DOUBLE_PRECISION = 5, TYPE_COUNT = LAST_TYPE + 1, RESTART_LEVEL_COUNT = LAST_RESTART_LEVEL + 1 } |
enum | { MAX_RESOURCE_ARG_TEXT_LENGTH = 1024 } |
enum | ResourceIndices { RESOURCE_INDEX_OF_SECTION_NAME = 0, RESOURCE_INDEX_OF_ARG_NAME = 1, RESOURCE_INDEX_OF_TYPE = 2, RESOURCE_INDEX_OF_PRIORITY = 3, RESOURCE_INDEX_OF_RESTART_LEVEL = 4, RESOURCE_INDEX_OF_PARENT_PATH = 5, RESOURCE_INDEX_OF_DESCRIPTION = 6, RESOURCE_INDEX_OF_EXTRA = 7, RESOURCE_INDEX_OF_DISPLAY = 8, RESOURCE_INDEX_OF_NEW = 9 } |
enum | RestartLevel { NO_RESTART, RESTART_CLIENT, RESTART_IO, RESTART_SOFTWARE, RESTART_HARDWARE, LAST_RESTART_LEVEL = RESTART_HARDWARE } |
Indicates the components that must be restarted if the parameter is changed. | |
enum | Type { INVALID, INT, DOUBLE, STRING, BOOL, FUNCTOR, DESCRIPTION_HOLDER, STRING_HOLDER, SEPARATOR, CPPSTRING, LIST, LIST_HOLDER, LAST_TYPE = LIST_HOLDER } |
Public Member Functions | |
bool | addArg (const ArConfigArg &arg) |
Adds a child arg to this arg. Valid only for LIST type; otherwise returns false. More... | |
bool | addToFileParser (ArFileParser *parser, ArRetFunctor3C< bool, ArConfig, ArArgumentBuilder *, char *, size_t > *parserCB, const char *logPrefix="", bool isQuiet=false) const |
Adds given parserCB handler for the appropriate keyword(s) to the given file parser. More... | |
ArConfigArg () | |
Default empty contructor. | |
ArConfigArg (const char *name, int *pointer, const char *description="", int minInt=INT_MIN, int maxInt=INT_MAX) | |
Constructor for making an integer argument by pointer (4 bytes) More... | |
ArConfigArg (const char *name, short *pointer, const char *description="", int minInt=SHRT_MIN, int maxInt=SHRT_MAX) | |
Constructor for making an int argument thats a short (2 bytes) More... | |
ArConfigArg (const char *name, unsigned short *pointer, const char *description="", int minInt=0, int maxInt=USHRT_MAX) | |
Constructor for making an int argument thats a ushort (2 bytes) More... | |
ArConfigArg (const char *name, unsigned char *pointer, const char *description="", int minInt=0, int maxInt=255) | |
Constructor for making an char (1 byte) argument by pointer (treated as int) More... | |
ArConfigArg (const char *name, double *pointer, const char *description="", double minDouble=-HUGE_VAL, double maxDouble=HUGE_VAL, int precision=DEFAULT_DOUBLE_PRECISION) | |
Constructor for making a double argument by pointer. More... | |
ArConfigArg (const char *name, bool *pointer, const char *description="") | |
Constructor for making a boolean argument by pointer. More... | |
ArConfigArg (const char *name, char *str, const char *description, size_t maxStrLen) | |
Constructor for making an argument of a string by pointer (see details) More... | |
ArConfigArg (const char *name, const char *str, const char *description) | |
Constructor for making an argument of a string by pointer (see details) More... | |
ArConfigArg (const char *name, std::string *str, const char *description) | |
Constructor for making an argument of a C++ std::string. More... | |
ArConfigArg (const char *name, int val, const char *description="", int minInt=INT_MIN, int maxInt=INT_MAX) | |
Constructor for making an integer argument. More... | |
ArConfigArg (const char *name, double val, const char *description="", double minDouble=-HUGE_VAL, double maxDouble=HUGE_VAL, int precision=DEFAULT_DOUBLE_PRECISION) | |
Constructor for making a double argument. More... | |
ArConfigArg (const char *name, bool val, const char *description="") | |
Constructor for making a boolean argument. More... | |
ArConfigArg (const char *name, ArRetFunctor1< bool, ArArgumentBuilder *> *setFunctor, ArRetFunctor< const std::list< ArArgumentBuilder *> *> *getFunctor, const char *description) | |
Constructor for making an argument that has functors to handle things. More... | |
ArConfigArg (const char *str, Type type=DESCRIPTION_HOLDER) | |
Constructor for just holding a description (for ArConfig) | |
ArConfigArg (const char *name, const char *str) | |
Constructor for holding an unknown argument (STRING_HOLDER) More... | |
ArConfigArg (Type type, const char *name, const char *description) | |
Constructs a new named argument of the specified type. More... | |
ArConfigArg (Type type) | |
Constructs a new argument of the specified type. More... | |
ArConfigArg (const char *argName, const ArConfigArg &arg) | |
Copy constructor that allows a new name to be assigned. | |
ArConfigArg (const ArConfigArg &arg) | |
Copy constructor. | |
void | clearValueSet (void) |
Tells the configArg that the value hasn't been set. | |
void | copyAndDetach (const ArConfigArg &arg) |
Copies the given arg to this one, detaching any pointers so they are not shared. | |
bool | copyTranslation (const ArConfigArg &arg) |
Copies the translation data from given arg to this one. More... | |
const ArConfigArg * | findArg (const char *childParamName) const |
Finds the specified child arg. Valid only for LIST type; otherwise returns NULL. More... | |
ArConfigArg * | findArg (const char *childParamName) |
Finds the specified child arg. Valid only for LIST type; otherwise returns NULL. More... | |
const ArConfigArg * | getArg (size_t index) const |
Returns the child arg at the specified index (between 0 and getArgCount()). More... | |
ArConfigArg * | getArg (size_t index) |
Returns the child arg at the specified index (between 0 and getArgCount()). | |
size_t | getArgCount () const |
Returns the number of child args. Valid only for LIST type; otherwise returns 0. More... | |
std::list< ArConfigArg > | getArgs (bool *ok=NULL) const |
Returns a list of all child args in this arg. Valid only for LIST type; otherwise returns an empty list. More... | |
const std::list< ArArgumentBuilder * > * | getArgsWithFunctor (bool *ok=NULL) const |
Gets the argument value, which is a list of argumentbuilders here. | |
bool | getBool (bool *ok=NULL) const |
Gets the argument value, for bool arguments. | |
ArPriority::Priority | getConfigPriority (void) const |
Gets the priority (only used by ArConfig) More... | |
std::string | getCppString (bool *ok=NULL) const |
Get a copy of the value of the target std::string. More... | |
const std::string * | getCppStringPtr (bool *ok=NULL) const |
Get the internal pointer to the target std::string. More... | |
const char * | getDescription (void) const |
Gets the brief description of the argument. More... | |
const char * | getDisplayHint () const |
Returns the display hint for this arg, or NULL if none is defined. | |
double | getDouble (bool *ok=NULL) const |
Gets the argument value, for double arguments. | |
int | getDoublePrecision (bool *ok=NULL) const |
Gets the decimal precision of the double. | |
const char * | getExtraExplanation () const |
Returns the extra explanation, if any, for this argument. | |
int | getInt (bool *ok=NULL) const |
Gets the argument value, for int arguments. | |
double | getMaxDouble (bool *ok=NULL) const |
Gets the maximum double value. More... | |
int | getMaxInt (bool *ok=NULL) const |
Gets the maximum int value. More... | |
double | getMinDouble (bool *ok=NULL) const |
Gets the minimum double value. More... | |
int | getMinInt (bool *ok=NULL) const |
Gets the minimum int value. More... | |
const char * | getName (void) const |
Gets the name of the argument. More... | |
ArConfigArg * | getParentArg () const |
Returns a pointer to the immediate parent arg. If this is not a child ArConfigArg, then returns NULL. More... | |
std::string | getParentPathName (char separator='|') const |
If getParentArg() is not null, then returns the path to the top level, as a single string. | |
RestartLevel | getRestartLevel () const |
Gets the restart level of this parameter (only used by ArConfig) | |
const char * | getString (bool *ok=NULL) const |
Gets the argument value, for string (and string holder) arguments. | |
bool | getSupressChanges (void) const |
Gets if notifications of changes are supressed (for the central server config) | |
ArConfigArg::Type | getType (void) const |
Gets the type of the argument. More... | |
bool | hasArgs () const |
Returns whether the list contains child args. Valid only for LIST type; otherwise returns false. More... | |
bool | hasExternalDataReference () const |
Returns true if this arg points to a member of another object, false if arg is self-contained. | |
bool | hasMaxBound () const |
Returns whether the arg has a maximum value, currently applicable to INTs and DOUBLEs. | |
bool | hasMinBound () const |
Returns whether the arg has a minimum value, currently applicable to INTs and DOUBLEs. | |
bool | isTranslated () const |
Returns whether the arg has been translated by a resource file. | |
bool | isValueEqual (const ArConfigArg &other) const |
Checks only the name, type, and value attributes and returns whether they are equal. | |
bool | isValueSet (void) |
Gets whether this value has been set since it was last cleared or not. | |
void | log (bool verbose=false, int indentCount=1, const char *logPrefix="") const |
Logs the type, name, and value of this argument. | |
ArConfigArg & | operator= (const ArConfigArg &arg) |
Assignment operator. | |
bool | parseArgument (ArArgumentBuilder *arg, char *errorBuffer, size_t errorBufferLen, const char *logPrefix="", bool isQuiet=false, bool *changed=NULL) |
Sets the value of this arg to the data described in the given ArArgumentBuilder. | |
bool | parseResource (ArArgumentBuilder *arg, char *errorBuffer, size_t errorBufferLen, const char *logPrefix="", bool isQuiet=false) |
Sets the value of this arg to the resource data described in the given ArArgumentBuilder. | |
void | replaceSpacesInName (void) |
Replaces spaces in the name with underscores. | |
bool | setArgWithFunctor (ArArgumentBuilder *argument, char *errorBuffer=NULL, size_t errorBufferLen=0, bool doNotSet=false) |
Sets the argument by calling the setFunctor callback. | |
bool | setBool (bool val, char *errorBuffer=NULL, size_t errorBufferLen=0, bool doNotSet=false) |
Sets the argument value, for bool arguments. | |
void | setConfigPriority (ArPriority::Priority priority) |
Sets the priority (only used by ArConfig) More... | |
bool | setCppString (const std::string &str, char *errorBuffer=NULL, size_t errorBufferLen=0, bool doNotSet=false) |
void | setDescription (const char *description) |
Sets the description (normally given in the constructor) | |
void | setDisplayHint (const char *hintText) |
Sets the display hint for this arg. More... | |
bool | setDouble (double val, char *errorBuffer=NULL, size_t errorBufferLen=0, bool doNotSet=false) |
Sets the argument value, for double arguments. | |
void | setExtraExplanation (const char *extraExplanation) |
For arguments that require more than a brief description, set the extra explanation. | |
void | setIgnoreBounds (bool ignoreBounds=false) |
Sets whether to ignore bounds or not (default is to not to) More... | |
bool | setInt (int val, char *errorBuffer=NULL, size_t errorBufferLen=0, bool doNotSet=false) |
Sets the argument value, for int arguments. | |
void | setRestartLevel (RestartLevel level) |
Sets the restart level of this parameter (only used by ArConfig) | |
bool | setString (const char *str, char *errorBuffer=NULL, size_t errorBufferLen=0, bool doNotSet=false) |
Sets the argument value for string arguments. More... | |
bool | setString (const std::string &str, char *errorBuffer=NULL, size_t errorBufferLen=0, bool doNotSet=false) |
Sets the argument value for string arguments. The value of str is copied to the target string. | |
void | setSupressChanges (bool supressChanges) |
Sets if notifications of changes are supressed (for the central server config) | |
void | setTranslated (bool b) |
Sets whether the arg has been translated by a resource file. | |
bool | setValue (const ArConfigArg &source, bool isVerifyArgNames=false) |
If the given source is of the same type, copies its value to this arg. More... | |
void | setValueSet (void) |
For special arg types (such as LIST), sets the flag to indicate the value was set. | |
bool | writeArguments (FILE *file, char *lineBuf, int lineBufSize, int startCommentColumn, bool isWriteExtra=false, const char *logPrefix="", int indentLevel=0) const |
Writes this arg to the given file, in a format suitable for reading by parseArgument. More... | |
bool | writeBounds (char *line, size_t lineLen, const char *logPrefix="") const |
Writes the min/max values of this arg to the given buffer, as applicable. More... | |
bool | writeName (char *lineBuf, int lineBufSize, int indentLevel) const |
Writes the name of this arg to the given buffer, indenting as specified. More... | |
bool | writeResource (FILE *file, char *lineBuf, int lineBufSize, char separatorChar, const char *sectionName, const char *logPrefix="") const |
Writes this arg to the given file, in a format suitable for reading by parseResource. | |
virtual | ~ArConfigArg () |
Destructor. | |
Static Public Member Functions | |
static bool | isResourceTopLevel (ArArgumentBuilder *arg, const char *logPrefix="") |
Returns true if the given resource arg is "top-level", i.e. not a list member. | |
static std::string | parseResourceArgName (ArArgumentBuilder *arg, const char *logPrefix="") |
Returns the param name contained in the given resource arg. | |
static bool | parseResourceArgText (const char *argText, char *bufOut, size_t bufLen) |
Parses the text obtained from the resource arg, strips surrounding quotes, blanks, and funny chars. | |
static std::string | parseResourceDescription (ArArgumentBuilder *arg, const char *logPrefix="") |
Returns the description contained in the given resource arg. | |
static std::string | parseResourceExtra (ArArgumentBuilder *arg, const char *logPrefix="") |
Returns the extra explanation contained in the given resource arg. | |
static std::list< std::string > | parseResourceParentPath (ArArgumentBuilder *arg, char separator='|', const char *logPrefix="") |
Returns the parent path contained in the resource arg for list members. | |
static std::string | parseResourceSectionName (ArArgumentBuilder *arg, const char *logPrefix="") |
Returns the section name contained in the given resource arg. | |
static Type | parseResourceType (ArArgumentBuilder *arg, const char *logPrefix="") |
Returns the arg type contained in the given resource arg. | |
static RestartLevel | restartLevelFromString (const char *text) |
Given a text representation, returns the appropriate RestartLevel. | |
static std::list< std::string > | splitParentPathName (const char *parentPathName, char separator='|') |
Given a parent path, as a single string, splits it in a format useable by ArConfigSection findParam. | |
static const char * | toString (Type t) |
Returns a text representation of the given type, suitable for logging. | |
static const char * | toString (RestartLevel r) |
Returns a text representation of the given RestartLevel, suitable for logging. | |
static Type | typeFromString (const char *text) |
Given a text representation, returns the appropriate Type. | |
static int | writeResourceHeader (FILE *file, char *lineBuf, int lineBufSize, char separatorChar, const char *sectionTitle, const char *logPrefix="") |
Writes column labels and edit info to the given resource file, returns number of lines written. | |
static int | writeResourceSectionHeader (FILE *file, char *lineBuf, int lineBufSize, char separatorChar, const char *sectionName, const char *sectionDesc, const char *sectionExtra, const char *sectionDisplayName, bool isTranslated, const char *logPrefix="") |
Writes the section description to the resource file. | |
Static Public Attributes | |
static const char * | LIST_BEGIN_TAG = "_beginList" |
Keyword that indicates the start of an ArConfigArg LIST object, for ArFileParser. | |
static const char * | LIST_END_TAG = "_endList" |
Keyword that indicates the end of an ArConfigArg LIST object, for ArFileParser. | |
static const char * | NEW_RESOURCE_TAG = "xltrNew" |
Resource file keyword that indicates a new entry. | |
static const char * | NULL_TAG = "NULL" |
Resource file keyword that indicates an empty string (cannot write empty for csv). | |
Static Protected Member Functions | |
static bool | writeMultiLineComment (const char *comment, FILE *file, char *lineBuf, int lineBufSize, const char *startComment) |
Writes the given comment to the specified file, spanning multiple lines as necessary. More... | |
Friends | |
class | ArConfig |
Argument class for ArConfig.
ArConfigArg stores information about a parameter (name, description, type), and a pointer to the variable that will actually store the value. This variable is normally stored and used by whatever class or module has added the parameter to ArConfig. (In addition, there are some special types of ArConfigArg that behave differently such as the "holder" types and separator, these are used internally or in special cases.)
Which constructor you use determines the value type of the ArConfigArg object.
A typical idiom for creating ArConfigArg objects and adding them to ArConfig is to create a temporary ArConfigArg in the call to ArConfig::addParam():
Where config
is a pointer to an ArConfig object or subclass, and myTarget
is a variable (e.g. int) that is a class member whose instance will not be destroyed before the end of the program, or which will remove the parameter from ArConfig before being destroyed (the pointer to myTarget
that is stored in ArConfig must not become invalid.) The ArConfigArg object passed to addParam() will be copied and stored in ArConfig.
Java and Python Wrappers: Swig cannot determine the correct constructor to use based on most target langugages types, so you must use subclasses defined for various types. Or, use the constructor that accepts functors for dealing with arguments. Also, Swig cannot use pointers to change variables, so you must create ArConfigArg objects, passing in default values, and retain references to those objects, in addition to passing them to ArConfig, and read new values from those objects if ArConfig changes; or pass functors to ArConfigArg instead of the initial value.
anonymous enum |
enum ArConfigArg::Type |
ArConfigArg::ArConfigArg | ( | const char * | name, |
int * | pointer, | ||
const char * | description = "" , |
||
int | minInt = INT_MIN , |
||
int | maxInt = INT_MAX |
||
) |
Constructor for making an integer argument by pointer (4 bytes)
Java and Python Wrappers: Not available in Java or Python wrapper libraries.
ArConfigArg::ArConfigArg | ( | const char * | name, |
short * | pointer, | ||
const char * | description = "" , |
||
int | minInt = SHRT_MIN , |
||
int | maxInt = SHRT_MAX |
||
) |
Constructor for making an int argument thats a short (2 bytes)
Java and Python Wrappers: Not available in Java or Python wrapper libraries.
ArConfigArg::ArConfigArg | ( | const char * | name, |
unsigned short * | pointer, | ||
const char * | description = "" , |
||
int | minInt = 0 , |
||
int | maxInt = USHRT_MAX |
||
) |
Constructor for making an int argument thats a ushort (2 bytes)
Java and Python Wrappers: Not available in Java or Python wrapper libraries.
ArConfigArg::ArConfigArg | ( | const char * | name, |
unsigned char * | pointer, | ||
const char * | description = "" , |
||
int | minInt = 0 , |
||
int | maxInt = 255 |
||
) |
Constructor for making an char (1 byte) argument by pointer (treated as int)
Java and Python Wrappers: Not available in Java or Python wrapper libraries.
ArConfigArg::ArConfigArg | ( | const char * | name, |
double * | pointer, | ||
const char * | description = "" , |
||
double | minDouble = -HUGE_VAL , |
||
double | maxDouble = HUGE_VAL , |
||
int | precision = DEFAULT_DOUBLE_PRECISION |
||
) |
Constructor for making a double argument by pointer.
Java and Python Wrappers: Not available in Java or Python wrapper libraries.
ArConfigArg::ArConfigArg | ( | const char * | name, |
bool * | pointer, | ||
const char * | description = "" |
||
) |
Constructor for making a boolean argument by pointer.
Java and Python Wrappers: Not available in Java or Python wrapper libraries.
ArConfigArg::ArConfigArg | ( | const char * | name, |
char * | str, | ||
const char * | description, | ||
size_t | maxStrLen | ||
) |
Constructor for making an argument of a string by pointer (see details)
This constructor can accept both an already-allocated string, or ArConfigArg can to the memory managment itself (reallocation and finally deletion).
If maxStrLen is 0, then ArConfigArg will do its own memory management, with the contents of str copied as the initial value of the internally held string. Otherwise, str must point to an allocated string, with its size given by maxStrLen.
Java and Python Wrappers: Not available in Java or Python wrapper libraries. Use ArConfigArg_String subclass instead (which has no maxStrLen parameter in its constructor)
ArConfigArg::ArConfigArg | ( | const char * | name, |
const char * | str, | ||
const char * | description | ||
) |
Constructor for making an argument of a string by pointer (see details)
This constructor can accept a const char str, then it'll take care of the string itself...
Java and Python Wrappers: Not available in Java or Python wrapper libraries. Use ArConfigArg_String subclass instead (which has no maxStrLen parameter in its constructor)
ArConfigArg::ArConfigArg | ( | const char * | name, |
std::string * | strptr, | ||
const char * | description | ||
) |
Constructor for making an argument of a C++ std::string.
Java and Python Wrappers: Not available in Java or Python wrapper libraries.
ArConfigArg::ArConfigArg | ( | const char * | name, |
int | val, | ||
const char * | description = "" , |
||
int | minInt = INT_MIN , |
||
int | maxInt = INT_MAX |
||
) |
Constructor for making an integer argument.
Java and Python Wrappers: Not available in Java or Python wrapper libraries. Use ArConfigArg_Int subclass instead.
ArConfigArg::ArConfigArg | ( | const char * | name, |
double | val, | ||
const char * | description = "" , |
||
double | minDouble = -HUGE_VAL , |
||
double | maxDouble = HUGE_VAL , |
||
int | precision = DEFAULT_DOUBLE_PRECISION |
||
) |
Constructor for making a double argument.
Java and Python Wrappers: Not available in Java or Python wrapper libraries. Use ArConfigArg_Double subclass instead.
ArConfigArg::ArConfigArg | ( | const char * | name, |
bool | val, | ||
const char * | description = "" |
||
) |
Constructor for making a boolean argument.
Java and Python Wrappers: Not available in Java or Python wrapper libraries. Use ArConfigArg_Bool subclass instead.
ArConfigArg::ArConfigArg | ( | const char * | name, |
ArRetFunctor1< bool, ArArgumentBuilder *> * | setFunctor, | ||
ArRetFunctor< const std::list< ArArgumentBuilder *> *> * | getFunctor, | ||
const char * | description | ||
) |
Constructor for making an argument that has functors to handle things.
This constructor is for the functor type of argument, this is for cases that need to be complicated and have more than one argument per name...
such as the sonar in a config file. Where this data needs to be used to construct internal data structures.
name | Name of this argument |
description | Description of the purpose of this argument |
setFunctor | When an argument is read it is passed to this functor in an ArArgumentBuilder object. The functor should return false if there is an error or problem handling the argument, or true otherwise. |
getFunctor | Since configuration needs to be serialized to save files on disk or send data over the network etc., this functor will be called to get a list of strings to represent this argument and its value as text in the file etc. |
ArConfigArg::ArConfigArg | ( | const char * | name, |
const char * | str | ||
) |
Constructor for holding an unknown argument (STRING_HOLDER)
ArConfigArg::ArConfigArg | ( | Type | type, |
const char * | name, | ||
const char * | description | ||
) |
Constructs a new named argument of the specified type.
This constructor is used for creating composite (LIST or LIST_HOLDER type) parameters.
ArConfigArg::ArConfigArg | ( | Type | type | ) |
Constructs a new argument of the specified type.
This constructor is useful for creating separators within a config section.
bool ArConfigArg::addArg | ( | const ArConfigArg & | arg | ) |
Adds a child arg to this arg. Valid only for LIST type; otherwise returns false.
If the given child arg is not a separator, then it must have a unique, non-empty name.
arg | the ArConfigArg to be added as a child of this composite arg |
bool ArConfigArg::addToFileParser | ( | ArFileParser * | parser, |
ArRetFunctor3C< bool, ArConfig, ArArgumentBuilder *, char *, size_t > * | parserCB, | ||
const char * | logPrefix = "" , |
||
bool | isQuiet = false |
||
) | const |
Adds given parserCB handler for the appropriate keyword(s) to the given file parser.
For normal args, this method simply adds the parserCB handler for the keyword (i.e.
arg name). For list args, this method adds the parserCB handler for all child arg names. The list arg itself is handled by ArConfig using the special keywords (_beginList and _endList).
parser | the ArFileParser * to which to add the handler |
parserCB | the ArFunctor * that will parse the arg when the keyword is found |
logPrefix | the char * prefix to use in debug log messages |
isQuiet | a bool set to true if minimal log messages should be generated; false if verbosity is desired. |
bool ArConfigArg::copyTranslation | ( | const ArConfigArg & | arg | ) |
Copies the translation data from given arg to this one.
The translation data currently consists of the description and the extra explanation.
const ArConfigArg * ArConfigArg::findArg | ( | const char * | childParamName | ) | const |
Finds the specified child arg. Valid only for LIST type; otherwise returns NULL.
This method performs a case-insensitive search of the child arg names.
childParamName | the char * name of the child arg to be retrieved; must be non-empty |
ArConfigArg * ArConfigArg::findArg | ( | const char * | childParamName | ) |
Finds the specified child arg. Valid only for LIST type; otherwise returns NULL.
This method performs a case-insensitive search of the child arg names.
childParamName | the char * name of the child arg to be retrieved; must be non-empty |
const ArConfigArg * ArConfigArg::getArg | ( | size_t | index | ) | const |
Returns the child arg at the specified index (between 0 and getArgCount()).
size_t ArConfigArg::getArgCount | ( | ) | const |
Returns the number of child args. Valid only for LIST type; otherwise returns 0.
std::list< ArConfigArg > ArConfigArg::getArgs | ( | bool * | ok = NULL | ) | const |
Returns a list of all child args in this arg. Valid only for LIST type; otherwise returns an empty list.
ArPriority::Priority ArConfigArg::getConfigPriority | ( | void | ) | const |
std::string ArConfigArg::getCppString | ( | bool * | ok = NULL | ) | const |
Get a copy of the value of the target std::string.
(If there is a NULL target, return "" and set ok to false if ok is not NULL.)
const std::string * ArConfigArg::getCppStringPtr | ( | bool * | ok = NULL | ) | const |
Get the internal pointer to the target std::string.
Do not modify. (If there is a NULL target, return NULL and set ok to false if ok is not NULL.)
const char * ArConfigArg::getDescription | ( | void | ) | const |
Gets the brief description of the argument.
double ArConfigArg::getMaxDouble | ( | bool * | ok = NULL | ) | const |
Gets the maximum double value.
This method is applicable only when getType() returns DOUBLE.
ok | an optional pointer to a bool that can be set by this method to indicate success (true) or failure (false) |
int ArConfigArg::getMaxInt | ( | bool * | ok = NULL | ) | const |
Gets the maximum int value.
This method is applicable only when getType() returns INT.
ok | an optional pointer to a bool that can be set by this method to indicate success (true) or failure (false) |
double ArConfigArg::getMinDouble | ( | bool * | ok = NULL | ) | const |
Gets the minimum double value.
This method is applicable only when getType() returns DOUBLE.
ok | an optional pointer to a bool that can be set by this method to indicate success (true) or failure (false) |
int ArConfigArg::getMinInt | ( | bool * | ok = NULL | ) | const |
Gets the minimum int value.
This method is applicable only when getType() returns INT.
ok | an optional pointer to a bool that can be set by this method to indicate success (true) or failure (false) |
const char * ArConfigArg::getName | ( | void | ) | const |
Gets the name of the argument.
ArConfigArg * ArConfigArg::getParentArg | ( | ) | const |
Returns a pointer to the immediate parent arg. If this is not a child ArConfigArg, then returns NULL.
ArConfigArg::Type ArConfigArg::getType | ( | void | ) | const |
Gets the type of the argument.
bool ArConfigArg::hasArgs | ( | ) | const |
Returns whether the list contains child args. Valid only for LIST type; otherwise returns false.
void ArConfigArg::setConfigPriority | ( | ArPriority::Priority | priority | ) |
void ArConfigArg::setDisplayHint | ( | const char * | hintText | ) |
Sets the display hint for this arg.
The "display hint" is a text string that may be used by the client to improve the display of the argument.
Multiple, non-confilicting display hints may be specified by using the "&&" separator. For example: "Choices:High;;Low&&Visible:PinEnabled=true"
The display hints that are currently supported by MobileEyes and MobilePlanner are described below.
For all ArConfigArg types:
Visible:
OtherParamName=OtherParamValue
Visible:
OtherParamName!=OtherParamValue
Visible:
OtherParamName>OtherParamValue
Visible:
false
Editable:
OtherParamName=OtherParamValue
Editable:
OtherParamName!=OtherParamValue
Editable:
OtherParamName>OtherParamValue
Editable:
false
For type STRING:
Choices:
choice1(;;
choice::i)* "Choices:North;;South;;East;;West"
;;
. For example, "Choices:;;FirstNonEmpty;;SecondNonEmpty"
MapItem:
type|
(Parent
|SubType
|SubTypeAndParent
|SubTypeGlob
)|
(Optional
|Required
) "MapItem:Dock|Parent|Optional"
SubTypeGlob
is specified, then type may contain wildchar characters *
and ?
ChildObject:
type|
(Parent
|SubType
|SubTypeAndParent
|SubTypeGlob
)|
(Optional
|Required
) ParentTypeName_@_ParameterName_@_DefaultChildTypeName
. Macro:
taskClass1(;;
taskClass::i)*|(Optional
|Required
) Macro
Time:
format
Time
RobotFile:
fileFilterNames|
fileFilters Map files (*.map);;World files (*.wld)
), or, empty if no filter needs to be applied, and *.map;;*.wld"
). The number and order of these filters must match that of the fileFilterNames parameter. "RobotFile:Map Files (*.map);;World Files
(*.wld)|*.map;;*.wld"
"All audio files (*.ogg *.wav);;Ogg Vorbis files (*.ogg);;WAV files (*.wav);;*.ogg *.wav;;*.ogg;;*.wav"
For type INT:
Color
For type BOOL:
Checkbox
void ArConfigArg::setIgnoreBounds | ( | bool | ignoreBounds = false | ) |
Sets whether to ignore bounds or not (default is to not to)
This is for debugging and will prevent the bounds checking from happening, you shouldn't normally use it.
bool ArConfigArg::setString | ( | const char * | str, |
char * | errorBuffer = NULL , |
||
size_t | errorBufferLen = 0 , |
||
bool | doNotSet = false |
||
) |
Sets the argument value for string arguments.
bool ArConfigArg::setValue | ( | const ArConfigArg & | source, |
bool | isVerifyArgNames = false |
||
) |
If the given source is of the same type, copies its value to this arg.
Note that this method currently only works for the primitive arg types (i.e. int, bool, etc.). It doesn't copy functors or description holders.
source | the ArConfigArg whose value is to be copied to this arg |
isVerifyArgNames | a bool set to true if the argument value should be set only if the given source has the same name as this argument; the default value is false |
ArLog::log(ArLog::Verbose, "ArConfigArg::setValue() unverified names, cannot set %s to %s", getName(), source.getName());
bool ArConfigArg::writeArguments | ( | FILE * | file, |
char * | lineBuf, | ||
int | lineBufSize, | ||
int | startCommentColumn, | ||
bool | isWriteExtra = false , |
||
const char * | logPrefix = "" , |
||
int | indentLevel = 0 |
||
) | const |
Writes this arg to the given file, in a format suitable for reading by parseArgument.
file | the FILE * to be written, must be non-NULL |
lineBuf | a char array to be used as a temporary write buffer, must be non-NULL |
lineBufSize | the int number of chars in lineBuf, must be positive |
startCommentColumn | the int column index at which to indent the arg description / comment |
isWriteExtra | a bool set to true if the arg priority, display hint, restart level and other later extras should also be written to the file |
logPrefix | the char * prefix to use in debug log messages, must be non-NULL |
indentLevel | the int level of indentation for the arg (children of lists are indented further); must be non-negative |
bool ArConfigArg::writeBounds | ( | char * | line, |
size_t | lineLen, | ||
const char * | logPrefix = "" |
||
) | const |
Writes the min/max values of this arg to the given buffer, as applicable.
line | a char array to be used as a temporary write buffer, must be non-NULL |
lineLen | the int number of chars in line, must be positive |
logPrefix | the char * prefix to use in debug log messages, must be non-NULL |
|
staticprotected |
Writes the given comment to the specified file, spanning multiple lines as necessary.
comment | the char * string to be written to the file, must be non-NULL |
file | the FILE * to be written, must be non-NULL |
lineBuf | a char array to be used as a temporary write buffer, must be non-NULL |
lineBufSize | the int number of chars in lineBuf, must be positive |
startComment | the char * text that should prefix the comment on the first line |
bool ArConfigArg::writeName | ( | char * | lineBuf, |
int | lineBufSize, | ||
int | indentLevel | ||
) | const |
Writes the name of this arg to the given buffer, indenting as specified.
lineBuf | a char array to which to write the name, must be non-NULL |
lineBufSize | the int number of chars in lineBuf, must be positive |
indentLevel | the int level of indentation for the arg (children of lists are indented further); must be non-negative |