void XYStateVariables::decode(Variables *var, RawVariables *raw) { for (RawVariables::iterator ra = raw->begin(); ra != raw->end(); ++ra) { Models models = find<Model*>(ra->modelPath); int noOfVariables = 0; for (Models::iterator mo = models.begin(); mo != models.end(); ++mo) { if (ra->stateName == "*") { for (Model::States::const_iterator st = (*mo)->states().begin(); st != (*mo)->states().end(); ++st) { Identifier stateId = st.key(); Variable v = {ra->variableName, stateId.key(), *mo, st.value()}; var->append(v); ++noOfVariables; } } else { const double *statePtr = (*mo)->statePtr(ra->stateName); if (statePtr) { Variable v = {ra->variableName, ra->stateName, *mo, statePtr}; var->append(v); ++noOfVariables; } } } if (noOfVariables == 0) throw Exception("Could not find variable: " + rawVariableAsText(*ra)); } }
bool operator==(const Identifier &id1, const Identifier &id2) { return id1.key() == id2.key(); }
bool operator<(const Identifier &id1, const Identifier &id2) { return id1.key() < id2.key(); }
uint qHash(Identifier id) { return qHash(id.key()); }