certi-cvs
[Top][All Lists]
Advanced

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

[certi-cvs] certi libCERTI/LBTS.hh RTIG/Federation.hh RTIG/...


From: certi-cvs
Subject: [certi-cvs] certi libCERTI/LBTS.hh RTIG/Federation.hh RTIG/...
Date: Wed, 18 Aug 2010 15:33:19 +0000

CVSROOT:        /sources/certi
Module name:    certi
Changes by:     Eric NOULARD <erk>      10/08/18 15:33:19

Modified files:
        libCERTI       : LBTS.hh 
        RTIG           : Federation.hh Federation.cc 

Log message:
        Update of the NULL PRIME message protocol
        Should be in better shape now (need testing...)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/LBTS.hh?cvsroot=certi&r1=3.11&r2=3.12
http://cvs.savannah.gnu.org/viewcvs/certi/RTIG/Federation.hh?cvsroot=certi&r1=3.67&r2=3.68
http://cvs.savannah.gnu.org/viewcvs/certi/RTIG/Federation.cc?cvsroot=certi&r1=3.133&r2=3.134

Patches:
Index: libCERTI/LBTS.hh
===================================================================
RCS file: /sources/certi/certi/libCERTI/LBTS.hh,v
retrieving revision 3.11
retrieving revision 3.12
diff -u -b -r3.11 -r3.12
--- libCERTI/LBTS.hh    11 Aug 2010 16:45:14 -0000      3.11
+++ libCERTI/LBTS.hh    18 Aug 2010 15:33:18 -0000      3.12
@@ -19,7 +19,7 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 // USA
 //
-// $Id: LBTS.hh,v 3.11 2010/08/11 16:45:14 erk Exp $
+// $Id: LBTS.hh,v 3.12 2010/08/18 15:33:18 erk Exp $
 // ----------------------------------------------------------------------------
 
 #ifndef LIBCERTI_LBTS_HH
@@ -59,6 +59,9 @@
      */
     void compute();
 
+    /** Return the current LBTS value */
+    FederationTime getLBTSValue() const {return _LBTS;};
+
     /**
      * Check if a federate exists
      */
@@ -91,4 +94,4 @@
 
 #endif // LIBCERTI_LBTS_HH
 
-// $Id: LBTS.hh,v 3.11 2010/08/11 16:45:14 erk Exp $
+// $Id: LBTS.hh,v 3.12 2010/08/18 15:33:18 erk Exp $

Index: RTIG/Federation.hh
===================================================================
RCS file: /sources/certi/certi/RTIG/Federation.hh,v
retrieving revision 3.67
retrieving revision 3.68
diff -u -b -r3.67 -r3.68
--- RTIG/Federation.hh  10 Aug 2010 16:34:09 -0000      3.67
+++ RTIG/Federation.hh  18 Aug 2010 15:33:18 -0000      3.68
@@ -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: Federation.hh,v 3.67 2010/08/10 16:34:09 erk Exp $
+// $Id: Federation.hh,v 3.68 2010/08/18 15:33:18 erk Exp $
 // ----------------------------------------------------------------------------
 
 #ifndef _CERTI_RTIG_FEDERATION_HH
@@ -67,7 +67,7 @@
     SecurityServer *server ;
     RootObject *root ;
 
-    LBTS regulators ;
+    LBTS regulators;
 
 #ifdef FEDERATION_USES_MULTICAST
     SocketMC *MCLink ;
@@ -716,4 +716,4 @@
 
 #endif // _CERTI_RTIG_FEDERATION_HH
 
-// $Id: Federation.hh,v 3.67 2010/08/10 16:34:09 erk Exp $
+// $Id: Federation.hh,v 3.68 2010/08/18 15:33:18 erk Exp $

