from gpilib2.rpc import rpc
from typing import List, Any
[docs]class generic_gpi_assembly:
"""Base class for various collections of components that take generic commands
Attributes
rpc (:py:class:`~gpilib2.rpc`):
rpc object for communications
comonents (list):
List of component objects
"""
def __init__(self, rpc: rpc) -> None:
"""Define all components
Args:
rpc (:py:class:`~gpilib2.rpc`):
rpc object. sim status and verbosity will be set
based on its settings.
"""
self.rpc = rpc
if not hasattr(self, "components"):
self.components = [] # type: List[Any]
def __str__(self) -> str:
"""assemble all component strings"""
return "\n".join([c.__str__() for c in self.components])
[docs] def init_all(self) -> None:
"""Init all components"""
for component in self.components:
component.init(queue=True)
self.rpc.execute_queue()
[docs] def datum_all(self) -> None:
"""Datum all components"""
for component in self.components:
component.datum(queue=True)
self.rpc.execute_queue()