Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Atom destructor
- OBAtom::~OBAtom()
- {
- if (_residue != NULL)
- {
- _residue->RemoveAtom(this);
- }
- /*
- if (!_vdata.empty())
- {
- vector<OBGenericData*>::iterator m;
- for (m = _vdata.begin();m != _vdata.end();++m)
- delete *m;
- _vdata.clear();
- }
- */
- }
- //OBMol destructor
- OBMol::~OBMol()
- {
- OBAtom *atom;
- OBBond *bond;
- OBResidue *residue;
- vector<OBAtom*>::iterator i;
- vector<OBBond*>::iterator j;
- vector<OBResidue*>::iterator r;
- for (atom = BeginAtom(i);atom;atom = NextAtom(i))
- DestroyAtom(atom);
- for (bond = BeginBond(j);bond;bond = NextBond(j))
- DestroyBond(bond);
- for (residue = BeginResidue(r);residue;residue = NextResidue(r))
- DestroyResidue(residue);
- //clear out the multiconformer data
- vector<double*>::iterator k;
- for (k = _vconf.begin();k != _vconf.end();++k)
- delete [] *k;
- _vconf.clear();
- }
- //function called within OBMol to destroy residue
- void OBMol::DestroyResidue(OBResidue *residue)
- {
- if (residue)
- {
- delete residue;
- residue = NULL;
- }
- }
- //Residue destructor
- OBResidue::~OBResidue()
- {
- vector<OBAtom*>::iterator a;
- for ( a = _atoms.begin() ; a != _atoms.end() ; a++ )
- (*a)->SetResidue(NULL);
- _atoms.clear();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement