tracemanager.cpp
来自「IO函数调用测试」· C++ 代码 · 共 81 行
CPP
81 行
#include "stdafx.h"
#include "afxtempl.h"
#include "TraceEvent.h"
#include "TraceManager.h"
TraceList TraceManager::hList;
/****************************************************************************
* TraceManager::Append
* Inputs:
* TraceEvent * e: Trace event to be added
* Result: POSITION
*
* Effect:
* Creates a CHandle object for the event
****************************************************************************/
POSITION TraceManager::Append(TraceEvent * e)
{
if(e == NULL)
return (POSITION)NULL;
return hList.AddTail(e);
}
/****************************************************************************
* TraceManager::Remove
* Inputs:
* TraceEvent * e: Event to be removed
* Result: void
*
* Effect:
* Removes the event from the event table.
****************************************************************************/
void TraceManager::Remove(TraceEvent * e)
{
POSITION p = hList.GetHeadPosition();
while(p != NULL)
{ /* loop */
POSITION lastp = p;
TraceEvent * t = hList.GetNext(p);
if(t == e)
{ /* delete it */
Remove(lastp);
return;
} /* delete it */
} /* loop */
ASSERT(FALSE); // should never be called if event not in list
}
/****************************************************************************
* TraceManager::Remove
* Inputs:
* POSITION p: Position of Handle Object to remove
* Result: BOOL
* TRUE if successful, FALSE if error
* Effect:
* Closes the handle associated with the handle object, deletes the
* handle object.
****************************************************************************/
void TraceManager::Remove(POSITION p)
{
hList.RemoveAt(p);
}
/****************************************************************************
* TraceManager::~TraceManager
* Effect:
* Deletes the object
****************************************************************************/
TraceManager::~TraceManager()
{
Clear();
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?