75 lines
2.2 KiB
C++
75 lines
2.2 KiB
C++
/**
|
||
@file ProcMngImpl.h
|
||
@brief 进程管理接口类的实现文件
|
||
@author 曹顶法
|
||
*/
|
||
#pragma once
|
||
#include "sys_proc_mng_api/ProcMngInterface.h"
|
||
#include "ProcMngApiThread.h"
|
||
|
||
namespace iot_sys
|
||
{
|
||
class CProcMngImpl : public CProcMngInterface
|
||
{
|
||
public:
|
||
/**
|
||
@brief 构造函数
|
||
@param const SProcessInfoKey & stProcKey 进程主键标识
|
||
*/
|
||
explicit CProcMngImpl(const SProcessInfoKey &stProcKey);
|
||
virtual ~CProcMngImpl();
|
||
|
||
/**
|
||
@brief 设置进程退出通知回调
|
||
@param const CProcessQuitInterface * pQuitInterface 回调对象
|
||
*/
|
||
virtual int setCallback(CProcessQuitInterface *pQuitInterface);
|
||
/**
|
||
@brief 清除回调
|
||
*/
|
||
virtual void unsetCallback();
|
||
/**
|
||
@brief 更新进程信息
|
||
@param bool bActive 是否可用标识
|
||
@param bool bMaster 是否为主
|
||
@param bool bSlave 是否为备
|
||
@return 成功返回Success,失败返回相应错误码
|
||
@retval
|
||
*/
|
||
virtual int updateProcessInfo(bool bActive, bool bMaster, bool bSlave);
|
||
/**
|
||
@brief 获取进程信息
|
||
@param SProcessInfo & stProcInfo 返回的进程信息
|
||
@return 成功返回Success,失败返回相应错误码
|
||
@retval
|
||
*/
|
||
virtual int getProcessInfo(SProcRunInfo &stProcInfo);
|
||
|
||
/**
|
||
@brief 向进程管理注册进程信息
|
||
@param const SProcessInfoKey & stProcKey 进程标识主键
|
||
@return 成功返回iotSuccess,失败返回iotFailed
|
||
@retval
|
||
*/
|
||
//int registerProcInfo(const SProcessInfoKey &stProcKey);
|
||
|
||
/**
|
||
@brief 初始化
|
||
@return 成功返回iotSuccess,失败返回相应错误码
|
||
*/
|
||
int initialize();
|
||
|
||
protected:
|
||
CProcMngImpl(); //< 防止默认构造
|
||
|
||
private:
|
||
SProcessInfoKey m_stProcKey; //< 进程信息的主键
|
||
CProcMngApiThreadPtr m_ptrProcMngThread; //< 心跳线程
|
||
bool m_bIsInitProcInfo; //< 是否已经完成初始化
|
||
};
|
||
|
||
typedef boost::shared_ptr<CProcMngImpl> CProcMngImplPtr;
|
||
|
||
} //namespace iot_sys
|
||
|