certi-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[certi-cvs] applications/HLA_TestsSuite Interactive_Federat...


From: certi-cvs
Subject: [certi-cvs] applications/HLA_TestsSuite Interactive_Federat...
Date: Thu, 16 Apr 2009 14:55:28 +0000

CVSROOT:        /sources/certi
Module name:    applications
Changes by:     Pierre Siron <siron>    09/04/16 14:55:28

Modified files:
        HLA_TestsSuite : Interactive_Federation.fed 
                         Interactive_Federate.cc 

Log message:
        New menu for this interactve federate.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/applications/HLA_TestsSuite/Interactive_Federation.fed?cvsroot=certi&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/applications/HLA_TestsSuite/Interactive_Federate.cc?cvsroot=certi&r1=1.2&r2=1.3

Patches:
Index: Interactive_Federation.fed
===================================================================
RCS file: 
/sources/certi/applications/HLA_TestsSuite/Interactive_Federation.fed,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- Interactive_Federation.fed  3 Jun 2008 09:30:05 -0000       1.1
+++ Interactive_Federation.fed  16 Apr 2009 14:55:28 -0000      1.2
@@ -1,6 +1,6 @@
-;; Interactive_Federation
+;; Federation_Interactive
 (Fed
-  (Federation Interactive_Federation)
+  (Federation Federation_Interactive)
   (FedVersion v1.3)
   (Spaces
   )

Index: Interactive_Federate.cc
===================================================================
RCS file: /sources/certi/applications/HLA_TestsSuite/Interactive_Federate.cc,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- Interactive_Federate.cc     18 Jun 2008 14:24:22 -0000      1.2
+++ Interactive_Federate.cc     16 Apr 2009 14:55:28 -0000      1.3
@@ -3,12 +3,19 @@
 #include <NullFederateAmbassador.hh>
 
 #include <iostream>
-#include <cstdlib>
+using namespace std;
+
+
+// VARIABLES GLOBALES
+
 
 RTIfedTime* temps = new RTIfedTime(0.0);
 RTIfedTime* lookahead = new RTIfedTime(1.0);
 RTIfedTime ft;
 
+bool timeRegulation = false;
+bool timeConstrained = false;
+
 class Federe_Interactif : public RTI::RTIambassador, public 
NullFederateAmbassador
 {
 public:
@@ -16,6 +23,29 @@
   virtual ~Federe_Interactif() throw (RTI::FederateInternalError) {}
   
 private:
+
+  void timeRegulationEnabled(const RTI::FedTime& theTime)
+    throw (
+      RTI::InvalidFederationTime,
+      RTI::EnableTimeRegulationWasNotPending,
+      RTI::FederateInternalError)
+  {
+     std::cout << std::endl << "callback timeRegulationEnabled pour l'instant 
" <<
+               ((RTIfedTime&)theTime).getTime() << std::endl;
+     timeRegulation = true;
+  }
+
+  void timeConstrainedEnabled(const RTI::FedTime& theTime)
+    throw (
+      RTI::InvalidFederationTime,
+      RTI::EnableTimeConstrainedWasNotPending,
+      RTI::FederateInternalError)
+  {
+     std::cout << std::endl << "callback timeRegulationConstrained pour 
l'instant " <<
+               ((RTIfedTime&)theTime).getTime() << std::endl;
+     timeConstrained = true;
+  }
+
   void timeAdvanceGrant (const RTI::FedTime& theTime)
   throw (
     RTI::InvalidFederationTime,
@@ -27,24 +57,24 @@
   }
 
   void receiveInteraction (
-          RTI::InteractionClassHandle       theInteraction, // supplied C1
-    const RTI::ParameterHandleValuePairSet& theParameters,  // supplied C4
-    const RTI::FedTime&                     theTime,        // supplied C4
-    const char                             *theTag,         // supplied C4
-          RTI::EventRetractionHandle        theHandle)      // supplied C1
+          RTI::InteractionClassHandle       theInteraction,
+    const RTI::ParameterHandleValuePairSet& theParameters,
+    const RTI::FedTime&                     theTime,
+    const char                             *theTag,
+          RTI::EventRetractionHandle        theHandle)
   throw (
     RTI::InteractionClassNotKnown,
     RTI::InteractionParameterNotKnown,
     RTI::InvalidFederationTime,
     RTI::FederateInternalError)
   {
-    std::cout << std::endl << "t=" << ((RTIfedTime&)theTime).getTime() << " : 
<----- receiveInteraction(" << ((RTIfedTime&)theTime).getTime() << ")" << 
std::endl;
+    std::cout << std::endl << "t=" << ((RTIfedTime&)theTime).getTime() << " : 
<----- receiveInteraction(" << ((RTIfedTime&)theTime).getTime() << ")" << 
theTag << std::endl;
   }
 
   void receiveInteraction (
-          RTI::InteractionClassHandle       theInteraction, // supplied C1
-    const RTI::ParameterHandleValuePairSet& theParameters,  // supplied C4
-    const char                             *theTag)         // supplied C4
+          RTI::InteractionClassHandle       theInteraction,
+    const RTI::ParameterHandleValuePairSet& theParameters,
+    const char                             *theTag)
   throw (
     RTI::InteractionClassNotKnown,
     RTI::InteractionParameterNotKnown,
@@ -54,6 +84,28 @@
   }
 };
 
