RTIambassador.cc

Go to the documentation of this file.
00001 // ----------------------------------------------------------------------------
00002 // CERTI - HLA RunTime Infrastructure
00003 // Copyright (C) 2002-2005  ONERA
00004 //
00005 // This file is part of CERTI-libRTI
00006 //
00007 // CERTI-libRTI is free software ; you can redistribute it and/or
00008 // modify it under the terms of the GNU Lesser General Public License
00009 // as published by the Free Software Foundation ; either version 2 of
00010 // the License, or (at your option) any later version.
00011 //
00012 // CERTI-libRTI is distributed in the hope that it will be useful, but
00013 // WITHOUT ANY WARRANTY ; without even the implied warranty of
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00015 // Lesser General Public License for more details.
00016 //
00017 // You should have received a copy of the GNU Lesser General Public
00018 // License along with this program ; if not, write to the Free Software
00019 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00020 // USA
00021 //
00022 // $Id: RTIambassador.cc,v 3.102 2009/04/02 19:58:06 erk Exp $
00023 // ----------------------------------------------------------------------------
00024 
00025 #include "RTI.hh"
00026 #include "fedtime.hh"
00027 
00028 #include "RTIambPrivateRefs.hh"
00029 #include "RTItypesImp.hh"
00030 
00031 #include "FedRegion.hh"
00032 #include "Message.hh"
00033 #include "PrettyDebug.hh"
00034 
00035 #ifdef _WIN32
00036 #include <config.h>
00037 #include <stdio.h>
00038 #include <string.h>
00039 #else 
00040 #include <unistd.h>
00041 #endif
00042 #include <iostream>
00043 #include <signal.h>
00044 #include <cassert>
00045 #include <cerrno>
00046 #include <typeinfo>
00047 
00048 using std::cout ;
00049 using std::cerr ;
00050 using std::endl ;
00051 
00052 namespace {
00053 
00054 static pdCDebug D("LIBRTI", __FILE__);
00055 static PrettyDebug G("GENDOC",__FILE__) ;
00056 
00057 using namespace certi ;
00058 
00059 std::vector<RTI::Handle>
00060 build_region_handles(RTI::Region **regions, int nb)
00061     throw (RTI::RegionNotKnown)
00062 {
00063     std::vector<RTI::Handle> vect(nb);
00064     for (int i = 0 ; i < nb ; ++i) {
00065         RTI::Region *region = regions[i] ;
00066         try {
00067             vect[i] = dynamic_cast<FedRegion *>(region)->getHandle();
00068         }
00069         catch (std::bad_cast) {
00070             throw RTI::RegionNotKnown("");
00071         }
00072     }
00073     return vect ;
00074 }
00075 
00076 RTI::Handle
00077 get_handle(const RTI::Region &region)
00078     throw (RTI::RegionNotKnown, RTI::RTIinternalError)
00079 {
00080     try {
00081     return dynamic_cast<const FedRegion &>(region).getHandle();
00082     }
00083     catch (std::bad_cast) {
00084     throw RTI::RegionNotKnown("");
00085     }
00086     throw RTI::RTIinternalError("");
00087 }
00088 
00089 char *
00090 hla_strdup(const std::string &s)
00091     throw (RTI::RTIinternalError)
00092 {
00093     try {
00094         size_t len = s.length();
00095         // the HLA 1.3 standard defines, that char* must be free-ed by delete[]
00096         char *result = new char[len+1];
00097         strncpy(result, s.c_str(), len);
00098         result[len] = '\0';
00099 
00100         return result;
00101     }
00102     catch (std::bad_alloc) {
00103         throw RTI::RTIinternalError("Cannot allocate memory.");
00104     }
00105     throw RTI::RTIinternalError("");
00106 }
00107 
00108 } // anonymous namespace
00109 
00110 // ----------------------------------------------------------------------------
00112 
00117 RTI::RTIambassador::RTIambassador()
00118     throw (RTI::MemoryExhausted, RTI::RTIinternalError)
00119 {
00120     G.Out(pdGendoc,"enter RTIambassador::RTIambassador");
00121     PrettyDebug::setFederateName( "Federate" );
00122     std::stringstream msg;
00123 
00124     privateRefs = new RTIambPrivateRefs();
00125 
00126     privateRefs->socketUn = new SocketUN(stIgnoreSignal);
00127     
00128     privateRefs->is_reentrant = false ;
00129     const char *rtiaexec = "rtia" ;
00130     const char *rtiaenv = getenv("CERTI_RTIA");
00131     const char *rtiacall ;
00132     if (rtiaenv) rtiacall = rtiaenv ;
00133     else rtiacall = rtiaexec ;
00134     
00135 #ifdef _WIN32
00136   STARTUPINFO si;
00137   PROCESS_INFORMATION pi;
00138 
00139   ZeroMemory( &si, sizeof(si) );
00140   si.cb = sizeof(si);
00141   ZeroMemory( &pi, sizeof(pi) );
00142 
00143   // Start the child process. 
00144   if( !CreateProcess( NULL, // No module name (use command line). 
00145         (char*)rtiacall,    // Command line. 
00146         NULL,                   // Process handle not inheritable. 
00147         NULL,                   // Thread handle not inheritable. 
00148         FALSE,                  // Set handle inheritance to FALSE. 
00149         0,                      // No creation flags. 
00150         NULL,                   // Use parent's environment block. 
00151         NULL,                   // Use parent's starting directory. 
00152         &si,                    // Pointer to STARTUPINFO structure.
00153         &pi ))                  // Pointer to PROCESS_INFORMATION structure.
00154                  
00155         {
00156          msg << "CreateProcess - GetLastError()=<"
00157              << GetLastError() <<"> "
00158              << "Cannot connect to RTIA.exe";       
00159         //perror("CreateProcess");
00160          throw RTI::RTIinternalError( msg.str().c_str());
00161         }
00162     
00163    privateRefs->handle_RTIA = pi.hProcess;
00164    privateRefs->pid_RTIA = pi.dwProcessId;
00165 
00166   sleep(1);
00167   privateRefs->socketUn->connectUN(privateRefs->pid_RTIA);
00168 #else
00169     sigset_t nset, oset;
00170     // temporarily block termination signals
00171     // note: this is to prevent child processes from receiving termination signals
00172     sigemptyset(&nset);
00173     sigaddset(&nset, SIGINT);
00174     sigprocmask(SIG_BLOCK, &nset, &oset);
00175 
00176     switch((privateRefs->pid_RTIA = fork())) {
00177       case -1: // fork failed.
00178         perror("fork");
00179         throw RTI::RTIinternalError("fork failed in RTIambassador constructor");
00180         break ;
00181 
00182       case 0: // child process (RTIA).
00183         execlp(rtiacall, NULL);
00184         msg << "Could not launch RTIA process (execlp): "
00185             << strerror(errno)
00186             << endl
00187             << "Maybe RTIA is not in search PATH environment.";        
00188         throw RTI::RTIinternalError(msg.str().c_str());
00189         
00190       default: // father process (Federe).
00191         // We sleep before trying to connect to the socket
00192         // our child RTIA process should have open
00193         // FIXME EN: this is poorly designed because
00194         //           we don't know if the child ever get a chance
00195         //           to be schedule by the Operating System
00196         sleep(1);
00197 
00198         if( privateRefs->socketUn->connectUN(privateRefs->pid_RTIA) )
00199         {
00200            D.Out( pdError, "Cannot connect to RTIA. Abort." ) ;
00201            kill( privateRefs->pid_RTIA, SIGINT ) ;
00202            throw RTI::RTIinternalError( "Cannot connect to RTIA" );
00203         };
00204         break ;
00205     }
00206 
00207     // unbock the above blocked signals
00208     sigprocmask(SIG_SETMASK, &oset, NULL);
00209 #endif
00210     G.Out(pdGendoc,"exit  RTIambassador::RTIambassador");
00211 }
00212 
00213 // ----------------------------------------------------------------------------
00215 
00217 RTI::RTIambassador::~RTIambassador()
00218     throw (RTI::RTIinternalError)
00219 {
00220     Message req, rep ;
00221 
00222     req.type = Message::CLOSE_CONNEXION;
00223     G.Out(pdGendoc,"        ====>executeService CLOSE_CONNEXION");
00224     privateRefs->executeService(&req, &rep);
00225     // after the response is received, the privateRefs->socketUn must not be used
00226 
00227     delete privateRefs;
00228 }
00229 
00230 // ----------------------------------------------------------------------------
00232 
00235 RTI::Boolean
00236 RTI::RTIambassador::tick()
00237     throw (SpecifiedSaveLabelDoesNotExist,
00238            ConcurrentAccessAttempted,
00239            RTI::RTIinternalError)
00240 {
00241    __tick_kernel(RTI_FALSE, 0.0, 0.0);
00242    return RTI_FALSE;
00243 }
00244 
00245 // ----------------------------------------------------------------------------
00247 
00252 RTI::Boolean
00253 RTI::RTIambassador::tick2()
00254     throw (RTI::SpecifiedSaveLabelDoesNotExist,
00255            RTI::ConcurrentAccessAttempted,
00256            RTI::RTIinternalError)
00257 {
00258    __tick_kernel(RTI_FALSE, std::numeric_limits<double>::infinity(), 0.0);
00259    return RTI_FALSE;
00260 }
00261 
00262 // ----------------------------------------------------------------------------
00264 
00269 RTI::Boolean
00270 RTI::RTIambassador::__tick_kernel(RTI::Boolean multiple, TickTime minimum, TickTime maximum)
00271     throw (RTI::SpecifiedSaveLabelDoesNotExist,
00272            RTI::ConcurrentAccessAttempted,
00273            RTI::RTIinternalError)
00274 {
00275     Message vers_RTI, vers_Fed ;
00276 
00277     // Request callback(s) from the local RTIA
00278     vers_RTI.type = Message::TICK_REQUEST ;
00279     vers_RTI.setBoolean(multiple);
00280     vers_RTI.setMinTickTime(minimum);
00281     vers_RTI.setMaxTickTime(maximum);
00282 
00283     try {
00284         vers_RTI.send(privateRefs->socketUn,privateRefs->msgBufSend);
00285     }
00286     catch (NetworkError &e) {
00287         std::stringstream msg;
00288         msg << "NetworkError in tick() while sending TICK_REQUEST: " << e._reason;
00289 
00290         throw RTI::RTIinternalError(msg.str().c_str());
00291     }
00292 
00293     // Read response(s) from the local RTIA until Message::TICK_REQUEST is received.
00294     while (1) {
00295         try {
00296             vers_Fed.receive(privateRefs->socketUn,privateRefs->msgBufReceive);
00297         }
00298         catch (NetworkError &e) {
00299             std::stringstream msg;
00300             msg << "NetworkError in tick() while receiving response: " << e._reason;
00301 
00302             throw RTI::RTIinternalError(msg.str().c_str());
00303         }
00304 
00305         //D.Mes( pdMessage, 'M', vers_Fed.type);
00306         vers_Fed.trace("RTI::RTIambassador::tick ");
00307 
00308         // If the type is TICK_REQUEST, the __tick_kernel() has terminated.
00309         if (vers_Fed.type == Message::TICK_REQUEST) {
00310             if (vers_Fed.getExceptionType() != e_NO_EXCEPTION) {
00311                 // tick() may only throw exceptions defined in the HLA standard
00312                 // the RTIA is responsible for sending 'allowed' exceptions only
00313                 privateRefs->processException(&vers_Fed);
00314             }
00315             return RTI::Boolean(vers_Fed.getBoolean());
00316         }
00317 
00318         try {
00319             // Otherwise, the RTI calls a FederateAmbassador service.
00320             privateRefs->callFederateAmbassador(&vers_Fed);
00321         }
00322         catch (RTI::RTIinternalError) {
00323             // RTIA awaits TICK_REQUEST_NEXT, terminate the tick() processing
00324             privateRefs->sendTickRequestStop();
00325             // ignore the response and re-throw the original exception
00326             throw;
00327         }
00328 
00329         try {
00330             // Request next callback from the RTIA
00331             Message tick_next;
00332             tick_next.type = Message::TICK_REQUEST_NEXT;
00333 
00334             tick_next.send(privateRefs->socketUn, privateRefs->msgBufSend);
00335         }
00336         catch (NetworkError &e) {
00337             std::stringstream msg;
00338             msg << "NetworkError in tick() while sending TICK_REQUEST_NEXT: " << e._reason;
00339 
00340             throw RTI::RTIinternalError(msg.str().c_str());
00341         }
00342     } // while(1)
00343 }
00344 
00345 // ----------------------------------------------------------------------------
00347 
00352 RTI::Boolean
00353 RTI::RTIambassador::tick(TickTime minimum, TickTime maximum)
00354     throw (RTI::SpecifiedSaveLabelDoesNotExist, RTI::ConcurrentAccessAttempted,
00355            RTI::RTIinternalError)
00356 {
00357     return __tick_kernel(RTI_TRUE, minimum, maximum);
00358 }
00359 
00360 // ----------------------------------------------------------------------------
00362 RTI::RegionToken
00363 RTI::RTIambassador::getRegionToken(Region *region)
00364     throw (RTI::FederateNotExecutionMember, RTI::ConcurrentAccessAttempted,
00365            RTI::RegionNotKnown, RTI::RTIinternalError)
00366 {
00367     return get_handle(*region);
00368 }
00369 
00370 // ----------------------------------------------------------------------------
00372 RTI::Region *
00373 RTI::RTIambassador::getRegion(RegionToken)
00374     throw (RTI::FederateNotExecutionMember, RTI::ConcurrentAccessAttempted,
00375            RTI::RegionNotKnown, RTI::RTIinternalError)
00376 {
00377     throw RTI::RTIinternalError("unimplemented service getRegion");
00378 }
00379 
00380 // ----------------------------------------------------------------------------
00381 // Create Federation Execution.
00389 void
00390 //RTI::
00391 RTI::RTIambassador::createFederationExecution(const char *executionName,
00392                           const char *FED)
00393     throw (RTI::RTIinternalError, RTI::ConcurrentAccessAttempted, 
00394        RTI::ErrorReadingFED, RTI::CouldNotOpenFED, 
00395        RTI::FederationExecutionAlreadyExists)
00396 {
00397 Message req, rep ;
00398 
00399 G.Out(pdGendoc,"enter RTIambassador::createFederationExecution");
00400 
00401 req.type = Message::CREATE_FEDERATION_EXECUTION ;
00402 req.setFederationName(executionName);
00403 req.setFEDid(FED);
00404 
00405 /*#ifdef _WIN32
00406     if(!stricmp(FED,executionName)) {
00407 #else
00408     if(!strcasecmp(FED,exeName)) {
00409 #endif
00410 }*/
00411 G.Out(pdGendoc,"             ====>executeService CREATE_FEDERATION_EXECUTION");
00412 
00413 privateRefs->executeService(&req, &rep);
00414 
00415 G.Out(pdGendoc,"exit RTIambassador::createFederationExecution");
00416 
00417 }
00418 
00419 // ----------------------------------------------------------------------------
00420 // Destroy Federation Execution.
00427 void
00428 RTI::RTIambassador::destroyFederationExecution(const char *executionName)
00429     throw (RTI::RTIinternalError, RTI::ConcurrentAccessAttempted,
00430        RTI::FederationExecutionDoesNotExist, RTI::FederatesCurrentlyJoined)
00431 {
00432     Message req, rep ;
00433 
00434     G.Out(pdGendoc,"enter RTIambassador::destroyFederationExecution");
00435 
00436     req.type = Message::DESTROY_FEDERATION_EXECUTION ;
00437     req.setFederationName(executionName);
00438 
00439     G.Out(pdGendoc,"        ====>executeService DESTROY_FEDERATION_EXECUTION");
00440 
00441     privateRefs->executeService(&req, &rep);
00442 
00443     G.Out(pdGendoc,"exit RTIambassador::destroyFederationExecution");
00444 
00445 }
00446 
00447 // ----------------------------------------------------------------------------
00449 FederateHandle
00450 RTI::RTIambassador::joinFederationExecution(const char *yourName,
00451                        const char *executionName,
00452                        FederateAmbassadorPtr fedamb)
00453     throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
00454        RTI::ConcurrentAccessAttempted, RTI::ErrorReadingFED, RTI::CouldNotOpenFED, 
00455        RTI::FederationExecutionDoesNotExist, RTI::FederateAlreadyExecutionMember)
00456 {
00457     Message req, rep ;
00458 
00459     G.Out(pdGendoc,"enter RTIambassador::joinFederationExecution");
00460 
00461     if ( yourName == NULL || strlen(yourName) == 0 )
00462         throw RTI::RTIinternalError("Incorrect or empty federate name");
00463     if ( executionName == NULL || strlen(executionName) == 0 )
00464         throw RTI::RTIinternalError("Incorrect or empty federation name");
00465 
00466     privateRefs->fed_amb = (FederateAmbassador *) fedamb ;
00467 
00468     req.type = Message::JOIN_FEDERATION_EXECUTION ;
00469     req.setFederateName(yourName);
00470     req.setFederationName(executionName);
00471     G.Out(pdGendoc,"        ====>executeService JOIN_FEDERATION_EXECUTION");
00472     privateRefs->executeService(&req, &rep);
00473     G.Out(pdGendoc,"exit  RTIambassador::joinFederationExecution");
00474     return rep.getFederate();
00475 }
00476 
00477 // ----------------------------------------------------------------------------
00479 void
00480 RTI::RTIambassador::resignFederationExecution(ResignAction theAction)
00481     throw (RTI::FederateOwnsAttributes,
00482            RTI::FederateNotExecutionMember,
00483            RTI::InvalidResignAction,
00484            RTI::ConcurrentAccessAttempted,
00485            RTI::RTIinternalError)
00486 {
00487     Message req, rep ;
00488 
00489     G.Out(pdGendoc,"enter RTIambassador::resignFederationExecution");
00490 
00491     req.type = Message::RESIGN_FEDERATION_EXECUTION ;
00492     req.setResignAction(theAction);
00493 
00494     G.Out(pdGendoc,"        ====>executeService RESIGN_FEDERATION_EXECUTION");
00495     privateRefs->executeService(&req, &rep);
00496 
00497     G.Out(pdGendoc,"exit RTIambassador::resignFederationExecution");
00498 
00499 }
00500 
00501 // ----------------------------------------------------------------------------
00503 //  (all federates in the federation execution are informed)
00508 void
00509 RTI::RTIambassador::registerFederationSynchronizationPoint(const char *label,
00510                                                       const char *the_tag)
00511     throw (RTI::FederateNotExecutionMember,
00512            RTI::ConcurrentAccessAttempted,
00513            RTI::SaveInProgress,
00514            RTI::RestoreInProgress,
00515            RTI::RTIinternalError)
00516 {
00517     Message req, rep ;
00518 
00519     G.Out(pdGendoc,"enter RTIambassador::registerFederationSynchronizationPoint for all federates");
00520 
00521     req.type = Message::REGISTER_FEDERATION_SYNCHRONIZATION_POINT ;
00522     req.setLabel(label);
00523     if ( the_tag == NULL )
00524        {
00525        throw RTI::RTIinternalError ("Calling registerFederationSynchronizationPoint with Tag NULL");
00526        }
00527     req.setTag(the_tag);
00528     // boolean false because without set of federates
00529     req.setBoolean(false);
00530     G.Out(pdGendoc,"        ====>executeService REGISTER_FEDERATION_SYNCHRONIZATION_POINT");
00531     privateRefs->executeService(&req, &rep);
00532 
00533     G.Out(pdGendoc,"exit RTIambassador::registerFederationSynchronizationPoint for all federates");
00534 
00535 }
00536 
00537 // ----------------------------------------------------------------------------
00539 //  (only federates in the set are informed)
00545 void
00546 RTI::RTIambassador::registerFederationSynchronizationPoint(const char *label,
00547                               const char *theTag,
00548                               const FederateHandleSet &set_of_fed)
00549     throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
00550        RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember)
00551 {
00552 
00553     Message req, rep ;
00554 
00555     G.Out(pdGendoc,"enter RTIambassador::registerFederationSynchronizationPoint for some federates");
00556 
00557     req.type = Message::REGISTER_FEDERATION_SYNCHRONIZATION_POINT ;
00558     req.setLabel(label);
00559     if ( theTag == NULL )
00560        {
00561        throw RTI::RTIinternalError ("Calling registerFederationSynchronizationPoint with Tag NULL");
00562        }
00563     req.setTag(theTag);
00564     // boolean must be true because federate set exists but if size=0 (set empty)
00565     // we have to put boolean false (HLA 1.3 compliance to inform ALL federates)
00566     if ( set_of_fed.size() == 0 )
00567         {
00568         req.setBoolean(false) ;
00569         }
00570     else
00571         {
00572         req.setBoolean(true);
00573         // and then we have to store this set (after the size)
00574         req.handleArraySize = set_of_fed.size() ;
00575         req.handleArray.resize(req.handleArraySize) ;
00576         for (unsigned long i=0 ; i<set_of_fed.size() ; i++)
00577             {
00578             req.handleArray[i] = set_of_fed.getHandle(i) ;
00579             }
00580         }
00581     G.Out(pdGendoc,"        ====>executeService REGISTER_FEDERATION_SYNCHRONIZATION_POINT");
00582     privateRefs->executeService(&req, &rep);
00583 
00584     G.Out(pdGendoc,"exit RTIambassador::registerFederationSynchronizationPoint for some federates");
00585 
00586 }
00587 
00588 // ----------------------------------------------------------------------------
00590 void
00591 RTI::RTIambassador::synchronizationPointAchieved(const char *label)
00592     throw (RTI::SynchronizationPointLabelWasNotAnnounced,
00593            RTI::FederateNotExecutionMember,
00594            RTI::ConcurrentAccessAttempted,
00595            RTI::SaveInProgress,
00596            RTI::RestoreInProgress,
00597            RTI::RTIinternalError)
00598 {
00599     Message req, rep ;
00600 
00601     G.Out(pdGendoc,"enter RTIambassador::synchronizationPointAchieved");
00602 
00603     req.type = Message::SYNCHRONIZATION_POINT_ACHIEVED ;
00604     req.setLabel(label);
00605     G.Out(pdGendoc,"        ====>executeService SYNCHRONIZATION_POINT_ACHIEVED");
00606     privateRefs->executeService(&req, &rep);
00607 
00608     G.Out(pdGendoc,"exit  RTIambassador::synchronizationPointAchieved");
00609 }
00610 
00611 // ----------------------------------------------------------------------------
00613 void
00614 RTI::RTIambassador::requestFederationSave(const char *label,
00615                                      const RTI::FedTime& theTime)
00616     throw (RTI::FederationTimeAlreadyPassed,
00617            RTI::InvalidFederationTime,
00618            RTI::FederateNotExecutionMember,
00619            RTI::ConcurrentAccessAttempted,
00620            RTI::SaveInProgress,
00621            RTI::RestoreInProgress,
00622            RTI::RTIinternalError)
00623 {
00624     Message req, rep ;
00625 
00626     G.Out(pdGendoc,"enter RTIambassador::requestFederationSave with time");
00627 
00628     req.type = Message::REQUEST_FEDERATION_SAVE ;
00629     req.setFedTime(certi_cast<RTIfedTime>()(theTime).getTime());
00630     req.setLabel(label);
00631     // boolean true means time constrained
00632     req.setBoolean(true);
00633 
00634     G.Out(pdGendoc,"        ====>executeService REQUEST_FEDERATION_SAVE");
00635     privateRefs->executeService(&req, &rep);
00636 
00637     G.Out(pdGendoc,"exit RTIambassador::requestFederationSave with time");
00638 }
00639 
00640 // ----------------------------------------------------------------------------
00642 void
00643 RTI::RTIambassador::requestFederationSave(const char *label)
00644     throw (RTI::FederateNotExecutionMember,
00645            RTI::ConcurrentAccessAttempted,
00646            RTI::SaveInProgress,
00647            RTI::RestoreInProgress,
00648            RTI::RTIinternalError)
00649 {
00650     Message req, rep ;
00651 
00652     G.Out(pdGendoc,"enter RTIambassador::requestFederationSave without time");
00653 
00654     req.type = Message::REQUEST_FEDERATION_SAVE ;
00655     req.setLabel(label);
00656     // boolean false means without time
00657     req.setBoolean(false);
00658 
00659     G.Out(pdGendoc,"      ====>executeService REQUEST_FEDERATION_SAVE");
00660 
00661     privateRefs->executeService(&req, &rep);
00662 
00663     G.Out(pdGendoc,"exit  RTIambassador::requestFederationSave without time");
00664 }
00665 
00666 // ----------------------------------------------------------------------------
00668 void
00669 RTI::RTIambassador::federateSaveBegun()
00670     throw (RTI::SaveNotInitiated,
00671            RTI::FederateNotExecutionMember,
00672            RTI::ConcurrentAccessAttempted,
00673            RTI::RestoreInProgress,
00674            RTI::RTIinternalError)
00675 {
00676     Message req, rep ;
00677 
00678     G.Out(pdGendoc,"enter RTIambassador::federateSaveBegun");
00679 
00680     req.type = Message::FEDERATE_SAVE_BEGUN ;
00681     G.Out(pdGendoc,"      ====>executeService FEDERATE_SAVE_BEGUN");
00682     privateRefs->executeService(&req, &rep);
00683 
00684     G.Out(pdGendoc,"exit  RTIambassador::federateSaveBegun");
00685 }
00686 
00687 // ----------------------------------------------------------------------------
00689 void
00690 RTI::RTIambassador::federateSaveComplete()
00691     throw (RTI::SaveNotInitiated,
00692            RTI::FederateNotExecutionMember,
00693            RTI::ConcurrentAccessAttempted,
00694            RTI::RestoreInProgress,
00695            RTI::RTIinternalError)
00696 {
00697     Message req, rep ;
00698 
00699     G.Out(pdGendoc,"enter RTIambassador::federateSaveComplete");
00700 
00701     req.type = Message::FEDERATE_SAVE_COMPLETE ;
00702     G.Out(pdGendoc,"      ====>executeService FEDERATE_SAVE_COMPLETE");
00703     privateRefs->executeService(&req, &rep);
00704     G.Out(pdGendoc,"exit  RTIambassador::federateSaveComplete");
00705 }
00706 
00707 // ----------------------------------------------------------------------------
00708 // Federate Save Not Complete.
00709 void
00710 RTI::RTIambassador::federateSaveNotComplete()
00711     throw (RTI::SaveNotInitiated,
00712            RTI::FederateNotExecutionMember,
00713            RTI::ConcurrentAccessAttempted,
00714            RTI::RestoreInProgress,
00715            RTI::RTIinternalError)
00716 {
00717 
00718     Message req, rep ;
00719 
00720     G.Out(pdGendoc,"enter RTIambassador::federateSaveNotComplete");
00721     G.Out(pdGendoc,"      ====>executeService FEDERATE_SAVE_NOT_COMPLETE");
00722     req.type = Message::FEDERATE_SAVE_NOT_COMPLETE ;
00723 
00724     privateRefs->executeService(&req, &rep);
00725 
00726     G.Out(pdGendoc,"exit  RTIambassador::federateSaveNotComplete");
00727 }
00728 
00729 // ----------------------------------------------------------------------------
00731 void
00732 RTI::RTIambassador::requestFederationRestore(const char *label)
00733     throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress, 
00734        RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember)
00735 {
00736     Message req, rep ;
00737 
00738     G.Out(pdGendoc,"enter RTIambassador::requestFederationRestore");
00739 
00740     req.type = Message::REQUEST_FEDERATION_RESTORE ;
00741     req.setLabel(label);
00742     G.Out(pdGendoc,"      ====>executeService REQUEST_FEDERATION_RESTORE");
00743     privateRefs->executeService(&req, &rep);
00744     G.Out(pdGendoc,"exit  RTIambassador::requestFederationRestore");
00745 }
00746 
00747 // ----------------------------------------------------------------------------
00749 void
00750 RTI::RTIambassador::federateRestoreComplete()
00751     throw (RTI::RTIinternalError, RTI::SaveInProgress,
00752        RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember,
00753        RTI::RestoreNotRequested)
00754 {
00755     Message req, rep ;
00756 
00757     G.Out(pdGendoc,"enter RTIambassador::federateRestoreComplete");
00758 
00759     req.type = Message::FEDERATE_RESTORE_COMPLETE ;
00760     G.Out(pdGendoc,"      ====>executeService FEDERATE_RESTORE_COMPLETE");
00761     privateRefs->executeService(&req, &rep);
00762     G.Out(pdGendoc,"exit  RTIambassador::federateRestoreComplete");
00763 }
00764 
00765 // ----------------------------------------------------------------------------
00767 void
00768 RTI::RTIambassador::federateRestoreNotComplete()
00769     throw (RTI::RTIinternalError, RTI::SaveInProgress,
00770        RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember,
00771        RTI::RestoreNotRequested)
00772 {
00773     Message req, rep ;
00774 
00775     G.Out(pdGendoc,"enter RTIambassador::federateRestoreNotComplete");
00776     G.Out(pdGendoc,"      ====>executeService FEDERATE_RESTORE_NOT_COMPLETE");
00777     req.type = Message::FEDERATE_RESTORE_NOT_COMPLETE ;
00778 
00779     privateRefs->executeService(&req, &rep);
00780     G.Out(pdGendoc,"exit  RTIambassador::federateRestoreNotComplete");
00781 }
00782 
00783 // ----------------------------------------------------------------------------
00784 // Publish Object Class
00785 void
00786 RTI::RTIambassador::publishObjectClass(ObjectClassHandle theClass,
00787                                   const AttributeHandleSet& attributeList)
00788     throw (RTI::RTIinternalError, 
00789        RTI::RestoreInProgress, RTI::SaveInProgress, RTI::ConcurrentAccessAttempted, 
00790        RTI::FederateNotExecutionMember, RTI::OwnershipAcquisitionPending, 
00791        RTI::AttributeNotDefined, RTI::ObjectClassNotDefined)
00792 {
00793     Message req, rep ;
00794 
00795     G.Out(pdGendoc,"enter RTIambassador::publishObjectClass");
00796 
00797     req.type = Message::PUBLISH_OBJECT_CLASS ;
00798     req.setObjectClass(theClass);
00799     req.setAHS(certi_cast<AttributeHandleSetImp>()(attributeList).getAttributeHandles());
00800     G.Out(pdGendoc,"      ====>executeService PUBLISH_OBJECT_CLASS");
00801     privateRefs->executeService(&req, &rep);
00802     G.Out(pdGendoc,"exit  RTIambassador::publishObjectClass");
00803 }
00804 
00805 // ----------------------------------------------------------------------------
00806 // UnPublish Object Class
00807 void
00808 RTI::RTIambassador::unpublishObjectClass(ObjectClassHandle theClass)
00809     throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress, 
00810        RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember, 
00811        RTI::OwnershipAcquisitionPending, RTI::ObjectClassNotPublished, 
00812        RTI::ObjectClassNotDefined)
00813 {
00814     Message req, rep ;
00815 
00816     G.Out(pdGendoc,"enter RTIambassador::unpublishObjectClass");
00817 
00818     req.type = Message::UNPUBLISH_OBJECT_CLASS ;
00819     req.setObjectClass(theClass);
00820     G.Out(pdGendoc,"      ====>executeService UNPUBLISH_OBJECT_CLASS");
00821     privateRefs->executeService(&req, &rep);
00822     G.Out(pdGendoc,"exit  RTIambassador::unpublishObjectClass");
00823 }
00824 
00825 
00826 // ----------------------------------------------------------------------------
00827 // Publish Interaction Class
00828 void
00829 RTI::RTIambassador::publishInteractionClass(InteractionClassHandle theInteraction)
00830     throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress, 
00831        RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember, 
00832        RTI::InteractionClassNotDefined)
00833 {
00834     Message req, rep ;
00835 
00836     req.type = Message::PUBLISH_INTERACTION_CLASS ;
00837     req.setInteractionClass(theInteraction);
00838     G.Out(pdGendoc,"      ====>executeService PUBLISH_INTERACTION_CLASS");
00839     privateRefs->executeService(&req, &rep);
00840 }
00841 
00842 // ----------------------------------------------------------------------------
00843 // Publish Interaction Class
00844 void
00845 RTI::RTIambassador::unpublishInteractionClass(InteractionClassHandle theInteraction)
00846     throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress, 
00847        RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember, 
00848        RTI::InteractionClassNotPublished, RTI::InteractionClassNotDefined)
00849 {
00850     Message req, rep ;
00851 
00852     req.type = Message::UNPUBLISH_INTERACTION_CLASS ;
00853     req.setInteractionClass(theInteraction);
00854     privateRefs->executeService(&req, &rep);
00855 }
00856 
00857 // ----------------------------------------------------------------------------
00858 // Subscribe Object Class Attributes
00859 void
00860 RTI::RTIambassador::
00861 subscribeObjectClassAttributes(ObjectClassHandle theClass,
00862                                const AttributeHandleSet& attributeList,
00863                                RTI::Boolean active)
00864     throw (RTI::RTIinternalError, 
00865        RTI::RestoreInProgress, RTI::SaveInProgress, RTI::ConcurrentAccessAttempted, 
00866        RTI::FederateNotExecutionMember, RTI::AttributeNotDefined, 
00867        RTI::ObjectClassNotDefined)
00868 {
00869     Message req, rep ;
00870     G.Out(pdGendoc,"enter RTIambassador::subscribeObjectClassAttributes");
00871     req.type = Message::SUBSCRIBE_OBJECT_CLASS_ATTRIBUTES ;
00872     req.setObjectClass(theClass);
00873     req.setAHS(certi_cast<AttributeHandleSetImp>()(attributeList).getAttributeHandles());
00874     req.setBoolean(active);
00875 
00876     privateRefs->executeService(&req, &rep);
00877     G.Out(pdGendoc,"exit  RTIambassador::subscribeObjectClassAttributes");
00878 }
00879 
00880 // ----------------------------------------------------------------------------
00881 // UnSubscribe Object Class Attribute
00882 void
00883 RTI::RTIambassador::unsubscribeObjectClass(ObjectClassHandle theClass)
00884     throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress, 
00885        RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember, 
00886        RTI::ObjectClassNotSubscribed, RTI::ObjectClassNotDefined)
00887 {
00888     Message req, rep ;
00889 
00890     req.type = Message::UNSUBSCRIBE_OBJECT_CLASS ;
00891     req.setObjectClass(theClass);
00892     privateRefs->executeService(&req, &rep);
00893 }
00894 
00895 
00896 // ----------------------------------------------------------------------------
00897 // Subscribe Interaction Class
00898 void
00899 RTI::RTIambassador::subscribeInteractionClass(InteractionClassHandle theClass,
00900                                          RTI::Boolean /*active*/)
00901     throw (RTI::RTIinternalError, RTI::RestoreInProgress, 
00902        RTI::SaveInProgress, RTI::FederateLoggingServiceCalls, 
00903        RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember, 
00904        RTI::InteractionClassNotDefined)
00905 {
00906     Message req, rep ;
00907 
00908     req.type = Message::SUBSCRIBE_INTERACTION_CLASS ;
00909     req.setInteractionClass(theClass);
00910     privateRefs->executeService(&req, &rep);
00911 }
00912 
00913 // ----------------------------------------------------------------------------
00914 // UnSubscribe Interaction Class
00915 void
00916 RTI::RTIambassador::unsubscribeInteractionClass(InteractionClassHandle theClass)
00917     throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress, 
00918        RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember, 
00919        RTI::InteractionClassNotSubscribed, RTI::InteractionClassNotDefined)
00920 {
00921     Message req, rep ;
00922 
00923     req.type = Message::UNSUBSCRIBE_INTERACTION_CLASS ;
00924     req.setInteractionClass(theClass);
00925     privateRefs->executeService(&req, &rep);
00926 }
00927 
00928 // ----------------------------------------------------------------------------
00929 // Register Object
00930 ObjectHandle
00931 RTI::RTIambassador::registerObjectInstance(ObjectClassHandle theClass,
00932                                       const char *theObjectName)
00933     throw (RTI::RTIinternalError, RTI::RestoreInProgress, 
00934        RTI::SaveInProgress, RTI::ConcurrentAccessAttempted, 
00935        RTI::FederateNotExecutionMember, RTI::ObjectAlreadyRegistered, 
00936        RTI::ObjectClassNotPublished, RTI::ObjectClassNotDefined)
00937 {
00938     Message req, rep ;
00939 
00940     req.type = Message::REGISTER_OBJECT_INSTANCE ;
00941     req.setName(theObjectName);
00942     req.setObjectClass(theClass);
00943     privateRefs->executeService(&req, &rep);
00944 
00945     return rep.getObject();
00946 }
00947 
00948 // ----------------------------------------------------------------------------
00949 ObjectHandle
00950 RTI::RTIambassador::registerObjectInstance(ObjectClassHandle theClass)
00951     throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress, 
00952        RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember, 
00953        RTI::ObjectClassNotPublished, RTI::ObjectClassNotDefined)
00954 {
00955     Message req, rep ;
00956 
00957     req.type = Message::REGISTER_OBJECT_INSTANCE ;
00958     req.setName("\0");
00959     req.setObjectClass(theClass);
00960 
00961     privateRefs->executeService(&req, &rep);
00962 
00963     return rep.getObject();
00964 }
00965 
00966 // ----------------------------------------------------------------------------
00967 // Update Attribute Values with time
00978 RTI::EventRetractionHandle
00979 RTI::RTIambassador::
00980 updateAttributeValues(ObjectHandle theObject,
00981                       const AttributeHandleValuePairSet& theAttributes,
00982                       const RTI::FedTime& theTime,
00983                       const char *theTag)
00984     throw (RTI::ObjectNotKnown,
00985            RTI::AttributeNotDefined,
00986            RTI::AttributeNotOwned,
00987            RTI::InvalidFederationTime,
00988            RTI::FederateNotExecutionMember,
00989            RTI::ConcurrentAccessAttempted,
00990            RTI::SaveInProgress,
00991            RTI::RestoreInProgress,
00992            RTI::RTIinternalError)
00993 {
00994     G.Out(pdGendoc,"enter RTIambassador::updateAttributeValues with time");
00995     Message req, rep ;
00996 
00997     req.type = Message::UPDATE_ATTRIBUTE_VALUES ;
00998     req.setObject(theObject);
00999     req.setFedTime(certi_cast<RTIfedTime>()(theTime).getTime());
01000     if ( theTag == NULL)
01001        {
01002        throw RTI::RTIinternalError ("Calling updateAttributeValues with Tag NULL");
01003        }
01004     req.setTag(theTag);
01005     req.setAHVPS(certi_cast<AttributeHandleValuePairSetImp>()(theAttributes).getAttributeHandleValuePairs());
01006     req.setBoolean(true);
01007 
01008     privateRefs->executeService(&req, &rep);
01009     G.Out(pdGendoc,"return  RTIambassador::updateAttributeValues with time");
01010     return rep.getEventRetraction();
01011 }
01012 
01013 // ----------------------------------------------------------------------------
01014 // Update Attribute Values without time
01023 void
01024 RTI::RTIambassador::updateAttributeValues(ObjectHandle the_object,
01025                                      const AttributeHandleValuePairSet& theAttributes,
01026                                      const char *theTag)
01027     throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress, 
01028        RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember, 
01029        RTI::AttributeNotOwned, RTI::AttributeNotDefined, RTI::ObjectNotKnown)
01030 {
01031     G.Out(pdGendoc,"enter RTIambassador::updateAttributeValues without time");
01032     Message req, rep ;
01033 
01034     req.type = Message::UPDATE_ATTRIBUTE_VALUES ;
01035     req.setObject(the_object);
01036     if ( theTag == NULL)
01037        {
01038        throw RTI::RTIinternalError ("Calling updateAttributeValues with Tag NULL");
01039        }
01040     req.setTag(theTag);
01041     req.setAHVPS(certi_cast<AttributeHandleValuePairSetImp>()(theAttributes).getAttributeHandleValuePairs());
01042     req.setBoolean(false);
01043 
01044     privateRefs->executeService(&req, &rep);
01045     G.Out(pdGendoc,"exit  RTIambassador::updateAttributeValues without time");
01046 }
01047 
01048 // ----------------------------------------------------------------------------
01057 RTI::EventRetractionHandle
01058 RTI::RTIambassador::sendInteraction(InteractionClassHandle theInteraction,
01059                                const ParameterHandleValuePairSet& theParameters,
01060                                const RTI::FedTime& theTime,
01061                                const char *theTag)
01062     throw (RTI::InteractionClassNotDefined,
01063            RTI::InteractionClassNotPublished,
01064            RTI::InteractionParameterNotDefined,
01065            RTI::InvalidFederationTime,
01066            RTI::FederateNotExecutionMember,
01067            RTI::ConcurrentAccessAttempted,
01068            RTI::SaveInProgress,
01069            RTI::RestoreInProgress,
01070            RTI::RTIinternalError)
01071 {
01072     Message req, rep ;
01073 
01074     req.type = Message::SEND_INTERACTION ;
01075     req.setInteractionClass(theInteraction);
01076     req.setFedTime(certi_cast<RTIfedTime>()(theTime).getTime());
01077     if (theTag == NULL)
01078        {
01079        throw RTI::RTIinternalError ("Calling sendInteraction with Tag NULL") ;
01080        }
01081     req.setTag((std::string)theTag);
01082     req.setPHVPS(certi_cast<ParameterHandleValuePairSetImp>()(theParameters).getParameterHandleValuePairs());
01083     req.setRegion(0);
01084     req.setBoolean(true);
01085 
01086     privateRefs->executeService(&req, &rep);
01087 
01088     return rep.getEventRetraction();
01089 }
01090 
01091 // ----------------------------------------------------------------------------
01099 void
01100 RTI::RTIambassador::sendInteraction(InteractionClassHandle theInteraction,
01101                                const ParameterHandleValuePairSet &theParameters,
01102                                const char *theTag)
01103     throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress, 
01104        RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember, 
01105        RTI::InteractionParameterNotDefined, RTI::InteractionClassNotPublished, 
01106        RTI::InteractionClassNotDefined)
01107 {
01108 
01109     Message req, rep ;
01110 
01111     req.type = Message::SEND_INTERACTION ;
01112     req.setInteractionClass(theInteraction);
01113     if (theTag == NULL)
01114        {
01115        throw RTI::RTIinternalError ("Calling sendIntercation with Tag NULL") ;
01116        }
01117     req.setTag((std::string)theTag);
01118     req.setPHVPS(certi_cast<ParameterHandleValuePairSetImp>()(theParameters).getParameterHandleValuePairs());
01119     req.setRegion(0);
01120     req.setBoolean(false);
01121   
01122     privateRefs->executeService(&req, &rep);
01123 }
01124 
01125 // ----------------------------------------------------------------------------
01133 RTI::EventRetractionHandle
01134 RTI::RTIambassador::deleteObjectInstance(ObjectHandle theObject,
01135                                     const RTI::FedTime& theTime,
01136                                     const char *theTag)
01137     throw (RTI::ObjectNotKnown,
01138            RTI::DeletePrivilegeNotHeld,
01139            RTI::InvalidFederationTime,
01140            RTI::FederateNotExecutionMember,
01141            RTI::ConcurrentAccessAttempted,
01142            RTI::SaveInProgress,
01143            RTI::RestoreInProgress,
01144            RTI::RTIinternalError)
01145 {
01146     Message req, rep ;
01147 
01148     req.type = Message::DELETE_OBJECT_INSTANCE ;
01149     req.setObject(theObject);
01150     req.setFedTime(certi_cast<RTIfedTime>()(theTime).getTime());
01151     if (theTag == NULL)
01152        {
01153        throw RTI::RTIinternalError ("Calling deleteObjectInstance with Tag NULL") ;
01154        }
01155     req.setTag(theTag);
01156     req.setBoolean(true);
01157 
01158     privateRefs->executeService(&req, &rep);
01159     return rep.getEventRetraction();
01160 }
01161 
01162 // ----------------------------------------------------------------------------
01168 void
01169 RTI::RTIambassador::deleteObjectInstance(ObjectHandle theObject,
01170                                     const char *theTag)
01171     throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress, 
01172        RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember, 
01173        RTI::DeletePrivilegeNotHeld, RTI::ObjectNotKnown)
01174 {
01175     Message req, rep ;
01176 
01177     req.type = Message::DELETE_OBJECT_INSTANCE ;
01178     req.setObject(theObject);
01179     if (theTag == NULL)
01180        {
01181        throw RTI::RTIinternalError ("Calling deleteObjectInstance with Tag NULL") ;
01182        }
01183     req.setTag(theTag);
01184    
01185     req.setBoolean(false);
01186 
01187     privateRefs->executeService(&req, &rep);
01188 }
01189 
01190 // ----------------------------------------------------------------------------
01191 // Local Delete Object Instance
01192 void
01193 RTI::RTIambassador::localDeleteObjectInstance(ObjectHandle theObject)
01194     throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress, 
01195        RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember, 
01196        RTI::FederateOwnsAttributes, RTI::ObjectNotKnown)
01197 {
01198     throw RTI::RTIinternalError("unimplemented service localDeleteObjectInstance");
01199     Message req, rep ;
01200 
01201     req.type = Message::LOCAL_DELETE_OBJECT_INSTANCE ;
01202     req.setObject(theObject);
01203 
01204     privateRefs->executeService(&req, &rep);
01205 }
01206 
01207 
01208 // ----------------------------------------------------------------------------
01209 // Change Attribute Transportation Type
01210 void
01211 RTI::RTIambassador::
01212 changeAttributeTransportationType(ObjectHandle theObject,
01213                                   const AttributeHandleSet& theAttributes,
01214                                   TransportationHandle theType)
01215     throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress, 
01216        RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember, 
01217        RTI::InvalidTransportationHandle, RTI::AttributeNotOwned, 
01218        RTI::AttributeNotDefined, RTI::ObjectNotKnown)
01219 {
01220     Message req, rep ;
01221 
01222     req.type = Message::CHANGE_ATTRIBUTE_TRANSPORTATION_TYPE ;
01223     req.setObject(theObject);
01224     req.setTransportation(theType);
01225     req.setAHS(certi_cast<AttributeHandleSetImp>()(theAttributes).getAttributeHandles());
01226 
01227     privateRefs->executeService(&req, &rep);
01228 }
01229 
01230 // ----------------------------------------------------------------------------
01231 // Change Interaction Transportation Type
01232 void
01233 RTI::RTIambassador::
01234 changeInteractionTransportationType(InteractionClassHandle theClass,
01235                                     TransportationHandle theType)
01236     throw (RTI::RTIinternalError, RTI::RestoreInProgress, 
01237        RTI::SaveInProgress, RTI::ConcurrentAccessAttempted, 
01238        RTI::FederateNotExecutionMember, RTI::InvalidTransportationHandle, 
01239        RTI::InteractionClassNotPublished, RTI::InteractionClassNotDefined)
01240 {
01241     Message req, rep ;
01242 
01243     req.type = Message::CHANGE_INTERACTION_TRANSPORTATION_TYPE ;
01244     req.setInteractionClass(theClass);
01245     req.setTransportation(theType);
01246 
01247     privateRefs->executeService(&req, &rep);
01248 }
01249 
01250 // ----------------------------------------------------------------------------
01251 // Request Attribute Value Update
01252 void
01253 RTI::RTIambassador::requestObjectAttributeValueUpdate(ObjectHandle theObject,
01254                                                  const AttributeHandleSet &ahs)
01255     throw (RTI::RTIinternalError, 
01256        RTI::RestoreInProgress, RTI::SaveInProgress, RTI::ConcurrentAccessAttempted, 
01257        RTI::FederateNotExecutionMember, RTI::AttributeNotDefined, 
01258        RTI::ObjectNotKnown)
01259 {
01260     Message req, rep ;
01261 
01262     G.Out(pdGendoc,"enter RTIambassador::requestObjectAttributeValueUpdate");
01263     req.type = Message::REQUEST_OBJECT_ATTRIBUTE_VALUE_UPDATE ;
01264     req.setObject(theObject);
01265     req.setAHS(certi_cast<AttributeHandleSetImp>()(ahs).getAttributeHandles());
01266 
01267     privateRefs->executeService(&req, &rep);
01268     G.Out(pdGendoc,"exit  RTIambassador::requestObjectAttributeValueUpdate");
01269 }
01270 
01271 // ----------------------------------------------------------------------------
01272 void
01273 RTI::RTIambassador::requestClassAttributeValueUpdate(ObjectClassHandle theClass,
01274                                                 const AttributeHandleSet &attrs)
01275     throw (RTI::RTIinternalError, 
01276        RTI::RestoreInProgress, RTI::SaveInProgress, RTI::ConcurrentAccessAttempted, 
01277        RTI::FederateNotExecutionMember, RTI::AttributeNotDefined, 
01278        RTI::ObjectClassNotDefined)
01279 {
01280 
01281     Message req, rep ;
01282 
01283     G.Out(pdGendoc,"enter RTIambassador::requestClassAttributeValueUpdate");
01284     req.type = Message::REQUEST_CLASS_ATTRIBUTE_VALUE_UPDATE ;
01285     req.setObjectClass(theClass);
01286     req.setAHS(certi_cast<AttributeHandleSetImp>()(attrs).getAttributeHandles());
01287 
01288     privateRefs->executeService(&req, &rep);
01289     G.Out(pdGendoc,"exit  RTIambassador::requestClassAttributeValueUpdate");
01290 }
01291 
01292 // ----------------------------------------------------------------------------
01293 // UnConditional Attribute Ownership Divestiture
01294 void
01295 RTI::RTIambassador::
01296 unconditionalAttributeOwnershipDivestiture(ObjectHandle theObject,
01297                                            const AttributeHandleSet &attrs)
01298     throw (RTI::ObjectNotKnown,
01299            RTI::AttributeNotDefined,
01300            RTI::AttributeNotOwned,
01301            RTI::FederateNotExecutionMember,
01302            RTI::ConcurrentAccessAttempted,
01303            RTI::SaveInProgress,
01304            RTI::RestoreInProgress,
01305            RTI::RTIinternalError)
01306 {
01307     Message req, rep ;
01308 
01309     req.type = Message::UNCONDITIONAL_ATTRIBUTE_OWNERSHIP_DIVESTITURE ;
01310     req.setObject(theObject);
01311     req.setAHS(certi_cast<AttributeHandleSetImp>()(attrs).getAttributeHandles());
01312 
01313     privateRefs->executeService(&req, &rep);
01314 }
01315 
01316 // ----------------------------------------------------------------------------
01317 // Negotiated Attribute Ownership Divestiture
01318 void
01319 RTI::RTIambassador::
01320 negotiatedAttributeOwnershipDivestiture(ObjectHandle theObject,
01321                                         const AttributeHandleSet& attrs,
01322                                         const char *theTag)
01323     throw (RTI::ObjectNotKnown,
01324            RTI::AttributeNotDefined,
01325            RTI::AttributeNotOwned,
01326            RTI::AttributeAlreadyBeingDivested,
01327            RTI::FederateNotExecutionMember,
01328            RTI::ConcurrentAccessAttempted,
01329            RTI::SaveInProgress,
01330            RTI::RestoreInProgress,
01331            RTI::RTIinternalError)
01332 {
01333     Message req, rep ;
01334 
01335     req.type = Message::NEGOTIATED_ATTRIBUTE_OWNERSHIP_DIVESTITURE ;
01336     req.setObject(theObject);
01337     if (theTag == NULL)
01338        {
01339        throw RTI::RTIinternalError ("Calling negotiatedAttributeOwnershipDivestiture with Tag NULL") ;
01340        }
01341     req.setTag(theTag);
01342     req.setAHS(certi_cast<AttributeHandleSetImp>()(attrs).getAttributeHandles());
01343 
01344     privateRefs->executeService(&req, &rep);
01345 }
01346 
01347 // ----------------------------------------------------------------------------
01348 // Attribute Ownership Acquisition
01349 void
01350 RTI::RTIambassador::
01351 attributeOwnershipAcquisition(ObjectHandle theObject,
01352                               const AttributeHandleSet& desiredAttributes,
01353                               const char *theTag)
01354     throw (RTI::ObjectNotKnown,
01355            RTI::ObjectClassNotPublished,
01356            RTI::AttributeNotDefined,
01357            RTI::AttributeNotPublished,
01358            RTI::FederateOwnsAttributes,
01359            RTI::FederateNotExecutionMember,
01360            RTI::ConcurrentAccessAttempted,
01361            RTI::SaveInProgress,
01362            RTI::RestoreInProgress,
01363            RTI::RTIinternalError)
01364 {
01365     Message req, rep ;
01366 
01367     req.type = Message::ATTRIBUTE_OWNERSHIP_ACQUISITION ;
01368     req.setObject(theObject);
01369     if (theTag == NULL)
01370        {
01371        throw RTI::RTIinternalError ("Calling attributeOwnershipAcquisition with Tag NULL") ;
01372        }
01373     req.setTag(theTag);
01374     req.setAHS(certi_cast<AttributeHandleSetImp>()(desiredAttributes).getAttributeHandles());
01375 
01376     privateRefs->executeService(&req, &rep);
01377 }
01378 
01379 // ----------------------------------------------------------------------------
01380 // Attribute Ownership Release Response
01381 RTI::AttributeHandleSet*
01382 RTI::RTIambassador::
01383 attributeOwnershipReleaseResponse(ObjectHandle theObject,
01384                                   const AttributeHandleSet& attrs)
01385     throw (RTI::ObjectNotKnown,
01386            RTI::AttributeNotDefined,
01387            RTI::AttributeNotOwned,
01388            RTI::FederateWasNotAskedToReleaseAttribute,
01389            RTI::FederateNotExecutionMember,
01390            RTI::ConcurrentAccessAttempted,
01391            RTI::SaveInProgress,
01392            RTI::RestoreInProgress,
01393            RTI::RTIinternalError)
01394 {
01395     Message req, rep ;
01396 
01397     req.type = Message::ATTRIBUTE_OWNERSHIP_RELEASE_RESPONSE ;
01398     req.setObject(theObject);
01399     req.setAHS(certi_cast<AttributeHandleSetImp>()(attrs).getAttributeHandles());
01400 
01401     privateRefs->executeService(&req, &rep);
01402 
01403     if (rep.getExceptionType() == e_NO_EXCEPTION) {
01404         return new AttributeHandleSetImp(rep.getAHS());
01405     }
01406 
01407     return NULL ;
01408 }
01409 
01410 // ----------------------------------------------------------------------------
01411 // Cancel Negotiated Attribute Ownership Divestiture
01412 void
01413 RTI::RTIambassador::
01414 cancelNegotiatedAttributeOwnershipDivestiture(ObjectHandle theObject,
01415                                               const AttributeHandleSet& attrs)
01416     throw (RTI::ObjectNotKnown,
01417            RTI::AttributeNotDefined,
01418            RTI::AttributeNotOwned,
01419            RTI::AttributeDivestitureWasNotRequested,
01420            RTI::FederateNotExecutionMember,
01421            RTI::ConcurrentAccessAttempted,
01422            RTI::SaveInProgress,
01423            RTI::RestoreInProgress,
01424            RTI::RTIinternalError)
01425 {
01426     Message req, rep ;
01427 
01428     req.type = Message::CANCEL_NEGOTIATED_ATTRIBUTE_OWNERSHIP_DIVESTITURE ;
01429     req.setObject(theObject);
01430     req.setAHS(certi_cast<AttributeHandleSetImp>()(attrs).getAttributeHandles());
01431 
01432     privateRefs->executeService(&req, &rep);
01433 }
01434 
01435 // ----------------------------------------------------------------------------
01436 // Cancel Attribute Ownership Acquisition
01437 void
01438 RTI::RTIambassador::
01439 cancelAttributeOwnershipAcquisition(ObjectHandle theObject,
01440                                     const AttributeHandleSet& attrs)
01441     throw (RTI::ObjectNotKnown,
01442            RTI::AttributeNotDefined,
01443            RTI::AttributeAlreadyOwned,
01444            RTI::AttributeAcquisitionWasNotRequested,
01445            RTI::FederateNotExecutionMember,
01446            RTI::ConcurrentAccessAttempted,
01447            RTI::SaveInProgress,
01448            RTI::RestoreInProgress,
01449            RTI::RTIinternalError)
01450 {
01451     Message req, rep ;
01452 
01453     req.type = Message::CANCEL_ATTRIBUTE_OWNERSHIP_ACQUISITION ;
01454     req.setObject(theObject);
01455     req.setAHS(certi_cast<AttributeHandleSetImp>()(attrs).getAttributeHandles());
01456 
01457     privateRefs->executeService(&req, &rep);
01458 }
01459 
01460 // ----------------------------------------------------------------------------
01461 // Attribute Ownership Acquisition If Available
01462 void
01463 RTI::RTIambassador::
01464 attributeOwnershipAcquisitionIfAvailable(ObjectHandle theObject,
01465                                          const AttributeHandleSet& desired)
01466     throw (RTI::ObjectNotKnown,
01467            RTI::ObjectClassNotPublished,
01468            RTI::AttributeNotDefined,
01469            RTI::AttributeNotPublished,
01470            RTI::FederateOwnsAttributes,
01471            RTI::AttributeAlreadyBeingAcquired,
01472            RTI::FederateNotExecutionMember,
01473            RTI::ConcurrentAccessAttempted,
01474            RTI::SaveInProgress,
01475            RTI::RestoreInProgress,
01476            RTI::RTIinternalError)
01477 {
01478     Message req, rep ;
01479 
01480     req.type = Message::ATTRIBUTE_OWNERSHIP_ACQUISITION_IF_AVAILABLE ;
01481     req.setObject(theObject);
01482     req.setAHS(certi_cast<AttributeHandleSetImp>()(desired).getAttributeHandles());
01483 
01484     privateRefs->executeService(&req, &rep);
01485 }
01486 
01487 // ----------------------------------------------------------------------------
01488 // Query Attribute Ownership
01489 void
01490 RTI::RTIambassador::
01491 queryAttributeOwnership(ObjectHandle theObject,
01492                         AttributeHandle theAttribute)
01493     throw (RTI::RTIinternalError, RTI::RestoreInProgress, 
01494        RTI::SaveInProgress, RTI::ConcurrentAccessAttempted, 
01495        RTI::FederateNotExecutionMember, RTI::AttributeNotDefined, 
01496        RTI::ObjectNotKnown)
01497 {
01498     Message req, rep ;
01499 
01500     req.type = Message::QUERY_ATTRIBUTE_OWNERSHIP ;
01501     req.setObject(theObject);
01502     req.setAttribute(theAttribute);
01503 
01504     privateRefs->executeService(&req, &rep);
01505 }
01506 
01507 // ----------------------------------------------------------------------------
01508 // 5.16 Is Attribute Owned By Federate
01509 RTI::Boolean
01510 RTI::RTIambassador::isAttributeOwnedByFederate(ObjectHandle theObject,
01511                                           AttributeHandle theAttribute)
01512     throw (RTI::ObjectNotKnown,
01513            RTI::AttributeNotDefined,
01514            RTI::FederateNotExecutionMember,
01515            RTI::ConcurrentAccessAttempted,
01516            RTI::SaveInProgress,
01517            RTI::RestoreInProgress,
01518            RTI::RTIinternalError)
01519 {
01520     Message req, rep ;
01521 
01522     req.type = Message::IS_ATTRIBUTE_OWNED_BY_FEDERATE ;
01523     req.setObject(theObject);
01524     req.setAttribute(theAttribute);
01525 
01526     privateRefs->executeService(&req, &rep);
01527 
01528     return ((strcmp((rep.getTag()).c_str(), "RTI_TRUE") == 0) ? RTI_TRUE : RTI_FALSE); 
01529 }
01530 
01531 // ----------------------------------------------------------------------------
01532 // Enable Time Regulation
01533 void
01534 RTI::RTIambassador::enableTimeRegulation(const RTI::FedTime& theFederateTime,
01535                                     const RTI::FedTime& theLookahead)
01536     throw (RTI::RTIinternalError, RTI::RestoreInProgress, 
01537        RTI::SaveInProgress, RTI::FederateNotExecutionMember, 
01538        RTI::ConcurrentAccessAttempted, RTI::InvalidLookahead, 
01539        RTI::InvalidFederationTime, RTI::TimeAdvanceAlreadyInProgress, 
01540        RTI::EnableTimeRegulationPending, RTI::TimeRegulationAlreadyEnabled)
01541 {
01542     Message req, rep ;
01543     req.type = Message::ENABLE_TIME_REGULATION ;
01544     req.setFedTime(certi_cast<RTIfedTime>()(theFederateTime).getTime());
01545     req.setLookahead(certi_cast<RTIfedTime>()(theLookahead).getTime());
01546     req.setBoolean(true);
01547     privateRefs->executeService(&req, &rep);
01548 }
01549 
01550 // ----------------------------------------------------------------------------
01551 // Disable Time Regulation
01552 void
01553 RTI::RTIambassador::disableTimeRegulation()
01554     throw (RTI::RTIinternalError, 
01555        RTI::RestoreInProgress, RTI::SaveInProgress, 
01556        RTI::FederateNotExecutionMember, RTI::ConcurrentAccessAttempted, 
01557        RTI::TimeRegulationWasNotEnabled)
01558 {
01559     Message req, rep ;
01560     req.type = Message::DISABLE_TIME_REGULATION ;
01561     req.setBoolean(false);
01562     privateRefs->executeService(&req, &rep);
01563 }
01564 
01565 // ----------------------------------------------------------------------------
01566 // Enable Time Constrained
01567 void
01568 RTI::RTIambassador::enableTimeConstrained()
01569     throw (RTI::TimeConstrainedAlreadyEnabled, //not implemented
01570            RTI::EnableTimeConstrainedPending, //not implemented
01571            RTI::TimeAdvanceAlreadyInProgress, //not implemented
01572            RTI::FederateNotExecutionMember,
01573            RTI::ConcurrentAccessAttempted,
01574            RTI::SaveInProgress,
01575            RTI::RestoreInProgress,
01576            RTI::RTIinternalError)
01577 {
01578     Message req, rep ;
01579 
01580     req.type = Message::ENABLE_TIME_CONSTRAINED ;
01581     req.setBoolean(true);
01582     privateRefs->executeService(&req, &rep);
01583 }
01584 
01585 // ----------------------------------------------------------------------------
01586 // Disable Time Constrained
01587 void
01588 RTI::RTIambassador::disableTimeConstrained()
01589     throw (RTI::TimeConstrainedWasNotEnabled, //not implemented
01590            RTI::FederateNotExecutionMember,
01591            RTI::ConcurrentAccessAttempted,
01592            RTI::SaveInProgress,
01593            RTI::RestoreInProgress,
01594            RTI::RTIinternalError)
01595 {
01596     Message req, rep ;
01597 
01598     req.type = Message::DISABLE_TIME_CONSTRAINED ;
01599     req.setBoolean(false);
01600     privateRefs->executeService(&req, &rep);
01601 }
01602 
01603 // ----------------------------------------------------------------------------
01604 // Time Advance Request
01605 void
01606 RTI::RTIambassador::timeAdvanceRequest(const RTI::FedTime& theTime)
01607     throw (RTI::TimeAdvanceAlreadyInProgress,
01608            RTI::FederationTimeAlreadyPassed,
01609            RTI::InvalidFederationTime,
01610            RTI::EnableTimeRegulationPending, //not implemented
01611            RTI::EnableTimeConstrainedPending, //not implemented
01612            RTI::FederateNotExecutionMember,
01613            RTI::ConcurrentAccessAttempted,
01614            RTI::SaveInProgress,
01615            RTI::RestoreInProgress,
01616            RTI::RTIinternalError)
01617 {
01618     Message req, rep ;
01619 
01620     req.type = Message::TIME_ADVANCE_REQUEST ;
01621     req.setFedTime(certi_cast<RTIfedTime>()(theTime).getTime());
01622     privateRefs->executeService(&req, &rep);
01623 }
01624 
01625 // ----------------------------------------------------------------------------
01626 // Time Advance Request Available
01627 void
01628 RTI::RTIambassador::timeAdvanceRequestAvailable(const RTI::FedTime& theTime)
01629     throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress, 
01630        RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember, 
01631        RTI::EnableTimeConstrainedPending, RTI::EnableTimeRegulationPending, 
01632        RTI::TimeAdvanceAlreadyInProgress, RTI::FederationTimeAlreadyPassed, 
01633        RTI::InvalidFederationTime)
01634 {
01635     Message req, rep ;
01636 
01637     req.type = Message::TIME_ADVANCE_REQUEST_AVAILABLE ;
01638     req.setFedTime(certi_cast<RTIfedTime>()(theTime).getTime());
01639 
01640     privateRefs->executeService(&req, &rep);
01641 }
01642 
01643 // ----------------------------------------------------------------------------
01644 // Next Event Request
01645 void
01646 RTI::RTIambassador::nextEventRequest(const RTI::FedTime& theTime)
01647     throw (RTI::TimeAdvanceAlreadyInProgress,
01648            RTI::FederationTimeAlreadyPassed,
01649            RTI::InvalidFederationTime,
01650            RTI::EnableTimeRegulationPending, //not implemented
01651            RTI::EnableTimeConstrainedPending, //not implemented
01652            RTI::FederateNotExecutionMember,
01653            RTI::ConcurrentAccessAttempted,
01654            RTI::SaveInProgress,
01655            RTI::RestoreInProgress,
01656            RTI::RTIinternalError)
01657 {
01658     Message req, rep ;
01659 
01660     req.type = Message::NEXT_EVENT_REQUEST ;
01661     req.setFedTime(certi_cast<RTIfedTime>()(theTime).getTime());
01662     privateRefs->executeService(&req, &rep);
01663 }
01664 
01665 // ----------------------------------------------------------------------------
01666 // Next Event Request Available
01667 void
01668 RTI::RTIambassador::nextEventRequestAvailable(const RTI::FedTime& theTime)
01669     throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress, 
01670        RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember, 
01671        RTI::EnableTimeConstrainedPending, RTI::EnableTimeRegulationPending, 
01672        RTI::TimeAdvanceAlreadyInProgress, RTI::FederationTimeAlreadyPassed, 
01673        RTI::InvalidFederationTime)
01674 {
01675     Message req, rep ;
01676 
01677     req.type = Message::NEXT_EVENT_REQUEST_AVAILABLE ;
01678     req.setFedTime(certi_cast<RTIfedTime>()(theTime).getTime());
01679     privateRefs->executeService(&req, &rep);
01680 }
01681 
01682 // ----------------------------------------------------------------------------
01683 // Flush Queue Request
01684 void
01685 RTI::RTIambassador::flushQueueRequest(const RTI::FedTime& theTime)
01686     throw (RTI::TimeAdvanceAlreadyInProgress,
01687            RTI::FederationTimeAlreadyPassed,
01688            RTI::InvalidFederationTime,
01689            RTI::EnableTimeRegulationPending, //not implemented
01690            RTI::EnableTimeConstrainedPending, //not implemented
01691            RTI::FederateNotExecutionMember,
01692            RTI::ConcurrentAccessAttempted,
01693            RTI::SaveInProgress,
01694            RTI::RestoreInProgress,
01695            RTI::RTIinternalError)
01696 {
01697     throw RTI::RTIinternalError("Unimplemented Service flushQueueRequest");
01698     Message req, rep ;
01699 
01700     req.type = Message::FLUSH_QUEUE_REQUEST ;
01701     req.setFedTime(certi_cast<RTIfedTime>()(theTime).getTime());
01702 
01703     privateRefs->executeService(&req, &rep);
01704 }
01705 
01706 // ----------------------------------------------------------------------------
01707 // Enable Asynchronous Delivery
01708 void
01709 RTI::RTIambassador::enableAsynchronousDelivery()
01710     throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress, 
01711        RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember, 
01712        RTI::AsynchronousDeliveryAlreadyEnabled)
01713 {
01714     // throw AsynchronousDeliveryAlreadyEnabled("Default value (non HLA)");
01715 
01716     Message req, rep ;
01717 
01718     req.type = Message::ENABLE_ASYNCHRONOUS_DELIVERY ;
01719 
01720     privateRefs->executeService(&req, &rep);
01721 }
01722 
01723 // ----------------------------------------------------------------------------
01724 // Disable Asynchronous Delivery
01725 void
01726 RTI::RTIambassador::disableAsynchronousDelivery()
01727     throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress, 
01728        RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember, 
01729        RTI::AsynchronousDeliveryAlreadyDisabled)
01730 {
01731     Message req, rep ;
01732 
01733     req.type = Message::DISABLE_ASYNCHRONOUS_DELIVERY ;
01734 
01735     privateRefs->executeService(&req, &rep);
01736 }
01737 
01738 // ----------------------------------------------------------------------------
01739 // Query LBTS
01740 void
01741 RTI::RTIambassador::queryLBTS(RTI::FedTime& theTime)
01742     throw (RTI::FederateNotExecutionMember,
01743            RTI::ConcurrentAccessAttempted,
01744            RTI::SaveInProgress,
01745            RTI::RestoreInProgress,
01746            RTI::RTIinternalError)
01747 {
01748     Message req, rep ;
01749 
01750     req.type = Message::QUERY_LBTS ;
01751     privateRefs->executeService(&req, &rep);
01752 
01753     certi_cast<RTIfedTime>()(theTime) = rep.getFedTime();
01754 }
01755 
01756 // ----------------------------------------------------------------------------
01757 // Query Federate Time
01758 void
01759 RTI::RTIambassador::queryFederateTime(RTI::FedTime& theTime)
01760     throw (RTI::FederateNotExecutionMember,
01761            RTI::ConcurrentAccessAttempted,
01762            RTI::SaveInProgress,
01763            RTI::RestoreInProgress,
01764            RTI::RTIinternalError)
01765 {
01766     Message req, rep ;
01767 
01768     req.type = Message::QUERY_FEDERATE_TIME ;
01769     privateRefs->executeService(&req, &rep);
01770 
01771     certi_cast<RTIfedTime>()(theTime) = rep.getFedTime();
01772 }
01773 
01774 // ----------------------------------------------------------------------------
01775 // Query Minimum Next Event Time
01776 void
01777 RTI::RTIambassador::queryMinNextEventTime(RTI::FedTime& theTime)
01778     throw (RTI::FederateNotExecutionMember,
01779            RTI::ConcurrentAccessAttempted,
01780            RTI::SaveInProgress,
01781            RTI::RestoreInProgress,
01782            RTI::RTIinternalError)
01783 {
01784     Message req, rep ;
01785 
01786     req.type = Message::QUERY_MIN_NEXT_EVENT_TIME ;
01787     privateRefs->executeService(&req, &rep);
01788 
01789     certi_cast<RTIfedTime>()(theTime) = rep.getFedTime();
01790 }
01791 
01792 // ----------------------------------------------------------------------------
01793 // Modify Lookahead
01794 void
01795 RTI::RTIambassador::modifyLookahead(const RTI::FedTime& theLookahead)
01796     throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress, 
01797        RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember, 
01798        RTI::InvalidLookahead)
01799 {
01800     Message req, rep ;
01801 
01802     req.type = Message::MODIFY_LOOKAHEAD ;
01803     req.setLookahead(certi_cast<RTIfedTime>()(theLookahead).getTime());
01804 
01805     privateRefs->executeService(&req, &rep);
01806 }
01807 
01808 // ----------------------------------------------------------------------------
01809 // Query Lookahead
01810 void
01811 RTI::RTIambassador::queryLookahead(RTI::FedTime &theTime)
01812     throw (RTI::FederateNotExecutionMember,
01813            RTI::ConcurrentAccessAttempted,
01814            RTI::SaveInProgress,
01815            RTI::RestoreInProgress,
01816            RTI::RTIinternalError)
01817 {
01818     Message req, rep ;
01819 
01820     req.type = Message::QUERY_LOOKAHEAD ;
01821     privateRefs->executeService(&req, &rep);
01822 
01823     certi_cast<RTIfedTime>()(theTime) = rep.getFederationTimeDelta().getTime();
01824 }
01825 
01826 // ----------------------------------------------------------------------------
01827 // Retract
01828 void
01829 RTI::RTIambassador::retract(RTI::EventRetractionHandle handle)
01830     throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress, 
01831        RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember, 
01832        RTI::InvalidRetractionHandle)
01833 {
01834     throw RTI::RTIinternalError("Unimplemented Service retract");
01835     Message req, rep ;
01836 
01837     req.type = Message::RETRACT ;
01838     req.setEventRetraction(handle);
01839 
01840     privateRefs->executeService(&req, &rep);
01841 }
01842 
01843 // ----------------------------------------------------------------------------
01844 // Change Attribute Order Type
01845 void
01846 RTI::RTIambassador::changeAttributeOrderType(ObjectHandle theObject,
01847                                         const AttributeHandleSet& attrs,
01848                                         OrderingHandle theType)
01849     throw (RTI::RTIinternalError, 
01850        RTI::RestoreInProgress, RTI::SaveInProgress, RTI::ConcurrentAccessAttempted, 
01851        RTI::FederateNotExecutionMember, RTI::InvalidOrderingHandle, 
01852        RTI::AttributeNotOwned, RTI::AttributeNotDefined, RTI::ObjectNotKnown)
01853 {
01854     Message req, rep ;
01855 
01856     req.type = Message::CHANGE_ATTRIBUTE_ORDER_TYPE ;
01857     req.setObject(theObject);
01858     req.setOrdering(theType);
01859     req.setAHS(certi_cast<AttributeHandleSetImp>()(attrs).getAttributeHandles());
01860 
01861     privateRefs->executeService(&req, &rep);
01862 }
01863 
01864 // ----------------------------------------------------------------------------
01865 // Change Interaction Order Type
01866 void
01867 RTI::RTIambassador::changeInteractionOrderType(InteractionClassHandle theClass,
01868                                           OrderingHandle theType)
01869     throw (RTI::RTIinternalError, RTI::RestoreInProgress, 
01870        RTI::SaveInProgress, RTI::ConcurrentAccessAttempted, 
01871        RTI::FederateNotExecutionMember, RTI::InvalidOrderingHandle, 
01872        RTI::InteractionClassNotPublished, RTI::InteractionClassNotDefined)
01873 {
01874     Message req, rep ;
01875 
01876     req.type = Message::CHANGE_INTERACTION_ORDER_TYPE ;
01877     req.setInteractionClass(theClass);
01878     req.setOrdering(theType);
01879 
01880     privateRefs->executeService(&req, &rep);
01881 }
01882 
01883 // ----------------------------------------------------------------------------
01889 RTI::Region *
01890 RTI::RTIambassador::createRegion(SpaceHandle space, ULong nb_extents)
01891     throw (RTI::SpaceNotDefined,
01892            RTI::InvalidExtents,
01893            RTI::FederateNotExecutionMember,
01894            RTI::ConcurrentAccessAttempted,
01895            RTI::SaveInProgress,
01896            RTI::RestoreInProgress,
01897            RTI::RTIinternalError)
01898 {
01899     Message req, rep ;
01900     req.setType(Message::DDM_CREATE_REGION);
01901     req.setSpace(space);
01902     req.setNumber(nb_extents);
01903     privateRefs->executeService(&req, &rep);
01904     RTI::Region *region = new RegionImp(rep.getRegion(), space,
01905                    std::vector<Extent>(nb_extents,
01906                                Extent(rep.getNumber())));
01907 
01908     assert(region->getNumberOfExtents() == nb_extents);
01909     return region ;
01910 }
01911 
01912 // ----------------------------------------------------------------------------
01917 void
01918 RTI::RTIambassador::notifyAboutRegionModification(Region &r)
01919     throw (RTI::RegionNotKnown,
01920            RTI::InvalidExtents,
01921            RTI::FederateNotExecutionMember,
01922            RTI::ConcurrentAccessAttempted,
01923            RTI::SaveInProgress,
01924            RTI::RestoreInProgress,
01925            RTI::RTIinternalError)
01926 {
01927     try {
01928     FedRegion &region = dynamic_cast<FedRegion &>(r);
01929     D[pdDebug] << "Notify About Region " << region.getHandle()
01930            << " Modification" << endl ;
01931     Message req, rep ;
01932     
01933     req.setType(Message::DDM_MODIFY_REGION);
01934     req.setRegion(region.getHandle());
01935     req.setExtents(region.getExtents());
01936     
01937     privateRefs->executeService(&req, &rep);
01938     region.commit();
01939     }
01940     catch (std::bad_cast) {
01941     throw RegionNotKnown("");
01942     }
01943     catch (Exception &e) {
01944     throw ;
01945     }
01946 }
01947 
01948 // ----------------------------------------------------------------------------
01953 void
01954 RTI::RTIambassador::deleteRegion(Region *region)
01955     throw (RTI::RegionNotKnown,
01956            RTI::RegionInUse,
01957            RTI::FederateNotExecutionMember,
01958            RTI::ConcurrentAccessAttempted,
01959            RTI::SaveInProgress,
01960            RTI::RestoreInProgress,
01961            RTI::RTIinternalError)
01962 {
01963     if (region == 0) {
01964         throw RegionNotKnown("");
01965     }
01966 
01967     Message req, rep ;
01968 
01969     req.setType(Message::DDM_DELETE_REGION);
01970     try {
01971     req.setRegion(dynamic_cast<FedRegion *>(region)->getHandle());
01972     }
01973     catch (std::bad_cast) {
01974     throw RegionNotKnown("");
01975     }
01976     privateRefs->executeService(&req, &rep);
01977 
01978     delete region ;
01979 }
01980 
01981 // ----------------------------------------------------------------------------
01982 // Register Object Instance With Region
01983 ObjectHandle
01984 RTI::RTIambassador::registerObjectInstanceWithRegion(ObjectClassHandle object_class,
01985                                                 const char *tag,
01986                                                 AttributeHandle attrs[],
01987                                                 Region *regions[],
01988                                                 ULong nb)
01989     throw (RTI::ObjectClassNotDefined,
01990            RTI::ObjectClassNotPublished,
01991            RTI::AttributeNotDefined,
01992            RTI::AttributeNotPublished,
01993            RTI::RegionNotKnown,
01994            RTI::InvalidRegionContext,
01995            RTI::ObjectAlreadyRegistered,
01996            RTI::FederateNotExecutionMember,
01997            RTI::ConcurrentAccessAttempted,
01998            RTI::SaveInProgress,
01999            RTI::RestoreInProgress,
02000            RTI::RTIinternalError)
02001 {
02002     Message req, rep ;
02003 
02004     req.setType(Message::DDM_REGISTER_OBJECT);
02005     req.setObjectClass(object_class);
02006     if ( tag != NULL )
02007        {
02008        req.setTag(tag);
02009        }
02010     req.setAHS(attrs, nb);
02011     req.setRegions(build_region_handles(regions, nb));
02012 
02013     privateRefs->executeService(&req, &rep);
02014 
02015     return rep.getObject();
02016 }
02017 
02018 // ----------------------------------------------------------------------------
02019 ObjectHandle
02020 RTI::RTIambassador::registerObjectInstanceWithRegion(ObjectClassHandle object_class,
02021                                                 AttributeHandle attrs[],
02022                                                 Region *regions[],
02023                                                 ULong nb)
02024     throw (RTI::ObjectClassNotDefined,
02025            RTI::ObjectClassNotPublished,
02026            RTI::AttributeNotDefined,
02027            RTI::AttributeNotPublished,
02028            RTI::RegionNotKnown,
02029            RTI::InvalidRegionContext,
02030            RTI::FederateNotExecutionMember,
02031            RTI::ConcurrentAccessAttempted,
02032            RTI::SaveInProgress,
02033            RTI::RestoreInProgress,
02034            RTI::RTIinternalError)
02035 {
02036     Message req, rep ;
02037 
02038     req.setType(Message::DDM_REGISTER_OBJECT);
02039     req.setObjectClass(object_class);
02040     req.setAHS(attrs, nb);
02041     req.setRegions(build_region_handles(regions, nb));
02042 
02043     privateRefs->executeService(&req, &rep);
02044 
02045     return rep.getObject();
02046 }
02047 
02048 // ----------------------------------------------------------------------------
02056 void
02057 RTI::RTIambassador::associateRegionForUpdates(Region &region,
02058                                          ObjectHandle object,
02059                                          const AttributeHandleSet &attributes)
02060     throw (RTI::ObjectNotKnown,
02061            RTI::AttributeNotDefined,
02062            RTI::InvalidRegionContext,
02063            RTI::RegionNotKnown,
02064            RTI::FederateNotExecutionMember,
02065            RTI::ConcurrentAccessAttempted,
02066            RTI::SaveInProgress,
02067            RTI::RestoreInProgress,
02068            RTI::RTIinternalError)
02069 {
02070     D[pdDebug] << "+ Associate Region for Updates" << endl ;
02071 
02072     Message req, rep ;
02073     
02074     req.type = Message::DDM_ASSOCIATE_REGION ;
02075     req.setObject(object);
02076     req.setRegion(get_handle(region));
02077     req.setAHS(certi_cast<AttributeHandleSetImp>()(attributes).getAttributeHandles());
02078 
02079     privateRefs->executeService(&req, &rep);
02080     D[pdDebug] << "- Associate Region for Updates" << endl ;
02081 }
02082 
02083 // ----------------------------------------------------------------------------
02090 void
02091 RTI::RTIambassador::unassociateRegionForUpdates(Region &region,
02092                                            ObjectHandle object)
02093     throw (RTI::ObjectNotKnown,
02094            RTI::InvalidRegionContext,
02095            RTI::RegionNotKnown,
02096            RTI::FederateNotExecutionMember,
02097            RTI::ConcurrentAccessAttempted,
02098            RTI::SaveInProgress,
02099            RTI::RestoreInProgress,
02100            RTI::RTIinternalError)
02101 {
02102     D[pdDebug] << "+ Unassociate Region for Updates" << endl ;
02103     Message req, rep ;
02104 
02105     req.type = Message::DDM_UNASSOCIATE_REGION ;
02106     req.setObject(object);
02107     req.setRegion(get_handle(region));
02108 
02109     privateRefs->executeService(&req, &rep);
02110     D[pdDebug] << "- Unassociate Region for Updates" << endl ;
02111 }
02112 
02113 // ----------------------------------------------------------------------------
02121 void
02122 RTI::RTIambassador::subscribeObjectClassAttributesWithRegion(
02123     ObjectClassHandle object_class,
02124     Region &region,
02125     const AttributeHandleSet &attributes,
02126     Boolean passive)
02127     throw (RTI::ObjectClassNotDefined,
02128            RTI::AttributeNotDefined,
02129            RTI::RegionNotKnown,
02130            RTI::InvalidRegionContext,
02131            RTI::FederateNotExecutionMember,
02132            RTI::ConcurrentAccessAttempted,
02133            RTI::SaveInProgress,
02134            RTI::RestoreInProgress,
02135            RTI::RTIinternalError)
02136 {
02137     D[pdDebug] << "+ Subscribe Object Class Attributes with Region" << endl ;
02138     Message req, rep ;
02139 
02140     req.type = Message::DDM_SUBSCRIBE_ATTRIBUTES ;
02141     req.setObjectClass(object_class);
02142     req.setRegion(get_handle(region));
02143     req.setAHS(certi_cast<AttributeHandleSetImp>()(attributes).getAttributeHandles());
02144     req.setBoolean(passive);
02145 
02146     privateRefs->executeService(&req, &rep);
02147     D[pdDebug] << "- Subscribe Object Class Attributes with Region" << endl ;
02148 }
02149 
02150 // ----------------------------------------------------------------------------
02156 void
02157 RTI::RTIambassador::unsubscribeObjectClassWithRegion(ObjectClassHandle object_class,
02158                                                 Region &region)
02159     throw (RTI::ObjectClassNotDefined,
02160            RTI::RegionNotKnown,
02161            RTI::ObjectClassNotSubscribed,
02162            RTI::FederateNotExecutionMember,
02163            RTI::ConcurrentAccessAttempted,
02164            RTI::SaveInProgress,
02165            RTI::RestoreInProgress,
02166            RTI::RTIinternalError)
02167 {
02168     D[pdDebug] << "+ Unsubscribe Object Class " << object_class
02169            << " with Region" << endl ;
02170     Message req, rep ;
02171 
02172     req.type = Message::DDM_UNSUBSCRIBE_ATTRIBUTES ;
02173     req.setObjectClass(object_class);
02174     req.setRegion(get_handle(region));
02175 
02176     privateRefs->executeService(&req, &rep);
02177     D[pdDebug] << "- Unsubscribe Object Class with Region" << endl ;
02178 }
02179 
02180 // ----------------------------------------------------------------------------
02181 // Subscribe Interaction Class With Region
02182 void
02183 RTI::RTIambassador::subscribeInteractionClassWithRegion(InteractionClassHandle ic,
02184                                                    Region &region,
02185                                                    RTI::Boolean passive)
02186     throw (RTI::InteractionClassNotDefined,
02187            RTI::RegionNotKnown,
02188            RTI::InvalidRegionContext,
02189            RTI::FederateLoggingServiceCalls,
02190            RTI::FederateNotExecutionMember,
02191            RTI::ConcurrentAccessAttempted,
02192            RTI::SaveInProgress,
02193            RTI::RestoreInProgress,
02194            RTI::RTIinternalError)
02195 {
02196     Message req, rep ;
02197 
02198     req.type = Message::DDM_SUBSCRIBE_INTERACTION ;
02199     req.setInteractionClass(ic);
02200     req.setRegion(get_handle(region));
02201     req.setBoolean(passive);
02202 
02203     privateRefs->executeService(&req, &rep);
02204 }
02205 
02206 // ----------------------------------------------------------------------------
02207 // UnSubscribe Interaction Class With Region
02208 void
02209 RTI::RTIambassador::unsubscribeInteractionClassWithRegion(InteractionClassHandle ic,
02210                                                      Region &region)
02211     throw (RTI::InteractionClassNotDefined,
02212            RTI::InteractionClassNotSubscribed,
02213            RTI::RegionNotKnown,
02214            RTI::FederateNotExecutionMember,
02215            RTI::ConcurrentAccessAttempted,
02216            RTI::SaveInProgress,
02217            RTI::RestoreInProgress,
02218            RTI::RTIinternalError)
02219 {
02220     Message req, rep ;
02221 
02222     req.type = Message::DDM_UNSUBSCRIBE_INTERACTION ;
02223     req.setInteractionClass(ic);
02224     req.setRegion(get_handle(region));
02225 
02226     privateRefs->executeService(&req, &rep);
02227 }
02228 
02229 // ----------------------------------------------------------------------------
02230 // Send Interaction With Region
02231 RTI::EventRetractionHandle
02232 RTI::RTIambassador::sendInteractionWithRegion(InteractionClassHandle interaction,
02233                                          const ParameterHandleValuePairSet &par,
02234                                          const RTI::FedTime &time,
02235                                          const char *tag,
02236                                          const Region &region)
02237     throw (RTI::InteractionClassNotDefined,
02238            RTI::InteractionClassNotPublished,
02239            RTI::InteractionParameterNotDefined,
02240            RTI::InvalidFederationTime,
02241            RTI::RegionNotKnown,
02242            RTI::InvalidRegionContext,
02243            RTI::FederateNotExecutionMember,
02244            RTI::ConcurrentAccessAttempted,
02245            RTI::SaveInProgress,
02246            RTI::RestoreInProgress,
02247            RTI::RTIinternalError)
02248 {
02249     Message req, rep ;
02250 
02251     req.setType(Message::SEND_INTERACTION);
02252     req.setInteractionClass(interaction);
02253     req.setPHVPS(certi_cast<ParameterHandleValuePairSetImp>()(par).getParameterHandleValuePairs());
02254     req.setFedTime(certi_cast<RTIfedTime>()(time).getTime());
02255     if ( tag == NULL )
02256        {
02257        throw RTI::RTIinternalError ("Calling sendInteractionWithRegion with Tag NULL");
02258        }
02259     req.setTag(tag);
02260     req.setRegion(get_handle(region));
02261 
02262     privateRefs->executeService(&req, &rep);
02263 
02264     return rep.getEventRetraction();
02265 }
02266 
02267 // ----------------------------------------------------------------------------
02268 void
02269 RTI::RTIambassador::sendInteractionWithRegion(InteractionClassHandle interaction,
02270                                          const ParameterHandleValuePairSet &par,
02271                                          const char *tag,
02272                                          const Region &region)
02273     throw (RTI::InteractionClassNotDefined,
02274            RTI::InteractionClassNotPublished,
02275            RTI::InteractionParameterNotDefined,
02276            RTI::RegionNotKnown,
02277            RTI::InvalidRegionContext,
02278            RTI::FederateNotExecutionMember,
02279            RTI::ConcurrentAccessAttempted,
02280            RTI::SaveInProgress,
02281            RTI::RestoreInProgress,
02282            RTI::RTIinternalError)
02283 {
02284     Message req, rep ;
02285 
02286     req.setType(Message::SEND_INTERACTION);
02287     req.setInteractionClass(interaction);
02288     req.setPHVPS(certi_cast<ParameterHandleValuePairSetImp>()(par).getParameterHandleValuePairs());
02289     if ( tag == NULL )
02290        {
02291        throw RTI::RTIinternalError ("Calling sendInteractionWithRegion with Tag NULL");
02292        }
02293     req.setTag(tag);
02294     req.setRegion(get_handle(region));
02295 
02296     privateRefs->executeService(&req, &rep);
02297 }
02298 
02299 // ----------------------------------------------------------------------------
02300 // Request Class Attribute Value Update With Region
02301 void RTI::RTIambassador::
02302 requestClassAttributeValueUpdateWithRegion(ObjectClassHandle /*object*/,
02303                                            const AttributeHandleSet &attrs,
02304                                            const Region &region)
02305     throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress, 
02306        RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember, 
02307        RTI::RegionNotKnown, RTI::AttributeNotDefined, RTI::ObjectClassNotDefined)
02308 {
02309     throw RTI::RTIinternalError("unimplemented service requestClassAttributeValueUpdateWithRegion");
02310 
02311     Message req, rep ;
02312     req.setType(Message::DDM_REQUEST_UPDATE);
02313     req.setAHS(certi_cast<AttributeHandleSetImp>()(attrs).getAttributeHandles());
02314     req.setRegion(get_handle(region));
02315     privateRefs->executeService(&req, &rep);    
02316 }
02317 
02318 // ----------------------------------------------------------------------------
02322 ObjectClassHandle
02323 RTI::RTIambassador::getObjectClassHandle(const char *theName)
02324     throw (RTI::NameNotFound,
02325            RTI::FederateNotExecutionMember,
02326            RTI::ConcurrentAccessAttempted,
02327            RTI::RTIinternalError)
02328 {
02329     Message req, rep ;
02330 
02331     G.Out(pdGendoc,"enter RTIambassador::getObjectClassHandle");
02332 
02333     req.type = Message::GET_OBJECT_CLASS_HANDLE ;
02334     req.setName(theName);
02335     privateRefs->executeService(&req, &rep);
02336 
02337     G.Out(pdGendoc,"exit RTIambassador::getObjectClassHandle");
02338 
02339     return rep.getObjectClass();
02340 }
02341 
02342 // ----------------------------------------------------------------------------
02348 char *
02349 RTI::RTIambassador::getObjectClassName(ObjectClassHandle handle)
02350     throw (RTI::ObjectClassNotDefined,
02351            RTI::FederateNotExecutionMember,
02352            RTI::ConcurrentAccessAttempted,
02353            RTI::RTIinternalError)
02354 {
02355     Message req, rep ;
02356     req.type = Message::GET_OBJECT_CLASS_NAME ;
02357     req.setObjectClass(handle);
02358     privateRefs->executeService(&req, &rep);
02359     return hla_strdup(rep.getName());
02360 }
02361 
02362 // ----------------------------------------------------------------------------
02367 AttributeHandle
02368 RTI::RTIambassador::getAttributeHandle(const char *theName,
02369                                   ObjectClassHandle whichClass)
02370     throw (RTI::ObjectClassNotDefined,
02371            RTI::NameNotFound,
02372            RTI::FederateNotExecutionMember,
02373            RTI::ConcurrentAccessAttempted,
02374            RTI::RTIinternalError)
02375 {
02376     G.Out(pdGendoc,"enter RTI::RTIambassador::getAttributeHandle");
02377     Message req, rep ;
02378     req.type = Message::GET_ATTRIBUTE_HANDLE ;
02379     req.setName(theName);
02380     req.setObjectClass(whichClass);
02381     privateRefs->executeService(&req, &rep);
02382     G.Out(pdGendoc,"exit  RTI::RTIambassador::getAttributeHandle");
02383     return rep.getAttribute();
02384 }
02385 
02386 // ----------------------------------------------------------------------------
02392 char *
02393 RTI::RTIambassador::getAttributeName(AttributeHandle theHandle,
02394                                 ObjectClassHandle whichClass)
02395     throw (RTI::ObjectClassNotDefined,
02396            RTI::AttributeNotDefined,
02397            RTI::FederateNotExecutionMember,
02398            RTI::ConcurrentAccessAttempted,
02399            RTI::RTIinternalError)
02400 {
02401     Message req, rep ;
02402     req.type = Message::GET_ATTRIBUTE_NAME ;
02403     req.setAttribute(theHandle);
02404     req.setObjectClass(whichClass);
02405     privateRefs->executeService(&req, &rep);
02406     return hla_strdup(rep.getName());
02407 }
02408 
02409 // ----------------------------------------------------------------------------
02410 // Get Interaction Class Handle
02411 InteractionClassHandle
02412 RTI::RTIambassador::getInteractionClassHandle(const char *theName)
02413     throw (RTI::NameNotFound,
02414            RTI::FederateNotExecutionMember,
02415            RTI::ConcurrentAccessAttempted,
02416            RTI::RTIinternalError)
02417 {
02418     Message req, rep ;
02419 
02420     req.type = Message::GET_INTERACTION_CLASS_HANDLE ;
02421     req.setName(theName);
02422 
02423     privateRefs->executeService(&req, &rep);
02424 
02425     return rep.getInteractionClass();
02426 }
02427 
02428 // ----------------------------------------------------------------------------
02429 // Get Interaction Class Name
02430 char *
02431 RTI::RTIambassador::getInteractionClassName(InteractionClassHandle theHandle)
02432     throw (RTI::InteractionClassNotDefined,
02433            RTI::FederateNotExecutionMember,
02434            RTI::ConcurrentAccessAttempted,
02435            RTI::RTIinternalError)
02436 {
02437     Message req, rep ;
02438 
02439     req.type = Message::GET_INTERACTION_CLASS_NAME ;
02440     req.setInteractionClass(theHandle);
02441 
02442     privateRefs->executeService(&req, &rep);
02443 
02444     return hla_strdup(rep.getName());
02445 }
02446 
02447 // ----------------------------------------------------------------------------
02448 // Get Parameter Handle
02449 ParameterHandle
02450 RTI::RTIambassador::getParameterHandle(const char *theName,
02451                                   InteractionClassHandle whichClass)
02452     throw (RTI::InteractionClassNotDefined,
02453            RTI::NameNotFound,
02454            RTI::FederateNotExecutionMember,
02455            RTI::ConcurrentAccessAttempted,
02456            RTI::RTIinternalError)
02457 {
02458     Message req, rep ;
02459 
02460     req.type = Message::GET_PARAMETER_HANDLE ;
02461     req.setName(theName);
02462     req.setInteractionClass(whichClass);
02463 
02464     privateRefs->executeService(&req, &rep);
02465 
02466     return rep.getParameter();
02467 }
02468 
02469 // ----------------------------------------------------------------------------
02470 // Get Parameter Name
02471 char *
02472 RTI::RTIambassador::getParameterName(ParameterHandle theHandle,
02473                                 InteractionClassHandle whichClass)
02474     throw (RTI::InteractionClassNotDefined,
02475            RTI::InteractionParameterNotDefined,
02476            RTI::FederateNotExecutionMember,
02477            RTI::ConcurrentAccessAttempted,
02478            RTI::RTIinternalError)
02479 {
02480     Message req, rep ;
02481 
02482     req.type = Message::GET_PARAMETER_NAME ;
02483     req.setParameter(theHandle);
02484     req.setInteractionClass(whichClass);
02485 
02486     privateRefs->executeService(&req, &rep);
02487 
02488     return hla_strdup(rep.getName());
02489 }
02490 
02491 // ----------------------------------------------------------------------------
02492 // Get Object Instance Handle
02493 ObjectHandle
02494 RTI::RTIambassador::getObjectInstanceHandle(const char *theName)
02495     throw (RTI::RTIinternalError, RTI::ConcurrentAccessAttempted, 
02496    RTI::FederateNotExecutionMember, RTI::ObjectNotKnown)
02497 {
02498     Message req, rep ;
02499 
02500     req.type = Message::GET_OBJECT_INSTANCE_HANDLE ;
02501     req.setName(theName);
02502 
02503     privateRefs->executeService(&req, &rep);
02504 
02505     return rep.getObject();
02506 }
02507 
02508 // ----------------------------------------------------------------------------
02509 // Get Object Instance Name
02510 char *
02511 RTI::RTIambassador::getObjectInstanceName(ObjectHandle theHandle)
02512     throw (RTI::RTIinternalError, RTI::ConcurrentAccessAttempted, 
02513        RTI::FederateNotExecutionMember, RTI::ObjectNotKnown)
02514 {
02515     Message req, rep ;
02516 
02517     req.type = Message::GET_OBJECT_INSTANCE_NAME ;
02518     req.setObject(theHandle);
02519 
02520     privateRefs->executeService(&req, &rep);
02521 
02522     return hla_strdup(rep.getName());
02523 }
02524 
02525 // ----------------------------------------------------------------------------
02529 SpaceHandle
02530 RTI::RTIambassador::getRoutingSpaceHandle(const char *rs_name)
02531     throw (RTI::NameNotFound,
02532            RTI::FederateNotExecutionMember,
02533            RTI::ConcurrentAccessAttempted,
02534            RTI::RTIinternalError)
02535 {
02536     D[pdDebug] << "Get routing space handle: " << rs_name << endl ;
02537     Message req, rep ;
02538     req.type = Message::GET_SPACE_HANDLE ;
02539     req.setName(rs_name);
02540     privateRefs->executeService(&req, &rep);
02541     return rep.getSpace();
02542 }
02543 
02544 // ----------------------------------------------------------------------------
02548 char *
02549 RTI::RTIambassador::getRoutingSpaceName(SpaceHandle handle)
02550     throw (RTI::SpaceNotDefined,
02551            RTI::FederateNotExecutionMember,
02552            RTI::ConcurrentAccessAttempted,
02553            RTI::RTIinternalError)
02554 {
02555     Message req, rep ;
02556     req.type = Message::GET_SPACE_NAME ;
02557     req.setSpace(handle);
02558     privateRefs->executeService(&req, &rep);
02559     return hla_strdup(rep.getName());
02560 }
02561 
02562 // ----------------------------------------------------------------------------
02567 DimensionHandle
02568 RTI::RTIambassador::getDimensionHandle(const char *dimension,
02569                                   SpaceHandle space)
02570     throw (RTI::SpaceNotDefined,
02571            RTI::NameNotFound,
02572            RTI::FederateNotExecutionMember,
02573            RTI::ConcurrentAccessAttempted,
02574            RTI::RTIinternalError)
02575 {
02576     Message req, rep ;
02577     req.type = Message::GET_DIMENSION_HANDLE ;
02578     req.setName(dimension);
02579     req.setSpace(space);
02580     privateRefs->executeService(&req, &rep);
02581     return rep.getDimension();
02582 }
02583 
02584 // ----------------------------------------------------------------------------
02589 char *
02590 RTI::RTIambassador::getDimensionName(DimensionHandle dimension,
02591                                 SpaceHandle space)
02592     throw (RTI::SpaceNotDefined,
02593            RTI::DimensionNotDefined,
02594            RTI::FederateNotExecutionMember,
02595            RTI::ConcurrentAccessAttempted,
02596            RTI::RTIinternalError)
02597 {
02598     Message req, rep ;
02599     req.type = Message::GET_DIMENSION_NAME ;
02600     req.setDimension(dimension);
02601     req.setSpace(space);
02602     privateRefs->executeService(&req, &rep);
02603     return hla_strdup(rep.getName());
02604 }
02605 
02606 // ----------------------------------------------------------------------------
02612 SpaceHandle
02613 RTI::RTIambassador::getAttributeRoutingSpaceHandle(AttributeHandle attribute,
02614                                               ObjectClassHandle object_class)
02615     throw (RTI::ObjectClassNotDefined,
02616        RTI::AttributeNotDefined,
02617            RTI::FederateNotExecutionMember,
02618        RTI::ConcurrentAccessAttempted,
02619            RTI::RTIinternalError)
02620 {
02621     Message req, rep ;
02622     req.type = Message::GET_ATTRIBUTE_SPACE_HANDLE ;
02623     req.setAttribute(attribute);
02624     req.setObjectClass(object_class);
02625     privateRefs->executeService(&req, &rep);
02626     return rep.getSpace();
02627 }
02628 
02629 // ----------------------------------------------------------------------------
02630 // Get Object Class
02631 ObjectClassHandle
02632 RTI::RTIambassador::getObjectClass(ObjectHandle theObject)
02633     throw (RTI::RTIinternalError, RTI::ConcurrentAccessAttempted, 
02634        RTI::FederateNotExecutionMember, RTI::ObjectNotKnown)
02635 {
02636     Message req, rep ;
02637     req.type = Message::GET_OBJECT_CLASS ;
02638     req.setObject(theObject);
02639     privateRefs->executeService(&req, &rep);
02640     return rep.getObjectClass();
02641 }
02642 
02643 // ----------------------------------------------------------------------------
02648 SpaceHandle
02649 RTI::RTIambassador::getInteractionRoutingSpaceHandle(InteractionClassHandle inter)
02650     throw (RTI::InteractionClassNotDefined,
02651        RTI::FederateNotExecutionMember,
02652            RTI::ConcurrentAccessAttempted,
02653        RTI::RTIinternalError)
02654 {
02655     Message req, rep ;
02656     req.type = Message::GET_INTERACTION_SPACE_HANDLE ;
02657     req.setInteractionClass(inter);
02658     this->privateRefs->executeService(&req, &rep);
02659     return rep.getSpace();
02660 }
02661 
02662 // ----------------------------------------------------------------------------
02663 // Get Transportation Handle
02664 RTI::TransportationHandle
02665 RTI::RTIambassador::getTransportationHandle(const char *theName)
02666     throw (RTI::RTIinternalError, RTI::ConcurrentAccessAttempted, 
02667        RTI::FederateNotExecutionMember, RTI::NameNotFound)
02668 {
02669     Message req, rep ;
02670     req.type = Message::GET_TRANSPORTATION_HANDLE ;
02671     req.setName(theName);
02672     privateRefs->executeService(&req, &rep);
02673     return rep.getTransportation();
02674 }
02675 
02676 // ----------------------------------------------------------------------------
02677 // Get Transportation Name
02678 char *
02679 RTI::RTIambassador::getTransportationName(TransportationHandle theHandle)
02680     throw (RTI::RTIinternalError, RTI::ConcurrentAccessAttempted, 
02681        RTI::FederateNotExecutionMember, RTI::InvalidTransportationHandle)
02682 {
02683     Message req, rep ;
02684     req.type = Message::GET_TRANSPORTATION_NAME ;
02685     req.setTransportation(theHandle);
02686     privateRefs->executeService(&req, &rep);
02687     return hla_strdup(rep.getName());
02688 }
02689 
02690 // ----------------------------------------------------------------------------
02691 // Get Ordering Handle
02692 RTI::OrderingHandle
02693 RTI::RTIambassador::getOrderingHandle(const char *theName)
02694     throw (RTI::RTIinternalError, RTI::ConcurrentAccessAttempted, 
02695        RTI::FederateNotExecutionMember, RTI::NameNotFound)
02696 {
02697     Message req, rep ;
02698     req.type = Message::GET_ORDERING_HANDLE ;
02699     req.setName(theName);
02700     privateRefs->executeService(&req, &rep);
02701     return rep.getOrdering();
02702 }
02703 
02704 
02705 // ----------------------------------------------------------------------------
02706 // Get Ordering Name
02707 char *
02708 RTI::RTIambassador::getOrderingName(OrderingHandle theHandle)
02709     throw (RTI::RTIinternalError, RTI::ConcurrentAccessAttempted, 
02710        RTI::FederateNotExecutionMember, RTI::InvalidOrderingHandle)
02711 {
02712     Message req, rep ;
02713     req.type = Message::GET_ORDERING_NAME ;
02714     req.setOrdering(theHandle);
02715     privateRefs->executeService(&req, &rep);
02716     return hla_strdup(rep.getName());
02717 }
02718 
02737 void
02738 RTI::RTIambassador::enableClassRelevanceAdvisorySwitch()
02739     throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress, 
02740        RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember)
02741 {
02742     Message req, rep ;
02743 
02744     req.type = Message::ENABLE_CLASS_RELEVANCE_ADVISORY_SWITCH ;
02745     privateRefs->executeService(&req, &rep);
02746 }
02747 
02766 void
02767 RTI::RTIambassador::disableClassRelevanceAdvisorySwitch()
02768     throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress, 
02769        RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember)
02770 {
02771     Message req, rep ;
02772 
02773     req.type = Message::DISABLE_CLASS_RELEVANCE_ADVISORY_SWITCH ;
02774     privateRefs->executeService(&req, &rep);
02775 }
02776 
02796 void
02797 RTI::RTIambassador::enableAttributeRelevanceAdvisorySwitch()
02798     throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress, 
02799        RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember)
02800 {
02801     Message req, rep ;
02802 
02803     req.type = Message::ENABLE_ATTRIBUTE_RELEVANCE_ADVISORY_SWITCH ;
02804     privateRefs->executeService(&req, &rep);
02805 }
02806 
02826 void
02827 RTI::RTIambassador::disableAttributeRelevanceAdvisorySwitch()
02828     throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress, 
02829        RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember)
02830 {
02831     Message req, rep ;
02832 
02833     req.type = Message::DISABLE_ATTRIBUTE_RELEVANCE_ADVISORY_SWITCH ;
02834     privateRefs->executeService(&req, &rep);
02835 }
02836 
02855 void RTI::RTIambassador::enableAttributeScopeAdvisorySwitch()
02856     throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress, 
02857        RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember)
02858 {
02859     Message req, rep ;
02860 
02861     req.type = Message::ENABLE_ATTRIBUTE_SCOPE_ADVISORY_SWITCH ;
02862     privateRefs->executeService(&req, &rep);
02863 }
02864 
02883 void
02884 RTI::RTIambassador::disableAttributeScopeAdvisorySwitch()
02885     throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress, 
02886        RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember)
02887 {
02888     Message req, rep ;
02889 
02890     req.type = Message::DISABLE_ATTRIBUTE_SCOPE_ADVISORY_SWITCH ;
02891     privateRefs->executeService(&req, &rep);
02892 }
02893 
02912 void
02913 RTI::RTIambassador::enableInteractionRelevanceAdvisorySwitch()
02914     throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress, 
02915        RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember)
02916 {
02917     Message req, rep ;
02918 
02919     req.type = Message::ENABLE_INTERACTION_RELEVANCE_ADVISORY_SWITCH ;
02920     privateRefs->executeService(&req, &rep);
02921 }
02922 
02941 void
02942 RTI::RTIambassador::disableInteractionRelevanceAdvisorySwitch()
02943     throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress, 
02944        RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember)
02945 {
02946     Message req, rep ;
02947 
02948     req.type = Message::DISABLE_INTERACTION_RELEVANCE_ADVISORY_SWITCH ;
02949     privateRefs->executeService(&req, &rep);
02950 }
02951 
02952 // $Id: RTIambassador.cc,v 3.102 2009/04/02 19:58:06 erk Exp $

Generated on Thu Apr 30 15:53:49 2009 for CERTIDeveloperDocumentation by doxygen 1.5.5