00001 /* 00002 * RTServerImpl.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 RTServerImpl.hh 00014 * 00015 * Header file for the RTServerImpl class. 00016 */ 00017 00018 #ifndef _rt_server_hh 00019 #define _rt_server_hh 00020 00021 #include "RTServerS.h" 00022 00023 /** 00024 * Basic implementation of the RTServer interface. 00025 */ 00026 class RTServerImpl : public virtual POA_RTServer 00027 { 00028 00029 public: 00030 00031 /** 00032 * Construct an RTServerImpl with the given values. 00033 * 00034 * @param deadline_us The server's deadline, in microseconds. 00035 * @param compute_us An array that describes the number of microseconds of 00036 * CPU to consume for each period. When the end of the array is reached, 00037 * the server will cycle back to the beginning of the array. The array is 00038 * kept by reference and not copied. 00039 * @param compute_us_length The number of elements in the 'compute_us' 00040 * array. 00041 */ 00042 RTServerImpl(CORBA::ULong deadline_us, 00043 const CORBA::ULong *compute_us, 00044 unsigned int compute_us_length); 00045 00046 /** 00047 * Consume the number of microseconds specified by 00048 * rts_Compute.data[rts_Compute.index]. 00049 * 00050 * @sideeffect rts_Compute.index is incremented. 00051 * 00052 * @copydoc RTServer::Periodic 00053 */ 00054 virtual void Periodic(void) 00055 throw (CORBA::SystemException); 00056 00057 protected: 00058 00059 /** 00060 * The server's deadline, in microseconds. 00061 */ 00062 CORBA::ULong rts_Deadline; 00063 00064 /** 00065 * The description of the computation to be done. 00066 */ 00067 struct { 00068 const CORBA::ULong *data; /**< The array passed into the 00069 constructor. */ 00070 unsigned int length; /**< The number of elements in the array. */ 00071 unsigned int index; /**< The next index in the array to use. */ 00072 } rts_Compute; 00073 00074 }; 00075 00076 #endif