Example #1
0
void
av::NetNodeServer::cast(av::Msg& av_msg)
{
  zmq::message_t zmq_message(av_msg.getSize());
  memcpy(zmq_message.data(), av_msg.getBuffer(), av_msg.getSize());
  mSocket.send(zmq_message);
}
Example #2
0
void osg::av_popMsg(av::Msg& netMsg, ::osg::Vec2f& buf)
{
    ::osg::Vec2f b;
    XDR xdr;

    xdrmem_create(&xdr, (caddr_t)&b, sizeof(b), XDR_DECODE);
    netMsg.pop((void*)&b, sizeof(b));
    xdr_vector(&xdr, (char*)&buf, 2, sizeof(float), (xdrproc_t)xdr_float);
    xdr_destroy(&xdr);
}
Example #3
0
void osg::av_popMsg(av::Msg& netMsg, ::osg::Matrixd& buf)
{
    ::osg::Matrixd b;
    XDR xdr;

    xdrmem_create(&xdr, (caddr_t)&b, sizeof(b), XDR_DECODE);
    netMsg.pop((void*)&b, sizeof(b));
    xdr_vector(&xdr, (char*)&buf, 16, sizeof(double), (xdrproc_t)xdr_double);
    xdr_destroy(&xdr);
}
Example #4
0
void osg::av_pushMsg(av::Msg& netMsg, const ::osg::Matrixf& buf)
{
    ::osg::Matrixf b;
    XDR xdr;

    xdrmem_create(&xdr, reinterpret_cast<caddr_t>(&b), sizeof(b), XDR_ENCODE);
    xdr_vector(&xdr, (char*)&buf, 16, sizeof(float), (xdrproc_t)xdr_float);
    netMsg.push(&b, sizeof(b));
    xdr_destroy(&xdr);
}
Example #5
0
void osg::av_pushMsg(av::Msg& netMsg, const ::osg::Vec4d& buf)
{
    ::osg::Vec4d b;
    XDR xdr;

    xdrmem_create(&xdr, (caddr_t)&b, sizeof(b), XDR_ENCODE);
    xdr_vector(&xdr, (char*)&buf, 4, sizeof(double), (xdrproc_t)xdr_double);
    netMsg.push((void*)&b, sizeof(b));
    xdr_destroy(&xdr);
}
Example #6
0
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);
}