feisty meow concerns codebase 2.140
mail_stop.h
Go to the documentation of this file.
1#ifndef MAIL_STOP_CLASS
2#define MAIL_STOP_CLASS
3
4/*****************************************************************************\
5* *
6* Name : mail_stop *
7* Author : Chris Koeritz *
8* *
9*******************************************************************************
10* Copyright (c) 1998-$now By Author. This program is free software; you can *
11* redistribute it and/or modify it under the terms of the GNU General Public *
12* License as published by the Free Software Foundation; either version 2 of *
13* the License or (at your option) any later version. This is online at: *
14* http://www.fsf.org/copyleft/gpl.html *
15* Please send any updates to: fred@gruntose.com *
16\*****************************************************************************/
17
18#include "safe_callback.h"
19
21
22namespace processes {
23
24// forward:
25class letter;
26
28
34{
35public:
36
37 // it is required that the derived mail_stop invoke the end_availability()
38 // method in its destructor before it destroys any other objects.
39
41 public:
43 : _id(id), _package(package) {}
46 };
47
48 virtual void delivery_for_you(const structures::unique_int &id, letter *package) = 0;
50
57protected:
59
61 virtual void real_callback(callback_data_block &data) {
62 items_to_deliver *bits = dynamic_cast<items_to_deliver *>(&data);
63 if (!bits) return; // bad type.
64 delivery_for_you(bits->_id, bits->_package);
65 }
66
67};
68
69} //namespace.
70
71#endif
72
a simple place-holder that anonymizes the type passed to the callback.
A virtual base class for pieces of "mail". Used by the mailbox object.
Definition letter.h:25
const structures::unique_int & _id
Definition mail_stop.h:44
items_to_deliver(const structures::unique_int &id, letter *package)
Definition mail_stop.h:42
Base class for routes on which letters are automatically delivered.
Definition mail_stop.h:34
virtual void delivery_for_you(const structures::unique_int &id, letter *package)=0
the derived object must provide this function.
virtual void real_callback(callback_data_block &data)
invoked by the safe callback machinery.
Definition mail_stop.h:61
A reasonably easy way to make callbacks safe from shutdown ordering issues.
A unique identifier based on integers.
Definition unique_id.h:97