certi-cvs
[Top][All Lists]
Advanced

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

[certi-cvs] certi RTIG/Federation.hh RTIG/FederationsList.h...


From: certi-cvs
Subject: [certi-cvs] certi RTIG/Federation.hh RTIG/FederationsList.h...
Date: Tue, 10 Aug 2010 16:34:10 +0000

CVSROOT:        /sources/certi
Module name:    certi
Changes by:     Eric NOULARD <erk>      10/08/10 16:34:10

Modified files:
        RTIG           : Federation.hh FederationsList.hh 
                         RTIG_processing.cc RTIG.cc Federate.hh 
                         Federation.cc FederationsList.cc RTIG.hh 
        libCERTI       : LBTS.cc NetworkMessage.cc 
        RTIA           : TimeManagement.cc RTIA_network.cc 
        include        : certi.hh 

Log message:
        Second set of modifications for the NULL PRIME idea.
        (to be continued - unfinished)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/certi/RTIG/Federation.hh?cvsroot=certi&r1=3.66&r2=3.67
http://cvs.savannah.gnu.org/viewcvs/certi/RTIG/FederationsList.hh?cvsroot=certi&r1=3.55&r2=3.56
http://cvs.savannah.gnu.org/viewcvs/certi/RTIG/RTIG_processing.cc?cvsroot=certi&r1=3.106&r2=3.107
http://cvs.savannah.gnu.org/viewcvs/certi/RTIG/RTIG.cc?cvsroot=certi&r1=3.65&r2=3.66
http://cvs.savannah.gnu.org/viewcvs/certi/RTIG/Federate.hh?cvsroot=certi&r1=3.17&r2=3.18
http://cvs.savannah.gnu.org/viewcvs/certi/RTIG/Federation.cc?cvsroot=certi&r1=3.131&r2=3.132
http://cvs.savannah.gnu.org/viewcvs/certi/RTIG/FederationsList.cc?cvsroot=certi&r1=3.71&r2=3.72
http://cvs.savannah.gnu.org/viewcvs/certi/RTIG/RTIG.hh?cvsroot=certi&r1=3.35&r2=3.36
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/LBTS.cc?cvsroot=certi&r1=3.17&r2=3.18
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/NetworkMessage.cc?cvsroot=certi&r1=3.49&r2=3.50
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/TimeManagement.cc?cvsroot=certi&r1=3.61&r2=3.62
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/RTIA_network.cc?cvsroot=certi&r1=3.38&r2=3.39
http://cvs.savannah.gnu.org/viewcvs/certi/include/certi.hh?cvsroot=certi&r1=3.49&r2=3.50

Patches:
Index: RTIG/Federation.hh
===================================================================
RCS file: /sources/certi/certi/RTIG/Federation.hh,v
retrieving revision 3.66
retrieving revision 3.67
diff -u -b -r3.66 -r3.67
--- RTIG/Federation.hh  31 May 2010 09:33:26 -0000      3.66
+++ RTIG/Federation.hh  10 Aug 2010 16:34:09 -0000      3.67
@@ -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.66 2010/05/31 09:33:26 erk Exp $
+// $Id: Federation.hh,v 3.67 2010/08/10 16:34:09 erk Exp $
 // ----------------------------------------------------------------------------
 
 #ifndef _CERTI_RTIG_FEDERATION_HH
@@ -156,7 +156,7 @@
                RestoreInProgress,
                RTIinternalError); // includes Time Regulation already enabled.
 
-    void updateRegulator(FederateHandle theHandle, FederationTime theTime)
+    void updateRegulator(FederateHandle theHandle, FederationTime theTime, 
bool anonymous)
         throw (FederateNotExecutionMember,
                RTIinternalError);
 
@@ -654,10 +654,32 @@
 
     void getFOM(NM_Join_Federation_Execution& objectModelData);
 
+    /**
+     * Update the last NERx message date for the concerned federate.
+     * @param[in] federate the handle of the federate for which we want to 
update NERx time.
+     * @param[in] date the new NERx date for the specified federate.
+     */
+    bool updateLastNERxForFederate(FederateHandle federate, FederationTime 
date) throw (FederateNotExecutionMember);
+
+    /**
+     * Compute the minimum of all NERx messsage date
+     * for all Federates using NERx messages.
+     * @return the minimum if at least one federate is using NERx, 0 otherwise
+     */
+    FederationTime computeMinNERx();
+
+    /**
+     * Get the (precomputed) minimum of all NERx messsage date
+     * for all Federates using NERx messages.
+     * @return the minimum if at least one federate is using NERx, 0 otherwise
+     */
+    FederationTime getMinNERx() const {return minNERx;};
 
 private:
