🛰️航天仿真算法库 SpaceAST
0.0.1
载入中...
搜索中...
未找到
OpUnary.hpp
浏览该文件的文档.
1
20
21
#pragma once
22
23
#include "AstGlobal.h"
24
#include "
Op.hpp
"
25
#include "AstScript/ScriptAPI.hpp"
26
#include <atomic>
27
#include <mutex>
28
29
AST_NAMESPACE_BEGIN
30
33
class
AST_SCRIPT_API
OpUnary
:
public
Op
34
{
35
public
:
36
AST_EXPR(
OpUnary
)
37
38
OpUnary
(
EOpUnaryType
op,
Expr
* expr)
39
: op_(op), expr_(expr)
40
{};
41
virtual
~OpUnary
() =
default
;
42
Value
*
eval
()
const override
;
43
std::string
getExpression
(
Object
* context=
nullptr
)
const override
;
44
EOpUnaryType
op()
const
{
return
op_;}
45
SharedPtr<Expr>
expr()
const
{
return
expr_;}
46
protected
:
47
EOpUnaryType
op_
;
48
SharedPtr<Expr>
expr_
;
49
private
:
50
mutable
std::atomic<OpUnaryFunc> func_{
nullptr
};
51
mutable
std::atomic<Class*> type_{
nullptr
};
52
mutable
std::mutex cache_mutex_;
53
};
54
55
56
57
AST_NAMESPACE_END
Op.hpp
~
ast::Expr
表达式基类
定义
Expr.hpp:40
ast::Expr::eval
virtual Value * eval() const =0
求值
ast::Expr::getExpression
virtual std::string getExpression(Object *context=nullptr) const =0
获取表达式的字符串表示
ast::Object
对象基类,继承自该类的对象可以使用运行时类型信息相关功能,实现强弱引用计数、运行时元信息(属性访问、序列化等)等基础功能
定义
Object.hpp:95
ast::OpUnary
一元运算符表达式
定义
OpUnary.hpp:34
ast::OpUnary::op_
EOpUnaryType op_
运算符
定义
OpUnary.hpp:47
ast::OpUnary::expr_
SharedPtr< Expr > expr_
操作数
定义
OpUnary.hpp:48
ast::Op
运算符表达式
定义
Op.hpp:32
ast::SharedPtr
共享指针
定义
SharedPtr.hpp:33
ast::Value
值对象基类
定义
Value.hpp:43
ast::EOpUnaryType
EOpUnaryType
定义
ScriptAPI.hpp:105
src
AstScript
Operator
OpUnary.hpp
制作者
1.12.0