SST  11.1.0
StructuralSimulationToolkit
configGraphOutput.h
1 // Copyright 2009-2021 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-2021, 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 #ifndef SST_CORE_CONFIGGRAPH_OUTPUT_H
13 #define SST_CORE_CONFIGGRAPH_OUTPUT_H
14 
15 #include "sst/core/configGraph.h"
16 
17 #include <cstdio>
18 #include <exception>
19 
20 namespace SST {
21 class ConfigGraph;
22 
23 namespace Core {
24 
25 class ConfigGraphOutputException : public std::exception
26 {
27 public:
28  ConfigGraphOutputException(const char* msg)
29  {
30  exMsg = (char*)malloc(sizeof(char) * (strlen(msg) + 1));
31  std::strcpy(exMsg, msg);
32  }
33 
34  virtual const char* what() const noexcept override { return exMsg; }
35 
36 protected:
37  char* exMsg;
38 };
39 
41 {
42 public:
43  ConfigGraphOutput(const char* path) { outputFile = fopen(path, "wt"); }
44 
45  virtual ~ConfigGraphOutput() { fclose(outputFile); }
46 
47  virtual void generate(const Config* cfg, ConfigGraph* graph) = 0;
48 
49 protected:
50  FILE* outputFile;
51 };
52 
53 } // namespace Core
54 } // namespace SST
55 
56 #endif // SST_CORE_CONFIGGRAPH_OUTPUT_H
Definition: configGraphOutput.h:40
Class to contain SST Simulation Configuration variables.
Definition: config.h:29
A Configuration Graph A graph representing Components and Links.
Definition: configGraph.h:375
Definition: configGraphOutput.h:25