certi-cvs
[Top][All Lists]
Advanced

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

[certi-cvs] certi libCERTI/ObjectClass.cc libCERTI/ObjectCl...


From: certi-cvs
Subject: [certi-cvs] certi libCERTI/ObjectClass.cc libCERTI/ObjectCl...
Date: Sat, 21 Nov 2009 14:46:18 +0000

CVSROOT:        /sources/certi
Module name:    certi
Changes by:     Eric NOULARD <erk>      09/11/21 14:46:18

Modified files:
        libCERTI       : ObjectClass.cc ObjectClass.hh RootObject.cc 
        RTIG           : Federation.cc 

Log message:
        Check-in clean-up patch from Mathias
        patch #6986: Use a std::map to store the class attributes indexed by 
handle
        (second -2 patch)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/ObjectClass.cc?cvsroot=certi&r1=3.71&r2=3.72
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/ObjectClass.hh?cvsroot=certi&r1=3.47&r2=3.48
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/RootObject.cc?cvsroot=certi&r1=3.44&r2=3.45
http://cvs.savannah.gnu.org/viewcvs/certi/RTIG/Federation.cc?cvsroot=certi&r1=3.116&r2=3.117

Patches:
Index: libCERTI/ObjectClass.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/ObjectClass.cc,v
retrieving revision 3.71
retrieving revision 3.72
diff -u -b -r3.71 -r3.72
--- libCERTI/ObjectClass.cc     20 Nov 2009 17:33:57 -0000      3.71
+++ libCERTI/ObjectClass.cc     21 Nov 2009 14:46:17 -0000      3.72
@@ -19,7 +19,7 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 // USA
 //
-// $Id: ObjectClass.cc,v 3.71 2009/11/20 17:33:57 erk Exp $
+// $Id: ObjectClass.cc,v 3.72 2009/11/21 14:46:17 erk Exp $
 // ----------------------------------------------------------------------------
 
 #include  "Object.hh"
@@ -35,17 +35,14 @@
 #include "helper.hh"
 #include <sstream>
 #include <memory>
+#include <iostream>
+#include <cassert>
 
 #ifdef _WIN32
-       #include <windows.h>
-       #include <algorithm>
-       #ifdef max
-               #undef max
-       #endif
-#else
-       #include <iostream>
+#ifdef max
+#undef max
+#endif
 #endif
-#include <assert.h>
 
 using std::cout ;
 using std::endl ;
@@ -65,7 +62,7 @@
     if (theAttribute == NULL)
         throw RTIinternalError("Tried to add NULL attribute.");
 
-    theAttribute->setHandle(attributeSet.size() + 1);
+    theAttribute->setHandle(_handleClassAttributeMap.size() + 1);
     theAttribute->server = server ;
 
     // If the attribute is inherited, it keeps its security level.
@@ -73,7 +70,7 @@
     if (!is_inherited)
         theAttribute->level = securityLevelId ;
 
-    attributeSet.push_front(theAttribute);
+    _handleClassAttributeMap[theAttribute->getHandle()] = theAttribute;
 
     D.Out(pdProtocol, "ObjectClass %u has a new attribute %u.",
           handle, theAttribute->getHandle());
@@ -86,23 +83,19 @@
 void
 ObjectClass::addInheritedClassAttributes(ObjectClass *the_child)
 {
-    // The Attribute List is read backwards to respect the same attribute order
-    // for the child(Attributes are inserted at the beginning of the list).
-    ObjectClassAttribute *childAttribute = NULL ;
-    list<ObjectClassAttribute *>::reverse_iterator a ;
-    for (a = attributeSet.rbegin(); a != attributeSet.rend(); a++) {
-        assert((*a) != NULL);
+    for (HandleClassAttributeMap::iterator a = 
_handleClassAttributeMap.begin(); a != _handleClassAttributeMap.end(); ++a) {
+        assert(a->second != NULL);
 
-        childAttribute = new ObjectClassAttribute(*a);
+        ObjectClassAttribute *childAttribute = new 
ObjectClassAttribute(*a->second);
         assert(childAttribute != NULL);
 
         D.Out(pdProtocol,
               "ObjectClass %u adding new attribute %d to child class %u.",
-              handle, (*a)->getHandle(), the_child->getHandle());
+              handle, a->second->getHandle(), the_child->getHandle());
 
         the_child->addAttribute(childAttribute);
 
-        if (childAttribute->getHandle() != (*a)->getHandle())
+        if (childAttribute->getHandle() != a->second->getHandle())
             throw RTIinternalError("Error while copying child's attributes.");
     }
 } /* end of addInheritedClassAttributes */
@@ -116,7 +109,6 @@
 ObjectClass::broadcastClassMessage(ObjectClassBroadcastList *ocbList,
                                   const Object *source)
 {
-    int i, trouve;
     G.Out(pdGendoc,"enter ObjectClass::broadcastClassMessage");
     // 1. Set ObjectHandle to local class Handle.
     ocbList->message->objectClass = handle ;
@@ -126,19 +118,15 @@
     // 2. Update message attribute list by removing child's attributes.
     if ((ocbList->message->getType() == 
NetworkMessage::REFLECT_ATTRIBUTE_VALUES) ||
         (ocbList->message->getType() == 
NetworkMessage::REQUEST_ATTRIBUTE_OWNERSHIP_ASSUMPTION)) {
-        int attr = 0 ;
-        while (attr < ocbList->message->handleArraySize) {
+        for (int attr = 0; attr < ocbList->message->handleArraySize;) {
             // If the attribute is not in that class, remove it from
             // the message.
-            try {
-                getAttribute(ocbList->message->handleArray[attr]);
-                attr++ ;
-            }
-            catch (AttributeNotDefined &e) {
+            if (hasAttribute(ocbList->message->handleArray[attr]))
+                ++attr;
+            else
                 ocbList->message->removeAttribute(attr);
             }
         }
-    }
 
     // 3. Add class/attributes subscribers to the list.
     switch(ocbList->message->getType()) {
@@ -157,31 +145,29 @@
       case NetworkMessage::REFLECT_ATTRIBUTE_VALUES: {
           // For each class attribute, update the list be adding federates who
           // subscribed to the attribute.
-          list<ObjectClassAttribute *>::const_iterator a ;
-          for (a = attributeSet.begin(); a != attributeSet.end(); a++) {
-              // Do not consider attributes that are not updated
-              trouve = 0;
-              for (i=0 ; i< ocbList->message->handleArraySize ; i++) {
-                  if ((*a)->getHandle() == ocbList->message->handleArray[i])
-                     trouve = 1;
+          for (int i = 0 ; i < ocbList->message->handleArraySize ; ++i) {
+              AttributeHandle attributeHandle = 
ocbList->message->handleArray[i];
+
+              HandleClassAttributeMap::iterator a = 
_handleClassAttributeMap.find(attributeHandle);
+              // May be this is a hard error?
+              if (a == _handleClassAttributeMap.end()) {
+                  continue;
               }
-              if (trouve) {
-                ObjectAttribute *attr = 
source->getAttribute((*a)->getHandle());
+
+              ObjectAttribute *attr = source->getAttribute(attributeHandle);
                         const RTIRegion *update_region = attr->getRegion();
-                Debug(D, pdTrace) << "RAV: attr " << (*a)->getHandle()
+              Debug(D, pdTrace) << "RAV: attr " << attributeHandle
                            << " / region " << (update_region ? 
update_region->getHandle() : 0)
                            << std::endl ;
-                 (*a)->updateBroadcastList(ocbList, update_region);
-              }
+              a->second->updateBroadcastList(ocbList, update_region);
           }
       } break ;
 
       case NetworkMessage::REQUEST_ATTRIBUTE_OWNERSHIP_ASSUMPTION: {
           // For each class attribute, update the list be adding federates who
           // subscribed to the attribute.
-          list<ObjectClassAttribute *>::const_iterator a ;
-          for (a = attributeSet.begin(); a != attributeSet.end(); a++) {
-              (*a)->updateBroadcastList(ocbList);
+          for (HandleClassAttributeMap::iterator i = 
_handleClassAttributeMap.begin(); i != _handleClassAttributeMap.end(); ++i) {
+              i->second->updateBroadcastList(ocbList);
           }
       } break ;
 
@@ -303,14 +289,13 @@
               "ObjectClass %d : Instances remaining while exiting...", handle);
 
     // Deleting Class Attributes
-    while (!attributeSet.empty()) {
-        delete attributeSet.front();
-        attributeSet.pop_front();
+    for (HandleClassAttributeMap::iterator i = 
_handleClassAttributeMap.begin(); i != _handleClassAttributeMap.end(); ++i) {
+        delete i->second;
     }
+    _handleClassAttributeMap.clear();
+
     // Deleting subclasses
-    if (NULL!=subClasses) {
        delete subClasses;
-    }
 } /* end of ObjectClass destructor */
 
 // ----------------------------------------------------------------------------
@@ -466,10 +451,9 @@
 
 
     // Display Attributes
-    cout << " " << attributeSet.size() << " Attribute(s):" << endl ;
-    list<ObjectClassAttribute *>::const_iterator a ;
-    for (a = attributeSet.begin(); a != attributeSet.end(); a++) {
-        (*a)->display();
+    cout << " " << _handleClassAttributeMap.size() << " Attribute(s):" << endl 
;
+    for (HandleClassAttributeMap::const_iterator i = 
_handleClassAttributeMap.begin(); i != _handleClassAttributeMap.end(); ++i) {
+        i->second->display();
     }
 
     // Display Instances
@@ -488,11 +472,10 @@
 {
     G.Out(pdGendoc,"enter ObjectClass::getAttributeHandle");
 
-    list<ObjectClassAttribute *>::const_iterator a ;
-    for (a = attributeSet.begin(); a != attributeSet.end(); a++) {
-        if ((*a)->isNamed(the_name)) {
+    for (HandleClassAttributeMap::const_iterator i = 
_handleClassAttributeMap.begin(); i != _handleClassAttributeMap.end(); ++i) {
+        if (the_name == i->second->getName()) {
             G.Out(pdGendoc,"exit  ObjectClass::getAttributeHandle");
-            return (*a)->getHandle();
+            return i->second->getHandle();
         }
     }
 
@@ -512,7 +495,6 @@
     return getAttribute(the_handle)->getName();
 }
 
-
 // ----------------------------------------------------------------------------
 /** Get attribute
     @param the_handle Attribute's handle
@@ -522,10 +504,9 @@
 ObjectClass::getAttribute(AttributeHandle the_handle) const
     throw (AttributeNotDefined)
 {
-    list<ObjectClassAttribute *>::const_iterator a ;
-    for (a = attributeSet.begin(); a != attributeSet.end(); a++) {
-        if ((*a)->getHandle() == the_handle)
-            return (*a);
+    HandleClassAttributeMap::const_iterator i = 
_handleClassAttributeMap.find(the_handle);
+    if (i != _handleClassAttributeMap.end()) {
+        return i->second;
     }
 
     D.Out(pdExcept, "ObjectClass %d: Attribute %d not defined.",
@@ -535,6 +516,14 @@
 }
 
 // ----------------------------------------------------------------------------
+//! Return true if the attribute with the given handle is an attribute of this 
object class
+bool
+ObjectClass::hasAttribute(AttributeHandle attributeHandle) const
+{
+    return _handleClassAttributeMap.find(attributeHandle) != 
_handleClassAttributeMap.end();
+}
+
+// ----------------------------------------------------------------------------
 //! Get Object
 Object *
 ObjectClass::getInstanceWithID(ObjectHandle the_id) const
@@ -561,13 +550,13 @@
 bool
 ObjectClass::isFederatePublisher(FederateHandle the_federate) const
 {
-    D.Out(pdRegister, "attributeSet.size() = %d.", attributeSet.size());
+    D.Out(pdRegister, "_handleClassAttributeMap.size() = %d.", 
_handleClassAttributeMap.size());
 
-    list<ObjectClassAttribute *>::const_iterator a ;
-    for (a = attributeSet.begin(); a != attributeSet.end(); a++) {
-        if ((*a)->isPublishing(the_federate))
+    for (HandleClassAttributeMap::const_iterator i = 
_handleClassAttributeMap.begin(); i != _handleClassAttributeMap.end(); ++i) {
+        if (i->second->isPublishing(the_federate)) {
             return true ;
     }
+    }
     return false ;
 }
 
@@ -580,11 +569,11 @@
 bool
 ObjectClass::isSubscribed(FederateHandle fed) const
 {
-    list<ObjectClassAttribute *>::const_iterator a ;
-    for (a = attributeSet.begin(); a != attributeSet.end(); a++) {
-        if ((*a)->isSubscribed(fed))
+    for (HandleClassAttributeMap::const_iterator i = 
_handleClassAttributeMap.begin(); i != _handleClassAttributeMap.end(); ++i) {
+        if (i->second->isSubscribed(fed)) {
             return true ;
     }
+    }
     return false ;
 }
 
@@ -674,10 +663,10 @@
     D.Out(pdInit, "ObjectClass %d: Reset publish info of Federate %d.",
           handle, theFederateHandle);
 
-    list<ObjectClassAttribute *>::const_iterator a ;
-    for (a = attributeSet.begin(); a != attributeSet.end(); a++) {
-        if ((*a)->isPublishing(theFederateHandle))
-            (*a)->unpublish(theFederateHandle);
+    for (HandleClassAttributeMap::iterator i = 
_handleClassAttributeMap.begin(); i != _handleClassAttributeMap.end(); ++i) {
+        if (i->second->isPublishing(theFederateHandle)) {
+            i->second->unpublish(theFederateHandle);
+        }
     }
 
     // Publish attributes one by one.
@@ -722,15 +711,14 @@
     // Ownership management :
     // Copy instance attributes
     // Federate only owns attributes it publishes.
+    for (HandleClassAttributeMap::iterator i = 
_handleClassAttributeMap.begin(); i != _handleClassAttributeMap.end(); ++i) {
     ObjectAttribute * oa ;
-    list<ObjectClassAttribute *>::reverse_iterator a ;
-    for (a = attributeSet.rbegin(); a != attributeSet.rend(); a++) {
-       oa = new ObjectAttribute((*a)->getHandle(),
-                                (*a)->isPublishing(the_federate) ? 
the_federate : 0,
-                                *a);
+       oa = new ObjectAttribute(i->second->getHandle(),
+                                i->second->isPublishing(the_federate) ? 
the_federate : 0,
+                                i->second);
 
         // privilegeToDelete is owned by federate even not published.
-        if ((*a)->isNamed("privilegeToDelete")) {
+        if (i->second->isNamed("privilegeToDelete")) {
             oa->setOwner(the_federate);
         }
 
@@ -922,7 +910,7 @@
             answer->valueArray[i] = the_values[i] ;
         }
 
-        ocbList = new ObjectClassBroadcastList(answer, attributeSet.size());
+        ocbList = new ObjectClassBroadcastList(answer, 
_handleClassAttributeMap.size());
 
         D.Out(pdProtocol,
               "Object %u updated in class %u, now broadcasting...",
@@ -986,7 +974,7 @@
             answer->valueArray[i] = the_values[i];
         }
 
-        ocbList = new ObjectClassBroadcastList(answer, attributeSet.size());
+        ocbList = new ObjectClassBroadcastList(answer, 
_handleClassAttributeMap.size());
 
         D.Out(pdProtocol,
               "Object %u updated in class %u, now broadcasting...",
@@ -1133,7 +1121,7 @@
             AnswerAssumption->handleArraySize = compteur_assumption ;
 
             List = new ObjectClassBroadcastList(AnswerAssumption,
-                                                attributeSet.size());
+                                                
_handleClassAttributeMap.size());
 
             D.Out(pdProtocol,
                   "Object %u divestiture in class %u, now broadcasting...",
@@ -1186,7 +1174,7 @@
             throw ObjectClassNotPublished("");
         }
 
-        //rem attributeSet.size()=attributeState.size()
+        //rem _handleClassAttributeMap.size()=attributeState.size()
         ObjectAttribute * oa ;
         ObjectClassAttribute * oca ;
         for (int i = 0 ; i < theListSize ; i++) {
@@ -1390,7 +1378,7 @@
             AnswerAssumption->handleArraySize = compteur_assumption ;
 
             List = new ObjectClassBroadcastList(AnswerAssumption,
-                                                attributeSet.size());
+                                                
_handleClassAttributeMap.size());
 
             D.Out(pdProtocol,
                   "Object %u updated in class %u, now broadcasting...",
@@ -1678,7 +1666,7 @@
               object_handle, attribute_list[i]);
 
     if (server != NULL) {
-        //rem attributeSet.size()=attributeState.size()
+        //rem _handleClassAttributeMap.size()=attributeState.size()
         ObjectAttribute * oa ;
         ObjectClassAttribute * oca ;
 
@@ -1746,10 +1734,9 @@
     Debug(D, pdTrace) << "ObjectClass::unsubscribe" << ": fed " << fed << ", 
region "
               << (region ? region->getHandle() : 0) << std::endl ;
 
-    list<ObjectClassAttribute *>::iterator i ;
-    for (i = attributeSet.begin(); i != attributeSet.end(); ++i) {
-       if ((*i)->isSubscribed(fed, region)) {
-           (*i)->unsubscribe(fed, region);
+    for (HandleClassAttributeMap::iterator i = 
_handleClassAttributeMap.begin(); i != _handleClassAttributeMap.end(); ++i) {
+       if (i->second->isSubscribed(fed, region)) {
+           i->second->unsubscribe(fed, region);
        }
     }
 }
@@ -1760,10 +1747,9 @@
 void
 ObjectClass::unsubscribe(FederateHandle fed)
 {
-    list<ObjectClassAttribute *>::iterator i ;
-    for (i = attributeSet.begin(); i != attributeSet.end(); ++i) {
-       if ((*i)->isSubscribed(fed)) {
-           (*i)->unsubscribe(fed);
+    for (HandleClassAttributeMap::iterator i = 
_handleClassAttributeMap.begin(); i != _handleClassAttributeMap.end(); ++i) {
+       if (i->second->isSubscribed(fed)) {
+           i->second->unsubscribe(fed);
        }
     }
 } /* end of unsubscribe */
@@ -1827,11 +1813,6 @@
 //     }
 // }
 
-const ObjectClass::AttributeList_t&
-ObjectClass::getAttributeList(void) {
-           return attributeSet;
-}
-
 } // namespace certi
 
-// $Id: ObjectClass.cc,v 3.71 2009/11/20 17:33:57 erk Exp $
+// $Id: ObjectClass.cc,v 3.72 2009/11/21 14:46:17 erk Exp $

Index: libCERTI/ObjectClass.hh
===================================================================
RCS file: /sources/certi/certi/libCERTI/ObjectClass.hh,v
retrieving revision 3.47
retrieving revision 3.48
diff -u -b -r3.47 -r3.48
--- libCERTI/ObjectClass.hh     19 Nov 2009 18:15:30 -0000      3.47
+++ libCERTI/ObjectClass.hh     21 Nov 2009 14:46:17 -0000      3.48
@@ -19,7 +19,7 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 // USA
 //
-// $Id: ObjectClass.hh,v 3.47 2009/11/19 18:15:30 erk Exp $
+// $Id: ObjectClass.hh,v 3.48 2009/11/21 14:46:17 erk Exp $
 // ----------------------------------------------------------------------------
 
 #ifndef _CERTI_OBJECT_CLASS_HH
@@ -85,9 +85,9 @@
        typedef ObjectClassNotDefined ObjectNotDefinedException;
 
        /**
-        * The type fot the attribute list.
+        * The type for the attribute by handle map.
         */
-       typedef std::list<ObjectClassAttribute*> AttributeList_t;
+       typedef std::map<AttributeHandle, ObjectClassAttribute*> 
HandleClassAttributeMap;
 
        /**
         * Create an objectClass.
@@ -221,6 +221,8 @@
        ObjectClassAttribute *getAttribute(AttributeHandle the_handle) const
        throw (AttributeNotDefined);
 
+       bool hasAttribute(AttributeHandle theHandle) const;
+
        // Instance Management
        ObjectClassBroadcastList *deleteInstance(FederateHandle 
theFederateHandle,
                        ObjectHandle theObjectHandle,
@@ -269,7 +271,8 @@
          * Getter for the attribute list of the object class.
          * param[out] AttributeList_t @see ObjectClass::AttributeList_t
          */
-       const AttributeList_t& getAttributeList(void);
+       const HandleClassAttributeMap& getHandleClassAttributeMap(void) const
+        { return _handleClassAttributeMap; }
 
        //! This Object help to find a TCPLink from a Federate Handle.
        SecurityServer *server ;
@@ -315,8 +318,17 @@
         * default level for non inherited attributes.
         */
        SecurityLevelID securityLevelId ;
-       std::list<ObjectClassAttribute *> attributeSet ;
+
+        /**
+         * All attributes, indexed by handle.
+         */
+        HandleClassAttributeMap _handleClassAttributeMap;        
+
+        /**
+         * All objects of this class, indexed by handle.
+         */
        std::list<Object *> objectSet ;
+
        /**
         * The super class handle.
         * 0 if they aren't any.
@@ -334,4 +346,4 @@
 
 #endif // _CERTI_OBJECT_CLASS_HH
 
-// $Id: ObjectClass.hh,v 3.47 2009/11/19 18:15:30 erk Exp $
+// $Id: ObjectClass.hh,v 3.48 2009/11/21 14:46:17 erk Exp $

Index: libCERTI/RootObject.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/RootObject.cc,v
retrieving revision 3.44
retrieving revision 3.45
diff -u -b -r3.44 -r3.45
--- libCERTI/RootObject.cc      19 Nov 2009 18:15:32 -0000      3.44
+++ libCERTI/RootObject.cc      21 Nov 2009 14:46:17 -0000      3.45
@@ -19,7 +19,7 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 // USA
 //
-// $Id: RootObject.cc,v 3.44 2009/11/19 18:15:32 erk Exp $
+// $Id: RootObject.cc,v 3.45 2009/11/21 14:46:17 erk Exp $
 // ----------------------------------------------------------------------------
 
 #include "Object.hh"
@@ -394,40 +394,32 @@
                 ObjectClassHandle superclassHandle = 
objectClass->getSuperclass();
                 moc.setSuperclassHandle(superclassHandle);
 
-                // Dump only those attributes from the list that are not 
alreay in the parent
-                ObjectClass::AttributeList_t attributeList = 
i->second->getAttributeList();
+                ObjectClass* parent = 0;
                 if (0 < superclassHandle) {
-                        ObjectClass* parent = getObjectClass(superclassHandle);
+                        parent = getObjectClass(superclassHandle);
 
                         // strip the common substring from the parents name.
                         if (name.find(parent->getName() + ".") == 0)
                                 name = name.substr(parent->getName().size() + 
1);
-
-                        // remove the parents attributes from the transfered 
list
-                        ObjectClass::AttributeList_t parentAttributeList = 
parent->getAttributeList();
-                        ObjectClass::AttributeList_t::const_iterator j = 
parentAttributeList.begin();
-                        for (; j != parentAttributeList.end(); ++j) {
-                                ObjectClass::AttributeList_t::iterator k = 
attributeList.begin();
-                                for (; k != attributeList.end(); ++k) {
-                                        if ((*k)->getHandle() != 
(*j)->getHandle())
-                                                continue;
-                                        attributeList.erase(k);
-                                        break;
-                                }
-                        }
                 }
 
                 // Transfer the short name
                 moc.setName(name);
 
                 // Transfer the attributes that are not inheritted
-                moc.setNumAttributes(attributeList.size());
                 uint32_t jdx = 0;
-                ObjectClass::AttributeList_t::const_reverse_iterator j = 
attributeList.rbegin();
-                for (; j != attributeList.rend(); ++j, ++jdx) {
-                        const ObjectClassAttribute* attribute = *j;
+                const ObjectClass::HandleClassAttributeMap& attributeMap = 
i->second->getHandleClassAttributeMap();
+                ObjectClass::HandleClassAttributeMap::const_iterator j = 
attributeMap.begin();
+                for (; j != attributeMap.end(); ++j) {
+                        // Dump only those attributes from the list that are 
not alreay in the parent
+                        if (parent && 
parent->hasAttribute(j->second->getHandle()))
+                                continue;
+
+                        const ObjectClassAttribute* attribute = j->second;
+
+                        moc.setNumAttributes(++jdx);
+                        NM_FOM_Attribute& ma = moc.getAttribute(jdx - 1);
 
-                        NM_FOM_Attribute& ma = moc.getAttribute(jdx);
                         ma.setHandle(attribute->getHandle());
                         ma.setName(attribute->getName());
                         ma.setSpaceHandle(attribute->getSpace());
@@ -581,4 +573,4 @@
 
 } // namespace certi
 
-// $Id: RootObject.cc,v 3.44 2009/11/19 18:15:32 erk Exp $
+// $Id: RootObject.cc,v 3.45 2009/11/21 14:46:17 erk Exp $

Index: RTIG/Federation.cc
===================================================================
RCS file: /sources/certi/certi/RTIG/Federation.cc,v
retrieving revision 3.116
retrieving revision 3.117
diff -u -b -r3.116 -r3.117
--- RTIG/Federation.cc  19 Nov 2009 18:15:29 -0000      3.116
+++ RTIG/Federation.cc  21 Nov 2009 14:46:17 -0000      3.117
@@ -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.116 2009/11/19 18:15:29 erk Exp $
+// $Id: Federation.cc,v 3.117 2009/11/21 14:46:17 erk Exp $
 // ----------------------------------------------------------------------------
 
 #include <config.h>
@@ -1837,10 +1837,7 @@
         ObjectClass *objectClass = 
root->ObjectClasses->getObjectFromHandle(object);
 
         // get attributes of object class
-        ObjectClass::AttributeList_t attrForObjClass = 
objectClass->getAttributeList();
-
         ObjectClassAttribute::PublishersList_t publishers;
-        publishers.clear();
 
         // get publishers of attributes        
         // first for: iterate through the attribute list and get publishers of 
@@ -1848,12 +1845,11 @@
         // second for: iterate through the temporal publishers list and store 
         //             non-duplicate entries in publishers
         ObjectClassAttribute::PublishersList_t tmp_publishers;
-        tmp_publishers.clear();
-        for (ObjectClass::AttributeList_t::const_iterator 
-            i=attrForObjClass.begin();
-           i!=attrForObjClass.end(); 
-           i++) {
-           tmp_publishers = (*i)->getPublishers();
+
+        const ObjectClass::HandleClassAttributeMap& attributeMap = 
objectClass->getHandleClassAttributeMap();
+        for (ObjectClass::HandleClassAttributeMap::const_iterator i = 
attributeMap.begin();
+             i != attributeMap.end(); ++i) {
+           tmp_publishers = i->second->getPublishers();
             for (ObjectClassAttribute::PublishersList_t::const_iterator
                 j=tmp_publishers.begin(); 
                j!=tmp_publishers.end(); 
@@ -2612,5 +2608,5 @@
 
 }} // namespace certi/rtig
 
-// $Id: Federation.cc,v 3.116 2009/11/19 18:15:29 erk Exp $
+// $Id: Federation.cc,v 3.117 2009/11/21 14:46:17 erk Exp $
 




reply via email to

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