Parcourir la source

Use port name in toString method of Links

Eric Ramat il y a 6 ans
Parent
commit
b6d64e3205

+ 4 - 2
src/artis-star/common/Links.hpp

@@ -109,10 +109,12 @@ public:
              it != Links < Time >::end(); ++it) {
             ss << common::String::make_spaces((level + 1) * 2)
                << it->first.get_model()->get_name() << "::"
-               << it->first.get_port_index()
+               << it->first.get_model()->get_out_port_name(
+                   it->first.get_port_index())
                << " -> "
                << it->second.get_model()->get_name() << "::"
-               << it->second.get_port_index() << std::endl;
+               << it->second.get_model()->get_out_port_name(
+                   it->second.get_port_index()) << std::endl;
         }
         return ss.str();
     }

+ 16 - 2
src/artis-star/common/Model.hpp

@@ -109,16 +109,30 @@ public:
         _out_port_map.erase(port.index);
     }
 
-    bool exist_in_port(unsigned int port_index)
+    bool exist_in_port(unsigned int port_index) const
     {
         return _in_port_map.find(port_index) != _in_port_map.end();
     }
 
-    bool exist_out_port(unsigned int port_index)
+    bool exist_out_port(unsigned int port_index) const
     {
         return _out_port_map.find(port_index) != _out_port_map.end();
     }
 
+    std::string get_in_port_name(unsigned int port_index) const
+    {
+        assert(exist_in_port(port_index));
+
+        return _in_port_map.find(port_index)->second;
+    }
+
+    std::string get_out_port_name(unsigned int port_index) const
+    {
+        assert(exist_out_port(port_index));
+
+        return _out_port_map.find(port_index)->second;
+    }
+
     const std::string& get_name() const
     { return _name; }
 

+ 0 - 6
src/artis-star/common/Node.hpp

@@ -56,17 +56,11 @@ public :
 
     bool operator<(const Node < Time >& o) const
     {
-      /*      if (o._model == _model) {
-	return o._port_name < _port_name;
-      } else {
-	return o._model < _model;
-	}*/
       return _id < o._id;
     }
 
     bool operator==(const Node < Time >& o) const
     {
-      //return (o._port_name == _port_name and o._model == _model);
       return _id == o._id;
     }