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