VR-Link API Documentation for HLA Evolved
Using the New Classes in an Application

Once all of these classes are set up, they can be used in applications just like VR-Link's normal publishers, reflected object lists, and reflected objects, as in testObj.cxx.

After you build the testObj example, run two copies of it. You should see each print out state data that it receives from the other.


/*********************************************************************
** Copyright (c) 1992-2010 VT MAK
** All rights reserved.
*********************************************************************/
#include "testPub.h"
#include "refTestList.h"
// For DtSleep
int main()
{
DtExerciseConn conn("VrlExtend", "TestObj", (DtFomMapper*) NULL);
DtClock* clock = conn.clock();
// Create a reflected test list
ReflectedTestList rtl(&conn);
// Create a test publisher
TestPublisher pub(&conn);
// Grab a pointer to its state repository
TestStateRepository* tsr = pub.tsr();
// Set some data
tsr->setVector(DtVector(1,2,3));
// Run the main loop for 20 seconds
DtTime beginTime = clock->absRealTime();
while (clock->absRealTime() < beginTime + 20.0)
{
clock->setSimTime(clock->absRealTime());
conn.drainInput();
// Print the state of the first object in the list:
if (rtl.first())
{
rtl.first()->tsr()->printData();
}
// Change the value of "Number" once a second
tsr->setNumber((int) clock->simTime());
// Tick the publisher, causing data to be sent when necessary.
pub.tick();
// Sleep till next iteration
DtSleep(0.2);
}
return 0;
}

Document ID: Generated on Wed Aug 14 15:35:11 EDT 2013 from SVN revision 130445
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)