00001
00002
00003
00004
00005
00006
00007
00008 #ifndef PORTS_H_
00009 #define PORTS_H_
00010
00011 #include <iostream>
00012 #include <string>
00013 #include <map>
00014 #include <vector>
00015 #include "include/CosiGlobal.h"
00016 #include "Interface.h"
00017 #include "core/IdGraph.h"
00018 #include "core/Quantity.h"
00019
00020 namespace cosi {
00021
00022 namespace quantity {
00023
00024 namespace onchipcommunication {
00025
00026
00027 class Ports : public Quantity {
00028 std::map<std::string,Interface> mPorts;
00029 std::map<std::string,Edge> mBound;
00030 public:
00031 Ports();
00032 ~Ports();
00033 static std::string GetQuantityType();
00034 static std::string GetQuantityName();
00035
00036 typedef std::map<string,Interface>::iterator iterator ;
00037
00038 Ports Get();
00039 void Set(Ports pP);
00040 std::map<std::string,Interface> GetValue();
00041
00042 void AddPort(std::string pName, std::string pType,
00043 Interface::tDirection pDir);
00044 void AddPort(std::string pName, Interface pIf);
00045 bool HasPortType(std::string pType);
00046 bool HasPort(std::string pName);
00047
00048 iterator Begin() ;
00049 iterator End() ;
00050 string Name(iterator It ) ;
00051 Interface If(iterator It ) ;
00052
00053 bool IsBound(std::string pName);
00054 void UnBound(string pName) ;
00055 Edge BoundTo(std::string pName);
00056 void BoundTo(std::string pName, Edge pE);
00057 string IsBoundTo(Edge pE , Interface::tDirection pDir = Interface::OUT) ;
00058 string GetInputPortNotBound() ;
00059 string GetOutputPortNotBound() ;
00060
00061 std::vector<std::string> GetNotBoundIn() ;
00062 std::vector<std::string> GetNotBoundOut() ;
00063 std::vector<std::string> GetNotBoundInOut() ;
00064
00065 bool operator==(Ports pP);
00066
00067 Ports operator+(Ports pT);
00068 Ports operator-(Ports pT);
00069
00070 friend std::ostream& operator<<(std::ostream &pOs, const Ports &pP);
00071 Interface& operator[](std::string pName);
00072
00073 static std::string sQuantityType;
00074 static std::string sQuantityName;
00075 };
00076
00077
00078
00079 }
00080 }
00081 }
00082 #endif