+void print_menu (void);
+void callTICK (void);
+void callCFE (void);
+void callJFE (char * name);
+void callRFE (void);
+void callDFE (void);
+void callPIC (void);
+void callSIC (void);
+void callSI (void);
+void callETR(void);
+void callETC(void);
+void callTAR(void);
+void callTARA(void);
+void callNER(void);
+void callNERA(void);
+void callEAD(void);
+void callDAD(void);
+void callQLBTS(void);
+void callQMNET(void);
+void callML(void);
+void callQL(void);
+void callCIOT(void);
 
 //VARIABLE
 Federe_Interactif* myFedere_Interactif = new Federe_Interactif();
@@ -64,199 +116,425 @@
   int i;
   float d;
   char c, entree;
+  string commande;
 
   if (argc!=2)
   {
-    std::cout <<"Vous devez donner en parametre le nom du federe" << std::endl;
+    cout <<"Vous devez donner en parametre le nom du federe" << endl;
     exit(1);
   }
 
   while(1)
   {
-    std::cout <<"Voulez-vous creer la federation ? [y/n]" << std::endl;
+    cout <<"Voulez-vous un preambule automatique [y/n]" << endl;
     scanf("%c", &c);
     scanf("%c", &entree);
     if (c=='y' || c=='n') break;
-    std::cout <<"Vous devez entrer 'y' ou 'n'" << std::endl;
+    cout <<"Vous devez entrer 'y' ou 'n'" << endl;
   }
 
-//CREER
+
   if (c=='y')
   {
-    
myFedere_Interactif->createFederationExecution("Interactive_Federation","Interactive_Federation.fed");
-    std::cout << "federation creee" << std::endl;
-  }
+    //CREER
+    callCFE ();
 
-//REJOINDRE
-  myFedere_Interactif->joinFederationExecution(argv[1], 
"Interactive_Federation", myFedere_Interactif);
-  std::cout << "federation rejointe" << std::endl;
+    //REJOINDRE
+    callJFE (argv[1]);
 
-//PUBLIER
-  
myFedere_Interactif->publishInteractionClass(myFedere_Interactif->getInteractionClassHandle("msg"));
-  std::cout << "interaction publiee" << std::endl;
+    //PUBLIER INTERACTION
+    callPIC ();
 
-//SOUSCRIRE
-  
myFedere_Interactif->subscribeInteractionClass(myFedere_Interactif->getInteractionClassHandle("msg"),
 RTI::RTI_TRUE);
-  std::cout << "interaction souscrite" << std::endl;
+    //SOUSCRIRE INTERACTION
+    callSIC ();
 
