certi-cvs
[Top][All Lists]
Advanced

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

[certi-cvs] certi RTIG/Federation.cc RTIG/Federation.hh lib...


From: certi-cvs
Subject: [certi-cvs] certi RTIG/Federation.cc RTIG/Federation.hh lib...
Date: Tue, 16 Dec 2008 07:08:29 +0000

CVSROOT:        /sources/certi
Module name:    certi
Changes by:     Christian Stenzel <approx>      08/12/16 07:08:29

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

Log message:
        next step of the implementation towards notification services

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/certi/RTIG/Federation.cc?cvsroot=certi&r1=3.102&r2=3.103
http://cvs.savannah.gnu.org/viewcvs/certi/RTIG/Federation.hh?cvsroot=certi&r1=3.56&r2=3.57
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/ObjectClass.cc?cvsroot=certi&r1=3.63&r2=3.64
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/ObjectClass.hh?cvsroot=certi&r1=3.44&r2=3.45
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/ObjectClassAttribute.cc?cvsroot=certi&r1=3.30&r2=3.31
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/ObjectClassAttribute.hh?cvsroot=certi&r1=3.25&r2=3.26

Patches:
Index: RTIG/Federation.cc
===================================================================
RCS file: /sources/certi/certi/RTIG/Federation.cc,v
retrieving revision 3.102
retrieving revision 3.103
diff -u -b -r3.102 -r3.103
--- RTIG/Federation.cc  20 Nov 2008 18:21:55 -0000      3.102
+++ RTIG/Federation.cc  16 Dec 2008 07:08:29 -0000      3.103
@@ -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.102 2008/11/20 18:21:55 approx Exp $
+// $Id: Federation.cc,v 3.103 2008/12/16 07:08:29 approx Exp $
 // ----------------------------------------------------------------------------
 
 #include <config.h>
@@ -1779,6 +1779,49 @@
     // It may throw *NotDefined
     root->ObjectClasses->subscribe(federate, object, attributes, list_size);
 
+    // get object class from object class handle       
+    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 
+    //            each attribtue
+    // 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();
+         for (ObjectClassAttribute::PublishersList_t::const_iterator
+             j=tmp_publishers.begin(); 
+            j!=tmp_publishers.end(); 
+            j++) {
+            // insert only non-duplicate entries ->
+            // pair<iterator, bool> set::insert(const TYPE& val);
+            publishers.insert(*j);
+         }
+        tmp_publishers.clear();
+    }
+
+    // notify all publishers
+    for (ObjectClassAttribute::PublishersList_t::const_iterator
+        k=publishers.begin(); 
+       k!=publishers.end(); 
+       k++) {
+       // what shall we do when subscriber and publisher are the same?
+       if (getFederate(*k).isClassRelevanceAdvisorySwitch()) {
+               // invoke startRegistrationForObjectClass
+       }
+    }
+
     D.Out(pdRegister,
           "Federation %d: Federate %d(un)sub. to %d attrib. of ObjClass %d.",
           handle, federate, list_size, object);
@@ -2482,5 +2525,5 @@
 
 }} // namespace certi/rtig
 
-// $Id: Federation.cc,v 3.102 2008/11/20 18:21:55 approx Exp $
+// $Id: Federation.cc,v 3.103 2008/12/16 07:08:29 approx Exp $
 

Index: RTIG/Federation.hh
===================================================================
RCS file: /sources/certi/certi/RTIG/Federation.hh,v
retrieving revision 3.56
retrieving revision 3.57
diff -u -b -r3.56 -r3.57
--- RTIG/Federation.hh  7 Dec 2008 20:16:11 -0000       3.56
+++ RTIG/Federation.hh  16 Dec 2008 07:08:29 -0000      3.57
@@ -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.56 2008/12/07 20:16:11 gotthardp Exp $
+// $Id: Federation.hh,v 3.57 2008/12/16 07:08:29 approx Exp $
 // ----------------------------------------------------------------------------
 
 #ifndef _CERTI_RTIG_FEDERATION_HH
@@ -295,6 +295,15 @@
                                 UShort theListSize)
         throw (ObjectNotKnown);
 
