12#ifndef SST_CORE_CORETEST_MESSAGEMESH_ENCLOSINGCOMPONENT_H
13#define SST_CORE_CORETEST_MESSAGEMESH_ENCLOSINGCOMPONENT_H
15#include "sst/core/testElements/message_mesh/messageEvent.h"
17#include "sst/core/component.h"
18#include "sst/core/event.h"
19#include "sst/core/link.h"
20#include "sst/core/rng/rng.h"
21#include "sst/core/ssthandler.h"
22#include "sst/core/subcomponent.h"
26namespace SST::CoreTest::MessageMesh {
33 explicit PortInterface(ComponentId_t
id) :
36 virtual ~PortInterface() {}
62 template <
typename classT,
typename dataT =
void>
84 template <
typename classT, auto funcT,
typename dataT =
void>
87 virtual void setNotifyOnReceive(
HandlerBase* functor) { rFunctor = functor; }
100 explicit RouteInterface(ComponentId_t
id) :
103 virtual ~RouteInterface() {}
105 virtual void send(
MessageEvent* ev,
int incoming_port) = 0;
112 SST_ELI_REGISTER_COMPONENT(
115 "message_mesh.enclosing_component",
116 SST_ELI_ELEMENT_VERSION(1,0,0),
117 "Base element that encloses the SubComponents that actually provide the functionality",
118 COMPONENT_CATEGORY_NETWORK
121 SST_ELI_DOCUMENT_PARAMS(
122 {
"id",
"Id for this componentd",
""},
125 SST_ELI_DOCUMENT_STATISTICS(
128 SST_ELI_DOCUMENT_PORTS(
131 SST_ELI_DOCUMENT_SUBCOMPONENT_SLOTS(
132 {
"ports",
"Slot that the ports objects go in",
"SST::CoreTest::MessageMesh::PortInterface" },
133 {
"route",
"Slot that the ports objects go in",
"SST::CoreTest::MessageMesh::RouteInterface" }
138 void setup()
override;
144 std::vector<PortInterface*> ports;
153class PortSlot :
public PortInterface
157 SST_ELI_REGISTER_SUBCOMPONENT(
160 "message_mesh.port_slot",
161 SST_ELI_ELEMENT_VERSION(1,0,0),
162 "SubComponent implementing PortInterface that simply defers to another loaded PortInterface",
166 SST_ELI_DOCUMENT_PARAMS(
169 SST_ELI_DOCUMENT_STATISTICS(
172 SST_ELI_DOCUMENT_PORTS(
175 SST_ELI_DOCUMENT_SUBCOMPONENT_SLOTS(
176 {
"port",
"Slot to load the real PortInterface object",
"SST::CoreTest::MessageMesh::PortInterface" }
179 PortSlot(ComponentId_t
id,
Params& params);
182 void send(
MessageEvent* ev)
override { port->send(ev); }
183 void setNotifyOnReceive(
HandlerBase* functor)
override { port->setNotifyOnReceive(functor); }
194 SST_ELI_REGISTER_SUBCOMPONENT(
197 "message_mesh.message_port",
198 SST_ELI_ELEMENT_VERSION(1,0,0),
199 "SubComponent implementing PortInterface for sending and receiving messages",
203 SST_ELI_DOCUMENT_PARAMS(
206 SST_ELI_DOCUMENT_STATISTICS(
209 SST_ELI_DOCUMENT_PORTS(
210 {
"port",
"Port to send or receive on", {
"" } },
213 SST_ELI_DOCUMENT_SUBCOMPONENT_SLOTS(
220 void handleEvent(
Event* ev);
230 SST_ELI_REGISTER_SUBCOMPONENT(
233 "message_mesh.route_message",
234 SST_ELI_ELEMENT_VERSION(1,0,0),
235 "SubComponent implementing message routing",
239 SST_ELI_DOCUMENT_PARAMS(
242 SST_ELI_DOCUMENT_STATISTICS(
243 {
"msg_count",
"Message counter",
"count", 1},
246 SST_ELI_DOCUMENT_PORTS(
249 SST_ELI_DOCUMENT_SUBCOMPONENT_SLOTS(
252 RouteMessage(ComponentId_t
id,
Params& params,
const std::vector<PortInterface*>& ports,
int my_id);
255 void send(
MessageEvent* ev,
int incoming_port)
override;
258 const std::vector<PortInterface*> ports;
Main component object for the simulation.
Definition component.h:31
Definition enclosingComponent.h:109
void finish() override
Called after complete phase, but before objects are destroyed.
Definition enclosingComponent.cc:72
void setup() override
Called after all components have been constructed and initialization has completed,...
Definition enclosingComponent.cc:60
Definition messageEvent.h:20
Definition enclosingComponent.h:191
Definition enclosingComponent.h:29
SSTHandler2< void, Event *, classT, dataT, funcT > Handler2
Used to create checkpointable handlers to notify the component when a message has arrived.
Definition enclosingComponent.h:85
SSTHandlerBase< void, Event * > HandlerBase
Base handler for event delivery.
Definition enclosingComponent.h:41
SSTHandler< void, Event *, classT, dataT > Handler
Used to create handlers to notify the component when a message has arrived.
Definition enclosingComponent.h:63
Definition enclosingComponent.h:96
Definition enclosingComponent.h:227
Base class for Events - Items sent across links to communicate between components.
Definition event.h:35
Link between two components.
Definition link.h:55
Parameter store.
Definition params.h:58
Implements the base class for random number generators for the SST core.
Definition rng.h:29
Base template for the class.
Definition ssthandler.h:1274
Base template for handlers which take a class defined argument.
Definition ssthandler.h:110
Handler class with user-data argument.
Definition ssthandler.h:1137
Forms the template defined base class for statistics gathering within SST.
Definition statbase.h:373
SubComponent is a class loadable through the factory which allows dynamic functionality to be added t...
Definition subcomponent.h:29