-//DECLARER REGULATEUR ET CONTRAINT
-#define WITH_CERTI
-#ifdef WITH_CERTI
-  myFedere_Interactif->queryFederateTime(*temps);
-  myFedere_Interactif->enableTimeRegulation(*temps, *lookahead);
-  myFedere_Interactif->enableTimeConstrained();
-  // myFedere_Interactif->modifyLookahead(*(new RTIfedTime(1.0)));
-#else
-  bool timeRegulation = false;
-  while (!timeRegulation)
-  {
-    try
-      { myFedere_Interactif->enableTimeRegulation(*temps,*lookahead); }
-    catch (RTI::EnableTimeRegulationPending&)
-      { myFedere_Interactif->tick(0.1, 0.2); }
-    catch (RTI::TimeRegulationAlreadyEnabled&)
-      { timeRegulation = true; }
+    //DECLARER REGULATEUR ET CONTRAINT
+    callETR ();
+    callETC ();
   }
-  bool timeConstrained = false;
-  while (!timeConstrained)
-  {
-  try
-    { myFedere_Interactif->enableTimeConstrained(); }
-  catch (RTI::EnableTimeConstrainedPending&)
-    { myFedere_Interactif->tick(0.1, 0.2); }
-  catch (RTI::TimeConstrainedAlreadyEnabled&)
-    { timeConstrained = true; }
-  }
-#endif
-  std::cout << "federe regulateur et contraint" << std::endl;
-
-//SYNCHRONISER
-  std::cout << std::endl << "Synchro manuel, tapez ENTREE continuer";
-  getchar();
-  std::cout << "federation synchronisee" << std::endl << std::endl;
+
+  //MENU PRINCIPAL
   
   while(1)
   {
-    while(1)
-    {
-      std::cout << std::endl <<"Choisissez une action : " << std::endl;
-      std::cout <<"  1 : timeAdvanceRequest" << std::endl;
-      std::cout <<"  2 : nextEventRequest" << std::endl;
-      std::cout <<"  3 : sendInteraction" << std::endl;
-      std::cout <<"  5 : tick()" << std::endl;
-      std::cout <<"  6 : queryLBTS" << std::endl;
-      std::cout <<"  7 : queryMinNextEventTime" << std::endl;
-      std::cout <<"  8 : queryLookahead" << std::endl;
-      std::cout <<"  9 : timeAdvanceRequestAvailable" << std::endl;
-      std::cout <<"  10 : nextEventRequestAvailable" << std::endl;
-      std::cout <<"  20 : Quitter la federation" << std::endl;
-      if (c=='y')
-        std::cout <<"  21 : Detruire la federation" << std::endl;
-      scanf("%i", &i);
-      scanf("%c", &entree);
-      if (i==1 || i==2 || i==3 || i==5 || i==6 || i==7 || i==8 || i==9 || 
i==10 || i==20) break;
-      if (c=='y')
-        { if (i==21) break; }
-      if (c=='n')
-        std::cout <<"Vous devez entrer 1, ..., 10 ou 20" << std::endl << 
std::endl;
-      if (c=='y')
-        std::cout <<"Vous devez entrer 1, ..., 10 ou 21" << std::endl << 
std::endl;
-    }
+      cout << endl <<"Choisissez une action : " << endl;
+      cin >> commande;
 
-//TIME_ADVANCE_REQUEST
-    if (i==1)
-    {
-      std::cout << std::endl << "t=" << temps->getTime() << " : Donner la date 
a laquelle vous souhaitez avancer : ";
-      scanf("%f", &d);
-      scanf("%c", &entree);
-      myFedere_Interactif->timeAdvanceRequest(*(new RTIfedTime(d)));
-      std::cout << std::endl << "t=" << temps->getTime() << " : -----> 
timeAdvanceRequest(" << d << ")" << std::endl;
+      if (commande=="q" || commande=="quit") break;
+      else if (commande=="h" || commande=="help") print_menu();
+      else if (commande=="t") callTICK();
+      else if (commande=="cfe") callCFE();
+      else if (commande=="dfe") callDFE();
+      else if (commande=="jfe") callJFE(argv[1]);
+      else if (commande=="rfe") callRFE();
+      else if (commande=="pic") callPIC();
+      else if (commande=="sic") callSIC();
+      else if (commande=="si") callSI();
+      else if (commande=="etr") callETR();
+      else if (commande=="etc") callETC();
+      else if (commande=="tar") callTAR();
+      else if (commande=="tara") callTARA();
+      else if (commande=="ner") callNER();
+      else if (commande=="nera") callNERA();
+      else if (commande=="ead") callEAD();
+      else if (commande=="dad") callDAD();
+      else if (commande=="qlbts") callQLBTS();
+      else if (commande=="qmnet") callQMNET();
+      else if (commande=="ml") callML();
+      else if (commande=="ql") callQL();
+      else if (commande=="ciot") callCIOT();
+      else cout << " commande inconnue " << endl;
     }
 
-//NEXT_EVENT_REQUEST
-    else if (i==2)
-    {
-      std::cout << std::endl << "t=" << temps->getTime() << " : Donner la date 
a laquelle vous souhaitez avancer : ";
-      scanf("%f", &d);
-      scanf("%c", &entree);
-      myFedere_Interactif->nextEventRequest(*(new RTIfedTime(d)));
-      std::cout << std::endl << "t=" << temps->getTime() << " : -----> 
nextEventRequest(" << d << ")" << std::endl;
-    }
+  exit(1);
+}
 
