Changeset 8501eb for molecuilder/src
- Timestamp:
- Feb 3, 2010, 4:42:06 PM (16 years ago)
- Children:
- b9f422
- Parents:
- bc1fbf
- Location:
- molecuilder/src
- Files:
-
- 4 edited
-
Patterns/Observer.hpp (modified) (1 diff)
-
molecule.cpp (modified) (11 diffs)
-
moleculelist.cpp (modified) (2 diffs)
-
unittests/CacheableTest.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/Patterns/Observer.hpp
rbc1fbf r8501eb 87 87 88 88 #define OBSERVE Observable::_Observable_protector _scope_obs_protector(this) 89 #define START_OBSERVER Observable::start_observer_internal(this);do{do{}while(0) 90 #define FINISH_OBSERVER }while(0);Observable::finish_observer_internal(this) 91 #define RETURN_OBSERVER( retval ) do{Observable::finish_observer_internal(this); return (retval);}while(0) 89 // deprecated macros from before RAII was used 90 //#define START_OBSERVER Observable::start_observer_internal(this);do{do{}while(0) 91 //#define FINISH_OBSERVER }while(0);Observable::finish_observer_internal(this) 92 //#define RETURN_OBSERVER( retval ) do{Observable::finish_observer_internal(this); return (retval);}while(0) 92 93 #endif /* OBSERVER_HPP_ */ -
molecuilder/src/molecule.cpp
rbc1fbf r8501eb 71 71 72 72 void molecule::setName(const std::string _name){ 73 START_OBSERVER;73 OBSERVE; 74 74 strncpy(name,_name.c_str(),MAXSTRINGSIZE); 75 FINISH_OBSERVER;76 75 } 77 76 … … 104 103 { 105 104 bool retval = false; 106 START_OBSERVER;105 OBSERVE; 107 106 if (pointer != NULL) { 108 107 pointer->sort = &pointer->nr; … … 123 122 retval = add(pointer, end); 124 123 } 125 FINISH_OBSERVER;126 124 return retval; 127 125 }; … … 135 133 { 136 134 atom *retval = NULL; 137 START_OBSERVER;135 OBSERVE; 138 136 if (pointer != NULL) { 139 137 atom *walker = new atom(pointer); … … 147 145 retval=walker; 148 146 } 149 FINISH_OBSERVER;150 147 return retval; 151 148 }; … … 188 185 { 189 186 bool AllWentWell = true; // flag gathering the boolean return value of molecule::AddAtom and other functions, as return value on exit 190 START_OBSERVER;187 OBSERVE; 191 188 double bondlength; // bond length of the bond to be replaced/cut 192 189 double bondangle; // bond angle of the bond to be replaced/cut … … 235 232 if (BondRescale == -1) { 236 233 eLog() << Verbose(1) << "There is no typical hydrogen bond distance in replacing bond (" << TopOrigin->Name << "<->" << TopReplacement->Name << ") of degree " << TopBond->BondDegree << "!" << endl; 237 RETURN_OBSERVER(false);234 return false; 238 235 BondRescale = bondlength; 239 236 } else { … … 315 312 if (bondangle == -1) { 316 313 eLog() << Verbose(1) << "There is no typical hydrogen bond angle in replacing bond (" << TopOrigin->Name << "<->" << TopReplacement->Name << ") of degree " << TopBond->BondDegree << "!" << endl; 317 RETURN_OBSERVER(false);314 return false; 318 315 bondangle = 0; 319 316 } … … 442 439 Free(&matrix); 443 440 444 FINISH_OBSERVER;445 441 // Log() << Verbose(3) << "End of AddHydrogenReplacementAtom." << endl; 446 442 return AllWentWell; … … 468 464 return false; 469 465 470 START_OBSERVER;466 OBSERVE; 471 467 getline(xyzfile,line,'\n'); // Read numer of atoms in file 472 468 input = new istringstream(line); … … 509 505 xyzfile.close(); 510 506 delete(input); 511 FINISH_OBSERVER;512 507 return true; 513 508 }; -
molecuilder/src/moleculelist.cpp
rbc1fbf r8501eb 50 50 void MoleculeListClass::insert(molecule *mol) 51 51 { 52 START_OBSERVER;52 OBSERVE; 53 53 mol->IndexNr = MaxIndex++; 54 54 ListOfMolecules.push_back(mol); 55 55 mol->signOn(this); 56 FINISH_OBSERVER;57 56 }; 58 57 … … 892 891 893 892 void MoleculeListClass::createNewMolecule(periodentafel *periode) { 894 START_OBSERVER;893 OBSERVE; 895 894 molecule *mol = NULL; 896 895 mol = new molecule(periode); 897 896 insert(mol); 898 FINISH_OBSERVER;899 897 }; 900 898 -
molecuilder/src/unittests/CacheableTest.cpp
rbc1fbf r8501eb 27 27 28 28 void setX(int _x){ 29 START_OBSERVER;;29 OBSERVE; 30 30 x = _x; 31 FINISH_OBSERVER;32 31 } 33 32 34 33 void setY 35 34 (int _y){ 36 START_OBSERVER;;35 OBSERVE; 37 36 y = _y; 38 FINISH_OBSERVER;39 37 } 40 38 41 39 void setZ(int _z){ 42 START_OBSERVER;;40 OBSERVE; 43 41 z = _z; 44 FINISH_OBSERVER;45 42 } 46 43
Note:
See TracChangeset
for help on using the changeset viewer.
