source: src/Patterns/ObservedContainer.hpp@ 4c1230

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 4c1230 was e3d865, checked in by Tillmann Crueger <crueger@…>, 14 years ago

Madet the internal iterators provided by the world unobserved

  • Property mode set to 100644
File size: 2.9 KB
Line 
1/*
2 * AtomSet.hpp
3 *
4 * Created on: Jul 8, 2010
5 * Author: crueger
6 */
7
8#ifndef OBSERVEDCONTAINER_HPP_
9#define OBSERVEDCONTAINER_HPP_
10
11#include "types.hpp"
12
13#include <utility>
14#include "Patterns/ObservedIterator.hpp"
15#include "Descriptors/SelectiveIterator.hpp"
16
17class World;
18class atom;
19class AtomDescriptor;
20
21/**
22 * Forward to std::map<atomId_t,atom*> that allows production of observed and
23 * unobserved iterators to all atoms.
24 *
25 * Imported via typedef into class World. Defined here to avoid bloating of the
26 * World class
27 */
28template <class Container>
29class ObservedContainer
30{
31 friend class World;
32
33public:
34 typedef Container set_t;
35 // this iterator can be used for internal purposes...
36 // no lock used here
37 typedef typename set_t::iterator internal_iterator;
38 typedef typename std::reverse_iterator<internal_iterator> reverse_internal_iterator;
39
40 // typedefs for iterator structure
41 typedef ObservedIterator<set_t> iterator;
42 typedef typename set_t::const_iterator const_iterator;
43 typedef std::reverse_iterator<iterator> reverse_iterator;
44 typedef typename std::reverse_iterator<const_iterator> const_reverse_iterator;
45
46 // some more typedefs for STL-Structure
47 typedef typename set_t::key_type key_type;
48 typedef typename set_t::mapped_type mapped_type;
49 typedef typename set_t::value_type value_type;
50 typedef typename set_t::key_compare key_compare;
51 typedef typename set_t::allocator_type allocator_type;
52
53 ObservedContainer(Observable*);
54 ObservedContainer(const ObservedContainer&);
55 virtual ~ObservedContainer();
56
57 // all the functions from STL-map (forwards to content)
58 ObservedContainer& operator=(const ObservedContainer&);
59
60 iterator begin();
61 const_iterator begin() const;
62 iterator end();
63 const_iterator end() const;
64 reverse_iterator rbegin();
65 const_reverse_iterator rbegin() const;
66 reverse_iterator rend();
67 const_reverse_iterator rend() const;
68
69 bool empty() const;
70 size_t size() const;
71 size_t max_size() const;
72
73 mapped_type &operator[](const key_type&);
74
75 std::pair<iterator,bool> insert (const value_type&);
76
77 size_t erase ( const key_type& x );
78 void clear();
79
80 iterator find ( const key_type& x );
81 const_iterator find ( const key_type& x ) const;
82
83 size_t count ( const key_type& x ) const;
84 internal_iterator begin_internal();
85 internal_iterator end_internal();
86 reverse_internal_iterator rbegin_internal();
87 reverse_internal_iterator rend_internal();
88
89 set_t &getContent();
90private:
91 set_t content;
92 Observable *obs;
93};
94
95#endif /* OBSERVEDCONTAINER_HPP_ */
Note: See TracBrowser for help on using the repository browser.