Project

General

Profile

Revision 2009

Rewrote some of the WH_Robot.h code to make it c-compatible. Most of the c++ was commented out instead of deleted.

View differences:

Order.cpp
4 4

  
5 5
/** @Brief: Regular order constructor */
6 6
Order::Order(int order_id, Address order_source, Address order_dest, 
7
    Time order_start_time, Path order_path, Time order_est_time) 
7
    Time order_start_time, Path order_path, Duration order_est_time) 
8 8
{ 
9 9
    id = order_id;
10 10
    source = order_source;
......
40 40
    return path;
41 41
}
42 42

  
43
Time Order::get_est_time() const
43
Duration Order::get_est_time() const
44 44
{
45 45
    return est_time;
46 46
}
47 47

  
48
bool Order::operator==(Order& o1, Order& o2)
48
int Order::get_priority() const
49 49
{
50
  return o1.id == o2.id;
50
    return start_time.toSec() + MAX_WAIT_TIME - est_time.toSec();
51 51
}
52 52

  
53
bool Order::operator==(Order& order)
54
{
55
  return this->id == order.id;
56
}
57

  
53 58
void Order::set_path(Path order_path)
54 59
{
55 60
    path = order_path;
......
62 67
 */
63 68
bool CompareOrder::operator()(Order& o1, Order& o2) 
64 69
{
65
  int pq_value1 = o1.get_start_time + MAX_WAIT_TIME - o1.get_est_time();
66
  int pq_value2 = o2.get_start_time + MAX_WAIT_TIME - o2.get_est_time();
67
  return pq_value1 > pq_value2;
70
  return o1.get_priority() > o2.get_priority();
68 71
}
69 72

  

Also available in: Unified diff