🛰️航天仿真算法库 SpaceAST 0.0.1
载入中...
搜索中...
未找到
ast::Object类 参考abstract

#include <Object.hpp>

+ 类 ast::Object 继承关系图:

Public 成员函数

 Object (Object *parentScope)
 
 Object (std::nullptr_t)
 
 Object (initial_strong_ref_t)
 
virtual ClassgetType () const
 
virtual std::string getRepresentation () const
 
virtual const std::string & getName () const
 
virtual void setName (StringView name)=0
 
const std::string & name () const
 
errc_t showEditDialog ()
 
Attribute attr (StringView path)
 
errc_t getAttrBool (StringView path, bool &value) const
 
errc_t getAttrInt (StringView path, int &value) const
 
errc_t getAttrDouble (StringView path, double &value) const
 
errc_t getAttrString (StringView path, std::string &value) const
 
errc_t getAttrObject (StringView path, Object *&value) const
 
double getAttrDouble (StringView path) const
 
int getAttrInt (StringView path) const
 
bool getAttrBool (StringView path) const
 
std::string getAttrString (StringView path) const
 
ObjectgetAttrObject (StringView path) const
 
errc_t setAttrBool (StringView path, bool value)
 
errc_t setAttrInt (StringView path, int value)
 
errc_t setAttrDouble (StringView path, double value)
 
errc_t setAttrString (StringView path, StringView value)
 
errc_t setAttrObject (StringView path, Object *value)
 
Classtype () const
 
const std::string & typeName () const
 
PropertygetProperty (StringView fieldName) const
 
ObjectId getID () const
 
errc_t setParentScope (Object *parentScope)
 
ObjectgetParentScope () const
 
bool isOfType (const Class *type) const
 
bool isOfType (StringView typeName) const
 
template<typename T >
bool isOfType () const
 
uint32_t refCount () const
 
uint32_t weakRefCount () const
 
bool isDestructed () const
 
void destruct ()
 
uint32_t incWeakRef ()
 
uint32_t decWeakRef ()
 
uint32_t incRef ()
 
uint32_t decRef ()
 
uint32_t decRefNoDelete ()
 
template<typename Func >
void addDelayedLink (Func &&link)
 
template<typename Func >
void addDelayedLinkIfFailed (Func &&link)
 
void resolveLinks ()
 

静态 Public 成员函数

static ObjectResolve (StringView value)
 
static void ClassInit (Class *cls)
 
static ClassStaticType ()
 

静态 Public 属性

static Class staticType
 

Protected 成员函数

 Object (const Object &obj)
 
Objectoperator= (const Object &)
 

友元

class ObjectManager
 
A_ALWAYS_INLINE friend uint32_t aObject_IncRef (Object *obj)
 
A_ALWAYS_INLINE friend uint32_t aObject_DecRef (Object *obj)
 
A_ALWAYS_INLINE friend uint32_t aObject_IncWeakRef (Object *obj)
 
A_ALWAYS_INLINE friend uint32_t aObject_DecWeakRef (Object *obj)
 
A_ALWAYS_INLINE friend bool aObject_IsDestructed (const Object *obj)
 

详细描述

对象基类,继承自该类的对象可以使用运行时类型信息相关功能,实现强弱引用计数、运行时元信息(属性访问、序列化等)等基础功能

参考了Qt的QObject类、UE的UObject类、以及Python的PyObject等类的设计和实现

构造及析构函数说明

◆ Object()

ast::Object::Object ( initial_strong_ref_t )
inline

构造函数,用于初始化对象的强引用计数为1

参数
initial_strong_ref_t初始化强引用计数的标记

成员函数说明

◆ addDelayedLink()

template<typename Func >
void ast::Object::addDelayedLink ( Func && link)
inline

添加延迟链接

参数
link延迟链接函数
警告
必须include ObjectLinker.hpp
参见
ObjectLinker.hpp

◆ addDelayedLinkIfFailed()

template<typename Func >
void ast::Object::addDelayedLinkIfFailed ( Func && link)
inline

若直接解析失败则添加延迟链接

参数
link延迟链接函数
警告
必须include ObjectLinker.hpp
参见
ObjectLinker.hpp

◆ attr()

Attribute ast::Object::attr ( StringView path)

获取属性,属性路径格式为 "attr1.attr2.attr3"

参数
path属性路径
返回
Attribute 属性

◆ decRef()

uint32_t ast::Object::decRef ( )
inline

减少强引用计数

返回
uint32_t 新的强引用计数

◆ decRefNoDelete()

uint32_t ast::Object::decRefNoDelete ( )
inline

减少强引用计数,不删除对象

返回
uint32_t 新的强引用计数

◆ decWeakRef()

uint32_t ast::Object::decWeakRef ( )
inline

减少弱引用计数

返回
uint32_t 新的弱引用计数

◆ destruct()

void ast::Object::destruct ( )
inline

析构对象,仅当强引用计数为0时才会被调用

析构对象时,会先将弱引用计数减1,若弱引用计数为0,则会调用析构函数

警告
对于栈上的对象,不要调用该函数,避免对栈内存调用 delete 导致崩溃

◆ getAttrBool() [1/2]

bool ast::Object::getAttrBool ( StringView path) const

获取属性值,属性路径格式为 "attr1.attr2.attr3"

参数
path属性路径
返回
bool 属性值

◆ getAttrBool() [2/2]

errc_t ast::Object::getAttrBool ( StringView path,
bool & value ) const

获取属性值,属性路径格式为 "attr1.attr2.attr3"

参数
path属性路径
value属性值引用
返回
errc_t 错误码

◆ getAttrDouble() [1/2]

double ast::Object::getAttrDouble ( StringView path) const

获取属性值,属性路径格式为 "attr1.attr2.attr3"

参数
path属性路径
返回
double 属性值

◆ getAttrDouble() [2/2]

errc_t ast::Object::getAttrDouble ( StringView path,
double & value ) const

获取属性值,属性路径格式为 "attr1.attr2.attr3"

参数
path属性路径
value属性值引用
返回
errc_t 错误码

◆ getAttrInt() [1/2]

int ast::Object::getAttrInt ( StringView path) const

获取属性值,属性路径格式为 "attr1.attr2.attr3"

参数
path属性路径
返回
int 属性值

◆ getAttrInt() [2/2]

errc_t ast::Object::getAttrInt ( StringView path,
int & value ) const

获取属性值,属性路径格式为 "attr1.attr2.attr3"

参数
path属性路径
value属性值引用
返回
errc_t 错误码

◆ getAttrObject() [1/2]

Object * ast::Object::getAttrObject ( StringView path) const

获取属性值,属性路径格式为 "attr1.attr2.attr3"

参数
path属性路径
返回
Object* 属性值

◆ getAttrObject() [2/2]

errc_t ast::Object::getAttrObject ( StringView path,
Object *& value ) const

获取属性值,属性路径格式为 "attr1.attr2.attr3"

参数
path属性路径
value属性值引用
返回
errc_t 错误码

◆ getAttrString() [1/2]

std::string ast::Object::getAttrString ( StringView path) const

获取属性值,属性路径格式为 "attr1.attr2.attr3"

参数
path属性路径
返回
std::string 属性值

◆ getAttrString() [2/2]

errc_t ast::Object::getAttrString ( StringView path,
std::string & value ) const

获取属性值,属性路径格式为 "attr1.attr2.attr3"

参数
path属性路径
value属性值引用
返回
errc_t 错误码

◆ getID()

uint32_t ast::Object::getID ( ) const

获取对象ID

返回
ObjectId 对象ID

◆ getName()

const std::string & ast::Object::getName ( ) const
virtual

◆ getParentScope()

Object * ast::Object::getParentScope ( ) const

获取对象的父作用域

返回
Object* 父作用域指针

