certi-cvs
[Top][All Lists]
Advanced

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

[certi-cvs] certi/libCERTI Interaction.hh Interaction.cc


From: CERTI CVS commits
Subject: [certi-cvs] certi/libCERTI Interaction.hh Interaction.cc
Date: Sat, 31 Dec 2011 15:49:23 +0000

CVSROOT:        /sources/certi
Module name:    certi
Changes by:     Eric NOULARD <erk>      11/12/31 15:49:23

Modified files:
        libCERTI       : Interaction.hh Interaction.cc 

Log message:
        More interaction class clean-up

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/Interaction.hh?cvsroot=certi&r1=3.44&r2=3.45
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/Interaction.cc?cvsroot=certi&r1=3.63&r2=3.64

Patches:
Index: Interaction.hh
===================================================================
RCS file: /sources/certi/certi/libCERTI/Interaction.hh,v
retrieving revision 3.44
retrieving revision 3.45
diff -u -b -r3.44 -r3.45
--- Interaction.hh      31 Dec 2011 13:25:58 -0000      3.44
+++ Interaction.hh      31 Dec 2011 15:49:23 -0000      3.45
@@ -19,7 +19,7 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 // USA
 //
-// $Id: Interaction.hh,v 3.44 2011/12/31 13:25:58 erk Exp $
+// $Id: Interaction.hh,v 3.45 2011/12/31 15:49:23 erk Exp $
 // ----------------------------------------------------------------------------
 
 #ifndef _CERTI_INTERACTION_HH
@@ -27,8 +27,8 @@
 
 // forward declaration
 namespace certi {
-       class InteractionBroadcastList;
-       class InteractionSet;
+class InteractionBroadcastList;
+class InteractionSet;
 }  // namespace certi
 
 // CERTI headers
@@ -59,24 +59,25 @@
         * The type of the handle of this class.
         */
        typedef InteractionClassHandle handle_t;
+
        /**
         * The type of the exception to when such object is not found
         */
        typedef InteractionClassNotDefined ObjectNotDefinedException;
-       /**
-        * Build an interaction class object.
-        * @param[in] name the name of the interaction class
-        * @param[in] handle the handle of this class
-        * @param[in] transport the transport type
-        * @param[in] order the receive order type
-        */
 
        /**
         * The type for the parameter list.
         */
        typedef std::map<ParameterHandle, Parameter*> HandleParameterMap;
 
-    Interaction(const std::string& theName, InteractionClassHandle theHandle, 
TransportType theTransport, OrderType theOrder);
+    /**
+     * Build an interaction class object.
+     * @param[in] theName the name of the interaction class
+     * @param[in] handle the handle of this class
+     * @param[in] transport the transport type
+     * @param[in] order the receive order type
+     */
+    Interaction(const std::string& name, InteractionClassHandle handle, 
TransportType transport, OrderType order);
     /**
      * Destructor.
      */
@@ -92,11 +93,11 @@
         * Get the super class handle.
         * @return the super class handle
         */
-       InteractionClassHandle getSuperclass() const { return superClass ; };
+    InteractionClassHandle getSuperclass() const { return superClass ;};
 
        /**
         * Add a subclass to this interaction class.
-        * @param[in] child the interaction to add as a sub class
+     * @param[in,out] child the interaction to add as a sub class
         */
        void addSubClass(Interaction *child);
 
@@ -106,15 +107,21 @@
         * @return the sub class object class.
         */
        Interaction* getSubClassByName(const std::string& subClassName);
+
        /**
         * Get the whole set of subclasses.
         */
        InteractionSet* getSubClasses() {return subClasses;};
 
