source: src/Descriptors/MoleculeDescriptor.hpp@ 808fd3

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
Last change on this file since 808fd3 was 6e97e5, checked in by Tillmann Crueger <crueger@…>, 15 years ago

Added a generic Iterator that can be used to iterate only over certain parts of an internal data structure

  • Property mode set to 100644
File size: 3.7 KB
Line 
1/*
2 * MoleculeDescriptor.hpp
3 *
4 * Created on: Feb 5, 2010
5 * Author: crueger
6 */
7
8#ifndef MOLECULEDESCRIPTOR_HPP_
9#define MOLECULEDESCRIPTOR_HPP_
10
11
12#include <vector>
13#include <map>
14#include <boost/shared_ptr.hpp>
15#include "World.hpp"
16
17class World;
18class molecule;
19
20// internal implementation, allows assignment, copying etc
21class MoleculeDescriptor_impl;
22
23/**
24 * An MoleculeDescriptor describes a Set of Molecules from the World. Can be used for any method that needs to work on
25 * a specific set of Molecules.
26 *
27 * This Class is implemented using the PIMPL-Idion, i.e. this class only contains an abstract structure
28 * that forwards any request to a wrapped pointer-to-implementation. This way operators and calculations
29 * on Descriptors are possible.
30 *
31 * Concrete Implementation Objects can be shared between multiple Wrappers, so make sure that
32 * any Implementation remainst constant during lifetime.
33 */
34class MoleculeDescriptor {
35 // close coupling to the world to allow access
36 friend molecule* World::getMolecule(MoleculeDescriptor descriptor);
37 friend std::vector<molecule*> World::getAllMolecules(MoleculeDescriptor descriptor);
38 template <class,class,class> friend class SelectiveIterator;
39
40 friend MoleculeDescriptor operator&&(const MoleculeDescriptor &lhs, const MoleculeDescriptor &rhs);
41 friend MoleculeDescriptor operator||(const MoleculeDescriptor &lhs, const MoleculeDescriptor &rhs);
42 friend MoleculeDescriptor operator!(const MoleculeDescriptor &arg);
43
44public:
45 typedef MoleculeDescriptor_impl impl_t;
46 typedef boost::shared_ptr<impl_t> impl_ptr; //!< Allow easy changes of the pointer-to-implementation type
47
48 MoleculeDescriptor(impl_ptr);
49
50 /**
51 * Copy constructor.
52 * Takes the Implementation from the copied object and sets it's own pointer to link there.
53 * This way the actuall implementation object is shared between copy and original
54 */
55 MoleculeDescriptor(const MoleculeDescriptor&);
56 ~MoleculeDescriptor();
57
58 /**
59 * Assignment Operator.
60 *
61 * Implemented by setting the pointer to the new Implementation.
62 */
63 MoleculeDescriptor &operator=(MoleculeDescriptor &);
64
65protected:
66 /**
67 * forward Method to implementation
68 */
69 molecule* find();
70
71 /**
72 * forward Method to implementation
73 */
74 std::vector<molecule*> findAll();
75
76 /**
77 * Return the implementation this Wrapper currently points to.
78 * Used for copying, assignment and in Iterators over subsets of the World.
79 */
80 impl_ptr get_impl() const;
81
82private:
83 impl_ptr impl;
84};
85
86/**
87 * produce an Moleculedescriptor that at the point of construction contains an implementation that matches all Molecules
88 */
89MoleculeDescriptor AllMolecules();
90
91/**
92 * produce an Moleculedescriptor that at the point of construction contains an implementation that matches no Molecules
93 */
94MoleculeDescriptor NoMolecules();
95
96/**
97 * Set Intersection for two Moleculedescriptors. The resulting Moleculedescriptor will only match an Molecule if both
98 * given Moleculedescriptors also match. Uses short circuit inside, so the second predicate wont be called
99 * when the first one failed.
100 */
101MoleculeDescriptor operator&&(const MoleculeDescriptor &lhs, const MoleculeDescriptor &rhs);
102
103/**
104 * Set Union for two MoleculeDescriptors. The resulting MoleculeDescriptor will match an Molecule if at least one of
105 * the two given MoleculeDescriptors does match. Used short circuit inside, so the second predicate wont
106 * be called when the first one failed.
107 */
108MoleculeDescriptor operator||(const MoleculeDescriptor &lhs, const MoleculeDescriptor &rhs);
109
110/**
111 * Set inversion for an MoleculeDescriptor. Matches an Molecule if the given MoleculeDescriptor did not match.
112 */
113MoleculeDescriptor operator!(const MoleculeDescriptor &arg);
114
115#endif /* MOLECULEDESCRIPTOR_HPP_ */
Note: See TracBrowser for help on using the repository browser.