Ignore:
Timestamp:
Feb 12, 2016, 11:15:06 PM (9 years ago)
Author:
Frederik Heber <heber@…>
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:
15c8a9
Parents:
099f67
git-author:
Frederik Heber <heber@…> (01/25/16 11:01:10)
git-committer:
Frederik Heber <heber@…> (02/12/16 23:15:06)
Message:

Changed GLMoleculeObject_...:countSubjectKilled() to taking id parameter.

  • this is a precursor for when the ObservedValues reside with QtInstanceInformationBoard.
  • enhanced ObservedValue_wCallback to take a bound getIndex function().
  • additionally, we route internally to ObservedValue::get() and this gets us out of the painful situation where we need to supply an index getter to the ObservedValue that monitors the index (and hence must be present already to bind to its get function).
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_molecule.cpp

    r099f67 r026bef  
    122122  hoverAtomId(-1)
    123123{
    124   boost::function<void()> subjectKilled =
    125       boost::bind(&GLMoleculeObject_molecule::countsubjectKilled, this);
     124  boost::function<void(const moleculeId_t)> subjectKilled =
     125      boost::bind(&GLMoleculeObject_molecule::countsubjectKilled, this, _molid);
    126126  initObservedValues(ObservedValues, _molid, molref, subjectKilled);
    127127
     
    138138  connect (this, SIGNAL(TesselationHullChanged()), this, SLOT(resetTesselationHull()), Qt::QueuedConnection);
    139139  connect (this, SIGNAL(BoundingBoxChanged()), this, SLOT(resetBoundingBox()), Qt::QueuedConnection);
    140   connect (this, SIGNAL(IsSelectedChanged()), this, SLOT(resetIsSelected()), Qt::QueuedConnection);
    141140  connect (this, SIGNAL(IdChanged()), this, SLOT(resetIndex()), Qt::QueuedConnection);
    142141  connect (this, SIGNAL(AtomInserted(const atomId_t)), this, SLOT(atomInserted(const atomId_t)), Qt::QueuedConnection);
     
    148147}
    149148
    150 GLMoleculeObject_molecule::GLMoleculeObject_molecule(QGLSceneNode *mesh[], QObject *parent, const moleculeId_t _molid) :
     149GLMoleculeObject_molecule::GLMoleculeObject_molecule(
     150    QGLSceneNode *mesh[],
     151    QObject *parent,
     152    const moleculeId_t _molid) :
    151153  GLMoleculeObject(mesh, parent),
    152154  Observer(std::string("GLMoleculeObject_molecule")+toString(_molid)),
     
    169171  hoverAtomId(-1)
    170172{
    171   boost::function<void()> subjectKilled =
    172       boost::bind(&GLMoleculeObject_molecule::countsubjectKilled, this);
     173  boost::function<void(const moleculeId_t)> subjectKilled =
     174      boost::bind(&GLMoleculeObject_molecule::countsubjectKilled, this, _molid);
    173175  initObservedValues(ObservedValues, _molid, molref, subjectKilled);
    174176
     
    480482  owner = NULL;
    481483
    482   countsubjectKilled();
     484  countsubjectKilled(getMolIndex());
    483485}
    484486
     
    844846}
    845847
    846 void GLMoleculeObject_molecule::countsubjectKilled()
     848void GLMoleculeObject_molecule::countsubjectKilled(const moleculeId_t)
    847849{
    848850  ++subjectKilledCount;
     
    856858    const moleculeId_t _molid,
    857859    const molecule * const _molref,
    858     const boost::function<void()> &_subjectKilled)
     860    const boost::function<void(const moleculeId_t)> &_subjectKilled)
    859861{
    860862  /* This is an old note from when the code was still part of cstor's initializer body.
     
    893895      boost::bind(&GLMoleculeObject_molecule::updateBoundingBox, MolIndexGetter));
    894896
    895   _ObservedValues[MolName] = new ObservedValue_wCallback<std::string>(
     897  _ObservedValues[MolName] = new ObservedValue_wCallback<std::string, moleculeId_t>(
    896898      _molref,
    897899      MolNameUpdater,
     
    899901      MolNameUpdater(),
    900902      NameChannels,
    901       _subjectKilled);
    902   _ObservedValues[BoundingBox] = new ObservedValue_wCallback<molecule::BoundingBoxInfo>(
     903      _subjectKilled,
     904      MolIndexGetter);
     905  _ObservedValues[BoundingBox] = new ObservedValue_wCallback<molecule::BoundingBoxInfo, moleculeId_t>(
    903906      _molref,
    904907      BoundingBoxUpdater,
     
    906909      initBoundingBox(),
    907910      BoundingBoxChannels,
    908       _subjectKilled);
     911      _subjectKilled,
     912      MolIndexGetter);
    909913  _ObservedValues[PresentAtoms] = new ObservedValue_UpdateAtoms(
    910914      _molref,
     
    919923{
    920924  delete boost::any_cast<ObservedValue_wCallback<moleculeId_t> *>(_ObservedValues[MolIndex]);
    921   delete boost::any_cast<ObservedValue_wCallback<std::string> *>(_ObservedValues[MolName]);
    922   delete boost::any_cast<ObservedValue_wCallback<molecule::BoundingBoxInfo> *>(_ObservedValues[BoundingBox]);
     925  delete boost::any_cast<ObservedValue_wCallback<std::string, moleculeId_t> *>(_ObservedValues[MolName]);
     926  delete boost::any_cast<ObservedValue_wCallback<molecule::BoundingBoxInfo, moleculeId_t> *>(_ObservedValues[BoundingBox]);
    923927  delete boost::any_cast<ObservedValue_UpdateAtoms *>(_ObservedValues[PresentAtoms]);
    924928  _ObservedValues.clear();
     
    932936std::string GLMoleculeObject_molecule::getMolName() const
    933937{
    934   return boost::any_cast<ObservedValue_wCallback<std::string> *>(ObservedValues[MolName])->get();
     938  return boost::any_cast<ObservedValue_wCallback<std::string, moleculeId_t> *>(ObservedValues[MolName])->get();
    935939}
    936940
    937941molecule::BoundingBoxInfo GLMoleculeObject_molecule::getBoundingBox() const
    938942{
    939   return boost::any_cast<ObservedValue_wCallback<molecule::BoundingBoxInfo> *>(ObservedValues[BoundingBox])->get();
     943  return boost::any_cast<ObservedValue_wCallback<molecule::BoundingBoxInfo, moleculeId_t> *>(ObservedValues[BoundingBox])->get();
    940944}
    941945
Note: See TracChangeset for help on using the changeset viewer.