certi-cvs
[Top][All Lists]
Advanced

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

[certi-cvs] certi/RTIG FederationsList.hh FederationsList.cc


From: certi-cvs
Subject: [certi-cvs] certi/RTIG FederationsList.hh FederationsList.cc
Date: Fri, 20 Nov 2009 22:43:46 +0000

CVSROOT:        /sources/certi
Module name:    certi
Changes by:     Eric NOULARD <erk>      09/11/20 22:43:46

Modified files:
        RTIG           : FederationsList.hh FederationsList.cc 

Log message:
        Suppress unecessary checkHandle mehtod.
        Handles provided to RTIG should be valid and/or
        checked *BEFORE* going to FederationList methods.
        Those call generates unecessary overhead.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/certi/RTIG/FederationsList.hh?cvsroot=certi&r1=3.51&r2=3.52
http://cvs.savannah.gnu.org/viewcvs/certi/RTIG/FederationsList.cc?cvsroot=certi&r1=3.67&r2=3.68

Patches:
Index: FederationsList.hh
===================================================================
RCS file: /sources/certi/certi/RTIG/FederationsList.hh,v
retrieving revision 3.51
retrieving revision 3.52
diff -u -b -r3.51 -r3.52
--- FederationsList.hh  20 Nov 2009 19:43:40 -0000      3.51
+++ FederationsList.hh  20 Nov 2009 22:43:46 -0000      3.52
@@ -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.51 2009/11/20 19:43:40 erk Exp $
+// $Id: FederationsList.hh,v 3.52 2009/11/20 22:43:46 erk Exp $
 // ----------------------------------------------------------------------------
 
 #ifndef _CERTI_RTIG_FEDERATIONS_LIST_HH
