Changeset cd032d for src/World.cpp


Ignore:
Timestamp:
Mar 11, 2010, 2:46:41 PM (16 years ago)
Author:
Tillmann Crueger <crueger@…>
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, Candidate_v1.7.0, 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:
68d781
Parents:
a77c96 (diff), ed58ad (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'StructureRefactoring' into QT4Refactoring

Conflicts:

molecuilder/src/builder.cpp
molecuilder/src/defs.hpp

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/World.cpp

    ra77c96 rcd032d  
    1616#include "Descriptors/MoleculeDescriptor_impl.hpp"
    1717#include "Actions/ManipulateAtomsProcess.hpp"
     18
     19#include "Patterns/Singleton_impl.hpp"
    1820
    1921using namespace std;
     
    229231/******************************* Singleton Stuff **************************/
    230232
    231 // TODO: Hide boost-thread using Autotools stuff when no threads are used
    232 World* World::theWorld = 0;
    233 boost::mutex World::worldLock;
    234 
    235233World::World() :
    236234    periode(new periodentafel),
     
    261259}
    262260
    263 World* World::get(){
    264   // boost supports RAII-Style locking, so we don't need to unlock
    265   boost::mutex::scoped_lock guard(worldLock);
    266   if(!theWorld) {
    267     theWorld = new World();
    268   }
    269   return theWorld;
    270 }
    271 
    272 void World::destroy(){
    273   // boost supports RAII-Style locking, so we don't need to unlock
    274   boost::mutex::scoped_lock guard(worldLock);
    275   delete theWorld;
    276   theWorld = 0;
    277 }
    278 
    279 World* World::reset(){
    280   World* oldWorld = 0;
    281   {
    282     // boost supports RAII-Style locking, so we don't need to unlock
    283     boost::mutex::scoped_lock guard(worldLock);
    284 
    285     oldWorld = theWorld;
    286     theWorld = new World();
    287     // oldworld does not need protection any more,
    288     // since we should have the only reference
    289 
    290     // worldLock handles access to the pointer,
    291     // not to the object
    292   } // scope-end releases the lock
    293 
    294   // we have to let all the observers know that the
    295   // oldWorld was destroyed. oldWorld calls subjectKilled
    296   // upon destruction. Every Observer getting that signal
    297   // should see that it gets the updated new world
    298   delete oldWorld;
    299   return theWorld;
    300 }
     261// Explicit instantiation of the singleton mechanism at this point
     262
     263CONSTRUCT_SINGLETON(World)
    301264
    302265/******************************* deprecated Legacy Stuff ***********************/
Note: See TracChangeset for help on using the changeset viewer.