certi-cvs
[Top][All Lists]
Advanced

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

[certi-cvs] certi AUTHORS myconf RTIA/Communications.cc RTI...


From: certi-cvs
Subject: [certi-cvs] certi AUTHORS myconf RTIA/Communications.cc RTI...
Date: Wed, 23 Apr 2008 07:36:02 +0000

CVSROOT:        /sources/certi
Module name:    certi
Changes by:     Pierre Siron <siron>    08/04/23 07:36:02

Modified files:
        .              : AUTHORS myconf 
        RTIA           : Communications.cc Communications.hh RTIA.cc 
                         RTIA.hh RTIA_federate.cc TimeManagement.cc 
                         TimeManagement.hh 
        include        : RTIambServices.hh 
        libCERTI       : Message.cc Message.hh Message_R.cc Message_W.cc 
        libRTI         : RTIambPrivateRefs.cc RTIambassador.cc 

Log message:
        Correction of the #22798 bug by Petr Gotthard.
        tick(time,time) is now operational.
        A very important contribution, thank you very much.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/certi/AUTHORS?cvsroot=certi&r1=3.9&r2=3.10
http://cvs.savannah.gnu.org/viewcvs/certi/myconf?cvsroot=certi&r1=3.11&r2=3.12
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/Communications.cc?cvsroot=certi&r1=3.23&r2=3.24
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/Communications.hh?cvsroot=certi&r1=3.10&r2=3.11
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/RTIA.cc?cvsroot=certi&r1=3.16&r2=3.17
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/RTIA.hh?cvsroot=certi&r1=3.11&r2=3.12
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/RTIA_federate.cc?cvsroot=certi&r1=3.70&r2=3.71
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/TimeManagement.cc?cvsroot=certi&r1=3.31&r2=3.32
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/TimeManagement.hh?cvsroot=certi&r1=3.14&r2=3.15
http://cvs.savannah.gnu.org/viewcvs/certi/include/RTIambServices.hh?cvsroot=certi&r1=3.3&r2=3.4
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/Message.cc?cvsroot=certi&r1=3.49&r2=3.50
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/Message.hh?cvsroot=certi&r1=3.41&r2=3.42
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/Message_R.cc?cvsroot=certi&r1=3.19&r2=3.20
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/Message_W.cc?cvsroot=certi&r1=3.22&r2=3.23
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/RTIambPrivateRefs.cc?cvsroot=certi&r1=3.11&r2=3.12
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/RTIambassador.cc?cvsroot=certi&r1=3.75&r2=3.76

Patches:
Index: AUTHORS
===================================================================
RCS file: /sources/certi/certi/AUTHORS,v
retrieving revision 3.9
retrieving revision 3.10
diff -u -b -r3.9 -r3.10
--- AUTHORS     24 Jan 2008 08:45:02 -0000      3.9
+++ AUTHORS     23 Apr 2008 07:36:00 -0000      3.10
@@ -1,5 +1,5 @@
 * CERTI Authors and contributors: M. Adelantado, P. Bieber, S. Bonnet,
-B. Bréholée, P. Desseaux, F. Fayet, A. Harzi, Ph. Hautesserres, M. Joubert
+B. Bréholée, P. Desseaux, F. Fayet, P. Gotthard, A. Harzi, Ph. Hautesserres, 
M. Joubert
 J. Latour, S. Lemanceau, J.M. Mathé, P. Nortier, E. Noulard, S. Prunet, 
 V. Raulet, J.-Y. Rousselot, P. Siron, C. Stenzel, P. Torguet, G. Zanon
 

Index: myconf
===================================================================
RCS file: /sources/certi/certi/myconf,v
retrieving revision 3.11
retrieving revision 3.12
diff -u -b -r3.11 -r3.12
--- myconf      18 Feb 2008 13:37:29 -0000      3.11
+++ myconf      23 Apr 2008 07:36:00 -0000      3.12
@@ -1,6 +1,6 @@
 #! /bin/sh
 # CERTI myconf
-# $Id: myconf,v 3.11 2008/02/18 13:37:29 siron Exp $
+# $Id: myconf,v 3.12 2008/04/23 07:36:00 siron Exp $
 
 case $1 in
     sun)
@@ -58,9 +58,9 @@
 esac
 
 WHERE=`dirname $0`
-$WHERE/configure --prefix=$HOME/CERTI-3.2.5 $SHARED $2 $3 $4 $5
+$WHERE/configure --prefix=$HOME/CERTI-3.2.6 $SHARED $2 $3 $4 $5
 make clean
 make
 make install
 
-# $Id: myconf,v 3.11 2008/02/18 13:37:29 siron Exp $
+# $Id: myconf,v 3.12 2008/04/23 07:36:00 siron Exp $

Index: RTIA/Communications.cc
===================================================================
RCS file: /sources/certi/certi/RTIA/Communications.cc,v
retrieving revision 3.23
retrieving revision 3.24
diff -u -b -r3.23 -r3.24
--- RTIA/Communications.cc      8 Apr 2008 08:50:22 -0000       3.23
+++ RTIA/Communications.cc      23 Apr 2008 07:36:00 -0000      3.24
@@ -18,7 +18,7 @@
 // along with this program ; if not, write to the Free Software
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 //
-// $Id: Communications.cc,v 3.23 2008/04/08 08:50:22 rousse Exp $
+// $Id: Communications.cc,v 3.24 2008/04/23 07:36:00 siron Exp $
 // ----------------------------------------------------------------------------
 
 #include <config.h>
@@ -183,7 +183,8 @@
   Returns the actual source in the 1st parameter (RTIG=>1 federate=>2)
 */
 void
-Communications::readMessage(int &n, NetworkMessage *msg_reseau, Message *msg)
+Communications::readMessage(int &n, NetworkMessage *msg_reseau, Message *msg,
+                            struct timeval *timeout)
 {
     const int tcp_fd(SecureTCPSocket::returnSocket());
     const int udp_fd(SocketUDP::returnSocket());
@@ -244,7 +245,7 @@
     else {
         // waitingList is empty and no data in TCP buffer.
         // Wait a message (coming from federate or network).
-        if (select(max_fd, &fdset, NULL, NULL, NULL) < 0) {
+        if (select(max_fd, &fdset, NULL, NULL, timeout) < 0) {
                        #ifdef _WIN32
                                 if(WSAGetLastError() == WSAEINTR)
                        #else
@@ -278,12 +279,16 @@
             msg_reseau->read((SocketUDP *) this);
             n = 1 ;
         }
-        else {
+        else if (FD_ISSET(_socket_un, &fdset)) {
             // Read a message coming from the federate.
-            assert(FD_ISSET(_socket_un, &fdset));
             receiveUN(msg);
             n = 2 ;
         }
+        else
+        {
+            // select() timeout occured
+            n = 3;
+        }
     }
 }
 
@@ -342,4 +347,4 @@
 
 }} // namespace certi/rtia
 
-// $Id: Communications.cc,v 3.23 2008/04/08 08:50:22 rousse Exp $
+// $Id: Communications.cc,v 3.24 2008/04/23 07:36:00 siron Exp $

Index: RTIA/Communications.hh
===================================================================
RCS file: /sources/certi/certi/RTIA/Communications.hh,v
retrieving revision 3.10
retrieving revision 3.11
diff -u -b -r3.10 -r3.11
--- RTIA/Communications.hh      22 Feb 2008 11:34:30 -0000      3.10
+++ RTIA/Communications.hh      23 Apr 2008 07:36:01 -0000      3.11
@@ -18,7 +18,7 @@
 // along with this program ; if not, write to the Free Software
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 //
-// $Id: Communications.hh,v 3.10 2008/02/22 11:34:30 siron Exp $
+// $Id: Communications.hh,v 3.11 2008/04/23 07:36:01 siron Exp $
 // ----------------------------------------------------------------------------
 
 #ifndef _CERTI_COMMUNICATIONS_HH
@@ -54,7 +54,7 @@
     void sendMessage(NetworkMessage *Msg);
     void sendUN(Message *Msg);
     void receiveUN(Message *Msg);
-    void readMessage(int&, NetworkMessage *, Message *);
+    void readMessage(int&, NetworkMessage *, Message *, struct timeval *);
     void requestFederateService(Message *req);
     unsigned long getAddress();
     unsigned int getPort();
@@ -74,4 +74,4 @@
 
 #endif // _CERTI_COMMUNICATIONS_HH
 
-// $Id: Communications.hh,v 3.10 2008/02/22 11:34:30 siron Exp $
+// $Id: Communications.hh,v 3.11 2008/04/23 07:36:01 siron Exp $

Index: RTIA/RTIA.cc
===================================================================
RCS file: /sources/certi/certi/RTIA/RTIA.cc,v
retrieving revision 3.16
retrieving revision 3.17
diff -u -b -r3.16 -r3.17
--- RTIA/RTIA.cc        1 Apr 2008 13:00:46 -0000       3.16
+++ RTIA/RTIA.cc        23 Apr 2008 07:36:01 -0000      3.17
@@ -18,13 +18,14 @@
 // along with this program ; if not, write to the Free Software
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 //
-// $Id: RTIA.cc,v 3.16 2008/04/01 13:00:46 rousse Exp $
+// $Id: RTIA.cc,v 3.17 2008/04/23 07:36:01 siron Exp $
 // ----------------------------------------------------------------------------
 
 #include <config.h>
 #include "RTIA.hh"
 
 #include <assert.h>
