post_office.h

Go to the documentation of this file.
00001 #ifndef CENTRAL_MAILBOX_CLASS
00002 #define CENTRAL_MAILBOX_CLASS
00003 
00004 /*****************************************************************************\
00005 *                                                                             *
00006 *  Name   : post_office                                                       *
00007 *  Author : Chris Koeritz                                                     *
00008 *                                                                             *
00009 *******************************************************************************
00010 * Copyright (c) 1998-$now By Author.  This program is free software; you can  *
00011 * redistribute it and/or modify it under the terms of the GNU General Public  *
00012 * License as published by the Free Software Foundation; either version 2 of   *
00013 * the License or (at your option) any later version.  This is online at:      *
00014 *     http://www.fsf.org/copyleft/gpl.html                                    *
00015 * Please send any updates to: fred@gruntose.com                               *
00016 \*****************************************************************************/
00017 
00018 #include "mail_stop.h"
00019 
00020 // forward:
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   // informational functions...
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   // general delivery services subject to the constraints of the mailbox class.
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   // mail delivery and routing support.
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 

Generated on Fri Nov 21 04:29:57 2008 for HOOPLE Libraries by  doxygen 1.5.1