示例#1
0
void Ambassador::stopRegistrationForObjectClass (
   RTI::ObjectClassHandle   theClass)
throw (
   RTI::ObjectClassNotPublished,
   RTI::FederateInternalError)
{
   //std::cout << "Ambassador::stopRegistrationForObjectClass(): ";
   NetIO* netIO = getNetIO();
   int classIndex = netIO->findObjectClassIndex(theClass);
   if (classIndex != 0 ) {
      //std::cout << classIndex;
      netIO->setObjectClassRegistrationFlag(classIndex,false);
   }
   //std::cout << std::endl;
}
示例#2
0
void Ambassador::startRegistrationForObjectClass (
   RTI::ObjectClassHandle   theClass)
throw (
   RTI::ObjectClassNotPublished,
   RTI::FederateInternalError)
{
   //std::cout << "Ambassador::startRegistrationForObjectClass(): " ;
   NetIO* netIO = getNetIO();
   int classIndex = netIO->findObjectClassIndex(theClass);
   if (classIndex != 0 && netIO->isObjectClassPublished(classIndex)) {
      // It's an object class that we publish, so we can start to
      // register our objects ...
      //std::cout << classIndex;
      netIO->setObjectClassRegistrationFlag(classIndex,true);
   }
   //std::cout << std::endl;
}
示例#3
0
void Ambassador::discoverObjectInstance (
   RTI::ObjectHandle          theObject,
   RTI::ObjectClassHandle     theObjectClass,
   const char *               theObjectName)
throw (
   RTI::CouldNotDiscover,
   RTI::ObjectClassNotKnown,
   RTI::FederateInternalError)
{
   std::cout << "Ambassador::discoverObjectInstance(): " << theObjectName << ", handle = " << theObject << std::endl;
   NetIO* netIO = getNetIO();
   int classIndex = netIO->findObjectClassIndex(theObjectClass);
   if (classIndex != 0 && netIO->isObjectClassSubscribed(classIndex)) {
      // It's an object class that we've subscribed to ...

      // just act as an interface to NetIO, which will handle this.
      getNetIO()->discoverObjectInstance(theObject, theObjectClass, theObjectName);
   }
}