certi-cvs
[Top][All Lists]
Advanced

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

[certi-cvs] certi/RTIA TimeManagement.cc TimeManagement.hh


From: certi-cvs
Subject: [certi-cvs] certi/RTIA TimeManagement.cc TimeManagement.hh
Date: Sat, 20 Nov 2010 16:52:44 +0000

CVSROOT:        /sources/certi
Module name:    certi
Changes by:     Eric NOULARD <erk>      10/11/20 16:52:44

Modified files:
        RTIA           : TimeManagement.cc TimeManagement.hh 

Log message:
        Some french-->english renaming
        More API documentation.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/TimeManagement.cc?cvsroot=certi&r1=3.68&r2=3.69
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/TimeManagement.hh?cvsroot=certi&r1=3.27&r2=3.28

Patches:
Index: TimeManagement.cc
===================================================================
RCS file: /sources/certi/certi/RTIA/TimeManagement.cc,v
retrieving revision 3.68
retrieving revision 3.69
diff -u -b -r3.68 -r3.69
--- TimeManagement.cc   20 Nov 2010 16:39:28 -0000      3.68
+++ TimeManagement.cc   20 Nov 2010 16:52:44 -0000      3.69
@@ -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.68 2010/11/20 16:39:28 erk Exp $
+// $Id: TimeManagement.cc,v 3.69 2010/11/20 16:52:44 erk Exp $
 // ----------------------------------------------------------------------------
 
 #include <config.h>
@@ -62,7 +62,7 @@
                                      // cas d'attente active pendant
                                      // une pause.
     }
-}
+} /* advance */
 
 // ----------------------------------------------------------------------------
 //! Constructor.
@@ -89,14 +89,13 @@
 
     _heure_courante = 0.0 ;
     _lookahead_courant = 0.0 ;
-    _est_regulateur = false ;
-    _est_contraint = false ;
-}
+    _is_regulating = false ;
+    _is_constrained = false ;
+} /* end of TimeManagement */
 
 // ----------------------------------------------------------------------------
-
-void TimeManagement::sendNullMessage(FederationTime logicalTime)
-{
+void
+TimeManagement::sendNullMessage(FederationTime logicalTime) {
     NM_Message_Null msg ;
 
     // Chandy-Misra NMA indicates that NULL message timestamp
@@ -118,8 +117,8 @@
     }
 } /* end of sendNullMessage */
 
