TORCS  1.3.9
The Open Racing Car Simulator
Parameter Data Handling API

Handling of data in parameter sets. More...

Collaboration diagram for Parameter Data Handling API:

Functions

void GfParmRemove (void *parmHandle, char *sectionName, char *paramName)
 Remove a parameter from a parameter set. More...
 
tdble GfParmUnit2SI (const char *unit, tdble val)
 Convert a value given in unit to SI. More...
 
tdble GfParmSI2Unit (const char *unit, tdble val)
 Convert a value from SI to given unit. More...
 
char * GfParmGetName (void *handle)
 Get the name property of the parameter set handle. More...
 
const char * GfParmGetStr (void *parmHandle, const char *path, const char *key, const char *deflt)
 Get a string parameter from the parameter set handle. More...
 
tdble GfParmGetNum (void *handle, const char *path, const char *key, const char *unit, tdble deflt)
 Get a numerical parameter from the parameter set handle. More...
 
int GfParmSetStr (void *handle, const char *path, const char *key, const char *val)
 Set a string parameter in the parameter set handle. More...
 
int GfParmSetNum (void *handle, const char *path, const char *key, const char *unit, tdble val)
 Set a numerical parameter in the parameter set handle. More...
 
int GfParmSetNumEx (void *handle, const char *path, const char *key, const char *unit, tdble val, tdble min, tdble max)
 Set a numerical parameter in the parameter set handle including min and max. More...
 
int GfParmGetNumBoundaries (void *handle, const char *path, const char *key, tdble *min, tdble *max)
 Get the min and max of a numerical parameter from the parameter set handle. More...
 

Detailed Description

Handling of data in parameter sets.

Function Documentation

◆ GfParmGetName()

char* GfParmGetName ( void *  handle)

Get the name property of the parameter set handle.

Parameters
[in]handleparameter set handle
Returns
Name
NULL if failed or not set
Note
The pointer returned is for immediate use, if you plan to keep the value for a long time, it is necessary to copy the string, because manipulating the handle will produce an incoherent pointer.

Definition at line 2057 of file params.cpp.

Here is the call graph for this function:

◆ GfParmGetNum()

tdble GfParmGetNum ( void *  handle,
const char *  path,
const char *  key,
const char *  unit,
tdble  deflt 
)

Get a numerical parameter from the parameter set handle.

If the parameter does not exist the given default value is returned without unit conversion.

Parameters
[in]handleparameter set handle
[in]pathpath of the parameter
[in]keyparameter key name
[in]unitunit to convert the result to (NULL if SI is desired)
[in]defltdefault value
Returns
parameter value

Definition at line 2392 of file params.cpp.

Here is the call graph for this function:

◆ GfParmGetNumBoundaries()

int GfParmGetNumBoundaries ( void *  handle,
const char *  path,
const char *  key,
tdble min,
tdble max 
)

Get the min and max of a numerical parameter from the parameter set handle.

Parameters
[in]handleparameter set handle
[in]pathpath of the parameter
[in]keyparameter key name
[out]minReceives the min value
[out]maxReceives the max value
Returns
0 Ok
-1 Parameter does not exist

Definition at line 3101 of file params.cpp.

Here is the call graph for this function:

◆ GfParmGetStr()

const char* GfParmGetStr ( void *  parmHandle,
const char *  path,
const char *  key,
const char *  deflt 
)

Get a string parameter from the parameter set handle.

If the parameter does not yet exist the given default is returned.

Parameters
[in]parmHandleparameter set handle
[in]pathpath of the parameter
[in]keyparameter key name
[in]defltdefault string
Returns
parameter value
deflt if error or not found
Note
The pointer returned is for immediate use, if you plan to keep the value for a long time, it is necessary to copy the string, because removing the attribute will produce an incoherent pointer.

Definition at line 2311 of file params.cpp.

Here is the call graph for this function:

◆ GfParmRemove()

void GfParmRemove ( void *  parmHandle,
char *  sectionName,
char *  paramName 
)

Remove a parameter from a parameter set.

Parameters
parmHandleparameter set handle
sectionNameparameter section name
paramNameparameter name

Definition at line 1698 of file params.cpp.

Here is the call graph for this function:

◆ GfParmSetNum()

int GfParmSetNum ( void *  handle,
const char *  path,
const char *  key,
const char *  unit,
tdble  val 
)

Set a numerical parameter in the parameter set handle.

If the parameter does not yet exist it is created. The value is assigned to the value, min and max.

Parameters
[in,out]handleparameter set handle
[in]pathpath of the parameter
[in]keyparameter key name
[in]unitunit to convert the result to (NULL if SI desired)
[in]valvalue to set
Returns
0 ok
-1 error

Definition at line 2586 of file params.cpp.

Here is the call graph for this function:

◆ GfParmSetNumEx()

int GfParmSetNumEx ( void *  handle,
const char *  path,
const char *  key,
const char *  unit,
tdble  val,
tdble  min,
tdble  max 
)

Set a numerical parameter in the parameter set handle including min and max.

Parameters
[in,out]handleparameter set handle
[in]pathpath of the parameter
[in]keyparameter key name
[in]unitunit to convert the result to (NULL if SI desired)
[in]valvalue to set
[in]minmin value to set
[in]maxmax value to set
Returns
0 ok
-1 error

Definition at line 2629 of file params.cpp.

Here is the call graph for this function:

◆ GfParmSetStr()

int GfParmSetStr ( void *  handle,
const char *  path,
const char *  key,
const char *  val 
)

Set a string parameter in the parameter set handle.

If the parameter does not yet exist it is created. The within constraint is not checked.

Parameters
[in,out]handleparameter set handle
[in]pathpath of the parameter
[in]keyparameter key name
[in]valvalue (NULL or empty string to remove the parameter)
Returns
0 ok
-1 error

Definition at line 2477 of file params.cpp.

Here is the call graph for this function:

◆ GfParmSI2Unit()

tdble GfParmSI2Unit ( const char *  unit,
tdble  val 
)

Convert a value from SI to given unit.

Parameters
[in]unitunit name to convert to
[in]valvalue in SI units to be converted to unit
Returns
converted value in unit
See also
GfParmUnit2SI

Definition at line 1998 of file params.cpp.

Here is the call graph for this function:

◆ GfParmUnit2SI()

tdble GfParmUnit2SI ( const char *  unit,
tdble  val 
)

Convert a value given in unit to SI.

The units can be combined with "/" (divide), "." (multiply) and "2" (square), e.g. "lbf/in", "N.m", "kg.m/s2".

Parameters
[in]unitunit name from val
[in]valvalue in unit
Returns
the value converted to SI
Note
The supported units are:
  • feet or ft converted to m
  • inches,inch or in converted to m
  • km converted to m
  • cm converted to m
  • mm converted to m
  • lbs converted to kg
  • slug or slugs converted to kg
  • h,hour or hours converted to s
  • day or days converted to s
  • kPa or MPa converted to Pa
  • PSI or psi converted to Pa
  • deg converted to rad
  • rpm or RPM converted to rad/s
  • percent or % divided by 100
  • lbf converted to N
See also
GfParmSI2Unit

Definition at line 1944 of file params.cpp.

Here is the call graph for this function: