VR-Link API Documentation for DIS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
The TestPublisher class

We derive TestPublisher from DtObjectPublisher in testPub.h and testPub.cxx.

As you can see, this class just configures its base class properly in its constructor, and provides type safety in accessing its state repository.


/*********************************************************************
** Copyright (c) 1992-2010 VT MAK
** All rights reserved.
*********************************************************************/
#pragma once
#if DtHLA
#include "testSR.h"
class TestPublisher : public DtObjectPublisher
{
public:
TestPublisher(DtExerciseConn* conn, const char* objName = NULL);
virtual ~TestPublisher();
virtual TestStateRepository* testStateRep();
virtual TestStateRepository* tsr();
};
#endif

/*********************************************************************
** Copyright (c) 1992-2010 VT MAK
** All rights reserved.
*********************************************************************/
#if DtHLA
#include "testPub.h"
#include "testEnc.h"
#include "testDec.h"
#include <vl/fom.h>
TestPublisher::TestPublisher(
DtExerciseConn* conn, const char* objName) :
conn, new TestStateRepository(), new TestStateRepository())
{
// setHlaObject is defined in the base DtObjectPublisher. Pass the FOM
// class name, and an encoder and decoder. These objects will be deleted
// by the base class on destruction.
const char* className = "Test";
DtObjClassDesc* desc = conn->fom()->objClassByName(className);
setHlaObject(className, new TestEncoder(conn, desc),
new TestDecoder(conn, desc), objName);
}
TestPublisher::~TestPublisher()
{
}
TestStateRepository* TestPublisher::testStateRep()
{
return (TestStateRepository*) stateRep();
}
TestStateRepository* TestPublisher::tsr()
{
return (TestStateRepository*) stateRep();
}
#endif

Document ID: Generated on Mon Feb 6 18:36:34 EST 2017 from SVN revision 173107
Copyright © 2005-2016 VT MÄK. All Rights Reserved (www.mak.com)