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