certi-cvs
[Top][All Lists]
Advanced

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

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


From: certi-cvs
Subject: [certi-cvs] certi libCERTI/InteractionSet.hh libCERTI/Objec...
Date: Sun, 02 Nov 2008 01:01:53 +0000

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

Modified files:
        libCERTI       : InteractionSet.hh ObjectClassSet.hh 
                         TreeNamedAndHandledSet.hh InteractionSet.cc 
                         ObjectClassSet.cc RootObject.cc 
        RTIA           : RTIA_network.cc DataDistribution.cc 

Log message:
        More clean-up.
        Remove duplicate method getByHandle from Interaction
        (same as getObjectFromHandle in the base class)
        begin more <iostream> compliant refactoring

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/InteractionSet.hh?cvsroot=certi&r1=3.21&r2=3.22
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/ObjectClassSet.hh?cvsroot=certi&r1=3.33&r2=3.34
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/TreeNamedAndHandledSet.hh?cvsroot=certi&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/InteractionSet.cc?cvsroot=certi&r1=3.26&r2=3.27
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/ObjectClassSet.cc?cvsroot=certi&r1=3.42&r2=3.43
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/RootObject.cc?cvsroot=certi&r1=3.37&r2=3.38
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/RTIA_network.cc?cvsroot=certi&r1=3.27&r2=3.28
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/DataDistribution.cc?cvsroot=certi&r1=3.25&r2=3.26

Patches:
Index: libCERTI/InteractionSet.hh
===================================================================
RCS file: /sources/certi/certi/libCERTI/InteractionSet.hh,v
retrieving revision 3.21
retrieving revision 3.22
diff -u -b -r3.21 -r3.22
--- libCERTI/InteractionSet.hh  2 Nov 2008 00:26:40 -0000       3.21
+++ libCERTI/InteractionSet.hh  2 Nov 2008 01:01:52 -0000       3.22
@@ -19,7 +19,7 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 // USA
 //
-// $Id: InteractionSet.hh,v 3.21 2008/11/02 00:26:40 erk Exp $
+// $Id: InteractionSet.hh,v 3.22 2008/11/02 01:01:52 erk Exp $
 // ----------------------------------------------------------------------------
 
 #ifndef _CERTI_INTERACTION_SET_HH
@@ -51,12 +51,6 @@
         */
        void addClass(Interaction *theClass);
 
-
-       /**
-        *  Print the Interactions tree to the standard output.
-        */
-       void display() const ;
-
        // --------------------------
        // -- RTI Support Services --
        // --------------------------
@@ -90,17 +84,6 @@
        void killFederate(FederateHandle the_federate)
        throw ();
 
-       /**
-        *  Return interaction associated to handle.
-        *  @param[in] the_handle
-        *  @return the interaction associated to handle
-        *  @throw InteractionClassNotDefined if the handle does not correspond 
to
-        *         any interactrion class
-        *  @throw RTIinternalError
-        */
-       Interaction* getByHandle(InteractionClassHandle the_handle) const
-       throw (InteractionClassNotDefined, RTIinternalError);
-
        // ----------------------------------
        // -- Interaction Class Management --
        // ----------------------------------
@@ -167,4 +150,4 @@
 
 #endif // _CERTI_INTERACTION_SET_HH
 
-// $Id: InteractionSet.hh,v 3.21 2008/11/02 00:26:40 erk Exp $
+// $Id: InteractionSet.hh,v 3.22 2008/11/02 01:01:52 erk Exp $

Index: libCERTI/ObjectClassSet.hh
===================================================================
RCS file: /sources/certi/certi/libCERTI/ObjectClassSet.hh,v
retrieving revision 3.33
retrieving revision 3.34
diff -u -b -r3.33 -r3.34
--- libCERTI/ObjectClassSet.hh  2 Nov 2008 00:02:45 -0000       3.33
+++ libCERTI/ObjectClassSet.hh  2 Nov 2008 01:01:52 -0000       3.34
@@ -19,7 +19,7 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 // USA
 //
