Rik's Treehouse > Babbling in Binary > My Software > Orphanware > R2DToo > R2DToo Help > For the Programmer > getParamAbout

getParamAbout

Declaration
Parameters
Return Value
Remarks
Revisions
Example
See Also

Declaration

char* __stdcall getParamAbout(
	char* name    // name of parameter
);
Top of page

Parameters

name
Name of parameter of interest.
Top of page

Return Value

A character string returning information on parameter with name name. Top of page

Remarks

This optional function may be provided by the model. For each valid parameter name (neglecting properties) the function should return a character string with background information on that model parameter. The information is displayed in R2DToo's "New Simulation" dialog box to help the user.

You may want to read the parameter values from within getParamAbout. If so, always use getParamVal and never use the getParamRef! This is because getParamAbout is intended to be used while the "New Simulation" dialog is being displayed, and the parameters shown there are only copies of the actual parameters. getParamRef will return pointers to the actual parameters, not the copies being displayed and manipulated in the dialog. getParamVal does not have this problem, it knows when the dialog is open and returns the appropriate results. See the example for a demonstration. Top of page


Revisions

API v1.5
  • new! Replaces aboutParam.
Top of page

Example

#include <string.h> // for strcmp(a,b) which returns 0 if a==b //--------------------------------------------------------------------------- char* __stdcall getParamAbout(char* name) { if (!strcmp(name,"World Width")) return "Columns of agents across the grid."; if (!strcmp(name,"World Height")) return "Rows of agents down the grid."; if (!strcmp(name,"Neighbourhood Type")) { switch(int(getParamVal(name))) { case 0: return "Non-spatial, all agents can interact."; case 1: return "1 dimension (horizontal). Periodic boundaries. " "Each row is separate."; case 2: return "2 dimensions, Moore neighbourhood. 4 nearest and " "4 diagonal neighbours. Periodic boundaries."; case 3: return "Symmetric Erdos-Renyi random graph. Links are " "reciprocal."; case 4: return "Deterministic scale-free network with clustering."; } } if (!strcmp(name,"Neighbourhood Range")) { switch(int(getParamVal("Neighbourhood Type"))) { case 0: return "Disregarded."; case 1: return "(Rounded down to integer value.) Number of " "neighbours on each side. Total # neighbours = " "2*range."; case 2: return "(Rounded down to integer value.) Range of " "neighbourhood. Total # neighbours = " "(2*range+1)^2-1."; case 3: return "Average number of links per node."; case 4: return "(Rounded down to integer value.) Length of " "smallest clusters (squares)."; } } return "Unknown."; } //--------------------------------------------------------------------------- Top of page

See Also

getModelAbout, getAgentAbout, getParamVal.
Top of page
[Rik's Office Hours] [Contact Rik]
Last updated: Fri Apr 30 2004, 1:39pm