VR-Link API Documentation for HLA Evolved
Simple Test Interaction application

This file contains the Simple Test Interaction application, which sends and receives Simple Test Interactions.


/*********************************************************************
** Copyright (c) 1992-2010 VT MAK
** All rights reserved.
*********************************************************************/


#include "testSimpInter.h"
#include <iostream>

// For DtSleep
#include <vlutil/vlProcessControl.h>

// Callback function to be called when a TestSimpleInteraction is received.
void testCb(TestSimpleInteraction* inter, void*)
{
   std::cout << "Received Test Interaction!\n";
   inter->print();
   std::cout << std::endl;
}

int main()
{
   DtExerciseConn conn("VrlExtend", "TestInter", (DtFomMapper*) NULL);
   DtClock* clock = conn.clock();
   
   // Register the callback on incoming TestInteractions.
   TestSimpleInteraction::addCallback(&conn, testCb, NULL);

   while (1)
   {
      clock->setSimTime(clock->absRealTime());
      conn.drainInput();
      
      // Send a TestSimpleInteraction.
      TestSimpleInteraction inter;
      inter.setNumber(10);
      inter.setVector(DtVector(1.0, 2.0, 3.0));
      conn.sendStamped(inter);

      DtSleep(1.0);
   }

   return 0;
}

Document ID: Generated on Mon May 14 08:06:18 EDT 2012 from SVN revision 114750
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)