-// $Id: ObjectClassSet.hh,v 3.33 2008/11/02 00:02:45 erk Exp $
+// $Id: ObjectClassSet.hh,v 3.34 2008/11/02 01:01:52 erk Exp $
 // ----------------------------------------------------------------------------
 
 #ifndef _CERTI_OBJECT_CLASS_SET_HH
@@ -59,8 +59,6 @@
         */
        void addClass(ObjectClass *theClass) throw (RTIinternalError);
 
-       void display() const ;
-
        // RTI Support Services
        AttributeHandle getAttributeHandle(const char *the_name,
                        ObjectClassHandle the_class) const
@@ -198,4 +196,4 @@
 
 #endif // _CERTI_OBJECT_CLASS_SET_HH
 
-// $Id: ObjectClassSet.hh,v 3.33 2008/11/02 00:02:45 erk Exp $
+// $Id: ObjectClassSet.hh,v 3.34 2008/11/02 01:01:52 erk Exp $

Index: libCERTI/TreeNamedAndHandledSet.hh
===================================================================
RCS file: /sources/certi/certi/libCERTI/TreeNamedAndHandledSet.hh,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- libCERTI/TreeNamedAndHandledSet.hh  2 Nov 2008 00:26:41 -0000       1.2
+++ libCERTI/TreeNamedAndHandledSet.hh  2 Nov 2008 01:01:52 -0000       1.3
@@ -19,7 +19,7 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 // USA
 //
-// $Id: TreeNamedAndHandledSet.hh,v 1.2 2008/11/02 00:26:41 erk Exp $
+// $Id: TreeNamedAndHandledSet.hh,v 1.3 2008/11/02 01:01:52 erk Exp $
 // ----------------------------------------------------------------------------
 
 #ifndef _TreeNamedAndHandledSet_HH
@@ -32,6 +32,7 @@
 // System headers
 #include <string>
 #include <map>
+#include <iostream>
 
 namespace certi {
 
@@ -74,9 +75,11 @@
         */
        typedef typename ObjectType::ObjectNotDefinedException 
ObjectNotDefinedException;
 
-       TreeNamedAndHandledSet(bool isRootSet=false);
+       TreeNamedAndHandledSet(std::string setName,bool isRootSet=false);
        ~TreeNamedAndHandledSet();
 
+       std::string getSetName() const {return setName;};
+
        /**
         * Add an object to the set.
         * @param[in] object the object to be added
@@ -161,16 +164,23 @@
 protected:
        Handle2ObjectMap_t fromHandle;
        Name2ObjectMap_t   fromName;
-       /* The "Root" set is owning the object
+       /*
+        * The "Root" set is owning the object
         * and will destroy objects in its destructor.
         * Non "Root" set won't destroy anything beside itself.
         */
        bool               isRootSet;
+       /*
+        * The name of the set.
+        * Mainly used for displaying the set.
+        */
+       std::string        setName;
 };
 
 template <typename ObjectType>
-TreeNamedAndHandledSet<ObjectType>::TreeNamedAndHandledSet(bool isRootSet) {
+TreeNamedAndHandledSet<ObjectType>::TreeNamedAndHandledSet(std::string 
setName, bool isRootSet) {
    this->isRootSet = isRootSet;
+   this->setName   = setName;
 } /* end of TreeNamedAndHandledSet (constructor) */
 
 template <typename ObjectType>
@@ -200,7 +210,6 @@
        }
 } /* end of ~TreeNamedAndHandledSet (destructor) */
 
-
 template <typename ObjectType>
 void
 TreeNamedAndHandledSet<ObjectType>::add(ObjectType *object)
@@ -315,6 +324,21 @@
        }
 } /* end of getObjectFromHandle */
 
+template <typename ObjectType>
+std::ostream& operator<<(std::ostream& os, TreeNamedAndHandledSet<ObjectType> 
set) {
+       typename TreeNamedAndHandledSet<ObjectType>::const_iterator i;
+       // display the set name
+       os << set.getSetName() << " : "<< std::endl ;
+       // then display the object contained in the set
+       // FIXME currently the display method of ObjectClass
+       // and Interaction is not <iostream> oriented.
+       // will update that later
+       for (i = set.begin(); i != set.end(); ++i) {
+               i->second->display();
+       }
+       return os;
+}
+
 } // namespace certi
 
 

