certi-cvs
[Top][All Lists]
Advanced

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

[certi-cvs] certi RTIG/RTIG_processing.cc libCERTI/NM_Class...


From: certi-cvs
Subject: [certi-cvs] certi RTIG/RTIG_processing.cc libCERTI/NM_Class...
Date: Sun, 07 Jun 2009 15:08:46 +0000

CVSROOT:        /sources/certi
Module name:    certi
Changes by:     Petr Gotthard <gotthardp>       09/06/07 15:08:46

Modified files:
        RTIG           : RTIG_processing.cc 
        libCERTI       : NM_Classes.cc 
        libRTI         : RTIambassador.cc RTItypesImp.cc RTItypesImp.hh 

Log message:
        BUG #26704, BUG #26705: Fixed CreateRegion and DeleteRegion functions.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/certi/RTIG/RTIG_processing.cc?cvsroot=certi&r1=3.82&r2=3.83
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/NM_Classes.cc?cvsroot=certi&r1=3.15&r2=3.16
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/RTIambassador.cc?cvsroot=certi&r1=3.102&r2=3.103
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/RTItypesImp.cc?cvsroot=certi&r1=3.3&r2=3.4
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/RTItypesImp.hh?cvsroot=certi&r1=3.3&r2=3.4

Patches:
Index: RTIG/RTIG_processing.cc
===================================================================
RCS file: /sources/certi/certi/RTIG/RTIG_processing.cc,v
retrieving revision 3.82
retrieving revision 3.83
diff -u -b -r3.82 -r3.83
--- RTIG/RTIG_processing.cc     8 Apr 2009 10:47:19 -0000       3.82
+++ RTIG/RTIG_processing.cc     7 Jun 2009 15:08:45 -0000       3.83
@@ -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.82 2009/04/08 10:47:19 approx Exp $
+// $Id: RTIG_processing.cc,v 3.83 2009/06/07 15:08:45 gotthardp Exp $
 // ----------------------------------------------------------------------------
 
 #include <config.h>
@@ -1309,7 +1309,6 @@
     // TODO: audit...
 
     NM_DDM_Create_Region rep ;
-
     rep.region = federations.createRegion(req->federation,
                                            req->federate,
                                            req->space,
@@ -1328,13 +1327,13 @@
 void
 RTIG::processModifyRegion(Socket *link, NetworkMessage *req)
 {
-    federations.modifyRegion(req->federation, req->federate,
-                             req->region, req->getExtents());
-
     D[pdDebug] << "Federate " << req->federate << " of Federation "
                << req->federation << " modifies region " << req->region
                << endl ;
 
+    federations.modifyRegion(req->federation, req->federate,
+                             req->region, req->getExtents());
+
     NM_DDM_Modify_Region rep ;
     rep.federate = req->federate ;
     rep.send(link,NM_msgBufSend);
@@ -1347,12 +1346,12 @@
 {
     // TODO: audit...
 
-    federations.deleteRegion(req->federation, req->federate, req->region);
-
     D[pdDebug] << "Federate " << req->federate << " of Federation "
                << req->federation << " deletes region " << req->region
                << endl ;
 
+    federations.deleteRegion(req->federation, req->federate, req->region);
+
     NM_DDM_Delete_Region rep ;
     rep.federate = req->federate ;
     rep.region = req->region ;
@@ -1553,4 +1552,4 @@
 
 }} // namespace certi/rtig
 
-// $Id: RTIG_processing.cc,v 3.82 2009/04/08 10:47:19 approx Exp $
+// $Id: RTIG_processing.cc,v 3.83 2009/06/07 15:08:45 gotthardp Exp $

Index: libCERTI/NM_Classes.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/NM_Classes.cc,v
retrieving revision 3.15
retrieving revision 3.16
diff -u -b -r3.15 -r3.16
--- libCERTI/NM_Classes.cc      8 Apr 2009 10:47:19 -0000       3.15
+++ libCERTI/NM_Classes.cc      7 Jun 2009 15:08:46 -0000       3.16
@@ -1562,13 +1562,19 @@
        /* call mother class */      
        NetworkMessage::serialize(msgBuffer);   
        /* specific code (if any) goes here */
-       BasicMessage::serialize(msgBuffer);
+       msgBuffer.write_int32(federation);
+       msgBuffer.write_int32(federate);
+       msgBuffer.write_int32(region);
+       writeExtents(msgBuffer);
 } /* end of serialize */ 
 void NM_DDM_Modify_Region::deserialize(MessageBuffer& msgBuffer) {
        /* call mother class */      
        NetworkMessage::deserialize(msgBuffer); 
        /* specific code (if any) goes here */
-       BasicMessage::deserialize(msgBuffer);   
+       federation = msgBuffer.read_int32();
+       federate   = msgBuffer.read_int32();
+       region     = msgBuffer.read_int32();
+       readExtents(msgBuffer);
 } /* end of deserialize */
 /*<END>---------- DDM_Modify_Region ------------<END>*/
 
@@ -1584,13 +1590,17 @@
        /* call mother class */      
        NetworkMessage::serialize(msgBuffer); 
        /* specific code (if any) goes here */
-       BasicMessage::serialize(msgBuffer);     
+       msgBuffer.write_int32(federation);
+       msgBuffer.write_int32(federate);
+       msgBuffer.write_int32(region);
 } /* end of serialize */ 
 void NM_DDM_Delete_Region::deserialize(MessageBuffer& msgBuffer) {
        /* call mother class */      
        NetworkMessage::deserialize(msgBuffer); 
        /* specific code (if any) goes here */
-       BasicMessage::deserialize(msgBuffer);
+       federation = msgBuffer.read_int32();
+       federate   = msgBuffer.read_int32();
+       region     = msgBuffer.read_int32();
 } /* end of deserialize */
 /*<END>---------- DDM_Delete_Region ------------<END>*/
 

Index: libRTI/RTIambassador.cc
===================================================================
RCS file: /sources/certi/certi/libRTI/RTIambassador.cc,v
retrieving revision 3.102
retrieving revision 3.103
diff -u -b -r3.102 -r3.103
--- libRTI/RTIambassador.cc     2 Apr 2009 19:58:06 -0000       3.102
+++ libRTI/RTIambassador.cc     7 Jun 2009 15:08:46 -0000       3.103
@@ -19,7 +19,7 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 // USA
 //
-// $Id: RTIambassador.cc,v 3.102 2009/04/02 19:58:06 erk Exp $
+// $Id: RTIambassador.cc,v 3.103 2009/06/07 15:08:46 gotthardp Exp $
 // ----------------------------------------------------------------------------
 
 #include "RTI.hh"
@@ -28,7 +28,6 @@
 #include "RTIambPrivateRefs.hh"
 #include "RTItypesImp.hh"
 
-#include "FedRegion.hh"
 #include "Message.hh"
 #include "PrettyDebug.hh"
 
@@ -64,7 +63,7 @@
     for (int i = 0 ; i < nb ; ++i) {
        RTI::Region *region = regions[i] ;
        try {
-               vect[i] = dynamic_cast<FedRegion *>(region)->getHandle();
+               vect[i] = dynamic_cast<RegionImp *>(region)->getHandle();
        }
        catch (std::bad_cast) {
                throw RTI::RegionNotKnown("");
@@ -78,7 +77,7 @@
     throw (RTI::RegionNotKnown, RTI::RTIinternalError)
 {
     try {
-       return dynamic_cast<const FedRegion &>(region).getHandle();
+       return dynamic_cast<const RegionImp &>(region).getHandle();
     }
     catch (std::bad_cast) {
        throw RTI::RegionNotKnown("");
@@ -1925,7 +1924,7 @@
            RTI::RTIinternalError)
 {
     try {
-       FedRegion &region = dynamic_cast<FedRegion &>(r);
+       RegionImp &region = dynamic_cast<RegionImp &>(r);
        D[pdDebug] << "Notify About Region " << region.getHandle()
                   << " Modification" << endl ;
        Message req, rep ;
@@ -1968,7 +1967,7 @@
 
     req.setType(Message::DDM_DELETE_REGION);
     try {
-       req.setRegion(dynamic_cast<FedRegion *>(region)->getHandle());
+       req.setRegion(dynamic_cast<RegionImp *>(region)->getHandle());
     }
     catch (std::bad_cast) {
        throw RegionNotKnown("");
@@ -2949,4 +2948,4 @@
     privateRefs->executeService(&req, &rep);
 }
 
-// $Id: RTIambassador.cc,v 3.102 2009/04/02 19:58:06 erk Exp $
+// $Id: RTIambassador.cc,v 3.103 2009/06/07 15:08:46 gotthardp Exp $

Index: libRTI/RTItypesImp.cc
===================================================================
RCS file: /sources/certi/certi/libRTI/RTItypesImp.cc,v
retrieving revision 3.3
retrieving revision 3.4
diff -u -b -r3.3 -r3.4
--- libRTI/RTItypesImp.cc       4 Apr 2009 13:18:12 -0000       3.3
+++ libRTI/RTItypesImp.cc       7 Jun 2009 15:08:46 -0000       3.4
@@ -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: RTItypesImp.cc,v 3.3 2009/04/04 13:18:12 gotthardp Exp $
+// $Id: RTItypesImp.cc,v 3.4 2009/06/07 15:08:46 gotthardp Exp $
 // ----------------------------------------------------------------------------
 
 #include "certi.hh"
@@ -464,7 +464,7 @@
 
 // ----------------------------------------------------------------------------
 RegionImp::RegionImp(RegionHandle h, SpaceHandle s, const std::vector<Extent> 
&ext)
-    : handle(h), space(s), coExtents(ext)
+    : handle(h), space(s), extents(ext), effectiveExtents(ext)
 {
 }
 
@@ -517,14 +517,14 @@
 ULong RegionImp::getNumberOfExtents() const
     throw ()
 {
-    return coExtents.size();
+    return extents.size();
 }
 
 ULong RegionImp::getRangeLowerBoundNotificationLimit(ExtentIndex index, 
DimensionHandle dimension) const
     throw (RTI::ArrayIndexOutOfBounds)
 {
-    if (index < coExtents.size())
-        return coExtents[index].getRangeLowerBound(dimension);
+    if (index < effectiveExtents.size())
+        return effectiveExtents[index].getRangeLowerBound(dimension);
     else
         throw RTI::ArrayIndexOutOfBounds("Extent index above limit");
 }
@@ -532,10 +532,34 @@
 ULong RegionImp::getRangeUpperBoundNotificationLimit(ExtentIndex index, 
DimensionHandle dimension) const
     throw (RTI::ArrayIndexOutOfBounds)
 {
-    if (index < coExtents.size())
-        return coExtents[index].getRangeUpperBound(dimension);
+    if (index < effectiveExtents.size())
+        return effectiveExtents[index].getRangeUpperBound(dimension);
     else
         throw RTI::ArrayIndexOutOfBounds("Extent index above limit");
 }
 
-// $Id: RTItypesImp.cc,v 3.3 2009/04/04 13:18:12 gotthardp Exp $
+RegionHandle RegionImp::getHandle() const
+{
+    return handle;
+}
+
+/** Get the region's extents 
+    \return The extents, as a vector 
+ */
+const std::vector<Extent> &
+RegionImp::getExtents() const
+{
+    return extents;
+}
+
+/** Register a successful notifyAboutRegionModification()
+ */
+void RegionImp::commit()
+{
+    if (extents.size() != effectiveExtents.size())
+        throw InvalidExtents("Different number of extents");
+
+    effectiveExtents = extents;
+}
+
+// $Id: RTItypesImp.cc,v 3.4 2009/06/07 15:08:46 gotthardp Exp $

Index: libRTI/RTItypesImp.hh
===================================================================
RCS file: /sources/certi/certi/libRTI/RTItypesImp.hh,v
retrieving revision 3.3
retrieving revision 3.4
diff -u -b -r3.3 -r3.4
--- libRTI/RTItypesImp.hh       4 Apr 2009 13:18:13 -0000       3.3
+++ libRTI/RTItypesImp.hh       7 Jun 2009 15:08:46 -0000       3.4
@@ -19,7 +19,7 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 // USA
 //
-// $Id: RTItypesImp.hh,v 3.3 2009/04/04 13:18:13 gotthardp Exp $
+// $Id: RTItypesImp.hh,v 3.4 2009/06/07 15:08:46 gotthardp Exp $
 // ----------------------------------------------------------------------------
 
 #ifndef _RTI_TYPESIMP_HH
@@ -255,16 +255,22 @@
     virtual ULong getRangeUpperBoundNotificationLimit(ExtentIndex, 
DimensionHandle) const
         throw (RTI::ArrayIndexOutOfBounds);
 
+    RegionHandle getHandle() const;
+
+    const std::vector<Extent>& getExtents() const;
+
+    void commit();
+
 private:
     RegionHandle handle;
     SpaceHandle space;
     std::vector<Extent> extents;
-
-    std::vector<Extent> coExtents;
+    // extents used in last notifyAboutRegionModification
+    std::vector<Extent> effectiveExtents;
 };
 
 }
 
 #endif // _RTI_TYPESIMP_HH
 
-// $Id: RTItypesImp.hh,v 3.3 2009/04/04 13:18:13 gotthardp Exp $
+// $Id: RTItypesImp.hh,v 3.4 2009/06/07 15:08:46 gotthardp Exp $




reply via email to

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