MAK RTIspy API Documentation for HLA Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
rtisimple Example Code for HLA 1.3

rtiSimple13.cxx and rtiSimpleFedAmb13.cxx (rtiSimpleFedAmb13.h) have the RTI calls and federate ambassador calls for the HLA 1.3 version of rtisimple.

This page has the code for the following files:


rtiSimple13.cxx

/*******************************************************************************
** Copyright (c) 2004 MaK Technologies, Inc.
** All rights reserved.
*******************************************************************************/
// A simple federate that updates an object with attributes whose values
// are the name of the attribute. Objects from other simple federates
// are discovered and reflected. The string values are byte encoded to allow
// compatibility between 1.3 and 1516
#pragma warning(disable: 4786)
#pragma warning(disable: 4290)
#ifdef WIN32
#include <winsock2.h>
#include <process.h>
#else
#include <unistd.h>
#endif
#include <stdio.h>
#include <cstdlib>
#include <cstring>
#include <map>
#include <string>
#include <iostream>
#include <sstream>
#include "RTI.hh"
using namespace std;
// Map between strings and attribute handles
typedef std::map<std::string, RTI::AttributeHandle> DtAttrNameHandleMap;
// Map between strings and parameter handles
typedef std::map<std::string, RTI::ParameterHandle> DtParamNameHandleMap;
// Handles keyboard input without blocking
keyboard theInput;
// Data shared between federate and federate ambassador
DtSimpleData theAmbData;
// The federate handle
RTI::FederateHandle theFederateHandle;
// The object class name
std::string theClassName = "BaseEntity";
// The interaction class name
std::string theInterClassName = "WeaponFire";
// The object class handle (to be retrieved from RTI).
RTI::ObjectClassHandle theClassHandle;
// The interaction class handle (to be retrieved from RTI).
RTI::InteractionClassHandle theInterClassHandle;
// The object instance handle (to be retrieved from the RTI).
RTI::ObjectHandle theObjectHandle;
// Map between strings and attribute handles
DtAttrNameHandleMap theAttrNameHandleMap;
// Map between strings and parameter handles
DtParamNameHandleMap theParamNameHandleMap;
// Create the federation execution
void createFedEx(RTI::RTIambassador & rtiAmb, std::string const& fedName, std::string const& fedFile)
{
cout << "createFederationExecution " << fedName.c_str() << " " << fedFile.c_str() << endl;
try
{
rtiAmb.createFederationExecution(fedName.c_str(), fedFile.c_str());
}
catch(RTI::FederationExecutionAlreadyExists& ex)
{
cout << "FederationExecutionAlreadyExists: " << ex._name << " " << ex._reason << endl
<< "\tCould not create Federation Execution!" << endl;
}
catch(RTI::Exception& ex)
{
cout << "RTI Exception: " << ex._name << " " << ex._reason << endl
<< "\tCould not create federation execution!" << endl;
exit(0);
}
rtiAmb.tick(0.1, 0.2);
cout << "Federation Created" << endl;
}
// Join the federation execution
void joinFedEx(RTI::RTIambassador & rtiAmb, MyFederateAmbassador* fedAmb, std::string const& federateType,
std::string const& federationName)
{
bool joined=false;
const int maxTry = 10;
int numTries = 0;
cout << "joinFederationExecution " << federateType.c_str() << " " << federationName.c_str() << endl;
while (!joined && numTries++ < maxTry)
{
try
{
theFederateHandle = rtiAmb.joinFederationExecution(federateType.c_str(), federationName.c_str(), fedAmb);
joined = true;
}
catch(RTI::FederationExecutionDoesNotExist)
{
cout << "FederationExecutionDoesNotExist, try " << numTries << "out of " << maxTry << endl;
continue;
}
catch(RTI::Exception& ex)
{
cout << "RTI Exception: " << ex._name << " " << ex._reason << endl
<< "\tCould not join federation execution!" << endl;
exit(0);
}
rtiAmb.tick(0.1, 0.2);
}
if (joined)
cout << "Joined Federation." << endl;
else
{
cout << "Giving up." << endl;
rtiAmb.destroyFederationExecution(federationName.c_str());
exit(0);
}
}
// Resign and destroy the federation execution
void resignAndDestroy( RTI::RTIambassador & rtiAmb, std::string const& federationName)
{
cout << "Resign and Destroy Federation" << endl;
rtiAmb.resignFederationExecution(RTI::DELETE_OBJECTS);
rtiAmb.destroyFederationExecution(federationName.c_str());
}
// Publish and subscribe the object class attributes.
// Register an object instance of the class.
bool publishSubscribeAndRegisterObject(RTI::RTIambassador & rtiAmb)
{
// Get the object class handle
try
{
theClassHandle = rtiAmb.getObjectClassHandle(theClassName.c_str());
theAmbData.objectClassMap[theClassHandle] = theClassName;
}
catch (RTI::Exception& ex)
{
cout << "RTI Exception: " << ex._name << " " << ex._reason << endl
<< "Could not get object class handle: " << theClassName.c_str() << endl;
return false;
}
// Get the attribute handles and construct the name-handle map
std::string attrName;
try
{
attrName = "AccelerationVector";
theAttrNameHandleMap[attrName] = rtiAmb.getAttributeHandle(attrName.c_str(), theClassHandle);
attrName = "VelocityVector";
theAttrNameHandleMap[attrName] = rtiAmb.getAttributeHandle(attrName.c_str(), theClassHandle);
attrName = "Orientation";
theAttrNameHandleMap[attrName] = rtiAmb.getAttributeHandle(attrName.c_str(), theClassHandle);
attrName = "DeadReckoningAlgorithm";
theAttrNameHandleMap[attrName] = rtiAmb.getAttributeHandle(attrName.c_str(), theClassHandle);
attrName = "WorldLocation";
theAttrNameHandleMap[attrName] = rtiAmb.getAttributeHandle(attrName.c_str(), theClassHandle);
}
catch (RTI::Exception& ex)
{
cout << "RTI Exception: " << ex._name << " " << ex._reason << endl
<< "Could not get attribute handle " << attrName.c_str() << endl;
return false;
}
// Construct an attribute handle set
RTI::AttributeHandleSet* hSet = RTI::AttributeHandleSetFactory::create(theAttrNameHandleMap.size());
for (DtAttrNameHandleMap::iterator iter = theAttrNameHandleMap.begin(); iter != theAttrNameHandleMap.end(); iter++)
{
hSet->add(iter->second);
}
// Publish and subscribe
int cnt = 0;
try
{
rtiAmb.publishObjectClass(theClassHandle, *hSet);
rtiAmb.tick(0.1, 0.2);
cnt = 1;
rtiAmb.subscribeObjectClassAttributes(theClassHandle, *hSet);
rtiAmb.tick(0.1, 0.2);
}
catch (RTI::Exception& ex)
{
cout << "RTI Exception: " << ex._name << " " << ex._reason << endl
<< "Could not " << (cnt ? "publish" : "subscribe") << endl;
delete hSet;
return false;
}
std::string objectName("Talk");
// Register the object instance
try
{
unsigned int objId = abs(getpid());
std::stringstream pid;
pid << objId;
objectName += pid.str();
theObjectHandle = rtiAmb.registerObjectInstance(theClassHandle, objectName.c_str());
// Add name-handle to map
theAmbData.objectInstanceMap[theObjectHandle] = rtiAmb.getObjectInstanceName(theObjectHandle);
rtiAmb.tick(0.1, 0.2);
}
catch (RTI::Exception& ex)
{
cout << "RTI Exception: " << ex._name << " " << ex._reason << endl
<< "Could not Register Object " << objectName.c_str() << " with class " << theClassName.c_str() << endl;
delete hSet;
return false;
}
cout << "Registered object " << objectName.c_str() << " with class name " << theClassName.c_str() << endl;
delete hSet;
return true;
}
// Publish and Subscribe to an interaction class
bool publishAndSubscribeInteraction(RTI::RTIambassador & rtiAmb)
{
// Get the interaction class handle
try
{
theInterClassHandle = rtiAmb.getInteractionClassHandle(theInterClassName.c_str());
theAmbData.interactionClassMap[theInterClassHandle] = theInterClassName;
}
catch (RTI::Exception& ex)
{
cout << "RTI Exception: " << ex._name << " " << ex._reason << endl
<< "Could not get interaction class handle: " << theInterClassName.c_str() << endl;
return false;
}
// Get the parameter handles and construct the name-handle map
std::string paramName;
try
{
paramName = "EventIdentifier";
theParamNameHandleMap[paramName] = rtiAmb.getParameterHandle(paramName.c_str(), theInterClassHandle);
paramName = "FireControlSolutionRange";
theParamNameHandleMap[paramName] = rtiAmb.getParameterHandle(paramName.c_str(), theInterClassHandle);
paramName = "FireMissionIndex";
theParamNameHandleMap[paramName] = rtiAmb.getParameterHandle(paramName.c_str(), theInterClassHandle);
paramName = "FiringLocation";
theParamNameHandleMap[paramName] = rtiAmb.getParameterHandle(paramName.c_str(), theInterClassHandle);
paramName = "FiringObjectIdentifier";
theParamNameHandleMap[paramName] = rtiAmb.getParameterHandle(paramName.c_str(), theInterClassHandle);
paramName = "FuseType";
theParamNameHandleMap[paramName] = rtiAmb.getParameterHandle(paramName.c_str(), theInterClassHandle);
paramName = "InitialVelocityVector";
theParamNameHandleMap[paramName] = rtiAmb.getParameterHandle(paramName.c_str(), theInterClassHandle);
paramName = "MunitionObjectIdentifier";
theParamNameHandleMap[paramName] = rtiAmb.getParameterHandle(paramName.c_str(), theInterClassHandle);
paramName = "MunitionType";
theParamNameHandleMap[paramName] = rtiAmb.getParameterHandle(paramName.c_str(), theInterClassHandle);
paramName = "QuantityFired";
theParamNameHandleMap[paramName] = rtiAmb.getParameterHandle(paramName.c_str(), theInterClassHandle);
paramName = "RateOfFire";
theParamNameHandleMap[paramName] = rtiAmb.getParameterHandle(paramName.c_str(), theInterClassHandle);
paramName = "TargetObjectIdentifier";
theParamNameHandleMap[paramName] = rtiAmb.getParameterHandle(paramName.c_str(), theInterClassHandle);
paramName = "WarheadType";
theParamNameHandleMap[paramName] = rtiAmb.getParameterHandle(paramName.c_str(), theInterClassHandle);
}
catch (RTI::Exception& ex)
{
cout << "RTI Exception: " << ex._name << " " << ex._reason << endl
<< "Could not get parameter handle " << paramName.c_str() << endl;
return false;
}
// Publish and subscribe
int cnt = 0;
try
{
rtiAmb.publishInteractionClass(theInterClassHandle);
rtiAmb.tick(0.1, 0.2);
cnt = 1;
rtiAmb.subscribeInteractionClass(theInterClassHandle);
rtiAmb.tick(0.1, 0.2);
}
catch (RTI::Exception& ex)
{
cout << "RTI Exception: " << ex._name << " " << ex._reason << endl
<< "Could not " << (cnt ? "publish" : "subscribe") << " to interaction." << endl;
return false;
}
cout << "Subscribed to interaction class: " << theInterClassName.c_str() << " with handle: " << theInterClassHandle << endl;
return true;
}
int main(int argc, char** argv)
{
std::cout << "MAK rtiSimple version 1.3" << std::endl;
try
{
// Federate and Federation info
std::string federationName("MAKsimple");
std::string federationFile("MAKsimple.fed");
std::string federateType("rtisimple13");
if (argc > 1)
{
if (strcmp(argv[1], "-h") == 0)
{
cout << "Usage: rtisimple13 [federationName] [federationFile] [federateType]" << endl;
cout << "default values: "
<< "\"" << federationName.c_str() << "\" "
<< "\"" << federationFile.c_str() << "\" "
<< "\"" << federateType.c_str() << "\" " << endl;
return 0;
}
federationName = argv[1];
}
if (argc > 2)
{
federationFile = argv[2];
}
if (argc > 3)
{
federateType = argv[3];
}
#ifdef WIN32
WSADATA data;
WSAStartup(MAKEWORD(1, 1), &data);
#endif
// RTI and Federate Ambassadors
RTI::RTIambassador rtiAmb;
MyFederateAmbassador fedAmb(theAmbData);
RTI::AttributeHandleValuePairSet *attrValues = 0;
RTI::ParameterHandleValuePairSet *paramValues = 0;
rtiAmb.tick();
long count = 0;
bool doConnect = true;
bool connected = false;
while (1)
{
if (doConnect)
{
doConnect = false;
// Create the federation
createFedEx(rtiAmb, federationName, federationFile);
// Join the federation
joinFedEx(rtiAmb, &fedAmb, federateType, federationName);
// Publish, subscribe and register and object
if (!publishSubscribeAndRegisterObject(rtiAmb))
{
resignAndDestroy(rtiAmb, federationName);
return 0;
}
// Publish and subscribe to the required interaction
if (!publishAndSubscribeInteraction(rtiAmb))
{
resignAndDestroy(rtiAmb, federationName);
return 0;
}
// Construct an attribute handle value pair set with the values containing the attribute names
attrValues = RTI::AttributeSetFactory::create(theAttrNameHandleMap.size());
DtAttrNameHandleMap::iterator attrIter = theAttrNameHandleMap.begin();
DtAttrNameHandleMap::iterator attrEnd = theAttrNameHandleMap.end();
for ( ; attrIter != attrEnd; attrIter++)
{
// Attribute values will be just the name of the attribute.
attrValues->add(attrIter->second, attrIter->first.c_str(), attrIter->first.length()+1);
}
// Construct a parameter handle value pair set with the values containing the parameter names
paramValues = RTI::ParameterSetFactory::create(theParamNameHandleMap.size());
DtParamNameHandleMap::iterator paramIter = theParamNameHandleMap.begin();
DtParamNameHandleMap::iterator paramEnd = theParamNameHandleMap.end();
for ( ; paramIter != paramEnd; paramIter++)
{
// Parameter values will be just the name of the attribute.
paramValues->add(paramIter->second, paramIter->first.c_str(), paramIter->first.length()+1);
}
connected = true;
}
else if (connected)
{
std::stringstream ss;
ss << "1.3-" << count++;
std::string tag(ss.str());
// Update the object
rtiAmb.updateAttributeValues(theObjectHandle, *attrValues, tag.c_str());
// Send an interaction every few passes
if ( count % 5 == 0 )
{
cout << "Sending interaction..." << endl;
rtiAmb.sendInteraction(theInterClassHandle, *paramValues, tag.c_str());
}
rtiAmb.tick(0.1, 0.5);
}
int key = theInput.keybrdTick();
if (key < 0)
{
break;
}
else if ('c' == key || 'C' == key )
{
doConnect = !connected;
}
else if ('d' == key || 'D' == key )
{
if (connected)
{
try
{
resignAndDestroy(rtiAmb, federationName);
if (attrValues)
{
delete attrValues;
attrValues = 0;
}
if (paramValues)
{
delete paramValues;
paramValues = 0;
}
connected = false;
}
catch(RTI::Exception& ex)
{
cout << "RTI Exception: "
<< ex._name << " " << ex._reason << endl;
}
}
}
#ifdef WIN32
Sleep(2000);
#else
sleep(2);
#endif
}
// Resign and destroy federation
resignAndDestroy(rtiAmb, federationName);
}
catch (RTI::Exception& ex)
{
cout << "RTI Exception (main loop): "
<< ex._name << " "
<< ex._reason << endl;
}
#ifdef WIN32
WSACleanup();
#endif
return 0;
}

