00001 00018 #ifndef PLUGIN_HPP 00019 #define PLUGIN_HPP 00020 #include <iostream> 00021 #include <fstream> 00022 #include <errno.h> 00023 #include <string.h> 00024 #include "Plugin.hpp" 00025 00026 using namespace std; 00027 00038 class Plugin { 00039 public: 00040 Plugin(){}; 00041 00042 virtual ~Plugin(){}; 00043 00044 virtual void setup(string) = 0; 00045 //returns the version of the plugin 00046 virtual int getVersion() const = 0; 00047 //returns the location of the new specs file 00048 virtual string getSpecs() = 0; 00049 //returns the location of a new logic file 00050 virtual string getLogic() = 0; 00051 //returns true if there is a new specs file 00052 virtual bool nSpecs()=0; 00053 //returns true if there is a new logic file 00054 virtual bool nLogic()=0; 00055 //returns the name of a node that this plugin wants to see the level of 00056 virtual string retrieveNodeLevel() = 0; 00057 //takes in the name of the node and it's current level for analysis 00058 virtual void sendNodeLevel(string, int) =0; 00059 //returns the name of an input node and the level it wants the node set to 00060 virtual pair<string, int> setInputNodeLevel() =0; 00061 00062 //These three functions are called throughout the simulation 00063 //so that this plugin may know what is going on and may do 00064 //any nessicary calculations. 00065 // 00066 //this function is called before any simulations occur 00067 virtual void initialize() = 0; 00068 //this function is called during simulation setup before each simulation 00069 virtual void preSim() = 0; 00070 //this function is called every step during the simulation 00071 virtual void midSim() = 0; 00072 //this function is called after each simulation is over 00073 virtual void postSim() = 0; 00074 //this function is called after all simulations are over 00075 virtual void close() = 0; 00076 00077 //setter methods for data to be shared with the plugin 00078 void setROOTDIR(string s){ROOTDIR=s;}; 00079 void setSIMDIR(string s){SIMDIR=s;}; 00080 void setOutFile(string s){outFile=s;}; 00081 void setRunName(string s){runName=s;}; 00082 void setT(int i){t=i;}; 00083 void setDUMP(string s){DUMP=s;}; 00084 void setAnalysisPoint(int i){analysisPt=i;}; 00085 void setLogic(string s){logic=s;}; 00086 void setSpecs(string s){specs=s;}; 00087 00088 protected: 00089 int t; 00090 string outFile; 00091 string ROOTDIR; 00092 string SIMDIR; 00093 string runName; 00094 string DUMP; 00095 string logic; 00096 string specs; 00097 string name; 00098 int analysisPt; 00099 00100 00101 }; 00102 00103 // the types of the class factories 00104 typedef Plugin* create_t(); 00105 typedef void destroy_t(Plugin*); 00106 00107 #endif