mailbox.h

Go to the documentation of this file.
00001 #ifndef MAILBOX_CLASS
00002 #define MAILBOX_CLASS
00003 
00004 /*****************************************************************************\
00005 *                                                                             *
00006 *  Name   : mailbox                                                           *
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 "post_office_dll.h"
00019 
00020 // forward.
00021 class letter;
00022 class mailbox_bank;
00023 class unique_int;
00024 
00026 
00034 class POST_OFFICE_CLASS_STYLE mailbox
00035 {
00036 public:
00037   mailbox();
00038   virtual ~mailbox();
00039 
00040   void drop_off(const unique_int &id, letter *package);
00042 
00047   bool pick_up(const unique_int &id, letter * &package);
00049 
00058   int waiting(const unique_int &id) const;
00060 
00061   void get_ids(int_set &to_fill);
00063 
00066   bool close_out(const unique_int &id);
00068 
00073   void show(istring &to_fill);
00075 
00077   void clean_up();
00079 
00080   void limit_boxes(int max_letters);
00082 
00088   enum apply_outcomes {
00089     OKAY = common::OKAY,   
00090 
00091     DEFINE_OUTCOME(APPLY_STOP, -50, "Halt the apply process"),
00092     DEFINE_OUTCOME(APPLY_WHACK, -51, "Removes the current letter, but "
00093         "continues"),
00094     DEFINE_OUTCOME(APPLY_WHACK_STOP, -52, "Halts apply and trashes the "
00095         "current letter")
00096   };
00097 
00098   typedef outcome apply_function(letter &current, int uid, void *data_link);
00100 
00109   void apply(apply_function *to_apply, void *data_link);
00111 
00117 private:
00118   mutex *_transaction_lock;  
00119   mailbox_bank *_packages;  
00120 
00121   // prohibited.
00122   mailbox(const mailbox &);
00123   mailbox &operator =(const mailbox &);
00124 };
00125 
00126 #endif
00127 

Generated on Fri Nov 28 04:29:30 2008 for HOOPLE Libraries by  doxygen 1.5.1