@ -124,14 +124,18 @@ namespace storm {
Scope scope ( name ) ;
// Parse constants
size_t constantsCount = parsedStructure . count ( " constants " ) ;
ConstantsMap constants ;
scope . constants = & constants ;
size_t constantsCount = parsedStructure . count ( " constants " ) ;
STORM_LOG_THROW ( constantsCount < 2 , storm : : exceptions : : InvalidJaniException , " Constant-declarations can be given at most once. " ) ;
if ( constantsCount = = 1 ) {
for ( auto const & constStructure : parsedStructure . at ( " constants " ) ) {
std : : shared_ptr < storm : : jani : : Constant > constant = parseConstant ( constStructure , scope . refine ( " constants[ " + std : : to_string ( constants . size ( ) ) + " ] " ) ) ;
constants . emplace ( constant - > getName ( ) , & model . addConstant ( * constant ) ) ;
model . addConstant ( * constant ) ;
}
// Insert references after adding all constants to make sure that they remain valid
for ( auto const & constant : model . getConstants ( ) ) {
constants . emplace ( constant . getName ( ) , & constant ) ;
}
}