OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Parser::LikelihoodExpr Class Reference

#include <ParserNode.h>

+ Inheritance diagram for Parser::LikelihoodExpr:
+ Collaboration diagram for Parser::LikelihoodExpr:

Public Member Functions

 LikelihoodExpr (bool n, Expr *a, float l)
 
bool get_is_not () const
 
const Exprget_arg () const
 
float get_likelihood () const
 
std::shared_ptr< Analyzer::Expranalyze (const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query, TlistRefType allow_tlist_ref=TLIST_NONE) const override
 
std::string to_string () const override
 
- Public Member Functions inherited from Parser::Node
virtual ~Node ()
 

Static Public Member Functions

static std::shared_ptr
< Analyzer::Expr
get (std::shared_ptr< Analyzer::Expr > arg_expr, float likelihood, const bool is_not)
 

Private Attributes

bool is_not_
 
std::unique_ptr< Exprarg_
 
float likelihood_
 

Additional Inherited Members

- Public Types inherited from Parser::Expr
enum  TlistRefType { TLIST_NONE, TLIST_REF, TLIST_COPY }
 

Detailed Description

Definition at line 585 of file ParserNode.h.

Constructor & Destructor Documentation

Parser::LikelihoodExpr::LikelihoodExpr ( bool  n,
Expr a,
float  l 
)
inline

Definition at line 587 of file ParserNode.h.

587 : is_not_(n), arg_(a), likelihood_(l) {}
std::unique_ptr< Expr > arg_
Definition: ParserNode.h:602
constexpr double a
Definition: Utm.h:32
constexpr double n
Definition: Utm.h:38

Member Function Documentation

std::shared_ptr< Analyzer::Expr > Parser::LikelihoodExpr::analyze ( const Catalog_Namespace::Catalog catalog,
Analyzer::Query query,
TlistRefType  allow_tlist_ref = TLIST_NONE 
) const
overridevirtual

Implements Parser::Expr.

Definition at line 839 of file ParserNode.cpp.

842  {
843  auto arg_expr = arg_->analyze(catalog, query, allow_tlist_ref);
844  return LikelihoodExpr::get(arg_expr, likelihood_, is_not_);
845 }
std::unique_ptr< Expr > arg_
Definition: ParserNode.h:602
static std::shared_ptr< Analyzer::Expr > get(std::shared_ptr< Analyzer::Expr > arg_expr, float likelihood, const bool is_not)
Definition: ParserNode.cpp:847
std::shared_ptr< Analyzer::Expr > Parser::LikelihoodExpr::get ( std::shared_ptr< Analyzer::Expr arg_expr,
float  likelihood,
const bool  is_not 
)
static

Definition at line 847 of file ParserNode.cpp.

References run_benchmark_import::result.

850  {
851  if (!arg_expr->get_type_info().is_boolean()) {
852  throw std::runtime_error("likelihood expression expects boolean type.");
853  }
854  std::shared_ptr<Analyzer::Expr> result = makeExpr<Analyzer::LikelihoodExpr>(
855  arg_expr->decompress(), is_not ? 1 - likelihood : likelihood);
856  return result;
857 }
const Expr* Parser::LikelihoodExpr::get_arg ( ) const
inline

Definition at line 589 of file ParserNode.h.

References arg_.

589 { return arg_.get(); }
std::unique_ptr< Expr > arg_
Definition: ParserNode.h:602
bool Parser::LikelihoodExpr::get_is_not ( ) const
inline

Definition at line 588 of file ParserNode.h.

References is_not_.

588 { return is_not_; }
float Parser::LikelihoodExpr::get_likelihood ( ) const
inline

Definition at line 590 of file ParserNode.h.

References likelihood_.

590 { return likelihood_; }
std::string Parser::LikelihoodExpr::to_string ( ) const
overridevirtual

Implements Parser::Expr.

Definition at line 2295 of file ParserNode.cpp.

2295  {
2296  std::string str = " LIKELIHOOD ";
2297  str += arg_->to_string();
2298  str += " ";
2299  str += boost::lexical_cast<std::string>(is_not_ ? 1.0 - likelihood_ : likelihood_);
2300  return str;
2301 }
std::unique_ptr< Expr > arg_
Definition: ParserNode.h:602

Member Data Documentation

std::unique_ptr<Expr> Parser::LikelihoodExpr::arg_
private

Definition at line 602 of file ParserNode.h.

Referenced by get_arg().

bool Parser::LikelihoodExpr::is_not_
private

Definition at line 601 of file ParserNode.h.

Referenced by get_is_not().

float Parser::LikelihoodExpr::likelihood_
private

Definition at line 603 of file ParserNode.h.

Referenced by get_likelihood().


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