GKD.RoboCtrl
载入中...
搜索中...
未找到
roboctrl::utils::singleton_base< T > 模板类 参考

提供单例模式的单例基类 更多...

详细描述

template<typename T>
class roboctrl::utils::singleton_base< T >

提供单例模式的单例基类

模板参数
T需要成为单例模式的类

这是一个用于提供单例模式功能的基类。要编写一个单例类 T,你需要让 T 继承自 singleton_base<T>, 并和多例模式一样添加一个用于初始化的 info_type 类型,并实现一个名为 init() 的成员函数,该函数接受 info_type 类型的参数。 在初始化时,init() 函数会被调用,你应该通过其返回值是 true 还是 false 来表明是否成功初始化。

在文件 singleton.hpp19 行定义.

#include <singleton.hpp>

类 roboctrl::utils::singleton_base< T > 继承关系图:
roboctrl::utils::immovable_base roboctrl::utils::not_copyable_base

Public 成员函数

 singleton_base (const singleton_base &)=delete
 
singleton_baseoperator= (const singleton_base &)=delete
 
- Public 成员函数 继承自 roboctrl::utils::immovable_base
 immovable_base (immovable_base &&)=delete
 
immovable_baseoperator= (immovable_base &&)=delete
 
- Public 成员函数 继承自 roboctrl::utils::not_copyable_base
 not_copyable_base (const not_copyable_base &)=delete
 
not_copyable_baseoperator= (const not_copyable_base &)=delete
 

静态 Public 成员函数

static T & instance ()
 获取单例实例
 

成员函数说明

◆ instance()

template<typename T >
static T & roboctrl::utils::singleton_base< T >::instance ( )
inlinestatic

获取单例实例

返回
T& 单例实例

在文件 singleton.hpp29 行定义.

引用了 roboctrl::utils::singleton_base< T >::instance().

被这些函数引用 roboctrl::utils::singleton_base< T >::instance().


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