Changeset f0964c


Ignore:
Timestamp:
Oct 14, 2013, 11:41:38 PM (11 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:
b677ab
Parents:
4b2e05
git-author:
Frederik Heber <heber@…> (09/07/13 15:10:08)
git-committer:
Frederik Heber <heber@…> (10/14/13 23:41:38)
Message:

QtHomologyList also observes PotentialRegistry.

Location:
src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/Potentials/PotentialRegistry.cpp

    r4b2e05 rf0964c  
    4040#include "CodePatterns/Registry_impl.hpp"
    4141
     42PotentialRegistry::PotentialRegistry() :
     43  Observable("PotentialRegistry")
     44{}
     45
     46
     47void PotentialRegistry::registerInstance(EmpiricalPotential *potential)
     48{
     49  OBSERVE;
     50  Registry<EmpiricalPotential>::registerInstance(potential);
     51}
     52void PotentialRegistry::unregisterInstance(EmpiricalPotential *potential)
     53{
     54  OBSERVE;
     55  Registry<EmpiricalPotential>::unregisterInstance(potential);
     56}
     57
    4258CONSTRUCT_SINGLETON(PotentialRegistry)
    4359CONSTRUCT_REGISTRY(EmpiricalPotential)
  • src/Potentials/PotentialRegistry.hpp

    r4b2e05 rf0964c  
    1414#endif
    1515
     16#include "CodePatterns/Observer/Observable.hpp"
    1617#include "CodePatterns/Registry.hpp"
    1718#include "CodePatterns/Singleton.hpp"
     
    2930 * ones.
    3031 */
    31 class PotentialRegistry : public Singleton<PotentialRegistry>, public Registry<EmpiricalPotential>
     32class PotentialRegistry :
     33    public Singleton<PotentialRegistry>,
     34    public Registry<EmpiricalPotential>,
     35    public Observable
    3236{
    3337  friend class Singleton<PotentialRegistry>;
     
    3640public:
    3741
     42  void registerInstance(EmpiricalPotential*);
     43  void unregisterInstance(EmpiricalPotential*);
     44
    3845private:
    39   PotentialRegistry() {}
    40   ~PotentialRegistry() {}
     46  PotentialRegistry();
     47  virtual ~PotentialRegistry() {}
    4148};
    4249
  • src/UIElements/Views/Qt4/QtHomologyList.cpp

    r4b2e05 rf0964c  
    4545
    4646#include "Fragmentation/Homology/HomologyContainer.hpp"
     47#include "Potentials/PotentialRegistry.hpp"
    4748#include "World.hpp"
    4849
     
    5455QtHomologyList::QtHomologyList(QWidget * _parent) :
    5556    QWidget(_parent),
    56     Observer("QtHomologyList")
     57    Observer("QtHomologyList"),
     58    potentialregistry_enabled(false)
    5759{
    5860  QSplitter *splitter = new QSplitter (Qt::Horizontal, this );
     
    7880        HomologyContainer &homologies = World::getInstance().getHomologies();
    7981        homologies.signOn(this);
     82        PotentialRegistry::getInstance().signOn(this);
     83        potentialregistry_enabled = true;
    8084
    8185  connect(treewidget,SIGNAL(itemSelectionChanged()),this,SLOT(rowSelected()));
     
    8791  HomologyContainer &homologies = World::getInstance().getHomologies();
    8892  homologies.signOff(this);
     93  if (potentialregistry_enabled)
     94    PotentialRegistry::getInstance().signOff(this);
    8995}
    9096
     
    150156{
    151157  // as a new instance should always already be present ... just sign on
    152   HomologyContainer &homologies = World::getInstance().getHomologies();
    153   homologies.signOn(this);
     158  if (static_cast<PotentialRegistry *>(publisher) == PotentialRegistry::getPointer()) {
     159    potentialregistry_enabled = false;
     160  } else {
     161    // its HomologyContainer
     162  }
    154163}
    155164
  • src/UIElements/Views/Qt4/QtHomologyList.hpp

    r4b2e05 rf0964c  
    5353  //!> flag to indicate that we currently clear the view, avoids thread collisions
    5454  bool clearing;
     55  //!> flag to indicate whether we are subscribed to PotentialRegistry
     56  bool potentialregistry_enabled;
    5557
    5658private:
Note: See TracChangeset for help on using the changeset viewer.