mutable
A Database System for Research and Fast Prototyping
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends
m::cnf::Predicate Struct Reference

A Predicate contains a Expr of Boolean type in either positive or negative form. More...

#include <CNF.hpp>

Collaboration diagram for m::cnf::Predicate:
[legend]

Public Member Functions

bool negative () const
 Returns true iff this Predicate is negative.
 
ast::Exprexpr ()
 Returns the Expr within this Predicate.
 
const ast::Exprexpr () const
 Returns the Expr within this Predicate.
 
const ast::Exproperator* () const
 Returns the Expr within this Predicate.
 
const ast::Exproperator-> () const
 Returns the Expr within this Predicate.
 
bool is_equi () const
 Returns true iff this Predicate is an equi-predicate, i.e.
 
bool can_be_null () const
 Returns true iff this Predicate is nullable, i.e.
 
Predicate operator! () const
 Returns a negated version of this Predicate, i.e. if this Predicate is positive, the returned Predicate is negative.
 
bool operator== (Predicate other) const
 Returns true iff other is equal to this.
 
bool operator!= (Predicate other) const
 Returns true iff other is not equal to this.
 
bool operator< (Predicate other) const
 Compare Predicates by the location of their referenced Expr in memory and their sign.
 
void to_sql (std::ostream &out) const
 Print as SQL expression.
 
void dump (std::ostream &out) const
 
void dump () const
 

Static Public Member Functions

static Predicate Positive (const ast::Expr *e)
 Creates a positive Predicate from e.
 
static Predicate Negative (const ast::Expr *e)
 Creates a negative Predicate from e.
 
static Predicate Create (const ast::Expr *e, bool is_negative)
 Creates a Predicate from e.
 

Private Member Functions

 Predicate (uintptr_t l)
 

Private Attributes

uintptr_t literal_
 pointer to Expr; LSB is 1 iff literal is negated
 

Friends

std::ostream &M_EXPORT operator<< (std::ostream &out, const Predicate &pred)
 Print a textual representation of pred to out.
 
M_EXPORT std::string to_string (const Predicate &pred)
 

Detailed Description

A Predicate contains a Expr of Boolean type in either positive or negative form.

Definition at line 15 of file CNF.hpp.

Constructor & Destructor Documentation

◆ Predicate()

m::cnf::Predicate::Predicate ( uintptr_t  l)
inlineexplicitprivate

Definition at line 20 of file CNF.hpp.

Member Function Documentation

◆ can_be_null()

bool m::cnf::Predicate::can_be_null ( ) const
inline

Returns true iff this Predicate is nullable, i.e.

may evaluate to NULL at runtime.

Definition at line 51 of file CNF.hpp.

◆ Create()

static Predicate m::cnf::Predicate::Create ( const ast::Expr e,
bool  is_negative 
)
inlinestatic

Creates a Predicate from e.

The Predicate is negative iff is_negative.

Definition at line 28 of file CNF.hpp.

Referenced by CNFGenerator::operator()().

◆ dump() [1/2]

void Predicate::dump ( ) const

Definition at line 186 of file CNF.cpp.

References dump().

Referenced by dump().

◆ dump() [2/2]

void Predicate::dump ( std::ostream &  out) const

Definition at line 182 of file CNF.cpp.

◆ expr() [1/2]

ast::Expr & m::cnf::Predicate::expr ( )
inline

Returns the Expr within this Predicate.

Definition at line 34 of file CNF.hpp.

Referenced by std::hash< m::cnf::Predicate >::operator()(), operator==(), and to_sql().

◆ expr() [2/2]

const ast::Expr & m::cnf::Predicate::expr ( ) const
inline

Returns the Expr within this Predicate.

Definition at line 36 of file CNF.hpp.

◆ is_equi()

bool m::cnf::Predicate::is_equi ( ) const
inline

Returns true iff this Predicate is an equi-predicate, i.e.

an equality comparison of two designators.

Definition at line 43 of file CNF.hpp.

References and().

◆ negative()

bool m::cnf::Predicate::negative ( ) const
inline

Returns true iff this Predicate is negative.

Definition at line 31 of file CNF.hpp.

Referenced by std::hash< m::cnf::Predicate >::operator()(), operator==(), and to_sql().

◆ Negative()

static Predicate m::cnf::Predicate::Negative ( const ast::Expr e)
inlinestatic

Creates a negative Predicate from e.

Definition at line 26 of file CNF.hpp.

◆ operator!()

Predicate m::cnf::Predicate::operator! ( ) const
inline

Returns a negated version of this Predicate, i.e. if this Predicate is positive, the returned Predicate is negative.

Definition at line 55 of file CNF.hpp.

◆ operator!=()

bool m::cnf::Predicate::operator!= ( Predicate  other) const
inline

Returns true iff other is not equal to this.

Two Predicates are equal, iff they have the same Expr and the same sign.

Definition at line 64 of file CNF.hpp.

◆ operator*()

const ast::Expr & m::cnf::Predicate::operator* ( ) const
inline

Returns the Expr within this Predicate.

Definition at line 38 of file CNF.hpp.

◆ operator->()

const ast::Expr * m::cnf::Predicate::operator-> ( ) const
inline

Returns the Expr within this Predicate.

Definition at line 40 of file CNF.hpp.

◆ operator<()

bool m::cnf::Predicate::operator< ( Predicate  other) const
inline

Compare Predicates by the location of their referenced Expr in memory and their sign.

Negative Predicates are larger than positive Predicates of the same expression.

Definition at line 68 of file CNF.hpp.

References literal_.

◆ operator==()

bool m::cnf::Predicate::operator== ( Predicate  other) const
inline

Returns true iff other is equal to this.

Two Predicates are equal, iff they have equal Expr and the same sign.

Definition at line 59 of file CNF.hpp.

References and(), expr(), and negative().

◆ Positive()

static Predicate m::cnf::Predicate::Positive ( const ast::Expr e)
inlinestatic

Creates a positive Predicate from e.

Definition at line 24 of file CNF.hpp.

◆ to_sql()

void Predicate::to_sql ( std::ostream &  out) const

Print as SQL expression.

Definition at line 99 of file CNF.cpp.

References expr(), and negative().

Friends And Related Function Documentation

◆ operator<<

std::ostream &M_EXPORT operator<< ( std::ostream &  out,
const Predicate pred 
)
friend

Print a textual representation of pred to out.

◆ to_string

M_EXPORT std::string to_string ( const Predicate pred)
friend

Definition at line 75 of file CNF.hpp.

Field Documentation

◆ literal_

uintptr_t m::cnf::Predicate::literal_
private

pointer to Expr; LSB is 1 iff literal is negated

Definition at line 18 of file CNF.hpp.

Referenced by operator<().


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