示例#1
0
/* virtual */ void
av::gua::NetTransform::_setStateFragment(const std::string& fragment, Msg& stateMsg)
{
  // created a new fpFragmentGroup node and register with the correct well-known id.
  // it consists of the endpoint-id of the server and a constant number.

  EIDGrpMap::iterator found = mGroupMap.find(fragment);
  if (found == mGroupMap.end())
  {

    NetID group_id(fragment, NetID::sNetGroupRootNode);
    registerWellKnown(this, group_id);

    mGroupMap.insert(fragment);
  }

  // send an update message for the well-known shared container  node of this fragment
  SharedContainerMap::iterator container_iter = mSharedContainerMap.find(fragment);
  if (container_iter == mSharedContainerMap.end())
  {
    Link<SharedContainerHolder> container_holder = new SharedContainerHolder;
    NetID container_holder_id(fragment, NetID::sNetGroupContainerHolder);
    registerWellKnown(container_holder.getPtr(), container_holder_id);
    mSharedContainerMap[fragment] = container_holder;
    sharedContainersChanged();
  }
  // consume the state message
  consumeMessage(stateMsg);
  // consume the shared container message
  consumeMessage(stateMsg);
}
示例#2
0
文件: NetNode.cpp 项目: 4og/avango
void
av::NetNode::consumePackedMessage(av::Msg& msg)
{
  int msg_count;
  av_popMsg(msg, msg_count);

#ifdef AVANGO_DEBUG
  logger.debug()<< "av::NetNode::consume_packed_message: " << msg_count;
#endif

  for (int i = 0; i < msg_count; ++i) {
    consumeMessage(msg);
  }
}
示例#3
0
文件: NetNode.cpp 项目: 4og/avango
void
av::NetNode::consumeReceivedMessages()
{
#if AVANGO_DEBUG
  logger.debug() << "av::NetNode::consume_received_messages: "
                 << mReceivedMessages.size() << " messages";
#endif

  // now, just consume all the received messages
  boost::mutex::scoped_lock lock(mMessageMutex);

  while (mReceivedMessages.size()) {
    consumeMessage(mReceivedMessages.front());
    mReceivedMessages.pop_front();
  }
}
示例#4
0
文件: NetNode.cpp 项目: 4og/avango
void
av::NetNode::setStateFragment(const std::string& fragment, av::Msg& stateMsg)
{
#ifdef AVANGO_DEBUG
  logger.debug()<< "av::NetNode::set_state_fragment: from "
                    << fragment << " size: "
                    << stateMsg.getSize() << " bytes.";
#endif

  // this is for the Maestro_Merge_Simple test
  if (mObjectMap.slotExists(fragment))
  {
    return;
  }

  // we need to reset our old state fragment before we receive the new state fragment
  if (mObjectMap.slotExists(fragment))
  {
    mObjectMap.emptySlot(fragment);
  } else
  {
    mObjectMap.addSlot(fragment);
  }

  // decode the state message
  Msg sm(stateMsg);
  sm.setNetNode(this);

  // first the creations
  int num_objects, i;

  av_popMsg(sm, num_objects);

#ifdef AVANGO_DEBUG
  logger.debug()<< "av::NetNode::set_state_fragment: create messages: "
                    << num_objects;
#endif

  for (i=0; i<num_objects; ++i)
  {
    consumeMessage(sm);
  }
  // then the updates
  av_popMsg(sm, num_objects);

#ifdef AVANGO_DEBUG
  logger.debug()<< "av::NetNode::set_state_fragment: update messages: "
                    << num_objects;
#endif

  for (i=0; i<num_objects; ++i)
  {
    consumeMessage(sm);
  }

#ifdef AVANGO_DEBUG
  logger.debug()<< "av::NetNode::set_state_fragment: setting state fragment for "
                    << fragment;
#endif

  // finally whatever the client needs
  _setStateFragment(fragment, sm);
}