00001 /* 00002 * ContractDelegate.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 ContractDelegate.hh 00014 * 00015 * Header file for a delegate that extends the BasicDelegate to support QuO 00016 * contracts. 00017 */ 00018 00019 #ifndef _contract_delegate_hh 00020 #define _contract_delegate_hh 00021 00022 #include <quoC.h> 00023 00024 #include <BasicDelegate.hh> 00025 00026 /** 00027 * A BasicDelegate that will evaluate a QuO contract during a precall/postcall. 00028 * 00029 * XXX Make a template? 00030 */ 00031 class ContractDelegate : public BasicDelegate 00032 { 00033 00034 public: 00035 00036 /** 00037 * Construct a ContractDelegate with the given values. 00038 * 00039 * @param contract The contract to evaluate. 00040 * @param name The name value to pass to BasicDelegate's constructor. 00041 * @param period The period value to pass to BasicDelegate's constructor. 00042 * @param deadline The deadline value to pass to BasicDelegate's 00043 * constructor. 00044 */ 00045 ContractDelegate(quo::Contract_ptr contract, 00046 const char *name, 00047 unsigned long period, 00048 unsigned long deadline); 00049 00050 /** 00051 * The premethod callback. This implementation will evaluate the contract, 00052 * call the parent method, and evaluate the contract again. 00053 * 00054 * @sa BasicDelegate::precall 00055 */ 00056 virtual rk_stub_precall_retval_t precall(void); 00057 00058 /** 00059 * The postmethod callback. This implementation will evaluate the 00060 * contract, call the parent method, and evaluate the contract again. 00061 * 00062 * @sa BasicDelegate::postcall 00063 */ 00064 virtual void postcall(void); 00065 00066 private: 00067 00068 /** 00069 * The contract to evaluate. 00070 */ 00071 quo::Contract_var cd_Contract; 00072 00073 }; 00074 00075 #endif