Ignore:
Timestamp:
Mar 3, 2010, 5:47:40 PM (16 years ago)
Author:
Tillmann Crueger <crueger@…>
Children:
4938aa, f058ef
Parents:
14d898
Message:

Added mechanisms that allow reuse of IDs and changing Ids of Atoms

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/atom.cpp

    r14d898 r3746aeb  
    290290}
    291291
    292 void atom::setId(int _id) {
     292bool atom::changeId(atomId_t newId){
     293  // first we move ourselves in the world
     294  // the world lets us know if that succeeded
     295  if(world->changeAtomId(id,newId,this)){
     296    id = newId;
     297    return true;
     298  }
     299  else{
     300    return false;
     301  }
     302}
     303
     304void atom::setId(atomId_t _id) {
    293305  id=_id;
    294306}
     
    298310}
    299311
    300 atom* NewAtom(){
    301   return new atom();
    302 }
    303 
    304 void  DeleteAtom(atom* atom){
     312atom* NewAtom(atomId_t _id){
     313  atom * res =new atom();
     314  res->setId(_id);
     315  return res;
     316}
     317
     318void DeleteAtom(atom* atom){
    305319  delete atom;
    306320}
Note: See TracChangeset for help on using the changeset viewer.