yate学习--yateclass.h--class YATE_API RefObject : public GenObject_class test1_api umyobject : public uobject报错_一枪尽骚丶魂的博客-程序员秘密

技术标签: Yate学习  study_yate  

请声明出处:

对象的引用计数的类,基本大部分的类都继承了该类:

/**
 * A reference counted object.
 * 引用计数的对象
 * Whenever using multiple inheritance you should inherit this class virtually.
 * 使用多重继承,一般都会继承这个类
 */
class YATE_API RefObject : public GenObject
{
    YNOCOPY(RefObject); // no automatic copies please
public:
    /**
     * The constructor initializes the reference counter to 1!
     * 构造函数,初始化引用计数器为1.
     * Use deref() to destruct the object when safe
     * 使用deref()去销毁这个对象在安全的时候
     */
    RefObject();

    /**
     * Destructor.
     */
    virtual ~RefObject();

    /**
     * Get a pointer to a derived class given that class name
     * 获取一个指向派生类的指针,因为类名
     * @param name Name of the class we are asking for
     * @参数 name,请求的类名
     * @return Pointer to the requested class or NULL if this object doesn't implement it
     * @返回被请求类的地址,为NULL,如果这个对象没有实例化
     */
    virtual void* getObject(const String& name) const;

    /**
     * Check if the object is still referenced and safe to access.
     * 检查对象是否依旧被引用并且安全的访问
     * Note that you should not trust this result unless the object is locked
     * 注意,不能完全相信这个结果,除非对象被其他方法锁定
     *  by other means.
     * @return True if the object is referenced and safe to access
     * @返回True,如果对象被引用并且安全的访问
     */
    virtual bool alive() const;

    /**
     * Increments the reference counter if not already zero
     * 增加引用计数器,如果不为0
     * @return True if the object was successfully referenced and is safe to access
     * @返回True,如果对象被引用并且安全的访问
     */
    bool ref();

    /**
     * Decrements the reference counter, destroys the object if it reaches zero
     * 减少引用计数器,如果为0则销毁对象
     * <pre>
     * // Deref this object, return quickly if the object was deleted
     * if (deref()) return;
     * </pre>
     * @return True if the object may have been deleted, false if it still exists and is safe to access
     * @返回true,如果对象已经被删除,false,依旧存在并且安全的访问
     */
    bool deref();

    /**
     * Get the current value of the reference counter
     * 获取引用计数器当前的值
     * @return The value of the reference counter
     */
    inline int refcount() const
	{ return m_refcount; }

    /**
     * Refcounted objects should just have the counter decremented.
     * 引用计数对象减少计数器
     * That will destroy them only when the refcount reaches zero.
     * 当引用计数器为0的时候销毁
     */
    virtual void destruct();

    /**
     * Check if reference counter manipulations are efficient on this platform.
     * 检查在这个平台上引用计数器对象是否有效
     * If platform does not support atomic operations a mutex pool is used.
     * 如果该平台不支持原子操作使用互斥对象池
     * @return True if refcount uses atomic integer operations
     * @返回true,如果对象计数使用原子整数操作
     */
    static bool efficientIncDec();

protected:
    /**
     * This method is called when the reference count reaches zero after
     * 当该应用计数为0之后调用这个方法
     *  unlocking the mutex if the call to zeroRefsTest() returned true.
     * 如果调用zeroRefsTest() 返回true,解除这个互斥锁
     * The default behaviour is to delete the object.
     * 默认删除这个对象
     */
    virtual void zeroRefs();

    /**
     * Bring the object back alive by setting the reference counter to one.
     * Note that it works only if the counter was zero previously
     * @return True if the object was resurrected - its name may be Lazarus ;-)
     */
    bool resurrect();

    /**
     * Pre-destruction notification, called just before the object is deleted.
     * Unlike in the destructor it is safe to call virtual methods here.
     * Reimplementing this method allows to perform any object cleanups.
     */
    virtual void destroyed();

private:
    int m_refcount;
    Mutex* m_mutex;
};


版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/u012377333/article/details/45917765

智能推荐

SkyWalking系列(4)-IDEA 部署探针_云烟成雨TD的博客-程序员秘密

