Changeset bf6245 for src/UIElements/Qt4/InstanceBoard
- Timestamp:
- Apr 20, 2016, 8:53:33 AM (9 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
- Children:
- 6af6a62
- Parents:
- ee3fb8
- git-author:
- Frederik Heber <heber@…> (03/23/16 09:56:51)
- git-committer:
- Frederik Heber <heber@…> (04/20/16 08:53:33)
- Location:
- src/UIElements/Qt4/InstanceBoard
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/Qt4/InstanceBoard/QtObservedMolecule.cpp
ree3fb8 rbf6245 114 114 ObservedValues(QtObservedMolecule::MAX_ObservedTypes) 115 115 { 116 boost::function<void ( const atomId_t)> moleculeSubjectKilled(116 boost::function<void (ObservedValue_Index_t)> moleculeSubjectKilled( 117 117 boost::bind(&QtObservedMolecule::countValuesSubjectKilled, 118 118 boost::ref(*this), 119 _1));119 boost::bind(&QtObservedMolecule::getIndex, boost::ref(*this)))); 120 120 initObservedValues(ObservedValues, _id, _mol, moleculeSubjectKilled); 121 121 … … 125 125 QtObservedMolecule::~QtObservedMolecule() 126 126 { 127 boost::any_cast<ObservedValue_wCallback<moleculeId_t > *>(ObservedValues[MolIndex])->noteCallBackIsGone();128 boost::any_cast<ObservedValue_wCallback<int, moleculeId_t> *>(ObservedValues[AtomCount])->noteCallBackIsGone();129 boost::any_cast<ObservedValue_wCallback<int, moleculeId_t> *>(ObservedValues[BondCount])->noteCallBackIsGone();130 boost::any_cast<ObservedValue_wCallback<molecule::BoundingBoxInfo, moleculeId_t> *>(ObservedValues[BoundingBox])->noteCallBackIsGone();131 boost::any_cast<ObservedValue_wCallback<std::string, moleculeId_t> *>(ObservedValues[FormulaString])->noteCallBackIsGone();132 boost::any_cast<ObservedValue_wCallback<Vector, moleculeId_t> *>(ObservedValues[MolCenter])->noteCallBackIsGone();133 boost::any_cast<ObservedValue_wCallback<std::string, moleculeId_t> *>(ObservedValues[MolName])->noteCallBackIsGone();134 boost::any_cast<ObservedValue_wCallback<int, moleculeId_t> *>(ObservedValues[NonHydrogenCount])->noteCallBackIsGone();135 boost::any_cast<ObservedValue_wCallback<bool, moleculeId_t> *>(ObservedValues[MolSelected])->noteCallBackIsGone();127 boost::any_cast<ObservedValue_wCallback<moleculeId_t, ObservedValue_Index_t> *>(ObservedValues[MolIndex])->noteCallBackIsGone(); 128 boost::any_cast<ObservedValue_wCallback<int, ObservedValue_Index_t> *>(ObservedValues[AtomCount])->noteCallBackIsGone(); 129 boost::any_cast<ObservedValue_wCallback<int, ObservedValue_Index_t> *>(ObservedValues[BondCount])->noteCallBackIsGone(); 130 boost::any_cast<ObservedValue_wCallback<molecule::BoundingBoxInfo, ObservedValue_Index_t> *>(ObservedValues[BoundingBox])->noteCallBackIsGone(); 131 boost::any_cast<ObservedValue_wCallback<std::string, ObservedValue_Index_t> *>(ObservedValues[FormulaString])->noteCallBackIsGone(); 132 boost::any_cast<ObservedValue_wCallback<Vector, ObservedValue_Index_t> *>(ObservedValues[MolCenter])->noteCallBackIsGone(); 133 boost::any_cast<ObservedValue_wCallback<std::string, ObservedValue_Index_t> *>(ObservedValues[MolName])->noteCallBackIsGone(); 134 boost::any_cast<ObservedValue_wCallback<int, ObservedValue_Index_t> *>(ObservedValues[NonHydrogenCount])->noteCallBackIsGone(); 135 boost::any_cast<ObservedValue_wCallback<bool, ObservedValue_Index_t> *>(ObservedValues[MolSelected])->noteCallBackIsGone(); 136 136 137 137 deactivateObserver(); … … 180 180 ++signedOffChannels; 181 181 182 checkForRemoval( );183 } 184 185 void QtObservedMolecule::countValuesSubjectKilled( const moleculeId_t _id)186 { 187 ASSERT( _id == get MolIndex(),188 "QtObservedAtom::countValuesSubjectKilled() - molecule "+toString(get MolIndex())182 checkForRemoval(getIndex()); 183 } 184 185 void QtObservedMolecule::countValuesSubjectKilled(ObservedValue_Index_t _id) 186 { 187 ASSERT( _id == getIndex(), 188 "QtObservedAtom::countValuesSubjectKilled() - molecule "+toString(getIndex()) 189 189 +" received countValuesSubjectKilled for molecule id "+toString(_id)+"."); 190 190 191 191 ++subjectKilledCount; 192 192 193 checkForRemoval( );194 } 195 196 void QtObservedMolecule::checkForRemoval( )193 checkForRemoval(_id); 194 } 195 196 void QtObservedMolecule::checkForRemoval(ObservedValue_Index_t _id) 197 197 { 198 198 if ((signedOffChannels == AllsignedOnChannels) && (subjectKilledCount == MAX_ObservedTypes)) { … … 203 203 204 204 if (!BoardIsGone) { 205 board.markObservedMoleculeAsDisconnected( getIndex());206 board.markObservedMoleculeForErase( getIndex());205 board.markObservedMoleculeAsDisconnected(_id); 206 board.markObservedMoleculeForErase(_id); 207 207 } 208 208 } … … 321 321 const moleculeId_t _molid, 322 322 const molecule * const _molref, 323 const boost::function<void(const moleculeId_t)> &_subjectKilled) 324 { 325 /* This is an old note from when the code was still part of cstor's initializer body. 326 * TODO: Probably does not apply anymore but has not yet been tested. 327 * 328 * We must not use boost::cref(this) as "this" has not been properly constructed and seemingly 329 * boost::cref tries to do some magic to grasp the inheritance hierarchy which fails because 330 * the class has not been fully constructed yet. "This" itself seems to be working fine. 331 */ 332 323 const boost::function<void(ObservedValue_Index_t)> &_subjectKilled) 324 { 333 325 ASSERT( _ObservedValues.size() == MAX_ObservedTypes, 334 326 "QtObservedMolecule::initObservedValues() - given ObservedValues has not correct size."); 335 327 336 328 // fill ObservedValues: index first 329 const boost::function<ObservedValue_Index_t ()> MolIndexGetter = 330 boost::bind(&QtObservedMolecule::getIndex, 331 boost::cref(*this)); 332 333 // fill ObservedValues: then all the other that need index 337 334 const boost::function<moleculeId_t ()> MolIndexUpdater( 338 335 boost::bind(&QtObservedMolecule::updateIndex, boost::cref(*_molref))); 339 340 ObservedValue_wCallback<moleculeId_t> * const IndexObservable =341 new ObservedValue_wCallback<moleculeId_t>(342 _molref,343 MolIndexUpdater,344 "MoleculeIndex_"+toString(_molid),345 _molid,346 IndexChannels,347 _subjectKilled);348 _ObservedValues[MolIndex] = IndexObservable;349 350 const boost::function<const moleculeId_t ()> MolIndexGetter =351 boost::bind(&ObservedValue_wCallback<moleculeId_t>::get,352 IndexObservable);353 354 // fill ObservedValues: then all the other that need index355 336 const boost::function<int ()> AtomCountUpdater( 356 337 boost::bind(&QtObservedMolecule::updateAtomCount, boost::cref(*_molref))); … … 370 351 boost::bind(&QtObservedMolecule::updateSelected, boost::cref(*_molref))); 371 352 372 _ObservedValues[AtomCount] = new ObservedValue_wCallback<int, moleculeId_t>( 353 _ObservedValues[MolIndex] = new ObservedValue_wCallback<moleculeId_t, ObservedValue_Index_t>( 354 _molref, 355 MolIndexUpdater, 356 "MoleculeIndex_"+toString(_molid), 357 _molid, 358 IndexChannels, 359 _subjectKilled, 360 MolIndexGetter); 361 _ObservedValues[AtomCount] = new ObservedValue_wCallback<int, ObservedValue_Index_t>( 373 362 _molref, 374 363 AtomCountUpdater, … … 378 367 _subjectKilled, 379 368 MolIndexGetter); 380 _ObservedValues[BondCount] = new ObservedValue_wCallback<int, moleculeId_t>(369 _ObservedValues[BondCount] = new ObservedValue_wCallback<int, ObservedValue_Index_t>( 381 370 _molref, 382 371 BondCountUpdater, … … 386 375 _subjectKilled, 387 376 MolIndexGetter); 388 _ObservedValues[BoundingBox] = new ObservedValue_wCallback<molecule::BoundingBoxInfo, moleculeId_t>(377 _ObservedValues[BoundingBox] = new ObservedValue_wCallback<molecule::BoundingBoxInfo, ObservedValue_Index_t>( 389 378 _molref, 390 379 BoundingBoxUpdater, … … 394 383 _subjectKilled, 395 384 MolIndexGetter); 396 _ObservedValues[FormulaString] = new ObservedValue_wCallback<std::string, moleculeId_t>(385 _ObservedValues[FormulaString] = new ObservedValue_wCallback<std::string, ObservedValue_Index_t>( 397 386 _molref, 398 387 MolFormulaUpdater, … … 402 391 _subjectKilled, 403 392 MolIndexGetter); 404 _ObservedValues[MolCenter] = new ObservedValue_wCallback<Vector, moleculeId_t>(393 _ObservedValues[MolCenter] = new ObservedValue_wCallback<Vector, ObservedValue_Index_t>( 405 394 _molref, 406 395 MolCenterUpdater, … … 410 399 _subjectKilled, 411 400 MolIndexGetter); 412 _ObservedValues[MolName] = new ObservedValue_wCallback<std::string, moleculeId_t>(401 _ObservedValues[MolName] = new ObservedValue_wCallback<std::string, ObservedValue_Index_t>( 413 402 _molref, 414 403 MolNameUpdater, … … 418 407 _subjectKilled, 419 408 MolIndexGetter); 420 _ObservedValues[NonHydrogenCount] = new ObservedValue_wCallback<int, moleculeId_t>(409 _ObservedValues[NonHydrogenCount] = new ObservedValue_wCallback<int, ObservedValue_Index_t>( 421 410 _molref, 422 411 NonHydrogenCountUpdater, … … 426 415 _subjectKilled, 427 416 MolIndexGetter); 428 _ObservedValues[MolSelected] = new ObservedValue_wCallback<bool, moleculeId_t>(417 _ObservedValues[MolSelected] = new ObservedValue_wCallback<bool, ObservedValue_Index_t>( 429 418 _molref, 430 419 SelectedUpdater, … … 439 428 std::vector<boost::any> &_ObservedValues) 440 429 { 441 delete boost::any_cast<ObservedValue_wCallback<moleculeId_t > *>(_ObservedValues[MolIndex]);442 delete boost::any_cast<ObservedValue_wCallback<int, moleculeId_t> *>(_ObservedValues[AtomCount]);443 delete boost::any_cast<ObservedValue_wCallback<int, moleculeId_t> *>(_ObservedValues[BondCount]);444 delete boost::any_cast<ObservedValue_wCallback<molecule::BoundingBoxInfo, moleculeId_t> *>(_ObservedValues[BoundingBox]);445 delete boost::any_cast<ObservedValue_wCallback<std::string, moleculeId_t> *>(_ObservedValues[FormulaString]);446 delete boost::any_cast<ObservedValue_wCallback<Vector, moleculeId_t> *>(_ObservedValues[MolCenter]);447 delete boost::any_cast<ObservedValue_wCallback<std::string, moleculeId_t> *>(_ObservedValues[MolName]);448 delete boost::any_cast<ObservedValue_wCallback<int, moleculeId_t> *>(_ObservedValues[NonHydrogenCount]);449 delete boost::any_cast<ObservedValue_wCallback<bool, moleculeId_t> *>(_ObservedValues[MolSelected]);430 delete boost::any_cast<ObservedValue_wCallback<moleculeId_t, ObservedValue_Index_t> *>(_ObservedValues[MolIndex]); 431 delete boost::any_cast<ObservedValue_wCallback<int, ObservedValue_Index_t> *>(_ObservedValues[AtomCount]); 432 delete boost::any_cast<ObservedValue_wCallback<int, ObservedValue_Index_t> *>(_ObservedValues[BondCount]); 433 delete boost::any_cast<ObservedValue_wCallback<molecule::BoundingBoxInfo, ObservedValue_Index_t> *>(_ObservedValues[BoundingBox]); 434 delete boost::any_cast<ObservedValue_wCallback<std::string, ObservedValue_Index_t> *>(_ObservedValues[FormulaString]); 435 delete boost::any_cast<ObservedValue_wCallback<Vector, ObservedValue_Index_t> *>(_ObservedValues[MolCenter]); 436 delete boost::any_cast<ObservedValue_wCallback<std::string, ObservedValue_Index_t> *>(_ObservedValues[MolName]); 437 delete boost::any_cast<ObservedValue_wCallback<int, ObservedValue_Index_t> *>(_ObservedValues[NonHydrogenCount]); 438 delete boost::any_cast<ObservedValue_wCallback<bool, ObservedValue_Index_t> *>(_ObservedValues[MolSelected]); 450 439 _ObservedValues.clear(); 451 440 } … … 532 521 const int& QtObservedMolecule::getAtomCount() const 533 522 { 534 return boost::any_cast<ObservedValue_wCallback<int, moleculeId_t> *>(ObservedValues[AtomCount])->get();523 return boost::any_cast<ObservedValue_wCallback<int, ObservedValue_Index_t> *>(ObservedValues[AtomCount])->get(); 535 524 } 536 525 537 526 const int& QtObservedMolecule::getBondCount() const 538 527 { 539 return boost::any_cast<ObservedValue_wCallback<int, moleculeId_t> *>(ObservedValues[BondCount])->get();528 return boost::any_cast<ObservedValue_wCallback<int, ObservedValue_Index_t> *>(ObservedValues[BondCount])->get(); 540 529 } 541 530 542 531 const std::string& QtObservedMolecule::getMolFormula() const 543 532 { 544 return boost::any_cast<ObservedValue_wCallback<std::string, moleculeId_t> *>(ObservedValues[FormulaString])->get();533 return boost::any_cast<ObservedValue_wCallback<std::string, ObservedValue_Index_t> *>(ObservedValues[FormulaString])->get(); 545 534 } 546 535 547 536 const Vector& QtObservedMolecule::getMolCenter() const 548 537 { 549 return boost::any_cast<ObservedValue_wCallback<Vector, moleculeId_t> *>(ObservedValues[MolCenter])->get();538 return boost::any_cast<ObservedValue_wCallback<Vector, ObservedValue_Index_t> *>(ObservedValues[MolCenter])->get(); 550 539 } 551 540 552 541 const moleculeId_t& QtObservedMolecule::getMolIndex() const 553 542 { 554 return boost::any_cast<ObservedValue_wCallback<moleculeId_t > *>(ObservedValues[MolIndex])->get();543 return boost::any_cast<ObservedValue_wCallback<moleculeId_t, ObservedValue_Index_t> *>(ObservedValues[MolIndex])->get(); 555 544 } 556 545 557 546 const std::string& QtObservedMolecule::getMolName() const 558 547 { 559 return boost::any_cast<ObservedValue_wCallback<std::string, moleculeId_t> *>(ObservedValues[MolName])->get();548 return boost::any_cast<ObservedValue_wCallback<std::string, ObservedValue_Index_t> *>(ObservedValues[MolName])->get(); 560 549 } 561 550 562 551 const int& QtObservedMolecule::getNonHydrogenCount() const 563 552 { 564 return boost::any_cast<ObservedValue_wCallback<int, moleculeId_t> *>(ObservedValues[NonHydrogenCount])->get();553 return boost::any_cast<ObservedValue_wCallback<int, ObservedValue_Index_t> *>(ObservedValues[NonHydrogenCount])->get(); 565 554 } 566 555 567 556 const molecule::BoundingBoxInfo& QtObservedMolecule::getBoundingBox() const 568 557 { 569 return boost::any_cast<ObservedValue_wCallback<molecule::BoundingBoxInfo, moleculeId_t> *>(ObservedValues[BoundingBox])->get();558 return boost::any_cast<ObservedValue_wCallback<molecule::BoundingBoxInfo, ObservedValue_Index_t> *>(ObservedValues[BoundingBox])->get(); 570 559 } 571 560 572 561 const bool& QtObservedMolecule::getMolSelected() const 573 562 { 574 return boost::any_cast<ObservedValue_wCallback<bool, moleculeId_t> *>(ObservedValues[MolSelected])->get();575 } 563 return boost::any_cast<ObservedValue_wCallback<bool, ObservedValue_Index_t> *>(ObservedValues[MolSelected])->get(); 564 } -
src/UIElements/Qt4/InstanceBoard/QtObservedMolecule.hpp
ree3fb8 rbf6245 244 244 const moleculeId_t _molid, 245 245 const molecule * const _molref, 246 const boost::function<void( const moleculeId_t)> &_subjectKilled);246 const boost::function<void(ObservedValue_Index_t)> &_subjectKilled); 247 247 248 248 /** Destroys all \a ObservedValues entries. … … 265 265 * \param _id id to check against ours 266 266 */ 267 void countValuesSubjectKilled( const atomId_t _id);267 void countValuesSubjectKilled(ObservedValue_Index_t _id); 268 268 269 269 //!> counts how many ObservedValues have already been subjectKilled() … … 273 273 * this instance and all its internal observed values. 274 274 * 275 */ 276 void checkForRemoval(); 275 * \param _id id to check against ours 276 */ 277 void checkForRemoval(ObservedValue_Index_t _id); 277 278 278 279 private:
Note:
See TracChangeset
for help on using the changeset viewer.