-    // Private methods
-    void broadcastAnyMessage(NetworkMessage *msg, FederateHandle Except);
+    /**
+     * Broadcast 'msg' to all Federate except the specified one (unless this 
is an anonymous update)
+     */
+    void broadcastAnyMessage(NetworkMessage *msg, FederateHandle Except, bool 
anonymous);
 
     void broadcastSomeMessage(NetworkMessage *msg, FederateHandle Except,
                        const std::vector <FederateHandle> &fede_array, 
uint32_t nbfed);
@@ -670,7 +692,6 @@
 
     // Private attributes
     typedef std::map<FederateHandle, Federate> HandleFederateMap;
-
     HandleFederateMap _handleFederateMap;
     bool saveInProgress ;
     bool restoreInProgress ;
@@ -679,6 +700,11 @@
     int  verboseLevel ;
     std::string saveLabel ; //!< The label associated with the save request.
 
+    /**
+     * The minimum NERx timestamp for this federation
+     */
+    FederationTime minNERx;
+
 #ifdef HAVE_XML
     xmlDocPtr doc ; // FIXME: should not be an attribute
 #endif // HAVE_XML
@@ -690,4 +716,4 @@
 
 #endif // _CERTI_RTIG_FEDERATION_HH
 
-// $Id: Federation.hh,v 3.66 2010/05/31 09:33:26 erk Exp $
+// $Id: Federation.hh,v 3.67 2010/08/10 16:34:09 erk Exp $

Index: RTIG/FederationsList.hh
===================================================================
RCS file: /sources/certi/certi/RTIG/FederationsList.hh,v
retrieving revision 3.55
retrieving revision 3.56
diff -u -b -r3.55 -r3.56
--- RTIG/FederationsList.hh     31 May 2010 09:33:26 -0000      3.55
+++ RTIG/FederationsList.hh     10 Aug 2010 16:34:09 -0000      3.56
@@ -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: FederationsList.hh,v 3.55 2010/05/31 09:33:26 erk Exp $
+// $Id: FederationsList.hh,v 3.56 2010/08/10 16:34:09 erk Exp $
 // ----------------------------------------------------------------------------
 
 #ifndef _CERTI_RTIG_FEDERATIONS_LIST_HH
@@ -251,9 +251,13 @@
                RestoreInProgress,
                RTIinternalError);
 
-    void updateRegulator(Handle theHandle,
+    /**
+     *  updateRegulator
+     */
+    void updateRegulator(FederationHandle theHandle,
                          FederateHandle theFederateHandle,
-                         FederationTime heure_logique)
+                         FederationTime heure_logique,
+                         bool anonymous)
         throw (FederationExecutionDoesNotExist,
                FederateNotExecutionMember,
                RTIinternalError);
@@ -650,6 +654,22 @@
 
     void setVerboseLevel(int theVerboseLevel) { this->verboseLevel = 
theVerboseLevel ; }
 
+    /**
+     * Handle a Null Prime message.
+     * @param[in] federation the federation handle
+     * @param[in] federate the handle of the federate which is sending a NULL 
PRIME message.
+     * @param[in] date the date of the NULL PRIME message
+     * @return True is the NULL PRIME message changed the minNERx of the 
federation
+     *         False otherwise.
+     */
+    bool handleMessageNullPrime(FederationHandle federation, FederateHandle 
federate, FederationTime date);
+
+    /**
+     * Get the Null Prime value of the specified federation
+     * @param[in] federation
+     * @return the Null Prime value of the federation
+     */
+    FederationTime getNullPrimeValue(FederationHandle federation);
 private:
     /**
      * Search federation from handle.
@@ -670,4 +690,4 @@
 
 #endif // _CERTI_RTIG_FEDERATIONS_LIST_HH
 
-// $Id: FederationsList.hh,v 3.55 2010/05/31 09:33:26 erk Exp $
+// $Id: FederationsList.hh,v 3.56 2010/08/10 16:34:09 erk Exp $

Index: RTIG/RTIG_processing.cc
===================================================================
RCS file: /sources/certi/certi/RTIG/RTIG_processing.cc,v
retrieving revision 3.106
retrieving revision 3.107
diff -u -b -r3.106 -r3.107
--- RTIG/RTIG_processing.cc     10 Aug 2010 08:45:46 -0000      3.106
+++ RTIG/RTIG_processing.cc     10 Aug 2010 16:34:09 -0000      3.107
@@ -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: RTIG_processing.cc,v 3.106 2010/08/10 08:45:46 erk Exp $
+// $Id: RTIG_processing.cc,v 3.107 2010/08/10 16:34:09 erk Exp $
 // ----------------------------------------------------------------------------
 
 #include <config.h>
@@ -502,7 +502,7 @@
 // ----------------------------------------------------------------------------
 //! processMessageNull.
 void
-RTIG::processMessageNull(NetworkMessage *msg)
+RTIG::processMessageNull(NetworkMessage *msg, bool anonymous)
 {
        auditServer << "Date " << msg->getDate().getTime();
 
@@ -510,31 +510,26 @@
        try {
                federations.updateRegulator(msg->getFederation(),
                                msg->getFederate(),
-                               msg->getDate());
+                               msg->getDate(), anonymous);
        } catch (Exception &e) {}
 }
 
 void
 RTIG::processMessageNullPrime(NM_Message_Null_Prime *msg)
 {
-  /* this is the first NULL PRIME message we receive */
-  if (NullPrimeTime.isZero()) {
-    NullPrimeTime = msg->getDate();
-  }
-
   /*
    * Update the NullPrimeDate of the concerned federate.
+        * and check the result in order to decide whether
+        * if the RTIG should send an anonymous NULL message or not
    */
