DDD  1.9.0.20240826145154
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
_GShom Class Referenceabstract

The concrete data class for Homomorphisms. More...

#include <SHom.h>

Inheritance diagram for _GShom:
Inheritance graph
Collaboration diagram for _GShom:
Collaboration graph

Public Member Functions

GSDD has_image_skip (const GSDD &) const
 
virtual bool skip_variable (int) const
 The skip_variable predicate indicates which variables are "don't care" with respect to this SHom. More...
 
virtual bool is_selector () const
 The isSelector predicate indicates a homomorphism that only selects paths in the SDD (no modifications, no additions) Tagging with isSelector() allows to enable optimizations and makes the homomorphism eligible as "condition" in ITE construct. More...
 
virtual const GShom::range_t get_range () const
 The range returns the dual of skip_variable, default implem considers that all variables are affected by this homomorphism. More...
 
 _GShom (int ref=0)
 Constructor. More...
 
virtual ~_GShom ()
 Destructor. More...
 
virtual bool operator== (const _GShom &h) const =0
 Comparator. More...
 
virtual size_t hash () const =0
 Hash key computation. More...
 
virtual _GShomclone () const =0
 
virtual GSDD has_image (const GSDD &d) const
 
virtual GShom compose (const GShom &) const
 
virtual GSDD eval (const GSDD &) const =0
 The computation function responsible for evaluation over a node. More...
 
virtual void mark () const
 For garbage collection. Used in first phase of garbage collection. More...
 
void mark_if_refd () const
 
void ref () const
 
void deref () const
 
unsigned long int refCounter () const
 
bool is_marked () const
 
void set_mark (bool val) const
 
virtual void print (std::ostream &os) const =0
 
virtual GShom invert (const GSDD &) const
 

Static Public Member Functions

static const _GShomget_concret (const GShom &gshom)
 TODO : this is a dirty trick to allow us to do terms rewriting in Add, Fixpoint etc... More...
 

Private Member Functions

GSDD eval_skip (const GSDD &) const
 The procedure responsible for propagating efficiently across "skipped" variable nodes. More...
 
virtual bool immediat () const
 For operation cache management. More...
 

Private Attributes

int _refCounter
 For garbage collection. More...
 

Friends

class GShom
 open access to container class GShom. More...
 
class Shom
 open access to container class Shom. More...
 

Detailed Description

The concrete data class for Homomorphisms.

Users should not use this (private) class directly, but may use it indirectly by deriving user homomorphisms from the StrongShom class.

Constructor & Destructor Documentation

◆ _GShom()

_GShom::_GShom ( int  ref = 0)
inline

Constructor.

Note this class is abstract, so this is only used in initialization list of derived classes constructors (hard coded operations and StrongShom).

◆ ~_GShom()

virtual _GShom::~_GShom ( )
inlinevirtual

Destructor.

Default behavior.

Todo:
Remove this declaration ? compiler generated version sufficient.

Member Function Documentation

◆ clone()

virtual _GShom* _GShom::clone ( ) const
pure virtual

◆ compose()

GShom _GShom::compose ( const GShom r) const
virtual

References GShom::id, and GSDD::null.

Referenced by GShom::compose().

◆ deref()

void _GShom::deref ( ) const
inline

References _refCounter.

Referenced by Shom::operator=(), and Shom::~Shom().

◆ eval()

virtual GSDD _GShom::eval ( const GSDD ) const
pure virtual

The computation function responsible for evaluation over a node.

Users should not directly use this. Normal behavior is to use GShom::operator() that encapsulates this call with operation caching.

Implemented in sns::MLShomAdapter, sns::Fixpoint, sns::HomMinus, sns::Minus, sns::RightConcat, sns::LeftConcat, sns::Compose, sns::RecFireSat, sns::Add, sns::And, sns::SNotCond, sns::SLocalApply, sns::LocalApply, sns::SDomExtract, sns::Inter, sns::Mult, sns::SApply2k, sns::Constant, sns::Identity, and StrongShom.

Referenced by eval_skip().

◆ eval_skip()

GSDD _GShom::eval_skip ( const GSDD d) const
private

The procedure responsible for propagating efficiently across "skipped" variable nodes.

References GSDD::begin(), GSDD::end(), eval(), GShom::id, immediat(), GSDD::nbsons(), GSDD::null, GSDD::one, skip_variable(), square_union(), GSDD::top, and GSDD::variable().

Referenced by GShom::eval().

◆ get_concret()

static const _GShom* _GShom::get_concret ( const GShom gshom)
inlinestatic

◆ get_range()

virtual const GShom::range_t _GShom::get_range ( ) const
inlinevirtual

The range returns the dual of skip_variable, default implem considers that all variables are affected by this homomorphism.

Reimplemented in sns::Fixpoint, sns::Compose, sns::RecFireSat, sns::Add, sns::And, sns::SNotCond, sns::SLocalApply, and sns::LocalApply.

References GShom::full_range.

Referenced by GShom::get_range().

◆ has_image()

