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

#include <Object.hpp>

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

Public 成员函数

 Object (Object *parentScope)
 
 Object (std::nullptr_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
 
std::string displayName () 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
 
template<typename T >
getParent () const
 
bool isOfType (const Class *type) const
 
bool isOfType (StringView typeName) const
 
template<typename T >
bool isOfType () const
 
template<typename Func >
void addDelayedLink (Func &&link)
 
template<typename Func >
void addDelayedLinkIfFailed (Func &&link)
 
void resolveLinks ()
 
bool readOnly () const
 
void setReadOnly (bool readOnly)
 
bool active () const
 
void setActive (bool active)
 
bool isComponent () const
 
void setIsComponent (bool isComponent)
 
bool isEntity () const
 
void setIsEntity (bool isEntity)
 
const char * tr (const char *msg) const
 
 Referenced ()
 
 Referenced (initial_strong_ref_t)
 
- Public 成员函数 继承自 ast::Referenced
 Referenced (initial_strong_ref_t)
 
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 ()
 

静态 Public 成员函数

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

静态 Public 属性

static Class staticType
 

Protected 成员函数

 Object (const Object &obj)
 
Objectoperator= (const Object &)
 
- Protected 成员函数 继承自 ast::Referenced
void setDestructed ()
 

友元

class ObjectManager
 

详细描述

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

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

成员函数说明

◆ 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 属性

◆ 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

获取对象的名称

ast::Facility, ast::Mover, ast::ObjectNamed, ast::Scenario, ast::Sensor , 以及 ast::Struct 重载.

◆ 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* 类型元信息指针

◆ 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 是否为指定类型的实例

◆ Referenced()

ast::Referenced::Referenced ( initial_strong_ref_t )
inlineexplicit

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

参数
initial_strong_ref_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::Facility, ast::Mover, ast::ObjectNamed, ast::Scenario, ast::Sensor , 以及 ast::Struct 内被实现.

◆ 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* 类型元信息

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