Objective Chart : PART I User’s Guide : Chapter 8 Data Storage Models : Deleting Groups
Deleting Groups
The data structures of the data storage system can be manipulated using standard MFC methods. SRGDataManager::m_data is a CPtrList, the groups (SRGraphDataList) are CObLists, and the data (SRGraphData) are CObjects. The SRGraphDataList destructor automatically deletes all of its SRGraphData objects. Therefore, the code to delete group group would look something like this.
 
int nLastGroup=0;
POSITION p=m_Graph.GetDataList()->GetHeadPosition();
while(nLastGroup<group)
{
m_Graph.GetDataList()->GetNext(p);
nLastGroup++;
}
SRGraphDataList* pList=(SRGraphDataList *)m_Graph.GetDataList()-> GetAt(p);
m_Graph.GetDataList()->RemoveAt(p);
delete pList;
InvalidateGroupPosition();
In order to speed up access to items in the data list, SRGraph and SRGraphDataList store the positions of the group and index that were most recently accessed. When the data lists are manipulated directly, these saved positions may become invalid. Call SRGraph::InvalidateGroupPosition() or SRGraphDataList::InvalidateIndexPosition() to ensure that these potentially invalid values are not used later.