-
-  /*
-   * Now check whether if the RTIG should send
-   * an anonymous NULL message.
-   */
-  if (NullPrimeTime > msg->getDate()) {
-    NullPrimeTime = msg->getDate();
-    NM_Message_Null msg;
-    msg.setDate(NullPrimeTime);
+       if (federations.handleMessageNullPrime(msg->getFederation(), 
msg->getFederate(), msg->getDate())) {
+               NM_Message_Null nmsg;
+               
nmsg.setDate(federations.getNullPrimeValue(msg->getFederation()));
+               nmsg.setFederation(msg->getFederation());
+               nmsg.setFederate(0);
+               processMessageNull(&nmsg,true);
   }
+
 } /* end of processMessageNullPrime */
 
 // ----------------------------------------------------------------------------
@@ -1530,4 +1525,4 @@
 
 }} // namespace certi/rtig
 
-// $Id: RTIG_processing.cc,v 3.106 2010/08/10 08:45:46 erk Exp $
+// $Id: RTIG_processing.cc,v 3.107 2010/08/10 16:34:09 erk Exp $

Index: RTIG/RTIG.cc
===================================================================
RCS file: /sources/certi/certi/RTIG/RTIG.cc,v
retrieving revision 3.65
retrieving revision 3.66
diff -u -b -r3.65 -r3.66
--- RTIG/RTIG.cc        9 Aug 2010 18:24:07 -0000       3.65
+++ RTIG/RTIG.cc        10 Aug 2010 16:34:09 -0000      3.66
@@ -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: RTIG.cc,v 3.65 2010/08/09 18:24:07 erk Exp $
+// $Id: RTIG.cc,v 3.66 2010/08/10 16:34:09 erk Exp $
 // ----------------------------------------------------------------------------
 
 #include <config.h>
@@ -68,12 +68,6 @@
     udpPort = atoi(udp_port_s);
 
     federations.setVerboseLevel(verboseLevel);
-    /*
-     * Initialize NullPrimeTime to zero, this way
-     * when the first NULL Prime message is received
-     * NullPrimeTime will have a "true" initial value.
-     */
-    NullPrimeTime.setZero();
 }
 
 // ----------------------------------------------------------------------------
@@ -104,7 +98,13 @@
       case NetworkMessage::MESSAGE_NULL:
         D.Out(pdDebug, "Message Null.");
         auditServer.setLevel(0);
-        processMessageNull(msg);
+       processMessageNull(msg,false);
+       break ;
+
+    case NetworkMessage::MESSAGE_NULL_PRIME:
+       D.Out(pdDebug, "Message Null.");
+       auditServer.setLevel(0);
+       processMessageNullPrime(static_cast<NM_Message_Null_Prime*>(msg));
         break ;
 
       case NetworkMessage::UPDATE_ATTRIBUTE_VALUES:
@@ -1042,4 +1042,4 @@
 
 }} // namespace certi/rtig
 
-// $Id: RTIG.cc,v 3.65 2010/08/09 18:24:07 erk Exp $
+// $Id: RTIG.cc,v 3.66 2010/08/10 16:34:09 erk Exp $

Index: RTIG/Federate.hh
===================================================================
RCS file: /sources/certi/certi/RTIG/Federate.hh,v
retrieving revision 3.17
retrieving revision 3.18
diff -u -b -r3.17 -r3.18
--- RTIG/Federate.hh    9 Aug 2010 18:24:07 -0000       3.17
+++ RTIG/Federate.hh    10 Aug 2010 16:34:09 -0000      3.18
@@ -16,7 +16,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: Federate.hh,v 3.17 2010/08/09 18:24:07 erk Exp $
+// $Id: Federate.hh,v 3.18 2010/08/10 16:34:09 erk Exp $
 // ----------------------------------------------------------------------------
 
 #ifndef CERTI_RTIG_FEDERATE_HH
@@ -24,6 +24,7 @@
 
 #include "certi.hh"
 #include "Exception.hh"
+#include "FedTimeD.hh"
 
 #include <vector>
 #include <string>
@@ -47,7 +48,9 @@
     void setConstrained(bool c) { constrained = c ; };
     void setRegulator(bool r) { regulator = r ; };
     void setIsUsingNERx(bool unx) { usingNERx = unx;};
-    const bool isUsingNERx() {return usingNERx;};
+    bool isUsingNERx() const {return usingNERx;};
+    const FederationTime getLastNERxValue() const {return lastNERxValue;};
+    void setLastNERxValue(const FederationTime t) {lastNERxValue=t; 
usingNERx=true;};
 
     /**
      * Sets the ClassRelevanceAdvisorySwitch of the federate to the value of 
@@ -140,6 +143,10 @@
      * the concerned federate.
      */
     bool usingNERx;
+    /**
+     * The last NERx timestamp value received for this federate.
+     */
+    FederationTime lastNERxValue;
 
     bool cras ; //!< = class relevance advisory switch -> true  by default.
     bool iras ; //!< = interaction relevance advisory siwtch -> true  by 
default.
@@ -157,4 +164,4 @@
 
 #endif // CERTI_RTIG_FEDERATE_HH
 
-// $Id: Federate.hh,v 3.17 2010/08/09 18:24:07 erk Exp $
+// $Id: Federate.hh,v 3.18 2010/08/10 16:34:09 erk Exp $

Index: RTIG/Federation.cc
===================================================================
RCS file: /sources/certi/certi/RTIG/Federation.cc,v
retrieving revision 3.131
retrieving revision 3.132
diff -u -b -r3.131 -r3.132
--- RTIG/Federation.cc  10 Aug 2010 08:45:46 -0000      3.131
+++ RTIG/Federation.cc  10 Aug 2010 16:34:09 -0000      3.132
@@ -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.131 2010/08/10 08:45:46 erk Exp $
+// $Id: Federation.cc,v 3.132 2010/08/10 16:34:09 erk Exp $
 // ----------------------------------------------------------------------------
 
 #include <config.h>
@@ -361,6 +361,7 @@
                }
        }
 
+       minNERx.setZero();
        G.Out(pdGendoc,"exit Federation::Federation");
 
 }
@@ -733,7 +734,7 @@
        msg.regulatorOn();
        msg.setDate(time);
 
-       this->broadcastAnyMessage(&msg, 0);
+       this->broadcastAnyMessage(&msg, 0,false);
 }
 
 void
@@ -742,18 +743,54 @@
        root->convertToSerializedFOM(objectModelData);
 }
 
-// ----------------------------------------------------------------------------
-//! Broadcast 'msg' to all Federate except the specified one
+bool
+Federation::updateLastNERxForFederate(FederateHandle federate, FederationTime 
date)
+throw (FederateNotExecutionMember) {
+       bool retval = false;
+       FederationTime newMin;
+       Federate& f = getFederate(federate);
+
+       f.setLastNERxValue(date);
+       newMin = computeMinNERx();
+       if (newMin > minNERx) {
+               if (!minNERx.isZero()) {
+                       retval = true;
+               }
+               minNERx = newMin;
+       }
+       return retval;
+} /* end of updateLastNERxForFederate */
+
+FederationTime
+Federation::computeMinNERx() {
+       FederationTime retval;
+       retval.setZero();
+       HandleFederateMap::iterator i = _handleFederateMap.begin();
+
+       for (++i; i != _handleFederateMap.end(); ++i) {
+               if (i->second.isUsingNERx()) {
+                       if (retval.isZero()) {
+                               retval = i->second.getLastNERxValue();
+                       } else {
+                               if (retval > (i->second.getLastNERxValue())) {
+                                       retval = i->second.getLastNERxValue();
+                               }
+                       }
+               }
+       }
+       return retval;
+} /* end of getMinimumNERx */
+
 void
 Federation::broadcastAnyMessage(NetworkMessage *msg,
-               FederateHandle except_federate)
+               FederateHandle except_federate, bool anonymous)
 {
        Socket *socket = NULL ;
 
        // Broadcast the message 'msg' to all Federates in the Federation
        // except to Federate whose Handle is 'Except_Federate'.
        for (HandleFederateMap::iterator i = _handleFederateMap.begin(); i != 
_handleFederateMap.end(); ++i) {
-               if (i->first != except_federate) {
+               if (anonymous || (i->first != except_federate)) {
                        try {
 #ifdef HLA_USES_UDP
                                socket = 
server->getSocketLink(i->second.getHandle(), BEST_EFFORT);
@@ -1096,7 +1133,7 @@
 
        G.Out(pdGendoc,"      broadcastSynchronization is calling 
broadcastAnyMessage for all federates");
 
-       broadcastAnyMessage(&msg, 0);
+       broadcastAnyMessage(&msg, 0,false);
 
        G.Out(pdGendoc,"exit  Federation::broadcastSynchronization");
 
@@ -1173,7 +1210,7 @@
 
        G.Out(pdGendoc,"      requestFederationSave====>broadcast I_F_S to 
all");
 
-       broadcastAnyMessage(&msg, 0);
+       broadcastAnyMessage(&msg, 0, false);
 
        G.Out(pdGendoc,"exit  Federation::requestFederationSave with time");
 }
@@ -1211,7 +1248,7 @@
        G.Out(pdGendoc,"                  requestFederationSave====>broadcast 
I_F_S"
                        " to all");
 
-       broadcastAnyMessage(&msg, 0);
+       broadcastAnyMessage(&msg, 0, false);
 
        G.Out(pdGendoc,"exit  Federation::requestFederationSave without time");
 }
@@ -1263,7 +1300,7 @@
        msg->setFederate(the_federate);
        msg->setFederation(handle);
 
-       broadcastAnyMessage(msg.get(), 0);
+       broadcastAnyMessage(msg.get(), 0,false);
 
        G.Out(pdGendoc,"            =======> broadcast F_S or F_N_S");
 
@@ -1356,7 +1393,7 @@
 
        G.Out(pdGendoc,"             =====> broadcast message F_R_B");
 
-       broadcastAnyMessage(msg, 0);
+       broadcastAnyMessage(msg, 0, false);
        delete msg ;
 
        // For each federate, send an initiateFederateRestore with correct 
handle.
@@ -1405,7 +1442,7 @@
        msg->setFederate(the_federate);
        msg->setFederation(handle);
 
-       broadcastAnyMessage(msg.get(), 0);
+       broadcastAnyMessage(msg.get(), 0, false);
 
        // Reinitialize state.
        restoreStatus = true ;
@@ -1720,7 +1757,7 @@
        msg.setFederate(federate_handle);
        msg.regulatorOff();
 
-       broadcastAnyMessage(&msg, 0);
+       broadcastAnyMessage(&msg, 0, false);
                }
 
 // ----------------------------------------------------------------------------
@@ -1767,7 +1804,7 @@
        msg.setFederate(federate_handle);
        msg.setLabel(label);
 
-       broadcastAnyMessage(&msg, 0);
+       broadcastAnyMessage(&msg, 0, false);
 
        D.Out(pdTerm, "Federation %d is synchronized on %s.", handle, 
label.c_str());
 
@@ -1986,10 +2023,15 @@
 //! Update the current time of a regulator federate.
 void
 Federation::updateRegulator(FederateHandle federate_handle,
-               FederationTime time)
+               FederationTime time, bool anonymous)
 throw (FederateNotExecutionMember,
                RTIinternalError)
                {
+
+       /* if it is an anonymous update (from NULL PRIME message)
+        * no need to check federate.
+        */
+       if (!anonymous) {
        // It may throw FederateNotExecutionMember
        Federate &federate = getFederate(federate_handle);
 
@@ -2002,13 +2044,17 @@
                        handle, federate_handle, time.getTime());
 
        regulators.update(federate_handle, time);
+       }
 
        NM_Message_Null msg ;
        msg.setFederation(handle);
+       if (anonymous) {
+               msg.setFederate(0);
+       } else {
        msg.setFederate(federate_handle);
+       }
        msg.setDate(time);
-
-       broadcastAnyMessage(&msg, federate_handle);
+       broadcastAnyMessage(&msg, federate_handle, anonymous);
 }
 
 // ----------------------------------------------------------------------------
@@ -2616,5 +2662,5 @@
 
 }} // namespace certi/rtig
 