Index: libCERTI/InteractionSet.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/InteractionSet.cc,v
retrieving revision 3.26
retrieving revision 3.27
diff -u -b -r3.26 -r3.27
--- libCERTI/InteractionSet.cc  2 Nov 2008 00:26:41 -0000       3.26
+++ libCERTI/InteractionSet.cc  2 Nov 2008 01:01:53 -0000       3.27
@@ -19,7 +19,7 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 // USA
 //
-// $Id: InteractionSet.cc,v 3.26 2008/11/02 00:26:41 erk Exp $
+// $Id: InteractionSet.cc,v 3.27 2008/11/02 01:01:53 erk Exp $
 // ----------------------------------------------------------------------------
 
 #include "Interaction.hh"
@@ -40,7 +40,7 @@
 
 
 InteractionSet::InteractionSet(SecurityServer *security_server, bool 
isRootClassSet)
-: TreeNamedAndHandledSet<Interaction>(isRootClassSet) {
+: TreeNamedAndHandledSet<Interaction>("Interaction Classes",isRootClassSet) {
     // It can be NULL on the RTIA.
     server = security_server ;
 }
@@ -78,7 +78,7 @@
 
        // It may throw InteractionClassNotDefined.
        //InteractionClassHandle currentClass = interaction_handle ;
-       Interaction *theInteraction = getByHandle(interaction_handle);
+       Interaction *theInteraction = getObjectFromHandle(interaction_handle);
 
        InteractionBroadcastList *ibList ;
        ibList = theInteraction->sendInteraction(federate_handle,
@@ -93,7 +93,7 @@
        if (ibList != NULL) {
                //currentClass = theInteraction->parent ;
                //while (CurrentClass != 0) {
-               // theInteraction = getByHandle(CurrentClass);
+               // theInteraction = getObjectFromHandle(CurrentClass);
                // theInteraction->broadcastInteractionMessage(List);
                // CurrentClass = theInteraction->Father ;
                //}
@@ -126,7 +126,7 @@
 
        // It may throw InteractionClassNotDefined.
        //InteractionClassHandle currentClass = interaction_handle ;
-       Interaction *theInteraction = getByHandle(interaction_handle);
+       Interaction *theInteraction = getObjectFromHandle(interaction_handle);
 
        InteractionBroadcastList *ibList ;
        ibList = theInteraction->sendInteraction(federate_handle,
@@ -140,7 +140,7 @@
        if (ibList != NULL) {
                //currentClass = theInteraction->parent ;
                //while (CurrentClass != 0) {
-               // theInteraction = getByHandle(CurrentClass);
+               // theInteraction = getObjectFromHandle(CurrentClass);
                // theInteraction->broadcastInteractionMessage(List);
                // CurrentClass = theInteraction->Father ;
                //}
@@ -153,35 +153,6 @@
        G.Out(pdGendoc,"exit InteractionSet::broadcastInteraction without 
time") ;
 } /* end of broadcastInteraction (WITHOUT time) */
 
-void
-InteractionSet::display() const
-{
-       cout << " Interactions :" << endl ;
-       handled_const_iterator i;
-       for (i = handled_begin(); i != handled_end(); ++i) {
-               i->second->display();
-       }
-} /* end of display */
-
-Interaction*
-InteractionSet::getByHandle(InteractionClassHandle the_handle) const
-throw (InteractionClassNotDefined, RTIinternalError)
-{
-       std::stringstream msg;
-
-       handled_const_iterator iter;
-
-       iter = fromHandle.find(the_handle);
-
-       if (iter != fromHandle.end()) {
-               return iter->second;
-       } else {
-               msg << "Unknown Object Class Handle <" << the_handle << ">";
-               D.Out(pdExcept, "Unknown Object Class Handle %d .", the_handle);
-               throw InteractionClassNotDefined(msg.str().c_str());
-       }
-} /* end of getByHandle */
-
 // ----------------------------------------------------------------------------
 //! Return the interaction handle associated to name.
 InteractionClassHandle
@@ -214,7 +185,7 @@
                throw RTIinternalError("");
 
        // It may throw InteractionClassNotDefined
-       Interaction *interaction = getByHandle(the_class);
+       Interaction *interaction = getObjectFromHandle(the_class);
        return interaction->getParameterHandle(the_name);
                }
 
@@ -228,7 +199,7 @@
                RTIinternalError)
                {
        // It may throw InteractionClassNotDefined
-       Interaction *interaction = getByHandle(the_class);
+       Interaction *interaction = getObjectFromHandle(the_class);
        return interaction->getParameterName(the_handle);
                }
 
@@ -247,7 +218,7 @@
                RTIinternalError)
                {
        // It may throw InteractionClassNotDefined
-       Interaction *interaction = getByHandle(the_interaction);
+       Interaction *interaction = getObjectFromHandle(the_interaction);
        interaction->isReady(federate_handle, param_array, param_array_size);
                }
 
@@ -277,7 +248,7 @@
                SecurityError)
                {
        // It may throw InteractionClassNotDefined
-       Interaction *interaction = getByHandle(interaction_handle);
+       Interaction *interaction = getObjectFromHandle(interaction_handle);
        if (publish)
                interaction->publish(federate_handle);
        else
@@ -297,7 +268,7 @@
                SecurityError)
                {
        // It may throw InteractionClassNotDefined
-       Interaction *interaction = getByHandle(interaction_handle);
+       Interaction *interaction = getObjectFromHandle(interaction_handle);
        if (subscribe)
                interaction->subscribe(federate_handle, region);
        else
@@ -306,4 +277,4 @@
 
 } // namespace certi
 
-// $Id: InteractionSet.cc,v 3.26 2008/11/02 00:26:41 erk Exp $
+// $Id: InteractionSet.cc,v 3.27 2008/11/02 01:01:53 erk Exp $

Index: libCERTI/ObjectClassSet.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/ObjectClassSet.cc,v
retrieving revision 3.42
retrieving revision 3.43
diff -u -b -r3.42 -r3.43
--- libCERTI/ObjectClassSet.cc  2 Nov 2008 00:02:45 -0000       3.42
+++ libCERTI/ObjectClassSet.cc  2 Nov 2008 01:01:53 -0000       3.43
@@ -19,7 +19,7 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 // USA
 //
-// $Id: ObjectClassSet.cc,v 3.42 2008/11/02 00:02:45 erk Exp $
+// $Id: ObjectClassSet.cc,v 3.43 2008/11/02 01:01:53 erk Exp $
 // ----------------------------------------------------------------------------
 
 // Project
@@ -47,7 +47,7 @@
 static PrettyDebug G("GENDOC",__FILE__) ;
 
 ObjectClassSet::ObjectClassSet(SecurityServer *theSecurityServer, bool 
isRootClassSet)
- : TreeNamedAndHandledSet<ObjectClass>(isRootClassSet)
+ : TreeNamedAndHandledSet<ObjectClass>("Object Classes",isRootClassSet)
 {
     // It can be NULL on the RTIA.
     server = theSecurityServer ;
@@ -158,19 +158,6 @@
 }
 
 // ----------------------------------------------------------------------------
-//! Print the ObjectClasses tree to the standard output.
-void
-ObjectClassSet::display() const
-{
-    cout << " ObjectClasses :" << endl ;
-
-    handled_const_iterator i;
-    for (i = fromHandle.begin(); i != fromHandle.end(); ++i) {
-        i->second->display();
-    }
-} /* end of display */
-
-// ----------------------------------------------------------------------------
 //! getAttributeHandle.
 AttributeHandle
 ObjectClassSet::getAttributeHandle(const char *the_name,
@@ -719,4 +706,4 @@
 
 } // namespace certi
 
-// $Id: ObjectClassSet.cc,v 3.42 2008/11/02 00:02:45 erk Exp $
+// $Id: ObjectClassSet.cc,v 3.43 2008/11/02 01:01:53 erk Exp $

Index: libCERTI/RootObject.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/RootObject.cc,v
retrieving revision 3.37
retrieving revision 3.38
diff -u -b -r3.37 -r3.38
--- libCERTI/RootObject.cc      1 Nov 2008 19:19:35 -0000       3.37
+++ libCERTI/RootObject.cc      2 Nov 2008 01:01:53 -0000       3.38
@@ -19,7 +19,7 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 // USA
 //
-// $Id: RootObject.cc,v 3.37 2008/11/01 19:19:35 erk Exp $
+// $Id: RootObject.cc,v 3.38 2008/11/02 01:01:53 erk Exp $
 // ----------------------------------------------------------------------------
 
 #include "Object.hh"
@@ -78,8 +78,8 @@
 RootObject::display() const
 {
     cout << endl << "Root Object Tree :" << endl ;
-    ObjectClasses->display();
-    Interactions->display();
+    cout << ObjectClasses;
+    cout << Interactions;
     if (spaces.size() > 0) {
         cout << "+ Routing Spaces :" << endl ;
        vector<RoutingSpace>::const_iterator it ;
@@ -325,7 +325,7 @@
 Interaction *
 RootObject::getInteractionClass(InteractionClassHandle the_class)
 {
-    return Interactions->getByHandle(the_class);
+    return Interactions->getObjectFromHandle(the_class);
 }
 // ----------------------------------------------------------------------------
 // requestObjectInstance
@@ -364,4 +364,4 @@
 
 } // namespace certi
 
-// $Id: RootObject.cc,v 3.37 2008/11/01 19:19:35 erk Exp $
+// $Id: RootObject.cc,v 3.38 2008/11/02 01:01:53 erk Exp $

Index: RTIA/RTIA_network.cc
===================================================================
RCS file: /sources/certi/certi/RTIA/RTIA_network.cc,v
retrieving revision 3.27
retrieving revision 3.28
diff -u -b -r3.27 -r3.28
--- RTIA/RTIA_network.cc        11 Jul 2008 14:56:00 -0000      3.27
+++ RTIA/RTIA_network.cc        2 Nov 2008 01:01:53 -0000       3.28
@@ -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: RTIA_network.cc,v 3.27 2008/07/11 14:56:00 approx Exp $
+// $Id: RTIA_network.cc,v 3.28 2008/11/02 01:01:53 erk Exp $
 // ----------------------------------------------------------------------------
 
 #include <config.h>
@@ -171,7 +171,7 @@
              {      
              // Retrieve order type
              interactionOrder = rootObject->Interactions->
-                getByHandle(msg->interactionClass)->order;
+                getObjectFromHandle(msg->interactionClass)->order;
              }
          
          // Decide which queue will be used
@@ -352,4 +352,4 @@
 
 }} // namespace certi/rtia
 
