Public Member Functions | Static Public Attributes

wali::SemElem Class Reference

base abstract class to be subclassed by user's semiring More...

List of all members.

Public Member Functions

 SemElem ()
 SemElem constructor.
virtual ~SemElem ()
 SemElem destructor is virtual and does nothing.
virtual sem_elem_t one () const =0
 return the One element of the semiring
virtual sem_elem_t zero () const =0
 return the Zero element of the semiring
virtual sem_elem_t extend (SemElem *se)=0
 Perform the extend operation.
virtual sem_elem_t combine (SemElem *se)=0
 Perform the combine operation.
virtual bool equal (SemElem *se) const =0
 Equality comparison between two semiring elements.
virtual std::ostream & print (std::ostream &o) const =0
 Print the semiring element to the std::ostream o.
virtual std::ostream & marshall (std::ostream &o) const
 Used to print weights to XML.
std::ostream & marshallWeight (std::ostream &o) const
 Used to print weights to XML.
virtual sem_elem_t diff (SemElem *se)
 Perfrom the diff operation NOTE: This method performs (this - se).
virtual sem_elem_t quasi_one () const
 Perform the quasi_one operation.
virtual std::pair< sem_elem_t,
sem_elem_t
delta (SemElem *se)
 Perform delta operation The delta operation is defined for the user but can be overridden to get better performance.
sem_elem_t star ()
 Perform the star operation (returns this^).
sem_elem_t extend (sem_elem_t se)
 Wrapper method for extend that will remove the ref_ptr to make the call to the user's code.
sem_elem_t combine (sem_elem_t se)
 Wrapper method for combine that will remove the ref_ptr to make the call to the user's code.
bool equal (sem_elem_t se) const
 Wrapper method for equal that will remove the ref_ptr to make the call to the user's code.
sem_elem_t diff (sem_elem_t se)
 Wrapper method for diff that will remove the ref_ptr to make the call to the user's code.
std::pair< sem_elem_t, sem_elem_tdelta (sem_elem_t se)
 Wrapper method for delta that will remove the ref_ptr to make the call to the user's code.

Static Public Attributes

static const std::string XMLTag

Detailed Description

base abstract class to be subclassed by user's semiring

This abstract class provides the signature (or in Java interface) for a Semiring Element (or Weight). All pure abstract methods must be defined by the user.

The constructor takes a boolean that turns reference counting on or off. By default it is on. Please leave this as true less you know you do not want the user weight objects to be garbage collected.

See also:
ref_ptr

Some minimal testing is provided by

o wali::test_semelem_impl(wali::sem_elem_t x)

It performs tests such as the following: o 0 = 0 o 1 = 1 o x = x o x + 0 = x = 0 + x o x * 0 = 0 = 0 * x o x * 1 = x = 1 * x


Constructor & Destructor Documentation

wali::SemElem::SemElem (  )  [explicit]

SemElem constructor.

virtual wali::SemElem::~SemElem (  )  [virtual]

SemElem destructor is virtual and does nothing.


Member Function Documentation

virtual sem_elem_t wali::SemElem::one (  )  const [pure virtual]

return the One element of the semiring

Implemented in Reach, wali::regex::Regex, wali::SemElemPair, wali::ShortestPathSemiring, and wali::wfa::epr::FunctionalWeight.

Referenced by quasi_one(), and star().

virtual sem_elem_t wali::SemElem::zero (  )  const [pure virtual]

return the Zero element of the semiring

Implemented in Reach, wali::regex::Regex, wali::SemElemPair, wali::ShortestPathSemiring, and wali::wfa::epr::FunctionalWeight.

Referenced by delta().

virtual sem_elem_t wali::SemElem::extend ( SemElem se  )  [pure virtual]

Perform the extend operation.

Implemented in Reach, wali::regex::Regex, wali::SemElemPair, wali::ShortestPathSemiring, and wali::wfa::epr::FunctionalWeight.

Referenced by extend().