-// $Id: Federation.cc,v 3.131 2010/08/10 08:45:46 erk Exp $
+// $Id: Federation.cc,v 3.132 2010/08/10 16:34:09 erk Exp $
 

Index: RTIG/FederationsList.cc
===================================================================
RCS file: /sources/certi/certi/RTIG/FederationsList.cc,v
retrieving revision 3.71
retrieving revision 3.72
diff -u -b -r3.71 -r3.72
--- RTIG/FederationsList.cc     31 May 2010 09:33:25 -0000      3.71
+++ RTIG/FederationsList.cc     10 Aug 2010 16:34:09 -0000      3.72
@@ -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: FederationsList.cc,v 3.71 2010/05/31 09:33:25 erk Exp $
+// $Id: FederationsList.cc,v 3.72 2010/08/10 16:34:09 erk Exp $
 // ----------------------------------------------------------------------------
 
 #include <config.h>
@@ -475,12 +475,12 @@
     return(federation->registerObject(federate, object_class, name));
 }
 
-// ----------------------------------------------------------------------------
-// updateRegulator
+
 void
-FederationsList::updateRegulator(Handle federationHandle,
+FederationsList::updateRegulator(FederationHandle federationHandle,
                                  FederateHandle federate,
-                                 FederationTime time)
+                                 FederationTime time,
+                                 bool anonymous)
     throw (FederationExecutionDoesNotExist,
            FederateNotExecutionMember,
            RTIinternalError)
@@ -488,7 +488,7 @@
     // It may throw FederationExecutionDoesNotExist.
     Federation *federation = searchFederation(federationHandle);
 
-    federation->updateRegulator(federate, time);
+    federation->updateRegulator(federate, time, anonymous);
 }
 
 // ----------------------------------------------------------------------------
@@ -1413,9 +1413,23 @@
     G.Out(pdGendoc,"exit  FederationsList::federateRestoreStatus");
 }
 
+bool
+FederationsList::handleMessageNullPrime(FederationHandle federation, 
FederateHandle federate, FederationTime date)
+{
+   Federation* fed = searchFederation(federation);
+
+   return fed->updateLastNERxForFederate(federate,date);
+} /* end of handleMessageNullPrime */
+
+FederationTime
+FederationsList::getNullPrimeValue(FederationHandle federation)
+{
+   Federation* fed = searchFederation(federation);
 
+   return fed->getMinNERx();
+} /* end of handleMessageNullPrime */
 
 }} // certi::rtig
 
-// EOF $Id: FederationsList.cc,v 3.71 2010/05/31 09:33:25 erk Exp $
+// EOF $Id: FederationsList.cc,v 3.72 2010/08/10 16:34:09 erk Exp $
 

Index: RTIG/RTIG.hh
===================================================================
RCS file: /sources/certi/certi/RTIG/RTIG.hh,v
retrieving revision 3.35
retrieving revision 3.36
diff -u -b -r3.35 -r3.36
--- RTIG/RTIG.hh        9 Aug 2010 18:24:07 -0000       3.35
+++ RTIG/RTIG.hh        10 Aug 2010 16:34:09 -0000      3.36
@@ -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: RTIG.hh,v 3.35 2010/08/09 18:24:07 erk Exp $
+// $Id: RTIG.hh,v 3.36 2010/08/10 16:34:09 erk Exp $
 // ----------------------------------------------------------------------------
 
 #ifndef CERTI_RTIG_HH
@@ -83,7 +83,7 @@
                                NM_Set_Attribute_Scope_Advisory_Switch*);
     void processSetTimeRegulating(Socket*, NM_Set_Time_Regulating *msg);
     void processSetTimeConstrained(Socket*, NM_Set_Time_Constrained *msg);
-    void processMessageNull(NetworkMessage*);
+    void processMessageNull(NetworkMessage* msg, bool anonymous);
     void processMessageNullPrime(NM_Message_Null_Prime* msg);
     void processRegisterSynchronization(Socket*, 
NM_Register_Federation_Synchronization_Point*);
     void processSynchronizationAchieved(Socket*, NetworkMessage*);
@@ -128,7 +128,6 @@
     int tcpPort ;
     int udpPort ;
     int verboseLevel ;
-    FederationTime NullPrimeTime;
     HandleManager<Handle> federationHandles ;
     SocketTCP tcpSocketServer ;
     SocketUDP udpSocketServer ;
@@ -145,4 +144,4 @@
 
 #endif // CERTI_RTIG_HH
 
