Reflectable script-object registry backing the database panel. 更多...
#include <ObjectRegistry.h>
Public 成员函数 | |
| ObjectRegistry (const ObjectRegistry &)=delete | |
| ObjectRegistry & | operator= (const ObjectRegistry &)=delete |
| ~ObjectRegistry () | |
| Releases remaining roots, or abandons them if the Runtime VM is gone. | |
| eve::Result< ObjectHandle > | create (const std::string &className) |
| Creates a class instance through the active Runtime and registers it. | |
| eve::Result< ObjectHandle > | registerObject (const std::string &className, const ssq::Object &object, const std::string &label={}) |
| Registers an existing live script instance. | |
| eve::Result< void > | unregister (ObjectHandle handle) |
| Removes a live entry and advances its slot generation. | |
| void | clear (const std::string &className) |
| Removes every entry of a class. | |
| void | clearAll () |
| Removes every entry. | |
| std::vector< std::string > | classNames () const |
| Class names with at least one entry, sorted. | |
| std::vector< ObjectEntry > | entries (const std::string &className) const |
| Entries of a class, in registration order. | |
| const ObjectEntry * | entry (ObjectHandle handle) const noexcept |
| Looks up a live entry without transferring ownership. | |
| bool | isStale (ObjectHandle handle) const noexcept |
| Reports whether a valid handle is stale in this registry. | |
| size_t | count (const std::string &className) const |
| Number of entries of a class. | |
静态 Public 成员函数 | |
| static ObjectRegistry & | instance () |
| Returns the process-local singleton owned by the UI module. | |
详细描述
Reflectable script-object registry backing the database panel.
Holds rooted references to script class instances grouped by class name. The database panel lists entries per class, creates instances through the active Runtime and edits their reflected properties; scripts register their own live objects through ui.dbRegister(obj).
All methods are main/UI-thread-affine. The registry owns the rooted script object while its slot is live. Callbacks must retain ObjectHandle values and resolve them again at invocation time; pointers and copied entries are observations and do not extend an entry's lifetime. Runtime shutdown releases remaining roots before the Squirrel VM is destroyed.
在文件 ObjectRegistry.h 第 56 行定义.
构造及析构函数说明
◆ ObjectRegistry()
|
delete |
◆ ~ObjectRegistry()
| eve::ui::ObjectRegistry::~ObjectRegistry | ( | ) |
Releases remaining roots, or abandons them if the Runtime VM is gone.
在文件 ObjectRegistry.cpp 第 51 行定义.
引用了 clearAll(), eve::ModuleManager::runtime() , 以及 target.
成员函数说明
◆ classNames()
| std::vector< std::string > eve::ui::ObjectRegistry::classNames | ( | ) | const |
Class names with at least one entry, sorted.
在文件 ObjectRegistry.cpp 第 258 行定义.
◆ clear()
| void eve::ui::ObjectRegistry::clear | ( | const std::string & | className | ) |
Removes every entry of a class.
在文件 ObjectRegistry.cpp 第 237 行定义.
引用了 found, handle, eve::Result< void >::ignore() , 以及 unregister().
◆ clearAll()
| void eve::ui::ObjectRegistry::clearAll | ( | ) |
Removes every entry.
在文件 ObjectRegistry.cpp 第 247 行定义.
引用了 handle, eve::Result< void >::ignore() , 以及 unregister().
被这些函数引用 eve::ui::UI::releaseSquirrelRoots() , 以及 ~ObjectRegistry().
◆ count()
| size_t eve::ui::ObjectRegistry::count | ( | const std::string & | className | ) | const |
◆ create()
| eve::Result< ObjectHandle > eve::ui::ObjectRegistry::create | ( | const std::string & | className | ) |
Creates a class instance through the active Runtime and registers it.
- 参数
-
className Reflected script class name.
- 返回
- A live ObjectHandle, or a structured failure when the class is unknown, the Runtime is unavailable, or construction fails.
在文件 ObjectRegistry.cpp 第 75 行定义.
引用了 error, eve::Diagnostic::error(), eve::Failed, eve::Result< T >::failure(), eve::InvalidArgument, registerObject() , 以及 eve::ModuleManager::runtime().
◆ entries()
| std::vector< ObjectEntry > eve::ui::ObjectRegistry::entries | ( | const std::string & | className | ) | const |
◆ entry()
|
noexcept |
Looks up a live entry without transferring ownership.
- 参数
-
handle Candidate generation-qualified handle.
- 返回
- Borrowed nullable entry for a live handle. @ownership ObjectRegistry owns the rooted entry; callers must not delete or mutate the result. @lifetime Valid only until unregister(), clear(), or another registry mutation. @thread Call on the UI thread owning this registry. @reentrancy The lookup invokes no callbacks and is invalid across registry mutation.
在文件 ObjectRegistry.cpp 第 277 行定义.
被这些函数引用 entries().
◆ instance()
|
static |
Returns the process-local singleton owned by the UI module.
在文件 ObjectRegistry.cpp 第 45 行定义.
被这些函数引用 eve::ui::DatabasePanel::createInstance(), eve::ui::DatabasePanel::registerObject(), eve::ui::UI::releaseSquirrelRoots() , 以及 eve::ui::DatabasePanel::unregister().
◆ isStale()
|
noexcept |
Reports whether a valid handle is stale in this registry.
- 参数
-
handle Candidate handle; invalid() is not classified as stale.
在文件 ObjectRegistry.cpp 第 283 行定义.
◆ operator=()
|
delete |
◆ registerObject()
| eve::Result< ObjectHandle > eve::ui::ObjectRegistry::registerObject | ( | const std::string & | className, |
| const ssq::Object & | object, | ||
| const std::string & | label = {} |
||
| ) |
Registers an existing live script instance.
- 参数
-
className Class name used for grouping (auto-derived when empty). object Live script instance (rooted while registered). label Optional display label (defaults to "Class #n").
- 返回
- A live ObjectHandle, or a structured failure for an invalid object, unavailable Runtime, or allocation failure.
在文件 ObjectRegistry.cpp 第 98 行定义.
引用了 eve::script::borrowSquirrelObject(), eve::ui::ObjectEntry::className, count, error, eve::Diagnostic::error(), eve::Failed, eve::Result< T >::failure(), group, handle, eve::ui::ObjectEntry::handle, eve::InvalidArgument, eve::RuntimeHandle< UiObjectHandleTag >::invalidIndex, eve::InvariantViolation, label, eve::ui::ObjectEntry::label, eve::ui::ObjectEntry::object, eve::script::ownSquirrelObject(), eve::ModuleManager::runtime(), eve::Result< T >::success() , 以及 target.
被这些函数引用 create() , 以及 eve::ui::DatabasePanel::registerObject().
◆ unregister()
| eve::Result< void > eve::ui::ObjectRegistry::unregister | ( | ObjectHandle | handle | ) |
Removes a live entry and advances its slot generation.
- 参数
-
handle Handle returned by create() or registerObject().
- 返回
- Applied on success; StaleHandle, NotFound, or InvalidArgument when the handle cannot identify the live entry.
在文件 ObjectRegistry.cpp 第 183 行定义.
引用了 eve::Applied, error, eve::Diagnostic::error(), eve::Failed, eve::Result< T >::failure(), handle, eve::InvalidArgument, eve::InvariantViolation, eve::RuntimeHandle< UiObjectHandleTag >::nextGeneration(), eve::NotFound, eve::StaleHandle, eve::Status::success(), eve::Result< T >::success() , 以及 target.
被这些函数引用 clear(), clearAll() , 以及 eve::ui::DatabasePanel::unregister().
该类的文档由以下文件生成:
- src/modules/ui/ObjectRegistry.h
- src/modules/ui/ObjectRegistry.cpp