source: src/Patterns/ObservedContainer_impl.hpp@ 456e78

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 456e78 was 5f1d5b8, checked in by Frederik Heber <heber@…>, 14 years ago

BUGFIX: fixed undefined ref to ObservedContainer<...>::begin()/end()/count()/... at -O1

  • test_all.sh did not fail compilation at -O1 (though working fine at -g3, i.e. -O0).
  • Seems like a compiler bug (optimization makes some assumption we do not fulfill, ...)
  • FIX: wrote macro to explicitly instantiate all member functions of ObservedContainer, called CONSTRUCT_OBSERVEDCONTAINER(name).
  • Is used by the world for AtomSet and MoleculeSet
  • had to introduce typedefs for the STL-Sets as "set<bla,bla>" is parsed as two arguments by the preprocessor ... d'oh.
  • Property mode set to 100644
File size: 6.8 KB
Line 
1/*
2 * AtomSet_impl.hpp
3 *
4 * Created on: Jul 8, 2010
5 * Author: crueger
6 */
7
8#ifndef OBSERVEDCONTAINER_IMPL_HPP_
9#define OBSERVEDCONTAINER_IMPL_HPP_
10
11#include "Patterns/ObservedContainer.hpp"
12
13template <class Container>
14inline ObservedContainer<Container>::ObservedContainer(Observable* _obs) :
15 obs(_obs)
16{}
17
18template <class Container>
19inline ObservedContainer<Container>::ObservedContainer(const ObservedContainer<Container> &src) :
20 content(src.content),
21 obs(src.obs)
22{}
23
24template <class Container>
25inline ObservedContainer<Container>::~ObservedContainer()
26{}
27
28template <class Container>
29inline
30ObservedContainer<Container>&
31ObservedContainer<Container>::operator=(const ObservedContainer<Container> &rhs){
32 content=rhs.content;
33 return *this;
34}
35
36template <class Container>
37inline
38typename ObservedContainer<Container>::iterator
39ObservedContainer<Container>::begin(){
40 return ObservedContainer<Container>::iterator(content.begin(),obs);
41}
42
43template <class Container>
44inline
45typename ObservedContainer<Container>::const_iterator
46ObservedContainer<Container>::begin() const{
47 return content.begin();
48}
49
50template <class Container>
51inline
52typename ObservedContainer<Container>::iterator
53ObservedContainer<Container>::end(){
54 return ObservedContainer<Container>::iterator(content.end(),obs);
55}
56
57template <class Container>
58inline
59typename ObservedContainer<Container>::const_iterator
60ObservedContainer<Container>::end() const{
61 return content.end();
62}
63
64template <class Container>
65inline
66typename ObservedContainer<Container>::reverse_iterator
67ObservedContainer<Container>::rbegin(){
68 return reverse_iterator(begin());
69}
70
71template <class Container>
72inline
73typename ObservedContainer<Container>::const_reverse_iterator
74ObservedContainer<Container>::rbegin() const{
75 return const_reverse_iterator(begin());
76}
77
78template <class Container>
79inline
80typename ObservedContainer<Container>::reverse_iterator
81ObservedContainer<Container>::rend(){
82 return reverse_iterator(end());
83}
84
85template <class Container>
86inline
87typename ObservedContainer<Container>::const_reverse_iterator
88ObservedContainer<Container>::rend() const{
89 return const_reverse_iterator(end());
90}
91
92template <class Container>
93inline bool ObservedContainer<Container>::empty() const{
94 return content.empty();
95}
96
97template <class Container>
98inline size_t ObservedContainer<Container>::size() const{
99 return content.size();
100}
101
102template <class Container>
103inline size_t ObservedContainer<Container>::max_size() const{
104 return content.max_size();
105}
106
107template <class Container>
108inline
109typename ObservedContainer<Container>::mapped_type &
110ObservedContainer<Container>::operator[](const key_type &key){
111 return content[key];
112}
113
114template <class Container>
115inline
116std::pair<typename ObservedContainer<Container>::iterator,bool>
117ObservedContainer<Container>::insert (const value_type &value){
118 std::pair<typename set_t::iterator,bool> res = content.insert(value);
119 return std::make_pair(iterator(res.first,obs),res.second);
120}
121
122template <class Container>
123inline size_t ObservedContainer<Container>::erase ( const key_type& x ){
124 return content.erase(x);
125}
126
127template <class Container>
128inline void ObservedContainer<Container>::clear(){
129 content.clear();
130}
131
132template <class Container>
133inline
134typename ObservedContainer<Container>::iterator
135ObservedContainer<Container>::find ( const key_type& x ){
136 return iterator(content.find(x),obs);
137}
138
139template <class Container>
140inline
141typename ObservedContainer<Container>::const_iterator
142ObservedContainer<Container>::find ( const key_type& x ) const{
143 return content.find(x);
144}
145
146template <class Container>
147inline size_t ObservedContainer<Container>::count ( const key_type& x ) const{
148 return content.count(x);
149}
150
151/************ Unprotected access ***************/
152
153template <class Container>
154inline
155typename ObservedContainer<Container>::internal_iterator
156ObservedContainer<Container>::begin_internal(){
157 return content.begin();
158}
159
160template <class Container>
161inline
162typename ObservedContainer<Container>::internal_iterator
163ObservedContainer<Container>::end_internal(){
164 return content.end();
165}
166
167template <class Container>
168inline
169typename ObservedContainer<Container>::reverse_internal_iterator
170ObservedContainer<Container>::rbegin_internal(){
171 return content.rbegin();
172}
173
174template <class Container>
175inline
176typename ObservedContainer<Container>::reverse_internal_iterator
177ObservedContainer<Container>::rend_internal(){
178 return content.rend();
179}
180
181template <class Container>
182inline
183typename ObservedContainer<Container>::set_t &
184ObservedContainer<Container>::getContent(){
185 return content;
186}
187
188/************ Explicit instantiation ***************/
189
190#define CONSTRUCT_OBSERVEDCONTAINER(name) \
191 template ObservedContainer< name >& ObservedContainer< name >::operator=(const ObservedContainer< name >&); \
192 template ObservedContainer< name >::iterator ObservedContainer< name >::begin(); \
193 template ObservedContainer< name >::const_iterator ObservedContainer< name >::begin() const; \
194 template ObservedContainer< name >::iterator ObservedContainer< name >::end(); \
195 template ObservedContainer< name >::const_iterator ObservedContainer< name >::end() const; \
196 template ObservedContainer< name >::reverse_iterator ObservedContainer< name >::rbegin(); \
197 template ObservedContainer< name >::const_reverse_iterator ObservedContainer< name >::rbegin() const; \
198 template ObservedContainer< name >::reverse_iterator ObservedContainer< name >::rend(); \
199 template ObservedContainer< name >::const_reverse_iterator ObservedContainer< name >::rend() const; \
200 template bool ObservedContainer< name >::empty() const; \
201 template size_t ObservedContainer< name >::size() const; \
202 template size_t ObservedContainer< name >::max_size() const; \
203 template ObservedContainer< name >::mapped_type &ObservedContainer< name >::operator[](const key_type&); \
204 template std::pair<ObservedContainer< name >::iterator,bool> ObservedContainer< name >::insert (const value_type&); \
205 template size_t ObservedContainer< name >::erase ( const key_type& x ); \
206 template void ObservedContainer< name >::clear(); \
207 template ObservedContainer< name >::iterator ObservedContainer< name >::find ( const key_type& x ); \
208 template ObservedContainer< name >::const_iterator ObservedContainer< name >::find ( const key_type& x ) const; \
209 template size_t ObservedContainer< name >::count ( const key_type& x ) const; \
210 template ObservedContainer< name >::internal_iterator ObservedContainer< name >::begin_internal(); \
211 template ObservedContainer< name >::reverse_internal_iterator ObservedContainer< name >::rbegin_internal(); \
212 template ObservedContainer< name >::internal_iterator ObservedContainer< name >::end_internal(); \
213 template ObservedContainer< name >::reverse_internal_iterator ObservedContainer< name >::rend_internal(); \
214
215#endif /* OBSERVEDCONTAINER_IMPL_HPP_ */
Note: See TracBrowser for help on using the repository browser.