Changes in src/Bond/BondInfo.cpp [c26617:5aaa43]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Bond/BondInfo.cpp
rc26617 r5aaa43 61 61 atom * const rightatom = World::getInstance().getAtom(AtomById(rightid)); 62 62 if ((leftatom == NULL) || (rightatom == NULL)) { 63 // LOG(3, "DEBUG:Either of the two atoms " << leftid << " or "64 // << rightid << " does not existin the world.");63 ELOG(1, "Either of the two atoms " << leftid << " or " 64 << rightid << " does not exists in the world."); 65 65 return false; 66 66 } 67 67 const BondList &leftbonds = leftatom->getListOfBonds(); 68 boost::function< bool (const bond::ptr )> predicate = 69 boost::bind(static_cast<bool (bond::*)(const int) const>(&bond::Contains), _1, rightid); 70 if (std::find_if(leftbonds.begin(), leftbonds.end(), predicate) != leftbonds.end()) 71 return false; 72 68 73 const BondList &rightbonds = rightatom->getListOfBonds(); 69 boost::function< bool (const bond::ptr )> leftpredicate = 70 boost::bind(static_cast<bool (bond::*)(const atomId_t) const>(&bond::ContainsId), _1, rightid); 71 boost::function< bool (const bond::ptr )> rightpredicate = 72 boost::bind(static_cast<bool (bond::*)(const atomId_t) const>(&bond::ContainsId), _1, leftid); 73 if ((std::find_if(leftbonds.begin(), leftbonds.end(), leftpredicate) != leftbonds.end()) 74 || (std::find_if(rightbonds.begin(), rightbonds.end(), rightpredicate) != rightbonds.end())) { 75 // LOG(3, "DEBUG: Bond between atoms " << leftid << " or "111 76 // << rightid << " is already present in the world."); 77 return true; 78 } 74 if (std::find_if(rightbonds.begin(), rightbonds.end(), predicate) != rightbonds.end()) 75 return false; 79 76 80 77 // create bond … … 84 81 return true; 85 82 } 86 87 void BondInfo::RemoveBond() const88 {89 atom * leftatom = World::getInstance().getAtom(AtomById(leftid));90 atom * rightatom = World::getInstance().getAtom(AtomById(rightid));91 leftatom->removeBond(rightatom);92 }
Note:
See TracChangeset
for help on using the changeset viewer.