AddStringItem Method

WRAPPER_API bool AddStringItem(const BmgChar *name, bool optional = false)

 

Description

The AddStringItem method adds a new string parameter to the ParameterCollection.  The method takes two arguments, the first of which gives the name of the parameter.  The second argument is optional, and it indicates if the parameter is an optional or a required parameter.  The method returns a boolean value indicating the success of the operation.  The value of the added parameter is the empty string.  This value can be set with the set_StringItem method.

 

Example

void ParameterCollection_AddStringItem()

{

GEOCALCPBW_NAMESPACE::ParameterCollection pc;

 

BmgChar * angularParName = L"AngularParameter";

GEOCALCPBW_NAMESPACE::AngularValue angularVal;

pc.AddAngularItem(angularParName);

pc.set_AngularItem(angularParName, angularVal);

GEOCALCPBW_NAMESPACE::AngularValue * av = pc.get_AngularItem(angularParName);

delete av;

 

BmgChar * floatParName = L"FloatParameter";

double floatVal = 12.34;

pc.AddFloatItem(floatParName);

pc.set_FloatItem(floatParName, floatVal);

floatVal = pc.get_FloatItem(floatParName);

 

BmgChar * intParName = L"IntegerParameter";

int intVal = 54;

pc.AddIntegerItem(intParName);

pc.set_IntegerItem(intParName, intVal);

intVal = pc.get_IntegerItem(intParName);

 

BmgChar * linearParName = L"LinearParameter";

GEOCALCPBW_NAMESPACE::LinearValue linearVal;

pc.AddLinearItem(linearParName);

pc.set_LinearItem(linearParName, linearVal);

GEOCALCPBW_NAMESPACE::LinearValue * lv = pc.get_LinearItem(linearParName);

delete lv;

 

BmgChar * stringParName = L"StringParameter";

BmgChar * stringVal = L"A Value";

pc.AddStringItem(stringParName);

pc.set_StringItem(stringParName, stringVal);

stringVal = const_cast<BmgChar *>(pc.get_StringItem(stringParName));

}