00001 /* 00002 * Delegate.hh 00003 * 00004 * Copyright (c) 2003 The University of Utah and the Flux Group. 00005 * All rights reserved. 00006 * 00007 * This file is licensed under the terms of the GNU Public License. 00008 * See the file "license.terms" for restrictions on redistribution 00009 * of this file, and for a DISCLAIMER OF ALL WARRANTIES. 00010 */ 00011 00012 /** 00013 * @file Delegate.hh 00014 * 00015 * Header file for fake C++ delegates. 00016 */ 00017 00018 #ifndef _delegate_hh 00019 #define _delegate_hh 00020 00021 /** 00022 * Abstract class for fake C++ delegates that work with the rk_stub library. 00023 */ 00024 class Delegate 00025 { 00026 00027 public: 00028 00029 /** 00030 * Construct an empty delegate. 00031 */ 00032 Delegate(); 00033 00034 /** 00035 * Deconstruct a delegate. 00036 */ 00037 virtual ~Delegate(); 00038 00039 /** 00040 * Pure virtual method that is called by cxx_delegate_precall. 00041 * 00042 * @return A valid rk_stub_precall_retval_t value. 00043 */ 00044 virtual rk_stub_precall_retval_t precall(void) = 0; 00045 00046 /** 00047 * Pure virtual method that is called by cxx_delegate_postcall. 00048 */ 00049 virtual void postcall(void) = 0; 00050 00051 }; 00052 00053 /** 00054 * Callback for rk_stub_mk_pid that will cast the parameter to a Delegate 00055 * object and call Delegate::precall(). Typically, this function would be 00056 * passed as the precall argument to rk_stub_mk_pid(). 00057 * 00058 * @param obj The Delegate object. 00059 * @return The result of Delegate::precall(). 00060 */ 00061 rk_stub_precall_retval_t cxx_delegate_precall(void *obj); 00062 00063 /** 00064 * Callback for rk_stub_mk_pid that will cast the parameter to a Delegate 00065 * object and call Delegate::postcall(). Typically, this function would be 00066 * passed as the postcall argument to rk_stub_mk_pid(). 00067 * 00068 * @param obj The Delegate object. 00069 */ 00070 void cxx_delegate_postcall(void *obj); 00071 00072 #endif