+#include <math.h>
 
 namespace certi {
 namespace rtia {
@@ -119,7 +120,7 @@
         msg_un = new Message ;
 
         try {
-            comm->readMessage(n, msg_tcp_udp, msg_un);
+            comm->readMessage(n, msg_tcp_udp, msg_un, NULL);
         }
         catch (NetworkSignal) {
             fm->_fin_execution = true ;
@@ -139,20 +140,32 @@
             processFederateRequest(msg_un);
             delete msg_tcp_udp ;
             break ;
+          case 3: // timeout
+            break ;
           default:
             assert(false);
         }
 
-        // special case, blocking tick (tick2)
-        while (!fm->_fin_execution && tm->_ongoing_tick) {
+        // special case, blocking tick
+        while (!fm->_fin_execution && tm->_blocking_tick) {
            // read a message from the rtig
             // same code is reused, but only the case 1 should match
-
             msg_tcp_udp = new NetworkMessage ;
             msg_un = new Message ;
 
             try {
-                comm->readMessage(n, msg_tcp_udp, msg_un);
+                if (isfinite(tm->_tick_timeout) && tm->_tick_timeout < 
LONG_MAX)
+                {
+                    struct timeval timev;
+                    timev.tv_sec = int(tm->_tick_timeout);
+                    timev.tv_usec = 
int((tm->_tick_timeout-timev.tv_sec)*1000000.0);
+
+                    comm->readMessage(n, msg_tcp_udp, msg_un, &timev);
+                }
+                else
+                    comm->readMessage(n, msg_tcp_udp, msg_un, NULL);
+
+                /* timev is undefined after select() */
             }
             catch (NetworkSignal) {
                 fm->_fin_execution = true ;
@@ -166,11 +179,15 @@
                 break ;
               case 1:
                 processNetworkMessage(msg_tcp_udp) ;  // could authorize a 
callbak
-                msg_un->type = Message::TICK_REQUEST ;
-                msg_un->setBoolean(true) ;
-                processFederateRequest(msg_un);  //could reset _ongoing_tick   
             
+                // may have reset tm->_blocking_tick
+                processOngoingTick();
                 break ;
               case 2:
+                assert(false);
+              case 3: // timeout
+                tm->_blocking_tick = false;
+                processOngoingTick();
+                break ;
               default:
                 assert(false);
             }
@@ -180,4 +197,4 @@
 
 }} // namespace certi/rtia
 
-// $Id: RTIA.cc,v 3.16 2008/04/01 13:00:46 rousse Exp $
+// $Id: RTIA.cc,v 3.17 2008/04/23 07:36:01 siron Exp $

Index: RTIA/RTIA.hh
===================================================================
RCS file: /sources/certi/certi/RTIA/RTIA.hh,v
retrieving revision 3.11
retrieving revision 3.12
diff -u -b -r3.11 -r3.12
--- RTIA/RTIA.hh        14 Mar 2008 14:52:23 -0000      3.11
+++ RTIA/RTIA.hh        23 Apr 2008 07:36:01 -0000      3.12
@@ -18,7 +18,7 @@
 // along with this program ; if not, write to the Free Software
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 //
-// $Id: RTIA.hh,v 3.11 2008/03/14 14:52:23 rousse Exp $
+// $Id: RTIA.hh,v 3.12 2008/04/23 07:36:01 siron Exp $
 // ----------------------------------------------------------------------------
 
 #ifndef _CERTI_RTIA_HH
@@ -67,10 +67,11 @@
     void chooseFederateProcessing(Message *, Message &, TypeException &)
        throw (CouldNotOpenFED,FederationExecutionAlreadyExists,ErrorReadingFED,
               FederateAlreadyExecutionMember);
+    void processOngoingTick();
 };
 
 }} // namespace certi
 
 #endif // _CERTI_RTIA_HH
 
-// $Id: RTIA.hh,v 3.11 2008/03/14 14:52:23 rousse Exp $
+// $Id: RTIA.hh,v 3.12 2008/04/23 07:36:01 siron Exp $

Index: RTIA/RTIA_federate.cc
===================================================================
RCS file: /sources/certi/certi/RTIA/RTIA_federate.cc,v
retrieving revision 3.70
retrieving revision 3.71
diff -u -b -r3.70 -r3.71
--- RTIA/RTIA_federate.cc       1 Apr 2008 13:00:46 -0000       3.70
+++ RTIA/RTIA_federate.cc       23 Apr 2008 07:36:01 -0000      3.71
@@ -18,7 +18,7 @@
 // along with this program ; if not, write to the Free Software
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 //
-// $Id: RTIA_federate.cc,v 3.70 2008/04/01 13:00:46 rousse Exp $
+// $Id: RTIA_federate.cc,v 3.71 2008/04/23 07:36:01 siron Exp $
 // ----------------------------------------------------------------------------
 
 #include <config.h>
@@ -39,6 +39,22 @@
 static PrettyDebug G("GENDOC",__FILE__) ;
 
 // ----------------------------------------------------------------------------
+static RTI::TickTime currentTickTime()
+{
+    RTI::TickTime result;
+#ifdef _WIN32 
+    _timeb timev;
+    _ftime(&timev);
+    result = timev.time + timev.millitm/1000;
+#else 
+    struct timeval timev;
+    gettimeofday(&timev, NULL);
+    result = timev.tv_sec + timev.tv_usec/1000000;
+#endif 
+    return result;
+}
+
+// ----------------------------------------------------------------------------
 //! Verify that federate is not in saving or restoring state.
 void
 RTIA::saveAndRestoreStatus(Message::Type type)
@@ -942,18 +958,19 @@
         break ;
 
       case Message::TICK_REQUEST:
-        tm->_tick_request_ack = true ;
-        if (req->getBoolean()) {
-           tm->_ongoing_tick = true ;
-           D.Out(pdDebug, "Receiving Message from Federate, type 
TickRequest2.");
+        tm->_tick_multiple = req->getBoolean();
            
-        }
-        else {
-           D.Out(pdDebug, "Receiving Message from Federate, type 
TickRequest.");
+       if (req->getMinTickTime() > 0.0)
+       {
+            tm->_tick_timeout = req->getMinTickTime();
+            tm->_tick_stop_time = currentTickTime() + req->getMaxTickTime();
            
+            tm->_blocking_tick = true ;
         }
-        rep.setBoolean(tm->tick(e));
+        else
+            tm->_blocking_tick = false ;
 
+        processOngoingTick();
         break ;
 
       default:
@@ -966,6 +983,43 @@
 }
 
 // ----------------------------------------------------------------------------
+//! RTIA processes the TICK_REQUEST
+void
+RTIA::processOngoingTick()
+{
+    TypeException exc = e_NO_EXCEPTION;
+    bool pending;
+
+    do {
+        // send a single callback to federate (if any)
+       pending = tm->tick(exc);
+
+       // processing a callback may have reset tm->_blocking_tick
+
+        if (!tm->_tick_multiple)
+           break;
+
+       if (currentTickTime() > tm->_tick_stop_time)
+       {
+            tm->_blocking_tick = false;
+            break;
+       }
+    }
+    while (pending);
+
+    if (!tm->_blocking_tick)
+    {
+        Message *msg_un = new Message;
+        if ( exc != e_RTIinternalError )
+           msg_un->setException(exc);
+        // terminate __tick() call in the federate
+        msg_un->type = Message::TICK_REQUEST;
+        msg_un->setBoolean(pending);
+        comm->requestFederateService(msg_un);
+    }
+}
+
+// ----------------------------------------------------------------------------
 //! RTIA processes a service request coming from federate.
 void
 RTIA::processFederateRequest(Message *req)
@@ -1312,18 +1366,9 @@
 
     delete req ;;
 
-     
-    if (rep.type == Message::TICK_REQUEST)
-       if ((!tm->_ongoing_tick) && tm->_tick_request_ack) {
-           // acknowledgment of an empty tick
-           comm->sendUN(&rep);
-           D.Out(pdDebug, "Reply send to Unix socket.");
-        }
-        else {
-           // no answer in the case of a successful tick
-        }
-    else {
+    if (rep.type != Message::TICK_REQUEST) {
        // generic federate service acknowledgment
+       // the TICK_REQUEST confirmation is generated in processOngoingTick()
        comm->sendUN(&rep);
        D.Out(pdDebug, "Reply send to Unix socket.");
     }
@@ -1332,4 +1377,4 @@
 
 }} // namespace certi/rtia
 
-// $Id: RTIA_federate.cc,v 3.70 2008/04/01 13:00:46 rousse Exp $
+// $Id: RTIA_federate.cc,v 3.71 2008/04/23 07:36:01 siron Exp $

Index: RTIA/TimeManagement.cc
===================================================================
RCS file: /sources/certi/certi/RTIA/TimeManagement.cc,v
retrieving revision 3.31
retrieving revision 3.32
diff -u -b -r3.31 -r3.32
--- RTIA/TimeManagement.cc      7 Apr 2008 15:08:27 -0000       3.31
+++ RTIA/TimeManagement.cc      23 Apr 2008 07:36:01 -0000      3.32
@@ -18,7 +18,7 @@
 // along with this program ; if not, write to the Free Software
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 //
-// $Id: TimeManagement.cc,v 3.31 2008/04/07 15:08:27 erk Exp $
+// $Id: TimeManagement.cc,v 3.32 2008/04/23 07:36:01 siron Exp $
 // ----------------------------------------------------------------------------
 
 #include <config.h>
@@ -82,7 +82,7 @@
     lastNullMessageDate = 0.0 ;
 
     _avancee_en_cours = PAS_D_AVANCEE ;
-    _ongoing_tick          = false ;
+    _blocking_tick         = false ;
     _asynchronous_delivery = false ;
 
     _heure_courante = 0.0 ;
@@ -125,8 +125,7 @@
 
   msg.trace("TimeManagement::executeFederateService ");
 
-  _ongoing_tick = false ;  // end of the blocking tick, a message is delivered
-  _tick_request_ack = false ;  // the callback message serves as the ack
+    _blocking_tick = false;  // indicate a callback was processed
 
     switch (msg.type) {
 
@@ -822,8 +821,7 @@
     if (_lookahead_courant == epsilon)
        _lookahead_courant = 0.0 ;
 
-    _ongoing_tick = false ;  // end of the blocking tick, a message is 
delivered
-    _tick_request_ack = false ;
+    _blocking_tick = false;  // indicate a callback was processed
 
     comm->requestFederateService(&req);
 
@@ -914,4 +912,4 @@
 
 }} // namespaces
 
-// $Id: TimeManagement.cc,v 3.31 2008/04/07 15:08:27 erk Exp $
+// $Id: TimeManagement.cc,v 3.32 2008/04/23 07:36:01 siron Exp $

Index: RTIA/TimeManagement.hh
===================================================================
RCS file: /sources/certi/certi/RTIA/TimeManagement.hh,v
retrieving revision 3.14
retrieving revision 3.15
diff -u -b -r3.14 -r3.15
--- RTIA/TimeManagement.hh      13 Mar 2008 14:39:19 -0000      3.14
+++ RTIA/TimeManagement.hh      23 Apr 2008 07:36:01 -0000      3.15
@@ -18,7 +18,7 @@
 // along with this program ; if not, write to the Free Software
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 //
-// $Id: TimeManagement.hh,v 3.14 2008/03/13 14:39:19 siron Exp $
+// $Id: TimeManagement.hh,v 3.15 2008/04/23 07:36:01 siron Exp $
 // ----------------------------------------------------------------------------
 
 #ifndef CERTI_RTIA_TIME_MANAGEMENT_HH
@@ -105,8 +105,10 @@
     bool requestRegulateurState() { return _est_regulateur ; };
 
     // Attribute
-    bool _ongoing_tick;  // tick2 processing
-    bool _tick_request_ack;  // do we have to acknowledge the tick request
+    bool _blocking_tick;  // processing the tick
+    bool _tick_multiple;  // process multiple callbacks
+    RTI::TickTime _tick_timeout;
+    RTI::TickTime _tick_stop_time;
     bool _asynchronous_delivery ;
 
 private:
@@ -146,4 +148,4 @@
 
 #endif // CERTI_RTIA_TIME_MANAGEMENT_HH
 
-// $Id: TimeManagement.hh,v 3.14 2008/03/13 14:39:19 siron Exp $
+// $Id: TimeManagement.hh,v 3.15 2008/04/23 07:36:01 siron Exp $

Index: include/RTIambServices.hh
===================================================================
RCS file: /sources/certi/certi/include/RTIambServices.hh,v
retrieving revision 3.3
retrieving revision 3.4
diff -u -b -r3.3 -r3.4
--- include/RTIambServices.hh   14 Jun 2007 13:00:21 -0000      3.3
+++ include/RTIambServices.hh   23 Apr 2008 07:36:01 -0000      3.4
@@ -1,5 +1,5 @@
 // HLA 1.3 Header "RTIambServices.hh"
-// $Id: RTIambServices.hh,v 3.3 2007/06/14 13:00:21 siron Exp $
+// $Id: RTIambServices.hh,v 3.4 2008/04/23 07:36:01 siron Exp $
 
 typedef FederateAmbassador *FederateAmbassadorPtr ;
 
@@ -475,7 +475,7 @@
 Boolean tick2()
     throw (SpecifiedSaveLabelDoesNotExist, ConcurrentAccessAttempted, 
RTIinternalError);
 
-Boolean tick_kernel(bool)
+Boolean __tick_kernel(Boolean, TickTime, TickTime)
     throw (SpecifiedSaveLabelDoesNotExist, ConcurrentAccessAttempted, 
RTIinternalError);
 
 Boolean tick(TickTime, TickTime)
@@ -493,4 +493,4 @@
 Region *getRegion(RegionToken)
     throw (FederateNotExecutionMember, ConcurrentAccessAttempted, 
RegionNotKnown, RTIinternalError);
 
-// $Id: RTIambServices.hh,v 3.3 2007/06/14 13:00:21 siron Exp $
+// $Id: RTIambServices.hh,v 3.4 2008/04/23 07:36:01 siron Exp $

Index: libCERTI/Message.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/Message.cc,v
retrieving revision 3.49
retrieving revision 3.50
diff -u -b -r3.49 -r3.50
--- libCERTI/Message.cc 27 Feb 2008 16:38:27 -0000      3.49
+++ libCERTI/Message.cc 23 Apr 2008 07:36:01 -0000      3.50
@@ -194,6 +194,20 @@
 
 // ----------------------------------------------------------------------------
 void
+Message::setMinTickTime(RTI::TickTime time)
+{
+    minTickTime = time;
+}
+
+// ----------------------------------------------------------------------------
+void
+Message::setMaxTickTime(RTI::TickTime time)
+{
+    maxTickTime = time;
+}
+
+// ----------------------------------------------------------------------------
+void
 Message::setDimension(DimensionHandle handle)
 {
     dimension = handle ;
@@ -603,6 +617,8 @@
     dimension = msg.dimension ;
     // transportation = msg.transportation ;
     // ordering = msg.ordering ;
+    minTickTime = msg.minTickTime ;
+    maxTickTime = msg.maxTickTime ;
 
     strcpy(tag, msg.tag);
     strcpy(name, msg.name);

Index: libCERTI/Message.hh
===================================================================
RCS file: /sources/certi/certi/libCERTI/Message.hh,v
retrieving revision 3.41
retrieving revision 3.42
diff -u -b -r3.41 -r3.42
--- libCERTI/Message.hh 17 Dec 2007 16:01:25 -0000      3.41
+++ libCERTI/Message.hh 23 Apr 2008 07:36:01 -0000      3.42
@@ -310,6 +310,12 @@
     long getRegion() const { return region ; };
     void setRegion(long);
 
+    RTI::TickTime getMinTickTime() const { return minTickTime ; };
+    void setMinTickTime(RTI::TickTime);
+
+    RTI::TickTime getMaxTickTime() const { return maxTickTime ; };
+    void setMaxTickTime(RTI::TickTime);
+
     void setFederationTimeDelta(FederationTimeDelta);
     FederationTimeDelta getFederationTimeDelta() const
     { return lookahead ; };
@@ -415,6 +421,8 @@
     // OrderingHandle ordering ;
     unsigned long number ;
     long region ;
+    RTI::TickTime minTickTime;
+    RTI::TickTime maxTickTime;
 
 public:
     // used for both Attributes and Parameters arrays.

Index: libCERTI/Message_R.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/Message_R.cc,v
retrieving revision 3.19
retrieving revision 3.20
diff -u -b -r3.19 -r3.20
--- libCERTI/Message_R.cc       3 Apr 2008 15:21:51 -0000       3.19
+++ libCERTI/Message_R.cc       23 Apr 2008 07:36:01 -0000      3.20
@@ -17,7 +17,7 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 // USA
 //
-// $Id: Message_R.cc,v 3.19 2008/04/03 15:21:51 rousse Exp $
+// $Id: Message_R.cc,v 3.20 2008/04/23 07:36:01 siron Exp $
 // ----------------------------------------------------------------------------
 
 
@@ -441,8 +441,14 @@
           case DISABLE_TIME_REGULATION:
           case ENABLE_TIME_CONSTRAINED:
           case DISABLE_TIME_CONSTRAINED:
+            boolean = body.readLongInt();
+            break ;
+
+          // Body contains boolean, TickTime, TickTime
           case TICK_REQUEST:
             boolean = body.readLongInt();
+            body.readBlock((char *)&minTickTime, sizeof(minTickTime));
+            body.readBlock((char *)&maxTickTime, sizeof(maxTickTime));
             break ;
 
           // Body contains objectClass, handleArraySize,
@@ -758,4 +764,4 @@
 
 } // namespace certi
 
-// $Id: Message_R.cc,v 3.19 2008/04/03 15:21:51 rousse Exp $
+// $Id: Message_R.cc,v 3.20 2008/04/23 07:36:01 siron Exp $

Index: libCERTI/Message_W.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/Message_W.cc,v
retrieving revision 3.22
retrieving revision 3.23
diff -u -b -r3.22 -r3.23
--- libCERTI/Message_W.cc       3 Apr 2008 15:21:51 -0000       3.22
+++ libCERTI/Message_W.cc       23 Apr 2008 07:36:02 -0000      3.23
@@ -17,7 +17,7 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 // USA
 //
-// $Id: Message_W.cc,v 3.22 2008/04/03 15:21:51 rousse Exp $
+// $Id: Message_W.cc,v 3.23 2008/04/23 07:36:02 siron Exp $
 // ----------------------------------------------------------------------------
 
 
