Changes in src/molecule.cpp [6a3c83:575343]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/molecule.cpp
r6a3c83 r575343 67 67 last_atom(0) 68 68 { 69 // add specific channels70 Channels *OurChannel = new Channels;71 NotificationChannels.insert( std::make_pair( this, OurChannel) );72 for (size_t type = 0; type < (size_t)NotificationType_MAX; ++type)73 OurChannel->addChannel(type);74 69 75 70 strcpy(name,World::getInstance().getDefaultName().c_str()); … … 112 107 void molecule::setName(const std::string _name){ 113 108 OBSERVE; 114 NOTIFY(MoleculeNameChanged);115 109 cout << "Set name of molecule " << getId() << " to " << _name << endl; 116 110 strncpy(name,_name.c_str(),MAXSTRINGSIZE); … … 120 114 OBSERVE; 121 115 if(atomIdPool.reserveId(newNr)){ 122 NOTIFY(AtomNrChanged);123 116 if (oldNr != -1) // -1 is reserved and indicates no number 124 117 atomIdPool.releaseId(oldNr); … … 179 172 { 180 173 OBSERVE; 181 NOTIFY(AtomRemoved);182 174 const_iterator iter = loc; 183 175 ++iter; 184 176 atom * const _atom = const_cast<atom *>(*loc); 185 177 atomIds.erase( _atom->getId() ); 186 {187 NOTIFY(AtomNrChanged);188 atomIdPool.releaseId(_atom->getNr());189 _atom->setNr(-1);190 }191 178 formula-=_atom->getType(); 192 179 _atom->removeFromMolecule(); … … 197 184 { 198 185 OBSERVE; 199 NOTIFY(AtomRemoved);200 186 const_iterator iter = find(key); 201 187 if (iter != end()){ 202 188 ++iter; 203 189 atomIds.erase( key->getId() ); 204 { 205 NOTIFY(AtomNrChanged); 206 atomIdPool.releaseId(key->getNr()); 207 key->setNr(-1); 208 } 190 atomIdPool.releaseId(key->getNr()); 191 key->setNr(-1); 209 192 formula-=key->getType(); 210 193 key->removeFromMolecule(); … … 216 199 { 217 200 OBSERVE; 218 NOTIFY(AtomInserted);219 201 std::pair<iterator,bool> res = atomIds.insert(key->getId()); 220 202 if (res.second) { // push atom if went well 221 NOTIFY(AtomNrChanged);222 203 key->setNr(atomIdPool.getNextId()); 223 204 setAtomName(key); … … 251 232 bool molecule::AddAtom(atom *pointer) 252 233 { 234 OBSERVE; 253 235 if (pointer != NULL) { 254 236 insert(pointer); … … 266 248 { 267 249 atom *retval = NULL; 250 OBSERVE; 268 251 if (pointer != NULL) { 269 252 atom *walker = pointer->clone(); … … 315 298 // Info info(__func__); 316 299 bool AllWentWell = true; // flag gathering the boolean return value of molecule::AddAtom and other functions, as return value on exit 300 OBSERVE; 317 301 double bondlength; // bond length of the bond to be replaced/cut 318 302 double bondangle; // bond angle of the bond to be replaced/cut … … 672 656 bond * molecule::AddBond(atom *atom1, atom *atom2, int degree) 673 657 { 658 OBSERVE; 674 659 bond *Binder = NULL; 675 660 … … 729 714 void molecule::SetNameFromFilename(const char *filename) 730 715 { 716 OBSERVE; 731 717 int length = 0; 732 718 const char *molname = strrchr(filename, '/'); … … 763 749 { 764 750 ASSERT(pointer, "Null pointer passed to molecule::RemoveAtom()."); 751 OBSERVE; 765 752 RemoveBonds(pointer); 766 753 pointer->removeFromMolecule();
Note:
See TracChangeset
for help on using the changeset viewer.