OMProtected 是受保护对象的基类。这个类中包含一个互斥对象以及自动嵌入在为该对象定义的具体公共方法中的 lock 和 unlock 方法。
这个类是在文件 omprotected.h 中声明的。
OMDECLARE_GUARDED
将 OMProtected 对象聚集到被守护类中,而不是让这些类继承
OMProtected。其定义如下所示:
#define
OMDECLARE_GUARDED
public:
inline void lock() const {m_omGuard.lock();}
inline void
unlock() const {m_omGuard.unlock();}
inline const OMProtected&
getGuard() const
{return m_omGuard;}
private:
OmProtected m_omGuard;