diff --git a/src/RestaurantRegistry.h b/src/RestaurantRegistry.h index 3478122..a99fb9c 100644 --- a/src/RestaurantRegistry.h +++ b/src/RestaurantRegistry.h @@ -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 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::iterator it = group_active.begin(); it != group_active.end(); it++) + { + for(htl::vector::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& 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& order); - private: + private: + htl::list groups_left; + htl::list group_active; + htl::list orders; }; }