@@ -454,8 +454,14 @@
           case DISABLE_TIME_REGULATION:
           case ENABLE_TIME_CONSTRAINED:
           case DISABLE_TIME_CONSTRAINED:
+            body.writeLongInt(boolean);
+            break ;
+
+          // Body contains boolean, TickTime, TickTime
           case TICK_REQUEST:
             body.writeLongInt(boolean);
+            body.writeBlock((char *)&minTickTime, sizeof(minTickTime));
+            body.writeBlock((char *)&maxTickTime, sizeof(maxTickTime));
             break ;
 
           // Body contains objectClass, handleArray
@@ -739,4 +745,4 @@
 
 } // namespace certi
 
-// $Id: Message_W.cc,v 3.22 2008/04/03 15:21:51 rousse Exp $
+// $Id: Message_W.cc,v 3.23 2008/04/23 07:36:02 siron Exp $

Index: libRTI/RTIambPrivateRefs.cc
===================================================================
RCS file: /sources/certi/certi/libRTI/RTIambPrivateRefs.cc,v
retrieving revision 3.11
retrieving revision 3.12
diff -u -b -r3.11 -r3.12
--- libRTI/RTIambPrivateRefs.cc 18 Feb 2008 13:37:30 -0000      3.11
+++ libRTI/RTIambPrivateRefs.cc 23 Apr 2008 07:36:02 -0000      3.12
@@ -19,7 +19,7 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 // USA
 //
-// $Id: RTIambPrivateRefs.cc,v 3.11 2008/02/18 13:37:30 siron Exp $
+// $Id: RTIambPrivateRefs.cc,v 3.12 2008/04/23 07:36:02 siron Exp $
 // ----------------------------------------------------------------------------
 
 #include <config.h>
@@ -84,13 +84,12 @@
 
     D.Out(pdDebug, "RTIA reply received.");
 
-    if (req->type != Message::TICK_REQUEST) {
+
        if (rep->type != req->type) {
            std::cout << "LibRTI: Assertion failed: rep->type != req->type" << 
std::endl ;
            throw RTIinternalError("RTIambPrivateRefs::executeService: "
                                   "rep->type != req->type");
        }
-    }
 
     D.Out(pdDebug, "processing returned exception (from reply).");
     processException(rep);
@@ -540,4 +539,4 @@
     }
 }
 
-// $Id: RTIambPrivateRefs.cc,v 3.11 2008/02/18 13:37:30 siron Exp $
+// $Id: RTIambPrivateRefs.cc,v 3.12 2008/04/23 07:36:02 siron Exp $

Index: libRTI/RTIambassador.cc
===================================================================
RCS file: /sources/certi/certi/libRTI/RTIambassador.cc,v
retrieving revision 3.75
retrieving revision 3.76
diff -u -b -r3.75 -r3.76
--- libRTI/RTIambassador.cc     3 Apr 2008 15:21:52 -0000       3.75
+++ libRTI/RTIambassador.cc     23 Apr 2008 07:36:02 -0000      3.76
@@ -19,7 +19,7 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 // USA
 //
-// $Id: RTIambassador.cc,v 3.75 2008/04/03 15:21:52 rousse Exp $
+// $Id: RTIambassador.cc,v 3.76 2008/04/23 07:36:02 siron Exp $
 // ----------------------------------------------------------------------------
 
 
@@ -195,33 +195,46 @@
 }
 
 // ----------------------------------------------------------------------------
-// Tick
+//! Evoke callback (HLA1.3).
+/*! Non-blocking callback evocation, returns immediately with or without 1 
callback.
+ *  @return Always returns false.
+ */
 RTI::Boolean
 RTI::RTIambassador::tick()
     throw (SpecifiedSaveLabelDoesNotExist,
            ConcurrentAccessAttempted,
            RTIinternalError)
 {
-   // non-blocking tick, returns immediately with or without 1 callback
-   return tick_kernel (false);
+   __tick_kernel(RTI_FALSE, 0.0, 0.0);
+   return RTI_FALSE;
 }
 
 // ----------------------------------------------------------------------------
-// Tick
+//! Evoke callback (CERTI extension).
+/*! Blocks until a callback delivery and then evokes a single callback.
+ *  Waits until a callback delivery, be careful.
+ *  @return true if additional callbacks pending, false otherwise
+ *  @warning This is a non-standard extension of the HLA 1.3 API.
+ */
 RTI::Boolean
 RTI::RTIambassador::tick2()
     throw (SpecifiedSaveLabelDoesNotExist,
            ConcurrentAccessAttempted,
            RTIinternalError)
 {
-   // blocking tick, waits until a callback delivery, be careful
-   return tick_kernel (true);
+   __tick_kernel(RTI_FALSE, std::numeric_limits<double>::infinity(), 0.0);
+   return RTI_FALSE;
 }
 
 // ----------------------------------------------------------------------------