Index: RTIG/Federation.cc
===================================================================
RCS file: /sources/certi/certi/RTIG/Federation.cc,v
retrieving revision 3.133
retrieving revision 3.134
diff -u -b -r3.133 -r3.134
--- RTIG/Federation.cc  11 Aug 2010 16:45:14 -0000      3.133
+++ RTIG/Federation.cc  18 Aug 2010 15:33:18 -0000      3.134
@@ -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: Federation.cc,v 3.133 2010/08/11 16:45:14 erk Exp $
+// $Id: Federation.cc,v 3.134 2010/08/18 15:33:18 erk Exp $
 // ----------------------------------------------------------------------------
 
 #include <config.h>
@@ -757,6 +757,18 @@
                Debug(D,pdDebug) << "New minNERx =" << newMin << std::endl;
                retval = true;
                minNERx = newMin;
+               /* if a new Min is found then we shall reset the NERx status of 
NERing federates
+                * whose lastNERx value is equal to the new Min found.
+                * Rationale: an Anonymous NULL MESSAGE dated with newMin will 
be sent to them.
+                */
+               for (HandleFederateMap::iterator i = 
_handleFederateMap.begin(); i != _handleFederateMap.end(); ++i) {
+                       if ((i->second.isUsingNERx()) &&
+                           (i->second.getLastNERxValue()==newMin)) {
+                               //i->second.setLastNERxValue(FedTime(0.0)); // 
not needed
+                               i->second.setIsUsingNERx(false);
+                               Debug(D,pdDebug) << "Federate <" << 
i->second.getName() <<"> not NERing anymore." <<  std::endl;
+                       }
+               }
        }
        return retval;
 } /* end of updateLastNERxForFederate */
@@ -765,23 +777,29 @@
 Federation::computeMinNERx() {
        FederationTime retval;
        uint32_t       nbFed;
+       LBTS           NER_regulators;
+       std::vector<LBTS::FederateClock> clocks;
        retval.setZero();
-       HandleFederateMap::iterator i;
        nbFed = 0;
+       regulators.get(clocks);
 
-       for (i = _handleFederateMap.begin(); i != _handleFederateMap.end(); 
++i) {
-               if (i->second.isUsingNERx()) {
-                       ++nbFed;
-                       if (retval.isZero()) {
-                               retval = i->second.getLastNERxValue();
+       /* Build a set of clocks */
+       for (std::vector<LBTS::FederateClock>::iterator it = clocks.begin(); 
it!=clocks.end(); ++it) {
+               FederateHandle h=it->first;
+               HandleFederateMap::iterator f = _handleFederateMap.find(h);
+               if (f->second.isUsingNERx()) {
+                       nbFed++;
+                       NER_regulators.insert(h,f->second.getLastNERxValue());
                        } else {
-                               if (retval > (i->second.getLastNERxValue())) {
-                                       retval = i->second.getLastNERxValue();
-                               }
-                       }
+                       NER_regulators.insert(h,it->second);
                }
        }
 
+       /* compute the new NERx LBTS (minimum) */
+       NER_regulators.compute();
+       retval = NER_regulators.getLBTSValue();
+       Debug(D,pdDebug) << "MinNERx =" << retval.getTime() << std::endl;
+
        /* the minimum is different from 0 iff more than 2 federate use NERx */
        if (nbFed<2) {
                retval.setZero();
@@ -2050,9 +2068,8 @@
                        throw RTIinternalError("Time regulation not enabled.");
                }
 
-               D.Out(pdTerm, "Federation %d: Federate %d's new time is %f.",
+               D.Out(pdDebug, "Federation %d: Federate %d's new time is %f.",
                                handle, federate_handle, time.getTime());
-
                regulators.update(federate_handle, time);
        }
 
@@ -2672,5 +2689,5 @@
 
 }} // namespace certi/rtig
 
-// $Id: Federation.cc,v 3.133 2010/08/11 16:45:14 erk Exp $
+// $Id: Federation.cc,v 3.134 2010/08/18 15:33:18 erk Exp $
 



reply via email to

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