Changeset d7940e
- Timestamp:
- Mar 11, 2010, 10:37:32 AM (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:
- d25863
- Parents:
- 23b547
- Location:
- src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/small_actions.cpp
r23b547 rd7940e 27 27 string filename; 28 28 molecule *mol = NULL; 29 Dialog *dialog = UIFactory::get ()->makeDialog();29 Dialog *dialog = UIFactory::getInstance().makeDialog(); 30 30 31 31 dialog->queryMolecule("Enter index of molecule: ",&mol,molecules); -
src/Legacy/oldmenu.cpp
r23b547 rd7940e 912 912 void oldmenu::SimpleAddMolecules(MoleculeListClass *molecules) { 913 913 molecule *srcmol = NULL, *destmol = NULL; 914 Dialog *dialog = UIFactory::get ()->makeDialog();914 Dialog *dialog = UIFactory::getInstance().makeDialog(); 915 915 dialog->queryMolecule("Enter index of destination molecule: ",&destmol, molecules); 916 916 dialog->queryMolecule("Enter index of source molecule to add from: ",&srcmol, molecules); … … 926 926 void oldmenu::embeddMolecules(MoleculeListClass *molecules) { 927 927 molecule *srcmol = NULL, *destmol = NULL; 928 Dialog *dialog = UIFactory::get ()->makeDialog();928 Dialog *dialog = UIFactory::getInstance().makeDialog(); 929 929 dialog->queryMolecule("Enter index of matrix molecule (the variable one): ",&srcmol,molecules); 930 930 dialog->queryMolecule("Enter index of molecule to merge into (the fixed one): ",&destmol,molecules); -
src/Patterns/Singleton.hpp
r23b547 rd7940e 9 9 #define SINGLETON_HPP_ 10 10 11 #include <memory> 11 #include <cassert> 12 #include <boost/thread.hpp> 12 13 13 14 #include "defs.hpp" -
src/Patterns/Singleton_impl.hpp
r23b547 rd7940e 9 9 #define SINGLETON_IMPL_HPP_ 10 10 11 #include <cassert>11 #include "Patterns/Singleton.hpp" 12 12 13 13 template <class T,bool _may_create> -
src/UIElements/UIFactory.cpp
r23b547 rd7940e 8 8 9 9 #include <cassert> 10 #include "Patterns/Singleton_impl.hpp" 10 11 #include "UIElements/UIFactory.hpp" 11 12 12 13 // all factories that can be used: 13 14 #include "UIElements/TextUIFactory.hpp" 14 15 UIFactory *UIFactory::theFactory = 0;16 15 17 16 UIFactory::UIFactory() … … 27 26 28 27 void UIFactory::makeUserInterface(InterfaceTypes type) { 29 assert(theFactory == 0 && "makeUserInterface should only be called once");30 28 switch(type) { 31 29 case Text : 32 theFactory = new TextUIFactory();30 setInstance(new TextUIFactory()); 33 31 break; 34 32 … … 39 37 } 40 38 41 UIFactory* UIFactory::get(){ 42 assert(theFactory != 0 && "No UserInterface created prior to factory access"); 43 return theFactory; 44 } 45 46 47 void UIFactory::purgeInstance(){ 48 if(theFactory) { 49 delete theFactory; 50 theFactory = 0; 51 } 52 } 39 CONSTRUCT_SINGLETON(UIFactory) -
src/UIElements/UIFactory.hpp
r23b547 rd7940e 17 17 18 18 struct menuPopulaters; 19 20 #include "Patterns/Singleton.hpp" 21 19 22 /** 20 23 * Abstract Factory to create any kind of User interface object needed by the programm. … … 24 27 * UIs can be handled in a concise abstract way. 25 28 */ 26 class UIFactory 29 class UIFactory : public Singleton<UIFactory,false> 27 30 { 28 31 … … 45 48 UIFactory(); 46 49 47 // singleton stuff48 private:49 static UIFactory *theFactory;50 51 50 public: 52 51 /** … … 55 54 static void makeUserInterface(InterfaceTypes type); 56 55 57 /**58 * get the previously created factory59 */60 static UIFactory* get();61 62 /**63 * Destroy the created factory.64 *65 * Make sure that all UIElements that were created by the factory are destroyed before calling this method.66 */67 static void purgeInstance();68 56 }; 69 57 -
src/builder.cpp
r23b547 rd7940e 2225 2225 2226 2226 UIFactory::makeUserInterface(UIFactory::Text); 2227 MainWindow *mainWindow = UIFactory::get ()->makeMainWindow(populaters,World::getInstance().getMolecules(), configuration, World::getInstance().getPeriode(), ConfigFileName);2227 MainWindow *mainWindow = UIFactory::getInstance().makeMainWindow(populaters,World::getInstance().getMolecules(), configuration, World::getInstance().getPeriode(), ConfigFileName); 2228 2228 mainWindow->display(); 2229 2229 delete mainWindow;
Note:
See TracChangeset
for help on using the changeset viewer.