Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
separator.inc
Go to the documentation of this file.
1
29#pragma once
30
34
35#pragma GCC visibility push(default)
36namespace abacus {
37
38
39template <class BaseType, class CoType>
42{
43 if(newCons_.full()) {
44 delete cv;
45 return Full;
46 }
47
48 if(pool_&&pool_->present(cv)) {
49 delete cv;
50 nDuplications_++;
51 return Duplication;
52 }
53
54 if(hash_&&find(cv)) {
55 delete cv;
56 nDuplications_++;
57 return Duplication;
58 }
59
60
61 newCons_.push(cv);
62 if(hash_)
63 hash_->insert(cv->hashKey(),cv);
64 return Added;
65}
66
67
68template <class BaseType, class CoType>
70{
71 if(!hash_)
72 return 0;
73 return hash_->nCollisions();
74}
75
76
77template <class BaseType, class CoType>
78bool Separator<BaseType, CoType>::find(BaseType *cv)
79{
80 int key = cv->hashKey();
81
82 BaseType **cand = hash_->initializeIteration(key);
83
84 while(cand) {
85 if (cv->equal(*cand)) return true;
86 cand = hash_->next(key);
87 }
88 return false;
89}
90
91}
92#pragma GCC visibility pop
Separator_CUTFOUND cutFound(BaseType *cv)
Passes a cut (constraint or variable) to the buffer.
int nCollisions() const
Returns the number of collisions in the hash table.
bool find(BaseType *cv)
constraint.
Separator_CUTFOUND
Definition separator.h:41
@ Duplication
Definition separator.h:41
@ Added
Definition separator.h:41
separator.
variable.