Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
poolslot.inc
Go to the documentation of this file.
1
29#pragma once
30
34
35#pragma GCC visibility push(default)
36namespace abacus {
37
38template<class BaseType, class CoType>
40 Master *master,
41 Pool<BaseType, CoType> *pool,
42 BaseType *convar) : master_(master), conVar_(convar), pool_(pool)
43{
44 version_ = (convar) ? 1 : 0;
45}
46
47
48template<class BaseType, class CoType>
49PoolSlot<BaseType, CoType>::~PoolSlot()
50{
51#ifdef OGDF_DEBUG
52 if (conVar_ && conVar_->nReferences()) {
53 Logger::ifout() << "~PoolSlot(): it is not allowed to destruct objects of class PoolSlot with a constraint/variable with positive reference counter = " << conVar_->nReferences() << ".\n";
54 }
55
56#ifndef OGDF_USE_ASSERT_EXCEPTIONS // do not throw exceptions in destructor
57 OGDF_ASSERT((conVar_ && conVar_->nReferences()) == false);
58#endif
59#endif
60
61 delete conVar_;
62}
63
64
65template<class BaseType, class CoType>
66void PoolSlot<BaseType, CoType>::insert(BaseType *convar)
67{
68 if (conVar_ != nullptr) {
69 Logger::ifout() << "PoolSlot::insert(): insertion failed, the slot is not void\n";
71 }
72
73 if (version_ == std::numeric_limits<unsigned long>::max()) {
74 Logger::ifout() << "PoolSlot::insert(): insertion failed, maximum version number ULONG_MAX reached\n";
76 }
77
78 conVar_ = convar;
79 ++version_;
80}
81
82}
83#pragma GCC visibility pop
PoolSlot(Master *master, Pool< BaseType, CoType > *pool, BaseType *convar=0)
Creates a pool slot and inserts convar.
constraints and variables.
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
Definition basic.h:52
#define OGDF_THROW_PARAM(CLASS, PARAM)
Replacement for throw.
Definition exceptions.h:58
poolslot.