gravatar
deba@inf.elte.hu
deba@inf.elte.hu
Wrong member variable settings bug fix. (Ticket #95)
0 2 0
default
2 files changed with 4 insertions and 4 deletions:
↑ Collapse diff ↑
Ignore white space 128 line context
... ...
@@ -955,150 +955,150 @@
955 955
    ///Runs Bfs algorithm from a given node.
956 956
    ///The node can be given by the \ref source function.
957 957
    void run()
958 958
    {
959 959
      if(Base::_source==INVALID) throw UninitializedParameter();
960 960
      Bfs<Digraph,TR> alg(*reinterpret_cast<const Digraph*>(Base::_g));
961 961
      if(Base::_reached)
962 962
	alg.reachedMap(*reinterpret_cast<ReachedMap*>(Base::_reached));
963 963
      if(Base::_processed) 
964 964
        alg.processedMap(*reinterpret_cast<ProcessedMap*>(Base::_processed));
965 965
      if(Base::_pred) 
966 966
        alg.predMap(*reinterpret_cast<PredMap*>(Base::_pred));
967 967
      if(Base::_dist) 
968 968
        alg.distMap(*reinterpret_cast<DistMap*>(Base::_dist));
969 969
      alg.run(Base::_source);
970 970
    }
971 971

	
972 972
    ///Runs Bfs algorithm from the given node.
973 973

	
974 974
    ///Runs Bfs algorithm from the given node.
975 975
    ///\param s is the given source.
976 976
    void run(Node s)
977 977
    {
978 978
      Base::_source=s;
979 979
      run();
980 980
    }
981 981

	
982 982
    template<class T>
983 983
    struct DefPredMapBase : public Base {
984 984
      typedef T PredMap;
985 985
      static PredMap *createPredMap(const Digraph &) { return 0; };
986 986
      DefPredMapBase(const TR &b) : TR(b) {}
987 987
    };
988 988
    
989 989
    ///\brief \ref named-templ-param "Named parameter"
990 990
    ///function for setting PredMap
991 991
    ///
992 992
    /// \ref named-templ-param "Named parameter"
993 993
    ///function for setting PredMap
994 994
    ///
995 995
    template<class T>
996 996
    BfsWizard<DefPredMapBase<T> > predMap(const T &t) 
997 997
    {
998 998
      Base::_pred=reinterpret_cast<void*>(const_cast<T*>(&t));
999 999
      return BfsWizard<DefPredMapBase<T> >(*this);
1000 1000
    }
1001 1001
    
1002 1002
 
1003 1003
    template<class T>
1004 1004
    struct DefReachedMapBase : public Base {
1005 1005
      typedef T ReachedMap;
1006 1006
      static ReachedMap *createReachedMap(const Digraph &) { return 0; };
1007 1007
      DefReachedMapBase(const TR &b) : TR(b) {}
1008 1008
    };
1009 1009
    
1010 1010
    ///\brief \ref named-templ-param "Named parameter"
1011 1011
    ///function for setting ReachedMap
1012 1012
    ///
1013 1013
    /// \ref named-templ-param "Named parameter"
1014 1014
    ///function for setting ReachedMap
1015 1015
    ///
1016 1016
    template<class T>
1017 1017
    BfsWizard<DefReachedMapBase<T> > reachedMap(const T &t) 
1018 1018
    {
1019
      Base::_pred=reinterpret_cast<void*>(const_cast<T*>(&t));
1019
      Base::_reached=reinterpret_cast<void*>(const_cast<T*>(&t));
1020 1020
      return BfsWizard<DefReachedMapBase<T> >(*this);
1021 1021
    }
1022 1022
    
1023 1023

	
1024 1024
    template<class T>
1025 1025
    struct DefProcessedMapBase : public Base {
1026 1026
      typedef T ProcessedMap;
1027 1027
      static ProcessedMap *createProcessedMap(const Digraph &) { return 0; };
1028 1028
      DefProcessedMapBase(const TR &b) : TR(b) {}
1029 1029
    };
1030 1030
    
1031 1031
    ///\brief \ref named-templ-param "Named parameter"
1032 1032
    ///function for setting ProcessedMap
1033 1033
    ///
1034 1034
    /// \ref named-templ-param "Named parameter"
1035 1035
    ///function for setting ProcessedMap
1036 1036
    ///
1037 1037
    template<class T>
1038 1038
    BfsWizard<DefProcessedMapBase<T> > processedMap(const T &t) 
1039 1039
    {
1040
      Base::_pred=reinterpret_cast<void*>(const_cast<T*>(&t));
1040
      Base::_processed=reinterpret_cast<void*>(const_cast<T*>(&t));
1041 1041
      return BfsWizard<DefProcessedMapBase<T> >(*this);
1042 1042
    }
1043 1043
    
1044 1044
   
1045 1045
    template<class T>
1046 1046
    struct DefDistMapBase : public Base {
1047 1047
      typedef T DistMap;
1048 1048
      static DistMap *createDistMap(const Digraph &) { return 0; };
1049 1049
      DefDistMapBase(const TR &b) : TR(b) {}
1050 1050
    };
1051 1051
    
1052 1052
    ///\brief \ref named-templ-param "Named parameter"
1053 1053
    ///function for setting DistMap type
1054 1054
    ///
1055 1055
    /// \ref named-templ-param "Named parameter"
1056 1056
    ///function for setting DistMap type
1057 1057
    ///
1058 1058
    template<class T>
1059 1059
    BfsWizard<DefDistMapBase<T> > distMap(const T &t) 
1060 1060
    {
1061 1061
      Base::_dist=reinterpret_cast<void*>(const_cast<T*>(&t));
1062 1062
      return BfsWizard<DefDistMapBase<T> >(*this);
1063 1063
    }
1064 1064
    
1065 1065
    /// Sets the source node, from which the Bfs algorithm runs.
1066 1066

	
1067 1067
    /// Sets the source node, from which the Bfs algorithm runs.
1068 1068
    /// \param s is the source node.
1069 1069
    BfsWizard<TR> &source(Node s) 
1070 1070
    {
1071 1071
      Base::_source=s;
1072 1072
      return *this;
1073 1073
    }
1074 1074
    
1075 1075
  };
