SST  15.1.0
StructuralSimulationToolkit
pythonConfigOutput.h
1 // Copyright 2009-2025 NTESS. Under the terms
2 // of Contract DE-NA0003525 with NTESS, the U.S.
3 // Government retains certain rights in this software.
4 //
5 // Copyright (c) 2009-2025, NTESS
6 // All rights reserved.
7 //
8 // This file is part of the SST software package. For license
9 // information, see the LICENSE file in the top level directory of the
10 // distribution.
11 //
12 
13 #ifndef SST_CORE_PYTHON_CONFIG_OUTPUT_H
14 #define SST_CORE_PYTHON_CONFIG_OUTPUT_H
15 
16 #include "sst/core/configGraph.h"
17 #include "sst/core/configGraphOutput.h"
18 
19 #include <cstddef>
20 #include <map>
21 #include <string>
22 
23 namespace SST::Core {
24 
26 {
27 public:
28  explicit PythonConfigGraphOutput(const char* path);
29 
30  virtual void generate(const Config* cfg, ConfigGraph* graph) override;
31 
32 protected:
33  ConfigGraph* getGraph() { return graph_; }
34  void generateParams(const Params& params);
35  void generateCommonComponent(const char* objName, const ConfigComponent* comp);
36  void generateSubComponent(const char* owner, const ConfigComponent* comp);
37  void generateComponent(const ConfigComponent* comp, bool output_parition_info);
38  void generateStatGroup(const ConfigGraph* graph, const ConfigStatGroup& grp);
39  void generateCommonLink(const char* objName, const ConfigComponent* comp);
40  void generateSubComponentLinks(const char* objName, const ConfigComponent* comp);
41  void generateComponentLinks(const ConfigComponent* comp);
42 
43  const std::string& getLinkObject(LinkId_t id, const std::string& name, bool no_cut);
44 
45  char* generateCompName(const ConfigComponent* comp);
46  char* makePythonSafeWithPrefix(const std::string& name, const std::string& prefix) const;
47  void makeBufferPythonSafe(char* buffer) const;
48  char* makeEscapeSafe(const std::string& input) const;
49  bool strncmp(const char* a, const char* b, const size_t n) const;
50  bool isMultiLine(const char* check) const;
51  bool isMultiLine(const std::string& check) const;
52 
53 private:
54  ConfigGraph* graph_;
55  std::map<LinkId_t, std::string> link_map_;
56  std::string py_parent_name_;
57  std::map<StatisticId_t, std::string> shared_stat_map_;
58 };
59 
60 } // namespace SST::Core
61 
62 #endif // SST_CORE_PYTHON_CONFIG_OUTPUT_H
virtual void generate(const Config *cfg, ConfigGraph *graph) override
Definition: pythonConfigOutput.cc:364
Outputs configuration data to a specified file path.
Definition: configGraphOutput.h:61
Class to contain SST Simulation Configuration variables.
Definition: config.h:51
Represents the configuration of a generic component.
Definition: configGraph.h:381
A Configuration Graph A graph representing Components and Links.
Definition: configGraph.h:585
Definition: pythonConfigOutput.h:25
Parameter store.
Definition: params.h:63
Definition: configGraph.h:282