◆ getProperty()

Property * ast::Object::getProperty ( StringView fieldName) const

获取属性元信息

参数
fieldName属性名
返回
Property* 属性元信息

◆ getRepresentation()

std::string ast::Object::getRepresentation ( ) const
virtual

获取对象的表示

返回
对象的表示

ast::EventTimeExplicit , 以及 ast::Frame 重载.

◆ getType()

Class * ast::Object::getType ( ) const
virtual

获取对象的类型元信息

返回
Class* 类型元信息指针

◆ incRef()

uint32_t ast::Object::incRef ( )
inline

增加强引用计数

返回
uint32_t 新的强引用计数

◆ incWeakRef()

uint32_t ast::Object::incWeakRef ( )
inline

增加弱引用计数

返回
uint32_t 新的弱引用计数

◆ isDestructed()

bool ast::Object::isDestructed ( ) const
inline

判断对象是否被析构

返回
bool 是否已析构

◆ isOfType() [1/2]

bool ast::Object::isOfType ( const Class * type) const

判断对象是否为指定类型的实例

参数
type类型元信息
返回
bool 是否为指定类型的实例

◆ isOfType() [2/2]

bool ast::Object::isOfType ( StringView typeName) const

判断对象是否为指定类型的实例

参数
typeName类型名
返回
bool 是否为指定类型的实例

◆ refCount()

uint32_t ast::Object::refCount ( ) const
inline

获取强引用计数

返回
uint32_t 强引用计数

◆ Resolve()

Object * ast::Object::Resolve ( StringView value)
static

解析字符串

参数
value字符串值
返回
Object* 解析结果

◆ resolveLinks()

A_ALWAYS_INLINE void ast::Object::resolveLinks ( )

解析延迟链接

解析所有延迟链接

警告
必须include ObjectLinker.hpp
参见
ObjectLinker.hpp

◆ setAttrBool()

errc_t ast::Object::setAttrBool ( StringView path,
bool value )
参数
path属性路径
value属性值
返回
errc_t 错误码

◆ setAttrDouble()

errc_t ast::Object::setAttrDouble ( StringView path,
double value )

设置属性值,属性路径格式为 "attr1.attr2.attr3"

参数
path属性路径
value属性值
返回
errc_t 错误码

◆ setAttrInt()

errc_t ast::Object::setAttrInt ( StringView path,
int value )

设置属性值,属性路径格式为 "attr1.attr2.attr3"

参数
path属性路径
value属性值
返回
errc_t 错误码

◆ setAttrObject()

errc_t ast::Object::setAttrObject ( StringView path,
Object * value )

设置属性值,属性路径格式为 "attr1.attr2.attr3"

参数
path属性路径
value属性值
返回
errc_t 错误码

◆ setAttrString()

errc_t ast::Object::setAttrString ( StringView path,
StringView value )

设置属性值,属性路径格式为 "attr1.attr2.attr3"

参数
path属性路径
value属性值
返回
errc_t 错误码

◆ setName()

virtual void ast::Object::setName ( StringView name)
pure virtual

设置对象的名称

参数
name对象名称

ast::CelestialBody, ast::Expr, ast::Facility, ast::Mover, ast::ObjectNamed, ast::Scenario, ast::Sensor, ast::Struct , 以及 ast::Variable 内被实现.

◆ setParentScope()

errc_t ast::Object::setParentScope ( Object * parentScope)

设置对象的父作用域

参数
parentScope父作用域指针
返回
errc_t 错误码

◆ showEditDialog()

errc_t ast::Object::showEditDialog ( )

显示编辑对话框,用于编辑对象的属性

返回
errc_t 错误码

◆ type()

Class * ast::Object::type ( ) const
inline

获取对象类型

返回
Class* 类型元信息

◆ weakRefCount()

uint32_t ast::Object::weakRefCount ( ) const
inline

获取弱引用计数

返回
uint32_t 弱引用计数

该类的文档由以下文件生成: