The SimpleBroker application is a complete VR-Exchange broker.
It demonstrates how to build a broker class as well as a broker application. The SimpleBroker receives and transmits DIS PDUs as part of the example. It does not do translations in any meaningful way, and is completely non functional as a DIS broker.
#include <matrix/vlVector.h>
#include <vl/exerciseConn.h>
#include <vlpi/entityIdentifier.h>
using namespace MAKVrExchange;
myDisConn(disConn),
myPortalConn(pConn)
{
DtFireInteraction::addCallback(
&myDisConn, receiveDisInteraction, this);
DtPortalFireInteraction::addCallback(
&myPortalConn, receivePortalInteraction, this);
}
{
DtFireInteraction::removeCallback(
DtPortalFireInteraction::removeCallback(
}
{
DtFireInteraction out;
out.setAttackerId(DtEntityIdentifier(1,3,4));
out.setTargetId(DtEntityIdentifier(2,4,2));
out.setMunitionId(DtEntityIdentifier(3,4,2));
out.setWarheadType((DtWarheadType)in.warheadType());
}
{
out.setAttackerId( in.attackerId().string() );
out.setTargetId( in.targetId().string() );
out.setMunitionId( in.munitionId().string() );
out.setWarheadType( (DtWarheadType)in.warheadType() );
}
{
}
{
}
#include <matrix/vlVector.h>
#include <vl/exerciseConn.h>
#include <vl/entityPublisher.h>
#include <vl/reflectedEntityList.h>
#include <vl/baseEntityStateRepository.h>
using namespace MAKVrExchange;
: myDisConn( disConn )
, myPortalConn( pConn )
, myDisReflectedList( 0 )
, myPortalReflectedManager( 0 )
, myDisEntityPublisher( 0 )
, myPortalEntityPublisher( 0 )
{
myDisReflectedList = new DtReflectedEntityList(&disConn);
myDisReflectedList->setDiscoveryCondition(disDiscoveryCriteria, this);
}
{
if (myDisEntityPublisher)
{
DtDELETE( myDisEntityPublisher );
}
if (myPortalEntityPublisher)
{
DtDELETE( myPortalEntityPublisher );
}
DtDELETE( myPortalReflectedManager );
}
{
}
{
if (!myPortalEntityPublisher)
{
myPortalEntityPublisher =
}
}
{
if (!myDisEntityPublisher)
{
myDisEntityPublisher =
new DtEntityPublisher( DtEntityType(1,2,3,4,5,6,7),
&myDisConn,
DtEntityIdentifier(1,2,3));
}
}
{
if ( myPortalEntityPublisher )
{
const DtEntityStateRepository* sr = reflectedObj.esr();
newSr->setLocation( sr->location() );
newSr->setVelocity( sr->velocity() );
newSr->setAcceleration( sr->acceleration() );
newSr->setOrientation( sr->orientation() );
newSr->setRotationalVelocity( sr->rotationalVelocity() );
newSr->setRelativeLocation( sr->relativeLocation() );
newSr->setRelativeVelocity( sr->relativeVelocity() );
newSr->setRelativeAcceleration( sr->relativeAcceleration() );
newSr->setRelativeOrientation( sr->relativeOrientation() );
newSr->setRelativeRotationalVelocity( sr->relativeRotationalVelocity() );
}
}
{
if (myDisEntityPublisher)
{
DtEntityStateRepository *newSr = myDisEntityPublisher->esr();
newSr->setLocation(sr->location());
newSr->setVelocity(sr->velocity());
newSr->setAcceleration(sr->acceleration());
newSr->setOrientation(sr->orientation());
newSr->setRotationalVelocity(sr->rotationalVelocity());
newSr->setRelativeLocation(sr->relativeLocation());
newSr->setRelativeVelocity(sr->relativeVelocity());
newSr->setRelativeAcceleration(sr->relativeAcceleration());
newSr->setRelativeOrientation(sr->relativeOrientation());
newSr->setRelativeRotationalVelocity(sr->relativeRotationalVelocity());
}
}
{
if (myPortalEntityPublisher)
{
DtDELETE( myPortalEntityPublisher );
}
}
{
if (myDisEntityPublisher)
{
DtDELETE( myDisEntityPublisher );
}
}
DtReflectedEntity *reflectedObj, void *userData)
{
}
DtReflectedEntity *reflectedObj, void *userData)
{
}
DtReflectedEntity *reflectedObj, void *userData)
{
et->processDisRemoval(*reflectedObj);
}
{
}
{
}
{
et->processProtalRemoval(reflectedObj);
}
DtReflectedObject* ro, void *object)
{
return true;
}
{
return true;
}