00001
00002 #ifndef _H_SST_CORE_CONFIG_OUTPUT
00003 #define _H_SST_CORE_CONFIG_OUTPUT
00004
00005 #include <sst/core/config.h>
00006 #include <configGraph.h>
00007
00008 #include <exception>
00009 #include <cstring>
00010 #include <cstdio>
00011
00012 namespace SST {
00013 namespace Core {
00014
00015 class ConfigGraphOutputException : public std::exception {
00016 public:
00017 ConfigGraphOutputException(const char* msg) {
00018 exMsg = (char*) malloc( sizeof(char) * (strlen(msg) + 1) );
00019 std::strcpy(exMsg, msg);
00020 }
00021
00022 virtual const char* what() const throw() {
00023 return exMsg;
00024 }
00025
00026 protected:
00027 char* exMsg;
00028 };
00029
00030 class ConfigGraphOutput {
00031 public:
00032 ConfigGraphOutput(const char* path) {
00033 outputFile = fopen(path, "wt");
00034 }
00035
00036 virtual ~ConfigGraphOutput() {
00037 fclose(outputFile);
00038 }
00039
00040 virtual void generate(const Config* cfg,
00041 ConfigGraph* graph) throw(ConfigGraphOutputException) = 0;
00042 protected:
00043 FILE* outputFile;
00044
00045 };
00046
00047 }
00048 }
00049
00050 #endif