rtiSimpleFedAmb13.cxx

/*******************************************************************************
** Copyright (c) 2004 MaK Technologies, Inc.
** All rights reserved.
*******************************************************************************/
#pragma warning(disable: 4786)
#pragma warning(disable: 4290)
#include <stdio.h>
#include <iostream>
using namespace std;
void printAttrValues(const RTI::AttributeHandleValuePairSet& attributes)
{
for (unsigned int iloop = 0; iloop < attributes.size(); iloop++)
{
RTI::ULong length = attributes.getValueLength(iloop);
cout << "\t" << attributes.getHandle(iloop) << " " << attributes.getValuePointer(iloop,length) << endl;
}
}
void printParamValues(const RTI::ParameterHandleValuePairSet& params)
{
for (unsigned int iloop = 0; iloop < params.size(); iloop++)
{
RTI::ULong length = params.getValueLength(iloop);
cout << "\t" << params.getHandle(iloop) << " " << params.getValuePointer(iloop,length) << endl;
}
}
std::string timeToString(RTI::FedTime const& time)
{
char* buff = new char[time.getPrintableLength()+1];
((RTI::FedTime &)time).getPrintableString(buff);
std::string timeStr(buff);
delete [] buff;
return timeStr;
}
: NullFederateAmbassador(), myData(data)
{
}
throw (RTI::FederateInternalError)
{
int x = 1;
}
RTI::ObjectHandle theObject,
RTI::ObjectClassHandle theObjectClass,
const char* theObjectName)
throw (RTI::CouldNotDiscover, RTI::ObjectClassNotKnown, RTI::FederateInternalError)
{
cout << "discoverObjectInstance: "
<< theObjectName << "("
<< theObject << ") of class "
<< myData.objectClassMap[theObjectClass].c_str() << "( "
<< theObjectClass << ")" << endl;\
myData.objectInstanceMap[theObject] = theObjectName;
}
RTI::ObjectHandle theObject, // supplied C1
const RTI::AttributeHandleValuePairSet& theAttributes, // supplied C4
const RTI::FedTime& theTime, // supplied C1
const char *theTag, // supplied C4
RTI::EventRetractionHandle theHandle) // supplied C1
throw (RTI::ObjectNotKnown, RTI::AttributeNotKnown, RTI::FederateOwnsAttributes, RTI::InvalidFederationTime,
RTI::FederateInternalError)
{
cout << "reflectAttributeValues: "
<< myData.objectInstanceMap[theObject].c_str() << "("
<< theObject << ") "
<< timeToString(theTime).c_str() << " "
<< (theTag ? theTag : "") << " "
<< "#attributes: " << theAttributes.size() << endl;
printAttrValues(theAttributes);
}
RTI::ObjectHandle theObject, // supplied C1
const RTI::AttributeHandleValuePairSet& theAttributes, // supplied C4
const char *theTag) // supplied C4
throw (RTI::ObjectNotKnown, RTI::AttributeNotKnown, RTI::FederateOwnsAttributes, RTI::FederateInternalError)
{
cout << "reflectAttributeValues: "
<< myData.objectInstanceMap[theObject].c_str() << "("
<< theObject << ") "
<< (theTag ? theTag : "") << " "
<< "#attributes: " << theAttributes.size() << endl;
printAttrValues(theAttributes);
}
// 4.6
RTI::InteractionClassHandle theInteraction, // supplied C1
const RTI::ParameterHandleValuePairSet& theParameters, // supplied C4
const RTI::FedTime& theTime, // supplied C4
const char *theTag, // supplied C4
RTI::EventRetractionHandle theHandle) // supplied C1
throw (RTI::InteractionClassNotKnown, RTI::InteractionParameterNotKnown, RTI::InvalidFederationTime,
RTI::FederateInternalError)
{
cout << "receiveInteraction: "
<< myData.interactionClassMap[theInteraction].c_str() << "( "
<< theInteraction << ") "
<< timeToString(theTime).c_str() << " "
<< (theTag ? theTag : "") << " "
<< "#parameters: " << theParameters.size() << endl;
printParamValues(theParameters);
}
RTI::InteractionClassHandle theInteraction, // supplied C1
const RTI::ParameterHandleValuePairSet& theParameters, // supplied C4
const char *theTag) // supplied C4
throw (RTI::InteractionClassNotKnown, RTI::InteractionParameterNotKnown, RTI::FederateInternalError)
{
cout << "receiveInteraction: "
<< myData.interactionClassMap[theInteraction].c_str() << "( "
<< theInteraction << ") "
<< (theTag ? theTag : "") << " "
<< "#parameters: " << theParameters.size() << endl;
printParamValues(theParameters);
}
RTI::ObjectHandle theObject, // supplied C1
const RTI::FedTime& theTime, // supplied C4
const char *theTag, // supplied C4
RTI::EventRetractionHandle theHandle) // supplied C1
throw (RTI::ObjectNotKnown, RTI::InvalidFederationTime, RTI::FederateInternalError)
{
cout << "removeObjectInstance: "
<< myData.objectInstanceMap[theObject].c_str() << "("
<< theObject << ") "
<< timeToString(theTime).c_str() << " "
<< (theTag ? theTag : "") << endl;
}
RTI::ObjectHandle theObject, // supplied C1
const char *theTag) // supplied C4
throw (RTI::ObjectNotKnown, RTI::FederateInternalError)
{
cout << "removeObjectInstance: "
<< myData.objectInstanceMap[theObject].c_str() << "("
<< theObject << ") "
<< (theTag ? theTag : "") << endl;
}

rtiSimpleKeyboard.cxx

/*******************************************************************************
* Adapted from "Beginning Linux Programming", from Wrox Press -- www.wrox.com
*******************************************************************************/
#ifdef WIN32
#include <conio.h>
#else
#include <unistd.h>
#endif
{
#ifndef WIN32
tcgetattr(0,&initial_settings);
new_settings = initial_settings;
new_settings.c_lflag &= ~ICANON;
new_settings.c_lflag &= ~ECHO;
new_settings.c_lflag &= ~ISIG;
new_settings.c_cc[VMIN] = 1;
new_settings.c_cc[VTIME] = 0;
tcsetattr(0, TCSANOW, &new_settings);
#endif
}
{
#ifndef WIN32
tcsetattr(0, TCSANOW, &initial_settings);
#endif
}
{
#ifdef WIN32
return _kbhit();
#else
unsigned char ch;
int nread;
if (peek_character != -1) return 1;
new_settings.c_cc[VMIN]=0;
tcsetattr(0, TCSANOW, &new_settings);
nread = read(0,&ch,1);
new_settings.c_cc[VMIN]=1;
tcsetattr(0, TCSANOW, &new_settings);
if (nread == 1)
{
return 1;
}
return 0;
#endif
}
{
char ch;
#ifdef WIN32
ch = _getch();
#else
if (peek_character != -1)
{
}
else
read(0,&ch,1);
#endif
return ch;
}
{
char key = ' ';
if (!kbhit())
return 0;
key = getkey();
while (key != 'q' && key != 'Q' && kbhit())
key = getkey();
return (key == 'q' || key == 'Q') ? -1 : key;
}

