Skip to main content

constructor

// Subclass constructor
ComponentExtensionClassName(SST::ComponentId_t id, ...);
// Base SST::ComponentExtension class constructor
SST::ComponentExtension::ComponentExtension(SST::ComponentId_t id);

Availability: ComponentExtension SST calls this constructor when a ComponentExtension is loaded.

Parameters

  • id (ComponentId_t) A unique ID generated by SST for each component.
  • ... (Variable) Arguments specific to this class's constructor. These are provided by the Component that loads the extension.
  • returns (ComponentExtension*) The newly constructed component

Example

Excerpt from sst-elements/src/sst/elements/memHierarchy/mshr.h
#include <sst/core/componentextension.h>

/* The MSHR is really just a buffer that a cache uses but it is useful to be able to access
* some of the simulation time functions available to components. We could make this a subcomponent
* but it doesn't need to be available to users to swap dynamically.
*/
class MSHR : public SST::ComponentExtension
{
public:
// No ELI needed

// id is passed automatically by SST when loaded, the rest of the args are provided by the Component
// that loads this extension
MSHR(ComponentId_t id, Output* dbg, int maxSize, std::string cacheName, std::set<Addr> debugAddr);
virtual ~MSHR() {}

int getMaxSize();
int getSize();

/* Rest of class here */

};
Excerpt from sst-elements/src/sst/elements/memHierarchy/mshr.cc
#include <sst_config.h>
#include "mshr.h"

MSHR::MSHR(ComponentId_t id, Output* debug, int maxSize, string cacheName, std::set<Addr> debugAddr) :
ComponentExtension(id)
{
/* Constructor here */
}

/* Rest of functions defined here */

#include <sst/core/componentExtension.h>