00001 #ifndef SCHEDULABLE_CLASS 00002 #define SCHEDULABLE_CLASS 00003 00004 /*****************************************************************************\ 00005 * * 00006 * Name : schedulable * 00007 * Author : Chris Koeritz * 00008 * * 00009 ******************************************************************************* 00010 * Copyright (c) 1991-$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 "item_statistics.h" 00019 #include "periodicity.h" 00020 00021 #include <data_struct/unique_id.h> 00022 #include <mechanisms/heartbeat.h> 00023 #include <nodes/safe_node.h> 00024 00026 00032 class scheduling_id : public unique_int 00033 { 00034 public: 00035 inline scheduling_id(int initial) : unique_int(initial) {} 00036 }; 00037 00039 00041 00050 class SCHEDULING_CLASS_STYLE schedulable 00051 : public nodes::safe_node, 00052 public periodicity, 00053 public virtual object_base 00054 { 00055 public: 00056 schedulable(const scheduling_id &item_id, int actor_id, 00057 const periodicity &when_to_schedule); 00059 00062 virtual ~schedulable(); 00063 00064 IMPLEMENT_CLASS_NAME("schedulable"); 00065 00066 const scheduling_id &item_id() const { return _sched_id; } 00068 00069 int actor_id() const { return _actor_id; } 00071 00072 virtual int weight() const; 00074 00078 //deprecate this. it's really the object base text form. 00079 virtual istring schedulable_text_form() const; 00081 00082 const heartbeat &expiration() const { return _expiration_timer; } 00084 heartbeat &expiration() { return _expiration_timer; } 00086 00087 const item_statistics &stats() const { return _stats; } 00089 item_statistics &stats() { return _stats; } 00091 00092 bool preprocessed() const { return _preprocessed; } 00094 void preprocessed(bool state) { _preprocessed = state; } 00096 00097 private: 00098 int _actor_id; 00099 scheduling_id _sched_id; 00100 item_statistics _stats; 00101 heartbeat _expiration_timer; 00103 00109 bool _preprocessed; 00110 }; 00111 00112 #endif 00113
1.5.1