void VolumeCollection::deserialize(XmlDeserializer& s) { std::vector<VolumeHandle*> handleList; s.deserialize("VolumeHandles", handleList, "VolumeHandle"); // add volume handles of loaded volumes... std::vector<VolumeHandle*> deleteList; for (std::vector<VolumeHandle*>::iterator it = handleList.begin(); it != handleList.end(); ++it) if ((*it) && static_cast<VolumeHandle*>((*it))->getNumRepresentations() > 0) add(*it); else deleteList.push_back(*it); // remove volume handles that were not able to load their volume... for (std::vector<VolumeHandle*>::iterator it = deleteList.begin(); it != deleteList.end(); ++it) { //remove(*it); s.freePointer(*it); delete *it; } }
void VolumeCollection::deserialize(XmlDeserializer& s) { std::vector<VolumeHandle*> handleList; s.deserialize("VolumeHandles", handleList, "VolumeHandle"); // add volume handles of loaded volumes... std::vector<VolumeHandle*> deleteList; for (std::vector<VolumeHandle*>::iterator it = handleList.begin(); it != handleList.end(); ++it) if ((*it) && (*it)->getVolume()) add(*it); else deleteList.push_back(*it); // remove volume handles that was not able to load its volume... for (std::vector<VolumeHandle*>::iterator it = deleteList.begin(); it != deleteList.end(); ++it) { //remove(*it); s.freePointer(*it); delete *it; } }