00001 #ifndef MAILBOX_CLASS
00002 #define MAILBOX_CLASS
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "post_office_dll.h"
00019
00020
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 ¤t, 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
00122 mailbox(const mailbox &);
00123 mailbox &operator =(const mailbox &);
00124 };
00125
00126 #endif
00127