Documentation of CSL
Public Types | Static Public Member Functions
csl::Lock Class Reference

Static class allowing to compress expressions given a boolean predicate. More...

#include <lock.h>

Public Types

using ID_t = int
 Typedef for lock id.
 
using predicate = std::function< bool(Expr const &)>
 Typedef for the boolean predicate.
 

Static Public Member Functions

static void lock (Expr &init, int lockId, predicate const &f)
 Abbreviates all parts of an expression depending on a condition. More...
 
static void lock (Expr &init, predicate const &f)
 Abbreviates all parts of an expression depending on a condition. More...
 
static void unlock (Expr &init, int lockId)
 Expand abbreviations from a previous lock. The lock id should be the same. More...
 
static void unlock (Expr &init)
 Expand abbreviations from a previous lock. The lock id should be the same. More...
 
static std::string lockNameOf (ID_t id)
 Returns the generic abbreviation name of a lock given its id. More...
 

Detailed Description

Static class allowing to compress expressions given a boolean predicate.

When doing heavy calculations, many sub expressions are not needed and just slow down (while taking memory) the calculation. This class can, given a boolean predicate, abbreviate all these expressions (lock()). After the calculation, you may re-expand the abbreviations (unlock()).

Member Function Documentation

◆ lock() [1/2]

void csl::Lock::lock ( Expr init,
int  lockId,
predicate const &  f 
)
static

Abbreviates all parts of an expression depending on a condition.

Any sub expression sub in expr such that f(sub) == false is abbreviated. This allows to compress all the information that is not needed when performing a given calculation. Large parts of expressions may be totally useless and must be abbreviated in order to minimize their impact on memory and computation time. To be clear, f should return true on objects that are important for the calculation, i.e. that must not be abbreviated.

Parameters
initExpression to lock.
lockIDLock id, allows to differentiate different locks when unlocking.
fBoolean predicate.
See also
unlock()

◆ lock() [2/2]

void csl::Lock::lock ( Expr init,
predicate const &  f 
)
static

Abbreviates all parts of an expression depending on a condition.

Any sub expression sub in expr such that f(sub) == false is abbreviated. This allows to compress all the information that is not needed when performing a given calculation. Large parts of expressions may be totally useless and must be abbreviated in order to minimize their impact on memory and computation time. To be clear, f should return true on objects that are important for the calculation, i.e. that must not be abbreviated.

Note
This overload does not take any id. It actually calls the first function with the default id 0.
Parameters
initExpression to lock.
fBoolean predicate.
See also
unlock()

◆ lockNameOf()

std::string csl::Lock::lockNameOf ( ID_t  id)
static

Returns the generic abbreviation name of a lock given its id.

Parameters
lockIDId of the lock.
Returns
The name of abbreviations of lock with id id.
See also
Lock(), Unlock()

◆ unlock() [1/2]

void csl::Lock::unlock ( Expr init,
int  lockId 
)
static

Expand abbreviations from a previous lock. The lock id should be the same.

Parameters
initExpression to unlock.
lockIDLock id, allows to differentiate different locks when unlocking.
See also
Lock()

◆ unlock() [2/2]

void csl::Lock::unlock ( Expr init)
static

Expand abbreviations from a previous lock. The lock id should be the same.

Parameters
initExpression to unlock.
Note
This overload does not take any id. It actually calls the first function with the default id 0.
See also
Lock()

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