safe_callback.h

Go to the documentation of this file.
00001 #ifndef SAFE_CALLBACK_CLASS
00002 #define SAFE_CALLBACK_CLASS
00003 
00004 /*****************************************************************************\
00005 *                                                                             *
00006 *  Name   : safe_callback                                                     *
00007 *  Author : Chris Koeritz                                                     *
00008 *                                                                             *
00009 *******************************************************************************
00010 * Copyright (c) 2001-$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 "mechanisms_dll.h"
00019 
00020 #include <basis/object_base.h>
00021 
00022 // forward.
00023 class callback_data_block;
00024 class global_live_objects;
00025 
00027 
00065 class MECHANISMS_CLASS_STYLE safe_callback
00066 {
00067 public:
00068   safe_callback();
00070 
00071   void end_availability();
00073 
00077   virtual ~safe_callback();
00079 
00083   IMPLEMENT_CLASS_NAME("safe_callback");
00084 
00085   bool decoupled() const { return _decoupled; }
00087 
00092   bool invoke_callback(callback_data_block &new_data);
00094 
00111 protected:
00112   virtual void real_callback(callback_data_block &new_data) = 0;
00114 
00117 private:
00118   bool _decoupled;  
00119   mutex *_callback_lock;  
00120   void begin_availability();
00122 
00124 public:
00125   global_live_objects &_invocables();
00127 
00129 };
00130 
00132 
00134 
00139 class callback_data_block
00140 {
00141 public:
00142   virtual ~callback_data_block();
00143 };
00144  
00146 
00147 #endif
00148 

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