libxr  1.0
Want to be the best embedded framework
Loading...
Searching...
No Matches
LibXR::ApplicationManager Class Reference

应用模块管理器 More...

#include <app_framework.hpp>

Collaboration diagram for LibXR::ApplicationManager:
[legend]

Public Member Functions

void Register (Application &app)
 注册一个应用模块
 
void MonitorAll ()
 调用所有模块的 OnMonitor
 
size_t Size ()
 获取模块数量
 

Data Fields

LibXR::LockFreeList app_list_
 模块链表 / Module list
 

Detailed Description

应用模块管理器

Manager for registering and updating application modules

Definition at line 129 of file app_framework.hpp.

Member Function Documentation

◆ MonitorAll()

void LibXR::ApplicationManager::MonitorAll ( )
inline

调用所有模块的 OnMonitor

Call OnMonitor for all registered modules

Definition at line 151 of file app_framework.hpp.

152 {
153 app_list_.Foreach<Application*>(
154 [](Application* app)
155 {
156 app->OnMonitor();
157 return ErrorCode::OK;
158 });
159 }
LibXR::LockFreeList app_list_
模块链表 / Module list
ErrorCode Foreach(Func func)
遍历链表中的每个节点,并应用回调函数。 Iterates over each node in the list and applies a callback function.

◆ Register()

void LibXR::ApplicationManager::Register ( Application & app)
inline

注册一个应用模块

Register an application module

Parameters
app模块实例引用 / Reference to an Application instance

Definition at line 140 of file app_framework.hpp.

141 {
142 auto node = new (std::align_val_t(LIBXR_CACHE_LINE_SIZE))
144 app_list_.Add(*node);
145 }
数据节点模板,继承自 BaseNode,用于存储具体数据类型。 Template data node that inherits from BaseNode to store specific data...
void Add(BaseNode &data)
向链表添加一个节点。 Adds a node to the linked list.

◆ Size()

size_t LibXR::ApplicationManager::Size ( )
inline

获取模块数量

Get number of registered modules

Returns
模块总数 / Total module count

Definition at line 167 of file app_framework.hpp.

167{ return app_list_.Size(); }
uint32_t Size() noexcept
获取链表中的节点数量。 Gets the number of nodes in the linked list.

Field Documentation

◆ app_list_

LibXR::LockFreeList LibXR::ApplicationManager::app_list_

模块链表 / Module list

Definition at line 132 of file app_framework.hpp.


The documentation for this class was generated from the following file: