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();
SRGraphDataList* pList=(SRGraphDataList *)m_Graph.GetDataList()-> GetAt(p);
delete pList;
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.