Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

Manoeuvre.cpp

00001 // 00002 // Copyright 2004 P&P Software GmbH - All Rights Reserved 00003 // 00004 // Manoeuvre.cpp 00005 // 00006 // Version 1.0 00007 // Date 10.04.03 00008 // Author A. Pasetti (P&P Software) 00009 00010 #include "../GeneralInclude/CompilerSwitches.h" 00011 #include "../GeneralInclude/DebugSupport.h" 00012 #include "../GeneralInclude/Constants.h" 00013 #include "../Base/CC_RootObject.h" 00014 #include "Manoeuvre.h" 00015 00016 Manoeuvre::Manoeuvre(void) { 00017 enabled = ENABLED; 00018 inUse = MAN_NOT_IN_USE; 00019 executing = MAN_NOT_EXECUTING; 00020 suspended = MAN_NOT_SUSPENDED; 00021 activationStepCounter = 0; 00022 } 00023 00024 void Manoeuvre::internalAbort(void) { 00025 return; 00026 } 00027 00028 void Manoeuvre::internalTerminate(void) { 00029 return; 00030 } 00031 00032 bool Manoeuvre::internalCanStart(void) { 00033 return MAN_CAN_START; 00034 } 00035 00036 bool Manoeuvre::canStart(void) { 00037 assert( !executing ); 00038 00039 if ( !isEnabled() ) 00040 return MAN_CANNOT_START; 00041 else 00042 return internalCanStart(); 00043 } 00044 00045 void Manoeuvre::initialize(void) { 00046 assert( !executing ); 00047 return; 00048 } 00049 00050 bool Manoeuvre::canContinue(void) { 00051 assert( executing ); 00052 return MAN_CAN_CONTINUE; 00053 } 00054 00055 TD_CheckCode Manoeuvre::getContinuationCheckCode(void) const { 00056 return 0; 00057 } 00058 00059 void Manoeuvre::doContinue(void) { 00060 00061 if ( !executing ) { 00062 executing = true; 00063 activationStepCounter = 0; 00064 CC_RootObject::getEventRepository()->create(this,EVT_MAN_STARTED); 00065 } 00066 00067 if ( !isSuspended() ) { 00068 activationStepCounter++; 00069 doInternalContinue(); 00070 } 00071 } 00072 00073 void Manoeuvre::abort(void) { 00074 suspended = false; 00075 00076 if (executing) { 00077 executing = false; 00078 CC_RootObject::getEventRepository()->create(this,EVT_MAN_ABORTED); 00079 internalAbort(); 00080 } 00081 } 00082 00083 void Manoeuvre::terminate(void) { 00084 assert( executing ); 00085 suspended = false; 00086 executing = false; 00087 CC_RootObject::getEventRepository()->create(this,EVT_MAN_TERMINATED); 00088 internalTerminate(); 00089 } 00090 00091 void Manoeuvre::setInUse(bool newInUse) { 00092 inUse = newInUse; 00093 } 00094 00095 bool Manoeuvre::isInUse(void) const { 00096 return inUse; 00097 } 00098 00099 void Manoeuvre::setIsSuspended(bool newIsSuspended) { 00100 if ( suspended && !newIsSuspended ) 00101 CC_RootObject::getEventRepository()->create(this,EVT_MAN_RESUMED); 00102 else if ( !suspended && newIsSuspended ) 00103 CC_RootObject::getEventRepository()->create(this,EVT_MAN_SUSPENDED); 00104 suspended = newIsSuspended; 00105 } 00106 00107 bool Manoeuvre::isSuspended(void) const { 00108 return suspended; 00109 } 00110 00111 bool Manoeuvre::isExecuting(void) const { 00112 return executing; 00113 } 00114 00115 void Manoeuvre::setEnabled(bool enabledStatus) { 00116 enabled = enabledStatus; 00117 } 00118 00119 bool Manoeuvre::isEnabled(void) const { 00120 return enabled; 00121 } 00122 00123 unsigned int Manoeuvre::getActivationStepCounter(void) const { 00124 return activationStepCounter; 00125 }
Copyright 2003 P&P Software GmbH - All Rights Reserved