예제 #1
0
파일: Engine.cpp 프로젝트: hongsan/ukibase
message_ptr Engine::mqueue_pop(uint32_t okey)
{
	boost::mutex::scoped_lock lock(mqueue_mutex);
	mqueue_map::iterator it = mqueue.find(okey);
	if (it != mqueue.end())
	{
		Worker* worker = it->second;
		if (worker->messages.empty())
		{
			worker->okey = 0;
			mqueue.erase(okey);
			return message_ptr();
		}
		message_ptr ret = worker->messages.front();
		it->second->messages.pop_front();
		return ret;
	}
	return message_ptr();
}
예제 #2
0
    protobuf_wrapper_pkg::message_ptr protobuf_wrapper_pkg::create_message(const std::string& typeName)
{
    message_ptr message;
    const Descriptor* descriptor = DescriptorPool::generated_pool()->FindMessageTypeByName(typeName);
    if (descriptor)
    {
        const Message* prototype = MessageFactory::generated_factory()->GetPrototype(descriptor);
        if (prototype)
        {
            message = message_ptr(prototype->New());
        }
    }
    return message;
}
예제 #3
0
WSConnection::message_ptr WSConnection::getMessage ()
{
    ScopedLockType sl (m_receiveQueueMutex);

    if (m_isDead || m_receiveQueue.empty ())
    {
        m_receiveQueueRunning = false;
        return message_ptr ();
    }

    message_ptr m = m_receiveQueue.front ();
    m_receiveQueue.pop_front ();
    return m;
}
예제 #4
0
    message_ptr get_message() {
        if (!ready()) {
            return message_ptr();
        }
        message_ptr ret = m_current_msg->msg_ptr;
        m_current_msg->msg_ptr.reset();

        if (frame::opcode::is_control(ret->get_opcode())) {
            m_control_msg.msg_ptr.reset();
        } else {
            m_data_msg.msg_ptr.reset();
        }

        this->reset_headers();

        return ret;
    }
예제 #5
0
task4_4::message_ptr task4_4::a_message::create_message( std::istream& inp )
{
	return message_ptr( new a_message( inp ) );
}
void ShapeBase::setMessage(const Marker& message)
{
  // copy and save to shared pointer
  MarkerConstPtr message_ptr( new Marker(message) );
  setMessage( message_ptr );
}