certi-cvs
[Top][All Lists]
Advanced

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

[certi-cvs] certi/libCERTI InteractionSet.hh RootObject.hh ...


From: certi-cvs
Subject: [certi-cvs] certi/libCERTI InteractionSet.hh RootObject.hh ...
Date: Sat, 08 Nov 2008 11:08:03 +0000

CVSROOT:        /sources/certi
Module name:    certi
Changes by:     Eric NOULARD <erk>      08/11/08 11:08:03

Modified files:
        libCERTI       : InteractionSet.hh RootObject.hh ObjectClass.hh 
                         Interaction.cc Interaction.hh 
                         TreeNamedAndHandledSet.hh ObjectClass.cc 

Log message:
        More interaction and object class refactoring.
        Should be clean and simple "enough" for now.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/InteractionSet.hh?cvsroot=certi&r1=3.23&r2=3.24
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/RootObject.hh?cvsroot=certi&r1=3.31&r2=3.32
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/ObjectClass.hh?cvsroot=certi&r1=3.42&r2=3.43
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/Interaction.cc?cvsroot=certi&r1=3.49&r2=3.50
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/Interaction.hh?cvsroot=certi&r1=3.34&r2=3.35
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/TreeNamedAndHandledSet.hh?cvsroot=certi&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/ObjectClass.cc?cvsroot=certi&r1=3.60&r2=3.61

Patches:
Index: InteractionSet.hh
===================================================================
RCS file: /sources/certi/certi/libCERTI/InteractionSet.hh,v
retrieving revision 3.23
retrieving revision 3.24
diff -u -b -r3.23 -r3.24
--- InteractionSet.hh   8 Nov 2008 01:11:23 -0000       3.23
+++ InteractionSet.hh   8 Nov 2008 11:08:03 -0000       3.24
@@ -19,7 +19,7 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 // USA
 //
-// $Id: InteractionSet.hh,v 3.23 2008/11/08 01:11:23 erk Exp $
+// $Id: InteractionSet.hh,v 3.24 2008/11/08 11:08:03 erk Exp $
 // ----------------------------------------------------------------------------
 
 #ifndef _CERTI_INTERACTION_SET_HH
@@ -57,13 +57,19 @@
        // --------------------------
 
        /**
-        * Return the interaction handle associated to name.
-        * @param[in] class_name the name of the interaction for whose handle 
is requested
+        * Return the interaction class handle corresponding to the provided 
name.
+        * @param[in] class_name the name of the interaction whose handle is 
requested
+        * @return the interaction class handle
         */
        InteractionClassHandle
        getInteractionClassHandle(const std::string& class_name) const
        throw (NameNotFound);
 
+       /**
+        * Return the interaction class name correspondig to the provided 
handle.
+        * @param[in] the_handle the handle of the interaction whose name is 
requested
+        * @return the interaction class name
+        */
        std::string
        getInteractionClassName(InteractionClassHandle the_handle) const
        throw (InteractionClassNotDefined);
@@ -151,4 +157,4 @@
 
 #endif // _CERTI_INTERACTION_SET_HH
 
-// $Id: InteractionSet.hh,v 3.23 2008/11/08 01:11:23 erk Exp $
+// $Id: InteractionSet.hh,v 3.24 2008/11/08 11:08:03 erk Exp $

Index: RootObject.hh
===================================================================
RCS file: /sources/certi/certi/libCERTI/RootObject.hh,v
retrieving revision 3.31
retrieving revision 3.32
diff -u -b -r3.31 -r3.32
--- RootObject.hh       31 Oct 2008 13:50:24 -0000      3.31
+++ RootObject.hh       8 Nov 2008 11:08:03 -0000       3.32
@@ -19,7 +19,7 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 // USA
 //
-// $Id: RootObject.hh,v 3.31 2008/10/31 13:50:24 erk Exp $
+// $Id: RootObject.hh,v 3.32 2008/11/08 11:08:03 erk Exp $
 // ----------------------------------------------------------------------------
 
 #ifndef LIBCERTI_ROOT_OBJECT
@@ -160,6 +160,7 @@
      * This is created when parsing the FOM.
      */
     InteractionSet *Interactions;
+
     /**
      * The set of registered object instance.
      */
@@ -182,4 +183,4 @@
 
 #endif // LIBCERTI_ROOT_OBJECT
 
-// $Id: RootObject.hh,v 3.31 2008/10/31 13:50:24 erk Exp $
+// $Id: RootObject.hh,v 3.32 2008/11/08 11:08:03 erk Exp $

Index: ObjectClass.hh
===================================================================
RCS file: /sources/certi/certi/libCERTI/ObjectClass.hh,v
retrieving revision 3.42
retrieving revision 3.43
diff -u -b -r3.42 -r3.43
--- ObjectClass.hh      2 Nov 2008 00:26:40 -0000       3.42
+++ ObjectClass.hh      8 Nov 2008 11:08:03 -0000       3.43
@@ -19,7 +19,7 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 // USA
 //
-// $Id: ObjectClass.hh,v 3.42 2008/11/02 00:26:40 erk Exp $
+// $Id: ObjectClass.hh,v 3.43 2008/11/08 11:08:03 erk Exp $
 // ----------------------------------------------------------------------------
 
 #ifndef _CERTI_OBJECT_CLASS_HH
@@ -62,8 +62,13 @@
        CDiffusion() { size = 0 ; };
 };
 
-/*! OMT object class. It also contains the instance list from this
-  class.
+/**
+ *  OMT object class.
+ * It also contains:
+ *  <ul>
+ *    <li> the set of subclasses. </li>
+ *    <li> the instance list from this class. </li>
+ *  </ul>
  */
 class CERTI_EXPORT ObjectClass : public Named {
 
@@ -99,19 +104,17 @@
        ObjectClassHandle getHandle() const ;
 
        /**
-        * Set the super class (parent class) of this object class;
-        * @param[in] h the handle of the super class.
-        */
-       void setSuperclass(ObjectClassHandle h) { superClass = h ; };
-       /**
         * Get the super class handle.
         * @return the super class handle
         */
        ObjectClassHandle getSuperclass() const { return superClass ; };
+
        /**
         * Add a subclass to this object class.
+        * @param[in] child the new child object class
         */
-       void addSubclass(ObjectClass *);
+       void addSubClass(ObjectClass *child);
+
        /**
         * Retrieve a sub class by its name.
         * @param[in] subClassName the name of the subclass
@@ -134,8 +137,6 @@
        AttributeHandle addAttribute(ObjectClassAttribute *the_attribute,
                        bool is_inherited = false);
 
-       void addToChild(ObjectClass *child);
-
        // Publication and Subscription
        void publish(FederateHandle theFederateHandle,
                        std::vector <AttributeHandle> &theAttributeList,
@@ -267,6 +268,9 @@
         * one should not call it.
         */
        ObjectClass();
+
+       void addInheritedClassAttributes(ObjectClass *child);
+
        void sendToFederate(NetworkMessage *msg, FederateHandle theFederate);
 
        void sendToOwners(CDiffusion *diffusionList,
@@ -318,4 +322,4 @@
 
 #endif // _CERTI_OBJECT_CLASS_HH
 
-// $Id: ObjectClass.hh,v 3.42 2008/11/02 00:26:40 erk Exp $
+// $Id: ObjectClass.hh,v 3.43 2008/11/08 11:08:03 erk Exp $

Index: Interaction.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/Interaction.cc,v
retrieving revision 3.49
retrieving revision 3.50
diff -u -b -r3.49 -r3.50
--- Interaction.cc      8 Nov 2008 01:11:23 -0000       3.49
+++ Interaction.cc      8 Nov 2008 11:08:03 -0000       3.50
@@ -19,7 +19,7 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 // USA
 //
-// $Id: Interaction.cc,v 3.49 2008/11/08 01:11:23 erk Exp $
+// $Id: Interaction.cc,v 3.50 2008/11/08 11:08:03 erk Exp $
 // ----------------------------------------------------------------------------
 
 
@@ -70,9 +70,20 @@
        }
 } /* end of ~Interaction */
 
-void Interaction::addSubclass(Interaction *sc) {
-       subClasses->addClass(sc,NULL);
-}
+void Interaction::addSubClass(Interaction *child) {
+       /* build parent-child relationship */
+       /* add child as subclass of parent */
+       subClasses->addClass(child,NULL);
+       /* link child to parent */
+       child->superClass = handle;
+       /* forward inherited properties to child */
+       /* Add Interaction Class Parameter */
+       addInheritedClassParameter(child);
+    /* security server is the same for child */
+    child->server = server;
+       /* inherit security Level */
+       child->setSecurityLevelId(id);
+} /* end of addChild */
 
 // ----------------------------------------------------------------------------
 //! Used only by CRead, return the new parameter's handle.
@@ -99,10 +110,8 @@
        return the_parameter->getHandle();
 } /* end of addParameter */
 
