Parcourir la source

common: fix bug in exist method of links

Eric Ramat il y a 7 ans
Parent
commit
bc8d265427
2 fichiers modifiés avec 12 ajouts et 11 suppressions
  1. 3 3
      CMakeLists.txt
  2. 9 8
      src/paradevs/common/Links.hpp

+ 3 - 3
CMakeLists.txt

@@ -73,15 +73,15 @@ INCLUDE(CMakeDetermineCCompiler)
  # Check libraries with pkgconfig
 #
 
-FIND_PACKAGE(PkgConfig REQUIRED)
+#FIND_PACKAGE(PkgConfig REQUIRED)
 
 # FIXME use old-style link directories for now
 IF (COMMAND CMAKE_POLICY)
   CMAKE_POLICY(SET CMP0003 OLD)
 ENDIF (COMMAND CMAKE_POLICY)
 
-PKG_CHECK_MODULES(GLIBMM REQUIRED glibmm-2.4)
-PKG_CHECK_MODULES(LIBXML REQUIRED libxml-2.0)
+#PKG_CHECK_MODULES(GLIBMM REQUIRED glibmm-2.4)
+#PKG_CHECK_MODULES(LIBXML REQUIRED libxml-2.0)
 #
  # Test the libboost header and libboost-text library.
 #

+ 9 - 8
src/paradevs/common/Links.hpp

@@ -74,17 +74,18 @@ public:
                Model < Time >* in_model,
                const std::string& in_port_name) const
     {
-        typename Links < Time >::const_iterator it =
-            std::multimap < Node < Time >,
-                            Node < Time > >::find(
-                                Node < Time >(out_model,
-                                                               out_port_name));
+      std::pair < typename Links < Time >::const_iterator,
+		  typename Links < Time >::const_iterator > it =
+	std::multimap < Node < Time >,
+			Node < Time > >::equal_range(Node < Time >(out_model,
+								   out_port_name));
+      typename Links < Time >::const_iterator it2 = it.first;
         bool found = false;
 
-        while (not found and it != Links < Time >::end()) {
-            found = it->second == Node < Time >(
+        while (not found and it2 != it.second) {
+            found = it2->second == Node < Time >(
                 in_model, in_port_name);
-            ++it;
+            ++it2;
         }
         return found;
     }