-// $Id: RTIA_network.cc,v 3.27 2008/07/11 14:56:00 approx Exp $
+// $Id: RTIA_network.cc,v 3.28 2008/11/02 01:01:53 erk Exp $

Index: RTIA/DataDistribution.cc
===================================================================
RCS file: /sources/certi/certi/RTIA/DataDistribution.cc,v
retrieving revision 3.25
retrieving revision 3.26
diff -u -b -r3.25 -r3.26
--- RTIA/DataDistribution.cc    10 Jun 2008 13:41:43 -0000      3.25
+++ RTIA/DataDistribution.cc    2 Nov 2008 01:01:53 -0000       3.26
@@ -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: DataDistribution.cc,v 3.25 2008/06/10 13:41:43 rousse Exp $
+// $Id: DataDistribution.cc,v 3.26 2008/11/02 01:01:53 erk Exp $
 // ----------------------------------------------------------------------------
 
 #include <config.h>
@@ -111,7 +111,7 @@
 DataDistribution::getInteractionSpace(InteractionClassHandle interaction) const
     throw (InteractionClassNotDefined)
 {
-    return rootObject->Interactions->getByHandle(interaction)->getSpace();
+    return 
rootObject->Interactions->getObjectFromHandle(interaction)->getSpace();
 }
 
 // ----------------------------------------------------------------------------
@@ -413,4 +413,4 @@
 
 }} // namespace certi::rtia
 
-// $Id: DataDistribution.cc,v 3.25 2008/06/10 13:41:43 rousse Exp $
+// $Id: DataDistribution.cc,v 3.26 2008/11/02 01:01:53 erk Exp $




reply via email to

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