Example #1
0
void OperationHistory::DeleteLastOp(BOOL ReduceOpHistSize)
{
    Operation* pOpToDelete = FindLastOp();

    // The NowPtr needs to be set to the previous operation - if one exists
    // if not then NULL is an OK state for the NowPtr
    NowPtr = OpHistoryList.GetPrev(NowPtr);

    if (ReduceOpHistSize)
    {
        DecSize(pOpToDelete->GetSize());  // Reduce history size
    }

    OpHistoryList.RemoveItem((ListItem*)pOpToDelete);   // Remove the operation from the
    // history list but don't delete it yet
    pOpToDelete->DeleteOnEnd();							// Mark it for deletion when it's safe
    // to do so.
}
Example #2
0
void OperationHistory::DeletePrevToLastOp(BOOL ReduceOpHistSize)
{
    // find the previous operation
    Operation *pPrev = (Operation *)OpHistoryList.GetPrev(NowPtr); // get the PrevToLastOp

    if (pPrev != NULL)
    {
        if (ReduceOpHistSize)
        {
            DecSize(pPrev->GetSize());  // Reduce history size
        }

        // remove it from the list
        OpHistoryList.RemoveItem((ListItem*)pPrev);   // Remove the operation from the
        // history list

        // delete it
        delete pPrev;
    }
}