代码拉取完成,页面将自动刷新
// Copyrights by Kenneth Lee, 2022. All Rights Reserved
#ifndef __VALUE_HPP__
#define __VALUE_HPP__
#include <iostream>
#include <assert.h>
using namespace std;
#ifdef USE_FLOAT_VAL
# define Val FloatVal
# include "float_val.hpp"
#else
# define Val AnaVal
# include "ana_val.hpp"
#endif
class ValComp {
private:
const static bool show_id = false; // for debug id allocation
bool contain_id(int id);
void clone_parent(ValComp *n);
public:
enum OPS { ADD, SUB, MUL, DIV, INV_OP };
Val ret; // evaluate result, NULL also means "NOT SET"
Val* vals;
int* ids; // indexes of value in splited ValComp, temporal used by emulation algorithm
int size;
OPS op;
ValComp *left, *right, *parent;
ValComp();
ValComp(int sz);
ValComp(ValComp *src, ValComp *sub);
ValComp(int argc, char *argv[]);
ValComp * clone() const;
ValComp * clone_tree();
friend ostream & show(ostream & os, const ValComp & vg, int i);
friend ostream & operator<<(ostream & os, const ValComp & vc);
bool is_right_most();
void copy_by_id(ValComp *vc, int tgt_id, int src_id);
void merge_op(ValComp *l, ValComp *r, OPS o);
ValComp *find_root();
void evaluate(void);
void show_expr(void);
};
extern void free_tree(ValComp *root);
extern ValComp *find_unsolved_leaf(ValComp *r);
extern ostream & operator<<(ostream & os, const ValComp::OPS & op);
#endif
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。