GSDD _GShom::has_image ( const GSDD d) const
virtual

◆ has_image_skip()

GSDD _GShom::has_image_skip ( const GSDD d) const

◆ hash()

virtual size_t _GShom::hash ( ) const
pure virtual

Hash key computation.

It is essential for good hash table operation that the spread of the keys be as good as possible. Also, fast hash key computation is a good design goal. Note that bad hash functions will yield more collisions, thus equality comparisons which may be quite costly.

Implemented in sns::MLShomAdapter, sns::Fixpoint, sns::HomMinus, sns::Minus, sns::RightConcat, sns::LeftConcat, sns::Compose, sns::RecFireSat, sns::Add, sns::And, sns::SNotCond, sns::SLocalApply, sns::LocalApply, sns::SDomExtract, sns::Inter, sns::Mult, sns::SApply2k, sns::Constant, and sns::Identity.

◆ immediat()

virtual bool _GShom::immediat ( ) const
inlineprivatevirtual

For operation cache management.

If immediat==true, eval is called without attempting a cache hit. Currently only the constant homomorphism has this attribute set to true. Overload and return true for immediate computations.

Reimplemented in sns::Constant, and sns::Identity.

Referenced by eval_skip(), and GShom::operator()().

◆ invert()

virtual GShom _GShom::invert ( const GSDD ) const
inlinevirtual

◆ is_marked()

bool _GShom::is_marked ( ) const
inline

References _refCounter.

Referenced by set_mark().

◆ is_selector()

virtual bool _GShom::is_selector ( ) const
inlinevirtual

The isSelector predicate indicates a homomorphism that only selects paths in the SDD (no modifications, no additions) Tagging with isSelector() allows to enable optimizations and makes the homomorphism eligible as "condition" in ITE construct.

Reimplemented in sns::Fixpoint, sns::HomMinus, sns::Minus, sns::Compose, sns::RecFireSat, sns::Add, sns::And, sns::SNotCond, sns::SLocalApply, sns::LocalApply, sns::SDomExtract, sns::Inter, sns::Mult, sns::SApply2k, sns::Constant, and sns::Identity.

Referenced by invert(), and GShom::is_selector().

◆ mark()

virtual void _GShom::mark ( ) const
inlinevirtual

◆ mark_if_refd()

void _GShom::mark_if_refd ( ) const
inline

References refCounter(), and set_mark().

◆ operator==()

virtual bool _GShom::operator== ( const _GShom h) const
pure virtual

Comparator.

Used in case of hash collision. Should be appropriately defined in derived classes, in particular in user defined homomorphisms.

Implemented in sns::SNotCond, sns::SLocalApply, sns::LocalApply, sns::SDomExtract, sns::MLShomAdapter, StrongShom, sns::Fixpoint, sns::HomMinus, sns::Minus, sns::RightConcat, sns::LeftConcat, sns::Compose, sns::RecFireSat, sns::Add, sns::And, sns::Inter, sns::Mult, sns::SApply2k, sns::Constant, and sns::Identity.

◆ print()

virtual void _GShom::print ( std::ostream &  os) const
pure virtual

◆ ref()

void _GShom::ref ( ) const
inline

References _refCounter.

Referenced by Shom::operator=(), and Shom::Shom().

◆ refCounter()

unsigned long int _GShom::refCounter ( ) const
inline

◆ set_mark()

void _GShom::set_mark ( bool  val) const
inline

◆ skip_variable()

virtual bool _GShom::skip_variable ( int  ) const
inlinevirtual

The skip_variable predicate indicates which variables are "don't care" with respect to this SHom.

This is defined as a StrongHom with : phi(var,val) { if ( skip_variable(var) ) return GShom( var, val, this ); else { real behavior } }

Reimplemented in sns::SDomExtract, sns::Identity, sns::Fixpoint, sns::RightConcat, sns::Compose, sns::RecFireSat, sns::Add, sns::And, sns::SNotCond, sns::SLocalApply, sns::LocalApply, sns::Inter, and sns::SApply2k.

Referenced by eval_skip(), has_image_skip(), sns::Inter::skip_variable(), sns::Add::skip_variable(), sns::RightConcat::skip_variable(), and GShom::skip_variable().

Friends And Related Function Documentation

◆ GShom

friend class GShom
friend

◆ Shom

friend class Shom
friend

open access to container class Shom.

Referenced by sns::Fixpoint::eval().

Member Data Documentation

◆ _refCounter

int _GShom::_refCounter
mutableprivate

For garbage collection.

Counts the number of times a _GShom is referenced from the context of an Shom. For garbage collection: lowest bit of refCounter gives marking value for mark&sweep. Used in the two phase garbage collection process. A Shom that is not marked after the first pass over the unicity table, will be sweeped in the second phase. Outside of garbage collection routine, marking should always bear the value false.

Referenced by deref(), is_marked(), ref(), refCounter(), and set_mark().


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

Please comment this page and report errors about it on the RefDocComments page.
Generated on Mon Aug 26 2024 14:54:00 for DDD by doxygen 1.9.1