Source code for simind_python_connector.connectors.base

"""Abstract connector contract shared by all connector/adaptor implementations."""

from __future__ import annotations

from abc import ABC, abstractmethod
from typing import Any, Dict, Mapping

from simind_python_connector.core.config import SimulationConfig


[docs] class BaseConnector(ABC): """Minimal interface for all SIMIND connector styles."""
[docs] @abstractmethod def add_config_value(self, index: int, value: Any) -> None: """Set a SIMIND config value by index."""
[docs] @abstractmethod def add_runtime_switch(self, switch: str, value: Any) -> None: """Set one runtime switch."""
[docs] def set_runtime_switches(self, switches: Mapping[str, Any]) -> None: """Set multiple runtime switches.""" for switch, value in switches.items(): self.add_runtime_switch(switch, value)
[docs] @abstractmethod def run(self, *args: Any, **kwargs: Any) -> Any: """Execute simulation and return connector-native outputs."""
[docs] @abstractmethod def get_outputs(self) -> Dict[str, Any]: """Return outputs from the latest successful run."""
[docs] @abstractmethod def get_config(self) -> SimulationConfig: """Return active simulation configuration."""
__all__ = ["BaseConnector"]