00001 #ifndef CENTRAL_MAILBOX_CLASS
00002 #define CENTRAL_MAILBOX_CLASS
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "mail_stop.h"
00019
00020
00021 class letter_morph;
00022 class mailbox;
00023 class ithread;
00024 class postal_cache;
00025 class route_map;
00026 class thread_cabinet;
00027 class time_stamp;
00028 class transport_id;
00029
00031
00032 class POST_OFFICE_CLASS_STYLE post_office
00033 {
00034 public:
00035 post_office();
00036
00037 virtual ~post_office();
00039
00040 void stop_serving();
00042
00043
00044
00045 IMPLEMENT_CLASS_NAME("post_office");
00046
00047 void show_mail(istring &to_fill);
00049
00050 void show_routes(istring &to_fill);
00052
00053
00054
00055 void drop_off(const unique_int &id, letter *package);
00057
00061 bool pick_up(const unique_int &id, letter * &package);
00063
00067
00068
00069
00070
00071 bool register_route(const unique_int &id, mail_stop &carrier_path);
00073
00074 bool unregister_route(const unique_int &id);
00076
00082 bool route_listed(const unique_int &id);
00084
00088
00089
00090 bool deliver_mail_on_route(const unique_int &route, ithread &carrier);
00092
00096 private:
00097 mailbox *_post;
00098 route_map *_routes;
00099 mutex *_stock_lock;
00100 time_stamp *_next_cleaning;
00101 thread_cabinet *_threads;
00102
00103 void get_route_list(int_set &route_set);
00105
00106 void clean_package_list(post_office &post, letter_morph &to_clean);
00108 };
00109
00110 #endif
00111