-// $Id: RTIG.hh,v 3.35 2010/08/09 18:24:07 erk Exp $
+// $Id: RTIG.hh,v 3.36 2010/08/10 16:34:09 erk Exp $

Index: libCERTI/LBTS.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/LBTS.cc,v
retrieving revision 3.17
retrieving revision 3.18
diff -u -b -r3.17 -r3.18
--- libCERTI/LBTS.cc    19 Mar 2010 13:54:03 -0000      3.17
+++ libCERTI/LBTS.cc    10 Aug 2010 16:34:09 -0000      3.18
@@ -19,7 +19,7 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 // USA
 //
-// $Id: LBTS.cc,v 3.17 2010/03/19 13:54:03 erk Exp $
+// $Id: LBTS.cc,v 3.18 2010/08/10 16:34:09 erk Exp $
 // ----------------------------------------------------------------------------
 
 
@@ -115,12 +115,22 @@
 LBTS::update(FederateHandle num_fed, FederationTime time)
 {
     D.Out(pdDebug, "LBTS.update: Updating federate %d(%f).", num_fed, 
time.getTime());
+    ClockSet::iterator it;
+    ClockSet::iterator itend = clocks.end();
 
-    ClockSet::iterator it = clocks.find(num_fed);
-
-    if (it == clocks.end())
+    /* num fed will be 0 if it is an 'anonymous' Null Message */
+    if (num_fed!=0) {
+       it = clocks.find(num_fed);
+       if (it == clocks.end()) {
         throw RTIinternalError(stringize() << "LBTS: Federate <" << num_fed << 
"> not found.");
+       } else {
+               itend = it;
+       }
+    } else {
+       it = clocks.begin();
+    }
 
+    do {
     // Coherence test.
     if (it->second > time)
         D.Out(pdDebug,
@@ -132,8 +142,11 @@
         it->second = time ;
         D.Out(pdDebug, "after LBTS.update: federate %u, new time %f.",
               it->first, it->second.getTime());
-        compute();
     }
+       if (it!=itend) ++it;
+    } while (it!=itend);
+    /* now update LBTS */
+       compute();
 }
 
 // ----------------------------------------------------------------------------
@@ -152,4 +165,4 @@
 
 } // namespace certi
 
-// $Id: LBTS.cc,v 3.17 2010/03/19 13:54:03 erk Exp $
+// $Id: LBTS.cc,v 3.18 2010/08/10 16:34:09 erk Exp $

Index: libCERTI/NetworkMessage.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/NetworkMessage.cc,v
retrieving revision 3.49
retrieving revision 3.50
diff -u -b -r3.49 -r3.50
--- libCERTI/NetworkMessage.cc  10 Jun 2010 08:31:52 -0000      3.49
+++ libCERTI/NetworkMessage.cc  10 Aug 2010 16:34:09 -0000      3.50
@@ -16,7 +16,7 @@
 // License along with this program ; if not, write to the Free Software
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 //
-// $Id: NetworkMessage.cc,v 3.49 2010/06/10 08:31:52 erk Exp $
+// $Id: NetworkMessage.cc,v 3.50 2010/08/10 16:34:09 erk Exp $
 // ----------------------------------------------------------------------------
 
 
@@ -51,6 +51,9 @@
 
 std::ostream& NetworkMessage::show(std::ostream& out) {
        out << "[NetworkMessage -Begin]" << std::endl;
+       if (isDated()) {
+               out << " date        = " << getDate() << std::endl;
+       }
        out << " federation = " << federation << std::endl;
        out << " federate   = " << federate << std::endl;
        out << "[NetworkMessage -End]" << std::endl;
@@ -59,4 +62,4 @@
 
 } // namespace certi
 
-// $Id: NetworkMessage.cc,v 3.49 2010/06/10 08:31:52 erk Exp $
+// $Id: NetworkMessage.cc,v 3.50 2010/08/10 16:34:09 erk Exp $

Index: RTIA/TimeManagement.cc
===================================================================
RCS file: /sources/certi/certi/RTIA/TimeManagement.cc,v
retrieving revision 3.61
retrieving revision 3.62
diff -u -b -r3.61 -r3.62
--- RTIA/TimeManagement.cc      9 Aug 2010 18:24:07 -0000       3.61
+++ RTIA/TimeManagement.cc      10 Aug 2010 16:34:10 -0000      3.62
@@ -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.61 2010/08/09 18:24:07 erk Exp $
+// $Id: TimeManagement.cc,v 3.62 2010/08/10 16:34:10 erk Exp $
 // ----------------------------------------------------------------------------
 
 #include <config.h>
