UDQ: add function for string name of UDQ variable types

This commit is contained in:
Joakim Hove
2019-06-13 14:40:50 +02:00
parent fac74432d4
commit 9087323265
2 changed files with 28 additions and 0 deletions

View File

@@ -113,6 +113,7 @@ namespace UDQ {
bool scalarFunc(UDQTokenType token_type);
bool cmpFunc(UDQTokenType token_type);
std::string typeName(UDQVarType var_type);
}
}

View File

@@ -241,6 +241,33 @@ bool compatibleTypes(UDQVarType lhs, UDQVarType rhs) {
return false;
}
std::string typeName(UDQVarType var_type) {
switch (var_type) {
case UDQVarType::NONE:
return "NONE";
case UDQVarType::SCALAR:
return "SCALAR";
case UDQVarType::WELL_VAR:
return "WELL_VAR";
case UDQVarType::CONNECTION_VAR:
return "CONNECTION_VAR";
case UDQVarType::FIELD_VAR:
return "FIELD_VAR";
case UDQVarType::GROUP_VAR:
return "GROUP_VAR";
case UDQVarType::REGION_VAR:
return "REGION_VAR";
case UDQVarType::SEGMENT_VAR:
return "SEGMENT_VAR";
case UDQVarType::AQUIFER_VAR:
return "AQUIFER_VAR";
case UDQVarType::BLOCK_VAR:
return "BLOCK_VAR";
default:
throw std::runtime_error("Should not be here");
}
}
}
}