+    /**
+     * Subscribes attributes to an object class. After subscription, attribute 
+     * publishers are notified by the federate service 
+     * startRegistrationForObjectClass.
+     * @param[in] federate federate handle of the subscriber
+     * @param[in] object subscripted object class handle 
+     * @param[in] attributes subscripted vector of attributes 
+     * @param[in] list_size size of the attribute vector
+    */
     void subscribeObject(FederateHandle theFederateHandle,
                          ObjectClassHandle theObjectHandle,
                          std::vector <AttributeHandle> &theAttributeList,
@@ -668,4 +677,4 @@
 
 #endif // _CERTI_RTIG_FEDERATION_HH
 
-// $Id: Federation.hh,v 3.56 2008/12/07 20:16:11 gotthardp Exp $
+// $Id: Federation.hh,v 3.57 2008/12/16 07:08:29 approx Exp $

Index: libCERTI/ObjectClass.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/ObjectClass.cc,v
retrieving revision 3.63
retrieving revision 3.64
diff -u -b -r3.63 -r3.64
--- libCERTI/ObjectClass.cc     7 Dec 2008 20:16:15 -0000       3.63
+++ libCERTI/ObjectClass.cc     16 Dec 2008 07:08:29 -0000      3.64
@@ -19,7 +19,7 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 // USA
 //
-// $Id: ObjectClass.cc,v 3.63 2008/12/07 20:16:15 gotthardp Exp $
+// $Id: ObjectClass.cc,v 3.64 2008/12/16 07:08:29 approx Exp $
 // ----------------------------------------------------------------------------
 
 #include  "Object.hh"
@@ -1828,6 +1828,11 @@
 //     }
 // }
 
+ObjectClass::AttributeList_t
+ObjectClass::getAttributeList(void) {
+           return attributeSet;
+}
+
 } // namespace certi
 
-// $Id: ObjectClass.cc,v 3.63 2008/12/07 20:16:15 gotthardp Exp $
+// $Id: ObjectClass.cc,v 3.64 2008/12/16 07:08:29 approx Exp $

Index: libCERTI/ObjectClass.hh
===================================================================
RCS file: /sources/certi/certi/libCERTI/ObjectClass.hh,v
retrieving revision 3.44
retrieving revision 3.45
diff -u -b -r3.44 -r3.45
--- libCERTI/ObjectClass.hh     7 Dec 2008 20:16:15 -0000       3.44
+++ libCERTI/ObjectClass.hh     16 Dec 2008 07:08:29 -0000      3.45
@@ -19,7 +19,7 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 // USA
 //
-// $Id: ObjectClass.hh,v 3.44 2008/12/07 20:16:15 gotthardp Exp $
+// $Id: ObjectClass.hh,v 3.45 2008/12/16 07:08:29 approx Exp $
 // ----------------------------------------------------------------------------
 
 #ifndef _CERTI_OBJECT_CLASS_HH
@@ -85,6 +85,11 @@
        typedef ObjectClassNotDefined ObjectNotDefinedException;
 
        /**
+        * The type fot the attribute list.
+        */
+       typedef std::list<ObjectClassAttribute*> AttributeList_t;
+
+       /**
         * Create an objectClass.
         * @param[in] name the object class name
         * @param[in] handle the object class handle value
@@ -260,6 +265,12 @@
        Object *getInstanceWithID(ObjectHandle the_id) const
        throw (ObjectNotKnown);
 
+        /**
+         * Getter for the attribute list of the object class.
+         * param[out] AttributeList_t @see ObjectClass::AttributeList_t
+         */
+       AttributeList_t getAttributeList(void);
+
        //! This Object help to find a TCPLink from a Federate Handle.
        SecurityServer *server ;
 
@@ -323,4 +334,4 @@
 
 #endif // _CERTI_OBJECT_CLASS_HH
 
-// $Id: ObjectClass.hh,v 3.44 2008/12/07 20:16:15 gotthardp Exp $
+// $Id: ObjectClass.hh,v 3.45 2008/12/16 07:08:29 approx Exp $

Index: libCERTI/ObjectClassAttribute.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/ObjectClassAttribute.cc,v
retrieving revision 3.30
retrieving revision 3.31
diff -u -b -r3.30 -r3.31
--- libCERTI/ObjectClassAttribute.cc    9 Nov 2008 12:41:40 -0000       3.30
+++ libCERTI/ObjectClassAttribute.cc    16 Dec 2008 07:08:29 -0000      3.31
@@ -19,7 +19,7 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 // USA
 //
