Skip to content

Commit

Permalink
all methods implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
hstefan committed Dec 10, 2010
1 parent bb276f5 commit 9878eb4
Showing 1 changed file with 49 additions and 4 deletions.
53 changes: 49 additions & 4 deletions src/RestaurantRegistry.h
Expand Up @@ -33,12 +33,57 @@ namespace rty
{
public:
typedef UserInterface::group_data group_data;

struct gp_time
{
group_data gd;
time_t left_at;
};

struct ord_group
{
group_data gp;
htl::list<Item> ord;
};

void registryGroup(const group_data& gp)
{
group_active.push_back(gp);
}

void notifyGroupLeft(const group_data& gp)
{
int no_table = gp.tables.front()->num;
for(htl::list<group_data>::iterator it = group_active.begin(); it != group_active.end(); it++)
{
for(htl::vector<Table*>::iterator iv = (*it).tables.begin(); iv != (*it).tables.end(); it++)
{
if((*iv)->num == no_table)
{
group_active.erase(it);
gp_time g = {(*it), Chronometer::getInstance().getCurrent()};
groups_left.push_back(g);
no_table = -1;
break;
}
}
if(no_table == -1)
break;
}
}

void registryOrder(const group_data& gp, const htl::list<Item>& order)
{
ord_group o = { gp , order };
orders.push_back(o);
}


void registryGroup(const group_data& gp);
void notifyGroupLeft(const group_data& gp);
void registryOrder(const group_data& gp, const htl::list<Item>& order);
private:

private:
htl::list<gp_time> groups_left;
htl::list<group_data> group_active;
htl::list<ord_group> orders;
};
}

Expand Down

0 comments on commit 9878eb4

Please sign in to comment.