source: src/UIElements/Qt4/InstanceBoard/QtObservedInstanceBoard.cpp@ 98c35c

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 Candidate_v1.7.0 Candidate_v1.7.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 98c35c was 98c35c, checked in by Frederik Heber <heber@…>, 10 years ago

Added rudimentary getter and returner for ObservedAtom/..Molecule() to InstanceBoard.

  • Property mode set to 100644
File size: 19.8 KB
Line 
1/*
2 * Project: MoleCuilder
3 * Description: creates and alters molecular systems
4 * Copyright (C) 2015 Frederik Heber. All rights reserved.
5 *
6 *
7 * This file is part of MoleCuilder.
8 *
9 * MoleCuilder is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation, either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * MoleCuilder is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with MoleCuilder. If not, see <http://www.gnu.org/licenses/>.
21 */
22
23/*
24 * QtObservedInstanceBoard.cpp
25 *
26 * Created on: Oct 17, 2015
27 * Author: heber
28 */
29
30
31// include config.h
32#ifdef HAVE_CONFIG_H
33#include <config.h>
34#endif
35
36#include "QtObservedInstanceBoard.hpp"
37
38#include "UIElements/Views/Qt4/Qt3D/GLMoleculeObject_atom.hpp"
39#include "UIElements/Views/Qt4/Qt3D/GLMoleculeObject_molecule.hpp"
40
41#include "CodePatterns/MemDebug.hpp"
42
43#include "CodePatterns/Log.hpp"
44
45#include "Atom/atom.hpp"
46#include "Descriptors/AtomIdDescriptor.hpp"
47#include "Descriptors/MoleculeIdDescriptor.hpp"
48#include "molecule.hpp"
49#include "World.hpp"
50
51QtObservedInstanceBoard::QtObservedInstanceBoard(QWidget * _parent) :
52 QWidget(_parent),
53 Observer("QtObservedInstanceBoard"),
54 WorldSignedOn(false),
55 atomSubjectKilled(
56 boost::bind(&QtObservedInstanceBoard::atomcountsubjectKilled, this, _1)),
57 moleculeSubjectKilled(
58 boost::bind(&QtObservedInstanceBoard::moleculecountsubjectKilled, this, _1)),
59 lastremovedatom((atomId_t)-1),
60 lastremovedatomsmolecule( std::make_pair((moleculeId_t)-1,(atomId_t)-1) ),
61 lastremovedmolecule((moleculeId_t)-1)
62{
63 // be first (besides ObservedValues to know about new insertions)
64 World::getInstance().signOn(this, World::AtomInserted, GlobalObservableInfo::PriorityLevel(int(-10)));
65 World::getInstance().signOn(this, World::AtomRemoved, GlobalObservableInfo::PriorityLevel(int(-10)));
66 World::getInstance().signOn(this, World::MoleculeInserted, GlobalObservableInfo::PriorityLevel(int(-10)));
67 World::getInstance().signOn(this, World::MoleculeRemoved, GlobalObservableInfo::PriorityLevel(int(-10)));
68 WorldSignedOn = true;
69}
70
71QtObservedInstanceBoard::~QtObservedInstanceBoard()
72{
73 if (WorldSignedOn) {
74 World::getInstance().signOff(this, World::AtomInserted);
75 World::getInstance().signOff(this, World::AtomRemoved);
76 World::getInstance().signOff(this, World::MoleculeInserted);
77 World::getInstance().signOff(this, World::MoleculeRemoved);
78 }
79 // sign off from all remaining molecules and atoms
80 for (SignedOn_t::iterator iter = AtomSignedOn.begin(); !AtomSignedOn.empty();
81 iter = AtomSignedOn.begin()) {
82 (*iter)->signOff(this, atom::IndexChanged);
83 AtomSignedOn.erase(iter);
84 }
85
86 for (SignedOn_t::iterator iter = MoleculeSignedOn.begin(); !MoleculeSignedOn.empty();
87 iter = MoleculeSignedOn.begin()) {
88 (*iter)->signOff(this, molecule::IndexChanged);
89 (*iter)->signOff(this, molecule::AtomInserted);
90 (*iter)->signOff(this, molecule::AtomRemoved);
91 MoleculeSignedOn.erase(*iter); //erase all instances
92 }
93}
94
95void QtObservedInstanceBoard::update(Observable *publisher)
96{
97 ASSERT(0,
98 "QtObservedInstanceBoard::update() - we are not signed on to general updates.");
99}
100
101void QtObservedInstanceBoard::subjectKilled(Observable *publisher)
102{
103 SignedOn_t::iterator iter = AtomSignedOn.find(publisher);
104 if ( iter != AtomSignedOn.end()) {
105 LOG(3, "DEBUG: InstanceBoard got subjectKilled() from atom " << publisher);
106 AtomSignedOn.erase(iter);
107 } else {
108 iter = MoleculeSignedOn.find(publisher);
109 if ( iter != MoleculeSignedOn.end()) {
110 LOG(3, "DEBUG: InstanceBoard got subjectKilled() from molecule " << publisher);
111 MoleculeSignedOn.erase(iter);
112 } else {
113 ASSERT(0,
114 "QtObservedInstanceBoard::subjectKilled() - could not find signedOn for atom/molecule "+toString(publisher));
115 }
116 }
117}
118
119void QtObservedInstanceBoard::recieveNotification(Observable *publisher, Notification_ptr notification)
120{
121 if (static_cast<World *>(publisher) == World::getPointer()) {
122 switch (notification->getChannelNo()) {
123 case World::MoleculeInserted:
124 {
125 const moleculeId_t _id = const_cast<const World &>(World::getInstance()).lastChangedMolId();
126 #ifdef LOG_OBSERVER
127 observerLog().addMessage() << "++ Observer " << observerLog().getName(static_cast<Observer *>(this)) << " received notification that molecule "+toString(_id)+" has been inserted.";
128 #endif
129 LOG(3, "DEBUG: InformationBoard got moleculeInserted signal for molecule " << _id);
130 const molecule * const _molecule = const_cast<const World &>(World::getInstance()).
131 getMolecule(MoleculeById(_id));
132 if (_molecule != NULL) {
133 ObservedValues_t ObservedValues(GLMoleculeObject_molecule::MAX_ObservedTypes);
134 LOG(3, "DEBUG: InformationBoard initializes ObservedValues for molecule " << _id);
135 GLMoleculeObject_molecule::initObservedValues(
136 ObservedValues,
137 _id,
138 _molecule,
139 moleculeSubjectKilled);
140#ifndef NDEBUG
141 std::pair<moleculeObservedValues_t::iterator, bool> inserter =
142#endif
143 moleculeObservedValues.insert(
144 std::make_pair( _id, std::make_pair(ObservedValues,0) ));
145 ASSERT( inserter.second,
146 "QtObservedInstanceBoard::recieveNotification() - could not insert ObservedValues for"
147 +toString(_id)+".");
148 // we need to check for index changes
149 LOG(3, "DEBUG: InformationBoard signOn()s to molecule " << _id);
150 _molecule->signOn(this, molecule::IndexChanged);
151 MoleculeSignedOn.insert( static_cast<Observable *>(const_cast<molecule *>(_molecule)) );
152 _molecule->signOn(this, molecule::AtomInserted);
153 MoleculeSignedOn.insert( static_cast<Observable *>(const_cast<molecule *>(_molecule)) );
154 _molecule->signOn(this, molecule::AtomRemoved);
155 MoleculeSignedOn.insert( static_cast<Observable *>(const_cast<molecule *>(_molecule)) );
156
157 emit moleculeInserted(_id);
158 } else {
159 ELOG(1, "QtObservedInstanceBoard got MoleculeInserted for unknown molecule id " << _id);
160 }
161 break;
162 }
163 case World::MoleculeRemoved:
164 {
165 const moleculeId_t _id = const_cast<const World &>(World::getInstance()).lastChangedMolId();
166 LOG(3, "DEBUG: InformationBoard got MoleculeRemoved signal for molecule " << _id);
167 // note down such that ObservedValues are simply dropped
168 lastremovedmolecule = _id;
169 break;
170 }
171 case World::AtomInserted:
172 {
173 const atomId_t _id = const_cast<const World &>(World::getInstance()).lastChangedAtomId();
174 #ifdef LOG_OBSERVER
175 observerLog().addMessage() << "++ Observer " << observerLog().getName(static_cast<Observer *>(this)) << " received notification that atom "+toString(_id)+" has been inserted.";
176 #endif
177 LOG(3, "DEBUG: InformationBoard got atomInserted signal for atom " << _id);
178 const atom * const _atom = const_cast<const World &>(World::getInstance()).
179 getAtom(AtomById(_id));
180 if (_atom!= NULL) {
181 ObservedValues_t ObservedValues(GLMoleculeObject_atom::MAX_ObservedTypes);
182 LOG(3, "DEBUG: InformationBoard initializes ObservedValues for atom " << _id);
183 GLMoleculeObject_atom::initObservedValues(
184 ObservedValues,
185 _id,
186 _atom,
187 atomSubjectKilled);
188#ifndef NDEBUG
189 std::pair<atomObservedValues_t::iterator, bool> inserter =
190#endif
191 atomObservedValues.insert(
192 std::make_pair( _id, std::make_pair(ObservedValues,0) ));
193 ASSERT( inserter.second,
194 "QtObservedInstanceBoard::recieveNotification() - could not insert ObservedValues for"
195 +toString(_id)+".");
196 // we need to check for index changes
197 LOG(3, "DEBUG: InformationBoard signOn()s to atom " << _id);
198 _atom->signOn(this, atom::IndexChanged);
199 AtomSignedOn.insert( static_cast<Observable *>(const_cast<atom *>(_atom)) );
200 } else {
201 ELOG(1, "QtObservedInstanceBoard got AtomInserted for unknown atom id " << _id);
202 }
203 break;
204 }
205 case World::AtomRemoved:
206 {
207 const atomId_t _id = const_cast<const World &>(World::getInstance()).lastChangedAtomId();
208 LOG(3, "DEBUG: InformationBoard got AtomRemoved signal for atom " << _id);
209 // note down such that ObservedValues are simply dropped
210 lastremovedatom = _id;
211 break;
212 }
213 default:
214 ASSERT(0, "QtObservedInstanceBoard::recieveNotification() - we cannot get here for World.");
215 break;
216 }
217 } else if (dynamic_cast<molecule *>(publisher) != NULL) {
218 const moleculeId_t molid = const_cast<const World &>(World::getInstance()).lastChangedMolId();
219 switch (notification->getChannelNo()) {
220 case molecule::AtomInserted:
221 {
222 const molecule * const _molecule = const_cast<const World &>(World::getInstance()).
223 getMolecule(MoleculeById(molid));
224 if (_molecule != NULL) {
225 const atomId_t atomid = const_cast<const molecule *>(_molecule)->lastChangedAtomId();
226 LOG(3, "DEBUG: InformationBoard got AtomInserted signal for atom "
227 << atomid << " from molecule " << molid);
228 // check whether atom's observedvalues are present
229 ASSERT( atomObservedValues.find(atomid) != atomObservedValues.end(),
230 "QtObservedInstanceBoard::recieveNotification() - ObservedValues for atom "
231 +toString(atomid)+" are not present yet.");
232 // and emit
233 emit atomInserted(molid, atomid);
234 } else {
235 ELOG(2, "QtObservedInstanceBoard::recieveNotification() - molecule "
236 << molid << " has disappeared.");
237 }
238 break;
239 }
240 case molecule::AtomRemoved:
241 {
242 const molecule * const _molecule = const_cast<const World &>(World::getInstance()).
243 getMolecule(MoleculeById(molid));
244 if (_molecule != NULL) {
245 const atomId_t atomid = const_cast<const molecule *>(_molecule)->lastChangedAtomId();
246 LOG(3, "DEBUG: InformationBoard got AtomRemoved signal for atom "
247 << atomid << " from molecule " << molid);
248 lastremovedatomsmolecule = std::make_pair(molid, atomid);
249 }
250 break;
251 }
252 case molecule::IndexChanged:
253 {
254 // molecule has changed its index
255 const moleculeId_t newmoleculeId = dynamic_cast<molecule *>(publisher)->getId();
256 LOG(3, "DEBUG: InformationBoard got IndexChanged from molecule " << molid << " to " << newmoleculeId);
257 {
258 moleculeObservedValues_t::iterator iter = moleculeObservedValues.find(molid);
259 // change id here only if still present
260 if (iter != moleculeObservedValues.end()) {
261 RefCountedObservedValues_t obsvalues = iter->second;
262 moleculeObservedValues.erase(iter);
263 ASSERT( moleculeObservedValues.find(newmoleculeId) == moleculeObservedValues.end(),
264 "QtObservedInstanceBoard::recieveNotification() - ObservedValues for atom "
265 +toString(newmoleculeId)+" already present.");
266 moleculeObservedValues.insert( std::make_pair(newmoleculeId, obsvalues) );
267 // if (!inserter.second)
268 // ELOG(1, "QtInformationBoard could not insert molecule id change "
269 // << molid << "->" << newmoleculeId);
270 }
271 }
272 // no need update SignedOn, ref does not change
273 emit moleculeIndexChanged(molid, newmoleculeId);
274 break;
275 }
276 default:
277 ASSERT(0, "QtObservedInstanceBoard::recieveNotification() - we cannot get here.");
278 break;
279 }
280 } else if (dynamic_cast<atom *>(publisher) != NULL) {
281 const atomId_t oldatomId = const_cast<const World &>(World::getInstance()).lastChangedAtomId();
282 switch (notification->getChannelNo()) {
283 case AtomObservable::IndexChanged:
284 {
285 const atomId_t newatomId = dynamic_cast<atom *>(publisher)->getId();
286 LOG(3, "DEBUG: InformationBoard got IndexChanged from atom " << oldatomId << " to " << newatomId);
287 // update atomObservedValues
288 {
289 atomObservedValues_t::iterator iter = atomObservedValues.find(oldatomId);
290 // change id here only if still present
291 if (iter != atomObservedValues.end()) {
292 RefCountedObservedValues_t obsvalues = iter->second;
293 atomObservedValues.erase(iter);
294 ASSERT( atomObservedValues.find(newatomId) == atomObservedValues.end(),
295 "QtObservedInstanceBoard::recieveNotification() - ObservedValues for atom "
296 +toString(newatomId)+" already present.");
297 atomObservedValues.insert( std::make_pair(newatomId, obsvalues) );
298 // if (!inserter.second)
299 // ELOG(1, "QtInformationBoard could not insert atom id change "
300 // << oldatomId << "->" << newatomId);
301 }
302 }
303 // no need update SignedOn, ref does not change
304 emit atomIndexChanged(oldatomId, newatomId);
305 break;
306 }
307 default:
308 ASSERT(0, "QtObservedInstanceBoard::recieveNotification() - we cannot get here.");
309 break;
310 }
311 } else {
312 ASSERT(0, "QtObservedInstanceBoard::recieveNotification() - notification from unknown source.");
313 }
314}
315
316void QtObservedInstanceBoard::atomcountsubjectKilled(const atomId_t _atomid)
317{
318 LOG(3, "DEBUG: InformationBoard got subjectKilled() for a value of atom " << _atomid);
319 atomsubjectKilledCount_t::iterator iter = atomsubjectKilledCount.find(_atomid);
320 if (iter == atomsubjectKilledCount.end()) {
321 std::pair<atomsubjectKilledCount_t::iterator, bool> inserter =
322 atomsubjectKilledCount.insert( std::make_pair(_atomid, 0) );
323 iter = inserter.first;
324 }
325 ++(iter->second);
326
327 if (iter->second > GLMoleculeObject_atom::MAX_ObservedTypes) {
328 ASSERT( atomObservedValues[_atomid].second == 0,
329 "QtObservedInstanceBoard::atomcountsubjectKilled() - observed Values for atom "
330 +toString(_atomid)+" are still being held somewhere.");
331 if (_atomid == lastremovedatomsmolecule.second)
332 emit atomRemoved(lastremovedatomsmolecule.first, lastremovedatomsmolecule.second);
333 else
334 ELOG(2, "QtObservedInstanceBoard::atomcountsubjectKilled() - id " << _atomid
335 << " not fitting with " << lastremovedatomsmolecule);
336 atomsubjectKilledCount.erase(iter);
337 }
338}
339
340void QtObservedInstanceBoard::moleculecountsubjectKilled(const moleculeId_t _molid)
341{
342 LOG(3, "DEBUG: InformationBoard got subjectKilled() for a value of molecule " << _molid);
343 moleculesubjectKilledCount_t::iterator iter = moleculesubjectKilledCount.find(_molid);
344 if (iter == moleculesubjectKilledCount.end()) {
345 std::pair<moleculesubjectKilledCount_t::iterator, bool> inserter =
346 moleculesubjectKilledCount.insert( std::make_pair(_molid, 0) );
347 iter = inserter.first;
348 }
349 ++(iter->second);
350
351 if (iter->second > GLMoleculeObject_molecule::MAX_ObservedTypes) {
352 ASSERT( moleculeObservedValues[_molid].second == 0,
353 "QtObservedInstanceBoard::moleculecountsubjectKilled() - observed Values for molecule "
354 +toString(_molid)+" are still being held somewhere.");
355 // then free the instance
356 emit moleculeRemoved(_molid);
357 moleculesubjectKilledCount.erase(iter);
358 }
359}
360
361ObservedValues_t
362QtObservedInstanceBoard::getAtomObservedValues(const atomId_t _id)
363{
364 ObservedValues_t returnvalues;
365 const atomObservedValues_t::iterator iter = atomObservedValues.find(_id);
366 ASSERT(iter != atomObservedValues.end(),
367 "QtObservedInstanceBoard::getAtomObservedValues() - atom values not present for id"
368 +toString(_id));
369 if (iter->first == _id) {
370 returnvalues = iter->second.first;
371 atomObservedValues.erase(iter);
372 }
373 return returnvalues;
374}
375
376ObservedValues_t
377QtObservedInstanceBoard::getMoleculeObservedValues(const moleculeId_t _id)
378{
379 ObservedValues_t returnvalues;
380 const moleculeObservedValues_t::iterator iter = moleculeObservedValues.find(_id);
381 ASSERT(iter != moleculeObservedValues.end(),
382 "getMoleculeObservedValues::getAtomObservedValues() - molecule values not present for id"
383 +toString(_id));
384 if (iter->first == _id) {
385 returnvalues = iter->second.first;
386 moleculeObservedValues.erase(iter);
387 }
388 return returnvalues;
389}
390
391void QtObservedInstanceBoard::returnAtomObservedValues(
392 const atomId_t _id,
393 ObservedValues_t &_observedvalues)
394{
395 if (lastremovedatom != _id) {
396#ifndef NDEBUG
397 std::pair<atomObservedValues_t::iterator, bool> inserter =
398#endif
399 atomObservedValues.insert(
400 std::make_pair( _id, std::make_pair(_observedvalues,0) ) );
401 ASSERT( inserter.second,
402 "QtObservedInstanceBoard::returnAtomObservedValues() - could not insert ObservedValues for"
403 +toString(_id)+".");
404 } else
405 lastremovedatom = (atomId_t)-1;
406}
407
408void QtObservedInstanceBoard::returnMoleculeObservedValues(
409 const moleculeId_t _id,
410 ObservedValues_t &_observedvalues)
411{
412 if (lastremovedmolecule != _id) {
413#ifndef NDEBUG
414 std::pair<moleculeObservedValues_t::iterator, bool> inserter =
415#endif
416 moleculeObservedValues.insert(
417 std::make_pair( _id, std::make_pair(_observedvalues,0) ) );
418 ASSERT( inserter.second,
419 "QtObservedInstanceBoard::returnMoleculeObservedValues() - could not insert ObservedValues for"
420 +toString(_id)+".");
421 } else
422 lastremovedmolecule = (moleculeId_t)-1;
423}
424
425QtObservedAtom::ptr QtObservedInstanceBoard::getObservedAtom(const atomId_t _id)
426{
427 atomObservedValues_t::iterator iter = atomObservedValues.find(_id);
428 ASSERT( iter != atomObservedValues.end(),
429 "QtObservedInstanceBoard::getObservedAtom() - no observed values present for atom "
430 +toString(_id));
431 const ObservedValues_t &obsvalues = iter->second.first;
432 // increase refcount
433 ++(iter->second.second);
434 QtObservedAtom::ptr _atom(new QtObservedAtom(obsvalues));
435
436 return _atom;
437}
438
439QtObservedMolecule::ptr QtObservedInstanceBoard::getObservedMolecule(const moleculeId_t _id)
440{
441 moleculeObservedValues_t::iterator iter = moleculeObservedValues.find(_id);
442 ASSERT( iter != moleculeObservedValues.end(),
443 "QtObservedInstanceBoard::getObservedMolecule() - no observed values present for molecule "
444 +toString(_id));
445 const ObservedValues_t &obsvalues = iter->second.first;
446 // increase refcount
447 ++(iter->second.second);
448 QtObservedMolecule::ptr _molecule(new QtObservedMolecule(obsvalues));
449
450 return _molecule;
451}
452
453void QtObservedInstanceBoard::returnObservedAtom(const atomId_t _id)
454{
455 atomObservedValues_t::iterator iter = atomObservedValues.find(_id);
456 ASSERT( iter != atomObservedValues.end(),
457 "QtObservedInstanceBoard::returnObservedAtom() - no observed values present for atom "
458 +toString(_id));
459 ASSERT( iter->second.second != 0,
460 "QtObservedInstanceBoard::returnObservedAtom() - all ObservedAtoms for atom "
461 +toString(_id)+" have already been returned.");
462 // decrease refcount
463 --(iter->second.second);
464 if (iter->second.second == 0) {
465 // free instance
466 }
467}
468
469void QtObservedInstanceBoard::returnObservedMolecule(const moleculeId_t _id)
470{
471 moleculeObservedValues_t::iterator iter = moleculeObservedValues.find(_id);
472 ASSERT( iter != moleculeObservedValues.end(),
473 "QtObservedInstanceBoard::returnObservedMolecule() - no observed values present for molecule "
474 +toString(_id));
475 ASSERT( iter->second.second != 0,
476 "QtObservedInstanceBoard::returnObservedMolecule() - all ObservedMolecules for molecule "
477 +toString(_id)+" have already been returned.");
478 // decrease refcount
479 --(iter->second.second);
480 if (iter->second.second == 0) {
481 // free instance
482 }
483}
484
Note: See TracBrowser for help on using the repository browser.