-// $Id: ObjectClassAttribute.cc,v 3.30 2008/11/09 12:41:40 gotthardp Exp $
+// $Id: ObjectClassAttribute.cc,v 3.31 2008/12/16 07:08:29 approx Exp $
 // ----------------------------------------------------------------------------
 
 #include "ObjectClassAttribute.hh"
@@ -97,7 +97,7 @@
 void
 ObjectClassAttribute::deletePublisher(FederateHandle fed)
 {
-    PublishersList::iterator it = publishers.find(fed);
+    PublishersList_t::iterator it = publishers.find(fed);
     if (it != publishers.end())
        publishers.erase(it);
 }
@@ -202,7 +202,7 @@
          addFederatesIfOverlap(*ocblist, region, handle);
       } break ;
       case NetworkMessage::REQUEST_ATTRIBUTE_OWNERSHIP_ASSUMPTION: {
-          PublishersList::iterator i ;
+          PublishersList_t::iterator i ;
           for (i = publishers.begin(); i != publishers.end(); i++) {
               ocblist->addFederate(*i, handle);
           }
@@ -212,6 +212,11 @@
     }
 }
 
+ObjectClassAttribute::PublishersList_t
+ObjectClassAttribute::getPublishers(void) {
+    return publishers;
+}
+
 } // namespace
 
-// $Id: ObjectClassAttribute.cc,v 3.30 2008/11/09 12:41:40 gotthardp Exp $
+// $Id: ObjectClassAttribute.cc,v 3.31 2008/12/16 07:08:29 approx Exp $

Index: libCERTI/ObjectClassAttribute.hh
===================================================================
RCS file: /sources/certi/certi/libCERTI/ObjectClassAttribute.hh,v
retrieving revision 3.25
retrieving revision 3.26
diff -u -b -r3.25 -r3.26
--- libCERTI/ObjectClassAttribute.hh    9 Nov 2008 12:41:40 -0000       3.25
+++ libCERTI/ObjectClassAttribute.hh    16 Dec 2008 07:08:29 -0000      3.26
@@ -19,7 +19,7 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 // USA
 //
-// $Id: ObjectClassAttribute.hh,v 3.25 2008/11/09 12:41:40 gotthardp Exp $
+// $Id: ObjectClassAttribute.hh,v 3.26 2008/12/16 07:08:29 approx Exp $
 // ----------------------------------------------------------------------------
 
 #ifndef CERTI_OBJECT_CLASS_ATTRIBUTE_HH
@@ -48,6 +48,12 @@
 class CERTI_EXPORT ObjectClassAttribute : public Subscribable {
 
 public:
+    /**
+     * A set of federate handles. The corresponding federates are publishers of
+     * the object class attribute.
+     */
+    typedef std::set<FederateHandle> PublishersList_t;
+
     ObjectClassAttribute(const std::string theName, TransportType 
theTransport, OrderType theOrder);
     ObjectClassAttribute(ObjectClassAttribute *source);
     virtual ~ObjectClassAttribute();
@@ -72,6 +78,12 @@
     void updateBroadcastList(ObjectClassBroadcastList *ocb_list,
                             const RTIRegion *region = 0);
 
+    /**
+     * Getter for the attributes publisher list.
+     * param[out] PublishersList_t @see ObjectClassAttribute::PublisherList_t
+     */
+    PublishersList_t getPublishers(void);
+
     // Attributes
     SecurityLevelID level ;
     OrderType order ;
@@ -89,13 +101,11 @@
     AttributeHandle handle ; //!< The attribute handle.
     SpaceHandle space ; //!< Routing space
 
-    typedef std::set<FederateHandle> PublishersList ;
-    PublishersList publishers ; //!< The publisher's list.
-
+    PublishersList_t publishers ; //!< The publisher's list.
 };
 
 } // namespace
 
 #endif // CERTI_OBJECT_CLASS_ATTRIBUTE_HH
 
-// $Id: ObjectClassAttribute.hh,v 3.25 2008/11/09 12:41:40 gotthardp Exp $
+// $Id: ObjectClassAttribute.hh,v 3.26 2008/12/16 07:08:29 approx Exp $




reply via email to

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