spec_level

can somebody tell me how to get the “spec_level” from an effect? i’ve gotten this far (below code, which is not yielding correct results obviously), but can’t get the actual float value.

i’m kind of paraphrasing with the code here…

daeString typeName = children[j]->getTypeName ();
daeString elementName = children[j]->getElementName ();
domAnyRef any = NULL;
if (!strcmp (typeName, “any”))
{
any = (domAnyRef)&children[j];
}

if (any && !strcmp (elementName, “spec_level”))
{
//daeString value = any->getValue ();
daeMemoryRef memRef = any->getValuePointer ();
if (memRef)
{
effect->spec_level = *memRef;
}
}

Once you have the corresponding domAny object you can use getValue to get the element’s content. The DOM doesn’t know the element is supposed to be a float, so you need to convert it from a string to a float yourself:

#include <sstream>

std::istringstream stream(any->getValue());
float specLevel;
stream >> specLevel;