Loading [MathJax]/extensions/tex2jax.js

Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Loading...
Searching...
No Matches
poolslot.inc
Go to the documentation of this file.
1
29#pragma once
30
34
35namespace abacus {
36
37template<class BaseType, class CoType>
39 Master *master,
40 Pool<BaseType, CoType> *pool,
41 BaseType *convar) : master_(master), conVar_(convar), pool_(pool)
42{
43 version_ = (convar) ? 1 : 0;
44}
45
46
47template<class BaseType, class CoType>
48PoolSlot<BaseType, CoType>::~PoolSlot()
49{
50#ifdef OGDF_DEBUG
51 if (conVar_ && conVar_->nReferences()) {
52 Logger::ifout() << "~PoolSlot(): it is not allowed to destruct objects of class PoolSlot with a constraint/variable with positive reference counter = " << conVar_->nReferences() << ".\n";
53 }
54
55#ifndef OGDF_USE_ASSERT_EXCEPTIONS // do not throw exceptions in destructor
56 OGDF_ASSERT((conVar_ && conVar_->nReferences()) == false);
57#endif
58#endif
59
60 delete conVar_;
61}
62
63
64template<class BaseType, class CoType>
65void PoolSlot<BaseType, CoType>::insert(BaseType *convar)
66{
67 if (conVar_ != nullptr) {
68 Logger::ifout() << "PoolSlot::insert(): insertion failed, the slot is not void\n";
70 }
71
72 if (version_ == std::numeric_limits<unsigned long>::max()) {
73 Logger::ifout() << "PoolSlot::insert(): insertion failed, maximum version number ULONG_MAX reached\n";
75 }
76
77 conVar_ = convar;
78 ++version_;
79}
80
81}
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:41
#define OGDF_THROW_PARAM(CLASS, PARAM)
Replacement for throw.
Definition exceptions.h:54
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
poolslot.