1076 1076
  
1077 1077
  ///Function type interface for Bfs algorithm.
1078 1078

	
1079 1079
  /// \ingroup search
1080 1080
  ///Function type interface for Bfs algorithm.
1081 1081
  ///
1082 1082
  ///This function also has several
1083 1083
  ///\ref named-templ-func-param "named parameters",
1084 1084
  ///they are declared as the members of class \ref BfsWizard.
1085 1085
  ///The following
1086 1086
  ///example shows how to use these parameters.
1087 1087
  ///\code
1088 1088
  ///  bfs(g,source).predMap(preds).run();
1089 1089
  ///\endcode
1090 1090
  ///\warning Don't forget to put the \ref BfsWizard::run() "run()"
1091 1091
  ///to the end of the parameter list.
1092 1092
  ///\sa BfsWizard
1093 1093
  ///\sa Bfs
1094 1094
  template<class GR>
1095 1095
  BfsWizard<BfsWizardBase<GR> >
1096 1096
  bfs(const GR &g,typename GR::Node s=INVALID)
1097 1097
  {
1098 1098
    return BfsWizard<BfsWizardBase<GR> >(g,s);
1099 1099
  }
1100 1100

	
1101 1101
#ifdef DOXYGEN
1102 1102
  /// \brief Visitor class for bfs.
1103 1103
  ///  
1104 1104
  /// This class defines the interface of the BfsVisit events, and
Ignore white space 128 line context
... ...
@@ -938,150 +938,150 @@
938 938
    ///Runs Dfs algorithm from a given node.
939 939
    ///The node can be given by the \ref source function.
940 940
    void run()
941 941
    {
942 942
      if(Base::_source==INVALID) throw UninitializedParameter();
943 943
      Dfs<Digraph,TR> alg(*reinterpret_cast<const Digraph*>(Base::_g));
944 944
      if(Base::_reached) 
945 945
        alg.reachedMap(*reinterpret_cast<ReachedMap*>(Base::_reached));
946 946
      if(Base::_processed) 
947 947
        alg.processedMap(*reinterpret_cast<ProcessedMap*>(Base::_processed));
948 948
      if(Base::_pred) 
949 949
        alg.predMap(*reinterpret_cast<PredMap*>(Base::_pred));
950 950
      if(Base::_dist) 
951 951
        alg.distMap(*reinterpret_cast<DistMap*>(Base::_dist));
952 952
      alg.run(Base::_source);
953 953
    }
954 954

	
955 955
    ///Runs Dfs algorithm from the given node.
956 956

	
957 957
    ///Runs Dfs algorithm from the given node.
958 958
    ///\param s is the given source.
959 959
    void run(Node s)
960 960
    {
961 961
      Base::_source=s;
962 962
      run();
963 963
    }
964 964

	
965 965
    template<class T>
966 966
    struct DefPredMapBase : public Base {
967 967
      typedef T PredMap;
968 968
      static PredMap *createPredMap(const Digraph &) { return 0; };
969 969
      DefPredMapBase(const TR &b) : TR(b) {}
970 970
    };
971 971
    
972 972
    ///\brief \ref named-templ-param "Named parameter"
973 973
    ///function for setting PredMap type
974 974
    ///
975 975
    /// \ref named-templ-param "Named parameter"
976 976
    ///function for setting PredMap type
977 977
    ///
978 978
    template<class T>
979 979
    DfsWizard<DefPredMapBase<T> > predMap(const T &t) 
980 980
    {
981 981
      Base::_pred=reinterpret_cast<void*>(const_cast<T*>(&t));
982 982
      return DfsWizard<DefPredMapBase<T> >(*this);
983 983
    }
984 984
    
985 985
 
986 986
    template<class T>
987 987
    struct DefReachedMapBase : public Base {
988 988
      typedef T ReachedMap;
989 989
      static ReachedMap *createReachedMap(const Digraph &) { return 0; };
990 990
      DefReachedMapBase(const TR &b) : TR(b) {}
991 991
    };
992 992
    
993 993
    ///\brief \ref named-templ-param "Named parameter"
994 994
    ///function for setting ReachedMap
995 995
    ///
996 996
    /// \ref named-templ-param "Named parameter"
997 997
    ///function for setting ReachedMap
998 998
    ///
999 999
    template<class T>
1000 1000
    DfsWizard<DefReachedMapBase<T> > reachedMap(const T &t) 
1001 1001
    {
1002
      Base::_pred=reinterpret_cast<void*>(const_cast<T*>(&t));
1002
      Base::_reached=reinterpret_cast<void*>(const_cast<T*>(&t));
1003 1003
      return DfsWizard<DefReachedMapBase<T> >(*this);
1004 1004
    }
1005 1005
    
1006 1006

	
1007 1007
    template<class T>
1008 1008
    struct DefProcessedMapBase : public Base {
1009 1009
      typedef T ProcessedMap;
1010 1010
      static ProcessedMap *createProcessedMap(const Digraph &) { return 0; };
1011 1011
      DefProcessedMapBase(const TR &b) : TR(b) {}
1012 1012
    };
1013 1013
    
1014 1014
    ///\brief \ref named-templ-param "Named parameter"
1015 1015
    ///function for setting ProcessedMap
1016 1016
    ///
1017 1017
    /// \ref named-templ-param "Named parameter"
1018 1018
    ///function for setting ProcessedMap
1019 1019
    ///
1020 1020
    template<class T>
1021 1021
    DfsWizard<DefProcessedMapBase<T> > processedMap(const T &t) 
1022 1022
    {
1023
      Base::_pred=reinterpret_cast<void*>(const_cast<T*>(&t));
1023
      Base::_processed=reinterpret_cast<void*>(const_cast<T*>(&t));
1024 1024
      return DfsWizard<DefProcessedMapBase<T> >(*this);
1025 1025
    }
1026 1026
    
1027 1027
    template<class T>
1028 1028
    struct DefDistMapBase : public Base {
1029 1029
      typedef T DistMap;
1030 1030
      static DistMap *createDistMap(const Digraph &) { return 0; };
1031 1031
      DefDistMapBase(const TR &b) : TR(b) {}
1032 1032
    };
1033 1033
    
1034 1034
    ///\brief \ref named-templ-param "Named parameter"
1035 1035
    ///function for setting DistMap type
1036 1036
    ///
1037 1037
    /// \ref named-templ-param "Named parameter"
1038 1038
    ///function for setting DistMap type
1039 1039
    ///
1040 1040
    template<class T>
1041 1041
    DfsWizard<DefDistMapBase<T> > distMap(const T &t) 
1042 1042
    {
1043 1043
      Base::_dist=reinterpret_cast<void*>(const_cast<T*>(&t));
1044 1044
      return DfsWizard<DefDistMapBase<T> >(*this);
1045 1045
    }
1046 1046
    
1047 1047
    /// Sets the source node, from which the Dfs algorithm runs.
1048 1048

	
1049 1049
    /// Sets the source node, from which the Dfs algorithm runs.
1050 1050
    /// \param s is the source node.
1051 1051
    DfsWizard<TR> &source(Node s) 
1052 1052
    {
1053 1053
      Base::_source=s;
1054 1054
      return *this;
1055 1055
    }
1056 1056
    
1057 1057
  };
1058 1058
  
1059 1059
  ///Function type interface for Dfs algorithm.
1060 1060

	
1061 1061
  ///\ingroup search
1062 1062
  ///Function type interface for Dfs algorithm.
1063 1063
  ///
1064 1064
  ///This function also has several
1065 1065
  ///\ref named-templ-func-param "named parameters",
1066 1066
  ///they are declared as the members of class \ref DfsWizard.
1067 1067
  ///The following
1068 1068
  ///example shows how to use these parameters.
1069 1069
  ///\code
1070 1070
  ///  dfs(g,source).predMap(preds).run();
1071 1071
  ///\endcode
1072 1072
  ///\warning Don't forget to put the \ref DfsWizard::run() "run()"
1073 1073
  ///to the end of the parameter list.
1074 1074
  ///\sa DfsWizard
1075 1075
  ///\sa Dfs
1076 1076
  template<class GR>
1077 1077
  DfsWizard<DfsWizardBase<GR> >
1078 1078
  dfs(const GR &g,typename GR::Node s=INVALID)
1079 1079
  {
1080 1080
    return DfsWizard<DfsWizardBase<GR> >(g,s);
1081 1081
  }
1082 1082

	
1083 1083
#ifdef DOXYGEN
1084 1084
  /// \brief Visitor class for dfs.
1085 1085
  ///  
1086 1086
  /// It gives a simple interface for a functional interface for dfs 
1087 1087
  /// traversal. The traversal on a linear data structure. 
0 comments (0 inline)