码迷,mamicode.com
首页 > Windows程序 > 详细

yate学习--yateclass.h--class YATE_API NamedCounter : public String

时间:2015-05-05 10:37:37      阅读:196      评论:0      收藏:0      [点我收藏+]

标签:

请声明出处:

NamedCounter,对象命名的计数器:

/**
 * An atomic counter with an associated name
 * 关联名的原子计数器
 * @short Atomic counter with name
 * @short 名字的原子计数器
 */
class YATE_API NamedCounter : public String
{
    YNOCOPY(NamedCounter); // no automatic copies please
public:
    /**
     * Constructor
     * 构造函数
     * @param name Name of the counter
     * @参数name,计数器的名字
     */
    explicit NamedCounter(const String& name);

    /**
     * Check if the counter is enabled
     * 检查计数器是否是启用的
     * @return True if the counter is enabled
     * @返回true,如果计数器是启动的
     */
    inline bool enabled() const
	{ return m_enabled; }

    /**
     * Enable or disable the counter
     * 启用或者禁用这个计数器
     * @param val True to enable counter, false to disable
     * @参数val,true , 启用,false, 禁止
     */
    inline void enable(bool val)
	{ m_enabled = val; }

    /**
     * Increment the counter
     * 增加计数
     * @return Post-increment value of the counter
     * @返回计数器增加之后的值
     */
    int inc();

    /**
     * Decrement the counter
     * 减少计数
     * @return Post-decrement value of the counter
     * @返回计数器减少之后的值
     */
    int dec();

    /**
     * Get the current value of the counter
     * 获得当前计数器的值
     * @return Value of the counter
     * @返回计数器的值
     */
    inline int count() const
	{ return m_count; }

private:
    int m_count;
    bool m_enabled;
    Mutex* m_mutex;
};


yate学习--yateclass.h--class YATE_API NamedCounter : public String

标签:

原文地址:http://blog.csdn.net/u012377333/article/details/45498887

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!