环境准备下载skywalking解压,目录介绍:activations:bootstrap-plugins:config:配置文件logs:日志文件optional-plugins:可选插件plugins:安装插件skywalking-agent.jar:集成步骤准备项目(我这里准备了三个微服务项目,调用关系为A=》B=》C)IDEA中每个项目添加JVM启动参数# 修为Demo03App为服务名# 修改192.168.58.161为skywalking所在地址-j

ubuntu下VTK的编译_xuyang2233的博客-程序员秘密

编译VTK首先要安装QT使用cmake-gui编译Build_SHARED_LIBS:编译生成链接动态库选择VTK_GROUP_QT后再编译会出现QT_QMAKE_EXECUTABLE:选择QT安装目录下bin中的qmakeVTK_QT_VERSION=5如果要用python,则下面的VTK_PYTHON_VERSION和VTK_WRAP_PYTHON都要设置。再次Configure会出现很多关于

fragment+RadioGroup实现底部导航栏 多个 fragment 重影问题_学习编程知识的博客-程序员秘密

fragment+RadioGroup实现底部导航栏多个 fragment 重影问题 需要在fragment加上这行代码 @Override public void setMenuVisibility(boolean menuVisible) { super.setMenuVisibility(menuVisible); if (this.get

html5手指滑动图片放大缩小,如何在移动端实现手势缩放(缩放图片,div等)_weixin_39921689的博客-程序员秘密

前几天有一个需求,需要在移动端能通过手势来实现对一个canvas的缩放功能,网上找了挺多方法的,最终实现的效果如下:简单说下思路:获取手势根据手势事件修改dom进行缩放获取手势的方式可以监听touch事件,但是处理的东西还挺多的。看了一个现成的手势缩放库PinchZoom.js,总出现一些奇怪的bug,一顿折腾后无解,果断弃用。网上找到了鹅厂的一些例子http://alloyteam.github...

随便推点

JAVA实现迭代器模式_HappyYiqin的博客-程序员秘密

环境:家里多台电视机会配有多个遥控器,我们希望有一个万能遥控器,它能操作多台电视。问题:访问一个聚合对象的内容而无需暴露它的内部,为遍历不同的聚合结构提供一个统一的接口(同一种算法在多种集合对象上进行操作)。解决方案:迭代器模式——为容器而生角色:    抽象集合    具体集合    抽象迭代器:规定了遍历具体集合的方法,比如next()    具体迭代器java代码Iterator接口Tele...

uni-app 微信小程序如何使用锚点定位 scroll-into-view_uni scroll-into-view_芒果大胖砸的博客-程序员秘密

点击切换实现锚点定位在微信小程序中是没有办法使用a标签来实现锚点跳转这个功能的。但是呢也有很多办法可以解决。按钮的代码就是一个点击然后传参,参数就是需要跳转的id属性,特别注意的是SkipSite 最好动态传参,可以参考我下面的代码&lt;scroll-view scroll-y='true' :scroll-top="scrollTop" :scroll-into-view="SkipSite" class="groupPurchase_main" style="flex: 1;overflow-y

[里程碑]1.0.0版本正式发布——Apache ServiceComb(incubating)_looook的博客-程序员秘密

近日,正在Apache基金会孵化项目—微服务解决方案Apache ServiceComb(incubating) 的1.0.0版本通过社区投票,正式发布。这...

zabbix5使用SNMP 监控打印机耗材用量_gsls200808的博客-程序员秘密

默认zabbix5不带这个模板可以下载https://share.zabbix.com/printers/universal-printer-template需要下载其中的5.0版本在登录后的页面中选择配置--&gt;模板--&gt;导入 ,可以导入模板但是直接导入会报错无法导入模板 "Template Printer Universal SNMPv2",被关联的模板"Template Module Generic SNMPv2"不存在.原因是Zabbix5中没有Templ

CenterOS7安装redis_centeros7 部署redis_精英丶阿琦的博客-程序员秘密

CenterOS7安装redis记录大佬redis安装文章地址https://blog.csdn.net/zhangxtn/article/details/50445519

推荐文章

热门文章

相关标签