@@ -36,7 +36,10 @@
 namespace certi {
 namespace rtig {
 
-/*! FederationsList keep track on federation operations.
+/**
+ * FederationsList keeps track on federation operations.
+ * There is one federation list in each RTIG instance.
+ * You usually have only one RTIG instance.
  */
 class FederationsList
 {
@@ -639,9 +642,13 @@
     void setVerboseLevel(int theVerboseLevel) { this->verboseLevel = 
theVerboseLevel ; }
 
 private:
-    // Private methods
-    void checkHandle(Handle theHandle) throw (RTIinternalError);
-    Federation* searchFederation(Handle handle)
+    /**
+     * Search federation from handle.
+     * @param[in] federationHandle, the handle of the search federation
+     * @throw FederationExecutionDoesNotExist if the provided federation handle
+     *        does not match any created federation.
+     */
+    Federation* searchFederation(Handle federationHandle)
         throw (FederationExecutionDoesNotExist);
 
     int verboseLevel;
@@ -654,4 +661,4 @@
 
 #endif // _CERTI_RTIG_FEDERATIONS_LIST_HH
 
-// $Id: FederationsList.hh,v 3.51 2009/11/20 19:43:40 erk Exp $
+// $Id: FederationsList.hh,v 3.52 2009/11/20 22:43:46 erk Exp $

Index: FederationsList.cc
===================================================================
RCS file: /sources/certi/certi/RTIG/FederationsList.cc,v
retrieving revision 3.67
retrieving revision 3.68
diff -u -b -r3.67 -r3.68
--- FederationsList.cc  20 Nov 2009 19:43:40 -0000      3.67
+++ FederationsList.cc  20 Nov 2009 22:43:46 -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: FederationsList.cc,v 3.67 2009/11/20 19:43:40 erk Exp $
+// $Id: FederationsList.cc,v 3.68 2009/11/20 22:43:46 erk Exp $
 // ----------------------------------------------------------------------------
 
 #include <config.h>
@@ -64,9 +64,6 @@
            RestoreInProgress,
            RTIinternalError)
 {
-    // It may throw RTIinternalError.
-    checkHandle(federate);
-
     // It may throw FederationExecutionDoesNotExist.
     Federation *federation = searchFederation(federationHandle);
 
@@ -85,9 +82,6 @@
            RestoreInProgress,
            RTIinternalError)
 {
-    // It may throw RTIinternalError.
-    checkHandle(federate);
-
     // It may throw FederationExecutionDoesNotExist.
     Federation *federation = searchFederation(federationHandle);
 
@@ -106,9 +100,6 @@
            RestoreInProgress,
            RTIinternalError)
 {
-    // It may throw RTIinternalError.
-    checkHandle(federate);
-
     // It may throw FederationExecutionDoesNotExist.
     Federation *federation = searchFederation(federationHandle);
 
@@ -127,9 +118,6 @@
            RestoreInProgress,
            RTIinternalError)
 {
-    // It may throw RTIinternalError.
-    checkHandle(federate);
-
     // It may throw FederationExecutionDoesNotExist.
     Federation *federation = searchFederation(federationHandle);
 
@@ -148,9 +136,6 @@
            RestoreInProgress,
            RTIinternalError)
 {
-    // It may throw RTIinternalError.
-    checkHandle(federate);
-
     // It may throw FederationExecutionDoesNotExist.
     Federation *federation = searchFederation(federationHandle);
 
@@ -169,9 +154,6 @@
            RestoreInProgress,
            RTIinternalError)
 {
-    // It may throw RTIinternalError.
-    checkHandle(federate);
-
     // It may throw FederationExecutionDoesNotExist.
     Federation *federation = searchFederation(federationHandle);
 
@@ -190,9 +172,6 @@
            RestoreInProgress,
            RTIinternalError)
 {
-    // It may throw RTIinternalError.
-    checkHandle(federate);
-
     // It may throw FederationExecutionDoesNotExist.
     Federation *federation = searchFederation(federationHandle);
 
@@ -211,9 +190,6 @@
            RestoreInProgress,
            RTIinternalError)
 {
-    // It may throw RTIinternalError.
-    checkHandle(federate);
-
     // It may throw FederationExecutionDoesNotExist.
     Federation *federation = searchFederation(federationHandle);
 
@@ -232,9 +208,6 @@
            RestoreInProgress,
            RTIinternalError)
 {
-    // It may throw RTIinternalError.
-    checkHandle(federate);
-
     // It may throw FederationExecutionDoesNotExist.
     Federation *federation = searchFederation(federationHandle);
 
@@ -275,15 +248,14 @@
     return federate ;
 }
 
-// ----------------------------------------------------------------------------
-// searchFederation
 Federation*
 FederationsList::searchFederation(Handle federationHandle)
     throw (FederationExecutionDoesNotExist)
 {
     HandleFederationMap::const_iterator i = 
_handleFederationMap.find(federationHandle);
-    if (i != _handleFederationMap.end())
+    if (i != _handleFederationMap.end()) {
             return i->second;
+    }
 
     D.Out(pdExcept, "Unknown Federation Handle %d.", federationHandle);
     throw FederationExecutionDoesNotExist("Bad Federation Handle.");
@@ -318,8 +290,6 @@
            RTIinternalError)
 {
     G.Out(pdGendoc,"enter FederationsList::createFederation");
-    // It may throw RTIinternalError
-    checkHandle(federationHandle);
     auditFile << ", Handle : " << federationHandle ;
     if (name.empty()) throw RTIinternalError("Invalid Federation Name.");
 
@@ -377,9 +347,6 @@
            RestoreInProgress,
            RTIinternalError)
 {
-    // It may throw RTIinternalError.
-    checkHandle(federate);
-
     // It may throw FederationExecutionDoesNotExist.
     Federation *federation = searchFederation(federationHandle);
 
@@ -404,9 +371,6 @@
           InvalidFederationTime,
            RTIinternalError)
 {
-    // It may throw RTIinternalError.
-    checkHandle(federate);
-
     // It may throw FederationExecutionDoesNotExist.
     Federation *federation = searchFederation(federationHandle);
 
@@ -428,9 +392,6 @@
            RestoreInProgress,
            RTIinternalError)
 {
-    // It may throw RTIinternalError.
-    checkHandle(federate);
-
     // It may throw FederationExecutionDoesNotExist.
     Federation *federation = searchFederation(federationHandle);
 
@@ -505,8 +466,6 @@
            RestoreInProgress,
            RTIinternalError)
 {
-    // It may throw RTIinternalError.
-    checkHandle(federate);
     D.Out(pdTrace, "federationHandle = %d, federate = %d.", federationHandle, 
federate);
 
     // It may throw FederationExecutionDoesNotExist.
@@ -517,21 +476,6 @@
 }
 
 // ----------------------------------------------------------------------------
-// checkHandle
-/*! handle can be any type of handle, not only a Federation handle.
-  Throw an exception if Handle is not correct(too low or too big)
-*/
-void
-FederationsList::checkHandle(Handle handle)
-    throw (RTIinternalError)
-{
-    if (handle <= 0) {
-        D.Out(pdExcept, "Illegal Handle %d.", handle);
-        throw RTIinternalError("Negative or null Handle.");
-    }
-}
-
-// ----------------------------------------------------------------------------
 // updateRegulator
 void
 FederationsList::updateRegulator(Handle federationHandle,
@@ -541,9 +485,6 @@
            FederateNotExecutionMember,
            RTIinternalError)
 {
-    // It may throw RTIinternalError.
-    checkHandle(federate);
-
     // It may throw FederationExecutionDoesNotExist.
     Federation *federation = searchFederation(federationHandle);
 
@@ -570,9 +511,6 @@
            RestoreInProgress,
            RTIinternalError)
 {
-    // It may throw RTIinternalError.
-    checkHandle(federate);
-
     // It may throw FederationExecutionDoesNotExist.
     Federation *federation = searchFederation(federationHandle);
 
@@ -599,9 +537,6 @@
            RestoreInProgress,
            RTIinternalError)
 {
-    // It may throw RTIinternalError.
-    checkHandle(federate);
-
     // It may throw FederationExecutionDoesNotExist.
     Federation *federation = searchFederation(federationHandle);
 
@@ -631,9 +566,6 @@
 {
     G.Out(pdGendoc,"enter FederationsList::updateParameter with time");
 
-    // It may throw RTIinternalError.
-    checkHandle(federate);
-
     // It may throw FederationExecutionDoesNotExist.
     Federation *federation = searchFederation(federationHandle);
 
@@ -665,10 +597,6 @@
            RTIinternalError)
 {
     G.Out(pdGendoc,"enter FederationsList::updateParameter without time");
-
-    // It may throw RTIinternalError.
-    checkHandle(federate);
-
     // It may throw FederationExecutionDoesNotExist.
     Federation *federation = searchFederation(federationHandle);
 
@@ -801,9 +729,6 @@
            RestoreInProgress,
            RTIinternalError)
 {
-    // It may throw RTIinternalError.
-    checkHandle(federate);
-
     // It may throw FederationExecutionDoesNotExist.
     Federation *federation = searchFederation(federationHandle);
 
@@ -829,9 +754,6 @@
            RTIinternalError)
 
 {
-    // It may throw RTIinternalError.
-    checkHandle(federate);
-
     // It may throw FederationExecutionDoesNotExist.
     Federation *federation = searchFederation(federationHandle);
 
@@ -854,9 +776,6 @@
            RestoreInProgress,
            RTIinternalError)
 {
-    // It may throw RTIinternalError.
-    checkHandle(federate);
-
     // It may throw FederationExecutionDoesNotExist.
     Federation *federation = searchFederation(federationHandle);
 
@@ -880,9 +799,6 @@
            SecurityError,
            RTIinternalError)
 {
-    // It may throw RTIinternalError.
-    checkHandle(federate);
-
     // It may throw FederationExecutionDoesNotExist.
     Federation *federation = searchFederation(federationHandle);
 
@@ -900,9 +816,6 @@
            RestoreInProgress,
            RTIinternalError)
 {
-    // It may throw RTIinternalError.
-    checkHandle(federate);
-
     // It may throw FederationExecutionDoesNotExist.
     Federation *federation = searchFederation(federationHandle);
 
@@ -963,9 +876,6 @@
            RestoreInProgress,
            RTIinternalError)
 {
-    // It may throw RTIinternalError.
-    checkHandle(federate);
-
     // It may throw FederationExecutionDoesNotExist.
     Federation *federation = searchFederation(federationHandle);
 
@@ -981,9 +891,6 @@
     throw ()
 {
     try {
-        // It may throw RTIinternalError.
-        checkHandle(federate);
-
         // It may throw FederationExecutionDoesNotExist.
         Federation *federation = searchFederation(federationHandle);
         federation->kill(federate);
@@ -1010,9 +917,6 @@
     // It may throw FederationExecutionDoesNotExist.
     Federation *federation = searchFederation(federationHandle);
 
-    // It may throw RTIinternalError.
-    checkHandle(federate);
-
     D.Out(pdDebug, "Owner of Attribute %u of Object %u .", attribute, id);
 
     return federation->isOwner(federate, id, attribute);
@@ -1035,9 +939,6 @@
     // It may throw FederationExecutionDoesNotExist.
     Federation *federation = searchFederation(federationHandle);
 
-    // It may throw RTIinternalError.
-    checkHandle(federate);
-
     D.Out(pdDebug, "Owner of Attribute %u of Object %u .", attribute, id);
 
     federation->queryAttributeOwnership(federate, id, attribute);
@@ -1064,9 +965,6 @@
     // It may throw FederationExecutionDoesNotExist.
     Federation *federation = searchFederation(federationHandle);
 
-    // It may throw RTIinternalError.
-    checkHandle(federate);
-
     D.Out(pdDebug, "NegotiatedAttributeOwnershipDivestiture of Object %u.", 
id);
 
     federation->negotiateDivestiture(federate, id, attributes, list_size, tag);
@@ -1094,9 +992,6 @@
     // It may throw FederationExecutionDoesNotExist.
     Federation *federation = searchFederation(federationHandle);
 
-    // It may throw RTIinternalError.
-    checkHandle(federate);
-
     federation->acquireIfAvailable(federate, id, attributes, list_size);
 }
 
@@ -1118,10 +1013,6 @@
 {
     // It may throw FederationExecutionDoesNotExist.
     Federation *federation = searchFederation(federationHandle);
-
-    // It may throw RTIinternalError.
-    checkHandle(federate);
-
     federation->divest(federate, id, attributes, list_size);
 }
 
@@ -1146,12 +1037,7 @@
 {
     // It may throw FederationExecutionDoesNotExist.
     Federation *federation = searchFederation(federationHandle);
-
-    // It may throw RTIinternalError.
-    checkHandle(federate);
-
     D.Out(pdDebug, "attributeOwnershipAcquisition of Object %u .", id);
-
     federation->acquire(federate, id, attributes, list_size, tag);
 }
 
@@ -1170,9 +1056,6 @@
     // It may throw FederationExecutionDoesNotExist.
     Federation *federation = searchFederation(federationHandle);
 
-    // It may throw RTIinternalError.
-    checkHandle(federate);
-
     D.Out(pdDebug,
           "cancelNegotiatedAttributeOwnershipDivestiture of Object %u .", id);
 
@@ -1199,9 +1082,6 @@
     // It may throw FederationExecutionDoesNotExist.
     Federation *federation = searchFederation(federationHandle);
 
-    // It may throw RTIinternalError.
-    checkHandle(federate);
-
     D.Out(pdDebug, "AttributeOwnershipRealeaseResponse of Object %u .", id);
 
     return federation->respondRelease(federate, id, attributes, list_size);
@@ -1227,9 +1107,6 @@
     // It may throw FederationExecutionDoesNotExist.
     Federation *federation = searchFederation(federationHandle);
 
-    // It may throw RTIinternalError.
-    checkHandle(federate);
-
     D.Out(pdDebug, "cancelAttributeOwnershipAcquisition of Object %u .", id);
 
     federation->cancelAcquisition(federate, id, attributes, list_size);
@@ -1245,7 +1122,6 @@
            SaveInProgress, RestoreInProgress, RTIinternalError)
 {
     Federation *federation = searchFederation(federationHandle);
-    checkHandle(federate);
 
     Debug(D, pdDebug) << "Create " << nb_extents << "-extent Region "
                << "in space " << space << endl ;
@@ -1262,7 +1138,6 @@
     throw (InvalidExtents, SaveInProgress, RestoreInProgress, RTIinternalError)
 {
     Federation *federation = searchFederation(federationHandle);
-    checkHandle(federate);
 
     Debug(D, pdDebug) << "Modify region #" << region << endl ;
     federation->modifyRegion(federate, region, extents);
@@ -1277,7 +1152,6 @@
            SaveInProgress, RestoreInProgress, RTIinternalError)
 {
     Federation *federation = searchFederation(federationHandle);
-    checkHandle(federate);
 
     Debug(D, pdDebug) << "Delete region " << region << endl ;
 
@@ -1298,7 +1172,6 @@
     Debug(D, pdDebug) << "Associate region " << region << " for updates." << 
endl ;
 
     Federation *federation = searchFederation(federationHandle);
-    checkHandle(federate);
 
     federation->associateRegion(federate, object, region, nb_attributes, 
attributes);
 }
@@ -1313,7 +1186,6 @@
               RestoreInProgress, RTIinternalError)
 {
     Federation *federation = searchFederation(federationHandle);
-    checkHandle(federate);
 
     Debug(D, pdDebug) << "Unassociate region for updates " << region << endl ;
 
@@ -1332,7 +1204,6 @@
           RTIinternalError)
 {
     Federation *federation = searchFederation(federationHandle);
-    checkHandle(federate);
 
     Debug(D, pdDebug) << " Subscribe attributes with region " << region << 
endl ;
 
@@ -1349,7 +1220,6 @@
           RTIinternalError)
 {
     Federation *federation = searchFederation(federationHandle);
-    checkHandle(federate);
 
     Debug(D, pdDebug) << "Unsubscribe attributes with region " << region << 
endl ;
 
@@ -1366,7 +1236,6 @@
           RTIinternalError)
 {
     Federation *federation = searchFederation(federationHandle);
-    checkHandle(federate);
 
     Debug(D, pdDebug) << "Subscribe interaction with region " << region << 
endl ;
 
@@ -1383,7 +1252,6 @@
           RTIinternalError)
 {
     Federation *federation = searchFederation(federationHandle);
-    checkHandle(federate);
 
     Debug(D, pdDebug) << "Unsubscribe interaction with region " << region << 
endl ;
 
@@ -1406,7 +1274,6 @@
               RTIinternalError)
 {
     Federation *federation = searchFederation(federationHandle);
-    checkHandle(federate);
 
     return federation->registerObjectWithRegion(federate, handle, tag, region, 
nb, attrs);
 }
@@ -1522,14 +1389,11 @@
 
     Federation *federation = searchFederation(federationHandle);
 
-    // It may throw RTIinternalError.
-    checkHandle(federate);
-
     // It may throw ObjectNotKnown
     return federation->requestObjectOwner(federate, id, attributes, list_size);
 }
 
 }} // certi::rtig
 
-// EOF $Id: FederationsList.cc,v 3.67 2009/11/20 19:43:40 erk Exp $
+// EOF $Id: FederationsList.cc,v 3.68 2009/11/20 22:43:46 erk Exp $
 




reply via email to

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