abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Minisat::OccLists< Idx, Vec, Deleted > Class Template Reference

#include <SolverTypes.h>

Public Member Functions

 OccLists (const Deleted &d)
 
void init (const Idx &idx)
 
Vec & operator[] (const Idx &idx)
 
Vec & lookup (const Idx &idx)
 
void cleanAll ()
 
void clean (const Idx &idx)
 
void smudge (const Idx &idx)
 
void clear (bool free=true)
 

Private Attributes

vec< Vec > occs
 
vec< char > dirty
 
vec< Idx > dirties
 
Deleted deleted
 

Detailed Description

template<class Idx, class Vec, class Deleted>
class Minisat::OccLists< Idx, Vec, Deleted >

Definition at line 256 of file SolverTypes.h.

Constructor & Destructor Documentation

template<class Idx, class Vec, class Deleted>
Minisat::OccLists< Idx, Vec, Deleted >::OccLists ( const Deleted &  d)
inline

Definition at line 264 of file SolverTypes.h.

264 : deleted(d) {}

Member Function Documentation

template<class Idx, class Vec , class Deleted >
void Minisat::OccLists< Idx, Vec, Deleted >::clean ( const Idx &  idx)

Definition at line 300 of file SolverTypes.h.

301 {
302  Vec& vec = occs[toInt(idx)];
303  int i, j;
304  for (i = j = 0; i < vec.size(); i++)
305  if (!deleted(vec[i]))
306  vec[j++] = vec[i];
307  vec.shrink(i - j);
308  dirty[toInt(idx)] = 0;
309 }
vec< char > dirty
Definition: SolverTypes.h:259
void shrink(int nelems)
Definition: Vec.h:64
vec< Vec > occs
Definition: SolverTypes.h:258
int toInt(Var v)
Definition: SolverTypes.h:65
template<class Idx , class Vec , class Deleted >
void Minisat::OccLists< Idx, Vec, Deleted >::cleanAll ( )

Definition at line 289 of file SolverTypes.h.

290 {
291  for (int i = 0; i < dirties.size(); i++)
292  // Dirties may contain duplicates so check here if a variable is already cleaned:
293  if (dirty[toInt(dirties[i])])
294  clean(dirties[i]);
295  dirties.clear();
296 }
void clean(const Idx &idx)
Definition: SolverTypes.h:300
int size(void) const
Definition: Vec.h:63
vec< Idx > dirties
Definition: SolverTypes.h:260
vec< char > dirty
Definition: SolverTypes.h:259
void clear(bool dealloc=false)
Definition: Vec.h:121
int toInt(Var v)
Definition: SolverTypes.h:65
template<class Idx, class Vec, class Deleted>
void Minisat::OccLists< Idx, Vec, Deleted >::clear ( bool  free = true)
inline

Definition at line 280 of file SolverTypes.h.

280  {
281  occs .clear(free);
282  dirty .clear(free);
283  dirties.clear(free);
284  }
VOID_HACK free()
vec< Idx > dirties
Definition: SolverTypes.h:260
vec< char > dirty
Definition: SolverTypes.h:259
vec< Vec > occs
Definition: SolverTypes.h:258
void clear(bool dealloc=false)
Definition: Vec.h:121
template<class Idx, class Vec, class Deleted>
void Minisat::OccLists< Idx, Vec, Deleted >::init ( const Idx &  idx)
inline

Definition at line 266 of file SolverTypes.h.

266 { occs.growTo(toInt(idx)+1); dirty.growTo(toInt(idx)+1, 0); }
vec< char > dirty
Definition: SolverTypes.h:259
vec< Vec > occs
Definition: SolverTypes.h:258
void growTo(int size)
Definition: Vec.h:113
int toInt(Var v)
Definition: SolverTypes.h:65
template<class Idx, class Vec, class Deleted>
Vec& Minisat::OccLists< Idx, Vec, Deleted >::lookup ( const Idx &  idx)
inline

Definition at line 269 of file SolverTypes.h.

269 { if (dirty[toInt(idx)]) clean(idx); return occs[toInt(idx)]; }
void clean(const Idx &idx)
Definition: SolverTypes.h:300
vec< char > dirty
Definition: SolverTypes.h:259
vec< Vec > occs
Definition: SolverTypes.h:258
int toInt(Var v)
Definition: SolverTypes.h:65
template<class Idx, class Vec, class Deleted>
Vec& Minisat::OccLists< Idx, Vec, Deleted >::operator[] ( const Idx &  idx)
inline

Definition at line 268 of file SolverTypes.h.

268 { return occs[toInt(idx)]; }
vec< Vec > occs
Definition: SolverTypes.h:258
int toInt(Var v)
Definition: SolverTypes.h:65
template<class Idx, class Vec, class Deleted>
void Minisat::OccLists< Idx, Vec, Deleted >::smudge ( const Idx &  idx)
inline

Definition at line 273 of file SolverTypes.h.

273  {
274  if (dirty[toInt(idx)] == 0){
275  dirty[toInt(idx)] = 1;
276  dirties.push(idx);
277  }
278  }
void push(void)
Definition: Vec.h:73
vec< Idx > dirties
Definition: SolverTypes.h:260
vec< char > dirty
Definition: SolverTypes.h:259
int toInt(Var v)
Definition: SolverTypes.h:65

Field Documentation

template<class Idx, class Vec, class Deleted>
Deleted Minisat::OccLists< Idx, Vec, Deleted >::deleted
private

Definition at line 261 of file SolverTypes.h.

template<class Idx, class Vec, class Deleted>
vec<Idx> Minisat::OccLists< Idx, Vec, Deleted >::dirties
private

Definition at line 260 of file SolverTypes.h.

template<class Idx, class Vec, class Deleted>
vec<char> Minisat::OccLists< Idx, Vec, Deleted >::dirty
private

Definition at line 259 of file SolverTypes.h.

template<class Idx, class Vec, class Deleted>
vec<Vec> Minisat::OccLists< Idx, Vec, Deleted >::occs
private

Definition at line 258 of file SolverTypes.h.


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