rtiSimpleFedAmb13.h

/*******************************************************************************
** Copyright (c) 2010 MaK Technologies, Inc.
** All rights reserved.
*******************************************************************************/
#pragma once
#pragma warning(disable: 4786)
#pragma warning(disable: 4290)
#include "NullFederateAmbassador.hh"
#include <string>
#include <map>
{
public:
std::map<RTI::ObjectClassHandle, std::string> objectClassMap;
std::map<RTI::ObjectHandle, std::string> objectInstanceMap;
std::map<RTI::InteractionClassHandle, std::string> interactionClassMap;
{
clear();
}
void clear()
{
objectClassMap.clear();
}
};
class MyFederateAmbassador : public NullFederateAmbassador
{
public:
throw (RTI::FederateInternalError);
// Object Management Services //
virtual void discoverObjectInstance(
RTI::ObjectHandle theObject, // supplied C1
RTI::ObjectClassHandle theObjectClass, // supplied C1
const char* theObjectName) // supplied C4
throw (RTI::CouldNotDiscover, RTI::ObjectClassNotKnown, RTI::FederateInternalError);
virtual void reflectAttributeValues(
RTI::ObjectHandle theObject, // supplied C1
const RTI::AttributeHandleValuePairSet& theAttributes, // supplied C4
const RTI::FedTime& theTime, // supplied C1
const char *theTag, // supplied C4
RTI::EventRetractionHandle theHandle) // supplied C1
throw (RTI::ObjectNotKnown, RTI::AttributeNotKnown, RTI::FederateOwnsAttributes, RTI::InvalidFederationTime,
RTI::FederateInternalError);
virtual void reflectAttributeValues(
RTI::ObjectHandle theObject, // supplied C1
const RTI::AttributeHandleValuePairSet& theAttributes, // supplied C4
const char *theTag) // supplied C4
throw (RTI::ObjectNotKnown, RTI::AttributeNotKnown, RTI::FederateOwnsAttributes, RTI::FederateInternalError);
// 4.6
virtual void receiveInteraction(
RTI::InteractionClassHandle theInteraction, // supplied C1
const RTI::ParameterHandleValuePairSet& theParameters, // supplied C4
const RTI::FedTime& theTime, // supplied C4
const char *theTag, // supplied C4
RTI::EventRetractionHandle theHandle) // supplied C1
throw (RTI::InteractionClassNotKnown, RTI::InteractionParameterNotKnown, RTI::InvalidFederationTime,
RTI::FederateInternalError);
virtual void receiveInteraction(
RTI::InteractionClassHandle theInteraction, // supplied C1
const RTI::ParameterHandleValuePairSet& theParameters, // supplied C4
const char *theTag) // supplied C4
throw (RTI::InteractionClassNotKnown, RTI::InteractionParameterNotKnown, RTI::FederateInternalError);
virtual void removeObjectInstance(
RTI::ObjectHandle theObject, // supplied C1
const RTI::FedTime& theTime, // supplied C4
const char *theTag, // supplied C4
RTI::EventRetractionHandle theHandle) // supplied C1
throw (RTI::ObjectNotKnown, RTI::InvalidFederationTime, RTI::FederateInternalError);
virtual void removeObjectInstance(
RTI::ObjectHandle theObject, // supplied C1
const char *theTag) // supplied C4
throw (RTI::ObjectNotKnown, RTI::FederateInternalError);
public:
};

