/***************************************************************************
                Process Test Class
                -----------------------------------------
    begin      : 2013/06/21
	copyright  : (C) 2005 Solbox Inc.
    author     : Dev 1 Team
    email      : dev1@solbox.com
    version    : 3.2.0

    CopyRight(C) 2005 Solbox Inc. All Rights reserved.
    Redistribution and use in source and binary forms, with or with out
    modification, are not permitted in outside of Solbox Inc.
*****************************************************************************/

#ifndef __MESSAGE_QUEUE_CONTROL_H__
#define __MESSAGE_QUEUE_CONTROL_H__

#include <vector>
#include <list>
#include "Process.h"
#include "FimngdData.h"
#include "IPCMsgQueue.h"
#include "MsgQueuePopThread.h"
#include "HotContentDetectThread.h"
#include "CacheGeneratorThread.h"
#include "HotContentInfoMap.h"

class CMessageQueueJob
{
public:
	CMessageQueueJob();
	~CMessageQueueJob();


	bool ThreadInit(const sig_atomic_t *sighandle, CIPCMsgQueue& msgqueu, CCacheRequestList *pCacheReqList, CHotContentInfoMap	* photContentinfoMap);

	bool Start();
private:
	// Message Queue 에서 데이터를 pop하는 쓰레드
	CMsgQueuePopThread m_objQueuePopThread;

	// hot content를 찾는 역할을 하는 쓰레드
	CHotContentDetectThread m_objHotContentDetectThread;
};

class  CWorkerMessageQueueControl : public CProcess
{
public:
	CWorkerMessageQueueControl();
	virtual ~CWorkerMessageQueueControl();

	pid_t Launcher(const sig_atomic_t *sighandle);

private:
	void	do_work(const sig_atomic_t *sighandle);

	std::vector<CIPCMsgQueue> m_vecContentQueue;
	
	std::vector<CMessageQueueJob> m_vecJobTread;
	
	// rc_rmcd로 internal cache 생성을 요청하는 쓰레드
	CCacheGeneratorThread m_objCacheGeneratorThread;

	CHotContentInfoMap	 m_hotContentinfoMap;
};
 
#endif // __MESSAGE_QUEUE_CONTROL_H__

