Changes in src/stackclass.hpp [e138de:a67d19]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/stackclass.hpp
re138de ra67d19 72 72 return true; 73 73 } else { 74 eLog() << Verbose(0) << "ERROR: Stack is full, " << "Stack: CurrentLastEntry " << CurrentLastEntry<< "\tCurrentFirstEntry " << CurrentFirstEntry << "\tNextFreeField " << NextFreeField << "\tEntryCount " << EntryCount << "!" << endl;74 DoeLog(1) && (eLog()<< Verbose(1) << "Stack is full, " << "Stack: CurrentLastEntry " << CurrentLastEntry<< "\tCurrentFirstEntry " << CurrentFirstEntry << "\tNextFreeField " << NextFreeField << "\tEntryCount " << EntryCount << "!" << endl); 75 75 return false; 76 76 } … … 87 87 Walker = StackList[CurrentFirstEntry]; 88 88 if (Walker == NULL) 89 eLog() << Verbose(0) << "ERROR: Stack's field is empty!" << endl;89 DoeLog(1) && (eLog()<< Verbose(1) << "Stack's field is empty!" << endl); 90 90 StackList[CurrentFirstEntry] = NULL; 91 91 if (CurrentFirstEntry != CurrentLastEntry) { // hasn't last item been popped as well? … … 96 96 } 97 97 } else 98 eLog() << Verbose(0) << "ERROR: Stack is empty!" << endl;98 DoeLog(1) && (eLog()<< Verbose(1) << "Stack is empty!" << endl); 99 99 return Walker; 100 100 }; … … 111 111 StackList[CurrentLastEntry] = NULL; 112 112 if (Walker == NULL) 113 eLog() << Verbose(0) << "ERROR: Stack's field is empty!" << endl;113 DoeLog(1) && (eLog()<< Verbose(1) << "Stack's field is empty!" << endl); 114 114 NextFreeField = CurrentLastEntry; 115 115 if (CurrentLastEntry != CurrentFirstEntry) // has there been more than one item on stack 116 116 CurrentLastEntry = (CurrentLastEntry + (EntryCount-1)) % EntryCount; // step back from current free field to last (modulo does not work in -1, thus go EntryCount-1 instead) 117 117 } else { 118 eLog() << Verbose(0) << "ERROR: Stack is empty!" << endl;118 DoeLog(1) && (eLog()<< Verbose(1) << "Stack is empty!" << endl); 119 119 } 120 120 return Walker; … … 130 130 { 131 131 bool found = false; 132 Log() << Verbose(5) << "First " << CurrentFirstEntry<< "\tLast " << CurrentLastEntry<< "\tNext " << NextFreeField<< "\tCount " << EntryCount<< "." << endl;132 DoLog(5) && (Log() << Verbose(5) << "First " << CurrentFirstEntry<< "\tLast " << CurrentLastEntry<< "\tNext " << NextFreeField<< "\tCount " << EntryCount<< "." << endl); 133 133 int i=CurrentFirstEntry; 134 134 if (!IsEmpty()) 135 135 do { 136 136 if (StackList[i] == ptr) { // if item found, remove 137 Log() << Verbose(5) << "Item " << *ptr << " was number " << i << " on stack, removing it." << endl;137 DoLog(5) && (Log() << Verbose(5) << "Item " << *ptr << " was number " << i << " on stack, removing it." << endl); 138 138 found = true; 139 139 StackList[i] = NULL; … … 141 141 if ((found) && (StackList[i] != NULL)) { // means we have to shift (and not the removed item) 142 142 if (i == 0) { // we are down to first item in stack, have to put onto last item 143 Log() << Verbose(5) << "Shifting item 0 to place " << EntryCount-1 << "." << endl;143 DoLog(5) && (Log() << Verbose(5) << "Shifting item 0 to place " << EntryCount-1 << "." << endl); 144 144 StackList[EntryCount-1] = StackList[0]; 145 145 } else { 146 Log() << Verbose(5) << "Shifting item " << i << " to place " << i-1 << "." << endl;146 DoLog(5) && (Log() << Verbose(5) << "Shifting item " << i << " to place " << i-1 << "." << endl); 147 147 StackList[i-1] = StackList[i]; 148 148 } … … 151 151 } while (i!=NextFreeField); 152 152 else 153 eLog() << Verbose(0) << "ERROR: Stack is already empty!" << endl;153 DoeLog(1) && (eLog()<< Verbose(1) << "Stack is already empty!" << endl); 154 154 if (found) { 155 155 NextFreeField = CurrentLastEntry;
Note:
See TracChangeset
for help on using the changeset viewer.