OmniSciDB  dfae7c3b14
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::Exprget (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 553 of file ParserNode.h.

Constructor & Destructor Documentation

◆ LikelihoodExpr()

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

Definition at line 555 of file ParserNode.h.

555 : is_not(n), arg(a), likelihood(l) {}
std::unique_ptr< Expr > arg
Definition: ParserNode.h:570

Member Function Documentation

◆ analyze()

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 683 of file ParserNode.cpp.

686  {
687  auto arg_expr = arg->analyze(catalog, query, allow_tlist_ref);
688  return LikelihoodExpr::get(arg_expr, likelihood, is_not);
689 }
static std::shared_ptr< Analyzer::Expr > get(std::shared_ptr< Analyzer::Expr > arg_expr, float likelihood, const bool is_not)
Definition: ParserNode.cpp:691
std::unique_ptr< Expr > arg
Definition: ParserNode.h:570

◆ get()

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 691 of file ParserNode.cpp.

References run_benchmark_import::result.

694  {
695  if (!arg_expr->get_type_info().is_boolean()) {
696  throw std::runtime_error("likelihood expression expects boolean type.");
697  }
698  std::shared_ptr<Analyzer::Expr> result = makeExpr<Analyzer::LikelihoodExpr>(
699  arg_expr->decompress(), is_not ? 1 - likelihood : likelihood);
700  return result;
701 }

◆ get_arg()

const Expr* Parser::LikelihoodExpr::get_arg ( ) const
inline

Definition at line 557 of file ParserNode.h.

557 { return arg.get(); }
std::unique_ptr< Expr > arg
Definition: ParserNode.h:570

◆ get_is_not()

bool Parser::LikelihoodExpr::get_is_not ( ) const
inline

Definition at line 556 of file ParserNode.h.

556 { return is_not; }

◆ get_likelihood()

float Parser::LikelihoodExpr::get_likelihood ( ) const
inline

Definition at line 558 of file ParserNode.h.

References to_string().

558 { return likelihood; }
+ Here is the call graph for this function:

◆ to_string()

std::string Parser::LikelihoodExpr::to_string ( ) const
overridevirtual

Implements Parser::Expr.

Definition at line 1412 of file ParserNode.cpp.

1412  {
1413  std::string str = " LIKELIHOOD ";
1414  str += arg->to_string();
1415  str += " ";
1416  str += boost::lexical_cast<std::string>(is_not ? 1.0 - likelihood : likelihood);
1417  return str;
1418 }
std::unique_ptr< Expr > arg
Definition: ParserNode.h:570

Member Data Documentation

◆ arg

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

Definition at line 570 of file ParserNode.h.

◆ is_not

bool Parser::LikelihoodExpr::is_not
private

Definition at line 569 of file ParserNode.h.

◆ likelihood

float Parser::LikelihoodExpr::likelihood
private

Definition at line 571 of file ParserNode.h.


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