ModuleDecl.h 3.12 KB
Newer Older
Anirudh Kaushik's avatar
Anirudh Kaushik committed
1 2 3
#ifndef _MODULE_DECL_H_
#define _MODULE_DECL_H_

rmrf's avatar
rmrf committed
4 5 6 7
#include "FindConstructor.h"
#include "FindEntryFunctions.h"
#include "FindPorts.h"
#include "FindTLMInterfaces.h"
Anirudh Kaushik's avatar
Anirudh Kaushik committed
8
#include "InterfaceDecl.h"
rmrf's avatar
rmrf committed
9
#include "PortDecl.h"
Anirudh Kaushik's avatar
Anirudh Kaushik committed
10 11 12
#include "ProcessDecl.h"
#include "Signal.h"
#include "Utility.h"
rmrf's avatar
rmrf committed
13 14 15
#include "clang/AST/DeclCXX.h"
#include <map>
#include <string>
Anirudh Kaushik's avatar
Anirudh Kaushik committed
16 17

namespace scpar {
rmrf's avatar
rmrf committed
18 19
using namespace clang;
using namespace std;
Anirudh Kaushik's avatar
Anirudh Kaushik committed
20

rmrf's avatar
rmrf committed
21 22
class ModuleDecl {
public:
rmrf's avatar
rmrf committed
23 24
  typedef pair<string, Signal* > signalPairType;
  typedef map<string, Signal* > signalMapType;
Anirudh Kaushik's avatar
Anirudh Kaushik committed
25

rmrf's avatar
rmrf committed
26 27 28 29
  // Maps the name of the port with a pointer to a structure that holds
  // information about the port.
  typedef pair<string, PortDecl* > portPairType;
  typedef map<string, PortDecl* > portMapType;
Anirudh Kaushik's avatar
Anirudh Kaushik committed
30

rmrf's avatar
rmrf committed
31 32
  typedef pair<string, InterfaceDecl* > interfacePairType;
  typedef map<string, InterfaceDecl* > interfaceMapType;
Anirudh Kaushik's avatar
Anirudh Kaushik committed
33

rmrf's avatar
rmrf committed
34 35 36 37
  // Maps the name of the process with a pointer to a structure that holds
  // information about the process.
  typedef pair<string, ProcessDecl* > processPairType;
  typedef map<string, ProcessDecl* > processMapType;
Anirudh Kaushik's avatar
Anirudh Kaushik committed
38

rmrf's avatar
rmrf committed
39
  typedef pair<string, string> moduleProcessPairType;
Anirudh Kaushik's avatar
Anirudh Kaushik committed
40

rmrf's avatar
rmrf committed
41 42
  typedef pair<string, string> portSignalPairType;
  typedef map<string, string> portSignalMapType;
rmrf's avatar
rmrf committed
43

rmrf's avatar
rmrf committed
44 45
  // Why is this a not a Type?
  typedef vector<string> instanceName;
rmrf's avatar
rmrf committed
46

rmrf's avatar
rmrf committed
47 48 49
public:
  ModuleDecl();
  ModuleDecl(const string &, CXXRecordDecl *);
Anirudh Kaushik's avatar
Anirudh Kaushik committed
50

rmrf's avatar
rmrf committed
51
  ~ModuleDecl();
Anirudh Kaushik's avatar
Anirudh Kaushik committed
52

rmrf's avatar
rmrf committed
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
  void addSignals(FindSignals::signalMapType *);
  void addInputPorts(FindPorts::PortType);
  void addOutputPorts(FindPorts::PortType);
  void addInputOutputPorts(FindPorts::PortType);
  void addInputInterfaces(FindTLMInterfaces::interfaceType);
  void addOutputInterfaces(FindTLMInterfaces::interfaceType);
  void addInputOutputInterfaces(FindTLMInterfaces::interfaceType);
  void addProcess(FindEntryFunctions::entryFunctionVectorType *);
  void addInstances(vector<string>);
  void addSignalBinding(map<string, string>);
  void setModuleName(const string &);
  void addConstructor(Stmt *);
  string getName();
  CXXRecordDecl *getModuleClassDecl();
  bool isModuleClassDeclNull();
  portMapType getOPorts();
  portMapType getIPorts();
  portMapType getIOPorts();
  processMapType getProcessMap();
  Stmt *getConstructorStmt();
  interfaceMapType getIInterfaces();
  interfaceMapType getOInterfaces();
  interfaceMapType getIOInterfaces();
  vector<string> getInstanceList();
  vector<EntryFunctionContainer *> getEntryFunctionContainer();
  int getNumInstances();
Anirudh Kaushik's avatar
Anirudh Kaushik committed
79

rmrf's avatar
rmrf committed
80 81 82 83 84 85 86
  void dumpPorts(raw_ostream &, int);
  void dumpInterfaces(raw_ostream &, int);
  void dumpProcesses(raw_ostream &, int);
  void dumpSignals(raw_ostream &, int);
  void dump(raw_ostream &);
  void dumpInstances(raw_ostream &, int);
  void dumpSignalBinding(raw_ostream &, int);
Anirudh Kaushik's avatar
Anirudh Kaushik committed
87

rmrf's avatar
rmrf committed
88
private:
rmrf's avatar
rmrf committed
89 90
  string module_name_;
  CXXRecordDecl *class_decl_;
rmrf's avatar
rmrf committed
91 92
  Stmt *constructor_stmt_;

rmrf's avatar
rmrf committed
93
  processMapType process_map_;
rmrf's avatar
rmrf committed
94 95 96 97 98 99 100
  portMapType _iports;
  portMapType _oports;
  portMapType _ioports;
  interfaceMapType _iinterfaces;
  interfaceMapType _ointerfaces;
  interfaceMapType _iointerfaces;
  signalMapType _signals;
rmrf's avatar
rmrf committed
101
  
rmrf's avatar
rmrf committed
102 103 104 105 106
  vector<string> _instanceList;
  portSignalMapType _portSignalMap;
  vector<EntryFunctionContainer *> _vef;
};
} // namespace scpar
Anirudh Kaushik's avatar
Anirudh Kaushik committed
107
#endif