コード例 #1
0
/** this is called by a user of a CommClient object
to retrieve mail */
bool CMOOSCommClient::Fetch(MOOSMSG_LIST &MsgList)
{

	if(!m_bMailPresent)
		return false;

	MsgList.clear();

	m_InLock.Lock();

	MOOSMSG_LIST::iterator p;

	m_InBox.remove_if(IsNullMsg);


	MsgList.splice(MsgList.begin(),m_InBox,m_InBox.begin(),m_InBox.end());

	//remove all elements
	m_InBox.clear();

	m_bMailPresent = false;

	m_InLock.UnLock();

	return !MsgList.empty();
}
コード例 #2
0
bool CMOOSCommClient::Peek(MOOSMSG_LIST & MsgList, int nIDRequired,bool bClear)
{
	MsgList.clear();

	m_InLock.Lock();

	MOOSMSG_LIST::iterator p,q;

	p=m_InBox.begin();
	while(p!=m_InBox.end())
	{
		if(!p->IsType(MOOS_NULL_MSG))
		{
			//only give client non NULL Msgs
			if(p->m_nID==nIDRequired)
			{
				//this is the correct ID!
				MsgList.push_front(*p);
				q=p++;
				m_InBox.erase(q);
				continue;
			}
		}
		p++;
	}

	//conditionally (ex MIT suggestion 2006) remove all elements
	if(bClear) 
		m_InBox.clear();


	m_InLock.UnLock();

	return !MsgList.empty();
}
コード例 #3
0
ファイル: HelmApp.cpp プロジェクト: alod83/IS-MOOS
bool CHelmApp::OnPostIterate()
{
    TASK_LIST::iterator p;

    MOOSMSG_LIST Notifications;

    MOOSMSG_LIST::iterator q;

    for(p = m_Tasks.begin();p!=m_Tasks.end();p++)
    {
        CMOOSBehaviour* pBehaviour = *p;

        Notifications.clear();

        pBehaviour->GetNotifications(Notifications);

        for(q = Notifications.begin();q!=Notifications.end();q++)
        {
            if(m_Comms.IsConnected())
            {
                m_Comms.Post(*q);
            }
        }
    }

    return true;
}