Changeset 0f6f3a
- Timestamp:
- Mar 11, 2010, 3:17:29 PM (15 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:
- c3dbe0
- Parents:
- ed58ad
- Location:
- src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Patterns/Singleton.hpp
red58ad r0f6f3a 32 32 void reset(T* _content); 33 33 void reset(); 34 ptr_t& operator=( ptr_t& rhs);34 ptr_t& operator=(const ptr_t& rhs); 35 35 private: 36 T* content;36 mutable T* content; 37 37 }; 38 38 … … 85 85 static void setInstance(T*); 86 86 protected: 87 // constructor accessible by subclasses 88 Singleton(); 87 89 88 90 private: 91 // private copy constructor to avoid unintended copying 92 Singleton(const Singleton&); 93 89 94 static boost::recursive_mutex instanceLock; 90 95 static ptr_t theInstance; -
src/Patterns/Singleton_impl.hpp
red58ad r0f6f3a 77 77 } 78 78 79 template<class T, bool _may_create> 80 Singleton<T,_may_create>::Singleton(){/* empty */} 81 82 // private copy constructor to avoid unintended copying 83 template <class T, bool _may_create> 84 Singleton<T,_may_create>::Singleton(const Singleton<T,_may_create>&){ 85 assert(0 && "Copy constructor of singleton template called"); 86 } 87 79 88 /** 80 89 * This define allows simple instantiation of the necessary singleton functions … … 121 130 122 131 template <class T,bool _may_create> 123 typename Singleton<T,_may_create>::ptr_t& Singleton<T,_may_create>::ptr_t::operator=( typename Singleton<T,_may_create>::ptr_t& rhs){132 typename Singleton<T,_may_create>::ptr_t& Singleton<T,_may_create>::ptr_t::operator=(const typename Singleton<T,_may_create>::ptr_t& rhs){ 124 133 if(&rhs!=this){ 125 134 delete content; -
src/unittests/SingletonTest.cpp
red58ad r0f6f3a 29 29 count1++; 30 30 } 31 // explicit copy constructor to catch if this is ever called 32 SingletonStub1(const SingletonStub1&){ 33 CPPUNIT_FAIL ( "Copy constructor of Singleton called" ); 34 } 31 35 virtual ~SingletonStub1(){ 32 36 count2++; … … 47 51 SingletonStub2(){ 48 52 count1++; 53 } 54 // explicit copy constructor to catch if thsi is ever called 55 SingletonStub2(const SingletonStub2&){ 56 CPPUNIT_FAIL ( "Copy constructor of Singleton called" ); 49 57 } 50 58 virtual ~SingletonStub2(){
Note:
See TracChangeset
for help on using the changeset viewer.