ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
CaDiCaL::heap< C > Class Template Reference

#include <heap.hpp>

Public Types

typedef vector< unsigned >::iterator iterator
 
typedef vector< unsigned >::const_iterator const_iterator
 

Public Member Functions

 heap (const C &c)
 
size_t size () const
 
bool empty () const
 
bool contains (unsigned e) const
 
void push_back (unsigned e)
 
unsigned front () const
 
unsigned pop_front ()
 
void update (unsigned e)
 
void clear ()
 
void erase ()
 
void shrink ()
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 

Detailed Description

template<class C>
class CaDiCaL::heap< C >

Definition at line 28 of file heap.hpp.

Member Typedef Documentation

◆ const_iterator

template<class C>
typedef vector<unsigned>::const_iterator CaDiCaL::heap< C >::const_iterator

Definition at line 207 of file heap.hpp.

◆ iterator

template<class C>
typedef vector<unsigned>::iterator CaDiCaL::heap< C >::iterator

Definition at line 206 of file heap.hpp.

Constructor & Destructor Documentation

◆ heap()

template<class C>
CaDiCaL::heap< C >::heap ( const C & c)
inline

Definition at line 127 of file heap.hpp.

127: less (c) {}

Member Function Documentation

◆ begin() [1/2]

template<class C>
iterator CaDiCaL::heap< C >::begin ( )
inline

Definition at line 208 of file heap.hpp.

208{ return array.begin (); }
iterator begin()
Definition heap.hpp:208

◆ begin() [2/2]

template<class C>
const_iterator CaDiCaL::heap< C >::begin ( ) const
inline

Definition at line 210 of file heap.hpp.

210{ return array.begin (); }

◆ clear()

template<class C>
void CaDiCaL::heap< C >::clear ( )
inline

Definition at line 189 of file heap.hpp.

189 {
190 array.clear ();
191 pos.clear ();
192 }
void clear()
Definition heap.hpp:189
unsigned * pos
Definition heap.h:25

◆ contains()

template<class C>
bool CaDiCaL::heap< C >::contains ( unsigned e) const
inline

Definition at line 139 of file heap.hpp.

139 {
140 if ((size_t) e >= pos.size ())
141 return false;
142 return pos[e] != invalid_heap_position;
143 }
Here is the caller graph for this function:

◆ empty()

template<class C>
bool CaDiCaL::heap< C >::empty ( ) const
inline

Definition at line 135 of file heap.hpp.

135{ return array.empty (); }
bool empty() const
Definition heap.hpp:135
Here is the caller graph for this function:

◆ end() [1/2]

template<class C>
iterator CaDiCaL::heap< C >::end ( )
inline

Definition at line 209 of file heap.hpp.

209{ return array.end (); }
iterator end()
Definition heap.hpp:209

◆ end() [2/2]

template<class C>
const_iterator CaDiCaL::heap< C >::end ( ) const
inline

Definition at line 211 of file heap.hpp.

211{ return array.end (); }

◆ erase()

template<class C>
void CaDiCaL::heap< C >::erase ( )
inline

Definition at line 194 of file heap.hpp.

194 {
197 }
void erase_vector(std::vector< T > &v)
Definition util.hpp:90
Here is the caller graph for this function:

◆ front()

template<class C>
unsigned CaDiCaL::heap< C >::front ( ) const
inline

Definition at line 160 of file heap.hpp.

160 {
161 CADICAL_assert (!empty ());
162 return array[0];
163 }
#define CADICAL_assert(ignore)
Definition global.h:14
Here is the caller graph for this function:

◆ pop_front()

template<class C>
unsigned CaDiCaL::heap< C >::pop_front ( )
inline

Definition at line 167 of file heap.hpp.

167 {
168 CADICAL_assert (!empty ());
169 unsigned res = array[0], last = array.back ();
170 if (size () > 1)
171 exchange (res, last);
173 array.pop_back ();
174 if (size () > 1)
175 down (last);
176 check ();
177 return res;
178 }
unsigned size
Definition heap.h:22
Here is the caller graph for this function:

◆ push_back()

template<class C>
void CaDiCaL::heap< C >::push_back ( unsigned e)
inline

Definition at line 147 of file heap.hpp.

147 {
149 size_t i = array.size ();
151 array.push_back (e);
152 index (e) = (unsigned) i;
153 up (e);
154 down (e);
155 check ();
156 }
size_t size() const
Definition heap.hpp:131
void push_back(unsigned e)
Definition heap.hpp:147
Here is the caller graph for this function:

◆ shrink()

template<class C>
void CaDiCaL::heap< C >::shrink ( )
inline

Definition at line 199 of file heap.hpp.

199 {
202 }
void shrink_vector(std::vector< T > &v)
Definition util.hpp:101
Here is the caller graph for this function:

◆ size()

template<class C>
size_t CaDiCaL::heap< C >::size ( ) const
inline

Definition at line 131 of file heap.hpp.

131{ return array.size (); }
Here is the caller graph for this function:

◆ update()

template<class C>
void CaDiCaL::heap< C >::update ( unsigned e)
inline

Definition at line 182 of file heap.hpp.

182 {
184 up (e);
185 down (e);
186 check ();
187 }
Here is the caller graph for this function:

The documentation for this class was generated from the following file: