#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;
RTI::FederateHandle theFederateHandle;
std::string theClassName = "BaseEntity";
std::string theInterClassName = "WeaponFire";
RTI::ObjectClassHandle theClassHandle;
RTI::InteractionClassHandle theInterClassHandle;
RTI::ObjectHandle theObjectHandle;
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 << "Could not create Federation Execution: "
<< "FederationExecutionAlreadyExists: "
<< ex._name << " "
<< ex._reason << endl;
}
catch(RTI::Exception& ex)
{
cout << "Could not create Federation Execution: " << endl
<< "RTI Exception: "
<< ex._name << " "
<< ex._reason << endl;
exit(0);
}
rtiAmb.tick(0.1, 0.2);
cout << "Federation Created" << endl;
}
void joinFedEx(
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;
return;
}
rtiAmb.tick(0.1, 0.2);
}
if (joined)
cout << "Joined Federation." << endl;
else
{
cout << "Giving up." << endl;
rtiAmb.destroyFederationExecution(federationName.c_str());
exit(0);
}
}
void resignAndDestroy( RTI::RTIambassador & rtiAmb,
std::string const& federationName)
{
cout << "Resign and Destroy Federation" << endl;
rtiAmb.destroyFederationExecution(federationName.c_str());
}
bool requestFederationSave(RTI::RTIambassador & rtiAmb, std::string const& label)
{
bool saveOk = true;
int count = 0;
theAmbData.myReceivedInitiateFederateSave =
theAmbData.myReceivedFederationSaved =
theAmbData.myReceivedFederationNotSaved = false;
cout << "Request federation save with label " << label.c_str() << endl;
rtiAmb.requestFederationSave(label.c_str());
while (count++ < 100
&& !theAmbData.myReceivedInitiateFederateSave
&& !theAmbData.myReceivedFederationNotSaved)
{
rtiAmb.tick(0.1, 0.2);
}
if ( !theAmbData.myReceivedInitiateFederateSave )
{
saveOk = false;
if ( !theAmbData.myReceivedFederationNotSaved )
{
cout << "Timed out waiting for initiate federate save\n";
}
}
return saveOk;
}
bool waitForFederationSaved(RTI::RTIambassador & rtiAmb)
{
bool saveOk = true;
int count = 0;
while ( count++ < 100
&& !theAmbData.myReceivedFederationNotSaved
&& !theAmbData.myReceivedFederationSaved )
{
rtiAmb.tick(0.1, 0.2);
}
if ( !theAmbData.myReceivedFederationSaved )
{
saveOk = false;
if ( !theAmbData.myReceivedFederationNotSaved )
{
cout << "Timed out waiting for federation saved\n";
}
}
return saveOk;
}
bool saveFederation(RTI::RTIambassador & rtiAmb, std::string const& label, bool performRequest)
{
bool saveOk = true;
int count = 0;
try
{
if ( performRequest )
{
saveOk = requestFederationSave(rtiAmb, label);
}
if ( theAmbData.myReceivedInitiateFederateSave )
{
cout << "Federate save begun\n";
rtiAmb.federateSaveBegun();
cout << "Federate save complete\n";
rtiAmb.federateSaveComplete();
saveOk = waitForFederationSaved(rtiAmb);
}
}
catch (RTI::Exception& ex)
{
cout << "RTI Exception: "
<< ex._name << " "
<< ex._reason << endl;
cout << "Could not save federation " << label.c_str() << endl;
saveOk = false;
}
catch(exception& stdEx)
{
cout << "Standard exception: " << stdEx.what() << endl;
cout << "Could not save federation " << label.c_str() << endl;
saveOk = false;
}
catch(...)
{
cout << "Unknown exception\n";
cout << "Could not save federation " << label.c_str() << endl;
saveOk = false;
}
theAmbData.myReceivedInitiateFederateSave =
theAmbData.myReceivedFederationSaved =
theAmbData.myReceivedFederationNotSaved = false;
return saveOk;
}
bool requestFederationRestore(RTI::RTIambassador & rtiAmb, std::string const& label)
{
int count = 0;
bool restoreOk = true;
cout << "Request federation restore with label " << label.c_str() << endl;
theAmbData.myReceivedRequestFederationRestoreSucceeded =
theAmbData.myReceivedRequestFederationRestoreFailed =
theAmbData.myReceivedFederationRestoreBegun =
theAmbData.myReceivedInitiateFederateRestore =
theAmbData.myReceivedFederationRestored =
theAmbData.myReceivedFederationNotRestored = false;
rtiAmb.requestFederationRestore(label.c_str());
while (count++ < 100
&& !theAmbData.myReceivedRequestFederationRestoreSucceeded
&& !theAmbData.myReceivedRequestFederationRestoreFailed)
{
rtiAmb.tick(0.1, 0.2);
}
if ( !theAmbData.myReceivedRequestFederationRestoreSucceeded )
{
restoreOk = false;
if ( !theAmbData.myReceivedRequestFederationRestoreFailed )
{
cout << "Timed out waiting for request federation restore succeeded.\n";
}
}
return restoreOk;
}
bool waitForRestoreBegun(RTI::RTIambassador & rtiAmb)
{
bool restoreOk = true;
cout << "Wait for restore begun\n";
int count = 0;
while (count++ < 100
&& !theAmbData.myReceivedFederationRestoreBegun
&& !theAmbData.myReceivedFederationNotRestored)
{
rtiAmb.tick(0.1, 0.2);
}
if ( !theAmbData.myReceivedFederationRestoreBegun )
{
restoreOk = false;
if (!theAmbData.myReceivedFederationNotRestored)
{
cout << "Timed out waiting for federation restore begun.\n";
}
}
return restoreOk;
}
bool waitForInitiateRestore(RTI::RTIambassador & rtiAmb)
{
bool restoreOk = true;
cout << "Wait for initiate restore\n";
int count = 0;
while (count++ < 100
&& !theAmbData.myReceivedInitiateFederateRestore
&& !theAmbData.myReceivedFederationNotRestored)
{
rtiAmb.tick(0.1, 0.2);
}
if ( theAmbData.myReceivedFederationNotRestored )
{
restoreOk = false;
}
else if ( !theAmbData.myReceivedInitiateFederateRestore )
{
restoreOk = false;
cout << "Timed out waiting for initiate federate restore.\n";
}
else if ( theAmbData.myRestoreFederateHandle != theFederateHandle )
{
cout << "Restore initiated with handle " << theAmbData.myRestoreFederateHandle
<< " does not match current handle " << theFederateHandle << endl;
cout << "Unable to complete restore\n";
restoreOk = false;
rtiAmb.federateRestoreNotComplete();
count = 0;
while ( count++ < 100
&& !theAmbData.myReceivedFederationNotRestored )
{
rtiAmb.tick(0.1, 0.2);
}
if ( !theAmbData.myReceivedFederationNotRestored )
{
cout << "Timed out waiting for federation not restored.\n";
}
}
return restoreOk;
}
bool waitForFederationRestored(RTI::RTIambassador & rtiAmb)
{
bool restoreOk = true;
cout << "Wait for federation restored\n";
int count = 0;
while ( count++ < 100
&& !theAmbData.myReceivedFederationRestored
&& !theAmbData.myReceivedFederationNotRestored )
{
rtiAmb.tick(0.1, 0.2);
}
if ( !theAmbData.myReceivedFederationRestored )
{
restoreOk = false;
if ( !theAmbData.myReceivedFederationNotRestored )
{
cout << "Timed out waiting for federation restored.\n";
}
}
return restoreOk;
}
bool restoreFederation(RTI::RTIambassador & rtiAmb, std::string const& label, bool performRequest)
{
bool restoreOk = true;
int count = 0;
try
{
if ( performRequest )
{
if ( requestFederationRestore(rtiAmb, label) )
{
restoreOk = waitForRestoreBegun(rtiAmb);
}
}
if ( theAmbData.myReceivedFederationRestoreBegun )
{
if ( restoreOk = waitForInitiateRestore(rtiAmb) )
{
wcout << L"Federate restore complete\n";
rtiAmb.federateRestoreComplete();
restoreOk = waitForFederationRestored(rtiAmb);
}
}
}
catch (RTI::Exception& ex)
{
cout << "RTI Exception: "
<< ex._name << " "
<< ex._reason << endl;
cout << "Could not save federation " << label.c_str() << endl;
restoreOk = false;
}
catch(exception& stdEx)
{
cout << "Standard exception: " << stdEx.what() << endl;
cout << "Could not save federation " << label.c_str() << endl;
restoreOk = false;
}
catch(...)
{
cout << "Unknown exception\n";
cout << "Could not save federation " << label.c_str() << endl;
restoreOk = false;
}
theAmbData.myReceivedRequestFederationRestoreSucceeded =
theAmbData.myReceivedRequestFederationRestoreFailed =
theAmbData.myReceivedFederationRestoreBegun =
theAmbData.myReceivedInitiateFederateRestore =
theAmbData.myReceivedFederationRestored =
theAmbData.myReceivedFederationNotRestored = false;
return restoreOk;
}
bool publishSubscribeAndRegisterObject(RTI::RTIambassador & rtiAmb)
{
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;
}
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;
}
RTI::AttributeHandleSetFactory::create(theAttrNameHandleMap.size());
for (DtAttrNameHandleMap::iterator iter = theAttrNameHandleMap.begin();
iter != theAttrNameHandleMap.end();
iter++)
{
hSet->add(iter->second);
}
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");
try
{
unsigned int objId = abs(getpid());
std::stringstream pid;
pid << objId;
objectName += pid.str();
theObjectHandle = rtiAmb.registerObjectInstance(theClassHandle,
objectName.c_str());
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;
}
bool publishAndSubscribeInteraction(RTI::RTIambassador & rtiAmb)
{
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;
}
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;
}
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
{
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];
}
RTI::RTIambassador rtiAmb;
RTI::AttributeHandleValuePairSet *attrValues = 0;
RTI::ParameterHandleValuePairSet *paramValues = 0;
#ifdef WIN32
WSADATA data;
WSAStartup(MAKEWORD(1,1), &data);
#endif
rtiAmb.tick();
long count=0;
bool doConnect = true;
bool connected = false;
while (1)
{
if (doConnect)
{
doConnect = false;
createFedEx(rtiAmb, federationName, federationFile);
joinFedEx(rtiAmb, &fedAmb, federateType, federationName);
if (!publishSubscribeAndRegisterObject(rtiAmb))
{
resignAndDestroy(rtiAmb, federationName);
return 0;
}
if (!publishAndSubscribeInteraction(rtiAmb))
{
resignAndDestroy(rtiAmb, federationName);
return 0;
}
attrValues = RTI::AttributeSetFactory::create(theAttrNameHandleMap.size());
for (DtAttrNameHandleMap::iterator iter = theAttrNameHandleMap.begin();
iter != theAttrNameHandleMap.end();
iter++)
{
attrValues->add(iter->second,
iter->first.c_str(), iter->first.length()+1);
}
paramValues = RTI::ParameterSetFactory::create(theParamNameHandleMap.size());
for (DtParamNameHandleMap::iterator iter2 = theParamNameHandleMap.begin();
iter2 != theParamNameHandleMap.end();
iter2++)
{
paramValues->add(iter2->second,
iter2->first.c_str(), iter2->first.length()+1);
}
connected = true;
}
else if (connected)
{
std::stringstream ss;
ss << "1.3-" << count++;
std::string tag(ss.str());
rtiAmb.updateAttributeValues(
theObjectHandle,
*attrValues,
tag.c_str());
if ( count % 5 == 0 )
{
cout << "Sending interaction..." << endl;
rtiAmb.sendInteraction(
theInterClassHandle,
*paramValues,
tag.c_str());
}
rtiAmb.tick(0.1, 0.5);
if ( theAmbData.myReceivedInitiateFederateSave )
{
saveFederation(rtiAmb, theAmbData.mySaveLabel, false);
}
if ( theAmbData.myReceivedFederationRestoreBegun )
{
restoreFederation(rtiAmb, theAmbData.myRestoreLabel, false);
}
}
int key = input.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;
}
}
}
else if ('s' == key || 'S' == key )
{
if (connected)
{
const std::string saveLabel("rtiSimpleSave");
if (!saveFederation(rtiAmb, saveLabel, true))
{
break;
}
}
}
else if ('r' == key || 'R' == key )
{
if (connected)
{
const std::string savedLabel("rtiSimpleSave");
if (!restoreFederation(rtiAmb, savedLabel, true))
{
break;
}
}
}
#ifdef WIN32
Sleep(2000);
#else
sleep(2);
#endif
}
resignAndDestroy(rtiAmb, federationName);
}
catch (RTI::Exception& ex)
{
cout << "RTI Exception (main loop): "
<< ex._name << " "
<< ex._reason << endl;
}
#ifdef WIN32
WSACleanup();
#endif
return 0;
}
#pragma warning(disable: 4786)
#pragma warning(disable: 4290)
#include <stdio.h>
#include <iostream>
using namespace std;
void printAttributes(const RTI::AttributeHandleValuePairSet& attributes)
{
for (unsigned int iloop = 0; iloop < attributes.size(); iloop++)
{
RTI::ULong length = attributes.getValueLength(iloop);
cout << attributes.getHandle(iloop) << " "
<< attributes.getValuePointer(iloop,length) << endl;
}
}
void printParameters(const RTI::ParameterHandleValuePairSet& params)
{
for (unsigned int iloop = 0; iloop < params.size(); iloop++)
{
RTI::ULong length = params.getValueLength(iloop);
cout << 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;
}
throw (
RTI::UnableToPerformSave,
RTI::FederateInternalError)
{
cout << "initiateFederateSave: "
<< label << endl;
myData.myReceivedInitiateFederateSave = true;
myData.mySaveLabel = label;
}
throw (RTI::FederateInternalError)
{
cout << "federationSaved " << endl;
}
throw (RTI::FederateInternalError)
{
cout << "federationNotSaved: ";
}
throw (RTI::FederateInternalError)
{
cout << "requestFederationRestoreSucceeded "
<< label << endl;
myData.myReceivedRequestFederationRestoreSucceeded = true;
myData.myRestoreLabel = label;
}
const char* reason)
throw (RTI::FederateInternalError)
{
cout << "requestFederationRestoreFailed "
<< label << " " << reason << endl;
myData.myReceivedRequestFederationRestoreFailed = true;
myData.myRestoreLabel = label;
myData.myRestoreFailureReason = reason;
}
throw (RTI::FederateInternalError)
{
cout << "federationRestoreBegun" << endl;
}
const char* label,
RTI::FederateHandle handle)
throw (
RTI::SpecifiedSaveLabelDoesNotExist,
RTI::CouldNotRestore,
RTI::FederateInternalError)
{
cout << "initiateFederateRestore "
<< label << " " << handle << endl;
myData.myReceivedInitiateFederateRestore = true;
myData.myRestoreLabel = label;
myData.myRestoreFederateHandle = handle;
}
throw (RTI::FederateInternalError)
{
cout << "federationRestored" << endl;
}
throw (RTI::FederateInternalError)
{
cout << "federationNotRestored" << endl;
}
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,
const RTI::AttributeHandleValuePairSet& theAttributes,
const RTI::FedTime& theTime,
const char *theTag,
RTI::EventRetractionHandle theHandle)
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;
printAttributes(theAttributes);
}
RTI::ObjectHandle theObject,
const RTI::AttributeHandleValuePairSet& theAttributes,
const char *theTag)
throw (
RTI::ObjectNotKnown,
RTI::AttributeNotKnown,
RTI::FederateOwnsAttributes,
RTI::FederateInternalError)
{
cout << "reflectAttributeValues: "
<< myData.objectInstanceMap[theObject].c_str() << "("
<< theObject << ") "
<< (theTag ? theTag : "") << " "
<< "#attributes: " << theAttributes.size() << endl;
printAttributes(theAttributes);
}
RTI::InteractionClassHandle theInteraction,
const RTI::ParameterHandleValuePairSet& theParameters,
const RTI::FedTime& theTime,
const char *theTag,
RTI::EventRetractionHandle theHandle)
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;
printParameters(theParameters);
}
RTI::InteractionClassHandle theInteraction,
const RTI::ParameterHandleValuePairSet& theParameters,
const char *theTag)
throw (
RTI::InteractionClassNotKnown,
RTI::InteractionParameterNotKnown,
RTI::FederateInternalError)
{
cout << "receiveInteraction: "
<< myData.interactionClassMap[theInteraction].c_str() << "( "
<< theInteraction << ") "
<< (theTag ? theTag : "") << " "
<< "#parameters: " << theParameters.size() << endl;
printParameters(theParameters);
}
RTI::ObjectHandle theObject,
const RTI::FedTime& theTime,
const char *theTag,
RTI::EventRetractionHandle theHandle)
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,
const char *theTag)
throw (
RTI::ObjectNotKnown,
RTI::FederateInternalError)
{
cout << "removeObjectInstance: "
<< myData.objectInstanceMap[theObject].c_str() << "("
<< theObject << ") "
<< (theTag ? theTag : "") << endl;
}