00001 /* -*- Mode: C++ -*- 00002 * $Id: Plan.icc,v 1.4 2000/10/25 19:34:07 frehe Exp $ 00003 * 00004 * 00005 * COPYRIGHT INFORMATION 00006 * 00007 * This file is part of RoboSoc created by Fredrik Heintz <frehe@ida.liu.se> 00008 * Copyright (C) 1999, 2000 Fredrik Heintz, Linköping University, Sweden 00009 * 00010 * You are allowed to modify and use this code as long as you retain this 00011 * notice. If you make any changes or have any comments I would appreciate 00012 * it if you send me a message. For more information, please see 00013 * http://www.ida.liu.se/~frehe/RoboCup/RoboSoc/ 00014 * 00015 * 00016 * IDENTIFICATION 00017 * 00018 * Filename: Plan.icc 00019 * Unitname: Library 00020 * $Revision: 1.4 $ 00021 * Created by: Fredrik Heintz 2000-09-03 00022 * Last modified by $Author: frehe $ $Date: 2000/10/25 19:34:07 $ 00023 * 00024 * 00025 * HISTORY 00026 * 00027 * $Log: Plan.icc,v $ 00028 * Revision 1.4 2000/10/25 19:34:07 frehe 00029 * Fixed Plan to check for empty steps and plans. 00030 * 00031 * Revision 1.3 2000/09/05 21:09:07 frehe 00032 * Fixed a bug in the copying of steps. 00033 * 00034 * Revision 1.2 2000/09/03 20:05:51 frehe 00035 * Made minor changes. 00036 * 00037 * Revision 1.1 2000/09/03 13:35:56 frehe 00038 * Imported the current version of RoboSoc (soon to be v2.5.0) 00039 * 00040 */ 00041 00054 #include "machine_dependent_compiler_directives.h" 00055 #include "rs_assert.h" 00056 00057 00058 RS_BEGIN_NAMESPACE 00059 00060 00061 // --- OTHER METHODS --- 00062 00063 inline Plan& Plan::addStep(const Step& step) 00064 { 00065 RS_CHECK_INVARIANT; 00066 if ( !step.empty() ) { 00067 stepSequence.push_back(step); 00068 } 00069 RS_CHECK_INVARIANT; 00070 return *this; 00071 } 00072 00073 00074 inline Plan& Plan::removeNextStep() 00075 { 00076 RS_CHECK_INVARIANT; 00077 if ( !empty() ) { 00078 stepSequence.pop_front(); 00079 } 00080 RS_CHECK_INVARIANT; 00081 return *this; 00082 } 00083 00084 00085 inline Plan& Plan::removeLastStep() 00086 { 00087 RS_CHECK_INVARIANT; 00088 if ( !empty() ) { 00089 stepSequence.pop_back(); 00090 } 00091 RS_CHECK_INVARIANT; 00092 return *this; 00093 } 00094 00095 00096 inline bool Plan::empty() const 00097 { 00098 RS_CHECK_INVARIANT; 00099 return stepSequence.empty(); 00100 } 00101 00102 00103 inline Plan& Plan::makeEmpty() 00104 { 00105 RS_CHECK_INVARIANT; 00106 if ( !empty() ) { 00107 stepSequence.clear(); 00108 } 00109 RS_CHECK_INVARIANT; 00110 return *this; 00111 } 00112 00113 00114 // --- TEST METHODS --- 00115 00116 inline bool Plan::invariant() const 00117 { 00118 return true; 00119 } 00120 00121 00122 RS_END_NAMESPACE
1.3-rc3