-// ----------------------------------------------------------------------------
-//! Add the class' attributes to the 'Child' Class.
 void
-Interaction::addToChild(Interaction *the_child)
+Interaction::addInheritedClassParameter(Interaction *the_child)
 {
        // The Parameter List is read backward to respect the same attribute 
order
        // for the child (Parameters are inserted at the beginning of the list)
@@ -127,7 +136,7 @@
                        ;
                }
        }
-} /* end of addParameterToChild */
+} /* end of addInheritedClassParameter */
 
 // ----------------------------------------------------------------------------
 /*! Called by the InteractionSet on Parent Classes whose Childrens
@@ -538,4 +547,4 @@
 
 } // namespace certi
 
-// $Id: Interaction.cc,v 3.49 2008/11/08 01:11:23 erk Exp $
+// $Id: Interaction.cc,v 3.50 2008/11/08 11:08:03 erk Exp $

Index: Interaction.hh
===================================================================
RCS file: /sources/certi/certi/libCERTI/Interaction.hh,v
retrieving revision 3.34
retrieving revision 3.35
diff -u -b -r3.34 -r3.35
--- Interaction.hh      2 Nov 2008 00:26:41 -0000       3.34
+++ Interaction.hh      8 Nov 2008 11:08:03 -0000       3.35
@@ -19,7 +19,7 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 // USA
 //
-// $Id: Interaction.hh,v 3.34 2008/11/02 00:26:41 erk Exp $
+// $Id: Interaction.hh,v 3.35 2008/11/08 11:08:03 erk Exp $
 // ----------------------------------------------------------------------------
 
 #ifndef _CERTI_INTERACTION_HH
@@ -43,6 +43,14 @@
 
 namespace certi {
 
+/**
+ * OMT Interaction class.
+ * It also contains:
+ *  <ul>
+ *    <li> the set of subclasses. </li>
+ *    <li> the instance list from this class. </li>
+ *  </ul>
+ */
 class CERTI_EXPORT Interaction : public Subscribable
 {
 public:
@@ -75,20 +83,17 @@
     InteractionClassHandle getHandle() const { return handle ;}
 
        /**
-        * Set the super class (parent class) of this object class;
-        * @param[in] h the handle of the super class.
-        */
-       void setSuperclass(InteractionClassHandle h) { superClass = h ; };
-       /**
         * Get the super class handle.
         * @return the super class handle
         */
        InteractionClassHandle getSuperclass() const { return superClass ; };
+
        /**
-        * Add a subclass to this object class.
-        * @param[in] sc the interaction to add as a sub class
+        * Add a subclass to this interaction class.
+        * @param[in] child the interaction to add as a sub class
         */
-       void addSubclass(Interaction *sc);
+       void addSubClass(Interaction *child);
+
        /**
         * Retrieve a sub class by its name.
         * @param[in] subClassName the name of the subclass
@@ -103,7 +108,7 @@
     ParameterHandle addParameter(Parameter *the_parameter,
                                  bool is_inherited = false);
 
-    void addToChild(Interaction *new_child);
+
     void display() const ;
 
     // -- Security Methods --
@@ -206,6 +211,8 @@
         */
        Interaction();
 
+       void addInheritedClassParameter(Interaction *new_child);
+
     InteractionClassHandle handle ; //!< Interaction class handle.
 
        /**
@@ -239,4 +246,4 @@
 
 #endif // _CERTI_INTERACTION.HH
 
-// $Id: Interaction.hh,v 3.34 2008/11/02 00:26:41 erk Exp $
+// $Id: Interaction.hh,v 3.35 2008/11/08 11:08:03 erk Exp $

Index: TreeNamedAndHandledSet.hh
===================================================================
RCS file: /sources/certi/certi/libCERTI/TreeNamedAndHandledSet.hh,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- TreeNamedAndHandledSet.hh   8 Nov 2008 01:11:23 -0000       1.4
+++ TreeNamedAndHandledSet.hh   8 Nov 2008 11:08:03 -0000       1.5
@@ -19,7 +19,7 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 // USA
 //
-// $Id: TreeNamedAndHandledSet.hh,v 1.4 2008/11/08 01:11:23 erk Exp $
+// $Id: TreeNamedAndHandledSet.hh,v 1.5 2008/11/08 11:08:03 erk Exp $
 // ----------------------------------------------------------------------------
 
 #ifndef _TreeNamedAndHandledSet_HH
@@ -171,14 +171,7 @@
         */
        std::string        setName;
 private:
-       /**
-        * Build inheritance relation between two objects class.
-        * @param[in,out] child the future child object class
-        * @param[in,out] parent the parent object class
-        * @post the child and parent object classes are linked
-        *       with inheritance relationship.
-        */
-       void buildParentRelation(ObjectType *child, ObjectType *parent);
+
 };
 
 template <typename ObjectType>