-    ParameterHandle addParameter(Parameter *the_parameter,
+    /**
+     * Add a parameter to an interaction class.
+     * @param[in] parameter,
+     * @param[in] is_inherited, true if it is an inherited parameter
+     * @return the new parameter handle
+     */
+    ParameterHandle addParameter(Parameter *parameter,
                                  bool is_inherited = false);
 
-
     void display() const ;
 
     // -- Security Methods --
@@ -206,8 +213,6 @@
     //! This Object helps to find a TCPLink given a Federate Handle.
     SecurityServer *server ;
 
-    uint16_t depth ;
-
     /*! Interaction messages' Transport Type(Reliable, Best Effort),
       Currently not used.
     */
@@ -258,4 +263,4 @@
 
 #endif // _CERTI_INTERACTION.HH
 
-// $Id: Interaction.hh,v 3.44 2011/12/31 13:25:58 erk Exp $
+// $Id: Interaction.hh,v 3.45 2011/12/31 15:49:23 erk Exp $

Index: Interaction.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/Interaction.cc,v
retrieving revision 3.63
retrieving revision 3.64
diff -u -b -r3.63 -r3.64
--- Interaction.cc      31 Dec 2011 13:25:58 -0000      3.63
+++ Interaction.cc      31 Dec 2011 15:49:23 -0000      3.64
@@ -19,11 +19,9 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 // USA
 //
-// $Id: Interaction.cc,v 3.63 2011/12/31 13:25:58 erk Exp $
+// $Id: Interaction.cc,v 3.64 2011/12/31 15:49:23 erk Exp $
 // ----------------------------------------------------------------------------
 
-
-
 #include "Interaction.hh"
 #include "InteractionSet.hh"
 #include "InteractionBroadcastList.hh"
@@ -43,24 +41,23 @@
 static PrettyDebug D("INTERACTION", "(Interact) - ");
 static PrettyDebug G("GENDOC",__FILE__) ;
 
-Interaction::Interaction(const std::string& theName, InteractionClassHandle 
theHandle, TransportType theTransport, OrderType theOrder)
-  : Subscribable(theName), depth(0), transport(theTransport), order(theOrder), 
handle(theHandle),
-  superClass(0), id(PublicLevelID), space(0)
-{
+Interaction::Interaction(const std::string& name, InteractionClassHandle 
handle, TransportType transport, OrderType order)
+  : Subscribable(name), transport(transport), order(order), handle(handle),
+  superClass(0), id(PublicLevelID), space(0) {
        /*
         * The set of interaction subclass has no security server
         */
        subClasses = new InteractionSet(NULL);
 } /* end of Interaction constructor */
 
-Interaction::~Interaction()
-{
+Interaction::~Interaction() {
         for (HandleParameterMap::iterator i = _handleParameterMap.begin(); i 
!= _handleParameterMap.end(); ++i) {
                 delete i->second;
         }
 
-       if (!publishers.empty())
+    if (!publishers.empty()) {
                D.Out(pdError, "Interaction %d: publishers list not empty at 
termination.", handle);
+    }
 
        // Deleting subclasses
        if (NULL!=subClasses) {
@@ -68,7 +65,8 @@
        }
 } /* end of ~Interaction */
 
-void Interaction::addSubClass(Interaction *child) {
+void
+Interaction::addSubClass(Interaction *child) {
        /* build parent-child relationship */
        /* add child as subclass of parent */
        subClasses->addClass(child,NULL);
@@ -81,39 +79,36 @@
     child->server = server;
        /* inherit security Level */
        child->setSecurityLevelId(id);
-} /* end of addChild */
+} /* end of addSubClass */
 
-// ----------------------------------------------------------------------------
-//! Used only by CRead, return the new parameter's handle.
 ParameterHandle
-Interaction::addParameter(Parameter *the_parameter, bool is_inherited)
-{
-        if (the_parameter == NULL)
+Interaction::addParameter(Parameter *parameter, bool is_inherited) {
+    if (parameter == NULL)
                 throw RTIinternalError("Tried to add NULL parameter.");
     
-        ParameterHandle parameterHandle = the_parameter->getHandle();
+    ParameterHandle parameterHandle = parameter->getHandle();
         if (_handleParameterMap.find(parameterHandle) != 
_handleParameterMap.end()) {
                 throw RTIinternalError("Interaction::addParameter: Tried to 
add parameter with duplicate handle.");
         }
 
        // An inherited parameter keeps its security level, any other get the
        // default security level of the class.
-       if (!is_inherited)
-               the_parameter->LevelID = id ;
+    if (!is_inherited) {
+        parameter->LevelID = id ;
+    }
 
-        _handleParameterMap[parameterHandle] = the_parameter;
+    _handleParameterMap[parameterHandle] = parameter;
 
        Debug(D, pdRegister) << "Interaction " << handle << "[" << name
        << "] has a new parameter "
-       << parameterHandle << "[" << the_parameter->getName() << "]"
+            << parameterHandle << "[" << parameter->getName() << "]"
        << std::flush;
 
        return parameterHandle;
 } /* end of addParameter */
 
 void
-Interaction::addInheritedClassParameter(Interaction *the_child)
-{
+Interaction::addInheritedClassParameter(Interaction *the_child) {
         for (HandleParameterMap::iterator i = _handleParameterMap.begin(); i 
!= _handleParameterMap.end(); ++i) {
                assert(i->second != NULL);
 
@@ -136,8 +131,7 @@
  */
 void
 Interaction::broadcastInteractionMessage(InteractionBroadcastList *ibList,
-               const RTIRegion *region)
-{
+        const RTIRegion *region) {
 
        G.Out(pdGendoc,"enter Interaction::broadcastInteractionMessage");
 
@@ -162,8 +156,7 @@
        ibList->sendPendingMessage(server);
 
        G.Out(pdGendoc,"exit Interaction::broadcastInteractionMessage");
-
-}
+}  /* end of broadcastInteractionMessage */
 
 // ----------------------------------------------------------------------------
 //! changeTransportationType.
@@ -172,8 +165,7 @@
                FederateHandle the_handle)
 throw (FederateNotPublishing,
                InvalidTransportationHandle,
-               RTIinternalError)
-               {
+        RTIinternalError) {
        if (!isPublishing(the_handle))
                throw FederateNotPublishing("Change Interaction Transport 
Type.");
 
@@ -184,7 +176,7 @@
 
        D.Out(pdInit,
                        "Interaction %d: New Transport type is %d.", handle, 
transport);
-               } /* end of changeTransportationType */
+} /* end of changeTransportationType */
 
 // ----------------------------------------------------------------------------
 //! changeOrderType.
@@ -192,8 +184,7 @@
 Interaction::changeOrderType(OrderType new_order, FederateHandle the_handle)
 throw (FederateNotPublishing,
                InvalidOrderingHandle,
-               RTIinternalError)
-               {
+        RTIinternalError) {
        if (!isPublishing(the_handle))
                throw FederateNotPublishing("Change Interaction Order Type.");
 
@@ -201,7 +192,7 @@
                throw InvalidOrderingHandle("");
 
        D.Out(pdInit, "Interaction %d: New Order type is %d.", handle, order);
-               }
+} /* end of changeOrderType */
 
 // ----------------------------------------------------------------------------
 /*! Throw SecurityError is the Federate is not allowed to access the
@@ -229,8 +220,7 @@
 // ----------------------------------------------------------------------------
 //! Delete a publisher with rank
 void
-Interaction::deletePublisher(FederateHandle fed)
-{
+Interaction::deletePublisher(FederateHandle fed) {
        PublishersList::iterator it = publishers.find(fed);
        if (it != publishers.end())
                publishers.erase(it);
@@ -239,8 +229,7 @@
 // ----------------------------------------------------------------------------
 //! Print the Interaction to the standard output.
 void
-Interaction::display() const
-{
+Interaction::display() const {
        cout << " Interaction " << handle << " \"" << name << "\" :" << endl ;
 
        // Display inheritance
@@ -266,15 +255,15 @@
 //! Returns the parameter by its handle
 Parameter*
 Interaction::getParameterByHandle(ParameterHandle the_handle) const
-throw (InteractionParameterNotDefined, RTIinternalError)
-{
+throw (InteractionParameterNotDefined, RTIinternalError) {
         HandleParameterMap::const_iterator i = 
_handleParameterMap.find(the_handle);
         if (i != _handleParameterMap.end()) {
                 return i->second;
         }
 
-       throw InteractionParameterNotDefined("");
-}
+    throw InteractionParameterNotDefined(
+             certi::stringize() << "for handle "<<the_handle);
+} /* end of getParameterByHandle */
 
 // ----------------------------------------------------------------------------
 //! Returns the parameter handle obtained by its name.
@@ -507,7 +496,7 @@
        // Return the BroadcastList in case it had to be passed to the
        // parent class.
        return ibList ;
-}
+        }
 
 
 // ----------------------------------------------------------------------------
@@ -541,4 +530,4 @@
 
 } // namespace certi
 
-// $Id: Interaction.cc,v 3.63 2011/12/31 13:25:58 erk Exp $
+// $Id: Interaction.cc,v 3.64 2011/12/31 15:49:23 erk Exp $



reply via email to

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