12 #ifndef _SST_CORE_FACTORY_H
13 #define _SST_CORE_FACTORY_H
15 #include <sst/core/sst_types.h>
20 #include <sst/core/params.h>
21 #include <sst/core/elemLoader.h>
22 #include <sst/core/element.h>
23 #include <sst/core/statapi/statoutput.h>
26 extern int main(
int argc,
char **argv);
42 static Factory* getFactory() {
return instance; }
48 const std::vector<std::string>* GetComponentAllowedPorts(std::string type);
57 Component* CreateComponent(ComponentId_t
id, std::string &componentname,
65 Introspector* CreateIntrospector(std::string &introspectorname,
71 void RequireEvent(std::string eventname);
90 Module* CreateCoreModule(std::string type,
Params& params);
108 partitionFunction GetPartitioner(std::string name);
113 generateFunction GetGenerator(std::string name);
154 genPythonModuleFunction getPythonModule(std::string name);
156 bool hasLibrary(std::string elemlib);
157 void requireLibrary(std::string &elemlib);
159 void getLoadedLibraryNames(std::set<std::string>& lib_names);
160 void loadUnloadedLibraries(
const std::set<std::string>& lib_names);
167 StatisticOutput* CreateStatisticOutput(
const std::string& statOutputType,
const Params& statOutputParams);
174 bool DoesComponentInfoStatisticNameExist(
const std::string& type,
const std::string& statisticName);
181 bool DoesSubComponentInfoStatisticNameExist(
const std::string& type,
const std::string& statisticName);
188 uint8_t GetComponentInfoStatisticEnableLevel(
const std::string& type,
const std::string& statisticName);
195 std::string GetComponentInfoStatisticUnits(
const std::string& type,
const std::string& statisticName);
198 Module* LoadCoreModule_StatisticOutputs(std::string& type,
Params& params);
200 friend int ::main(
int argc,
char **argv);
202 struct ComponentInfo {
205 std::vector<std::string> ports;
206 std::vector<std::string> statNames;
207 std::vector<std::string> statUnits;
208 std::vector<uint8_t> statEnableLevels;
213 component(component), params(params)
216 while ( NULL != p && NULL != p->
name ) {
217 ports.push_back(p->
name);
222 while ( NULL != s && NULL != s->
name ) {
223 statNames.push_back(s->
name);
224 statUnits.push_back(s->
units);
230 ComponentInfo(
const ComponentInfo& old) : component(old.component), params(old.params), ports(old.ports),
231 statNames(old.statNames), statUnits(old.statUnits), statEnableLevels(old.statEnableLevels)
234 ComponentInfo& operator=(
const ComponentInfo& old)
236 component = old.component;
239 statNames = old.statNames;
240 statUnits = old.statUnits;
241 statEnableLevels = old.statEnableLevels;
246 struct IntrospectorInfo {
250 IntrospectorInfo() {}
256 IntrospectorInfo(
const IntrospectorInfo& old) : introspector(old.introspector), params(old.params)
259 IntrospectorInfo& operator=(
const IntrospectorInfo& old)
261 introspector = old.introspector;
278 ModuleInfo(
const ModuleInfo& old) : module(old.module), params(old.params)
281 ModuleInfo& operator=(
const ModuleInfo& old)
289 struct SubComponentInfo {
292 std::vector<std::string> statNames;
293 std::vector<std::string> statUnits;
294 std::vector<uint8_t> statEnableLevels;
296 SubComponentInfo() {}
302 while ( NULL != s && NULL != s->
name ) {
303 statNames.push_back(s->
name);
304 statUnits.push_back(s->
units);
310 SubComponentInfo(
const SubComponentInfo& old) : subcomponent(old.subcomponent), params(old.params), statNames(old.statNames), statUnits(old.statUnits), statEnableLevels(old.statEnableLevels)
313 SubComponentInfo& operator=(
const SubComponentInfo& old)
315 subcomponent = old.subcomponent;
317 statNames = old.statNames;
318 statUnits = old.statUnits;
319 statEnableLevels = old.statEnableLevels;
324 typedef std::map<std::string, const ElementLibraryInfo*> eli_map_t;
325 typedef std::map<std::string, ComponentInfo> eic_map_t;
326 typedef std::map<std::string, const ElementInfoEvent*> eie_map_t;
327 typedef std::map<std::string, IntrospectorInfo> eii_map_t;
328 typedef std::map<std::string, ModuleInfo> eim_map_t;
329 typedef std::map<std::string, SubComponentInfo> eis_map_t;
330 typedef std::map<std::string, const ElementInfoPartitioner*> eip_map_t;
331 typedef std::map<std::string, const ElementInfoGenerator*> eig_map_t;
333 Factory(std::string searchPaths);
338 void operator=(
Factory const&);
349 eli_map_t loaded_libraries;
350 eic_map_t found_components;
351 eii_map_t found_introspectors;
352 eie_map_t found_events;
353 eim_map_t found_modules;
354 eis_map_t found_subcomponents;
355 eip_map_t found_partitioners;
356 eig_map_t found_generators;
357 std::string searchPaths;
359 std::string loadingComponentType;
361 std::pair<std::string, std::string> parseLoadName(
const std::string& wholename);
363 std::recursive_mutex factoryMutex;
372 #endif // SST_CORE_FACTORY_H
const ElementInfoStatistic * stats
Definition: element.h:128
Output object provides consistant method for outputing data to stdout, stderr and/or sst debug file...
Definition: output.h:54
Describes a Component and its associated information.
Definition: element.h:80
Forms the base class for statistics output generation within the SST core.
Definition: statoutput.h:47
Describes all the parts of the Element Library.
Definition: element.h:152
Main component object for the simulation.
Definition: component.h:56
const ElementInfoStatistic * stats
Definition: element.h:88
Describes Statistics used by a Component.
Definition: element.h:55
Module is a tag class used with the loadModule function.
Definition: module.h:20
Describes an Introspector.
Definition: element.h:93
Main introspector object for the simulation.
Definition: introspector.h:36
Class to load Element Libraries.
Definition: elemLoader.h:23
const char * name
Definition: element.h:56
Describes Parameters to a Component.
Definition: element.h:64
Describes a Module.
Definition: element.h:112
const ElementInfoPort * ports
Definition: element.h:86
Parameter store.
Definition: params.h:46
const char * name
Definition: element.h:73
const uint8_t enableLevel
Definition: element.h:59
Class for instantiating Components, Links and the like out of element libraries.
Definition: factory.h:39
std::set< key_type, KeyCompare > KeySet_t
Definition: params.h:95
Definition: simulation.h:62
Describes Ports that the Component can use.
Definition: element.h:72
Definition: element.h:122
SubComponent is a class loadable through the factory which allows dynamic functionality to be added t...
Definition: subcomponent.h:27
const char * units
Definition: element.h:58