Skip to content

Preparation for environments in other libraries - #1036

Open
volkm wants to merge 2 commits into
stormchecker:masterfrom
volkm:environments
Open

Preparation for environments in other libraries#1036
volkm wants to merge 2 commits into
stormchecker:masterfrom
volkm:environments

Conversation

@volkm

@volkm volkm commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Preparation to use storm::Environment in other libraries such as storm-dft.

It required to move the function implementation of SubEnvironment from the cpp to the header file. Otherwise the instantiations of the form SubEnvironment<XEnvironment> are not possible.
To avoid re-instantiation for each include, we define all instantiations in CoreEnvironments.cpp. The relevant header files also use extern template class SubEnvironment<XEnvironment>;.
Note that the member functions are declared inside the SubEnvironment class but defined out-of-line afterwards. This is needed because extern template class otherwise still implicitly inlines and instantiates member functions. I did not check the impact on the compilation though.

Also sorted environments alphabetically for easier maintenance.

@sjunges

sjunges commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Do we expect other (Storm) libraries to extend the environment, or to wrap the environment?

@volkm

volkm commented Aug 25, 2026

Copy link
Copy Markdown
Contributor Author

To wrap the environment. #1037 is the adaption in storm-dft, see for example here

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The template/extern-template refactor appears consistent and complete, with explicit instantiations centralized and corresponding extern template declarations added where needed.

Pull request overview

This PR prepares Storm’s core storm::Environment (and its sub-environments) for consumption in other libraries (e.g., storm-dft) by moving SubEnvironment’s template member function definitions into the header and centralizing explicit template instantiations in CoreEnvironments.cpp to avoid redundant instantiations across translation units.

Changes:

  • Moved SubEnvironment member function implementations into SubEnvironment.h (out-of-class definitions) to enable cross-library template instantiations.
  • Added extern template class SubEnvironment<...>; declarations in core environment headers and consolidated the corresponding explicit instantiations in CoreEnvironments.cpp.
  • Reordered/organized environment declarations and accessors (mostly alphabetical) for easier maintenance.
File summaries
File Description
src/storm/environment/SubEnvironment.h Moves template method definitions into the header (out-of-class) to enable external template instantiation usage.
src/storm/environment/solver/SolverEnvironment.h Adds extern template declarations for solver sub-environments and reorders declarations/accessors.
src/storm/environment/solver/SolverEnvironment.cpp Reorders method definitions to match the reorganized header layout.
src/storm/environment/solver/MinMaxSolverEnvironment.h Adds extern template for LP sub-environment and reorganizes lp() accessors/member placement.
src/storm/environment/modelchecker/ModelCheckerEnvironment.h Adds extern template declarations for model-checker sub-environments.
src/storm/environment/Environment.h Reorders sub-environment members/accessors and declares extern template specializations for core environment types.
src/storm/environment/Environment.cpp Reorders environment accessor implementations to match header organization.
src/storm/environment/dd/DdEnvironment.h Adds extern template declarations for DD manager sub-environments and reorders declarations/members.
src/storm/environment/CoreEnvironments.cpp Centralizes explicit instantiations for SubEnvironment<...> specializations used across core and other libraries.
Review details
  • Files reviewed: 9/9 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants