void forward_packet(packet payload)
 {
     for (uint32_t j = 0; j < receiver_count(); ++j)
     {
         forward(j, payload);
     }
 }
Ejemplo n.º 2
0
void ReceiverTypeData::print_receiver_data_on(outputStream* st) {
  uint row;
  int entries = 0;
  for (row = 0; row < row_limit(); row++) {
    if (receiver(row) != NULL)  entries++;
  }
  st->print_cr("count(%u) entries(%u)", count(), entries);
  int total = count();
  for (row = 0; row < row_limit(); row++) {
    if (receiver(row) != NULL) {
      total += receiver_count(row);
    }
  }
  for (row = 0; row < row_limit(); row++) {
    if (receiver(row) != NULL) {
      tab(st);
      receiver(row)->print_value_on(st);
      st->print_cr("(%u %4.2f)", receiver_count(row), (float) receiver_count(row) / (float) total);
    }
  }
}
Ejemplo n.º 3
0
void ciReceiverTypeData::print_receiver_data_on(outputStream* st) const {
  uint row;
  int entries = 0;
  for (row = 0; row < row_limit(); row++) {
    if (receiver(row) != NULL)  entries++;
  }
  st->print_cr("count(%u) entries(%u)", count(), entries);
  for (row = 0; row < row_limit(); row++) {
    if (receiver(row) != NULL) {
      tab(st);
      receiver(row)->print_name_on(st);
      st->print_cr("(%u)", receiver_count(row));
    }
  }
}
Ejemplo n.º 4
0
void VirtualCallData::print_data_on(outputStream* st) {
  print_shared(st, "VirtualCallData");
  uint row;
  int entries = 0;
  for (row = 0; row < row_limit(); row++) {
    if (receiver(row) != NULL)  entries++;
  }
  st->print_cr("count(%u) entries(%u)", count(), entries);
  for (row = 0; row < row_limit(); row++) {
    if (receiver(row) != NULL) {
      tab(st);
      receiver(row)->print_value_on(st);
      st->print_cr("(%u)", receiver_count(row));
    }
  }
}
    /// Receives a payload
    virtual void receive(packet payload)
    {
        for(uint32_t j = 0; j < receiver_count(); ++j)
        {
            std::string recv_id = get_receiver(j)->node_id();
            std::string src_id = payload.get_sender();

            // If true we drop
            if(m_channel_condition->generate())
            {
                ++m_counter[node_id()+"_"+src_id+"_to_"+recv_id+"_dropped"];
            }
            else
            {
                ++m_counter[node_id()+"_"+src_id+"_to_"+recv_id+"_ok"];

                // Deliver packet to receiver j
                forward(j, payload);
            }
        }

    }