double PlanSimSubpanel::getDouble(const vle::value::Matrix& view, unsigned int col, unsigned int row, bool error_message) { if (not view.get(col, row)) { if (error_message) { mLog->logExt(QString("output '%1' is null") .arg(view.getString(col, 0).c_str()), true); } return 0; } else if (view.get(col, row)->isInteger()) { return (double)view.getInt(col, row); } else if (view.get(col, row)->isDouble()) { return (double)view.getDouble(col, row); } else { if (error_message) { mLog->logExt(QString("output '%1' is neither an int nor a double") .arg(view.getString(col, 0).c_str()), true); } return 0; } }
va::ConstVectorView getColumnFromView(const va::Matrix& view, const std::string& model, const std::string& port) { for(unsigned int j=1; j < view.columns(); j++){ if(view.getString(j,0) == (model + std::string(".") + port)){ return view.column(j); } } return view.column(0); }
QString PlanSimSubpanel::getString(const vle::value::Matrix& view, unsigned int col, unsigned int row, bool error_message) { if (not view.get(col, row)) { if (error_message) { mLog->logExt(QString("output '%1' is null") .arg(view.getString(col, 0).c_str()), true); } return 0; } else if (view.get(col, row)->isString()) { return QString::fromStdString((std::string)view.getString(col, row)); } else { if (error_message) { mLog->logExt(QString("output '%1' is not a string") .arg(view.getString(col, 0).c_str()), true); } return 0; } }