-// Tick_kernel
+//! Generic callback evocation (CERTI extension).
+/*! Blocks up to "minimum" seconds until a callback delivery and then evokes a
+ *  single callback.
+ *  @return true if additional callbacks pending, false otherwise
+ *  @warning This is a non-standard extension of the HLA 1.3 API.
+ */
 RTI::Boolean
-RTI::RTIambassador::tick_kernel(bool locked)
+RTI::RTIambassador::__tick_kernel(RTI::Boolean multiple, TickTime minimum, 
TickTime maximum)
     throw (SpecifiedSaveLabelDoesNotExist,
            ConcurrentAccessAttempted,
            RTIinternalError)
@@ -230,10 +243,9 @@
 
     // Prevenir le RTI
     vers_RTI.type = Message::TICK_REQUEST ;
-    if (locked)
-       vers_RTI.setBoolean(true);
-    else
-       vers_RTI.setBoolean(false);
+    vers_RTI.setBoolean(multiple);
+    vers_RTI.setMinTickTime(minimum);
+    vers_RTI.setMaxTickTime(maximum);
 
     try {
         vers_RTI.write(privateRefs->socketUn);
@@ -245,7 +257,8 @@
         throw RTIinternalError("RTI::RTIambassador::tick_kernel (tick1) : 
NetworkError-->RTIinternalError");
     }
 
-    // Lire la reponse du RTIA local
+    // Read response(s) from the local RTIA until Message::TICK_REQUEST is 
received.
+    while (1) {
     try {
         vers_Fed.read(privateRefs->socketUn);
     }
@@ -256,24 +269,23 @@
         throw RTIinternalError("RTI::RTIambassador::tick_kernel (tick2) : 
NetworkError-->RTIinternalError");
     }
 
-    // Si c'est de type TICK_REQUEST, il n'y a qu'a traiter l'exception.
-    if (vers_Fed.type == Message::TICK_REQUEST) {
-        privateRefs->processException(&vers_Fed);
-        return RTI::Boolean(vers_Fed.getBoolean());
-    }
-
-    // Sinon, le RTI nous demande un service, donc on appele une methode
-    // du FederateAmbassador.
-
     vers_RTI.setException(e_NO_EXCEPTION);
 
-
     try {              
         //D.Mes( pdMessage, 'M', vers_Fed.type);
         vers_Fed.trace("RTI::RTIambassador::tick ");
                                
         switch (vers_Fed.type) {
 
+              // If the type is TICK_REQUEST, the __tick_kernel() has 
terminated.
+
+              case Message::TICK_REQUEST:
+                if (vers_Fed.getExceptionType() != e_NO_EXCEPTION)
+                    privateRefs->processException(&vers_Fed);
+                return RTI::Boolean(vers_Fed.getBoolean());
+
+              // Otherwise, the RTI calls a FederateAmbassador service.
+
           case Message::SYNCHRONIZATION_POINT_REGISTRATION_SUCCEEDED:
             
privateRefs->fed_amb->synchronizationPointRegistrationSucceeded(vers_Fed.getLabel());
             break ;
@@ -509,21 +521,24 @@
         vers_RTI.setException(e_RTIinternalError, e._reason);
         throw ;
     }
-    
-    return RTI::Boolean(true);
-          
+    }
 }
 
 // ----------------------------------------------------------------------------
+//! Evoke multiple callbacks (HLA1.3).
+/*! Blocks up to "minimum" seconds until a callback delivery, then envokes
+ *  multiple callbacks until no callback is pending, or until "maximum"
+ *  duration is reached.
+ *  @return true if additional callbacks pending, false otherwise
+ */
 RTI::Boolean
-RTI::RTIambassador::tick(TickTime, TickTime)
+RTI::RTIambassador::tick(TickTime minimum, TickTime maximum)
     throw (SpecifiedSaveLabelDoesNotExist, ConcurrentAccessAttempted,
            RTIinternalError)
 {
-    return tick();
+    return __tick_kernel(RTI_TRUE, minimum, maximum);
 }
 
-
 // ----------------------------------------------------------------------------
 // Create Federation Execution.
 /** Realization of the Create Federation Execution federation management 
service
@@ -2915,4 +2930,4 @@
     privateRefs->executeService(&req, &rep);
 }
 
-// $Id: RTIambassador.cc,v 3.75 2008/04/03 15:21:52 rousse Exp $
+// $Id: RTIambassador.cc,v 3.76 2008/04/23 07:36:02 siron Exp $




reply via email to

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