@@ -195,13 +188,8 @@
         * If we are Root Set (the class set owned by RootObject)
         *    we delete the content
         * If not we only clear the map in order to avoid double deletion.
-        *
-        * FIXME EN: this is a trick because we do not
-        *           really maintain a tree of ObjectClass in order
-        *           to support flat object class name
-        *           ("Boule" instead of "Bille.Boule")
-        *           We may get rid of this as soon as we want to support
-        *           same name for object class in different branch of the tree.
+        * The "Non Root" set are those who are not "owning"
+        * the stored object.
         */
        if (isRootSet) {
                while (!fromHandle.empty()) {
@@ -238,7 +226,7 @@
                        child->setName(parentName+"."+child->getName());
                }
                //std::cout << "Adding child :" << child->getName() << 
std::endl;
-               buildParentRelation(child,parent);
+               parent->addSubClass(child);
        }
 
     /*
@@ -264,19 +252,6 @@
 } /* end of add */
 
 template <typename ObjectType>
-void
-TreeNamedAndHandledSet<ObjectType>::buildParentRelation(ObjectType* child, 
ObjectType* parent) {
-       /* Link the child to its parent */
-    child->setSuperclass(parent->getHandle());
-    /* Declare a new child for the parent */
-    parent->addSubclass(child);
-    /* Security Level of the child is inherited from parent */
-    child->setSecurityLevelId(parent->getSecurityLevelId());
-    /* Add inherited feature from parent to child */
-    parent->addToChild(child);
-} /* end of buildParentRelation */
-
-template <typename ObjectType>
 typename TreeNamedAndHandledSet<ObjectType>::HandleType
 TreeNamedAndHandledSet<ObjectType>::getHandleFromName(std::string name) const
     throw (NameNotFound) {

Index: ObjectClass.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/ObjectClass.cc,v
retrieving revision 3.60
retrieving revision 3.61
diff -u -b -r3.60 -r3.61
--- ObjectClass.cc      8 Nov 2008 01:11:24 -0000       3.60
+++ ObjectClass.cc      8 Nov 2008 11:08:03 -0000       3.61
@@ -19,7 +19,7 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 // USA
 //
-// $Id: ObjectClass.cc,v 3.60 2008/11/08 01:11:24 erk Exp $
+// $Id: ObjectClass.cc,v 3.61 2008/11/08 11:08:03 erk Exp $
 // ----------------------------------------------------------------------------
 
 #include  "Object.hh"
@@ -84,7 +84,7 @@
 // ----------------------------------------------------------------------------
 //! Add the class' attributes to the 'Child' Class.
 void
-ObjectClass::addToChild(ObjectClass *the_child)
+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).
@@ -105,7 +105,7 @@
         if (childAttribute->getHandle() != (*a)->getHandle())
             throw RTIinternalError("Error while copying child's attributes.");
     }
-}
+} /* end of addInheritedClassAttributes */
 
 // ----------------------------------------------------------------------------
 /*! Take a Broadcast List and continue to send messages. You should
@@ -1766,14 +1766,25 @@
            (*i)->unsubscribe(fed);
        }
     }
-}
+} /* end of unsubscribe */
 
-// ----------------------------------------------------------------------------
 void
-ObjectClass::addSubclass(ObjectClass *c)
-{
-    subClasses->addClass(c,NULL);
-}
+ObjectClass::addSubClass(ObjectClass *child) {
+
+       /* build parent-child relationship */
+       /* add child as subclass of parent */
+    subClasses->addClass(child,NULL);
+    /* link child to parent */
+    child->superClass = handle;
+    /* forward inherited properties to child */
+    /* Add Object Class Attribute */
+    addInheritedClassAttributes(child);
+    /* security server is the same for child */
+    child->server = server;
+    /* inherit security Level */
+    child->setSecurityLevelId(securityLevelId);
+
+} /* end of addChild */
 
 // ----------------------------------------------------------------------------
 /** Recursively start discovery of existing objects.
@@ -1818,4 +1829,4 @@
 
 } // namespace certi
 
-// $Id: ObjectClass.cc,v 3.60 2008/11/08 01:11:24 erk Exp $
+// $Id: ObjectClass.cc,v 3.61 2008/11/08 11:08:03 erk Exp $




reply via email to

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