Changes in src/Bond/BondInfo.cpp [5aaa43:c26617]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Bond/BondInfo.cpp
r5aaa43 rc26617 61 61 atom * const rightatom = World::getInstance().getAtom(AtomById(rightid)); 62 62 if ((leftatom == NULL) || (rightatom == NULL)) { 63 ELOG(1, "Either of the two atoms " << leftid << " or "64 << rightid << " does not existsin the world.");63 // LOG(3, "DEBUG: Either of the two atoms " << leftid << " or " 64 // << rightid << " does not exist 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 73 68 const BondList &rightbonds = rightatom->getListOfBonds(); 74 if (std::find_if(rightbonds.begin(), rightbonds.end(), predicate) != rightbonds.end()) 75 return false; 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 } 76 79 77 80 // create bond … … 81 84 return true; 82 85 } 86 87 void BondInfo::RemoveBond() const 88 { 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.