how to interface two components - researcherben/structural-simulation-toolkit GitHub Wiki

There are two ways to interface between components written by two programmers A & B:

  1. They agree on a common event type. Programmer A includes a port in their component that expects that event type. Programmer B does the same. This works well for situations where the interface is a simple event exchange. The interface is documented using the SST_ELI_DOCUMENT_PORTS call to specify which event types are expected.
  2. They agree on a common SubComponent API. Programmer A’s component expects to interface with a SubComponent of this type, and implements a SubComponent slot to load one. A’s component interfaces with the subcomponent via the public function calls in the API. Programmer B creates a SubComponent implementing the API. Probably, the SubComponent will have a port that talks to programmer B’s component, but that’s hidden from the API and programmer A’s component. This works well in situations where the interface is more complex. When configuring, the user tells A’s component to load B’s subcomponent and connects B’s subcomponent to B’s component. The interface is documented with SST_ELI_DOCUMENT_SUBCOMPONENT_SLOTS (programmer A’s component), SST_ELI_REGISTER_SUBCOMPONENT_API (the common API they defined), and SST_ELI_REGISTER_SUBCOMPONENT (programmer B’s subcomponent).