-//SEND_INTERACTION
-    else if (i==3)
-    {
-      std::cout << std::endl << "t=" << temps->getTime() << " : Donner la 
valeur de l'estampille voulue : ";
-      scanf("%f", &d);
-      scanf("%c", &entree);
-      
myFedere_Interactif->sendInteraction(myFedere_Interactif->getInteractionClassHandle("msg"),
 *(RTI::ParameterSetFactory::create(0)), *(new RTIfedTime(d)), "msg");
-      std::cout << std::endl << "t=" << temps->getTime() << " : -----> 
sendInteraction(getInteractionClassHandle(-, -, " << d << ", -)" << std::endl;
-    }
+void print_menu (void) {
+   cout << "liste de commandes utilitaires :" << endl;
+   cout << "t" << endl;
+   cout << "liste de commandes Federation Management :" << endl;
+   cout << "cfe dfe jfe rfe" << endl;
+   cout << "liste de commandes Declaration Management :" << endl;
+   cout << "pic sic" << endl;
+   cout << "liste de commandes Object Management :" << endl;
+   cout << "si" << endl;
+   cout << "liste de commandes Time Management :" << endl;
+   cout << "etr etc tar tara ner nera ead dad qlbts qmnet ml ql ciot" << endl;
 
-//TICK
-    else if (i==5)
-    {
+}
+
+void callTICK (void) {
+    cout << endl << "t=" << temps->getTime() << " : -----> tick" << endl;
       myFedere_Interactif->tick(0.1, 0.2);
-      std::cout << std::endl << "t=" << temps->getTime() << " : -----> tick" 
<< std::endl;
-    }
+}
 
-//REQUEST_LBTS
-    else if (i==6)
-    {
-      myFedere_Interactif->queryLBTS(ft);
-      std::cout << std::endl << "LBTS=" << ft.getTime() << std::endl;
+// FEDERARION MANAGEMENT
+// createFederationExecution
+void callCFE (void) {
+    int test = 1;
+    try {
+       
myFedere_Interactif->createFederationExecution("Federation_Interactive","Interactive_Federation.fed");
+    }
+    catch (RTI::Exception& e) {
+        test = 0;
+        std::cout << "catch " << e._name << " reason " << e._reason 
<<std::endl;
     }
-
-//REQUEST_MIN_NEXT_EVENT_TIME
-    else if (i==7)
-    {
-      myFedere_Interactif->queryMinNextEventTime(ft);
-      std::cout << std::endl << "MinNextEventTime=" << ft.getTime() << 
std::endl;
+    if (test)
+       std::cout << "federation creee" << std::endl;
+    else
+       std::cout << "federation non creee" << std::endl;
+}
+// deleteFederationExecution
+void callDFE (void) {
+    int test = 1;
+    try {
+       
myFedere_Interactif->destroyFederationExecution("Federation_Interactive");
+    }
+    catch (RTI::Exception& e) {
+        test = 0;
+        std::cout << "catch " << e._name << " reason " << e._reason 
<<std::endl;
+    }
+    if (test)
+       std::cout << "federation detruite" << std::endl;
+    else
+       std::cout << "federation non detruite" << std::endl;
+}
+// joinFederationExecution
+void callJFE (char *name) {
+    int test = 1;
+    try {
+       myFedere_Interactif->joinFederationExecution(name, 
"Federation_Interactive", myFedere_Interactif);
+    }
+    catch (RTI::Exception& e) {
+        test = 0;
+        std::cout << "catch " << e._name << " reason " << e._reason 
<<std::endl;
     }
+    if (test)
+       std::cout << "federation rejointe" << std::endl;
+    else
+       std::cout << "federation non rejointe" << std::endl;
+}
+// resignFederationExecution
+void callRFE (void) {
+    int test = 1;
+    try {
+       
myFedere_Interactif->resignFederationExecution(RTI::DELETE_OBJECTS_AND_RELEASE_ATTRIBUTES);
+    }
+    catch (RTI::Exception& e) {
+        test = 0;
+        std::cout << "catch " << e._name << " reason " << e._reason 
<<std::endl;
+    }
+    if (test)
+       std::cout << "federation quittee" << std::endl;
+    else
+       std::cout << "federation non quittee" << std::endl;
+}
+// DECLARATION MANAGEMENT
+// publishInteractionClass
+void callPIC (void) {
+    int test = 1;
+    try {
+       
myFedere_Interactif->publishInteractionClass(myFedere_Interactif->getInteractionClassHandle("msg"));
+    }
+    catch (RTI::Exception& e) {
+        test = 0;
+        std::cout << "catch " << e._name << " reason " << e._reason 
<<std::endl;
+    }
+    if (test)
+       std::cout << "interaction publiee" << std::endl;
+    else
+       std::cout << "interaction non publiee" << std::endl;
+}
+// subscribeInteractionClass
+void callSIC (void) {
+    int test = 1;
+    try {
+       
myFedere_Interactif->subscribeInteractionClass(myFedere_Interactif->getInteractionClassHandle("msg"),
 RTI::RTI_TRUE);
+    }
+    catch (RTI::Exception& e) {
+        test = 0;
+        cout << "catch " << e._name << " reason " << e._reason << endl;
+    }
+    if (test)
+       cout << "interaction souscrite" << endl;
+    else
+       cout << "interaction non souscrite" << endl;
+}
+// OBJECT MANAGEMENT
+// sendInteraction
+void callSI (void) {
+    float d;
+    int test = 1;
+    cout << endl << "t=" << temps->getTime() << " : Donner la valeur de 
l'estampille voulue : ";
+    cin >> d;
+    try {
+        
myFedere_Interactif->sendInteraction(myFedere_Interactif->getInteractionClassHandle("msg"),
+                                             
*(RTI::ParameterSetFactory::create(0)),
+                                             *(new RTIfedTime(d)),
+                                             "msg");
+    }
+    catch (RTI::Exception& e) {
+        test = 0;
+        cout << "catch " << e._name << " reason " << e._reason << endl;
+    }
+    if (test)
+       cout << "interaction envoyee (estampillee " << d << ")" << endl;
+    else
+       cout << "interaction non envoyee" << endl;
+}
 
-//REQUEST_LOOKAHEAD
-    else if (i==8)
+// TIME MANAGEMENT
+// enableTimeRegulation
+void callETR (void) {
+    try {
+       myFedere_Interactif->enableTimeRegulation(*temps,*lookahead);
+    }
+    catch (RTI::Exception& e) {
+        cout << "catch " << e._name << " reason " << e._reason << endl;
+    }
+    while (!timeRegulation)
     {
-      myFedere_Interactif->queryLookahead(ft);
-      std::cout << std::endl << "Lookahead=" << ft.getTime() << std::endl;
+        myFedere_Interactif->tick(0.1, 0.2);
     }
-
-//TIME_ADVANCE_REQUEST_AVAILABLE
-    else if (i==9)
+    cout << "federe regulateur" << endl;
+}
+// enableTimeConstrained
+void callETC (void) {
+    try {
+       myFedere_Interactif->enableTimeConstrained();
+    }
+    catch (RTI::Exception& e) {
+        cout << "catch " << e._name << " reason " << e._reason << endl;
+    }
+    while (!timeConstrained)
     {
-      std::cout << std::endl << "t=" << temps->getTime() << " : Donner la date 
a laquelle vous souhaitez avancer : ";
-      scanf("%f", &d);
-      scanf("%c", &entree);
+        myFedere_Interactif->tick(0.1, 0.2);
+
+    }
+    cout << "federe contraint" << endl;
+}
+// timeAdvanceRequest
+void callTAR (void) {
+    float d;
+    int test = 1;
+    cout << endl << "t=" << temps->getTime() << " : Donner la date a laquelle 
vous souhaitez avancer : ";
+    cin >> d;
+    try {
+       myFedere_Interactif->timeAdvanceRequest(*(new RTIfedTime(d)));
+    }
+    catch (RTI::Exception& e) {
+        test = 0;
+        cout << "catch " << e._name << " reason " << e._reason << endl;
+    }
+    if (test)
+       cout << endl << "t=" << temps->getTime() << " timeAdvanceRequest(" << d 
<< ")" << endl;
+    else
+       cout << "timeAdvanceRequest a echoue" << endl;
+}
+// timeAdvanceRequestAvailable
+void callTARA (void) {
+    float d;
+    int test = 1;
+    cout << endl << "t=" << temps->getTime() << " : Donner la date a laquelle 
vous souhaitez avancer : ";
+    cin >> d;
+    try {
       myFedere_Interactif->timeAdvanceRequestAvailable(*(new RTIfedTime(d)));
-      std::cout << std::endl << "t=" << temps->getTime() << " : -----> 
timeAdvanceRequestAvailable(" << d << ")" << std::endl;
     }
-
-//NEXT_EVENT_REQUEST_AVAILABLE
-    else if (i==10)
-    {
-      std::cout << std::endl << "t=" << temps->getTime() << " : Donner la date 
a laquelle vous souhaitez avancer : ";
-      scanf("%f", &d);
-      scanf("%c", &entree);
+    catch (RTI::Exception& e) {
+        test = 0;
+        cout << "catch " << e._name << " reason " << e._reason << endl;
+    }
+    if (test)
+       cout << endl << "t=" << temps->getTime() << " 
timeAdvanceRequestAvailable(" << d << ")" << endl;
+    else
+       cout << "timeAdvanceRequestAvailable a echoue" << endl;
+}
+// nextEventRequest
+void callNER (void) {
+    float d;
+    int test = 1;
+    cout << endl << "t=" << temps->getTime() << " : Donner la date a laquelle 
vous souhaitez avancer : ";
+    cin >> d;
+    try {
+       myFedere_Interactif->nextEventRequest(*(new RTIfedTime(d)));
+    }
+    catch (RTI::Exception& e) {
+        test = 0;
+        cout << "catch " << e._name << " reason " << e._reason << endl;
+    }
+    if (test)
+       cout << endl << "t=" << temps->getTime() << " nextEventRequest(" << d 
<< ")" << endl;
+    else
+       cout << "nextEventRequest a echoue" << endl;
+}
+// nextEventRequestAvailable
+void callNERA (void) {
+    float d;
+    int test = 1;
+    cout << endl << "t=" << temps->getTime() << " : Donner la date a laquelle 
vous souhaitez avancer : ";
+    cin >> d;
+    try {
       myFedere_Interactif->nextEventRequestAvailable(*(new RTIfedTime(d)));
-      std::cout << std::endl << "t=" << temps->getTime() << " : -----> 
nextEventRequestAvailable(" << d << ")" << std::endl;
     }
-//QUITTER
-    else if (i==20)
-    {
-      
myFedere_Interactif->resignFederationExecution(RTI::DELETE_OBJECTS_AND_RELEASE_ATTRIBUTES);
-      std::cout << std::endl << "federation quittee" << std::endl;
-      if (c=='n')
-        break;
+    catch (RTI::Exception& e) {
+        test = 0;
+        cout << "catch " << e._name << " reason " << e._reason << endl;
+    }
+    if (test)
+       cout << endl << "t=" << temps->getTime() << " 
nextEventRequestAvailable(" << d << ")" << endl;
+    else
+       cout << "nextEventRequestAvailable a echoue" << endl;
+}
+// enableAsynchronousDelivery
+void callEAD (void) {
+    int test = 1;
+    try {
+       myFedere_Interactif->enableAsynchronousDelivery();
+    }
+    catch (RTI::Exception& e) {
+        test = 0;
+        cout << "catch " << e._name << " reason " << e._reason << endl;
+    }
+    if (test)
+       cout << "asynchronous delivery enabled" << endl;
+    else
+       cout << "enableAsynchronousDelivery has failed" << endl;
+}
+// disableAsynchronousDelivery
+void callDAD (void) {
+    int test = 1;
+    try {
+       myFedere_Interactif->disableAsynchronousDelivery();
+    }
+    catch (RTI::Exception& e) {
+        test = 0;
+        cout << "catch " << e._name << " reason " << e._reason << endl;
+    }
+    if (test)
+       cout << "asynchronous delivery disabled" << endl;
+    else
+       cout << "disableAsynchronousDelivery has failed" << endl;
+}
+// queryLBTS
+void callQLBTS (void) {
+    int test = 1;
+    try {
+       myFedere_Interactif->queryLBTS(ft);
     }
-
-//DETRUIRE
-    else if (i==21)
-    {
-      
myFedere_Interactif->destroyFederationExecution("Federation_Interactive");
-      std::cout << std::endl << "federation detruite" << std::endl;
-      break;
+    catch (RTI::Exception& e) {
+        test = 0;
+        cout << "catch " << e._name << " reason " << e._reason << endl;
+    }
+    if (test)
+       cout << endl << "LBTS=" << ft.getTime() << endl;
+    else
+       cout << "queryLBTS has failed" << endl;
+}
+// queryMinNextEventTime
+void callQMNET (void) {
+    int test = 1;
+    try {
+       myFedere_Interactif->queryMinNextEventTime(ft);
     }
+    catch (RTI::Exception& e) {
+        test = 0;
+        cout << "catch " << e._name << " reason " << e._reason << endl;
+    }
+    if (test)
+       cout << endl << "MinNextEventTime=" << ft.getTime() << endl;
+    else
+       cout << "queryMinNextEventTime has failed" << endl;
+}
+// modifyLookahead
+void callML (void) {
+    float d;
+    int test = 1;
+    cout << endl << "t=" << temps->getTime() << " : Donner la valeur du 
lookahead voulu : ";
+    cin >> d;
+    try {
+       myFedere_Interactif->modifyLookahead( *(new RTIfedTime(d)) );
+    }
+    catch (RTI::Exception& e) {
+        test = 0;
+        cout << "catch " << e._name << " reason " << e._reason << endl;
+    }
+    if (test)
+       cout << endl << "t=" << temps->getTime() << " modifyLookahead(" << d << 
" )" << endl;
+    else
+       cout << "modifyLookahead has failed" << endl;
+}
+// queryLookahead
+void callQL (void) {
+    int test = 1;
+    try {
+       myFedere_Interactif->queryLookahead(ft);
   }
-
-  exit(0);
+    catch (RTI::Exception& e) {
+        test = 0;
+        cout << "catch " << e._name << " reason " << e._reason << endl;
+    }
+    if (test)
+       cout << endl << "Lookahead=" << ft.getTime() << endl;
+    else
+       cout << "queryLookahead has failed" << endl;
+}
+// changeInteractionOrderType
+void callCIOT (void) {
+    int test = 1;
+    int type ;
+    cout << "ordre RECEIVE (1) ou TIMESTAMP (2) ?" << endl ;
+    cin >> type ;
+    try {
+       
myFedere_Interactif->changeInteractionOrderType(myFedere_Interactif->getInteractionClassHandle("msg"),
+                                                       type);
+    }
+    catch (RTI::Exception& e) {
+        test = 0;
+        cout << "catch " << e._name << " reason " << e._reason << endl;
+    }
+    if (test)
+       cout << endl << "Nouveau type d'ordre pour l'interaction = " << type << 
endl;
+    else
+       cout << "changeInteractionOrderType" << endl;
 }
+




reply via email to

[Prev in Thread] Current Thread [Next in Thread]