@@ -570,6 +570,7 @@
 
         _avancee_en_cours = NER ;
         date_avancee = heure_logique ;
+        sendNullPrimeMessage(heure_logique);
         D.Out(pdTrace, "NextEventRequest accepted.");
     }
     else {
@@ -602,6 +603,7 @@
         _type_granted_state = AFTER_TARA_OR_NERA ;  // will be
         _avancee_en_cours = NERA ;
         date_avancee = heure_logique ;
+        sendNullPrimeMessage(heure_logique);
         D.Out(pdTrace, "NextEventRequestAvailable accepted.");
     }
     else {
@@ -999,8 +1001,9 @@
            _type_granted_state = AFTER_TAR_OR_NER_WITH_ZERO_LK ;
         }
 
-        if (_est_regulateur)
+        if (_est_regulateur) {
             sendNullMessage(logical_time);
+        }
 
         _avancee_en_cours = TAR ;
         date_avancee = logical_time ;
@@ -1038,8 +1041,9 @@
 
         _type_granted_state = AFTER_TARA_OR_NERA ;  // will be
 
-        if (_est_regulateur)
+        if (_est_regulateur) {
             sendNullMessage(logical_time);
+        }
 
         _avancee_en_cours = TARA ;
         date_avancee = logical_time ;
@@ -1055,4 +1059,4 @@
 
 }} // namespaces
 
-// $Id: TimeManagement.cc,v 3.61 2010/08/09 18:24:07 erk Exp $
+// $Id: TimeManagement.cc,v 3.62 2010/08/10 16:34:10 erk Exp $

Index: RTIA/RTIA_network.cc
===================================================================
RCS file: /sources/certi/certi/RTIA/RTIA_network.cc,v
retrieving revision 3.38
retrieving revision 3.39
diff -u -b -r3.38 -r3.39
--- RTIA/RTIA_network.cc        9 Aug 2010 14:51:45 -0000       3.38
+++ RTIA/RTIA_network.cc        10 Aug 2010 16:34:10 -0000      3.39
@@ -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_network.cc,v 3.38 2010/08/09 14:51:45 erk Exp $
+// $Id: RTIA_network.cc,v 3.39 2010/08/10 16:34:10 erk Exp $
 // ----------------------------------------------------------------------------
 
 #include <config.h>
@@ -52,9 +52,10 @@
       case NetworkMessage::MESSAGE_NULL:
       {
           D.Out(pdTrace,
-                "Receving Message from RTIG, type 
NetworkMessage::MESSAGE_NULL(%f).",
+                "Receiving Message from RTIG, type 
NetworkMessage::MESSAGE_NULL(%f).",
                 msg->getDate().getTime());
 
+          //msg->show(std::cout);
           tm->update(msg->getFederate(), msg->getDate());
           delete msg ;
           break ;
@@ -380,4 +381,4 @@
 
 }} // namespace certi/rtia
 
-// $Id: RTIA_network.cc,v 3.38 2010/08/09 14:51:45 erk Exp $
+// $Id: RTIA_network.cc,v 3.39 2010/08/10 16:34:10 erk Exp $

Index: include/certi.hh
===================================================================
RCS file: /sources/certi/certi/include/certi.hh,v
retrieving revision 3.49
retrieving revision 3.50
diff -u -b -r3.49 -r3.50
--- include/certi.hh    22 Mar 2010 16:34:08 -0000      3.49
+++ include/certi.hh    10 Aug 2010 16:34:10 -0000      3.50
@@ -16,7 +16,7 @@
 // License along with this program ; if not, write to the Free Software
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 //
-// $Id: certi.hh,v 3.49 2010/03/22 16:34:08 erk Exp $
+// $Id: certi.hh,v 3.50 2010/08/10 16:34:10 erk Exp $
 // ----------------------------------------------------------------------------
 
 #ifndef CERTI_HH_INCLUDED
@@ -141,6 +141,7 @@
 typedef Handle   ObjectHandle;
 typedef Handle   DimensionHandle;
 typedef Handle   FederateHandle;
+typedef Handle   FederationHandle;
 typedef Handle   OrderType;
 typedef Handle   SpaceHandle;
 typedef Handle   TransportType;
@@ -310,4 +311,4 @@
        (uint64_t) CERTI_INT64_CONSTANT(0xff00000000000000U)) >> 56)))
 #endif // CERTI_HH_INCLUDED
 
-// $Id: certi.hh,v 3.49 2010/03/22 16:34:08 erk Exp $
+// $Id: certi.hh,v 3.50 2010/08/10 16:34:10 erk Exp $



reply via email to

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