00001 #ifndef PREDICTION_EVENT_NOTIFICATION_TABLE_H_INCLUDED_
00002 #define PREDICTION_EVENT_NOTIFICATION_TABLE_H_INCLUDED_
00003 
00004 #include<string>
00005 #include<utility>
00006 #include<vector>
00007 
00008 #include "event_conflict_table.h"
00009 #include "time.h"
00010 
00011 #include "segment_graph.h" 
00012 #include "mapped_variable.h" 
00013 
00014 namespace risc {
00015 
00016 namespace sg {
00017 
00018 class PredictionEventNotificationTable {
00019 
00020 public:
00021 
00027   PredictionEventNotificationTable(
00028       risc::sg::EventConflictTable &ect,
00029       PathInstanceMapper *path_instance_mapper);
00030 
00036   int get_max_instances(int segment_id);
00037 
00044   std::pair<int, int> index_to_segment_and_instance_id(int index);
00045 
00051   int segment_and_instance_id_to_index(int segment_id, int instance_id);
00052 
00058   void print_notification_table();
00059 
00065   void print_notification_table(std::string filename);
00066 
00072   void print_instance_id_to_index_lookup_table();
00073 
00079   void print_instance_id_to_index_lookup_table(std::string filename);
00080 
00081 
00082   PathInstanceMapper *path_instance_mapper_;
00083 
00089   VertexDescriptor *vertex_lookup_;
00090 
00096   int max_instances_;
00097 
00103   int number_of_segments_;
00104 
00109   int size_of_conflict_table_;
00110 
00115   int **instance_id_to_index_lookup_;
00116 
00120   Time **combined_table_;
00121 
00122   risc::sg::EventConflictTable &ect_;
00123 
00124 private:
00125 
00126   struct Node {
00127     VertexDescriptor vd;
00128     Time t;
00129     int inst;
00130 
00131     Node(VertexDescriptor vd, Time t, int inst):
00132       vd(vd), t(t), inst(inst)
00133     { }
00134 
00135     Node(const Node &ohs):
00136       vd(ohs.vd), t(ohs.t), inst(ohs.inst)
00137     { }
00138   };
00139 
00140   typedef std::pair<VertexDescriptor, Time> SegmentTimeTuple;
00141 
00146   void bfs(VertexDescriptor start, int instance);
00147 
00153   void compute_combined_table();
00154 
00155 };
00156 
00157 } 
00158 
00159 } 
00160 
00161 #endif 
00162 
00163