virtual sem_elem_t wali::SemElem::combine ( SemElem se  )  [pure virtual]

Perform the combine operation.

Implemented in Reach, wali::regex::Regex, wali::SemElemPair, wali::ShortestPathSemiring, and wali::wfa::epr::FunctionalWeight.

Referenced by combine(), delta(), and star().

virtual bool wali::SemElem::equal ( SemElem se  )  const [pure virtual]

Equality comparison between two semiring elements.

Implemented in Reach, wali::regex::Regex, wali::SemElemPair, wali::ShortestPathSemiring, and wali::wfa::epr::FunctionalWeight.

Referenced by delta(), and equal().

virtual std::ostream& wali::SemElem::print ( std::ostream &  o  )  const [pure virtual]

Print the semiring element to the std::ostream o.

Implemented in Reach, wali::regex::Regex, wali::SemElemPair, wali::ShortestPathSemiring, and wali::wfa::epr::FunctionalWeight.

Referenced by wali::witness::Witness::extend().

std::ostream & wali::SemElem::marshall ( std::ostream &  o  )  const [virtual]

Used to print weights to XML.

Default implementation simply calls this->toString() and sends the output to the passed in ostream o.

References wali::Printable::toString().

Referenced by marshallWeight().

std::ostream & wali::SemElem::marshallWeight ( std::ostream &  o  )  const

Used to print weights to XML.

Outer wrapper that places the appropriate tags and then calls the virtual method marshall.

References marshall(), and XMLTag.

virtual sem_elem_t wali::SemElem::diff ( SemElem se  )  [virtual]

Perfrom the diff operation NOTE: This method performs (this - se).

This is very important as diff is not commutative

Reimplemented in wali::SemElemPair.

Referenced by diff().

sem_elem_t wali::SemElem::quasi_one (  )  const [virtual]

Perform the quasi_one operation.

Quasi one by default returns the One semiring element. If you are unsure of how to use Quasione then leave the default implementation.

Reimplemented in wali::SemElemPair.

References one().

std::pair< sem_elem_t, sem_elem_t > wali::SemElem::delta ( SemElem se  )  [virtual]

Perform delta operation The delta operation is defined for the user but can be overridden to get better performance.

The std::pair returned must have two properties 1) the first element == this COMBINE se 2) the second element == this DIFF se

Parameters:
se is the weight to be combined/diffed with "this"
Returns:
std::pair<sem_elem_t,sem_elem_t> the delta

Reimplemented in wali::SemElemPair.

References combine(), equal(), and zero().

Referenced by delta().

sem_elem_t wali::SemElem::star (  ) 

Perform the star operation (returns this^).

References combine(), and one().

sem_elem_t wali::SemElem::extend ( sem_elem_t  se  ) 

Wrapper method for extend that will remove the ref_ptr to make the call to the user's code.

References extend(), and wali::ref_ptr< T >::get_ptr().

sem_elem_t wali::SemElem::combine ( sem_elem_t  se  ) 

Wrapper method for combine that will remove the ref_ptr to make the call to the user's code.

References combine(), and wali::ref_ptr< T >::get_ptr().

bool wali::SemElem::equal ( sem_elem_t  se  )  const

Wrapper method for equal that will remove the ref_ptr to make the call to the user's code.

References equal(), and wali::ref_ptr< T >::get_ptr().

sem_elem_t wali::SemElem::diff ( sem_elem_t  se  ) 

Wrapper method for diff that will remove the ref_ptr to make the call to the user's code.

References diff(), and wali::ref_ptr< T >::get_ptr().

std::pair< sem_elem_t,sem_elem_t > wali::SemElem::delta ( sem_elem_t  se  ) 

Wrapper method for delta that will remove the ref_ptr to make the call to the user's code.

This is just a nice "typesafe macro" b/c sem_elem_t is used by WPDS

References delta(), and wali::ref_ptr< T >::get_ptr().


Member Data Documentation

const std::string wali::SemElem::XMLTag [static]

Referenced by marshallWeight().


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