rtiSimpleKeyboard.h

/*******************************************************************************
* Adapted from "Beginning Linux Programming", from Wrox Press -- www.wrox.com
*******************************************************************************/
// Utility to allow keyboard input without blocking
#ifndef MYKBHIT_H_
#define MYKBHIT_H_
#ifndef WIN32
#include <termios.h>
#endif
class keyboard
{
public:
// Returns 1 if keyboard input is ready; otherwise, 0
int kbhit();
// Returns character from keyboard if avaialable; otherwise, 0
int keybrdTick();
protected:
// Return character from keyboard input
int getkey();
private:
#ifndef WIN32
struct termios initial_settings, new_settings;
#endif
};
#endif

rtiSimpleStringUtil.h

/*******************************************************************************
** Copyright (c) 2010 MaK Technologies, Inc.
** All rights reserved.
*******************************************************************************/
#ifndef stringUtil_H_
#define stringUtil_H_
#include <string>
#include <sstream>
// Convert narrow C string to wide string
inline std::wstring DtToWString(const char * in_val)
{
std::wstring temp;
while (*in_val != '\0')
temp += *in_val++;
return temp;
}
// Convert narrow string to wide string
inline std::string DtToString(const std::wstring &in_val)
{
std::string temp;
std::wstring::const_iterator b = in_val.begin();
const std::wstring::const_iterator e = in_val.end();
while (b != e)
{
temp += static_cast<char>(*b);
++b;
}
return temp;
}
#endif

Document ID: Generated on Sun Jul 20 16:15:30 EDT 2025 from SVN revision 277985
Copyright © 2005-2025 MAK Technologies Inc. All Rights Reserved (www.mak.com)