00001 /* 00002 * Copyright (C) 2004, Trent Waddington 00003 * 00004 * See the file "LICENSE.TERMS" for information on usage and 00005 * redistribution of this file, and for a DISCLAIMER OF ALL 00006 * WARRANTIES. 00007 * 00008 */ 00009 00010 /*============================================================================= 00011 * FILE: memo.h 00012 * OVERVIEW: declaration of the memo class. 00013 *============================================================================*/ 00014 /* 00015 * $Revision: 1.2 $ 00016 * 24 Aug 04 - Trent: Created 00017 */ 00018 00019 00020 #ifndef MEMO_H 00021 #define MEMO_H 00022 00023 class Memo { 00024 public: 00025 Memo(int m) : mId(m) { } 00026 int mId; 00027 virtual void doNothing() { } 00028 virtual ~Memo() { } // Kill gcc warning 00029 }; 00030 00031 class Memoisable { 00032 public: 00033 Memoisable() { cur_memo = memos.begin(); } 00034 virtual ~Memoisable() { } 00035 00036 void takeMemo(int mId); 00037 void restoreMemo(int mId, bool dec = false); 00038 00039 virtual Memo *makeMemo(int mId) = 0; 00040 virtual void readMemo(Memo *m, bool dec) = 0; 00041 00042 void takeMemo(); 00043 bool canRestore(bool dec = false); 00044 void restoreMemo(bool dec = false); 00045 00046 protected: 00047 std::list<Memo*> memos; 00048 std::list<Memo*>::iterator cur_memo; 00049 }; 00050 00051 #endif 00052