SST/macro
packet_flow_sender.h
Go to the documentation of this file.
1 #ifndef PACKETFLOW_CREDITOR_H
2 #define PACKETFLOW_CREDITOR_H
3 
4 #include <sprockit/util.h>
10 
11 #define packet_flow_debug(...) \
12  debug_printf(sprockit::dbg::packet_flow, __VA_ARGS__)
13 
14 namespace sstmac {
15 namespace hw {
16 
18  public packet_flow_handler
19 {
20  public:
21  virtual ~packet_flow_sender() {}
22 
23  void
25  acker_ = acker;
26  }
27 
28  virtual void
29  set_input(int my_inport, int dst_outport,
30  event_handler* input) = 0;
31 
32  virtual void
33  set_output(int my_outport, int dst_inport,
34  event_handler* output) = 0;
35 
36  virtual void
37  init_credits(int port, int num_credits) = 0;
38 
39  virtual int
40  num_initial_credits() const = 0;
41 
42  void
43  handle_payload(packet_flow_payload* pkt) {
44  pkt->set_arrival(now().sec());
45  do_handle_payload(pkt);
46  }
47 
48  void
51  }
52 
53  void
56  }
57 
58  void
60  stat_collector_ = c;
61  }
62 
63  std::string
64  to_string() const;
65 
66  virtual std::string
67  packet_flow_name() const = 0;
68 
69  void
70  set_update_vc(bool flag){
71  update_vc_ = flag;
72  }
73 
74  protected:
76  const timestamp& send_lat,
77  const timestamp& credit_lat);
78 
80 
81  void
82  send_credit(const packet_flow_input& src,
83  packet_flow_payload* payload,
84  timestamp packet_tail_leaves);
85 
86  void
88  packet_flow_payload* pkt,
89  const packet_flow_input& src,
90  const packet_flow_output& dest);
91 
92  virtual void
93  do_handle_payload(packet_flow_payload* pkt) = 0;
94 
95  protected:
97 
99 
101 
103 
105 
106 };
107 
108 
109 }
110 }
111 
112 #endif // PACKETFLOW_CREDITOR_H
113 
timestamp now() const
get the current time
virtual void set_input(int my_inport, int dst_outport, event_handler *input)=0
void set_stat_collector(packet_sent_stats *c)
virtual void init_credits(int port, int num_credits)=0
void init_loc_id(event_loc_id id)
Definition: event_handler.h:90
void set_event_location(switch_id sid)
virtual std::string packet_flow_name() const =0
packet_sent_stats * stat_collector_
The main interface for something that can respond to an event (sst_message).
Definition: event_handler.h:24
void set_acker(event_handler *acker)
A basic container for time (subject to future transplant).
Definition: timestamp.h:29
void handle_payload(packet_flow_payload *pkt)
topology_id switch_id
Definition: node_address.h:23
SUMI = Simulator unified messagine interface It is also the name for a solid ink in Japanese - i...
virtual int num_initial_credits() const =0
void send_credit(const packet_flow_input &src, packet_flow_payload *payload, timestamp packet_tail_leaves)
void send(packet_flow_bandwidth_arbitrator *arb, packet_flow_payload *pkt, const packet_flow_input &src, const packet_flow_output &dest)
virtual void do_handle_payload(packet_flow_payload *pkt)=0
endpoint_id node_id
Definition: node_address.h:20
virtual void set_output(int my_outport, int dst_inport, event_handler *output)=0
std::string to_string() const