-void TimeManagement::sendNullPrimeMessage(FederationTime logicalTime)
-{
+void
+TimeManagement::sendNullPrimeMessage(FederationTime logicalTime) {
     NM_Message_Null_Prime msg ;
 #ifdef CERTI_USE_NULL_PRIME_MESSAGE_PROTOCOL
     /*
@@ -143,10 +142,9 @@
 } /* end of sendNullPrimeMessage */
 
 // ----------------------------------------------------------------------------
-//! Deliver TSO messages to federate (UAV, ReceiveInteraction, etc...).
 bool
-TimeManagement::executeFederateService(NetworkMessage &msg)
-{
+TimeManagement::executeFederateService(NetworkMessage &msg) {
+
   G.Out(pdGendoc,"enter TimeManagement::executeFederateService for type 
%d",msg.getMessageType());
   D.Out(pdRequest, "Execute federate service: Type %d.", msg.getMessageType());
 
@@ -432,14 +430,12 @@
     }
     G.Out(pdGendoc,"exit  TimeManagement::executeFederateService");
     return true ;
-}
+} /* executeFederateService */
 
 // ----------------------------------------------------------------------------
-//! Not implemented.
 void
 TimeManagement::flushQueueRequest(FederationTime heure_logique,
-                                  TypeException &e)
-{
+                                  TypeException &e) {
     e = e_NO_EXCEPTION ;
 
     // Verifications
@@ -457,7 +453,6 @@
 }
 
 // ----------------------------------------------------------------------------
-
 void
 TimeManagement::nextEventAdvance(bool &msg_restant, TypeException &e)
 {
@@ -470,7 +465,7 @@
     G.Out(pdGendoc," enter TimeManagement::nextEventAdvance");
     msg_restant = false ;
 
-    if (_est_contraint) {
+    if (_is_constrained) {
 
         // Select lower value between expected time and first TSO message time.
         queues->nextTsoDate(TSOPresent, dateTSO);
@@ -495,7 +490,7 @@
             date_avancee = date_min ;
 
             // If federate is regulating, inform other federate we advanced.
-            if (_est_regulateur)
+            if (_is_regulating)
                 sendNullMessage(date_min);
 
             // Deliver to federate every TSO messages with time
@@ -517,7 +512,7 @@
         else { // date_min < _LBTS
             // Federate can't advance up to expected time but up to LBTS. Other
             // federates are informed and no TSO message are sent.
-            if (_est_regulateur) {
+            if (_is_regulating) {
                /* The following NULL message is part of the classical CMB NULL 
MESSAGE algorithm */
                 sendNullMessage(_LBTS);
                 /**
@@ -538,7 +533,7 @@
 
         // In this case, federate can advance freely. Moreover, there must be 
no
         // message in TSO list.
-        if (_est_regulateur)
+        if (_is_regulating)
             sendNullMessage(date_avancee);
 
         timeAdvanceGrant(date_avancee, e);
@@ -677,7 +672,7 @@
 
         // On previent les autres en leur envoyant un message NULL qui contient
         // notre temps local + le Lookahead.
-        if (_est_regulateur)
+        if (_is_regulating)
             sendNullMessage(_heure_courante);
 
         D.Out(pdRegister, "New Lookahead : %f.", _lookahead_courant.getTime());
@@ -694,14 +689,14 @@
 
     // Verifications
 
-    if (_est_contraint == etat)
+    if (_is_constrained == etat)
         e = e_RTIinternalError ;
 
     if (_avancee_en_cours != PAS_D_AVANCEE)
         e = e_RTIinternalError ;
 
     if (e == e_NO_EXCEPTION) {
-        _est_contraint = etat ;
+        _is_constrained = etat ;
 
         msg.setFederation(fm->_numero_federation);
         msg.setFederate(fm->federate);
@@ -734,7 +729,7 @@
 
     // Verifications
 
-    if (_est_regulateur == etat) {
+    if (_is_regulating == etat) {
         e = e_RTIinternalError ;
         D.Out(pdRegister,
               "erreur e_RTIinternalError : federe deja regulateur");
@@ -747,7 +742,7 @@
 
     // Si aucune erreur, prevenir le RTIG et devenir regulateur.
     if (e == e_NO_EXCEPTION) {
-        _est_regulateur = etat ;
+        _is_regulating = etat ;
 
         msg.setFederation(fm->_numero_federation);
         msg.setFederate(fm->federate);
@@ -847,16 +842,16 @@
     if (!oneMsgToHandle) {
         if ( _asynchronous_delivery              ||
                (_avancee_en_cours != PAS_D_AVANCEE) ||
-               (! _est_contraint)) {
+               (! _is_constrained)) {
                D.Out(pdDebug,"FIFO message to be delivered async_deliver=%d, 
_avancee=%d, constrained=%d",
-                                         
_asynchronous_delivery,_avancee_en_cours,_est_contraint);
+                                         
_asynchronous_delivery,_avancee_en_cours,_is_constrained);
           // to exclude the case not asynchronous_delivery and
           // not time advancing for a constrained federate
           msg = queues->giveFifoMessage(oneMsgToHandle, moreMsgToHandle);
         }
         else {
           D.Out(pdDebug,"FIFO message skipped async_deliver=%d, _avancee=%d, 
constrained=%d",
-                         
_asynchronous_delivery,_avancee_en_cours,_est_contraint);
+                         
_asynchronous_delivery,_avancee_en_cours,_is_constrained);
         }
     }
 
@@ -900,7 +895,7 @@
     G.Out(pdGendoc," enter TimeManagement::timeAdvance");
     msg_restant = false ;
 
-    if (_est_contraint) {
+    if (_is_constrained) {
         // give a TSO message.
         if (_LBTS.isPositiveInfinity())
            D.Out(pdDebug, "Logical time : %f, LBTS : infini.", 
date_avancee.getTime());
@@ -1008,7 +1003,7 @@
            _type_granted_state = AFTER_TAR_OR_NER_WITH_ZERO_LK ;
         }
 
-        if (_est_regulateur) {
+        if (_is_regulating) {
             sendNullMessage(logical_time);
         }
 
@@ -1048,7 +1043,7 @@
 
         _type_granted_state = AFTER_TARA_OR_NERA ;  // will be
 
-        if (_est_regulateur) {
+        if (_is_regulating) {
             sendNullMessage(logical_time);
         }
 
@@ -1066,4 +1061,4 @@
 
 }} // namespaces
 
-// $Id: TimeManagement.cc,v 3.68 2010/11/20 16:39:28 erk Exp $
+// $Id: TimeManagement.cc,v 3.69 2010/11/20 16:52:44 erk Exp $

Index: TimeManagement.hh
===================================================================
RCS file: /sources/certi/certi/RTIA/TimeManagement.hh,v
retrieving revision 3.27
retrieving revision 3.28
diff -u -b -r3.27 -r3.28
--- TimeManagement.hh   19 Nov 2010 13:12:11 -0000      3.27
+++ TimeManagement.hh   20 Nov 2010 16:52:44 -0000      3.28
@@ -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.27 2010/11/19 13:12:11 erk Exp $
+// $Id: TimeManagement.hh,v 3.28 2010/11/20 16:52:44 erk Exp $
 // ----------------------------------------------------------------------------
 
 #ifndef CERTI_RTIA_TIME_MANAGEMENT_HH
@@ -80,10 +80,14 @@
     void nextEventRequestAvailable(FederationTime heure_logique, TypeException 
&e);
 
     /**
-     * Federate calls either nextEventRequest or timeAdvanceRequest to 
determine
+     * Try to deliver some message to the federate (command or FIFO)
+     * and then try to advance time and deliver TSO messages.
+     * The method will call either @ref advance which in turn
+     * will call @ref nextEventAdvance or @ref timeAdvance to determine
      * which time to attain. It then calls tick() until a timeAdvanceGrant is
      * made.
      * @param[out] e exception which may have occurred during tick
+     * @return true if there is more message for the federate to handle
      */
     bool tick(TypeException &e);
 
@@ -106,8 +110,8 @@
     FederationTimeDelta requestLookahead();
     FederationTime requestMinNextEventTime();
     FederationTime requestLBTS() { return _LBTS ; };
-    bool requestContraintState() { return _est_contraint ; };
-    bool requestRegulateurState() { return _est_regulateur ; };
+    bool requestContraintState() { return _is_constrained ; };
+    bool requestRegulateurState() { return _is_regulating ; };
 
     /**
      * The different tick state values.
@@ -150,9 +154,11 @@
 
     /**
      * Main time advancing method.
-     * This method is called by tick().
+     * This method is called by @ref tick().
      * Calls are dispatched between timeAdvance (TAR/TARA) and 
nextEventAdvance (NER/NERA)
      * depending on current time advancing method.
+     * @param[out] msg_restant
+     * @param[out] e exception will be updated to
      */
     void advance(bool &msg_restant, TypeException &e);
 
@@ -162,6 +168,7 @@
      * federate and if no messages are available, delivers a TimeAdvanceGrant.
      */
     void timeAdvance(bool &msg_restant, TypeException &e);
+
     /**
      * This method is called by @ref advance which is called by tick. This call
      * is done only if request type does correspond. It delivers TSO messages 
to
@@ -174,7 +181,16 @@
      * advanced and send a timeAdvanceGrant to federate.
      */
     void timeAdvanceGrant(FederationTime, TypeException& e);
+
+    /**
+     * Not implemented.
+     */
     void flushQueueRequest(FederationTime, TypeException& e);
+
+    /**
+     * Deliver TSO messages to federate (UAV, ReceiveInteraction, etc...).
+     * @param[in] msg the message to be handled.
+     */
     bool executeFederateService(NetworkMessage &msg);
     /**
      * Send a null message to RTIG containing Logicaal Time + Lookahead.
@@ -208,8 +224,8 @@
     // Federate Data
     FederationTime _heure_courante ;
     FederationTimeDelta _lookahead_courant ;
-    bool _est_regulateur ;
-    bool _est_contraint ;
+    bool _is_regulating;
+    bool _is_constrained;
 
 };
 
@@ -217,4 +233,4 @@
 
 #endif // CERTI_RTIA_TIME_MANAGEMENT_HH
 
-// $Id: TimeManagement.hh,v 3.27 2010/11/19 13:12:11 erk Exp $
+// $Id: TimeManagement.hh,v 3.28 2010/11/20 16:52:44 erk Exp $



reply via email to

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