Skip to main content

SST_ELI_REGISTER_SUBCOMPONENT_API

SST_ELI_REGISTER_SUBCOMPONENT_API(class_name)
SST_ELI_REGISTER_SUBCOMPONENT_API(class_name, ...)

SubComponents implement a specific API and SubComponent slots require any SubComponents loaded into them to implement a specific API. This macro registers SubComponent APIs with SST Core. If a SubComponent API inherits from another registered SubComponent API (as opposed to, for example, SST::SubComponent directly), the API should instead register using the SST_ELI_REGISTER_SUBCOMPONENT_DERIVED_API macro.

Important

This macro must reside in a public section of the SubComponent API's header file.

Parameters​

  • class_name (class) The name of the SubComponent API class. This is not a string.
  • ... (types, optional) Additional constructor argument types, after the required SST::ComponentId_t and SST::Params&, that every SubComponent implementing this API must accept. Loaders pass the values as the trailing args of loadUserSubComponent or loadAnonymousSubComponent. For example, SST_ELI_REGISTER_SUBCOMPONENT_API(SST::Merlin::Topology, int, int, int) requires constructors of the form (ComponentId_t id, Params& params, int, int, int).

Example​

class basicSubComponentAPI : public SST::SubComponent
{
public:
/*
* Register this API with SST so that SST can match subcomponent slots to subcomponents
*/
SST_ELI_REGISTER_SUBCOMPONENT_API(SST::simpleElementExample::basicSubComponentAPI)

basicSubComponentAPI(ComponentId_t id, Params& params) : SubComponent(id) { }
virtual ~basicSubComponentAPI() { }

// These are the two functions described in the comment above
virtual int compute( int num ) =0;
virtual std::string compute( std::string comp) =0;
};
#include <sst/core/subcomponent.h>