lemon/lgf_reader.h
changeset 163 c82fd9568d75
parent 162 33247f6fff16
child 165 b4c336c27a03
equal deleted inserted replaced
5:416bae201451 6:20430796ad79
   465     /// therefore the copied reader will not be usable more. 
   465     /// therefore the copied reader will not be usable more. 
   466     DigraphReader(DigraphReader& other) 
   466     DigraphReader(DigraphReader& other) 
   467       : _is(other._is), local_is(other.local_is), _digraph(other._digraph),
   467       : _is(other._is), local_is(other.local_is), _digraph(other._digraph),
   468 	_use_nodes(other._use_nodes), _use_arcs(other._use_arcs) {
   468 	_use_nodes(other._use_nodes), _use_arcs(other._use_arcs) {
   469 
   469 
   470       other.is = 0;
   470       other._is = 0;
   471       other.local_is = false;
   471       other.local_is = false;
   472       
   472       
   473       _node_index.swap(other._node_index);
   473       _node_index.swap(other._node_index);
   474       _arc_index.swap(other._arc_index);
   474       _arc_index.swap(other._arc_index);
   475 
   475 
  1076 
  1076 
  1077     /// \brief Start the batch processing
  1077     /// \brief Start the batch processing
  1078     ///
  1078     ///
  1079     /// This function starts the batch processing
  1079     /// This function starts the batch processing
  1080     void run() {
  1080     void run() {
  1081       
       
  1082       LEMON_ASSERT(_is != 0, "This reader assigned to an other reader");
  1081       LEMON_ASSERT(_is != 0, "This reader assigned to an other reader");
       
  1082       if (!*_is) {
       
  1083 	throw DataFormatError("Cannot find file");
       
  1084       }
  1083       
  1085       
  1084       bool nodes_done = false;
  1086       bool nodes_done = false;
  1085       bool arcs_done = false;
  1087       bool arcs_done = false;
  1086       bool attributes_done = false;
  1088       bool attributes_done = false;
  1087       std::set<std::string> extra_sections;
  1089       std::set<std::string> extra_sections;
  1158   };
  1160   };
  1159 
  1161 
  1160   /// \relates DigraphReader
  1162   /// \relates DigraphReader
  1161   template <typename Digraph>
  1163   template <typename Digraph>
  1162   DigraphReader<Digraph> digraphReader(std::istream& is, Digraph& digraph) {
  1164   DigraphReader<Digraph> digraphReader(std::istream& is, Digraph& digraph) {
  1163     return DigraphReader<Digraph>(is, digraph);
  1165     DigraphReader<Digraph> tmp(is, digraph);
       
  1166     return tmp;
  1164   }
  1167   }
  1165 
  1168 
  1166   /// \relates DigraphReader
  1169   /// \relates DigraphReader
  1167   template <typename Digraph>
  1170   template <typename Digraph>
  1168   DigraphReader<Digraph> digraphReader(const std::string& fn, 
  1171   DigraphReader<Digraph> digraphReader(const std::string& fn, 
  1169 				       Digraph& digraph) {
  1172 				       Digraph& digraph) {
  1170     return DigraphReader<Digraph>(fn, digraph);
  1173     DigraphReader<Digraph> tmp(fn, digraph);
       
  1174     return tmp;
  1171   }
  1175   }
  1172 
  1176 
  1173   /// \relates DigraphReader
  1177   /// \relates DigraphReader
  1174   template <typename Digraph>
  1178   template <typename Digraph>
  1175   DigraphReader<Digraph> digraphReader(const char* fn, Digraph& digraph) {
  1179   DigraphReader<Digraph> digraphReader(const char* fn, Digraph& digraph) {
  1176     return DigraphReader<Digraph>(fn, digraph);
  1180     DigraphReader<Digraph> tmp(fn, digraph);
       
  1181     return tmp;
  1177   }
  1182   }
  1178 }
  1183 }
  1179 
  1184 
  1180 #endif
  1185 #endif