| 1 | /* -*- mode: C++; indent-tabs-mode: nil; -*- |
| 2 | * |
| 3 | * This file is a part of LEMON, a generic C++ optimization library. |
| 4 | * |
| 5 | * Copyright (C) 2003-2013 |
| 6 | * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
| 7 | * (Egervary Research Group on Combinatorial Optimization, EGRES). |
| 8 | * |
| 9 | * Permission to use, modify and distribute this software is granted |
| 10 | * provided that this copyright notice appears in all copies. For |
| 11 | * precise terms see the accompanying LICENSE file. |
| 12 | * |
| 13 | * This software is provided "AS IS" with no warranty of any kind, |
| 14 | * express or implied, and with no claim as to its suitability for any |
| 15 | * purpose. |
| 16 | * |
| 17 | */ |
| 18 | |
| 19 | ///\ingroup lemon_io |
| 20 | ///\file |
| 21 | ///\brief \ref lgf-format "LEMON Graph Format" writer. |
| 22 | |
| 23 | |
| 24 | #ifndef LEMON_LGF_WRITER_H |
| 25 | #define LEMON_LGF_WRITER_Hcxx . . $ `lemon/lgf_writer.h:25:9`! |
| 26 | |
| 27 | #include <iostream> |
| 28 | #include <fstream> |
| 29 | #include <sstream> |
| 30 | |
| 31 | #include <algorithm> |
| 32 | |
| 33 | #include <vector> |
| 34 | #include <functional> |
| 35 | |
| 36 | #include <lemon/core.h>cxx . . $ `<file>/lemon/core.h`/ |
| 37 | #include <lemon/maps.h>cxx . . $ `<file>/lemon/maps.h`/ |
| 38 | |
| 39 | #include <lemon/concept_check.h>cxx . . $ `<file>/lemon/concept_check.h`/ |
| 40 | #include <lemon/concepts/maps.h>cxx . . $ `<file>/lemon/concepts/maps.h`/ |
| 41 | |
| 42 | namespace lemoncxx . . $ lemon/ { |
| 43 | |
| 44 | namespace _writer_bitscxx . . $ lemon/_writer_bits/ { |
| 45 | |
| 46 | template <typename Value> |
| 47 | struct DefaultConvertercxx . . $ lemon/_writer_bits/DefaultConverter# { |
| 48 | stdcxx . . $ std/::stringcxx . . $ std/string# operatorcxx . . $ lemon/_writer_bits/DefaultConverter#`operator()`(23b83986b497e4d5).()(const Value& value) { |
| 49 | stdcxx . . $ std/::ostringstreamcxx . . $ std/ostringstream# oscxx . . $ std/__cxx11/basic_ostringstream#basic_ostringstream(49f6e7a06ebc5aa8).; |
| 50 | os << value; |
| 51 | return os.strcxx . . $ std/__cxx11/basic_ostringstream#str(d33e1a6fd36255f7).(); |
| 52 | } |
| 53 | }; |
| 54 | |
| 55 | template <typename T> |
| 56 | bool operatorcxx . . $ lemon/_writer_bits/`operator<`(9c67b3b6cbcd0cef).<(const T&, const T&) { |
| 57 | throw FormatErrorcxx . . $ lemon/FormatError#("Label map is not comparable"); |
| 58 | } |
| 59 | |
| 60 | template <typename _Map> |
| 61 | class MapLesscxx . . $ lemon/_writer_bits/MapLess# { |
| 62 | public: |
| 63 | typedef _Map Mapcxx . . $ lemon/_writer_bits/MapLess#Map#; |
| 64 | typedef typename Mapcxx . . $ lemon/_writer_bits/MapLess#Map#::Key Itemcxx . . $ lemon/_writer_bits/MapLess#Item#; |
| 65 | |
| 66 | private: |
| 67 | const Mapcxx . . $ lemon/_writer_bits/MapLess#Map#& _mapcxx . . $ lemon/_writer_bits/MapLess#_map.; |
| 68 | |
| 69 | public: |
| 70 | MapLesscxx . . $ lemon/_writer_bits/MapLess#`MapLess<_Map>`(77d9f17553126ecb).(const Mapcxx . . $ lemon/_writer_bits/MapLess#Map#& map) : _mapcxx . . $ lemon/_writer_bits/MapLess#_map.(map) {} |
| 71 | |
| 72 | bool operatorcxx . . $ lemon/_writer_bits/MapLess#`operator()`(48999622324ae362).()(const Itemcxx . . $ lemon/_writer_bits/MapLess#Item#& left, const Itemcxx . . $ lemon/_writer_bits/MapLess#Item#& right) { |
| 73 | return _mapcxx . . $ lemon/_writer_bits/MapLess#_map.[left] <cxx . . $ lemon/_writer_bits/`operator<`(9c67b3b6cbcd0cef). _mapcxx . . $ lemon/_writer_bits/MapLess#_map.[right]; |
| 74 | } |
| 75 | }; |
| 76 | |
| 77 | template <typename _Graph, bool _dir, typename _Map> |
| 78 | class GraphArcMapLesscxx . . $ lemon/_writer_bits/GraphArcMapLess# { |
| 79 | public: |
| 80 | typedef _Map Mapcxx . . $ lemon/_writer_bits/GraphArcMapLess#Map#; |
| 81 | typedef _Graph Graphcxx . . $ lemon/_writer_bits/GraphArcMapLess#Graph#; |
| 82 | typedef typename Graphcxx . . $ lemon/_writer_bits/GraphArcMapLess#Graph#::Edge Itemcxx . . $ lemon/_writer_bits/GraphArcMapLess#Item#; |
| 83 | |
| 84 | private: |
| 85 | const Graphcxx . . $ lemon/_writer_bits/GraphArcMapLess#Graph#& _graphcxx . . $ lemon/_writer_bits/GraphArcMapLess#_graph.; |
| 86 | const Mapcxx . . $ lemon/_writer_bits/GraphArcMapLess#Map#& _mapcxx . . $ lemon/_writer_bits/GraphArcMapLess#_map.; |
| 87 | |
| 88 | public: |
| 89 | GraphArcMapLesscxx . . $ lemon/_writer_bits/GraphArcMapLess#`GraphArcMapLess<_Graph, _dir, _Map>`(753441c5277c04d3).(const Graphcxx . . $ lemon/_writer_bits/GraphArcMapLess#Graph#& graph, const Mapcxx . . $ lemon/_writer_bits/GraphArcMapLess#Map#& map) |
| 90 | : _graphcxx . . $ lemon/_writer_bits/GraphArcMapLess#_graph.(graph), _mapcxx . . $ lemon/_writer_bits/GraphArcMapLess#_map.(map) {} |
| 91 | |
| 92 | bool operatorcxx . . $ lemon/_writer_bits/GraphArcMapLess#`operator()`(f8f5c9f9fd7889b7).()(const Itemcxx . . $ lemon/_writer_bits/GraphArcMapLess#Item#& left, const Itemcxx . . $ lemon/_writer_bits/GraphArcMapLess#Item#& right) { |
| 93 | return _mapcxx . . $ lemon/_writer_bits/GraphArcMapLess#_map.[_graphcxx . . $ lemon/_writer_bits/GraphArcMapLess#_graph..direct(left, _dir)] <cxx . . $ lemon/_writer_bits/`operator<`(9c67b3b6cbcd0cef). |
| 94 | _mapcxx . . $ lemon/_writer_bits/GraphArcMapLess#_map.[_graphcxx . . $ lemon/_writer_bits/GraphArcMapLess#_graph..direct(right, _dir)]; |
| 95 | } |
| 96 | }; |
| 97 | |
| 98 | template <typename _Item> |
| 99 | class MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase# { |
| 100 | public: |
| 101 | typedef _Item Itemcxx . . $ lemon/_writer_bits/MapStorageBase#Item#; |
| 102 | |
| 103 | public: |
| 104 | MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#`MapStorageBase<_Item>`(49f6e7a06ebc5aa8).() {} |
| 105 | virtual ~cxx . . $ lemon/_writer_bits/MapStorageBase#`~MapStorageBase<_Item>`(49f6e7a06ebc5aa8).MapStorageBase() {} |
| 106 | |
| 107 | virtual stdcxx . . $ std/::stringcxx . . $ std/string# getcxx . . $ lemon/_writer_bits/MapStorageBase#get(23b83986b497e4d5).(const Itemcxx . . $ lemon/_writer_bits/MapStorageBase#Item#& item) = 0; |
| 108 | virtual void sortcxx . . $ lemon/_writer_bits/MapStorageBase#sort(efb54ab086463856).(stdcxx . . $ std/::vectorcxx . . $ std/vector#<Itemcxx . . $ lemon/_writer_bits/MapStorageBase#Item#>&) = 0; |
| 109 | }; |
| 110 | |
| 111 | template <typename _Item, typename _Map, |
| 112 | typename _Converter = DefaultConvertercxx . . $ lemon/_writer_bits/DefaultConverter#<typename _Map::Value> > |
| 113 | class MapStoragecxx . . $ lemon/_writer_bits/MapStorage# : public MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<_Item> { |
| 114 | public: |
| 115 | typedef _Map Mapcxx . . $ lemon/_writer_bits/MapStorage#Map#; |
| 116 | typedef _Converter Convertercxx . . $ lemon/_writer_bits/MapStorage#Converter#; |
| 117 | typedef _Item Itemcxx . . $ lemon/_writer_bits/MapStorage#Item#; |
| 118 | |
| 119 | private: |
| 120 | const Mapcxx . . $ lemon/_writer_bits/MapStorage#Map#& _mapcxx . . $ lemon/_writer_bits/MapStorage#_map.; |
| 121 | Convertercxx . . $ lemon/_writer_bits/MapStorage#Converter# _convertercxx . . $ lemon/_writer_bits/MapStorage#_converter.; |
| 122 | |
| 123 | public: |
| 124 | MapStoragecxx . . $ lemon/_writer_bits/MapStorage#`MapStorage<_Item, _Map, _Converter>`(19c357cac5bd4ecc).(const Mapcxx . . $ lemon/_writer_bits/MapStorage#Map#& map, const Convertercxx . . $ lemon/_writer_bits/MapStorage#Converter#& converter = Convertercxx . . $ lemon/_writer_bits/MapStorage#Converter#()) |
| 125 | : _mapcxx . . $ lemon/_writer_bits/MapStorage#_map.(map), _convertercxx . . $ lemon/_writer_bits/MapStorage#_converter.(converter) {} |
| 126 | virtual ~cxx . . $ lemon/_writer_bits/MapStorage#`~MapStorage<_Item, _Map, _Converter>`(49f6e7a06ebc5aa8).MapStorage() {} |
| 127 | |
| 128 | virtual stdcxx . . $ std/::stringcxx . . $ std/string# getcxx . . $ lemon/_writer_bits/MapStorage#get(23b83986b497e4d5).(const Itemcxx . . $ lemon/_writer_bits/MapStorage#Item#& item) { |
| 129 | return _convertercxx . . $ lemon/_writer_bits/MapStorage#_converter.(_mapcxx . . $ lemon/_writer_bits/MapStorage#_map.[item]); |
| 130 | } |
| 131 | virtual void sortcxx . . $ lemon/_writer_bits/MapStorage#sort(efb54ab086463856).(stdcxx . . $ std/::vectorcxx . . $ std/vector#<Itemcxx . . $ lemon/_writer_bits/MapStorage#Item#>& items) { |
| 132 | MapLesscxx . . $ lemon/_writer_bits/MapLess#<Mapcxx . . $ lemon/_writer_bits/MapStorage#Map#> less(_mapcxx . . $ lemon/_writer_bits/MapStorage#_map.); |
| 133 | stdcxx . . $ std/::sortcxx . . $ std/sort(1b056e85f3afd146).(items.begincxx . . $ std/vector#begin(55a6de06420d4903).(), items.endcxx . . $ std/vector#end(d1e1699016b9d7e6).(), less); |
| 134 | } |
| 135 | }; |
| 136 | |
| 137 | template <typename _Graph, bool _dir, typename _Map, |
| 138 | typename _Converter = DefaultConvertercxx . . $ lemon/_writer_bits/DefaultConverter#<typename _Map::Value> > |
| 139 | class GraphArcMapStoragecxx . . $ lemon/_writer_bits/GraphArcMapStorage# : public MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<typename _Graph::Edge> { |
| 140 | public: |
| 141 | typedef _Map Mapcxx . . $ lemon/_writer_bits/GraphArcMapStorage#Map#; |
| 142 | typedef _Converter Convertercxx . . $ lemon/_writer_bits/GraphArcMapStorage#Converter#; |
| 143 | typedef _Graph Graphcxx . . $ lemon/_writer_bits/GraphArcMapStorage#Graph#; |
| 144 | typedef typename Graphcxx . . $ lemon/_writer_bits/GraphArcMapStorage#Graph#::Edge Itemcxx . . $ lemon/_writer_bits/GraphArcMapStorage#Item#; |
| 145 | static const bool dircxx . . $ lemon/_writer_bits/GraphArcMapStorage#dir. = _dir; |
| 146 | |
| 147 | private: |
| 148 | const Graphcxx . . $ lemon/_writer_bits/GraphArcMapStorage#Graph#& _graphcxx . . $ lemon/_writer_bits/GraphArcMapStorage#_graph.; |
| 149 | const Mapcxx . . $ lemon/_writer_bits/GraphArcMapStorage#Map#& _mapcxx . . $ lemon/_writer_bits/GraphArcMapStorage#_map.; |
| 150 | Convertercxx . . $ lemon/_writer_bits/GraphArcMapStorage#Converter# _convertercxx . . $ lemon/_writer_bits/GraphArcMapStorage#_converter.; |
| 151 | |
| 152 | public: |
| 153 | GraphArcMapStoragecxx . . $ lemon/_writer_bits/GraphArcMapStorage#`GraphArcMapStorage<_Graph, _dir, _Map, _Converter>`(5a3bf06bb30a5d88).(const Graphcxx . . $ lemon/_writer_bits/GraphArcMapStorage#Graph#& graph, const Mapcxx . . $ lemon/_writer_bits/GraphArcMapStorage#Map#& map, |
| 154 | const Convertercxx . . $ lemon/_writer_bits/GraphArcMapStorage#Converter#& converter = Convertercxx . . $ lemon/_writer_bits/GraphArcMapStorage#Converter#()) |
| 155 | : _graphcxx . . $ lemon/_writer_bits/GraphArcMapStorage#_graph.(graph), _mapcxx . . $ lemon/_writer_bits/GraphArcMapStorage#_map.(map), _convertercxx . . $ lemon/_writer_bits/GraphArcMapStorage#_converter.(converter) {} |
| 156 | virtual ~cxx . . $ lemon/_writer_bits/GraphArcMapStorage#`~GraphArcMapStorage<_Graph, _dir, _Map, _Converter>`(49f6e7a06ebc5aa8).GraphArcMapStorage() {} |
| 157 | |
| 158 | virtual stdcxx . . $ std/::stringcxx . . $ std/string# getcxx . . $ lemon/_writer_bits/GraphArcMapStorage#get(46889badfeb4ce75).(const Itemcxx . . $ lemon/_writer_bits/GraphArcMapStorage#Item#& item) { |
| 159 | return _convertercxx . . $ lemon/_writer_bits/GraphArcMapStorage#_converter.(_mapcxx . . $ lemon/_writer_bits/GraphArcMapStorage#_map.[_graphcxx . . $ lemon/_writer_bits/GraphArcMapStorage#_graph..direct(item, dircxx . . $ lemon/_writer_bits/GraphArcMapStorage#dir.)]); |
| 160 | } |
| 161 | virtual void sortcxx . . $ lemon/_writer_bits/GraphArcMapStorage#sort(1836587b6416291d).(stdcxx . . $ std/::vectorcxx . . $ std/vector#<Itemcxx . . $ lemon/_writer_bits/GraphArcMapStorage#Item#>& items) { |
| 162 | GraphArcMapLesscxx . . $ lemon/_writer_bits/GraphArcMapLess#<Graphcxx . . $ lemon/_writer_bits/GraphArcMapStorage#Graph#, dircxx . . $ lemon/_writer_bits/GraphArcMapStorage#dir., Mapcxx . . $ lemon/_writer_bits/GraphArcMapStorage#Map#> less(_graphcxx . . $ lemon/_writer_bits/GraphArcMapStorage#_graph., _mapcxx . . $ lemon/_writer_bits/GraphArcMapStorage#_map.); |
| 163 | stdcxx . . $ std/::sortcxx . . $ std/sort(360855cc766c4ee5).(items.begincxx . . $ std/vector#begin(d1e1699016b9d7e6).(), items.endcxx . . $ std/vector#end(55a6de06420d4903).(), less); |
| 164 | } |
| 165 | }; |
| 166 | |
| 167 | class ValueStorageBasecxx . . $ lemon/_writer_bits/ValueStorageBase# { |
| 168 | public: |
| 169 | ValueStorageBasecxx . . $ lemon/_writer_bits/ValueStorageBase#ValueStorageBase(49f6e7a06ebc5aa8).() {} |
| 170 | virtual ~cxx . . $ lemon/_writer_bits/ValueStorageBase#`~ValueStorageBase`(ced63f7c635d850d).ValueStorageBasecxx . . $ lemon/_writer_bits/ValueStorageBase#() {} |
| 171 | |
| 172 | virtual stdcxx . . $ std/::stringcxx . . $ std/string# getcxx . . $ lemon/_writer_bits/ValueStorageBase#get(efd28698952f529a).() = 0; |
| 173 | }; |
| 174 | |
| 175 | template <typename _Value, typename _Converter = DefaultConvertercxx . . $ lemon/_writer_bits/DefaultConverter#<_Value> > |
| 176 | class ValueStoragecxx . . $ lemon/_writer_bits/ValueStorage# : public ValueStorageBasecxx . . $ lemon/_writer_bits/ValueStorageBase# { |
| 177 | public: |
| 178 | typedef _Value Valuecxx . . $ lemon/_writer_bits/ValueStorage#Value#; |
| 179 | typedef _Converter Convertercxx . . $ lemon/_writer_bits/ValueStorage#Converter#; |
| 180 | |
| 181 | private: |
| 182 | const Valuecxx . . $ lemon/_writer_bits/ValueStorage#Value#& _valuecxx . . $ lemon/_writer_bits/ValueStorage#_value.; |
| 183 | Convertercxx . . $ lemon/_writer_bits/ValueStorage#Converter# _convertercxx . . $ lemon/_writer_bits/ValueStorage#_converter.; |
| 184 | |
| 185 | public: |
| 186 | ValueStoragecxx . . $ lemon/_writer_bits/ValueStorage#`ValueStorage<_Value, _Converter>`(13c11f7bd0e7e3d2).(const Valuecxx . . $ lemon/_writer_bits/ValueStorage#Value#& value, const Convertercxx . . $ lemon/_writer_bits/ValueStorage#Converter#& converter = Convertercxx . . $ lemon/_writer_bits/ValueStorage#Converter#()) |
| 187 | : _valuecxx . . $ lemon/_writer_bits/ValueStorage#_value.(value), _convertercxx . . $ lemon/_writer_bits/ValueStorage#_converter.(converter) {} |
| 188 | |
| 189 | virtual stdcxx . . $ std/::stringcxx . . $ std/string# getcxx . . $ lemon/_writer_bits/ValueStorage#get(efd28698952f529a).() { |
| 190 | return _convertercxx . . $ lemon/_writer_bits/ValueStorage#_converter.(_valuecxx . . $ lemon/_writer_bits/ValueStorage#_value.); |
| 191 | } |
| 192 | }; |
| 193 | |
| 194 | template <typename Value, |
| 195 | typename Map = stdcxx . . $ std/::mapcxx . . $ std/map#<Value, stdcxx . . $ std/::stringcxx . . $ std/string#> > |
| 196 | struct MapLookUpConvertercxx . . $ lemon/_writer_bits/MapLookUpConverter# { |
| 197 | const Map& _mapcxx . . $ lemon/_writer_bits/MapLookUpConverter#_map.; |
| 198 | |
| 199 | MapLookUpConvertercxx . . $ lemon/_writer_bits/MapLookUpConverter#`MapLookUpConverter<Value, Map>`(3496de05b827211c).(const Map& map) |
| 200 | : _mapcxx . . $ lemon/_writer_bits/MapLookUpConverter#_map.(map) {} |
| 201 | |
| 202 | stdcxx . . $ std/::stringcxx . . $ std/string# operatorcxx . . $ lemon/_writer_bits/MapLookUpConverter#`operator()`(23b83986b497e4d5).()(const Value& value) { |
| 203 | typename Map::const_iterator it = _mapcxx . . $ lemon/_writer_bits/MapLookUpConverter#_map..find(value); |
| 204 | if (it == _mapcxx . . $ lemon/_writer_bits/MapLookUpConverter#_map..end()) { |
| 205 | throw FormatErrorcxx . . $ lemon/FormatError#FormatError(aac1607cfe1c1740).("Item not found"); |
| 206 | } |
| 207 | return it->second; |
| 208 | } |
| 209 | }; |
| 210 | |
| 211 | template <typename Value, |
| 212 | typename Map1 = stdcxx . . $ std/::mapcxx . . $ std/map#<Value, stdcxx . . $ std/::stringcxx . . $ std/string#>, |
| 213 | typename Map2 = stdcxx . . $ std/::mapcxx . . $ std/map#<Value, stdcxx . . $ std/::stringcxx . . $ std/string#> > |
| 214 | struct DoubleMapLookUpConvertercxx . . $ lemon/_writer_bits/DoubleMapLookUpConverter# { |
| 215 | const Map1& _map1cxx . . $ lemon/_writer_bits/DoubleMapLookUpConverter#_map1.; |
| 216 | const Map2& _map2cxx . . $ lemon/_writer_bits/DoubleMapLookUpConverter#_map2.; |
| 217 | |
| 218 | DoubleMapLookUpConvertercxx . . $ lemon/_writer_bits/DoubleMapLookUpConverter#`DoubleMapLookUpConverter<Value, Map1, Map2>`(19c357cac5bd4ecc).(const Map1& map1, const Map2& map2) |
| 219 | : _map1cxx . . $ lemon/_writer_bits/DoubleMapLookUpConverter#_map1.(map1), _map2cxx . . $ lemon/_writer_bits/DoubleMapLookUpConverter#_map2.(map2) {} |
| 220 | |
| 221 | stdcxx . . $ std/::stringcxx . . $ std/string# operatorcxx . . $ lemon/_writer_bits/DoubleMapLookUpConverter#`operator()`(23b83986b497e4d5).()(const Value& value) { |
| 222 | typename Map1::const_iterator it1 = _map1cxx . . $ lemon/_writer_bits/DoubleMapLookUpConverter#_map1..find(value); |
| 223 | typename Map1::const_iterator it2 = _map2cxx . . $ lemon/_writer_bits/DoubleMapLookUpConverter#_map2..find(value); |
| 224 | if (it1 == _map1cxx . . $ lemon/_writer_bits/DoubleMapLookUpConverter#_map1..end()) { |
| 225 | if (it2 == _map2cxx . . $ lemon/_writer_bits/DoubleMapLookUpConverter#_map2..end()) { |
| 226 | throw FormatErrorcxx . . $ lemon/FormatError#FormatError(aac1607cfe1c1740).("Item not found"); |
| 227 | } else { |
| 228 | return it2->second; |
| 229 | } |
| 230 | } else { |
| 231 | if (it2 == _map2cxx . . $ lemon/_writer_bits/DoubleMapLookUpConverter#_map2..end()) { |
| 232 | return it1->second; |
| 233 | } else { |
| 234 | throw FormatErrorcxx . . $ lemon/FormatError#FormatError(aac1607cfe1c1740).("Item is ambigous"); |
| 235 | } |
| 236 | } |
| 237 | } |
| 238 | }; |
| 239 | |
| 240 | template <typename Graph> |
| 241 | struct GraphArcLookUpConvertercxx . . $ lemon/_writer_bits/GraphArcLookUpConverter# { |
| 242 | const Graph& _graphcxx . . $ lemon/_writer_bits/GraphArcLookUpConverter#_graph.; |
| 243 | const stdcxx . . $ std/::mapcxx . . $ std/map#<typename Graph::Edge, stdcxx . . $ std/::stringcxx . . $ std/string#>& _mapcxx . . $ lemon/_writer_bits/GraphArcLookUpConverter#_map.; |
| 244 | |
| 245 | GraphArcLookUpConvertercxx . . $ lemon/_writer_bits/GraphArcLookUpConverter#`GraphArcLookUpConverter<Graph>`(a55eba00adf0796e).(const Graph& graph, |
| 246 | const stdcxx . . $ std/::mapcxx . . $ std/map#<typename Graph::Edge, |
| 247 | stdcxx . . $ std/::stringcxx . . $ std/string#>& map) |
| 248 | : _graphcxx . . $ lemon/_writer_bits/GraphArcLookUpConverter#_graph.(graph), _mapcxx . . $ lemon/_writer_bits/GraphArcLookUpConverter#_map.(map) {} |
| 249 | |
| 250 | stdcxx . . $ std/::stringcxx . . $ std/string# operatorcxx . . $ lemon/_writer_bits/GraphArcLookUpConverter#`operator()`(937836f72541610e).()(const typename Graph::Arc& val) { |
| 251 | typename stdcxx . . $ std/::mapcxx . . $ std/map#<typename Graph::Edge, std::string> |
| 252 | ::const_iterator it = _mapcxx . . $ lemon/_writer_bits/GraphArcLookUpConverter#_map..findcxx . . $ std/map#find(7b3585bb5da8f7d).(val); |
| 253 | if (it == _mapcxx . . $ lemon/_writer_bits/GraphArcLookUpConverter#_map..endcxx . . $ std/map#end(b953fec338ad1a3b).()) { |
| 254 | throw FormatErrorcxx . . $ lemon/FormatError#FormatError(aac1607cfe1c1740).("Item not found"); |
| 255 | } |
| 256 | return (_graphcxx . . $ lemon/_writer_bits/GraphArcLookUpConverter#_graph..direction(val) ? '+' : '-') + it->second; |
| 257 | } |
| 258 | }; |
| 259 | |
| 260 | inline bool isWhiteSpacecxx . . $ lemon/_writer_bits/isWhiteSpace(b5fd09639b7a0261).(char c) { |
| 261 | return c == ' ' || c == '\t' || c == '\v' || |
| 262 | c == '\n' || c == '\r' || c == '\f'; |
| 263 | } |
| 264 | |
| 265 | inline bool isEscapedcxx . . $ lemon/_writer_bits/isEscaped(b5fd09639b7a0261).(char c) { |
| 266 | return c == '\\' || c == '\"' || c == '\'' || |
| 267 | c == '\a' || c == '\b'; |
| 268 | } |
| 269 | |
| 270 | inline static void writeEscapecxx . . $ lemon/_writer_bits/writeEscape(587b55fd76ddaf33).(stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& os, char c) { |
| 271 | switch (c) { |
| 272 | case '\\': |
| 273 | os <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\\\\"; |
| 274 | return; |
| 275 | case '\"': |
| 276 | os <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\\\""; |
| 277 | return; |
| 278 | case '\a': |
| 279 | os <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\\a"; |
| 280 | return; |
| 281 | case '\b': |
| 282 | os <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\\b"; |
| 283 | return; |
| 284 | case '\f': |
| 285 | os <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\\f"; |
| 286 | return; |
| 287 | case '\r': |
| 288 | os <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\\r"; |
| 289 | return; |
| 290 | case '\n': |
| 291 | os <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\\n"; |
| 292 | return; |
| 293 | case '\t': |
| 294 | os <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\\t"; |
| 295 | return; |
| 296 | case '\v': |
| 297 | os <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\\v"; |
| 298 | return; |
| 299 | default: |
| 300 | if (c < 0x20) { |
| 301 | stdcxx . . $ std/::ioscxx . . $ std/ios#::fmtflagscxx . . $ std/ios_base#fmtflags# flags = os.flagscxx . . $ std/ios_base#flags(ce39a176cc3dc355).(); |
| 302 | os <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). '\\' <<cxx . . $ std/basic_ostream#`operator<<`(d90e0e305b0e25c2). stdcxx . . $ std/::octcxx . . $ std/oct(cf36cc481190cd1f). <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). static_cast<int>(c); |
| 303 | os.flagscxx . . $ std/ios_base#flags(79f645757f7c3f1c).(flags); |
| 304 | } else { |
| 305 | os <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). c; |
| 306 | } |
| 307 | return; |
| 308 | } |
| 309 | } |
| 310 | |
| 311 | inline bool requireEscapecxx . . $ lemon/_writer_bits/requireEscape(7c222eea44a24d43).(const stdcxx . . $ std/::stringcxx . . $ std/string#& str) { |
| 312 | if (str.emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).() || str[cxx . . $ std/__cxx11/basic_string#`operator[]`(dd01cf3f78ddc127).0] == '@') return true; |
| 313 | stdcxx . . $ std/::istringstreamcxx . . $ std/istringstream# iscxx . . $ std/__cxx11/basic_istringstream#basic_istringstream(d3c8ea0e6521074c).(str); |
| 314 | char c; |
| 315 | while (is.getcxx . . $ std/basic_istream#get(7adacedb0a839d05).(c)) { |
| 316 | if (isWhiteSpacecxx . . $ lemon/_writer_bits/isWhiteSpace(b5fd09639b7a0261).(c) || isEscapedcxx . . $ lemon/_writer_bits/isEscaped(b5fd09639b7a0261).(c)) { |
| 317 | return true; |
| 318 | } |
| 319 | } |
| 320 | return false; |
| 321 | } |
| 322 | |
| 323 | inline stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& writeTokencxx . . $ lemon/_writer_bits/writeToken(b1020aba89db397c).(stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& os, const stdcxx . . $ std/::stringcxx . . $ std/string#& str) { |
| 324 | |
| 325 | if (requireEscapecxx . . $ lemon/_writer_bits/requireEscape(7c222eea44a24d43).(str)) { |
| 326 | os <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). '\"'; |
| 327 | for (stdcxx . . $ std/::stringcxx . . $ std/string#::const_iteratorcxx . . $ std/__cxx11/basic_string#const_iterator# it = str.begincxx . . $ std/__cxx11/basic_string#begin(a479f6ffbc603b2b).(); |
| 328 | it !=cxx . . $ __gnu_cxx/`operator!=`(30ee64f2df4eef8b). str.endcxx . . $ std/__cxx11/basic_string#end(a479f6ffbc603b2b).(); ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(1613faa01bc3d014).it) { |
| 329 | writeEscapecxx . . $ lemon/_writer_bits/writeEscape(587b55fd76ddaf33).(os, *cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(f9c37c6e427d43d6).it); |
| 330 | } |
| 331 | os <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). '\"'; |
| 332 | } else { |
| 333 | os <<cxx . . $ std/`operator<<`(88df5bef833f7f83). str; |
| 334 | } |
| 335 | return os; |
| 336 | } |
| 337 | |
| 338 | class Sectioncxx . . $ lemon/_writer_bits/Section# { |
| 339 | public: |
| 340 | virtual ~cxx . . $ lemon/_writer_bits/Section#`~Section`(ced63f7c635d850d).Sectioncxx . . $ lemon/_writer_bits/Section#() {} |
| 341 | virtual void processcxx . . $ lemon/_writer_bits/Section#process(f7f45734e6842120).(stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& os) = 0; |
| 342 | }; |
| 343 | |
| 344 | template <typename Functor> |
| 345 | class LineSectioncxx . . $ lemon/_writer_bits/LineSection# : public Sectioncxx . . $ lemon/_writer_bits/Section# { |
| 346 | private: |
| 347 | |
| 348 | Functor _functorcxx . . $ lemon/_writer_bits/LineSection#_functor.; |
| 349 | |
| 350 | public: |
| 351 | |
| 352 | LineSectioncxx . . $ lemon/_writer_bits/LineSection#`LineSection<Functor>`(77d9f17553126ecb).(const Functor& functor) : _functorcxx . . $ lemon/_writer_bits/LineSection#_functor.(functor) {} |
| 353 | virtual ~cxx . . $ lemon/_writer_bits/LineSection#`~LineSection<Functor>`(49f6e7a06ebc5aa8).LineSection() {} |
| 354 | |
| 355 | virtual void processcxx . . $ lemon/_writer_bits/LineSection#process(f7f45734e6842120).(stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& os) { |
| 356 | stdcxx . . $ std/::stringcxx . . $ std/string# linecxx . . $ std/__cxx11/basic_string#basic_string(925dcc5e17f50391).; |
| 357 | while (!(line = _functorcxx . . $ lemon/_writer_bits/LineSection#_functor.()).empty()) os <<cxx . . $ std/`operator<<`(88df5bef833f7f83). line <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 358 | } |
| 359 | }; |
| 360 | |
| 361 | template <typename Functor> |
| 362 | class StreamSectioncxx . . $ lemon/_writer_bits/StreamSection# : public Sectioncxx . . $ lemon/_writer_bits/Section# { |
| 363 | private: |
| 364 | |
| 365 | Functor _functorcxx . . $ lemon/_writer_bits/StreamSection#_functor.; |
| 366 | |
| 367 | public: |
| 368 | |
| 369 | StreamSectioncxx . . $ lemon/_writer_bits/StreamSection#`StreamSection<Functor>`(77d9f17553126ecb).(const Functor& functor) : _functorcxx . . $ lemon/_writer_bits/StreamSection#_functor.(functor) {} |
| 370 | virtual ~cxx . . $ lemon/_writer_bits/StreamSection#`~StreamSection<Functor>`(49f6e7a06ebc5aa8).StreamSection() {} |
| 371 | |
| 372 | virtual void processcxx . . $ lemon/_writer_bits/StreamSection#process(f7f45734e6842120).(stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& os) { |
| 373 | _functorcxx . . $ lemon/_writer_bits/StreamSection#_functor.(os); |
| 374 | } |
| 375 | }; |
| 376 | |
| 377 | } |
| 378 | |
| 379 | template <typename DGR> |
| 380 | class DigraphWritercxx . . $ lemon/DigraphWriter#; |
| 381 | |
| 382 | template <typename TDGR> |
| 383 | DigraphWritercxx . . $ lemon/DigraphWriter#<TDGR> digraphWritercxx . . $ lemon/digraphWriter(4bf528191b98dab5).(const TDGR& digraph, |
| 384 | stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& os = stdcxx . . $ std/::coutcxx . . $ std/cout.); |
| 385 | template <typename TDGR> |
| 386 | DigraphWritercxx . . $ lemon/DigraphWriter#<TDGR> digraphWritercxx . . $ lemon/digraphWriter(8f5f957600d73865).(const TDGR& digraph, const stdcxx . . $ std/::stringcxx . . $ std/string#& fn); |
| 387 | |
| 388 | template <typename TDGR> |
| 389 | DigraphWritercxx . . $ lemon/DigraphWriter#<TDGR> digraphWritercxx . . $ lemon/digraphWriter(8a17f6ba49ede916).(const TDGR& digraph, const char* fn); |
| 390 | |
| 391 | |
| 392 | /// \ingroup lemon_io |
| 393 | /// |
| 394 | /// \brief \ref lgf-format "LGF" writer for directed graphs |
| 395 | /// |
| 396 | /// This utility writes an \ref lgf-format "LGF" file. |
| 397 | /// |
| 398 | /// The writing method does a batch processing. The user creates a |
| 399 | /// writer object, then various writing rules can be added to the |
| 400 | /// writer, and eventually the writing is executed with the \c run() |
| 401 | /// member function. A map writing rule can be added to the writer |
| 402 | /// with the \c nodeMap() or \c arcMap() members. An optional |
| 403 | /// converter parameter can also be added as a standard functor |
| 404 | /// converting from the value type of the map to \c std::string. If it |
| 405 | /// is set, it will determine how the value type of the map is written to |
| 406 | /// the output stream. If the functor is not set, then a default |
| 407 | /// conversion will be used. The \c attribute(), \c node() and \c |
| 408 | /// arc() functions are used to add attribute writing rules. |
| 409 | /// |
| 410 | ///\code |
| 411 | /// DigraphWriter<DGR>(digraph, std::cout). |
| 412 | /// nodeMap("coordinates", coord_map). |
| 413 | /// nodeMap("size", size). |
| 414 | /// nodeMap("title", title). |
| 415 | /// arcMap("capacity", cap_map). |
| 416 | /// node("source", src). |
| 417 | /// node("target", trg). |
| 418 | /// attribute("caption", caption). |
| 419 | /// run(); |
| 420 | ///\endcode |
| 421 | /// |
| 422 | /// |
| 423 | /// By default, the writer does not write additional captions to the |
| 424 | /// sections, but they can be give as an optional parameter of |
| 425 | /// the \c nodes(), \c arcs() or \c |
| 426 | /// attributes() functions. |
| 427 | /// |
| 428 | /// The \c skipNodes() and \c skipArcs() functions forbid the |
| 429 | /// writing of the sections. If two arc sections should be written |
| 430 | /// to the output, it can be done in two passes, the first pass |
| 431 | /// writes the node section and the first arc section, then the |
| 432 | /// second pass skips the node section and writes just the arc |
| 433 | /// section to the stream. The output stream can be retrieved with |
| 434 | /// the \c ostream() function, hence the second pass can append its |
| 435 | /// output to the output of the first pass. |
| 436 | template <typename DGR> |
| 437 | class DigraphWritercxx . . $ lemon/DigraphWriter# { |
| 438 | public: |
| 439 | |
| 440 | typedef DGR Digraphcxx . . $ lemon/DigraphWriter#Digraph#; |
| 441 | TEMPLATE_DIGRAPH_TYPEDEFScxx . . $ lemon/DigraphWriter#ArcIt#(DGR); |
| 442 | |
| 443 | private: |
| 444 | |
| 445 | |
| 446 | stdcxx . . $ std/::ostreamcxx . . $ std/ostream#* _oscxx . . $ lemon/DigraphWriter#_os.; |
| 447 | bool local_oscxx . . $ lemon/DigraphWriter#local_os.; |
| 448 | |
| 449 | const DGR& _digraphcxx . . $ lemon/DigraphWriter#_digraph.; |
| 450 | |
| 451 | stdcxx . . $ std/::stringcxx . . $ std/string# _nodes_captioncxx . . $ lemon/DigraphWriter#_nodes_caption.; |
| 452 | stdcxx . . $ std/::stringcxx . . $ std/string# _arcs_captioncxx . . $ lemon/DigraphWriter#_arcs_caption.; |
| 453 | stdcxx . . $ std/::stringcxx . . $ std/string# _attributes_captioncxx . . $ lemon/DigraphWriter#_attributes_caption.; |
| 454 | |
| 455 | typedef stdcxx . . $ std/::mapcxx . . $ std/map#<Nodecxx . . $ lemon/DigraphWriter#Node#, stdcxx . . $ std/::stringcxx . . $ std/string#> NodeIndexcxx . . $ lemon/DigraphWriter#NodeIndex#; |
| 456 | NodeIndexcxx . . $ lemon/DigraphWriter#NodeIndex# _node_indexcxx . . $ lemon/DigraphWriter#_node_index.; |
| 457 | typedef stdcxx . . $ std/::mapcxx . . $ std/map#<Arccxx . . $ lemon/DigraphWriter#Arc#, stdcxx . . $ std/::stringcxx . . $ std/string#> ArcIndexcxx . . $ lemon/DigraphWriter#ArcIndex#; |
| 458 | ArcIndexcxx . . $ lemon/DigraphWriter#ArcIndex# _arc_indexcxx . . $ lemon/DigraphWriter#_arc_index.; |
| 459 | |
| 460 | typedef stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::paircxx . . $ std/pair#<stdcxx . . $ std/::stringcxx . . $ std/string#, |
| 461 | _writer_bitscxx . . $ lemon/_writer_bits/::MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<Nodecxx . . $ lemon/DigraphWriter#Node#>* > > NodeMapscxx . . $ lemon/DigraphWriter#NodeMaps#; |
| 462 | NodeMapscxx . . $ lemon/DigraphWriter#NodeMaps# _node_mapscxx . . $ lemon/DigraphWriter#_node_maps.; |
| 463 | |
| 464 | typedef stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::paircxx . . $ std/pair#<stdcxx . . $ std/::stringcxx . . $ std/string#, |
| 465 | _writer_bitscxx . . $ lemon/_writer_bits/::MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<Arccxx . . $ lemon/DigraphWriter#Arc#>* > >ArcMapscxx . . $ lemon/DigraphWriter#ArcMaps#; |
| 466 | ArcMapscxx . . $ lemon/DigraphWriter#ArcMaps# _arc_mapscxx . . $ lemon/DigraphWriter#_arc_maps.; |
| 467 | |
| 468 | typedef stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::paircxx . . $ std/pair#<stdcxx . . $ std/::stringcxx . . $ std/string#, |
| 469 | _writer_bitscxx . . $ lemon/_writer_bits/::ValueStorageBasecxx . . $ lemon/_writer_bits/ValueStorageBase#*> > Attributescxx . . $ lemon/DigraphWriter#Attributes#; |
| 470 | Attributescxx . . $ lemon/DigraphWriter#Attributes# _attributescxx . . $ lemon/DigraphWriter#_attributes.; |
| 471 | |
| 472 | bool _skip_nodescxx . . $ lemon/DigraphWriter#_skip_nodes.; |
| 473 | bool _skip_arcscxx . . $ lemon/DigraphWriter#_skip_arcs.; |
| 474 | |
| 475 | public: |
| 476 | |
| 477 | /// \brief Constructor |
| 478 | /// |
| 479 | /// Construct a directed graph writer, which writes to the given |
| 480 | /// output stream. |
| 481 | DigraphWritercxx . . $ lemon/DigraphWriter#`DigraphWriter<DGR>`(cd5921fea08118f1).(const DGR& digraph, stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& os = stdcxx . . $ std/::coutcxx . . $ std/cout.) |
| 482 | : _oscxx . . $ lemon/DigraphWriter#_os.(&os), local_oscxx . . $ lemon/DigraphWriter#local_os.(false), _digraphcxx . . $ lemon/DigraphWriter#_digraph.(digraph), |
| 483 | _skip_nodescxx . . $ lemon/DigraphWriter#_skip_nodes.(false), _skip_arcscxx . . $ lemon/DigraphWriter#_skip_arcs.(false) {} |
| 484 | |
| 485 | /// \brief Constructor |
| 486 | /// |
| 487 | /// Construct a directed graph writer, which writes to the given |
| 488 | /// output file. |
| 489 | DigraphWritercxx . . $ lemon/DigraphWriter#`DigraphWriter<DGR>`(a303ec4ca7cd6081).(const DGR& digraph, const stdcxx . . $ std/::stringcxx . . $ std/string#& fn) |
| 490 | : _oscxx . . $ lemon/DigraphWriter#_os.(new stdcxx . . $ std/::ofstreamcxx . . $ std/ofstream#(fn.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).())), local_oscxx . . $ lemon/DigraphWriter#local_os.(true), _digraphcxx . . $ lemon/DigraphWriter#_digraph.(digraph), |
| 491 | _skip_nodescxx . . $ lemon/DigraphWriter#_skip_nodes.(false), _skip_arcscxx . . $ lemon/DigraphWriter#_skip_arcs.(false) { |
| 492 | if (!cxx . . $ std/basic_ios#`operator!`(50ce9a9e25b4a850).(*_oscxx . . $ lemon/DigraphWriter#_os.)) { |
| 493 | delete _oscxx . . $ lemon/DigraphWriter#_os.; |
| 494 | throw IoErrorcxx . . $ lemon/IoError#("Cannot write file", fn); |
| 495 | } |
| 496 | } |
| 497 | |
| 498 | /// \brief Constructor |
| 499 | /// |
| 500 | /// Construct a directed graph writer, which writes to the given |
| 501 | /// output file. |
| 502 | DigraphWritercxx . . $ lemon/DigraphWriter#`DigraphWriter<DGR>`(4e234f26c19d7452).(const DGR& digraph, const char* fn) |
| 503 | : _oscxx . . $ lemon/DigraphWriter#_os.(new stdcxx . . $ std/::ofstreamcxx . . $ std/ofstream#(fn)), local_oscxx . . $ lemon/DigraphWriter#local_os.(true), _digraphcxx . . $ lemon/DigraphWriter#_digraph.(digraph), |
| 504 | _skip_nodescxx . . $ lemon/DigraphWriter#_skip_nodes.(false), _skip_arcscxx . . $ lemon/DigraphWriter#_skip_arcs.(false) { |
| 505 | if (!cxx . . $ std/basic_ios#`operator!`(50ce9a9e25b4a850).(*_oscxx . . $ lemon/DigraphWriter#_os.)) { |
| 506 | delete _oscxx . . $ lemon/DigraphWriter#_os.; |
| 507 | throw IoErrorcxx . . $ lemon/IoError#IoError(6521af5f82091f78).("Cannot write file", fncxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).); |
| 508 | } |
| 509 | } |
| 510 | |
| 511 | /// \brief Destructor |
| 512 | ~cxx . . $ lemon/DigraphWriter#`~DigraphWriter<DGR>`(49f6e7a06ebc5aa8).DigraphWriter() { |
| 513 | for (typename NodeMapscxx . . $ lemon/DigraphWriter#NodeMaps#::iterator it = _node_mapscxx . . $ lemon/DigraphWriter#_node_maps..begincxx . . $ std/vector#begin(55a6de06420d4903).(); |
| 514 | it != _node_mapscxx . . $ lemon/DigraphWriter#_node_maps..endcxx . . $ std/vector#end(55a6de06420d4903).(); ++it) { |
| 515 | delete it->second; |
| 516 | } |
| 517 | |
| 518 | for (typename ArcMapscxx . . $ lemon/DigraphWriter#ArcMaps#::iterator it = _arc_mapscxx . . $ lemon/DigraphWriter#_arc_maps..begincxx . . $ std/vector#begin(55a6de06420d4903).(); |
| 519 | it != _arc_mapscxx . . $ lemon/DigraphWriter#_arc_maps..endcxx . . $ std/vector#end(55a6de06420d4903).(); ++it) { |
| 520 | delete it->second; |
| 521 | } |
| 522 | |
| 523 | for (typename Attributescxx . . $ lemon/DigraphWriter#Attributes#::iteratorcxx . . $ std/vector#iterator# it = _attributescxx . . $ lemon/DigraphWriter#_attributes..begincxx . . $ std/vector#begin(55a6de06420d4903).(); |
| 524 | it !=cxx . . $ __gnu_cxx/`operator!=`(30ee64f2df4eef8b). _attributescxx . . $ lemon/DigraphWriter#_attributes..endcxx . . $ std/vector#end(55a6de06420d4903).(); ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(1613faa01bc3d014).it) { |
| 525 | delete it->cxx . . $ __gnu_cxx/__normal_iterator#`operator->`(65c2ec7035a77d3e).secondcxx . . $ std/pair#second.; |
| 526 | } |
| 527 | |
| 528 | if (local_oscxx . . $ lemon/DigraphWriter#local_os.) { |
| 529 | delete _oscxx . . $ lemon/DigraphWriter#_os.; |
| 530 | } |
| 531 | } |
| 532 | |
| 533 | private: |
| 534 | |
| 535 | template <typename TDGR> |
| 536 | friend DigraphWritercxx . . $ lemon/DigraphWriter#<TDGR> digraphWritercxx . . $ lemon/digraphWriter(65e6018e9b915a48).(const TDGR& digraph, |
| 537 | stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& os); |
| 538 | template <typename TDGR> |
| 539 | friend DigraphWritercxx . . $ lemon/DigraphWriter#<TDGR> digraphWritercxx . . $ lemon/digraphWriter(961a8468c03a7099).(const TDGR& digraph, |
| 540 | const stdcxx . . $ std/::stringcxx . . $ std/string#& fn); |
| 541 | template <typename TDGR> |
| 542 | friend DigraphWritercxx . . $ lemon/DigraphWriter#<TDGR> digraphWritercxx . . $ lemon/digraphWriter(3e693c2b423f27d0).(const TDGR& digraph, |
| 543 | const char *fn); |
| 544 | |
| 545 | DigraphWritercxx . . $ lemon/DigraphWriter#`DigraphWriter<DGR>`(60ead15a05850e).(DigraphWriter& other) |
| 546 | : _oscxx . . $ lemon/DigraphWriter#_os.(other._oscxx . . $ lemon/DigraphWriter#_os.), local_oscxx . . $ lemon/DigraphWriter#local_os.(other.local_oscxx . . $ lemon/DigraphWriter#local_os.), _digraphcxx . . $ lemon/DigraphWriter#_digraph.(other._digraphcxx . . $ lemon/DigraphWriter#_digraph.), |
| 547 | _skip_nodescxx . . $ lemon/DigraphWriter#_skip_nodes.(other._skip_nodescxx . . $ lemon/DigraphWriter#_skip_nodes.), _skip_arcscxx . . $ lemon/DigraphWriter#_skip_arcs.(other._skip_arcscxx . . $ lemon/DigraphWriter#_skip_arcs.) { |
| 548 | |
| 549 | other._oscxx . . $ lemon/DigraphWriter#_os. = 0; |
| 550 | other.local_oscxx . . $ lemon/DigraphWriter#local_os. = false; |
| 551 | |
| 552 | _node_indexcxx . . $ lemon/DigraphWriter#_node_index..swapcxx . . $ std/map#swap(6db4dfdbe2a5e125).(other._node_indexcxx . . $ lemon/DigraphWriter#_node_index.); |
| 553 | _arc_indexcxx . . $ lemon/DigraphWriter#_arc_index..swapcxx . . $ std/map#swap(6db4dfdbe2a5e125).(other._arc_indexcxx . . $ lemon/DigraphWriter#_arc_index.); |
| 554 | |
| 555 | _node_mapscxx . . $ lemon/DigraphWriter#_node_maps..swapcxx . . $ std/vector#swap(319777021b21d7dd).(other._node_mapscxx . . $ lemon/DigraphWriter#_node_maps.); |
| 556 | _arc_mapscxx . . $ lemon/DigraphWriter#_arc_maps..swapcxx . . $ std/vector#swap(319777021b21d7dd).(other._arc_mapscxx . . $ lemon/DigraphWriter#_arc_maps.); |
| 557 | _attributescxx . . $ lemon/DigraphWriter#_attributes..swapcxx . . $ std/vector#swap(319777021b21d7dd).(other._attributescxx . . $ lemon/DigraphWriter#_attributes.); |
| 558 | |
| 559 | _nodes_captioncxx . . $ lemon/DigraphWriter#_nodes_caption. =cxx . . $ std/__cxx11/basic_string#`operator=`(c0b47be1fddc0e75). other._nodes_captioncxx . . $ lemon/DigraphWriter#_nodes_caption.; |
| 560 | _arcs_captioncxx . . $ lemon/DigraphWriter#_arcs_caption. =cxx . . $ std/__cxx11/basic_string#`operator=`(c0b47be1fddc0e75). other._arcs_captioncxx . . $ lemon/DigraphWriter#_arcs_caption.; |
| 561 | _attributes_captioncxx . . $ lemon/DigraphWriter#_attributes_caption. =cxx . . $ std/__cxx11/basic_string#`operator=`(c0b47be1fddc0e75). other._attributes_captioncxx . . $ lemon/DigraphWriter#_attributes_caption.; |
| 562 | } |
| 563 | |
| 564 | DigraphWriter& operatorcxx . . $ lemon/DigraphWriter#`operator=`(e5b1e7d9f9500bf4).=(const DigraphWriter&); |
| 565 | |
| 566 | public: |
| 567 | |
| 568 | /// \name Writing Rules |
| 569 | /// @{ |
| 570 | |
| 571 | /// \brief Node map writing rule |
| 572 | /// |
| 573 | /// Add a node map writing rule to the writer. |
| 574 | template <typename Map> |
| 575 | DigraphWriter& nodeMapcxx . . $ lemon/DigraphWriter#nodeMap(2a7f7bd1be47a8c5).(const stdcxx . . $ std/::stringcxx . . $ std/string#& caption, const Map& map) { |
| 576 | checkConceptcxx . . $ lemon/checkConcept(49f6e7a06ebc5aa8).<conceptscxx . . $ lemon/concepts/::ReadMapcxx . . $ lemon/concepts/ReadMap#<Nodecxx . . $ lemon/DigraphWriter#Node#, typename Map::Value>, Map>(); |
| 577 | _writer_bitscxx . . $ lemon/_writer_bits/::MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<Nodecxx . . $ lemon/DigraphWriter#Node#>* storage = |
| 578 | new _writer_bitscxx . . $ lemon/_writer_bits/::MapStoragecxx . . $ lemon/_writer_bits/MapStorage#<Nodecxx . . $ lemon/DigraphWriter#Node#, Map>(map); |
| 579 | _node_mapscxx . . $ lemon/DigraphWriter#_node_maps..push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(caption, storage)); |
| 580 | return *this; |
| 581 | } |
| 582 | |
| 583 | /// \brief Node map writing rule |
| 584 | /// |
| 585 | /// Add a node map writing rule with specialized converter to the |
| 586 | /// writer. |
| 587 | template <typename Map, typename Converter> |
| 588 | DigraphWriter& nodeMapcxx . . $ lemon/DigraphWriter#nodeMap(9aaf6aaca4534406).(const stdcxx . . $ std/::stringcxx . . $ std/string#& caption, const Map& map, |
| 589 | const Converter& converter = Converter()) { |
| 590 | checkConceptcxx . . $ lemon/checkConcept(49f6e7a06ebc5aa8).<conceptscxx . . $ lemon/concepts/::ReadMapcxx . . $ lemon/concepts/ReadMap#<Nodecxx . . $ lemon/DigraphWriter#Node#, typename Map::Value>, Map>(); |
| 591 | _writer_bitscxx . . $ lemon/_writer_bits/::MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<Nodecxx . . $ lemon/DigraphWriter#Node#>* storage = |
| 592 | new _writer_bitscxx . . $ lemon/_writer_bits/::MapStoragecxx . . $ lemon/_writer_bits/MapStorage#<Nodecxx . . $ lemon/DigraphWriter#Node#, Map, Converter>(map, converter); |
| 593 | _node_mapscxx . . $ lemon/DigraphWriter#_node_maps..push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(caption, storage)); |
| 594 | return *this; |
| 595 | } |
| 596 | |
| 597 | /// \brief Arc map writing rule |
| 598 | /// |
| 599 | /// Add an arc map writing rule to the writer. |
| 600 | template <typename Map> |
| 601 | DigraphWriter& arcMapcxx . . $ lemon/DigraphWriter#arcMap(2a7f7bd1be47a8c5).(const stdcxx . . $ std/::stringcxx . . $ std/string#& caption, const Map& map) { |
| 602 | checkConceptcxx . . $ lemon/checkConcept(49f6e7a06ebc5aa8).<conceptscxx . . $ lemon/concepts/::ReadMapcxx . . $ lemon/concepts/ReadMap#<Arccxx . . $ lemon/DigraphWriter#Arc#, typename Map::Value>, Map>(); |
| 603 | _writer_bitscxx . . $ lemon/_writer_bits/::MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<Arccxx . . $ lemon/DigraphWriter#Arc#>* storage = |
| 604 | new _writer_bitscxx . . $ lemon/_writer_bits/::MapStoragecxx . . $ lemon/_writer_bits/MapStorage#<Arccxx . . $ lemon/DigraphWriter#Arc#, Map>(map); |
| 605 | _arc_mapscxx . . $ lemon/DigraphWriter#_arc_maps..push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(caption, storage)); |
| 606 | return *this; |
| 607 | } |
| 608 | |
| 609 | /// \brief Arc map writing rule |
| 610 | /// |
| 611 | /// Add an arc map writing rule with specialized converter to the |
| 612 | /// writer. |
| 613 | template <typename Map, typename Converter> |
| 614 | DigraphWriter& arcMapcxx . . $ lemon/DigraphWriter#arcMap(9aaf6aaca4534406).(const stdcxx . . $ std/::stringcxx . . $ std/string#& caption, const Map& map, |
| 615 | const Converter& converter = Converter()) { |
| 616 | checkConceptcxx . . $ lemon/checkConcept(49f6e7a06ebc5aa8).<conceptscxx . . $ lemon/concepts/::ReadMapcxx . . $ lemon/concepts/ReadMap#<Arccxx . . $ lemon/DigraphWriter#Arc#, typename Map::Value>, Map>(); |
| 617 | _writer_bitscxx . . $ lemon/_writer_bits/::MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<Arccxx . . $ lemon/DigraphWriter#Arc#>* storage = |
| 618 | new _writer_bitscxx . . $ lemon/_writer_bits/::MapStoragecxx . . $ lemon/_writer_bits/MapStorage#<Arccxx . . $ lemon/DigraphWriter#Arc#, Map, Converter>(map, converter); |
| 619 | _arc_mapscxx . . $ lemon/DigraphWriter#_arc_maps..push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(caption, storage)); |
| 620 | return *this; |
| 621 | } |
| 622 | |
| 623 | /// \brief Attribute writing rule |
| 624 | /// |
| 625 | /// Add an attribute writing rule to the writer. |
| 626 | template <typename Value> |
| 627 | DigraphWriter& attributecxx . . $ lemon/DigraphWriter#attribute(2a7f7bd1be47a8c5).(const stdcxx . . $ std/::stringcxx . . $ std/string#& caption, const Value& value) { |
| 628 | _writer_bitscxx . . $ lemon/_writer_bits/::ValueStorageBasecxx . . $ lemon/_writer_bits/ValueStorageBase#* storage = |
| 629 | new _writer_bitscxx . . $ lemon/_writer_bits/::ValueStoragecxx . . $ lemon/_writer_bits/ValueStorage#<Value>(value); |
| 630 | _attributescxx . . $ lemon/DigraphWriter#_attributes..push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(caption, storage)); |
| 631 | return *this; |
| 632 | } |
| 633 | |
| 634 | /// \brief Attribute writing rule |
| 635 | /// |
| 636 | /// Add an attribute writing rule with specialized converter to the |
| 637 | /// writer. |
| 638 | template <typename Value, typename Converter> |
| 639 | DigraphWriter& attributecxx . . $ lemon/DigraphWriter#attribute(9aaf6aaca4534406).(const stdcxx . . $ std/::stringcxx . . $ std/string#& caption, const Value& value, |
| 640 | const Converter& converter = Converter()) { |
| 641 | _writer_bitscxx . . $ lemon/_writer_bits/::ValueStorageBasecxx . . $ lemon/_writer_bits/ValueStorageBase#* storage = |
| 642 | new _writer_bitscxx . . $ lemon/_writer_bits/::ValueStoragecxx . . $ lemon/_writer_bits/ValueStorage#<Value, Converter>(value, converter); |
| 643 | _attributescxx . . $ lemon/DigraphWriter#_attributes..push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(caption, storage)); |
| 644 | return *this; |
| 645 | } |
| 646 | |
| 647 | /// \brief Node writing rule |
| 648 | /// |
| 649 | /// Add a node writing rule to the writer. |
| 650 | DigraphWriter& nodecxx . . $ lemon/DigraphWriter#node(705405f022c2e438).(const stdcxx . . $ std/::stringcxx . . $ std/string#& caption, const Nodecxx . . $ lemon/DigraphWriter#Node#& node) { |
| 651 | typedef _writer_bitscxx . . $ lemon/_writer_bits/::MapLookUpConvertercxx . . $ lemon/_writer_bits/MapLookUpConverter#<Nodecxx . . $ lemon/DigraphWriter#Node#> Convertercxx . . $ lemon/DigraphWriter#node(705405f022c2e438).Converter#; |
| 652 | Convertercxx . . $ lemon/DigraphWriter#node(705405f022c2e438).Converter# converter(_node_indexcxx . . $ lemon/DigraphWriter#_node_index.); |
| 653 | _writer_bitscxx . . $ lemon/_writer_bits/::ValueStorageBasecxx . . $ lemon/_writer_bits/ValueStorageBase#* storage = |
| 654 | new _writer_bitscxx . . $ lemon/_writer_bits/::ValueStoragecxx . . $ lemon/_writer_bits/ValueStorage#<Nodecxx . . $ lemon/DigraphWriter#Node#, Convertercxx . . $ lemon/DigraphWriter#node(705405f022c2e438).Converter#>(node, converter); |
| 655 | _attributescxx . . $ lemon/DigraphWriter#_attributes..push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(caption, storage)); |
| 656 | return *this; |
| 657 | } |
| 658 | |
| 659 | /// \brief Arc writing rule |
| 660 | /// |
| 661 | /// Add an arc writing rule to writer. |
| 662 | DigraphWriter& arccxx . . $ lemon/DigraphWriter#arc(b75bf79038e7f3e6).(const stdcxx . . $ std/::stringcxx . . $ std/string#& caption, const Arccxx . . $ lemon/DigraphWriter#Arc#& arc) { |
| 663 | typedef _writer_bitscxx . . $ lemon/_writer_bits/::MapLookUpConvertercxx . . $ lemon/_writer_bits/MapLookUpConverter#<Arccxx . . $ lemon/DigraphWriter#Arc#> Convertercxx . . $ lemon/DigraphWriter#arc(b75bf79038e7f3e6).Converter#; |
| 664 | Convertercxx . . $ lemon/DigraphWriter#arc(b75bf79038e7f3e6).Converter# converter(_arc_indexcxx . . $ lemon/DigraphWriter#_arc_index.); |
| 665 | _writer_bitscxx . . $ lemon/_writer_bits/::ValueStorageBasecxx . . $ lemon/_writer_bits/ValueStorageBase#* storage = |
| 666 | new _writer_bitscxx . . $ lemon/_writer_bits/::ValueStoragecxx . . $ lemon/_writer_bits/ValueStorage#<Arccxx . . $ lemon/DigraphWriter#Arc#, Convertercxx . . $ lemon/DigraphWriter#arc(b75bf79038e7f3e6).Converter#>(arc, converter); |
| 667 | _attributescxx . . $ lemon/DigraphWriter#_attributes..push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(caption, storage)); |
| 668 | return *this; |
| 669 | } |
| 670 | |
| 671 | /// \name Section Captions |
| 672 | /// @{ |
| 673 | |
| 674 | /// \brief Add an additional caption to the \c \@nodes section |
| 675 | /// |
| 676 | /// Add an additional caption to the \c \@nodes section. |
| 677 | DigraphWriter& nodescxx . . $ lemon/DigraphWriter#nodes(ecef84e34a6d8d29).(const stdcxx . . $ std/::stringcxx . . $ std/string#& caption) { |
| 678 | _nodes_captioncxx . . $ lemon/DigraphWriter#_nodes_caption. =cxx . . $ std/__cxx11/basic_string#`operator=`(c0b47be1fddc0e75). caption; |
| 679 | return *this; |
| 680 | } |
| 681 | |
| 682 | /// \brief Add an additional caption to the \c \@arcs section |
| 683 | /// |
| 684 | /// Add an additional caption to the \c \@arcs section. |
| 685 | DigraphWriter& arcscxx . . $ lemon/DigraphWriter#arcs(ecef84e34a6d8d29).(const stdcxx . . $ std/::stringcxx . . $ std/string#& caption) { |
| 686 | _arcs_captioncxx . . $ lemon/DigraphWriter#_arcs_caption. =cxx . . $ std/__cxx11/basic_string#`operator=`(c0b47be1fddc0e75). caption; |
| 687 | return *this; |
| 688 | } |
| 689 | |
| 690 | /// \brief Add an additional caption to the \c \@attributes section |
| 691 | /// |
| 692 | /// Add an additional caption to the \c \@attributes section. |
| 693 | DigraphWriter& attributescxx . . $ lemon/DigraphWriter#attributes(ecef84e34a6d8d29).(const stdcxx . . $ std/::stringcxx . . $ std/string#& caption) { |
| 694 | _attributes_captioncxx . . $ lemon/DigraphWriter#_attributes_caption. =cxx . . $ std/__cxx11/basic_string#`operator=`(c0b47be1fddc0e75). caption; |
| 695 | return *this; |
| 696 | } |
| 697 | |
| 698 | /// \name Skipping Section |
| 699 | /// @{ |
| 700 | |
| 701 | /// \brief Skip writing the node set |
| 702 | /// |
| 703 | /// The \c \@nodes section will not be written to the stream. |
| 704 | DigraphWriter& skipNodescxx . . $ lemon/DigraphWriter#skipNodes(13753e47467f3ada).() { |
| 705 | LEMON_ASSERTcxx . . $ `lemon/assert.h:193:13`!(!_skip_nodes, "Multiple usage of skipNodes() member"); |
| 706 | _skip_nodescxx . . $ lemon/DigraphWriter#_skip_nodes. = true; |
| 707 | return *this; |
| 708 | } |
| 709 | |
| 710 | /// \brief Skip writing arc set |
| 711 | /// |
| 712 | /// The \c \@arcs section will not be written to the stream. |
| 713 | DigraphWriter& skipArcscxx . . $ lemon/DigraphWriter#skipArcs(13753e47467f3ada).() { |
| 714 | LEMON_ASSERTcxx . . $ `lemon/assert.h:193:13`!(!_skip_arcs, "Multiple usage of skipArcs() member"); |
| 715 | _skip_arcscxx . . $ lemon/DigraphWriter#_skip_arcs. = true; |
| 716 | return *this; |
| 717 | } |
| 718 | |
| 719 | /// @} |
| 720 | |
| 721 | private: |
| 722 | |
| 723 | void writeNodescxx . . $ lemon/DigraphWriter#writeNodes(49f6e7a06ebc5aa8).() { |
| 724 | _writer_bitscxx . . $ lemon/_writer_bits/::MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<Nodecxx . . $ lemon/DigraphWriter#Node#>* label = 0; |
| 725 | for (typename NodeMapscxx . . $ lemon/DigraphWriter#NodeMaps#::iterator it = _node_mapscxx . . $ lemon/DigraphWriter#_node_maps..begincxx . . $ std/vector#begin(55a6de06420d4903).(); |
| 726 | it != _node_mapscxx . . $ lemon/DigraphWriter#_node_maps..endcxx . . $ std/vector#end(d1e1699016b9d7e6).(); ++it) { |
| 727 | if (it->first == "label") { |
| 728 | label = it->second; |
| 729 | break; |
| 730 | } |
| 731 | } |
| 732 | |
| 733 | *_oscxx . . $ lemon/DigraphWriter#_os. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "@nodes"; |
| 734 | if (!_nodes_captioncxx . . $ lemon/DigraphWriter#_nodes_caption..emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).()) { |
| 735 | _writer_bitscxx . . $ lemon/_writer_bits/::writeTokencxx . . $ lemon/_writer_bits/writeToken(b1020aba89db397c).(*_oscxx . . $ lemon/DigraphWriter#_os. <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). ' ', _nodes_captioncxx . . $ lemon/DigraphWriter#_nodes_caption.); |
| 736 | } |
| 737 | *_oscxx . . $ lemon/DigraphWriter#_os. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 738 | |
| 739 | if (label == 0) { |
| 740 | *_oscxx . . $ lemon/DigraphWriter#_os. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "label" <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). '\t'; |
| 741 | } |
| 742 | for (typename NodeMapscxx . . $ lemon/DigraphWriter#NodeMaps#::iterator it = _node_mapscxx . . $ lemon/DigraphWriter#_node_maps..begincxx . . $ std/vector#begin(55a6de06420d4903).(); |
| 743 | it != _node_mapscxx . . $ lemon/DigraphWriter#_node_maps..endcxx . . $ std/vector#end(d1e1699016b9d7e6).(); ++it) { |
| 744 | _writer_bitscxx . . $ lemon/_writer_bits/::writeTokencxx . . $ lemon/_writer_bits/writeToken(b1020aba89db397c).(*_oscxx . . $ lemon/DigraphWriter#_os., it->first) << '\t'; |
| 745 | } |
| 746 | *_oscxx . . $ lemon/DigraphWriter#_os. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 747 | |
| 748 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<Nodecxx . . $ lemon/DigraphWriter#Node#> nodes; |
| 749 | for (NodeItcxx . . $ lemon/DigraphWriter#NodeIt# n(_digraphcxx . . $ lemon/DigraphWriter#_digraph.); n != INVALIDcxx . . $ lemon/INVALID.; ++n) { |
| 750 | nodes.push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(n); |
| 751 | } |
| 752 | |
| 753 | if (label == 0) { |
| 754 | IdMapcxx . . $ lemon/IdMap#<DGR, Nodecxx . . $ lemon/DigraphWriter#Node#> id_map(_digraphcxx . . $ lemon/DigraphWriter#_digraph.); |
| 755 | _writer_bitscxx . . $ lemon/_writer_bits/::MapLesscxx . . $ lemon/_writer_bits/MapLess#<IdMapcxx . . $ lemon/IdMap#<DGR, Nodecxx . . $ lemon/DigraphWriter#Node#> > id_less(id_map); |
| 756 | stdcxx . . $ std/::sortcxx . . $ std/sort(360855cc766c4ee5).(nodes.begincxx . . $ std/vector#begin(55a6de06420d4903).(), nodes.endcxx . . $ std/vector#end(d1e1699016b9d7e6).(), id_less); |
| 757 | } else { |
| 758 | label->sortcxx . . $ lemon/_writer_bits/MapStorageBase#sort(efb54ab086463856).(nodes); |
| 759 | } |
| 760 | |
| 761 | for (int i = 0; i < static_cast<int>(nodes.sizecxx . . $ std/vector#size(c9b1e749b64d5edc).()); ++i) { |
| 762 | Nodecxx . . $ lemon/DigraphWriter#Node# n = nodes[i]; |
| 763 | if (label == 0) { |
| 764 | stdcxx . . $ std/::ostringstreamcxx . . $ std/ostringstream# oscxx . . $ std/__cxx11/basic_ostringstream#basic_ostringstream(49f6e7a06ebc5aa8).; |
| 765 | os << _digraphcxx . . $ lemon/DigraphWriter#_digraph..id(n); |
| 766 | _writer_bitscxx . . $ lemon/_writer_bits/::writeTokencxx . . $ lemon/_writer_bits/writeToken(b1020aba89db397c).(*_oscxx . . $ lemon/DigraphWriter#_os., os.strcxx . . $ std/__cxx11/basic_ostringstream#str(d33e1a6fd36255f7).()); |
| 767 | *_oscxx . . $ lemon/DigraphWriter#_os. <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). '\t'; |
| 768 | _node_indexcxx . . $ lemon/DigraphWriter#_node_index..insertcxx . . $ std/map#insert(9687e834fb3b5899).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(n, os.strcxx . . $ std/__cxx11/basic_ostringstream#str(d33e1a6fd36255f7).())); |
| 769 | } |
| 770 | for (typename NodeMapscxx . . $ lemon/DigraphWriter#NodeMaps#::iterator it = _node_mapscxx . . $ lemon/DigraphWriter#_node_maps..begincxx . . $ std/vector#begin(d1e1699016b9d7e6).(); |
| 771 | it != _node_mapscxx . . $ lemon/DigraphWriter#_node_maps..endcxx . . $ std/vector#end(d1e1699016b9d7e6).(); ++it) { |
| 772 | stdcxx . . $ std/::stringcxx . . $ std/string# value = it->second->get(n); |
| 773 | _writer_bitscxx . . $ lemon/_writer_bits/::writeTokencxx . . $ lemon/_writer_bits/writeToken(b1020aba89db397c).(*_oscxx . . $ lemon/DigraphWriter#_os., value); |
| 774 | if (it->first == "label") { |
| 775 | _node_indexcxx . . $ lemon/DigraphWriter#_node_index..insertcxx . . $ std/map#insert(50ef72ff69bc573d).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(n, value)); |
| 776 | } |
| 777 | *_oscxx . . $ lemon/DigraphWriter#_os. <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). '\t'; |
| 778 | } |
| 779 | *_oscxx . . $ lemon/DigraphWriter#_os. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 780 | } |
| 781 | } |
| 782 | |
| 783 | void createNodeIndexcxx . . $ lemon/DigraphWriter#createNodeIndex(49f6e7a06ebc5aa8).() { |
| 784 | _writer_bitscxx . . $ lemon/_writer_bits/::MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<Nodecxx . . $ lemon/DigraphWriter#Node#>* label = 0; |
| 785 | for (typename NodeMapscxx . . $ lemon/DigraphWriter#NodeMaps#::iterator it = _node_mapscxx . . $ lemon/DigraphWriter#_node_maps..begincxx . . $ std/vector#begin(d1e1699016b9d7e6).(); |
| 786 | it != _node_mapscxx . . $ lemon/DigraphWriter#_node_maps..endcxx . . $ std/vector#end(d1e1699016b9d7e6).(); ++it) { |
| 787 | if (it->first == "label") { |
| 788 | label = it->second; |
| 789 | break; |
| 790 | } |
| 791 | } |
| 792 | |
| 793 | if (label == 0) { |
| 794 | for (NodeItcxx . . $ lemon/DigraphWriter#NodeIt# n(_digraphcxx . . $ lemon/DigraphWriter#_digraph.); n != INVALIDcxx . . $ lemon/INVALID.; ++n) { |
| 795 | stdcxx . . $ std/::ostringstreamcxx . . $ std/ostringstream# oscxx . . $ std/__cxx11/basic_ostringstream#basic_ostringstream(49f6e7a06ebc5aa8).; |
| 796 | os << _digraphcxx . . $ lemon/DigraphWriter#_digraph..id(n); |
| 797 | _node_indexcxx . . $ lemon/DigraphWriter#_node_index..insertcxx . . $ std/map#insert(274b9441a76f0de8).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(n, os.strcxx . . $ std/__cxx11/basic_ostringstream#str(d33e1a6fd36255f7).())); |
| 798 | } |
| 799 | } else { |
| 800 | for (NodeItcxx . . $ lemon/DigraphWriter#NodeIt# n(_digraphcxx . . $ lemon/DigraphWriter#_digraph.); n != INVALIDcxx . . $ lemon/INVALID.; ++n) { |
| 801 | stdcxx . . $ std/::stringcxx . . $ std/string# value = label->getcxx . . $ lemon/_writer_bits/MapStorageBase#get(23b83986b497e4d5).(n); |
| 802 | _node_indexcxx . . $ lemon/DigraphWriter#_node_index..insertcxx . . $ std/map#insert(92111883a3599ede).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(n, value)); |
| 803 | } |
| 804 | } |
| 805 | } |
| 806 | |
| 807 | void writeArcscxx . . $ lemon/DigraphWriter#writeArcs(49f6e7a06ebc5aa8).() { |
| 808 | _writer_bitscxx . . $ lemon/_writer_bits/::MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<Arccxx . . $ lemon/DigraphWriter#Arc#>* label = 0; |
| 809 | for (typename ArcMapscxx . . $ lemon/DigraphWriter#ArcMaps#::iterator it = _arc_mapscxx . . $ lemon/DigraphWriter#_arc_maps..begincxx . . $ std/vector#begin(d1e1699016b9d7e6).(); |
| 810 | it != _arc_mapscxx . . $ lemon/DigraphWriter#_arc_maps..endcxx . . $ std/vector#end(55a6de06420d4903).(); ++it) { |
| 811 | if (it->first == "label") { |
| 812 | label = it->second; |
| 813 | break; |
| 814 | } |
| 815 | } |
| 816 | |
| 817 | *_oscxx . . $ lemon/DigraphWriter#_os. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "@arcs"; |
| 818 | if (!_arcs_captioncxx . . $ lemon/DigraphWriter#_arcs_caption..emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).()) { |
| 819 | _writer_bitscxx . . $ lemon/_writer_bits/::writeTokencxx . . $ lemon/_writer_bits/writeToken(b1020aba89db397c).(*_oscxx . . $ lemon/DigraphWriter#_os. <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). ' ', _arcs_captioncxx . . $ lemon/DigraphWriter#_arcs_caption.); |
| 820 | } |
| 821 | *_oscxx . . $ lemon/DigraphWriter#_os. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 822 | |
| 823 | *_oscxx . . $ lemon/DigraphWriter#_os. <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). '\t' <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). '\t'; |
| 824 | if (label == 0) { |
| 825 | *_oscxx . . $ lemon/DigraphWriter#_os. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "label" <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). '\t'; |
| 826 | } |
| 827 | for (typename ArcMapscxx . . $ lemon/DigraphWriter#ArcMaps#::iterator it = _arc_mapscxx . . $ lemon/DigraphWriter#_arc_maps..begincxx . . $ std/vector#begin(55a6de06420d4903).(); |
| 828 | it != _arc_mapscxx . . $ lemon/DigraphWriter#_arc_maps..endcxx . . $ std/vector#end(55a6de06420d4903).(); ++it) { |
| 829 | _writer_bitscxx . . $ lemon/_writer_bits/::writeTokencxx . . $ lemon/_writer_bits/writeToken(b1020aba89db397c).(*_oscxx . . $ lemon/DigraphWriter#_os., it->first) << '\t'; |
| 830 | } |
| 831 | *_oscxx . . $ lemon/DigraphWriter#_os. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 832 | |
| 833 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<Arccxx . . $ lemon/DigraphWriter#Arc#> arcs; |
| 834 | for (ArcItcxx . . $ lemon/DigraphWriter#ArcIt# n(_digraphcxx . . $ lemon/DigraphWriter#_digraph.); n != INVALIDcxx . . $ lemon/INVALID.; ++n) { |
| 835 | arcs.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(n); |
| 836 | } |
| 837 | |
| 838 | if (label == 0) { |
| 839 | IdMapcxx . . $ lemon/IdMap#<DGR, Arccxx . . $ lemon/DigraphWriter#Arc#> id_map(_digraphcxx . . $ lemon/DigraphWriter#_digraph.); |
| 840 | _writer_bitscxx . . $ lemon/_writer_bits/::MapLesscxx . . $ lemon/_writer_bits/MapLess#<IdMapcxx . . $ lemon/IdMap#<DGR, Arccxx . . $ lemon/DigraphWriter#Arc#> > id_less(id_map); |
| 841 | stdcxx . . $ std/::sortcxx . . $ std/sort(4d3091562df4e52e).(arcs.begincxx . . $ std/vector#begin(55a6de06420d4903).(), arcs.endcxx . . $ std/vector#end(55a6de06420d4903).(), id_less); |
| 842 | } else { |
| 843 | label->sortcxx . . $ lemon/_writer_bits/MapStorageBase#sort(efb54ab086463856).(arcs); |
| 844 | } |
| 845 | |
| 846 | for (int i = 0; i < static_cast<int>(arcs.sizecxx . . $ std/vector#size(c9b1e749b64d5edc).()); ++i) { |
| 847 | Arccxx . . $ lemon/DigraphWriter#Arc# a = arcs[i]; |
| 848 | _writer_bitscxx . . $ lemon/_writer_bits/::writeTokencxx . . $ lemon/_writer_bits/writeToken(b1020aba89db397c).(*_oscxx . . $ lemon/DigraphWriter#_os., _node_indexcxx . . $ lemon/DigraphWriter#_node_index.. |
| 849 | findcxx . . $ std/map#find(93703e90eb593a7f).(_digraphcxx . . $ lemon/DigraphWriter#_digraph..source(a))->second); |
| 850 | *_oscxx . . $ lemon/DigraphWriter#_os. <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). '\t'; |
| 851 | _writer_bitscxx . . $ lemon/_writer_bits/::writeTokencxx . . $ lemon/_writer_bits/writeToken(b1020aba89db397c).(*_oscxx . . $ lemon/DigraphWriter#_os., _node_indexcxx . . $ lemon/DigraphWriter#_node_index.. |
| 852 | findcxx . . $ std/map#find(93703e90eb593a7f).(_digraphcxx . . $ lemon/DigraphWriter#_digraph..target(a))->second); |
| 853 | *_oscxx . . $ lemon/DigraphWriter#_os. <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). '\t'; |
| 854 | if (label == 0) { |
| 855 | stdcxx . . $ std/::ostringstreamcxx . . $ std/ostringstream# oscxx . . $ std/__cxx11/basic_ostringstream#basic_ostringstream(49f6e7a06ebc5aa8).; |
| 856 | os << _digraphcxx . . $ lemon/DigraphWriter#_digraph..id(a); |
| 857 | _writer_bitscxx . . $ lemon/_writer_bits/::writeTokencxx . . $ lemon/_writer_bits/writeToken(b1020aba89db397c).(*_oscxx . . $ lemon/DigraphWriter#_os., os.strcxx . . $ std/__cxx11/basic_ostringstream#str(d33e1a6fd36255f7).()); |
| 858 | *_oscxx . . $ lemon/DigraphWriter#_os. <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). '\t'; |
| 859 | _arc_indexcxx . . $ lemon/DigraphWriter#_arc_index..insertcxx . . $ std/map#insert(92111883a3599ede).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(a, os.strcxx . . $ std/__cxx11/basic_ostringstream#str(d33e1a6fd36255f7).())); |
| 860 | } |
| 861 | for (typename ArcMapscxx . . $ lemon/DigraphWriter#ArcMaps#::iterator it = _arc_mapscxx . . $ lemon/DigraphWriter#_arc_maps..begincxx . . $ std/vector#begin(55a6de06420d4903).(); |
| 862 | it != _arc_mapscxx . . $ lemon/DigraphWriter#_arc_maps..endcxx . . $ std/vector#end(d1e1699016b9d7e6).(); ++it) { |
| 863 | stdcxx . . $ std/::stringcxx . . $ std/string# value = it->second->get(a); |
| 864 | _writer_bitscxx . . $ lemon/_writer_bits/::writeTokencxx . . $ lemon/_writer_bits/writeToken(b1020aba89db397c).(*_oscxx . . $ lemon/DigraphWriter#_os., value); |
| 865 | if (it->first == "label") { |
| 866 | _arc_indexcxx . . $ lemon/DigraphWriter#_arc_index..insertcxx . . $ std/map#insert(92111883a3599ede).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(a, value)); |
| 867 | } |
| 868 | *_oscxx . . $ lemon/DigraphWriter#_os. <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). '\t'; |
| 869 | } |
| 870 | *_oscxx . . $ lemon/DigraphWriter#_os. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 871 | } |
| 872 | } |
| 873 | |
| 874 | void createArcIndexcxx . . $ lemon/DigraphWriter#createArcIndex(49f6e7a06ebc5aa8).() { |
| 875 | _writer_bitscxx . . $ lemon/_writer_bits/::MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<Arccxx . . $ lemon/DigraphWriter#Arc#>* label = 0; |
| 876 | for (typename ArcMapscxx . . $ lemon/DigraphWriter#ArcMaps#::iterator it = _arc_mapscxx . . $ lemon/DigraphWriter#_arc_maps..begincxx . . $ std/vector#begin(d1e1699016b9d7e6).(); |
| 877 | it != _arc_mapscxx . . $ lemon/DigraphWriter#_arc_maps..endcxx . . $ std/vector#end(d1e1699016b9d7e6).(); ++it) { |
| 878 | if (it->first == "label") { |
| 879 | label = it->second; |
| 880 | break; |
| 881 | } |
| 882 | } |
| 883 | |
| 884 | if (label == 0) { |
| 885 | for (ArcItcxx . . $ lemon/DigraphWriter#ArcIt# a(_digraphcxx . . $ lemon/DigraphWriter#_digraph.); a != INVALIDcxx . . $ lemon/INVALID.; ++a) { |
| 886 | stdcxx . . $ std/::ostringstreamcxx . . $ std/ostringstream# oscxx . . $ std/__cxx11/basic_ostringstream#basic_ostringstream(49f6e7a06ebc5aa8).; |
| 887 | os << _digraphcxx . . $ lemon/DigraphWriter#_digraph..id(a); |
| 888 | _arc_indexcxx . . $ lemon/DigraphWriter#_arc_index..insertcxx . . $ std/map#insert(18cfdecbf775ff44).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(a, os.strcxx . . $ std/__cxx11/basic_ostringstream#str(d33e1a6fd36255f7).())); |
| 889 | } |
| 890 | } else { |
| 891 | for (ArcItcxx . . $ lemon/DigraphWriter#ArcIt# a(_digraphcxx . . $ lemon/DigraphWriter#_digraph.); a != INVALIDcxx . . $ lemon/INVALID.; ++a) { |
| 892 | stdcxx . . $ std/::stringcxx . . $ std/string# value = label->getcxx . . $ lemon/_writer_bits/MapStorageBase#get(23b83986b497e4d5).(a); |
| 893 | _arc_indexcxx . . $ lemon/DigraphWriter#_arc_index..insertcxx . . $ std/map#insert(50ef72ff69bc573d).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(a, value)); |
| 894 | } |
| 895 | } |
| 896 | } |
| 897 | |
| 898 | void writeAttributescxx . . $ lemon/DigraphWriter#writeAttributes(49f6e7a06ebc5aa8).() { |
| 899 | if (_attributescxx . . $ lemon/DigraphWriter#_attributes..emptycxx . . $ std/vector#empty(3482b152b9333168).()) return; |
| 900 | *_oscxx . . $ lemon/DigraphWriter#_os. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "@attributes"; |
| 901 | if (!_attributes_captioncxx . . $ lemon/DigraphWriter#_attributes_caption..emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).()) { |
| 902 | _writer_bitscxx . . $ lemon/_writer_bits/::writeTokencxx . . $ lemon/_writer_bits/writeToken(b1020aba89db397c).(*_oscxx . . $ lemon/DigraphWriter#_os. <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). ' ', _attributes_captioncxx . . $ lemon/DigraphWriter#_attributes_caption.); |
| 903 | } |
| 904 | *_oscxx . . $ lemon/DigraphWriter#_os. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 905 | for (typename Attributescxx . . $ lemon/DigraphWriter#Attributes#::iteratorcxx . . $ std/vector#iterator# it = _attributescxx . . $ lemon/DigraphWriter#_attributes..begincxx . . $ std/vector#begin(55a6de06420d4903).(); |
| 906 | it !=cxx . . $ __gnu_cxx/`operator!=`(30ee64f2df4eef8b). _attributescxx . . $ lemon/DigraphWriter#_attributes..endcxx . . $ std/vector#end(55a6de06420d4903).(); ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(1613faa01bc3d014).it) { |
| 907 | _writer_bitscxx . . $ lemon/_writer_bits/::writeTokencxx . . $ lemon/_writer_bits/writeToken(b1020aba89db397c).(*_oscxx . . $ lemon/DigraphWriter#_os., it->cxx . . $ __gnu_cxx/__normal_iterator#`operator->`(65c2ec7035a77d3e).firstcxx . . $ std/pair#first.) <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). ' '; |
| 908 | _writer_bitscxx . . $ lemon/_writer_bits/::writeTokencxx . . $ lemon/_writer_bits/writeToken(b1020aba89db397c).(*_oscxx . . $ lemon/DigraphWriter#_os., it->cxx . . $ __gnu_cxx/__normal_iterator#`operator->`(65c2ec7035a77d3e).secondcxx . . $ std/pair#second.->getcxx . . $ lemon/_writer_bits/ValueStorageBase#get(efd28698952f529a).()); |
| 909 | *_oscxx . . $ lemon/DigraphWriter#_os. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 910 | } |
| 911 | } |
| 912 | |
| 913 | public: |
| 914 | |
| 915 | /// \name Execution of the Writer |
| 916 | /// @{ |
| 917 | |
| 918 | /// \brief Start the batch processing |
| 919 | /// |
| 920 | /// This function starts the batch processing. |
| 921 | void runcxx . . $ lemon/DigraphWriter#run(49f6e7a06ebc5aa8).() { |
| 922 | if (!_skip_nodescxx . . $ lemon/DigraphWriter#_skip_nodes.) { |
| 923 | writeNodescxx . . $ lemon/DigraphWriter#writeNodes(49f6e7a06ebc5aa8).(); |
| 924 | } else { |
| 925 | createNodeIndexcxx . . $ lemon/DigraphWriter#createNodeIndex(49f6e7a06ebc5aa8).(); |
| 926 | } |
| 927 | if (!_skip_arcscxx . . $ lemon/DigraphWriter#_skip_arcs.) { |
| 928 | writeArcscxx . . $ lemon/DigraphWriter#writeArcs(49f6e7a06ebc5aa8).(); |
| 929 | } else { |
| 930 | createArcIndexcxx . . $ lemon/DigraphWriter#createArcIndex(49f6e7a06ebc5aa8).(); |
| 931 | } |
| 932 | writeAttributescxx . . $ lemon/DigraphWriter#writeAttributes(49f6e7a06ebc5aa8).(); |
| 933 | } |
| 934 | |
| 935 | /// \brief Give back the stream of the writer |
| 936 | /// |
| 937 | /// Give back the stream of the writer. |
| 938 | stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& ostreamcxx . . $ lemon/DigraphWriter#ostream(3094c9a1b678da92).() { |
| 939 | return *_oscxx . . $ lemon/DigraphWriter#_os.; |
| 940 | } |
| 941 | |
| 942 | /// @} |
| 943 | }; |
| 944 | |
| 945 | /// \ingroup lemon_io |
| 946 | /// |
| 947 | /// \brief Return a \ref lemon::DigraphWriter "DigraphWriter" class |
| 948 | /// |
| 949 | /// This function just returns a \ref lemon::DigraphWriter |
| 950 | /// "DigraphWriter" class. |
| 951 | /// |
| 952 | /// With this function a digraph can be write to a file or output |
| 953 | /// stream in \ref lgf-format "LGF" format with several maps and |
| 954 | /// attributes. For example, with the following code a network flow |
| 955 | /// problem can be written to the standard output, i.e. a digraph |
| 956 | /// with a \e capacity map on the arcs and \e source and \e target |
| 957 | /// nodes: |
| 958 | /// |
| 959 | ///\code |
| 960 | ///ListDigraph digraph; |
| 961 | ///ListDigraph::ArcMap<int> cap(digraph); |
| 962 | ///ListDigraph::Node src, trg; |
| 963 | /// // Setting the capacity map and source and target nodes |
| 964 | ///digraphWriter(digraph, std::cout). |
| 965 | /// arcMap("capacity", cap). |
| 966 | /// node("source", src). |
| 967 | /// node("target", trg). |
| 968 | /// run(); |
| 969 | ///\endcode |
| 970 | /// |
| 971 | /// For a complete documentation, please see the |
| 972 | /// \ref lemon::DigraphWriter "DigraphWriter" |
| 973 | /// class documentation. |
| 974 | /// \warning Don't forget to put the \ref lemon::DigraphWriter::run() "run()" |
| 975 | /// to the end of the parameter list. |
| 976 | /// \relates DigraphWriter |
| 977 | /// \sa digraphWriter(const TDGR& digraph, const std::string& fn) |
| 978 | /// \sa digraphWriter(const TDGR& digraph, const char* fn) |
| 979 | template <typename TDGR> |
| 980 | DigraphWritercxx . . $ lemon/DigraphWriter#<TDGR> digraphWritercxx . . $ lemon/digraphWriter(4bf528191b98dab5).(const TDGR& digraph, stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& os) { |
| 981 | DigraphWritercxx . . $ lemon/DigraphWriter#<TDGR> tmp(digraph, os); |
| 982 | return tmp; |
| 983 | } |
| 984 | |
| 985 | /// \brief Return a \ref DigraphWriter class |
| 986 | /// |
| 987 | /// This function just returns a \ref DigraphWriter class. |
| 988 | /// \relates DigraphWriter |
| 989 | /// \sa digraphWriter(const TDGR& digraph, std::ostream& os) |
| 990 | template <typename TDGR> |
| 991 | DigraphWritercxx . . $ lemon/DigraphWriter#<TDGR> digraphWritercxx . . $ lemon/digraphWriter(8f5f957600d73865).(const TDGR& digraph, |
| 992 | const stdcxx . . $ std/::stringcxx . . $ std/string#& fn) { |
| 993 | DigraphWritercxx . . $ lemon/DigraphWriter#<TDGR> tmp(digraph, fn); |
| 994 | return tmp; |
| 995 | } |
| 996 | |
| 997 | /// \brief Return a \ref DigraphWriter class |
| 998 | /// |
| 999 | /// This function just returns a \ref DigraphWriter class. |
| 1000 | /// \relates DigraphWriter |
| 1001 | /// \sa digraphWriter(const TDGR& digraph, std::ostream& os) |
| 1002 | template <typename TDGR> |
| 1003 | DigraphWritercxx . . $ lemon/DigraphWriter#<TDGR> digraphWritercxx . . $ lemon/digraphWriter(8a17f6ba49ede916).(const TDGR& digraph, const char* fn) { |
| 1004 | DigraphWritercxx . . $ lemon/DigraphWriter#<TDGR> tmp(digraph, fn); |
| 1005 | return tmp; |
| 1006 | } |
| 1007 | |
| 1008 | template <typename GR> |
| 1009 | class GraphWritercxx . . $ lemon/GraphWriter#; |
| 1010 | |
| 1011 | template <typename TGR> |
| 1012 | GraphWritercxx . . $ lemon/GraphWriter#<TGR> graphWritercxx . . $ lemon/graphWriter(7d7d23f7834e9ee3).(const TGR& graph, stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& os = stdcxx . . $ std/::coutcxx . . $ std/cout.); |
| 1013 | template <typename TGR> |
| 1014 | GraphWritercxx . . $ lemon/GraphWriter#<TGR> graphWritercxx . . $ lemon/graphWriter(9162b5f170578eac).(const TGR& graph, const stdcxx . . $ std/::stringcxx . . $ std/string#& fn); |
| 1015 | template <typename TGR> |
| 1016 | GraphWritercxx . . $ lemon/GraphWriter#<TGR> graphWritercxx . . $ lemon/graphWriter(c6729b551cbf56d4).(const TGR& graph, const char* fn); |
| 1017 | |
| 1018 | /// \ingroup lemon_io |
| 1019 | /// |
| 1020 | /// \brief \ref lgf-format "LGF" writer for undirected graphs |
| 1021 | /// |
| 1022 | /// This utility writes an \ref lgf-format "LGF" file. |
| 1023 | /// |
| 1024 | /// It can be used almost the same way as \c DigraphWriter. |
| 1025 | /// The only difference is that this class can handle edges and |
| 1026 | /// edge maps as well as arcs and arc maps. |
| 1027 | /// |
| 1028 | /// The arc maps are written into the file as two columns, the |
| 1029 | /// caption of the columns are the name of the map prefixed with \c |
| 1030 | /// '+' and \c '-'. The arcs are written into the \c \@attributes |
| 1031 | /// section as a \c '+' or a \c '-' prefix (depends on the direction |
| 1032 | /// of the arc) and the label of corresponding edge. |
| 1033 | template <typename GR> |
| 1034 | class GraphWritercxx . . $ lemon/GraphWriter# { |
| 1035 | public: |
| 1036 | |
| 1037 | typedef GR Graphcxx . . $ lemon/GraphWriter#Graph#; |
| 1038 | TEMPLATE_GRAPH_TYPEDEFScxx . . $ lemon/GraphWriter#IntEdgeMap#(GR); |
| 1039 | |
| 1040 | private: |
| 1041 | |
| 1042 | |
| 1043 | stdcxx . . $ std/::ostreamcxx . . $ std/ostream#* _oscxx . . $ lemon/GraphWriter#_os.; |
| 1044 | bool local_oscxx . . $ lemon/GraphWriter#local_os.; |
| 1045 | |
| 1046 | const GR& _graphcxx . . $ lemon/GraphWriter#_graph.; |
| 1047 | |
| 1048 | stdcxx . . $ std/::stringcxx . . $ std/string# _nodes_captioncxx . . $ lemon/GraphWriter#_nodes_caption.; |
| 1049 | stdcxx . . $ std/::stringcxx . . $ std/string# _edges_captioncxx . . $ lemon/GraphWriter#_edges_caption.; |
| 1050 | stdcxx . . $ std/::stringcxx . . $ std/string# _attributes_captioncxx . . $ lemon/GraphWriter#_attributes_caption.; |
| 1051 | |
| 1052 | typedef stdcxx . . $ std/::mapcxx . . $ std/map#<Nodecxx . . $ lemon/GraphWriter#Node#, stdcxx . . $ std/::stringcxx . . $ std/string#> NodeIndexcxx . . $ lemon/GraphWriter#NodeIndex#; |
| 1053 | NodeIndexcxx . . $ lemon/GraphWriter#NodeIndex# _node_indexcxx . . $ lemon/GraphWriter#_node_index.; |
| 1054 | typedef stdcxx . . $ std/::mapcxx . . $ std/map#<Edgecxx . . $ lemon/GraphWriter#Edge#, stdcxx . . $ std/::stringcxx . . $ std/string#> EdgeIndexcxx . . $ lemon/GraphWriter#EdgeIndex#; |
| 1055 | EdgeIndexcxx . . $ lemon/GraphWriter#EdgeIndex# _edge_indexcxx . . $ lemon/GraphWriter#_edge_index.; |
| 1056 | |
| 1057 | typedef stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::paircxx . . $ std/pair#<stdcxx . . $ std/::stringcxx . . $ std/string#, |
| 1058 | _writer_bitscxx . . $ lemon/_writer_bits/::MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<Nodecxx . . $ lemon/GraphWriter#Node#>* > > NodeMapscxx . . $ lemon/GraphWriter#NodeMaps#; |
| 1059 | NodeMapscxx . . $ lemon/GraphWriter#NodeMaps# _node_mapscxx . . $ lemon/GraphWriter#_node_maps.; |
| 1060 | |
| 1061 | typedef stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::paircxx . . $ std/pair#<stdcxx . . $ std/::stringcxx . . $ std/string#, |
| 1062 | _writer_bitscxx . . $ lemon/_writer_bits/::MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<Edgecxx . . $ lemon/GraphWriter#Edge#>* > >EdgeMapscxx . . $ lemon/GraphWriter#EdgeMaps#; |
| 1063 | EdgeMapscxx . . $ lemon/GraphWriter#EdgeMaps# _edge_mapscxx . . $ lemon/GraphWriter#_edge_maps.; |
| 1064 | |
| 1065 | typedef stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::paircxx . . $ std/pair#<stdcxx . . $ std/::stringcxx . . $ std/string#, |
| 1066 | _writer_bitscxx . . $ lemon/_writer_bits/::ValueStorageBasecxx . . $ lemon/_writer_bits/ValueStorageBase#*> > Attributescxx . . $ lemon/GraphWriter#Attributes#; |
| 1067 | Attributescxx . . $ lemon/GraphWriter#Attributes# _attributescxx . . $ lemon/GraphWriter#_attributes.; |
| 1068 | |
| 1069 | bool _skip_nodescxx . . $ lemon/GraphWriter#_skip_nodes.; |
| 1070 | bool _skip_edgescxx . . $ lemon/GraphWriter#_skip_edges.; |
| 1071 | |
| 1072 | public: |
| 1073 | |
| 1074 | /// \brief Constructor |
| 1075 | /// |
| 1076 | /// Construct an undirected graph writer, which writes to the |
| 1077 | /// given output stream. |
| 1078 | GraphWritercxx . . $ lemon/GraphWriter#`GraphWriter<GR>`(cd5921fea08118f1).(const GR& graph, stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& os = stdcxx . . $ std/::coutcxx . . $ std/cout.) |
| 1079 | : _oscxx . . $ lemon/GraphWriter#_os.(&os), local_oscxx . . $ lemon/GraphWriter#local_os.(false), _graphcxx . . $ lemon/GraphWriter#_graph.(graph), |
| 1080 | _skip_nodescxx . . $ lemon/GraphWriter#_skip_nodes.(false), _skip_edgescxx . . $ lemon/GraphWriter#_skip_edges.(false) {} |
| 1081 | |
| 1082 | /// \brief Constructor |
| 1083 | /// |
| 1084 | /// Construct a undirected graph writer, which writes to the given |
| 1085 | /// output file. |
| 1086 | GraphWritercxx . . $ lemon/GraphWriter#`GraphWriter<GR>`(a303ec4ca7cd6081).(const GR& graph, const stdcxx . . $ std/::stringcxx . . $ std/string#& fn) |
| 1087 | : _oscxx . . $ lemon/GraphWriter#_os.(new stdcxx . . $ std/::ofstreamcxx . . $ std/ofstream#(fn.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).())), local_oscxx . . $ lemon/GraphWriter#local_os.(true), _graphcxx . . $ lemon/GraphWriter#_graph.(graph), |
| 1088 | _skip_nodescxx . . $ lemon/GraphWriter#_skip_nodes.(false), _skip_edgescxx . . $ lemon/GraphWriter#_skip_edges.(false) { |
| 1089 | if (!cxx . . $ std/basic_ios#`operator!`(50ce9a9e25b4a850).(*_oscxx . . $ lemon/GraphWriter#_os.)) { |
| 1090 | delete _oscxx . . $ lemon/GraphWriter#_os.; |
| 1091 | throw IoErrorcxx . . $ lemon/IoError#IoError(6521af5f82091f78).("Cannot write file", fn); |
| 1092 | } |
| 1093 | } |
| 1094 | |
| 1095 | /// \brief Constructor |
| 1096 | /// |
| 1097 | /// Construct a undirected graph writer, which writes to the given |
| 1098 | /// output file. |
| 1099 | GraphWritercxx . . $ lemon/GraphWriter#`GraphWriter<GR>`(4e234f26c19d7452).(const GR& graph, const char* fn) |
| 1100 | : _oscxx . . $ lemon/GraphWriter#_os.(new stdcxx . . $ std/::ofstreamcxx . . $ std/ofstream#(fn)), local_oscxx . . $ lemon/GraphWriter#local_os.(true), _graphcxx . . $ lemon/GraphWriter#_graph.(graph), |
| 1101 | _skip_nodescxx . . $ lemon/GraphWriter#_skip_nodes.(false), _skip_edgescxx . . $ lemon/GraphWriter#_skip_edges.(false) { |
| 1102 | if (!cxx . . $ std/basic_ios#`operator!`(50ce9a9e25b4a850).(*_oscxx . . $ lemon/GraphWriter#_os.)) { |
| 1103 | delete _oscxx . . $ lemon/GraphWriter#_os.; |
| 1104 | throw IoErrorcxx . . $ lemon/IoError#IoError(6521af5f82091f78).("Cannot write file", fncxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).); |
| 1105 | } |
| 1106 | } |
| 1107 | |
| 1108 | /// \brief Destructor |
| 1109 | ~cxx . . $ lemon/GraphWriter#`~GraphWriter<GR>`(49f6e7a06ebc5aa8).GraphWriter() { |
| 1110 | for (typename NodeMapscxx . . $ lemon/GraphWriter#NodeMaps#::iterator it = _node_mapscxx . . $ lemon/GraphWriter#_node_maps..begincxx . . $ std/vector#begin(d1e1699016b9d7e6).(); |
| 1111 | it != _node_mapscxx . . $ lemon/GraphWriter#_node_maps..endcxx . . $ std/vector#end(55a6de06420d4903).(); ++it) { |
| 1112 | delete it->second; |
| 1113 | } |
| 1114 | |
| 1115 | for (typename EdgeMapscxx . . $ lemon/GraphWriter#EdgeMaps#::iterator it = _edge_mapscxx . . $ lemon/GraphWriter#_edge_maps..begincxx . . $ std/vector#begin(d1e1699016b9d7e6).(); |
| 1116 | it != _edge_mapscxx . . $ lemon/GraphWriter#_edge_maps..endcxx . . $ std/vector#end(55a6de06420d4903).(); ++it) { |
| 1117 | delete it->second; |
| 1118 | } |
| 1119 | |
| 1120 | for (typename Attributescxx . . $ lemon/GraphWriter#Attributes#::iteratorcxx . . $ std/vector#iterator# it = _attributescxx . . $ lemon/GraphWriter#_attributes..begincxx . . $ std/vector#begin(55a6de06420d4903).(); |
| 1121 | it !=cxx . . $ __gnu_cxx/`operator!=`(30ee64f2df4eef8b). _attributescxx . . $ lemon/GraphWriter#_attributes..endcxx . . $ std/vector#end(55a6de06420d4903).(); ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(1613faa01bc3d014).it) { |
| 1122 | delete it->cxx . . $ __gnu_cxx/__normal_iterator#`operator->`(65c2ec7035a77d3e).secondcxx . . $ std/pair#second.; |
| 1123 | } |
| 1124 | |
| 1125 | if (local_oscxx . . $ lemon/GraphWriter#local_os.) { |
| 1126 | delete _oscxx . . $ lemon/GraphWriter#_os.; |
| 1127 | } |
| 1128 | } |
| 1129 | |
| 1130 | private: |
| 1131 | |
| 1132 | template <typename TGR> |
| 1133 | friend GraphWritercxx . . $ lemon/GraphWriter#<TGR> graphWritercxx . . $ lemon/graphWriter(5f3b7b996b1b7fad).(const TGR& graph, stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& os); |
| 1134 | template <typename TGR> |
| 1135 | friend GraphWritercxx . . $ lemon/GraphWriter#<TGR> graphWritercxx . . $ lemon/graphWriter(1891ca828d738379).(const TGR& graph, |
| 1136 | const stdcxx . . $ std/::stringcxx . . $ std/string#& fn); |
| 1137 | template <typename TGR> |
| 1138 | friend GraphWritercxx . . $ lemon/GraphWriter#<TGR> graphWritercxx . . $ lemon/graphWriter(eb898b1555149af8).(const TGR& graph, const char *fn); |
| 1139 | |
| 1140 | GraphWritercxx . . $ lemon/GraphWriter#`GraphWriter<GR>`(eef32f3b8ddfc0fc).(GraphWriter& other) |
| 1141 | : _oscxx . . $ lemon/GraphWriter#_os.(other._oscxx . . $ lemon/GraphWriter#_os.), local_oscxx . . $ lemon/GraphWriter#local_os.(other.local_oscxx . . $ lemon/GraphWriter#local_os.), _graphcxx . . $ lemon/GraphWriter#_graph.(other._graphcxx . . $ lemon/GraphWriter#_graph.), |
| 1142 | _skip_nodescxx . . $ lemon/GraphWriter#_skip_nodes.(other._skip_nodescxx . . $ lemon/GraphWriter#_skip_nodes.), _skip_edgescxx . . $ lemon/GraphWriter#_skip_edges.(other._skip_edgescxx . . $ lemon/GraphWriter#_skip_edges.) { |
| 1143 | |
| 1144 | other._oscxx . . $ lemon/GraphWriter#_os. = 0; |
| 1145 | other.local_oscxx . . $ lemon/GraphWriter#local_os. = false; |
| 1146 | |
| 1147 | _node_indexcxx . . $ lemon/GraphWriter#_node_index..swapcxx . . $ std/map#swap(6db4dfdbe2a5e125).(other._node_indexcxx . . $ lemon/GraphWriter#_node_index.); |
| 1148 | _edge_indexcxx . . $ lemon/GraphWriter#_edge_index..swapcxx . . $ std/map#swap(6db4dfdbe2a5e125).(other._edge_indexcxx . . $ lemon/GraphWriter#_edge_index.); |
| 1149 | |
| 1150 | _node_mapscxx . . $ lemon/GraphWriter#_node_maps..swapcxx . . $ std/vector#swap(319777021b21d7dd).(other._node_mapscxx . . $ lemon/GraphWriter#_node_maps.); |
| 1151 | _edge_mapscxx . . $ lemon/GraphWriter#_edge_maps..swapcxx . . $ std/vector#swap(319777021b21d7dd).(other._edge_mapscxx . . $ lemon/GraphWriter#_edge_maps.); |
| 1152 | _attributescxx . . $ lemon/GraphWriter#_attributes..swapcxx . . $ std/vector#swap(319777021b21d7dd).(other._attributescxx . . $ lemon/GraphWriter#_attributes.); |
| 1153 | |
| 1154 | _nodes_captioncxx . . $ lemon/GraphWriter#_nodes_caption. =cxx . . $ std/__cxx11/basic_string#`operator=`(c0b47be1fddc0e75). other._nodes_captioncxx . . $ lemon/GraphWriter#_nodes_caption.; |
| 1155 | _edges_captioncxx . . $ lemon/GraphWriter#_edges_caption. =cxx . . $ std/__cxx11/basic_string#`operator=`(c0b47be1fddc0e75). other._edges_captioncxx . . $ lemon/GraphWriter#_edges_caption.; |
| 1156 | _attributes_captioncxx . . $ lemon/GraphWriter#_attributes_caption. =cxx . . $ std/__cxx11/basic_string#`operator=`(c0b47be1fddc0e75). other._attributes_captioncxx . . $ lemon/GraphWriter#_attributes_caption.; |
| 1157 | } |
| 1158 | |
| 1159 | GraphWriter& operatorcxx . . $ lemon/GraphWriter#`operator=`(a691dffb50fd9f8f).=(const GraphWriter&); |
| 1160 | |
| 1161 | public: |
| 1162 | |
| 1163 | /// \name Writing Rules |
| 1164 | /// @{ |
| 1165 | |
| 1166 | /// \brief Node map writing rule |
| 1167 | /// |
| 1168 | /// Add a node map writing rule to the writer. |
| 1169 | template <typename Map> |
| 1170 | GraphWriter& nodeMapcxx . . $ lemon/GraphWriter#nodeMap(8849273a3a03ce0a).(const stdcxx . . $ std/::stringcxx . . $ std/string#& caption, const Map& map) { |
| 1171 | checkConceptcxx . . $ lemon/checkConcept(49f6e7a06ebc5aa8).<conceptscxx . . $ lemon/concepts/::ReadMapcxx . . $ lemon/concepts/ReadMap#<Nodecxx . . $ lemon/GraphWriter#Node#, typename Map::Value>, Map>(); |
| 1172 | _writer_bitscxx . . $ lemon/_writer_bits/::MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<Nodecxx . . $ lemon/GraphWriter#Node#>* storage = |
| 1173 | new _writer_bitscxx . . $ lemon/_writer_bits/::MapStoragecxx . . $ lemon/_writer_bits/MapStorage#<Nodecxx . . $ lemon/GraphWriter#Node#, Map>(map); |
| 1174 | _node_mapscxx . . $ lemon/GraphWriter#_node_maps..push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(caption, storage)); |
| 1175 | return *this; |
| 1176 | } |
| 1177 | |
| 1178 | /// \brief Node map writing rule |
| 1179 | /// |
| 1180 | /// Add a node map writing rule with specialized converter to the |
| 1181 | /// writer. |
| 1182 | template <typename Map, typename Converter> |
| 1183 | GraphWriter& nodeMapcxx . . $ lemon/GraphWriter#nodeMap(e4fb176f5535be02).(const stdcxx . . $ std/::stringcxx . . $ std/string#& caption, const Map& map, |
| 1184 | const Converter& converter = Converter()) { |
| 1185 | checkConceptcxx . . $ lemon/checkConcept(49f6e7a06ebc5aa8).<conceptscxx . . $ lemon/concepts/::ReadMapcxx . . $ lemon/concepts/ReadMap#<Nodecxx . . $ lemon/GraphWriter#Node#, typename Map::Value>, Map>(); |
| 1186 | _writer_bitscxx . . $ lemon/_writer_bits/::MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<Nodecxx . . $ lemon/GraphWriter#Node#>* storage = |
| 1187 | new _writer_bitscxx . . $ lemon/_writer_bits/::MapStoragecxx . . $ lemon/_writer_bits/MapStorage#<Nodecxx . . $ lemon/GraphWriter#Node#, Map, Converter>(map, converter); |
| 1188 | _node_mapscxx . . $ lemon/GraphWriter#_node_maps..push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(caption, storage)); |
| 1189 | return *this; |
| 1190 | } |
| 1191 | |
| 1192 | /// \brief Edge map writing rule |
| 1193 | /// |
| 1194 | /// Add an edge map writing rule to the writer. |
| 1195 | template <typename Map> |
| 1196 | GraphWriter& edgeMapcxx . . $ lemon/GraphWriter#edgeMap(8849273a3a03ce0a).(const stdcxx . . $ std/::stringcxx . . $ std/string#& caption, const Map& map) { |
| 1197 | checkConceptcxx . . $ lemon/checkConcept(49f6e7a06ebc5aa8).<conceptscxx . . $ lemon/concepts/::ReadMapcxx . . $ lemon/concepts/ReadMap#<Edgecxx . . $ lemon/GraphWriter#Edge#, typename Map::Value>, Map>(); |
| 1198 | _writer_bitscxx . . $ lemon/_writer_bits/::MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<Edgecxx . . $ lemon/GraphWriter#Edge#>* storage = |
| 1199 | new _writer_bitscxx . . $ lemon/_writer_bits/::MapStoragecxx . . $ lemon/_writer_bits/MapStorage#<Edgecxx . . $ lemon/GraphWriter#Edge#, Map>(map); |
| 1200 | _edge_mapscxx . . $ lemon/GraphWriter#_edge_maps..push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(caption, storage)); |
| 1201 | return *this; |
| 1202 | } |
| 1203 | |
| 1204 | /// \brief Edge map writing rule |
| 1205 | /// |
| 1206 | /// Add an edge map writing rule with specialized converter to the |
| 1207 | /// writer. |
| 1208 | template <typename Map, typename Converter> |
| 1209 | GraphWriter& edgeMapcxx . . $ lemon/GraphWriter#edgeMap(e4fb176f5535be02).(const stdcxx . . $ std/::stringcxx . . $ std/string#& caption, const Map& map, |
| 1210 | const Converter& converter = Converter()) { |
| 1211 | checkConceptcxx . . $ lemon/checkConcept(49f6e7a06ebc5aa8).<conceptscxx . . $ lemon/concepts/::ReadMapcxx . . $ lemon/concepts/ReadMap#<Edgecxx . . $ lemon/GraphWriter#Edge#, typename Map::Value>, Map>(); |
| 1212 | _writer_bitscxx . . $ lemon/_writer_bits/::MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<Edgecxx . . $ lemon/GraphWriter#Edge#>* storage = |
| 1213 | new _writer_bitscxx . . $ lemon/_writer_bits/::MapStoragecxx . . $ lemon/_writer_bits/MapStorage#<Edgecxx . . $ lemon/GraphWriter#Edge#, Map, Converter>(map, converter); |
| 1214 | _edge_mapscxx . . $ lemon/GraphWriter#_edge_maps..push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(caption, storage)); |
| 1215 | return *this; |
| 1216 | } |
| 1217 | |
| 1218 | /// \brief Arc map writing rule |
| 1219 | /// |
| 1220 | /// Add an arc map writing rule to the writer. |
| 1221 | template <typename Map> |
| 1222 | GraphWriter& arcMapcxx . . $ lemon/GraphWriter#arcMap(8849273a3a03ce0a).(const stdcxx . . $ std/::stringcxx . . $ std/string#& caption, const Map& map) { |
| 1223 | checkConceptcxx . . $ lemon/checkConcept(49f6e7a06ebc5aa8).<conceptscxx . . $ lemon/concepts/::ReadMapcxx . . $ lemon/concepts/ReadMap#<Arccxx . . $ lemon/GraphWriter#Arc#, typename Map::Value>, Map>(); |
| 1224 | _writer_bitscxx . . $ lemon/_writer_bits/::MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<Edgecxx . . $ lemon/GraphWriter#Edge#>* forward_storage = |
| 1225 | new _writer_bitscxx . . $ lemon/_writer_bits/::GraphArcMapStoragecxx . . $ lemon/_writer_bits/GraphArcMapStorage#<GR, true, Map>(_graphcxx . . $ lemon/GraphWriter#_graph., map); |
| 1226 | _edge_mapscxx . . $ lemon/GraphWriter#_edge_maps..push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).('+' +cxx . . $ std/operator+(67a84f929457cf92). caption, forward_storage)); |
| 1227 | _writer_bitscxx . . $ lemon/_writer_bits/::MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<Edgecxx . . $ lemon/GraphWriter#Edge#>* backward_storage = |
| 1228 | new _writer_bitscxx . . $ lemon/_writer_bits/::GraphArcMapStoragecxx . . $ lemon/_writer_bits/GraphArcMapStorage#<GR, false, Map>(_graphcxx . . $ lemon/GraphWriter#_graph., map); |
| 1229 | _edge_mapscxx . . $ lemon/GraphWriter#_edge_maps..push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).('-' +cxx . . $ std/operator+(67a84f929457cf92). caption, backward_storage)); |
| 1230 | return *this; |
| 1231 | } |
| 1232 | |
| 1233 | /// \brief Arc map writing rule |
| 1234 | /// |
| 1235 | /// Add an arc map writing rule with specialized converter to the |
| 1236 | /// writer. |
| 1237 | template <typename Map, typename Converter> |
| 1238 | GraphWriter& arcMapcxx . . $ lemon/GraphWriter#arcMap(e4fb176f5535be02).(const stdcxx . . $ std/::stringcxx . . $ std/string#& caption, const Map& map, |
| 1239 | const Converter& converter = Converter()) { |
| 1240 | checkConceptcxx . . $ lemon/checkConcept(49f6e7a06ebc5aa8).<conceptscxx . . $ lemon/concepts/::ReadMapcxx . . $ lemon/concepts/ReadMap#<Arccxx . . $ lemon/GraphWriter#Arc#, typename Map::Value>, Map>(); |
| 1241 | _writer_bitscxx . . $ lemon/_writer_bits/::MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<Edgecxx . . $ lemon/GraphWriter#Edge#>* forward_storage = |
| 1242 | new _writer_bitscxx . . $ lemon/_writer_bits/::GraphArcMapStoragecxx . . $ lemon/_writer_bits/GraphArcMapStorage#<GR, true, Map, Converter> |
| 1243 | (_graphcxx . . $ lemon/GraphWriter#_graph., map, converter); |
| 1244 | _edge_mapscxx . . $ lemon/GraphWriter#_edge_maps..push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).('+' +cxx . . $ std/operator+(67a84f929457cf92). caption, forward_storage)); |
| 1245 | _writer_bitscxx . . $ lemon/_writer_bits/::MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<Edgecxx . . $ lemon/GraphWriter#Edge#>* backward_storage = |
| 1246 | new _writer_bitscxx . . $ lemon/_writer_bits/::GraphArcMapStoragecxx . . $ lemon/_writer_bits/GraphArcMapStorage#<GR, false, Map, Converter> |
| 1247 | (_graphcxx . . $ lemon/GraphWriter#_graph., map, converter); |
| 1248 | _edge_mapscxx . . $ lemon/GraphWriter#_edge_maps..push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).('-' +cxx . . $ std/operator+(67a84f929457cf92). caption, backward_storage)); |
| 1249 | return *this; |
| 1250 | } |
| 1251 | |
| 1252 | /// \brief Attribute writing rule |
| 1253 | /// |
| 1254 | /// Add an attribute writing rule to the writer. |
| 1255 | template <typename Value> |
| 1256 | GraphWriter& attributecxx . . $ lemon/GraphWriter#attribute(8849273a3a03ce0a).(const stdcxx . . $ std/::stringcxx . . $ std/string#& caption, const Value& value) { |
| 1257 | _writer_bitscxx . . $ lemon/_writer_bits/::ValueStorageBasecxx . . $ lemon/_writer_bits/ValueStorageBase#* storage = |
| 1258 | new _writer_bitscxx . . $ lemon/_writer_bits/::ValueStoragecxx . . $ lemon/_writer_bits/ValueStorage#<Value>(value); |
| 1259 | _attributescxx . . $ lemon/GraphWriter#_attributes..push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(caption, storage)); |
| 1260 | return *this; |
| 1261 | } |
| 1262 | |
| 1263 | /// \brief Attribute writing rule |
| 1264 | /// |
| 1265 | /// Add an attribute writing rule with specialized converter to the |
| 1266 | /// writer. |
| 1267 | template <typename Value, typename Converter> |
| 1268 | GraphWriter& attributecxx . . $ lemon/GraphWriter#attribute(e4fb176f5535be02).(const stdcxx . . $ std/::stringcxx . . $ std/string#& caption, const Value& value, |
| 1269 | const Converter& converter = Converter()) { |
| 1270 | _writer_bitscxx . . $ lemon/_writer_bits/::ValueStorageBasecxx . . $ lemon/_writer_bits/ValueStorageBase#* storage = |
| 1271 | new _writer_bitscxx . . $ lemon/_writer_bits/::ValueStoragecxx . . $ lemon/_writer_bits/ValueStorage#<Value, Converter>(value, converter); |
| 1272 | _attributescxx . . $ lemon/GraphWriter#_attributes..push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(caption, storage)); |
| 1273 | return *this; |
| 1274 | } |
| 1275 | |
| 1276 | /// \brief Node writing rule |
| 1277 | /// |
| 1278 | /// Add a node writing rule to the writer. |
| 1279 | GraphWriter& nodecxx . . $ lemon/GraphWriter#node(5e63002776ff051d).(const stdcxx . . $ std/::stringcxx . . $ std/string#& caption, const Nodecxx . . $ lemon/GraphWriter#Node#& node) { |
| 1280 | typedef _writer_bitscxx . . $ lemon/_writer_bits/::MapLookUpConvertercxx . . $ lemon/_writer_bits/MapLookUpConverter#<Nodecxx . . $ lemon/GraphWriter#Node#> Convertercxx . . $ lemon/GraphWriter#node(5e63002776ff051d).Converter#; |
| 1281 | Convertercxx . . $ lemon/GraphWriter#node(5e63002776ff051d).Converter# converter(_node_indexcxx . . $ lemon/GraphWriter#_node_index.); |
| 1282 | _writer_bitscxx . . $ lemon/_writer_bits/::ValueStorageBasecxx . . $ lemon/_writer_bits/ValueStorageBase#* storage = |
| 1283 | new _writer_bitscxx . . $ lemon/_writer_bits/::ValueStoragecxx . . $ lemon/_writer_bits/ValueStorage#<Nodecxx . . $ lemon/GraphWriter#Node#, Convertercxx . . $ lemon/GraphWriter#node(5e63002776ff051d).Converter#>(node, converter); |
| 1284 | _attributescxx . . $ lemon/GraphWriter#_attributes..push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(caption, storage)); |
| 1285 | return *this; |
| 1286 | } |
| 1287 | |
| 1288 | /// \brief Edge writing rule |
| 1289 | /// |
| 1290 | /// Add an edge writing rule to writer. |
| 1291 | GraphWriter& edgecxx . . $ lemon/GraphWriter#edge(dd32285af0713b22).(const stdcxx . . $ std/::stringcxx . . $ std/string#& caption, const Edgecxx . . $ lemon/GraphWriter#Edge#& edge) { |
| 1292 | typedef _writer_bitscxx . . $ lemon/_writer_bits/::MapLookUpConvertercxx . . $ lemon/_writer_bits/MapLookUpConverter#<Edgecxx . . $ lemon/GraphWriter#Edge#> Convertercxx . . $ lemon/GraphWriter#edge(dd32285af0713b22).Converter#; |
| 1293 | Convertercxx . . $ lemon/GraphWriter#edge(dd32285af0713b22).Converter# converter(_edge_indexcxx . . $ lemon/GraphWriter#_edge_index.); |
| 1294 | _writer_bitscxx . . $ lemon/_writer_bits/::ValueStorageBasecxx . . $ lemon/_writer_bits/ValueStorageBase#* storage = |
| 1295 | new _writer_bitscxx . . $ lemon/_writer_bits/::ValueStoragecxx . . $ lemon/_writer_bits/ValueStorage#<Edgecxx . . $ lemon/GraphWriter#Edge#, Convertercxx . . $ lemon/GraphWriter#edge(dd32285af0713b22).Converter#>(edge, converter); |
| 1296 | _attributescxx . . $ lemon/GraphWriter#_attributes..push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(caption, storage)); |
| 1297 | return *this; |
| 1298 | } |
| 1299 | |
| 1300 | /// \brief Arc writing rule |
| 1301 | /// |
| 1302 | /// Add an arc writing rule to writer. |
| 1303 | GraphWriter& arccxx . . $ lemon/GraphWriter#arc(bc903d9915ddd911).(const stdcxx . . $ std/::stringcxx . . $ std/string#& caption, const Arccxx . . $ lemon/GraphWriter#Arc#& arc) { |
| 1304 | typedef _writer_bitscxx . . $ lemon/_writer_bits/::GraphArcLookUpConvertercxx . . $ lemon/_writer_bits/GraphArcLookUpConverter#<GR> Convertercxx . . $ lemon/GraphWriter#arc(bc903d9915ddd911).Converter#; |
| 1305 | Convertercxx . . $ lemon/GraphWriter#arc(bc903d9915ddd911).Converter# converter(_graphcxx . . $ lemon/GraphWriter#_graph., _edge_indexcxx . . $ lemon/GraphWriter#_edge_index.); |
| 1306 | _writer_bitscxx . . $ lemon/_writer_bits/::ValueStorageBasecxx . . $ lemon/_writer_bits/ValueStorageBase#* storage = |
| 1307 | new _writer_bitscxx . . $ lemon/_writer_bits/::ValueStoragecxx . . $ lemon/_writer_bits/ValueStorage#<Arccxx . . $ lemon/GraphWriter#Arc#, Convertercxx . . $ lemon/GraphWriter#arc(bc903d9915ddd911).Converter#>(arc, converter); |
| 1308 | _attributescxx . . $ lemon/GraphWriter#_attributes..push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(caption, storage)); |
| 1309 | return *this; |
| 1310 | } |
| 1311 | |
| 1312 | /// \name Section Captions |
| 1313 | /// @{ |
| 1314 | |
| 1315 | /// \brief Add an additional caption to the \c \@nodes section |
| 1316 | /// |
| 1317 | /// Add an additional caption to the \c \@nodes section. |
| 1318 | GraphWriter& nodescxx . . $ lemon/GraphWriter#nodes(d16499a1a224faab).(const stdcxx . . $ std/::stringcxx . . $ std/string#& caption) { |
| 1319 | _nodes_captioncxx . . $ lemon/GraphWriter#_nodes_caption. =cxx . . $ std/__cxx11/basic_string#`operator=`(c0b47be1fddc0e75). caption; |
| 1320 | return *this; |
| 1321 | } |
| 1322 | |
| 1323 | /// \brief Add an additional caption to the \c \@edges section |
| 1324 | /// |
| 1325 | /// Add an additional caption to the \c \@edges section. |
| 1326 | GraphWriter& edgescxx . . $ lemon/GraphWriter#edges(d16499a1a224faab).(const stdcxx . . $ std/::stringcxx . . $ std/string#& caption) { |
| 1327 | _edges_captioncxx . . $ lemon/GraphWriter#_edges_caption. =cxx . . $ std/__cxx11/basic_string#`operator=`(c0b47be1fddc0e75). caption; |
| 1328 | return *this; |
| 1329 | } |
| 1330 | |
| 1331 | /// \brief Add an additional caption to the \c \@attributes section |
| 1332 | /// |
| 1333 | /// Add an additional caption to the \c \@attributes section. |
| 1334 | GraphWriter& attributescxx . . $ lemon/GraphWriter#attributes(d16499a1a224faab).(const stdcxx . . $ std/::stringcxx . . $ std/string#& caption) { |
| 1335 | _attributes_captioncxx . . $ lemon/GraphWriter#_attributes_caption. =cxx . . $ std/__cxx11/basic_string#`operator=`(c0b47be1fddc0e75). caption; |
| 1336 | return *this; |
| 1337 | } |
| 1338 | |
| 1339 | /// \name Skipping Section |
| 1340 | /// @{ |
| 1341 | |
| 1342 | /// \brief Skip writing the node set |
| 1343 | /// |
| 1344 | /// The \c \@nodes section will not be written to the stream. |
| 1345 | GraphWriter& skipNodescxx . . $ lemon/GraphWriter#skipNodes(9672ddb087547a).() { |
| 1346 | LEMON_ASSERTcxx . . $ `lemon/assert.h:193:13`!(!_skip_nodes, "Multiple usage of skipNodes() member"); |
| 1347 | _skip_nodescxx . . $ lemon/GraphWriter#_skip_nodes. = true; |
| 1348 | return *this; |
| 1349 | } |
| 1350 | |
| 1351 | /// \brief Skip writing edge set |
| 1352 | /// |
| 1353 | /// The \c \@edges section will not be written to the stream. |
| 1354 | GraphWriter& skipEdgescxx . . $ lemon/GraphWriter#skipEdges(9672ddb087547a).() { |
| 1355 | LEMON_ASSERTcxx . . $ `lemon/assert.h:193:13`!(!_skip_edges, "Multiple usage of skipEdges() member"); |
| 1356 | _skip_edgescxx . . $ lemon/GraphWriter#_skip_edges. = true; |
| 1357 | return *this; |
| 1358 | } |
| 1359 | |
| 1360 | /// @} |
| 1361 | |
| 1362 | private: |
| 1363 | |
| 1364 | void writeNodescxx . . $ lemon/GraphWriter#writeNodes(49f6e7a06ebc5aa8).() { |
| 1365 | _writer_bitscxx . . $ lemon/_writer_bits/::MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<Nodecxx . . $ lemon/GraphWriter#Node#>* label = 0; |
| 1366 | for (typename NodeMapscxx . . $ lemon/GraphWriter#NodeMaps#::iterator it = _node_mapscxx . . $ lemon/GraphWriter#_node_maps..begincxx . . $ std/vector#begin(55a6de06420d4903).(); |
| 1367 | it != _node_mapscxx . . $ lemon/GraphWriter#_node_maps..endcxx . . $ std/vector#end(d1e1699016b9d7e6).(); ++it) { |
| 1368 | if (it->first == "label") { |
| 1369 | label = it->second; |
| 1370 | break; |
| 1371 | } |
| 1372 | } |
| 1373 | |
| 1374 | *_oscxx . . $ lemon/GraphWriter#_os. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "@nodes"; |
| 1375 | if (!_nodes_captioncxx . . $ lemon/GraphWriter#_nodes_caption..emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).()) { |
| 1376 | _writer_bitscxx . . $ lemon/_writer_bits/::writeTokencxx . . $ lemon/_writer_bits/writeToken(b1020aba89db397c).(*_oscxx . . $ lemon/GraphWriter#_os. <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). ' ', _nodes_captioncxx . . $ lemon/GraphWriter#_nodes_caption.); |
| 1377 | } |
| 1378 | *_oscxx . . $ lemon/GraphWriter#_os. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 1379 | |
| 1380 | if (label == 0) { |
| 1381 | *_oscxx . . $ lemon/GraphWriter#_os. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "label" <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). '\t'; |
| 1382 | } |
| 1383 | for (typename NodeMapscxx . . $ lemon/GraphWriter#NodeMaps#::iterator it = _node_mapscxx . . $ lemon/GraphWriter#_node_maps..begincxx . . $ std/vector#begin(d1e1699016b9d7e6).(); |
| 1384 | it != _node_mapscxx . . $ lemon/GraphWriter#_node_maps..endcxx . . $ std/vector#end(55a6de06420d4903).(); ++it) { |
| 1385 | _writer_bitscxx . . $ lemon/_writer_bits/::writeTokencxx . . $ lemon/_writer_bits/writeToken(b1020aba89db397c).(*_oscxx . . $ lemon/GraphWriter#_os., it->first) << '\t'; |
| 1386 | } |
| 1387 | *_oscxx . . $ lemon/GraphWriter#_os. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 1388 | |
| 1389 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<Nodecxx . . $ lemon/GraphWriter#Node#> nodes; |
| 1390 | for (NodeItcxx . . $ lemon/GraphWriter#NodeIt# n(_graphcxx . . $ lemon/GraphWriter#_graph.); n != INVALIDcxx . . $ lemon/INVALID.; ++n) { |
| 1391 | nodes.push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(n); |
| 1392 | } |
| 1393 | |
| 1394 | if (label == 0) { |
| 1395 | IdMapcxx . . $ lemon/IdMap#<GR, Nodecxx . . $ lemon/GraphWriter#Node#> id_map(_graphcxx . . $ lemon/GraphWriter#_graph.); |
| 1396 | _writer_bitscxx . . $ lemon/_writer_bits/::MapLesscxx . . $ lemon/_writer_bits/MapLess#<IdMapcxx . . $ lemon/IdMap#<GR, Nodecxx . . $ lemon/GraphWriter#Node#> > id_less(id_map); |
| 1397 | stdcxx . . $ std/::sortcxx . . $ std/sort(249673c20e2b8d5).(nodes.begincxx . . $ std/vector#begin(d1e1699016b9d7e6).(), nodes.endcxx . . $ std/vector#end(d1e1699016b9d7e6).(), id_less); |
| 1398 | } else { |
| 1399 | label->sortcxx . . $ lemon/_writer_bits/MapStorageBase#sort(efb54ab086463856).(nodes); |
| 1400 | } |
| 1401 | |
| 1402 | for (int i = 0; i < static_cast<int>(nodes.sizecxx . . $ std/vector#size(c9b1e749b64d5edc).()); ++i) { |
| 1403 | Nodecxx . . $ lemon/GraphWriter#Node# n = nodes[i]; |
| 1404 | if (label == 0) { |
| 1405 | stdcxx . . $ std/::ostringstreamcxx . . $ std/ostringstream# oscxx . . $ std/__cxx11/basic_ostringstream#basic_ostringstream(49f6e7a06ebc5aa8).; |
| 1406 | os << _graphcxx . . $ lemon/GraphWriter#_graph..id(n); |
| 1407 | _writer_bitscxx . . $ lemon/_writer_bits/::writeTokencxx . . $ lemon/_writer_bits/writeToken(b1020aba89db397c).(*_oscxx . . $ lemon/GraphWriter#_os., os.strcxx . . $ std/__cxx11/basic_ostringstream#str(d33e1a6fd36255f7).()); |
| 1408 | *_oscxx . . $ lemon/GraphWriter#_os. <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). '\t'; |
| 1409 | _node_indexcxx . . $ lemon/GraphWriter#_node_index..insertcxx . . $ std/map#insert(92111883a3599ede).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(n, os.strcxx . . $ std/__cxx11/basic_ostringstream#str(d33e1a6fd36255f7).())); |
| 1410 | } |
| 1411 | for (typename NodeMapscxx . . $ lemon/GraphWriter#NodeMaps#::iterator it = _node_mapscxx . . $ lemon/GraphWriter#_node_maps..begincxx . . $ std/vector#begin(55a6de06420d4903).(); |
| 1412 | it != _node_mapscxx . . $ lemon/GraphWriter#_node_maps..endcxx . . $ std/vector#end(d1e1699016b9d7e6).(); ++it) { |
| 1413 | stdcxx . . $ std/::stringcxx . . $ std/string# value = it->second->get(n); |
| 1414 | _writer_bitscxx . . $ lemon/_writer_bits/::writeTokencxx . . $ lemon/_writer_bits/writeToken(b1020aba89db397c).(*_oscxx . . $ lemon/GraphWriter#_os., value); |
| 1415 | if (it->first == "label") { |
| 1416 | _node_indexcxx . . $ lemon/GraphWriter#_node_index..insertcxx . . $ std/map#insert(92111883a3599ede).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(n, value)); |
| 1417 | } |
| 1418 | *_oscxx . . $ lemon/GraphWriter#_os. <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). '\t'; |
| 1419 | } |
| 1420 | *_oscxx . . $ lemon/GraphWriter#_os. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 1421 | } |
| 1422 | } |
| 1423 | |
| 1424 | void createNodeIndexcxx . . $ lemon/GraphWriter#createNodeIndex(49f6e7a06ebc5aa8).() { |
| 1425 | _writer_bitscxx . . $ lemon/_writer_bits/::MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<Nodecxx . . $ lemon/GraphWriter#Node#>* label = 0; |
| 1426 | for (typename NodeMapscxx . . $ lemon/GraphWriter#NodeMaps#::iterator it = _node_mapscxx . . $ lemon/GraphWriter#_node_maps..begincxx . . $ std/vector#begin(d1e1699016b9d7e6).(); |
| 1427 | it != _node_mapscxx . . $ lemon/GraphWriter#_node_maps..endcxx . . $ std/vector#end(d1e1699016b9d7e6).(); ++it) { |
| 1428 | if (it->first == "label") { |
| 1429 | label = it->second; |
| 1430 | break; |
| 1431 | } |
| 1432 | } |
| 1433 | |
| 1434 | if (label == 0) { |
| 1435 | for (NodeItcxx . . $ lemon/GraphWriter#NodeIt# n(_graphcxx . . $ lemon/GraphWriter#_graph.); n != INVALIDcxx . . $ lemon/INVALID.; ++n) { |
| 1436 | stdcxx . . $ std/::ostringstreamcxx . . $ std/ostringstream# oscxx . . $ std/__cxx11/basic_ostringstream#basic_ostringstream(49f6e7a06ebc5aa8).; |
| 1437 | os << _graphcxx . . $ lemon/GraphWriter#_graph..id(n); |
| 1438 | _node_indexcxx . . $ lemon/GraphWriter#_node_index..insertcxx . . $ std/map#insert(7843218f68f64a61).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(n, os.strcxx . . $ std/__cxx11/basic_ostringstream#str(d33e1a6fd36255f7).())); |
| 1439 | } |
| 1440 | } else { |
| 1441 | for (NodeItcxx . . $ lemon/GraphWriter#NodeIt# n(_graphcxx . . $ lemon/GraphWriter#_graph.); n != INVALIDcxx . . $ lemon/INVALID.; ++n) { |
| 1442 | stdcxx . . $ std/::stringcxx . . $ std/string# value = label->getcxx . . $ lemon/_writer_bits/MapStorageBase#get(23b83986b497e4d5).(n); |
| 1443 | _node_indexcxx . . $ lemon/GraphWriter#_node_index..insertcxx . . $ std/map#insert(7843218f68f64a61).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(n, value)); |
| 1444 | } |
| 1445 | } |
| 1446 | } |
| 1447 | |
| 1448 | void writeEdgescxx . . $ lemon/GraphWriter#writeEdges(49f6e7a06ebc5aa8).() { |
| 1449 | _writer_bitscxx . . $ lemon/_writer_bits/::MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<Edgecxx . . $ lemon/GraphWriter#Edge#>* label = 0; |
| 1450 | for (typename EdgeMapscxx . . $ lemon/GraphWriter#EdgeMaps#::iterator it = _edge_mapscxx . . $ lemon/GraphWriter#_edge_maps..begincxx . . $ std/vector#begin(55a6de06420d4903).(); |
| 1451 | it != _edge_mapscxx . . $ lemon/GraphWriter#_edge_maps..endcxx . . $ std/vector#end(55a6de06420d4903).(); ++it) { |
| 1452 | if (it->first == "label") { |
| 1453 | label = it->second; |
| 1454 | break; |
| 1455 | } |
| 1456 | } |
| 1457 | |
| 1458 | *_oscxx . . $ lemon/GraphWriter#_os. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "@edges"; |
| 1459 | if (!_edges_captioncxx . . $ lemon/GraphWriter#_edges_caption..emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).()) { |
| 1460 | _writer_bitscxx . . $ lemon/_writer_bits/::writeTokencxx . . $ lemon/_writer_bits/writeToken(b1020aba89db397c).(*_oscxx . . $ lemon/GraphWriter#_os. <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). ' ', _edges_captioncxx . . $ lemon/GraphWriter#_edges_caption.); |
| 1461 | } |
| 1462 | *_oscxx . . $ lemon/GraphWriter#_os. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 1463 | |
| 1464 | *_oscxx . . $ lemon/GraphWriter#_os. <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). '\t' <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). '\t'; |
| 1465 | if (label == 0) { |
| 1466 | *_oscxx . . $ lemon/GraphWriter#_os. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "label" <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). '\t'; |
| 1467 | } |
| 1468 | for (typename EdgeMapscxx . . $ lemon/GraphWriter#EdgeMaps#::iterator it = _edge_mapscxx . . $ lemon/GraphWriter#_edge_maps..begincxx . . $ std/vector#begin(55a6de06420d4903).(); |
| 1469 | it != _edge_mapscxx . . $ lemon/GraphWriter#_edge_maps..endcxx . . $ std/vector#end(d1e1699016b9d7e6).(); ++it) { |
| 1470 | _writer_bitscxx . . $ lemon/_writer_bits/::writeTokencxx . . $ lemon/_writer_bits/writeToken(b1020aba89db397c).(*_oscxx . . $ lemon/GraphWriter#_os., it->first) << '\t'; |
| 1471 | } |
| 1472 | *_oscxx . . $ lemon/GraphWriter#_os. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 1473 | |
| 1474 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<Edgecxx . . $ lemon/GraphWriter#Edge#> edges; |
| 1475 | for (EdgeItcxx . . $ lemon/GraphWriter#EdgeIt# n(_graphcxx . . $ lemon/GraphWriter#_graph.); n != INVALIDcxx . . $ lemon/INVALID.; ++n) { |
| 1476 | edges.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(n); |
| 1477 | } |
| 1478 | |
| 1479 | if (label == 0) { |
| 1480 | IdMapcxx . . $ lemon/IdMap#<GR, Edgecxx . . $ lemon/GraphWriter#Edge#> id_map(_graphcxx . . $ lemon/GraphWriter#_graph.); |
| 1481 | _writer_bitscxx . . $ lemon/_writer_bits/::MapLesscxx . . $ lemon/_writer_bits/MapLess#<IdMapcxx . . $ lemon/IdMap#<GR, Edgecxx . . $ lemon/GraphWriter#Edge#> > id_less(id_map); |
| 1482 | stdcxx . . $ std/::sortcxx . . $ std/sort(1b056e85f3afd146).(edges.begincxx . . $ std/vector#begin(d1e1699016b9d7e6).(), edges.endcxx . . $ std/vector#end(55a6de06420d4903).(), id_less); |
| 1483 | } else { |
| 1484 | label->sortcxx . . $ lemon/_writer_bits/MapStorageBase#sort(efb54ab086463856).(edges); |
| 1485 | } |
| 1486 | |
| 1487 | for (int i = 0; i < static_cast<int>(edges.sizecxx . . $ std/vector#size(c9b1e749b64d5edc).()); ++i) { |
| 1488 | Edgecxx . . $ lemon/GraphWriter#Edge# e = edges[i]; |
| 1489 | _writer_bitscxx . . $ lemon/_writer_bits/::writeTokencxx . . $ lemon/_writer_bits/writeToken(b1020aba89db397c).(*_oscxx . . $ lemon/GraphWriter#_os., _node_indexcxx . . $ lemon/GraphWriter#_node_index.. |
| 1490 | findcxx . . $ std/map#find(10b5259e992a5e20).(_graphcxx . . $ lemon/GraphWriter#_graph..u(e))->second); |
| 1491 | *_oscxx . . $ lemon/GraphWriter#_os. <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). '\t'; |
| 1492 | _writer_bitscxx . . $ lemon/_writer_bits/::writeTokencxx . . $ lemon/_writer_bits/writeToken(b1020aba89db397c).(*_oscxx . . $ lemon/GraphWriter#_os., _node_indexcxx . . $ lemon/GraphWriter#_node_index.. |
| 1493 | findcxx . . $ std/map#find(93703e90eb593a7f).(_graphcxx . . $ lemon/GraphWriter#_graph..v(e))->second); |
| 1494 | *_oscxx . . $ lemon/GraphWriter#_os. <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). '\t'; |
| 1495 | if (label == 0) { |
| 1496 | stdcxx . . $ std/::ostringstreamcxx . . $ std/ostringstream# oscxx . . $ std/__cxx11/basic_ostringstream#basic_ostringstream(49f6e7a06ebc5aa8).; |
| 1497 | os << _graphcxx . . $ lemon/GraphWriter#_graph..id(e); |
| 1498 | _writer_bitscxx . . $ lemon/_writer_bits/::writeTokencxx . . $ lemon/_writer_bits/writeToken(b1020aba89db397c).(*_oscxx . . $ lemon/GraphWriter#_os., os.strcxx . . $ std/__cxx11/basic_ostringstream#str(d33e1a6fd36255f7).()); |
| 1499 | *_oscxx . . $ lemon/GraphWriter#_os. <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). '\t'; |
| 1500 | _edge_indexcxx . . $ lemon/GraphWriter#_edge_index..insertcxx . . $ std/map#insert(7843218f68f64a61).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(e, os.strcxx . . $ std/__cxx11/basic_ostringstream#str(d33e1a6fd36255f7).())); |
| 1501 | } |
| 1502 | for (typename EdgeMapscxx . . $ lemon/GraphWriter#EdgeMaps#::iterator it = _edge_mapscxx . . $ lemon/GraphWriter#_edge_maps..begincxx . . $ std/vector#begin(55a6de06420d4903).(); |
| 1503 | it != _edge_mapscxx . . $ lemon/GraphWriter#_edge_maps..endcxx . . $ std/vector#end(55a6de06420d4903).(); ++it) { |
| 1504 | stdcxx . . $ std/::stringcxx . . $ std/string# value = it->second->get(e); |
| 1505 | _writer_bitscxx . . $ lemon/_writer_bits/::writeTokencxx . . $ lemon/_writer_bits/writeToken(b1020aba89db397c).(*_oscxx . . $ lemon/GraphWriter#_os., value); |
| 1506 | if (it->first == "label") { |
| 1507 | _edge_indexcxx . . $ lemon/GraphWriter#_edge_index..insertcxx . . $ std/map#insert(50ef72ff69bc573d).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(e, value)); |
| 1508 | } |
| 1509 | *_oscxx . . $ lemon/GraphWriter#_os. <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). '\t'; |
| 1510 | } |
| 1511 | *_oscxx . . $ lemon/GraphWriter#_os. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 1512 | } |
| 1513 | } |
| 1514 | |
| 1515 | void createEdgeIndexcxx . . $ lemon/GraphWriter#createEdgeIndex(49f6e7a06ebc5aa8).() { |
| 1516 | _writer_bitscxx . . $ lemon/_writer_bits/::MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<Edgecxx . . $ lemon/GraphWriter#Edge#>* label = 0; |
| 1517 | for (typename EdgeMapscxx . . $ lemon/GraphWriter#EdgeMaps#::iterator it = _edge_mapscxx . . $ lemon/GraphWriter#_edge_maps..begincxx . . $ std/vector#begin(d1e1699016b9d7e6).(); |
| 1518 | it != _edge_mapscxx . . $ lemon/GraphWriter#_edge_maps..endcxx . . $ std/vector#end(55a6de06420d4903).(); ++it) { |
| 1519 | if (it->first == "label") { |
| 1520 | label = it->second; |
| 1521 | break; |
| 1522 | } |
| 1523 | } |
| 1524 | |
| 1525 | if (label == 0) { |
| 1526 | for (EdgeItcxx . . $ lemon/GraphWriter#EdgeIt# e(_graphcxx . . $ lemon/GraphWriter#_graph.); e != INVALIDcxx . . $ lemon/INVALID.; ++e) { |
| 1527 | stdcxx . . $ std/::ostringstreamcxx . . $ std/ostringstream# oscxx . . $ std/__cxx11/basic_ostringstream#basic_ostringstream(49f6e7a06ebc5aa8).; |
| 1528 | os << _graphcxx . . $ lemon/GraphWriter#_graph..id(e); |
| 1529 | _edge_indexcxx . . $ lemon/GraphWriter#_edge_index..insertcxx . . $ std/map#insert(cd8975477e12dde2).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(e, os.strcxx . . $ std/__cxx11/basic_ostringstream#str(d33e1a6fd36255f7).())); |
| 1530 | } |
| 1531 | } else { |
| 1532 | for (EdgeItcxx . . $ lemon/GraphWriter#EdgeIt# e(_graphcxx . . $ lemon/GraphWriter#_graph.); e != INVALIDcxx . . $ lemon/INVALID.; ++e) { |
| 1533 | stdcxx . . $ std/::stringcxx . . $ std/string# value = label->getcxx . . $ lemon/_writer_bits/MapStorageBase#get(23b83986b497e4d5).(e); |
| 1534 | _edge_indexcxx . . $ lemon/GraphWriter#_edge_index..insertcxx . . $ std/map#insert(f1d6a7bdcb7d7743).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(e, value)); |
| 1535 | } |
| 1536 | } |
| 1537 | } |
| 1538 | |
| 1539 | void writeAttributescxx . . $ lemon/GraphWriter#writeAttributes(49f6e7a06ebc5aa8).() { |
| 1540 | if (_attributescxx . . $ lemon/GraphWriter#_attributes..emptycxx . . $ std/vector#empty(3482b152b9333168).()) return; |
| 1541 | *_oscxx . . $ lemon/GraphWriter#_os. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "@attributes"; |
| 1542 | if (!_attributes_captioncxx . . $ lemon/GraphWriter#_attributes_caption..emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).()) { |
| 1543 | _writer_bitscxx . . $ lemon/_writer_bits/::writeTokencxx . . $ lemon/_writer_bits/writeToken(b1020aba89db397c).(*_oscxx . . $ lemon/GraphWriter#_os. <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). ' ', _attributes_captioncxx . . $ lemon/GraphWriter#_attributes_caption.); |
| 1544 | } |
| 1545 | *_oscxx . . $ lemon/GraphWriter#_os. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 1546 | for (typename Attributescxx . . $ lemon/GraphWriter#Attributes#::iteratorcxx . . $ std/vector#iterator# it = _attributescxx . . $ lemon/GraphWriter#_attributes..begincxx . . $ std/vector#begin(55a6de06420d4903).(); |
| 1547 | it !=cxx . . $ __gnu_cxx/`operator!=`(30ee64f2df4eef8b). _attributescxx . . $ lemon/GraphWriter#_attributes..endcxx . . $ std/vector#end(55a6de06420d4903).(); ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(1613faa01bc3d014).it) { |
| 1548 | _writer_bitscxx . . $ lemon/_writer_bits/::writeTokencxx . . $ lemon/_writer_bits/writeToken(b1020aba89db397c).(*_oscxx . . $ lemon/GraphWriter#_os., it->cxx . . $ __gnu_cxx/__normal_iterator#`operator->`(65c2ec7035a77d3e).firstcxx . . $ std/pair#first.) <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). ' '; |
| 1549 | _writer_bitscxx . . $ lemon/_writer_bits/::writeTokencxx . . $ lemon/_writer_bits/writeToken(b1020aba89db397c).(*_oscxx . . $ lemon/GraphWriter#_os., it->cxx . . $ __gnu_cxx/__normal_iterator#`operator->`(65c2ec7035a77d3e).secondcxx . . $ std/pair#second.->getcxx . . $ lemon/_writer_bits/ValueStorageBase#get(efd28698952f529a).()); |
| 1550 | *_oscxx . . $ lemon/GraphWriter#_os. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 1551 | } |
| 1552 | } |
| 1553 | |
| 1554 | public: |
| 1555 | |
| 1556 | /// \name Execution of the Writer |
| 1557 | /// @{ |
| 1558 | |
| 1559 | /// \brief Start the batch processing |
| 1560 | /// |
| 1561 | /// This function starts the batch processing. |
| 1562 | void runcxx . . $ lemon/GraphWriter#run(49f6e7a06ebc5aa8).() { |
| 1563 | if (!_skip_nodescxx . . $ lemon/GraphWriter#_skip_nodes.) { |
| 1564 | writeNodescxx . . $ lemon/GraphWriter#writeNodes(49f6e7a06ebc5aa8).(); |
| 1565 | } else { |
| 1566 | createNodeIndexcxx . . $ lemon/GraphWriter#createNodeIndex(49f6e7a06ebc5aa8).(); |
| 1567 | } |
| 1568 | if (!_skip_edgescxx . . $ lemon/GraphWriter#_skip_edges.) { |
| 1569 | writeEdgescxx . . $ lemon/GraphWriter#writeEdges(49f6e7a06ebc5aa8).(); |
| 1570 | } else { |
| 1571 | createEdgeIndexcxx . . $ lemon/GraphWriter#createEdgeIndex(49f6e7a06ebc5aa8).(); |
| 1572 | } |
| 1573 | writeAttributescxx . . $ lemon/GraphWriter#writeAttributes(49f6e7a06ebc5aa8).(); |
| 1574 | } |
| 1575 | |
| 1576 | /// \brief Give back the stream of the writer |
| 1577 | /// |
| 1578 | /// Give back the stream of the writer |
| 1579 | stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& ostreamcxx . . $ lemon/GraphWriter#ostream(3094c9a1b678da92).() { |
| 1580 | return *_oscxx . . $ lemon/GraphWriter#_os.; |
| 1581 | } |
| 1582 | |
| 1583 | /// @} |
| 1584 | }; |
| 1585 | |
| 1586 | /// \ingroup lemon_io |
| 1587 | /// |
| 1588 | /// \brief Return a \ref lemon::GraphWriter "GraphWriter" class |
| 1589 | /// |
| 1590 | /// This function just returns a \ref lemon::GraphWriter "GraphWriter" class. |
| 1591 | /// |
| 1592 | /// With this function a graph can be write to a file or output |
| 1593 | /// stream in \ref lgf-format "LGF" format with several maps and |
| 1594 | /// attributes. For example, with the following code a weighted |
| 1595 | /// matching problem can be written to the standard output, i.e. a |
| 1596 | /// graph with a \e weight map on the edges: |
| 1597 | /// |
| 1598 | ///\code |
| 1599 | ///ListGraph graph; |
| 1600 | ///ListGraph::EdgeMap<int> weight(graph); |
| 1601 | /// // Setting the weight map |
| 1602 | ///graphWriter(graph, std::cout). |
| 1603 | /// edgeMap("weight", weight). |
| 1604 | /// run(); |
| 1605 | ///\endcode |
| 1606 | /// |
| 1607 | /// For a complete documentation, please see the |
| 1608 | /// \ref lemon::GraphWriter "GraphWriter" |
| 1609 | /// class documentation. |
| 1610 | /// \warning Don't forget to put the \ref lemon::GraphWriter::run() "run()" |
| 1611 | /// to the end of the parameter list. |
| 1612 | /// \relates GraphWriter |
| 1613 | /// \sa graphWriter(const TGR& graph, const std::string& fn) |
| 1614 | /// \sa graphWriter(const TGR& graph, const char* fn) |
| 1615 | template <typename TGR> |
| 1616 | GraphWritercxx . . $ lemon/GraphWriter#<TGR> graphWritercxx . . $ lemon/graphWriter(7d7d23f7834e9ee3).(const TGR& graph, stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& os) { |
| 1617 | GraphWritercxx . . $ lemon/GraphWriter#<TGR> tmp(graph, os); |
| 1618 | return tmp; |
| 1619 | } |
| 1620 | |
| 1621 | /// \brief Return a \ref GraphWriter class |
| 1622 | /// |
| 1623 | /// This function just returns a \ref GraphWriter class. |
| 1624 | /// \relates GraphWriter |
| 1625 | /// \sa graphWriter(const TGR& graph, std::ostream& os) |
| 1626 | template <typename TGR> |
| 1627 | GraphWritercxx . . $ lemon/GraphWriter#<TGR> graphWritercxx . . $ lemon/graphWriter(9162b5f170578eac).(const TGR& graph, const stdcxx . . $ std/::stringcxx . . $ std/string#& fn) { |
| 1628 | GraphWritercxx . . $ lemon/GraphWriter#<TGR> tmp(graph, fn); |
| 1629 | return tmp; |
| 1630 | } |
| 1631 | |
| 1632 | /// \brief Return a \ref GraphWriter class |
| 1633 | /// |
| 1634 | /// This function just returns a \ref GraphWriter class. |
| 1635 | /// \relates GraphWriter |
| 1636 | /// \sa graphWriter(const TGR& graph, std::ostream& os) |
| 1637 | template <typename TGR> |
| 1638 | GraphWritercxx . . $ lemon/GraphWriter#<TGR> graphWritercxx . . $ lemon/graphWriter(c6729b551cbf56d4).(const TGR& graph, const char* fn) { |
| 1639 | GraphWritercxx . . $ lemon/GraphWriter#<TGR> tmp(graph, fn); |
| 1640 | return tmp; |
| 1641 | } |
| 1642 | |
| 1643 | template <typename BGR> |
| 1644 | class BpGraphWritercxx . . $ lemon/BpGraphWriter#; |
| 1645 | |
| 1646 | template <typename TBGR> |
| 1647 | BpGraphWritercxx . . $ lemon/BpGraphWriter#<TBGR> bpGraphWritercxx . . $ lemon/bpGraphWriter(f7f20be7edd9a974).(const TBGR& graph, |
| 1648 | stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& os = stdcxx . . $ std/::coutcxx . . $ std/cout.); |
| 1649 | template <typename TBGR> |
| 1650 | BpGraphWritercxx . . $ lemon/BpGraphWriter#<TBGR> bpGraphWritercxx . . $ lemon/bpGraphWriter(1e45cda9b1adcb47).(const TBGR& graph, const stdcxx . . $ std/::stringcxx . . $ std/string#& fn); |
| 1651 | template <typename TBGR> |
| 1652 | BpGraphWritercxx . . $ lemon/BpGraphWriter#<TBGR> bpGraphWritercxx . . $ lemon/bpGraphWriter(6d6934745ed9c5b7).(const TBGR& graph, const char* fn); |
| 1653 | |
| 1654 | /// \ingroup lemon_io |
| 1655 | /// |
| 1656 | /// \brief \ref lgf-format "LGF" writer for undirected bipartite graphs |
| 1657 | /// |
| 1658 | /// This utility writes an \ref lgf-format "LGF" file. |
| 1659 | /// |
| 1660 | /// It can be used almost the same way as \c GraphWriter, but it |
| 1661 | /// reads the red and blue nodes from separate sections, and these |
| 1662 | /// sections can contain different set of maps. |
| 1663 | /// |
| 1664 | /// The red and blue node maps are written to the corresponding |
| 1665 | /// sections. The node maps are written to both of these sections |
| 1666 | /// with the same map name. |
| 1667 | template <typename BGR> |
| 1668 | class BpGraphWritercxx . . $ lemon/BpGraphWriter# { |
| 1669 | public: |
| 1670 | |
| 1671 | typedef BGR BpGraphcxx . . $ lemon/BpGraphWriter#BpGraph#; |
| 1672 | TEMPLATE_BPGRAPH_TYPEDEFScxx . . $ lemon/BpGraphWriter#BlueNodeIt#(BGR); |
| 1673 | |
| 1674 | private: |
| 1675 | |
| 1676 | |
| 1677 | stdcxx . . $ std/::ostreamcxx . . $ std/ostream#* _oscxx . . $ lemon/BpGraphWriter#_os.; |
| 1678 | bool local_oscxx . . $ lemon/BpGraphWriter#local_os.; |
| 1679 | |
| 1680 | const BGR& _graphcxx . . $ lemon/BpGraphWriter#_graph.; |
| 1681 | |
| 1682 | stdcxx . . $ std/::stringcxx . . $ std/string# _nodes_captioncxx . . $ lemon/BpGraphWriter#_nodes_caption.; |
| 1683 | stdcxx . . $ std/::stringcxx . . $ std/string# _edges_captioncxx . . $ lemon/BpGraphWriter#_edges_caption.; |
| 1684 | stdcxx . . $ std/::stringcxx . . $ std/string# _attributes_captioncxx . . $ lemon/BpGraphWriter#_attributes_caption.; |
| 1685 | |
| 1686 | typedef stdcxx . . $ std/::mapcxx . . $ std/map#<Nodecxx . . $ lemon/BpGraphWriter#Node#, stdcxx . . $ std/::stringcxx . . $ std/string#> RedNodeIndexcxx . . $ lemon/BpGraphWriter#RedNodeIndex#; |
| 1687 | RedNodeIndexcxx . . $ lemon/BpGraphWriter#RedNodeIndex# _red_node_indexcxx . . $ lemon/BpGraphWriter#_red_node_index.; |
| 1688 | typedef stdcxx . . $ std/::mapcxx . . $ std/map#<Nodecxx . . $ lemon/BpGraphWriter#Node#, stdcxx . . $ std/::stringcxx . . $ std/string#> BlueNodeIndexcxx . . $ lemon/BpGraphWriter#BlueNodeIndex#; |
| 1689 | BlueNodeIndexcxx . . $ lemon/BpGraphWriter#BlueNodeIndex# _blue_node_indexcxx . . $ lemon/BpGraphWriter#_blue_node_index.; |
| 1690 | typedef stdcxx . . $ std/::mapcxx . . $ std/map#<Edgecxx . . $ lemon/BpGraphWriter#Edge#, stdcxx . . $ std/::stringcxx . . $ std/string#> EdgeIndexcxx . . $ lemon/BpGraphWriter#EdgeIndex#; |
| 1691 | EdgeIndexcxx . . $ lemon/BpGraphWriter#EdgeIndex# _edge_indexcxx . . $ lemon/BpGraphWriter#_edge_index.; |
| 1692 | |
| 1693 | typedef stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::paircxx . . $ std/pair#<stdcxx . . $ std/::stringcxx . . $ std/string#, |
| 1694 | _writer_bitscxx . . $ lemon/_writer_bits/::MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<RedNodecxx . . $ lemon/BpGraphWriter#RedNode#>* > > RedNodeMapscxx . . $ lemon/BpGraphWriter#RedNodeMaps#; |
| 1695 | RedNodeMapscxx . . $ lemon/BpGraphWriter#RedNodeMaps# _red_node_mapscxx . . $ lemon/BpGraphWriter#_red_node_maps.; |
| 1696 | typedef stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::paircxx . . $ std/pair#<stdcxx . . $ std/::stringcxx . . $ std/string#, |
| 1697 | _writer_bitscxx . . $ lemon/_writer_bits/::MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<BlueNodecxx . . $ lemon/BpGraphWriter#BlueNode#>* > > BlueNodeMapscxx . . $ lemon/BpGraphWriter#BlueNodeMaps#; |
| 1698 | BlueNodeMapscxx . . $ lemon/BpGraphWriter#BlueNodeMaps# _blue_node_mapscxx . . $ lemon/BpGraphWriter#_blue_node_maps.; |
| 1699 | |
| 1700 | typedef stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::paircxx . . $ std/pair#<stdcxx . . $ std/::stringcxx . . $ std/string#, |
| 1701 | _writer_bitscxx . . $ lemon/_writer_bits/::MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<Edgecxx . . $ lemon/BpGraphWriter#Edge#>* > >EdgeMapscxx . . $ lemon/BpGraphWriter#EdgeMaps#; |
| 1702 | EdgeMapscxx . . $ lemon/BpGraphWriter#EdgeMaps# _edge_mapscxx . . $ lemon/BpGraphWriter#_edge_maps.; |
| 1703 | |
| 1704 | typedef stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::paircxx . . $ std/pair#<stdcxx . . $ std/::stringcxx . . $ std/string#, |
| 1705 | _writer_bitscxx . . $ lemon/_writer_bits/::ValueStorageBasecxx . . $ lemon/_writer_bits/ValueStorageBase#*> > Attributescxx . . $ lemon/BpGraphWriter#Attributes#; |
| 1706 | Attributescxx . . $ lemon/BpGraphWriter#Attributes# _attributescxx . . $ lemon/BpGraphWriter#_attributes.; |
| 1707 | |
| 1708 | bool _skip_nodescxx . . $ lemon/BpGraphWriter#_skip_nodes.; |
| 1709 | bool _skip_edgescxx . . $ lemon/BpGraphWriter#_skip_edges.; |
| 1710 | |
| 1711 | public: |
| 1712 | |
| 1713 | /// \brief Constructor |
| 1714 | /// |
| 1715 | /// Construct a bipartite graph writer, which writes to the given |
| 1716 | /// output stream. |
| 1717 | BpGraphWritercxx . . $ lemon/BpGraphWriter#`BpGraphWriter<BGR>`(cd5921fea08118f1).(const BGR& graph, stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& os = stdcxx . . $ std/::coutcxx . . $ std/cout.) |
| 1718 | : _oscxx . . $ lemon/BpGraphWriter#_os.(&os), local_oscxx . . $ lemon/BpGraphWriter#local_os.(false), _graphcxx . . $ lemon/BpGraphWriter#_graph.(graph), |
| 1719 | _skip_nodescxx . . $ lemon/BpGraphWriter#_skip_nodes.(false), _skip_edgescxx . . $ lemon/BpGraphWriter#_skip_edges.(false) {} |
| 1720 | |
| 1721 | /// \brief Constructor |
| 1722 | /// |
| 1723 | /// Construct a bipartite graph writer, which writes to the given |
| 1724 | /// output file. |
| 1725 | BpGraphWritercxx . . $ lemon/BpGraphWriter#`BpGraphWriter<BGR>`(a303ec4ca7cd6081).(const BGR& graph, const stdcxx . . $ std/::stringcxx . . $ std/string#& fn) |
| 1726 | : _oscxx . . $ lemon/BpGraphWriter#_os.(new stdcxx . . $ std/::ofstreamcxx . . $ std/ofstream#(fn.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).())), local_oscxx . . $ lemon/BpGraphWriter#local_os.(true), _graphcxx . . $ lemon/BpGraphWriter#_graph.(graph), |
| 1727 | _skip_nodescxx . . $ lemon/BpGraphWriter#_skip_nodes.(false), _skip_edgescxx . . $ lemon/BpGraphWriter#_skip_edges.(false) { |
| 1728 | if (!cxx . . $ std/basic_ios#`operator!`(50ce9a9e25b4a850).(*_oscxx . . $ lemon/BpGraphWriter#_os.)) { |
| 1729 | delete _oscxx . . $ lemon/BpGraphWriter#_os.; |
| 1730 | throw IoErrorcxx . . $ lemon/IoError#("Cannot write file", fn); |
| 1731 | } |
| 1732 | } |
| 1733 | |
| 1734 | /// \brief Constructor |
| 1735 | /// |
| 1736 | /// Construct a bipartite graph writer, which writes to the given |
| 1737 | /// output file. |
| 1738 | BpGraphWritercxx . . $ lemon/BpGraphWriter#`BpGraphWriter<BGR>`(4e234f26c19d7452).(const BGR& graph, const char* fn) |
| 1739 | : _oscxx . . $ lemon/BpGraphWriter#_os.(new stdcxx . . $ std/basic_ofstream#basic_ofstream(b8cd37071ce335df).::ofstreamcxx . . $ std/ofstream#(fn)), local_oscxx . . $ lemon/BpGraphWriter#local_os.(true), _graphcxx . . $ lemon/BpGraphWriter#_graph.(graph), |
| 1740 | _skip_nodescxx . . $ lemon/BpGraphWriter#_skip_nodes.(false), _skip_edgescxx . . $ lemon/BpGraphWriter#_skip_edges.(false) { |
| 1741 | if (!cxx . . $ std/basic_ios#`operator!`(50ce9a9e25b4a850).(*_oscxx . . $ lemon/BpGraphWriter#_os.)) { |
| 1742 | delete _oscxx . . $ lemon/BpGraphWriter#_os.; |
| 1743 | throw IoErrorcxx . . $ lemon/IoError#("Cannot write file", fncxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).); |
| 1744 | } |
| 1745 | } |
| 1746 | |
| 1747 | /// \brief Destructor |
| 1748 | ~cxx . . $ lemon/BpGraphWriter#`~BpGraphWriter<BGR>`(49f6e7a06ebc5aa8).BpGraphWriter() { |
| 1749 | for (typename RedNodeMapscxx . . $ lemon/BpGraphWriter#RedNodeMaps#::iterator it = _red_node_mapscxx . . $ lemon/BpGraphWriter#_red_node_maps..begincxx . . $ std/vector#begin(55a6de06420d4903).(); |
| 1750 | it != _red_node_mapscxx . . $ lemon/BpGraphWriter#_red_node_maps..endcxx . . $ std/vector#end(55a6de06420d4903).(); ++it) { |
| 1751 | delete it->second; |
| 1752 | } |
| 1753 | |
| 1754 | for (typename BlueNodeMapscxx . . $ lemon/BpGraphWriter#BlueNodeMaps#::iterator it = _blue_node_mapscxx . . $ lemon/BpGraphWriter#_blue_node_maps..begincxx . . $ std/vector#begin(55a6de06420d4903).(); |
| 1755 | it != _blue_node_mapscxx . . $ lemon/BpGraphWriter#_blue_node_maps..endcxx . . $ std/vector#end(d1e1699016b9d7e6).(); ++it) { |
| 1756 | delete it->second; |
| 1757 | } |
| 1758 | |
| 1759 | for (typename EdgeMapscxx . . $ lemon/BpGraphWriter#EdgeMaps#::iterator it = _edge_mapscxx . . $ lemon/BpGraphWriter#_edge_maps..begincxx . . $ std/vector#begin(d1e1699016b9d7e6).(); |
| 1760 | it != _edge_mapscxx . . $ lemon/BpGraphWriter#_edge_maps..endcxx . . $ std/vector#end(55a6de06420d4903).(); ++it) { |
| 1761 | delete it->second; |
| 1762 | } |
| 1763 | |
| 1764 | for (typename Attributescxx . . $ lemon/BpGraphWriter#Attributes#::iteratorcxx . . $ std/vector#iterator# it = _attributescxx . . $ lemon/BpGraphWriter#_attributes..begincxx . . $ std/vector#begin(55a6de06420d4903).(); |
| 1765 | it !=cxx . . $ __gnu_cxx/`operator!=`(30ee64f2df4eef8b). _attributescxx . . $ lemon/BpGraphWriter#_attributes..endcxx . . $ std/vector#end(55a6de06420d4903).(); ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(1613faa01bc3d014).it) { |
| 1766 | delete it->cxx . . $ __gnu_cxx/__normal_iterator#`operator->`(65c2ec7035a77d3e).secondcxx . . $ std/pair#second.; |
| 1767 | } |
| 1768 | |
| 1769 | if (local_oscxx . . $ lemon/BpGraphWriter#local_os.) { |
| 1770 | delete _oscxx . . $ lemon/BpGraphWriter#_os.; |
| 1771 | } |
| 1772 | } |
| 1773 | |
| 1774 | private: |
| 1775 | |
| 1776 | template <typename TBGR> |
| 1777 | friend BpGraphWritercxx . . $ lemon/BpGraphWriter#<TBGR> bpGraphWritercxx . . $ lemon/bpGraphWriter(39970dd446b84a0f).(const TBGR& graph, |
| 1778 | stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& os); |
| 1779 | template <typename TBGR> |
| 1780 | friend BpGraphWritercxx . . $ lemon/BpGraphWriter#<TBGR> bpGraphWritercxx . . $ lemon/bpGraphWriter(f38a4f751e015dd2).(const TBGR& graph, |
| 1781 | const stdcxx . . $ std/::stringcxx . . $ std/string#& fn); |
| 1782 | template <typename TBGR> |
| 1783 | friend BpGraphWritercxx . . $ lemon/BpGraphWriter#<TBGR> bpGraphWritercxx . . $ lemon/bpGraphWriter(96165343474ff59e).(const TBGR& graph, const char *fn); |
| 1784 | |
| 1785 | BpGraphWritercxx . . $ lemon/BpGraphWriter#`BpGraphWriter<BGR>`(957a29ba09bfd5d7).(BpGraphWriter& other) |
| 1786 | : _oscxx . . $ lemon/BpGraphWriter#_os.(other._oscxx . . $ lemon/BpGraphWriter#_os.), local_oscxx . . $ lemon/BpGraphWriter#local_os.(other.local_oscxx . . $ lemon/BpGraphWriter#local_os.), _graphcxx . . $ lemon/BpGraphWriter#_graph.(other._graphcxx . . $ lemon/BpGraphWriter#_graph.), |
| 1787 | _skip_nodescxx . . $ lemon/BpGraphWriter#_skip_nodes.(other._skip_nodescxx . . $ lemon/BpGraphWriter#_skip_nodes.), _skip_edgescxx . . $ lemon/BpGraphWriter#_skip_edges.(other._skip_edgescxx . . $ lemon/BpGraphWriter#_skip_edges.) { |
| 1788 | |
| 1789 | other._oscxx . . $ lemon/BpGraphWriter#_os. = 0; |
| 1790 | other.local_oscxx . . $ lemon/BpGraphWriter#local_os. = false; |
| 1791 | |
| 1792 | _red_node_indexcxx . . $ lemon/BpGraphWriter#_red_node_index..swapcxx . . $ std/map#swap(6db4dfdbe2a5e125).(other._red_node_indexcxx . . $ lemon/BpGraphWriter#_red_node_index.); |
| 1793 | _blue_node_indexcxx . . $ lemon/BpGraphWriter#_blue_node_index..swapcxx . . $ std/map#swap(6db4dfdbe2a5e125).(other._blue_node_indexcxx . . $ lemon/BpGraphWriter#_blue_node_index.); |
| 1794 | _edge_indexcxx . . $ lemon/BpGraphWriter#_edge_index..swapcxx . . $ std/map#swap(6db4dfdbe2a5e125).(other._edge_indexcxx . . $ lemon/BpGraphWriter#_edge_index.); |
| 1795 | |
| 1796 | _red_node_mapscxx . . $ lemon/BpGraphWriter#_red_node_maps..swapcxx . . $ std/vector#swap(319777021b21d7dd).(other._red_node_mapscxx . . $ lemon/BpGraphWriter#_red_node_maps.); |
| 1797 | _blue_node_mapscxx . . $ lemon/BpGraphWriter#_blue_node_maps..swapcxx . . $ std/vector#swap(319777021b21d7dd).(other._blue_node_mapscxx . . $ lemon/BpGraphWriter#_blue_node_maps.); |
| 1798 | _edge_mapscxx . . $ lemon/BpGraphWriter#_edge_maps..swapcxx . . $ std/vector#swap(319777021b21d7dd).(other._edge_mapscxx . . $ lemon/BpGraphWriter#_edge_maps.); |
| 1799 | _attributescxx . . $ lemon/BpGraphWriter#_attributes..swapcxx . . $ std/vector#swap(319777021b21d7dd).(other._attributescxx . . $ lemon/BpGraphWriter#_attributes.); |
| 1800 | |
| 1801 | _nodes_captioncxx . . $ lemon/BpGraphWriter#_nodes_caption. =cxx . . $ std/__cxx11/basic_string#`operator=`(c0b47be1fddc0e75). other._nodes_captioncxx . . $ lemon/BpGraphWriter#_nodes_caption.; |
| 1802 | _edges_captioncxx . . $ lemon/BpGraphWriter#_edges_caption. =cxx . . $ std/__cxx11/basic_string#`operator=`(c0b47be1fddc0e75). other._edges_captioncxx . . $ lemon/BpGraphWriter#_edges_caption.; |
| 1803 | _attributes_captioncxx . . $ lemon/BpGraphWriter#_attributes_caption. =cxx . . $ std/__cxx11/basic_string#`operator=`(c0b47be1fddc0e75). other._attributes_captioncxx . . $ lemon/BpGraphWriter#_attributes_caption.; |
| 1804 | } |
| 1805 | |
| 1806 | BpGraphWriter& operatorcxx . . $ lemon/BpGraphWriter#`operator=`(5f32b74774e3693f).=(const BpGraphWriter&); |
| 1807 | |
| 1808 | public: |
| 1809 | |
| 1810 | /// \name Writing Rules |
| 1811 | /// @{ |
| 1812 | |
| 1813 | /// \brief Node map writing rule |
| 1814 | /// |
| 1815 | /// Add a node map writing rule to the writer. |
| 1816 | template <typename Map> |
| 1817 | BpGraphWriter& nodeMapcxx . . $ lemon/BpGraphWriter#nodeMap(c088722779396a5d).(const stdcxx . . $ std/::stringcxx . . $ std/string#& caption, const Map& map) { |
| 1818 | checkConceptcxx . . $ lemon/checkConcept(49f6e7a06ebc5aa8).<conceptscxx . . $ lemon/concepts/::ReadMapcxx . . $ lemon/concepts/ReadMap#<Nodecxx . . $ lemon/BpGraphWriter#Node#, typename Map::Value>, Map>(); |
| 1819 | _writer_bitscxx . . $ lemon/_writer_bits/::MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<RedNodecxx . . $ lemon/BpGraphWriter#RedNode#>* red_storage = |
| 1820 | new _writer_bitscxx . . $ lemon/_writer_bits/::MapStoragecxx . . $ lemon/_writer_bits/MapStorage#<RedNodecxx . . $ lemon/BpGraphWriter#RedNode#, Map>(map); |
| 1821 | _red_node_mapscxx . . $ lemon/BpGraphWriter#_red_node_maps..push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(caption, red_storage)); |
| 1822 | _writer_bitscxx . . $ lemon/_writer_bits/::MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<BlueNodecxx . . $ lemon/BpGraphWriter#BlueNode#>* blue_storage = |
| 1823 | new _writer_bitscxx . . $ lemon/_writer_bits/::MapStoragecxx . . $ lemon/_writer_bits/MapStorage#<BlueNodecxx . . $ lemon/BpGraphWriter#BlueNode#, Map>(map); |
| 1824 | _blue_node_mapscxx . . $ lemon/BpGraphWriter#_blue_node_maps..push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(caption, blue_storage)); |
| 1825 | return *this; |
| 1826 | } |
| 1827 | |
| 1828 | /// \brief Node map writing rule |
| 1829 | /// |
| 1830 | /// Add a node map writing rule with specialized converter to the |
| 1831 | /// writer. |
| 1832 | template <typename Map, typename Converter> |
| 1833 | BpGraphWriter& nodeMapcxx . . $ lemon/BpGraphWriter#nodeMap(5ff4d4a5c06ada95).(const stdcxx . . $ std/::stringcxx . . $ std/string#& caption, const Map& map, |
| 1834 | const Converter& converter = Converter()) { |
| 1835 | checkConceptcxx . . $ lemon/checkConcept(49f6e7a06ebc5aa8).<conceptscxx . . $ lemon/concepts/::ReadMapcxx . . $ lemon/concepts/ReadMap#<Nodecxx . . $ lemon/BpGraphWriter#Node#, typename Map::Value>, Map>(); |
| 1836 | _writer_bitscxx . . $ lemon/_writer_bits/::MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<RedNodecxx . . $ lemon/BpGraphWriter#RedNode#>* red_storage = |
| 1837 | new _writer_bitscxx . . $ lemon/_writer_bits/::MapStoragecxx . . $ lemon/_writer_bits/MapStorage#<RedNodecxx . . $ lemon/BpGraphWriter#RedNode#, Map, Converter>(map, converter); |
| 1838 | _red_node_mapscxx . . $ lemon/BpGraphWriter#_red_node_maps..push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(caption, red_storage)); |
| 1839 | _writer_bitscxx . . $ lemon/_writer_bits/::MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<BlueNodecxx . . $ lemon/BpGraphWriter#BlueNode#>* blue_storage = |
| 1840 | new _writer_bitscxx . . $ lemon/_writer_bits/::MapStoragecxx . . $ lemon/_writer_bits/MapStorage#<BlueNodecxx . . $ lemon/BpGraphWriter#BlueNode#, Map, Converter>(map, converter); |
| 1841 | _blue_node_mapscxx . . $ lemon/BpGraphWriter#_blue_node_maps..push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(caption, blue_storage)); |
| 1842 | return *this; |
| 1843 | } |
| 1844 | |
| 1845 | /// \brief Red node map writing rule |
| 1846 | /// |
| 1847 | /// Add a red node map writing rule to the writer. |
| 1848 | template <typename Map> |
| 1849 | BpGraphWriter& redNodeMapcxx . . $ lemon/BpGraphWriter#redNodeMap(c088722779396a5d).(const stdcxx . . $ std/::stringcxx . . $ std/string#& caption, const Map& map) { |
| 1850 | checkConceptcxx . . $ lemon/checkConcept(49f6e7a06ebc5aa8).<conceptscxx . . $ lemon/concepts/::ReadMapcxx . . $ lemon/concepts/ReadMap#<RedNodecxx . . $ lemon/BpGraphWriter#RedNode#, typename Map::Value>, Map>(); |
| 1851 | _writer_bitscxx . . $ lemon/_writer_bits/::MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<RedNodecxx . . $ lemon/BpGraphWriter#RedNode#>* storage = |
| 1852 | new _writer_bitscxx . . $ lemon/_writer_bits/::MapStoragecxx . . $ lemon/_writer_bits/MapStorage#<RedNodecxx . . $ lemon/BpGraphWriter#RedNode#, Map>(map); |
| 1853 | _red_node_mapscxx . . $ lemon/BpGraphWriter#_red_node_maps..push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(caption, storage)); |
| 1854 | return *this; |
| 1855 | } |
| 1856 | |
| 1857 | /// \brief Red node map writing rule |
| 1858 | /// |
| 1859 | /// Add a red node map writing rule with specialized converter to the |
| 1860 | /// writer. |
| 1861 | template <typename Map, typename Converter> |
| 1862 | BpGraphWriter& redNodeMapcxx . . $ lemon/BpGraphWriter#redNodeMap(5ff4d4a5c06ada95).(const stdcxx . . $ std/::stringcxx . . $ std/string#& caption, const Map& map, |
| 1863 | const Converter& converter = Converter()) { |
| 1864 | checkConceptcxx . . $ lemon/checkConcept(49f6e7a06ebc5aa8).<conceptscxx . . $ lemon/concepts/::ReadMapcxx . . $ lemon/concepts/ReadMap#<RedNodecxx . . $ lemon/BpGraphWriter#RedNode#, typename Map::Value>, Map>(); |
| 1865 | _writer_bitscxx . . $ lemon/_writer_bits/::MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<RedNodecxx . . $ lemon/BpGraphWriter#RedNode#>* storage = |
| 1866 | new _writer_bitscxx . . $ lemon/_writer_bits/::MapStoragecxx . . $ lemon/_writer_bits/MapStorage#<RedNodecxx . . $ lemon/BpGraphWriter#RedNode#, Map, Converter>(map, converter); |
| 1867 | _red_node_mapscxx . . $ lemon/BpGraphWriter#_red_node_maps..push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(caption, storage)); |
| 1868 | return *this; |
| 1869 | } |
| 1870 | |
| 1871 | /// \brief Blue node map writing rule |
| 1872 | /// |
| 1873 | /// Add a blue node map writing rule to the writer. |
| 1874 | template <typename Map> |
| 1875 | BpGraphWriter& blueNodeMapcxx . . $ lemon/BpGraphWriter#blueNodeMap(c088722779396a5d).(const stdcxx . . $ std/::stringcxx . . $ std/string#& caption, const Map& map) { |
| 1876 | checkConceptcxx . . $ lemon/checkConcept(49f6e7a06ebc5aa8).<conceptscxx . . $ lemon/concepts/::ReadMapcxx . . $ lemon/concepts/ReadMap#<BlueNodecxx . . $ lemon/BpGraphWriter#BlueNode#, typename Map::Value>, Map>(); |
| 1877 | _writer_bitscxx . . $ lemon/_writer_bits/::MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<BlueNodecxx . . $ lemon/BpGraphWriter#BlueNode#>* storage = |
| 1878 | new _writer_bitscxx . . $ lemon/_writer_bits/::MapStoragecxx . . $ lemon/_writer_bits/MapStorage#<BlueNodecxx . . $ lemon/BpGraphWriter#BlueNode#, Map>(map); |
| 1879 | _blue_node_mapscxx . . $ lemon/BpGraphWriter#_blue_node_maps..push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(caption, storage)); |
| 1880 | return *this; |
| 1881 | } |
| 1882 | |
| 1883 | /// \brief Blue node map writing rule |
| 1884 | /// |
| 1885 | /// Add a blue node map writing rule with specialized converter to the |
| 1886 | /// writer. |
| 1887 | template <typename Map, typename Converter> |
| 1888 | BpGraphWriter& blueNodeMapcxx . . $ lemon/BpGraphWriter#blueNodeMap(5ff4d4a5c06ada95).(const stdcxx . . $ std/::stringcxx . . $ std/string#& caption, const Map& map, |
| 1889 | const Converter& converter = Converter()) { |
| 1890 | checkConceptcxx . . $ lemon/checkConcept(49f6e7a06ebc5aa8).<conceptscxx . . $ lemon/concepts/::ReadMapcxx . . $ lemon/concepts/ReadMap#<BlueNodecxx . . $ lemon/BpGraphWriter#BlueNode#, typename Map::Value>, Map>(); |
| 1891 | _writer_bitscxx . . $ lemon/_writer_bits/::MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<BlueNodecxx . . $ lemon/BpGraphWriter#BlueNode#>* storage = |
| 1892 | new _writer_bitscxx . . $ lemon/_writer_bits/::MapStoragecxx . . $ lemon/_writer_bits/MapStorage#<BlueNodecxx . . $ lemon/BpGraphWriter#BlueNode#, Map, Converter>(map, converter); |
| 1893 | _blue_node_mapscxx . . $ lemon/BpGraphWriter#_blue_node_maps..push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(caption, storage)); |
| 1894 | return *this; |
| 1895 | } |
| 1896 | |
| 1897 | /// \brief Edge map writing rule |
| 1898 | /// |
| 1899 | /// Add an edge map writing rule to the writer. |
| 1900 | template <typename Map> |
| 1901 | BpGraphWriter& edgeMapcxx . . $ lemon/BpGraphWriter#edgeMap(c088722779396a5d).(const stdcxx . . $ std/::stringcxx . . $ std/string#& caption, const Map& map) { |
| 1902 | checkConceptcxx . . $ lemon/checkConcept(49f6e7a06ebc5aa8).<conceptscxx . . $ lemon/concepts/::ReadMapcxx . . $ lemon/concepts/ReadMap#<Edgecxx . . $ lemon/BpGraphWriter#Edge#, typename Map::Value>, Map>(); |
| 1903 | _writer_bitscxx . . $ lemon/_writer_bits/::MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<Edgecxx . . $ lemon/BpGraphWriter#Edge#>* storage = |
| 1904 | new _writer_bitscxx . . $ lemon/_writer_bits/::MapStoragecxx . . $ lemon/_writer_bits/MapStorage#<Edgecxx . . $ lemon/BpGraphWriter#Edge#, Map>(map); |
| 1905 | _edge_mapscxx . . $ lemon/BpGraphWriter#_edge_maps..push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(caption, storage)); |
| 1906 | return *this; |
| 1907 | } |
| 1908 | |
| 1909 | /// \brief Edge map writing rule |
| 1910 | /// |
| 1911 | /// Add an edge map writing rule with specialized converter to the |
| 1912 | /// writer. |
| 1913 | template <typename Map, typename Converter> |
| 1914 | BpGraphWriter& edgeMapcxx . . $ lemon/BpGraphWriter#edgeMap(5ff4d4a5c06ada95).(const stdcxx . . $ std/::stringcxx . . $ std/string#& caption, const Map& map, |
| 1915 | const Converter& converter = Converter()) { |
| 1916 | checkConceptcxx . . $ lemon/checkConcept(49f6e7a06ebc5aa8).<conceptscxx . . $ lemon/concepts/::ReadMapcxx . . $ lemon/concepts/ReadMap#<Edgecxx . . $ lemon/BpGraphWriter#Edge#, typename Map::Value>, Map>(); |
| 1917 | _writer_bitscxx . . $ lemon/_writer_bits/::MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<Edgecxx . . $ lemon/BpGraphWriter#Edge#>* storage = |
| 1918 | new _writer_bitscxx . . $ lemon/_writer_bits/::MapStoragecxx . . $ lemon/_writer_bits/MapStorage#<Edgecxx . . $ lemon/BpGraphWriter#Edge#, Map, Converter>(map, converter); |
| 1919 | _edge_mapscxx . . $ lemon/BpGraphWriter#_edge_maps..push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(caption, storage)); |
| 1920 | return *this; |
| 1921 | } |
| 1922 | |
| 1923 | /// \brief Arc map writing rule |
| 1924 | /// |
| 1925 | /// Add an arc map writing rule to the writer. |
| 1926 | template <typename Map> |
| 1927 | BpGraphWriter& arcMapcxx . . $ lemon/BpGraphWriter#arcMap(c088722779396a5d).(const stdcxx . . $ std/::stringcxx . . $ std/string#& caption, const Map& map) { |
| 1928 | checkConceptcxx . . $ lemon/checkConcept(49f6e7a06ebc5aa8).<conceptscxx . . $ lemon/concepts/::ReadMapcxx . . $ lemon/concepts/ReadMap#<Arccxx . . $ lemon/BpGraphWriter#Arc#, typename Map::Value>, Map>(); |
| 1929 | _writer_bitscxx . . $ lemon/_writer_bits/::MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<Edgecxx . . $ lemon/BpGraphWriter#Edge#>* forward_storage = |
| 1930 | new _writer_bitscxx . . $ lemon/_writer_bits/::GraphArcMapStoragecxx . . $ lemon/_writer_bits/GraphArcMapStorage#<BGR, true, Map>(_graphcxx . . $ lemon/BpGraphWriter#_graph., map); |
| 1931 | _edge_mapscxx . . $ lemon/BpGraphWriter#_edge_maps..push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).('+' +cxx . . $ std/operator+(67a84f929457cf92). caption, forward_storage)); |
| 1932 | _writer_bitscxx . . $ lemon/_writer_bits/::MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<Edgecxx . . $ lemon/BpGraphWriter#Edge#>* backward_storage = |
| 1933 | new _writer_bitscxx . . $ lemon/_writer_bits/::GraphArcMapStoragecxx . . $ lemon/_writer_bits/GraphArcMapStorage#<BGR, false, Map>(_graphcxx . . $ lemon/BpGraphWriter#_graph., map); |
| 1934 | _edge_mapscxx . . $ lemon/BpGraphWriter#_edge_maps..push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).('-' +cxx . . $ std/operator+(67a84f929457cf92). caption, backward_storage)); |
| 1935 | return *this; |
| 1936 | } |
| 1937 | |
| 1938 | /// \brief Arc map writing rule |
| 1939 | /// |
| 1940 | /// Add an arc map writing rule with specialized converter to the |
| 1941 | /// writer. |
| 1942 | template <typename Map, typename Converter> |
| 1943 | BpGraphWriter& arcMapcxx . . $ lemon/BpGraphWriter#arcMap(5ff4d4a5c06ada95).(const stdcxx . . $ std/::stringcxx . . $ std/string#& caption, const Map& map, |
| 1944 | const Converter& converter = Converter()) { |
| 1945 | checkConceptcxx . . $ lemon/checkConcept(49f6e7a06ebc5aa8).<conceptscxx . . $ lemon/concepts/::ReadMapcxx . . $ lemon/concepts/ReadMap#<Arccxx . . $ lemon/BpGraphWriter#Arc#, typename Map::Value>, Map>(); |
| 1946 | _writer_bitscxx . . $ lemon/_writer_bits/::MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<Edgecxx . . $ lemon/BpGraphWriter#Edge#>* forward_storage = |
| 1947 | new _writer_bitscxx . . $ lemon/_writer_bits/::GraphArcMapStoragecxx . . $ lemon/_writer_bits/GraphArcMapStorage#<BGR, true, Map, Converter> |
| 1948 | (_graphcxx . . $ lemon/BpGraphWriter#_graph., map, converter); |
| 1949 | _edge_mapscxx . . $ lemon/BpGraphWriter#_edge_maps..push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).('+' +cxx . . $ std/operator+(67a84f929457cf92). caption, forward_storage)); |
| 1950 | _writer_bitscxx . . $ lemon/_writer_bits/::MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<Edgecxx . . $ lemon/BpGraphWriter#Edge#>* backward_storage = |
| 1951 | new _writer_bitscxx . . $ lemon/_writer_bits/::GraphArcMapStoragecxx . . $ lemon/_writer_bits/GraphArcMapStorage#<BGR, false, Map, Converter> |
| 1952 | (_graphcxx . . $ lemon/BpGraphWriter#_graph., map, converter); |
| 1953 | _edge_mapscxx . . $ lemon/BpGraphWriter#_edge_maps..push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).('-' +cxx . . $ std/operator+(67a84f929457cf92). caption, backward_storage)); |
| 1954 | return *this; |
| 1955 | } |
| 1956 | |
| 1957 | /// \brief Attribute writing rule |
| 1958 | /// |
| 1959 | /// Add an attribute writing rule to the writer. |
| 1960 | template <typename Value> |
| 1961 | BpGraphWriter& attributecxx . . $ lemon/BpGraphWriter#attribute(c088722779396a5d).(const stdcxx . . $ std/::stringcxx . . $ std/string#& caption, const Value& value) { |
| 1962 | _writer_bitscxx . . $ lemon/_writer_bits/::ValueStorageBasecxx . . $ lemon/_writer_bits/ValueStorageBase#* storage = |
| 1963 | new _writer_bitscxx . . $ lemon/_writer_bits/::ValueStoragecxx . . $ lemon/_writer_bits/ValueStorage#<Value>(value); |
| 1964 | _attributescxx . . $ lemon/BpGraphWriter#_attributes..push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(caption, storage)); |
| 1965 | return *this; |
| 1966 | } |
| 1967 | |
| 1968 | /// \brief Attribute writing rule |
| 1969 | /// |
| 1970 | /// Add an attribute writing rule with specialized converter to the |
| 1971 | /// writer. |
| 1972 | template <typename Value, typename Converter> |
| 1973 | BpGraphWriter& attributecxx . . $ lemon/BpGraphWriter#attribute(5ff4d4a5c06ada95).(const stdcxx . . $ std/::stringcxx . . $ std/string#& caption, const Value& value, |
| 1974 | const Converter& converter = Converter()) { |
| 1975 | _writer_bitscxx . . $ lemon/_writer_bits/::ValueStorageBasecxx . . $ lemon/_writer_bits/ValueStorageBase#* storage = |
| 1976 | new _writer_bitscxx . . $ lemon/_writer_bits/::ValueStoragecxx . . $ lemon/_writer_bits/ValueStorage#<Value, Converter>(value, converter); |
| 1977 | _attributescxx . . $ lemon/BpGraphWriter#_attributes..push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(caption, storage)); |
| 1978 | return *this; |
| 1979 | } |
| 1980 | |
| 1981 | /// \brief Node writing rule |
| 1982 | /// |
| 1983 | /// Add a node writing rule to the writer. |
| 1984 | BpGraphWriter& nodecxx . . $ lemon/BpGraphWriter#node(519e2007d13afa58).(const stdcxx . . $ std/::stringcxx . . $ std/string#& caption, const Nodecxx . . $ lemon/BpGraphWriter#Node#& node) { |
| 1985 | typedef _writer_bitscxx . . $ lemon/_writer_bits/::DoubleMapLookUpConvertercxx . . $ lemon/_writer_bits/DoubleMapLookUpConverter#< |
| 1986 | Nodecxx . . $ lemon/BpGraphWriter#Node#, RedNodeIndexcxx . . $ lemon/BpGraphWriter#RedNodeIndex#, BlueNodeIndexcxx . . $ lemon/BpGraphWriter#BlueNodeIndex#> Convertercxx . . $ lemon/BpGraphWriter#node(519e2007d13afa58).Converter#; |
| 1987 | Convertercxx . . $ lemon/BpGraphWriter#node(519e2007d13afa58).Converter# converter(_red_node_indexcxx . . $ lemon/BpGraphWriter#_red_node_index., _blue_node_indexcxx . . $ lemon/BpGraphWriter#_blue_node_index.); |
| 1988 | _writer_bitscxx . . $ lemon/_writer_bits/::ValueStorageBasecxx . . $ lemon/_writer_bits/ValueStorageBase#* storage = |
| 1989 | new _writer_bitscxx . . $ lemon/_writer_bits/::ValueStoragecxx . . $ lemon/_writer_bits/ValueStorage#<Nodecxx . . $ lemon/BpGraphWriter#Node#, Convertercxx . . $ lemon/BpGraphWriter#node(519e2007d13afa58).Converter#>(node, converter); |
| 1990 | _attributescxx . . $ lemon/BpGraphWriter#_attributes..push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(caption, storage)); |
| 1991 | return *this; |
| 1992 | } |
| 1993 | |
| 1994 | /// \brief Red node writing rule |
| 1995 | /// |
| 1996 | /// Add a red node writing rule to the writer. |
| 1997 | BpGraphWriter& redNodecxx . . $ lemon/BpGraphWriter#redNode(4c103bd897ea5dd1).(const stdcxx . . $ std/::stringcxx . . $ std/string#& caption, const RedNodecxx . . $ lemon/BpGraphWriter#RedNode#& node) { |
| 1998 | typedef _writer_bitscxx . . $ lemon/_writer_bits/::MapLookUpConvertercxx . . $ lemon/_writer_bits/MapLookUpConverter#<Nodecxx . . $ lemon/BpGraphWriter#Node#> Convertercxx . . $ lemon/BpGraphWriter#redNode(4c103bd897ea5dd1).Converter#; |
| 1999 | Convertercxx . . $ lemon/BpGraphWriter#redNode(4c103bd897ea5dd1).Converter# converter(_red_node_indexcxx . . $ lemon/BpGraphWriter#_red_node_index.); |
| 2000 | _writer_bitscxx . . $ lemon/_writer_bits/::ValueStorageBasecxx . . $ lemon/_writer_bits/ValueStorageBase#* storage = |
| 2001 | new _writer_bitscxx . . $ lemon/_writer_bits/::ValueStoragecxx . . $ lemon/_writer_bits/ValueStorage#<Nodecxx . . $ lemon/BpGraphWriter#Node#, Convertercxx . . $ lemon/BpGraphWriter#redNode(4c103bd897ea5dd1).Converter#>(node, converter); |
| 2002 | _attributescxx . . $ lemon/BpGraphWriter#_attributes..push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(caption, storage)); |
| 2003 | return *this; |
| 2004 | } |
| 2005 | |
| 2006 | /// \brief Blue node writing rule |
| 2007 | /// |
| 2008 | /// Add a blue node writing rule to the writer. |
| 2009 | BpGraphWriter& blueNodecxx . . $ lemon/BpGraphWriter#blueNode(cad2d30d0f3569ba).(const stdcxx . . $ std/::stringcxx . . $ std/string#& caption, const BlueNodecxx . . $ lemon/BpGraphWriter#BlueNode#& node) { |
| 2010 | typedef _writer_bitscxx . . $ lemon/_writer_bits/::MapLookUpConvertercxx . . $ lemon/_writer_bits/MapLookUpConverter#<Nodecxx . . $ lemon/BpGraphWriter#Node#> Convertercxx . . $ lemon/BpGraphWriter#blueNode(cad2d30d0f3569ba).Converter#; |
| 2011 | Convertercxx . . $ lemon/BpGraphWriter#blueNode(cad2d30d0f3569ba).Converter# converter(_blue_node_indexcxx . . $ lemon/BpGraphWriter#_blue_node_index.); |
| 2012 | _writer_bitscxx . . $ lemon/_writer_bits/::ValueStorageBasecxx . . $ lemon/_writer_bits/ValueStorageBase#* storage = |
| 2013 | new _writer_bitscxx . . $ lemon/_writer_bits/::ValueStoragecxx . . $ lemon/_writer_bits/ValueStorage#<Nodecxx . . $ lemon/BpGraphWriter#Node#, Convertercxx . . $ lemon/BpGraphWriter#blueNode(cad2d30d0f3569ba).Converter#>(node, converter); |
| 2014 | _attributescxx . . $ lemon/BpGraphWriter#_attributes..push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(caption, storage)); |
| 2015 | return *this; |
| 2016 | } |
| 2017 | |
| 2018 | /// \brief Edge writing rule |
| 2019 | /// |
| 2020 | /// Add an edge writing rule to writer. |
| 2021 | BpGraphWriter& edgecxx . . $ lemon/BpGraphWriter#edge(e5d1a54dbb2fa744).(const stdcxx . . $ std/::stringcxx . . $ std/string#& caption, const Edgecxx . . $ lemon/BpGraphWriter#Edge#& edge) { |
| 2022 | typedef _writer_bitscxx . . $ lemon/_writer_bits/::MapLookUpConvertercxx . . $ lemon/_writer_bits/MapLookUpConverter#<Edgecxx . . $ lemon/BpGraphWriter#Edge#> Convertercxx . . $ lemon/BpGraphWriter#edge(e5d1a54dbb2fa744).Converter#; |
| 2023 | Convertercxx . . $ lemon/BpGraphWriter#edge(e5d1a54dbb2fa744).Converter# converter(_edge_indexcxx . . $ lemon/BpGraphWriter#_edge_index.); |
| 2024 | _writer_bitscxx . . $ lemon/_writer_bits/::ValueStorageBasecxx . . $ lemon/_writer_bits/ValueStorageBase#* storage = |
| 2025 | new _writer_bitscxx . . $ lemon/_writer_bits/::ValueStoragecxx . . $ lemon/_writer_bits/ValueStorage#<Edgecxx . . $ lemon/BpGraphWriter#Edge#, Convertercxx . . $ lemon/BpGraphWriter#edge(e5d1a54dbb2fa744).Converter#>(edge, converter); |
| 2026 | _attributescxx . . $ lemon/BpGraphWriter#_attributes..push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(caption, storage)); |
| 2027 | return *this; |
| 2028 | } |
| 2029 | |
| 2030 | /// \brief Arc writing rule |
| 2031 | /// |
| 2032 | /// Add an arc writing rule to writer. |
| 2033 | BpGraphWriter& arccxx . . $ lemon/BpGraphWriter#arc(f954e9792e4654e).(const stdcxx . . $ std/::stringcxx . . $ std/string#& caption, const Arccxx . . $ lemon/BpGraphWriter#Arc#& arc) { |
| 2034 | typedef _writer_bitscxx . . $ lemon/_writer_bits/::GraphArcLookUpConvertercxx . . $ lemon/_writer_bits/GraphArcLookUpConverter#<BGR> Convertercxx . . $ lemon/BpGraphWriter#arc(f954e9792e4654e).Converter#; |
| 2035 | Convertercxx . . $ lemon/BpGraphWriter#arc(f954e9792e4654e).Converter# converter(_graphcxx . . $ lemon/BpGraphWriter#_graph., _edge_indexcxx . . $ lemon/BpGraphWriter#_edge_index.); |
| 2036 | _writer_bitscxx . . $ lemon/_writer_bits/::ValueStorageBasecxx . . $ lemon/_writer_bits/ValueStorageBase#* storage = |
| 2037 | new _writer_bitscxx . . $ lemon/_writer_bits/::ValueStoragecxx . . $ lemon/_writer_bits/ValueStorage#<Arccxx . . $ lemon/BpGraphWriter#Arc#, Convertercxx . . $ lemon/BpGraphWriter#arc(f954e9792e4654e).Converter#>(arc, converter); |
| 2038 | _attributescxx . . $ lemon/BpGraphWriter#_attributes..push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(caption, storage)); |
| 2039 | return *this; |
| 2040 | } |
| 2041 | |
| 2042 | /// \name Section Captions |
| 2043 | /// @{ |
| 2044 | |
| 2045 | /// \brief Add an additional caption to the \c \@red_nodes and |
| 2046 | /// \c \@blue_nodes section |
| 2047 | /// |
| 2048 | /// Add an additional caption to the \c \@red_nodes and \c |
| 2049 | /// \@blue_nodes section. |
| 2050 | BpGraphWriter& nodescxx . . $ lemon/BpGraphWriter#nodes(dc4984a995ed3d3a).(const stdcxx . . $ std/::stringcxx . . $ std/string#& caption) { |
| 2051 | _nodes_captioncxx . . $ lemon/BpGraphWriter#_nodes_caption. =cxx . . $ std/__cxx11/basic_string#`operator=`(c0b47be1fddc0e75). caption; |
| 2052 | return *this; |
| 2053 | } |
| 2054 | |
| 2055 | /// \brief Add an additional caption to the \c \@edges section |
| 2056 | /// |
| 2057 | /// Add an additional caption to the \c \@edges section. |
| 2058 | BpGraphWriter& edgescxx . . $ lemon/BpGraphWriter#edges(dc4984a995ed3d3a).(const stdcxx . . $ std/::stringcxx . . $ std/string#& caption) { |
| 2059 | _edges_captioncxx . . $ lemon/BpGraphWriter#_edges_caption. =cxx . . $ std/__cxx11/basic_string#`operator=`(c0b47be1fddc0e75). caption; |
| 2060 | return *this; |
| 2061 | } |
| 2062 | |
| 2063 | /// \brief Add an additional caption to the \c \@attributes section |
| 2064 | /// |
| 2065 | /// Add an additional caption to the \c \@attributes section. |
| 2066 | BpGraphWriter& attributescxx . . $ lemon/BpGraphWriter#attributes(dc4984a995ed3d3a).(const stdcxx . . $ std/::stringcxx . . $ std/string#& caption) { |
| 2067 | _attributes_captioncxx . . $ lemon/BpGraphWriter#_attributes_caption. =cxx . . $ std/__cxx11/basic_string#`operator=`(c0b47be1fddc0e75). caption; |
| 2068 | return *this; |
| 2069 | } |
| 2070 | |
| 2071 | /// \name Skipping Section |
| 2072 | /// @{ |
| 2073 | |
| 2074 | /// \brief Skip writing the node set |
| 2075 | /// |
| 2076 | /// The \c \@red_nodes and \c \@blue_nodes section will not be |
| 2077 | /// written to the stream. |
| 2078 | BpGraphWriter& skipNodescxx . . $ lemon/BpGraphWriter#skipNodes(53375fdbd6621aa3).() { |
| 2079 | LEMON_ASSERTcxx . . $ `lemon/assert.h:193:13`!(!_skip_nodes, "Multiple usage of skipNodes() member"); |
| 2080 | _skip_nodescxx . . $ lemon/BpGraphWriter#_skip_nodes. = true; |
| 2081 | return *this; |
| 2082 | } |
| 2083 | |
| 2084 | /// \brief Skip writing edge set |
| 2085 | /// |
| 2086 | /// The \c \@edges section will not be written to the stream. |
| 2087 | BpGraphWriter& skipEdgescxx . . $ lemon/BpGraphWriter#skipEdges(53375fdbd6621aa3).() { |
| 2088 | LEMON_ASSERTcxx . . $ `lemon/assert.h:193:13`!(!_skip_edges, "Multiple usage of skipEdges() member"); |
| 2089 | _skip_edgescxx . . $ lemon/BpGraphWriter#_skip_edges. = true; |
| 2090 | return *this; |
| 2091 | } |
| 2092 | |
| 2093 | /// @} |
| 2094 | |
| 2095 | private: |
| 2096 | |
| 2097 | void writeRedNodescxx . . $ lemon/BpGraphWriter#writeRedNodes(49f6e7a06ebc5aa8).() { |
| 2098 | _writer_bitscxx . . $ lemon/_writer_bits/::MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<RedNodecxx . . $ lemon/BpGraphWriter#RedNode#>* label = 0; |
| 2099 | for (typename RedNodeMapscxx . . $ lemon/BpGraphWriter#RedNodeMaps#::iterator it = _red_node_mapscxx . . $ lemon/BpGraphWriter#_red_node_maps..begincxx . . $ std/vector#begin(d1e1699016b9d7e6).(); |
| 2100 | it != _red_node_mapscxx . . $ lemon/BpGraphWriter#_red_node_maps..endcxx . . $ std/vector#end(d1e1699016b9d7e6).(); ++it) { |
| 2101 | if (it->first == "label") { |
| 2102 | label = it->second; |
| 2103 | break; |
| 2104 | } |
| 2105 | } |
| 2106 | |
| 2107 | *_oscxx . . $ lemon/BpGraphWriter#_os. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "@red_nodes"; |
| 2108 | if (!_nodes_captioncxx . . $ lemon/BpGraphWriter#_nodes_caption..emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).()) { |
| 2109 | _writer_bitscxx . . $ lemon/_writer_bits/::writeTokencxx . . $ lemon/_writer_bits/writeToken(b1020aba89db397c).(*_oscxx . . $ lemon/BpGraphWriter#_os. <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). ' ', _nodes_captioncxx . . $ lemon/BpGraphWriter#_nodes_caption.); |
| 2110 | } |
| 2111 | *_oscxx . . $ lemon/BpGraphWriter#_os. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 2112 | |
| 2113 | if (label == 0) { |
| 2114 | *_oscxx . . $ lemon/BpGraphWriter#_os. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "label" <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). '\t'; |
| 2115 | } |
| 2116 | for (typename RedNodeMapscxx . . $ lemon/BpGraphWriter#RedNodeMaps#::iterator it = _red_node_mapscxx . . $ lemon/BpGraphWriter#_red_node_maps..begincxx . . $ std/vector#begin(d1e1699016b9d7e6).(); |
| 2117 | it != _red_node_mapscxx . . $ lemon/BpGraphWriter#_red_node_maps..endcxx . . $ std/vector#end(d1e1699016b9d7e6).(); ++it) { |
| 2118 | _writer_bitscxx . . $ lemon/_writer_bits/::writeTokencxx . . $ lemon/_writer_bits/writeToken(b1020aba89db397c).(*_oscxx . . $ lemon/BpGraphWriter#_os., it->first) << '\t'; |
| 2119 | } |
| 2120 | *_oscxx . . $ lemon/BpGraphWriter#_os. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 2121 | |
| 2122 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<RedNodecxx . . $ lemon/BpGraphWriter#RedNode#> nodes; |
| 2123 | for (RedNodeItcxx . . $ lemon/BpGraphWriter#RedNodeIt# n(_graphcxx . . $ lemon/BpGraphWriter#_graph.); n != INVALIDcxx . . $ lemon/INVALID.; ++n) { |
| 2124 | nodes.push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(n); |
| 2125 | } |
| 2126 | |
| 2127 | if (label == 0) { |
| 2128 | IdMapcxx . . $ lemon/IdMap#<BGR, Nodecxx . . $ lemon/BpGraphWriter#Node#> id_map(_graphcxx . . $ lemon/BpGraphWriter#_graph.); |
| 2129 | _writer_bitscxx . . $ lemon/_writer_bits/::MapLesscxx . . $ lemon/_writer_bits/MapLess#<IdMapcxx . . $ lemon/IdMap#<BGR, Nodecxx . . $ lemon/BpGraphWriter#Node#> > id_less(id_map); |
| 2130 | stdcxx . . $ std/::sortcxx . . $ std/sort(249673c20e2b8d5).(nodes.begincxx . . $ std/vector#begin(55a6de06420d4903).(), nodes.endcxx . . $ std/vector#end(55a6de06420d4903).(), id_less); |
| 2131 | } else { |
| 2132 | label->sortcxx . . $ lemon/_writer_bits/MapStorageBase#sort(efb54ab086463856).(nodes); |
| 2133 | } |
| 2134 | |
| 2135 | for (int i = 0; i < static_cast<int>(nodes.sizecxx . . $ std/vector#size(c9b1e749b64d5edc).()); ++i) { |
| 2136 | RedNodecxx . . $ lemon/BpGraphWriter#RedNode# n = nodes[i]; |
| 2137 | if (label == 0) { |
| 2138 | stdcxx . . $ std/::ostringstreamcxx . . $ std/ostringstream# oscxx . . $ std/__cxx11/basic_ostringstream#basic_ostringstream(49f6e7a06ebc5aa8).; |
| 2139 | os << _graphcxx . . $ lemon/BpGraphWriter#_graph..id(static_cast<Nodecxx . . $ lemon/BpGraphWriter#Node#>(n)); |
| 2140 | _writer_bitscxx . . $ lemon/_writer_bits/::writeTokencxx . . $ lemon/_writer_bits/writeToken(b1020aba89db397c).(*_oscxx . . $ lemon/BpGraphWriter#_os., os.strcxx . . $ std/__cxx11/basic_ostringstream#str(d33e1a6fd36255f7).()); |
| 2141 | *_oscxx . . $ lemon/BpGraphWriter#_os. <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). '\t'; |
| 2142 | _red_node_indexcxx . . $ lemon/BpGraphWriter#_red_node_index..insertcxx . . $ std/map#insert(18cfdecbf775ff44).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(n, os.strcxx . . $ std/__cxx11/basic_ostringstream#str(d33e1a6fd36255f7).())); |
| 2143 | } |
| 2144 | for (typename RedNodeMapscxx . . $ lemon/BpGraphWriter#RedNodeMaps#::iterator it = _red_node_mapscxx . . $ lemon/BpGraphWriter#_red_node_maps..begincxx . . $ std/vector#begin(d1e1699016b9d7e6).(); |
| 2145 | it != _red_node_mapscxx . . $ lemon/BpGraphWriter#_red_node_maps..endcxx . . $ std/vector#end(55a6de06420d4903).(); ++it) { |
| 2146 | stdcxx . . $ std/::stringcxx . . $ std/string# value = it->second->get(n); |
| 2147 | _writer_bitscxx . . $ lemon/_writer_bits/::writeTokencxx . . $ lemon/_writer_bits/writeToken(b1020aba89db397c).(*_oscxx . . $ lemon/BpGraphWriter#_os., value); |
| 2148 | if (it->first == "label") { |
| 2149 | _red_node_indexcxx . . $ lemon/BpGraphWriter#_red_node_index..insertcxx . . $ std/map#insert(f1d6a7bdcb7d7743).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(n, value)); |
| 2150 | } |
| 2151 | *_oscxx . . $ lemon/BpGraphWriter#_os. <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). '\t'; |
| 2152 | } |
| 2153 | *_oscxx . . $ lemon/BpGraphWriter#_os. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 2154 | } |
| 2155 | } |
| 2156 | |
| 2157 | void writeBlueNodescxx . . $ lemon/BpGraphWriter#writeBlueNodes(49f6e7a06ebc5aa8).() { |
| 2158 | _writer_bitscxx . . $ lemon/_writer_bits/::MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<BlueNodecxx . . $ lemon/BpGraphWriter#BlueNode#>* label = 0; |
| 2159 | for (typename BlueNodeMapscxx . . $ lemon/BpGraphWriter#BlueNodeMaps#::iterator it = _blue_node_mapscxx . . $ lemon/BpGraphWriter#_blue_node_maps..begincxx . . $ std/vector#begin(55a6de06420d4903).(); |
| 2160 | it != _blue_node_mapscxx . . $ lemon/BpGraphWriter#_blue_node_maps..endcxx . . $ std/vector#end(55a6de06420d4903).(); ++it) { |
| 2161 | if (it->first == "label") { |
| 2162 | label = it->second; |
| 2163 | break; |
| 2164 | } |
| 2165 | } |
| 2166 | |
| 2167 | *_oscxx . . $ lemon/BpGraphWriter#_os. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "@blue_nodes"; |
| 2168 | if (!_nodes_captioncxx . . $ lemon/BpGraphWriter#_nodes_caption..emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).()) { |
| 2169 | _writer_bitscxx . . $ lemon/_writer_bits/::writeTokencxx . . $ lemon/_writer_bits/writeToken(b1020aba89db397c).(*_oscxx . . $ lemon/BpGraphWriter#_os. <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). ' ', _nodes_captioncxx . . $ lemon/BpGraphWriter#_nodes_caption.); |
| 2170 | } |
| 2171 | *_oscxx . . $ lemon/BpGraphWriter#_os. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 2172 | |
| 2173 | if (label == 0) { |
| 2174 | *_oscxx . . $ lemon/BpGraphWriter#_os. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "label" <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). '\t'; |
| 2175 | } |
| 2176 | for (typename BlueNodeMapscxx . . $ lemon/BpGraphWriter#BlueNodeMaps#::iterator it = _blue_node_mapscxx . . $ lemon/BpGraphWriter#_blue_node_maps..begincxx . . $ std/vector#begin(55a6de06420d4903).(); |
| 2177 | it != _blue_node_mapscxx . . $ lemon/BpGraphWriter#_blue_node_maps..endcxx . . $ std/vector#end(d1e1699016b9d7e6).(); ++it) { |
| 2178 | _writer_bitscxx . . $ lemon/_writer_bits/::writeTokencxx . . $ lemon/_writer_bits/writeToken(b1020aba89db397c).(*_oscxx . . $ lemon/BpGraphWriter#_os., it->first) << '\t'; |
| 2179 | } |
| 2180 | *_oscxx . . $ lemon/BpGraphWriter#_os. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 2181 | |
| 2182 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<BlueNodecxx . . $ lemon/BpGraphWriter#BlueNode#> nodes; |
| 2183 | for (BlueNodeItcxx . . $ lemon/BpGraphWriter#BlueNodeIt# n(_graphcxx . . $ lemon/BpGraphWriter#_graph.); n != INVALIDcxx . . $ lemon/INVALID.; ++n) { |
| 2184 | nodes.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(n); |
| 2185 | } |
| 2186 | |
| 2187 | if (label == 0) { |
| 2188 | IdMapcxx . . $ lemon/IdMap#<BGR, Nodecxx . . $ lemon/BpGraphWriter#Node#> id_map(_graphcxx . . $ lemon/BpGraphWriter#_graph.); |
| 2189 | _writer_bitscxx . . $ lemon/_writer_bits/::MapLesscxx . . $ lemon/_writer_bits/MapLess#<IdMapcxx . . $ lemon/IdMap#<BGR, Nodecxx . . $ lemon/BpGraphWriter#Node#> > id_less(id_map); |
| 2190 | stdcxx . . $ std/::sortcxx . . $ std/sort(1b056e85f3afd146).(nodes.begincxx . . $ std/vector#begin(55a6de06420d4903).(), nodes.endcxx . . $ std/vector#end(d1e1699016b9d7e6).(), id_less); |
| 2191 | } else { |
| 2192 | label->sortcxx . . $ lemon/_writer_bits/MapStorageBase#sort(efb54ab086463856).(nodes); |
| 2193 | } |
| 2194 | |
| 2195 | for (int i = 0; i < static_cast<int>(nodes.sizecxx . . $ std/vector#size(c9b1e749b64d5edc).()); ++i) { |
| 2196 | BlueNodecxx . . $ lemon/BpGraphWriter#BlueNode# n = nodes[i]; |
| 2197 | if (label == 0) { |
| 2198 | stdcxx . . $ std/::ostringstreamcxx . . $ std/ostringstream# oscxx . . $ std/__cxx11/basic_ostringstream#basic_ostringstream(49f6e7a06ebc5aa8).; |
| 2199 | os << _graphcxx . . $ lemon/BpGraphWriter#_graph..id(static_cast<Nodecxx . . $ lemon/BpGraphWriter#Node#>(n)); |
| 2200 | _writer_bitscxx . . $ lemon/_writer_bits/::writeTokencxx . . $ lemon/_writer_bits/writeToken(b1020aba89db397c).(*_oscxx . . $ lemon/BpGraphWriter#_os., os.strcxx . . $ std/__cxx11/basic_ostringstream#str(d33e1a6fd36255f7).()); |
| 2201 | *_oscxx . . $ lemon/BpGraphWriter#_os. <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). '\t'; |
| 2202 | _blue_node_indexcxx . . $ lemon/BpGraphWriter#_blue_node_index..insertcxx . . $ std/map#insert(850dc27b70fa0624).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(n, os.strcxx . . $ std/__cxx11/basic_ostringstream#str(d33e1a6fd36255f7).())); |
| 2203 | } |
| 2204 | for (typename BlueNodeMapscxx . . $ lemon/BpGraphWriter#BlueNodeMaps#::iterator it = _blue_node_mapscxx . . $ lemon/BpGraphWriter#_blue_node_maps..begincxx . . $ std/vector#begin(d1e1699016b9d7e6).(); |
| 2205 | it != _blue_node_mapscxx . . $ lemon/BpGraphWriter#_blue_node_maps..endcxx . . $ std/vector#end(55a6de06420d4903).(); ++it) { |
| 2206 | stdcxx . . $ std/::stringcxx . . $ std/string# value = it->second->get(n); |
| 2207 | _writer_bitscxx . . $ lemon/_writer_bits/::writeTokencxx . . $ lemon/_writer_bits/writeToken(b1020aba89db397c).(*_oscxx . . $ lemon/BpGraphWriter#_os., value); |
| 2208 | if (it->first == "label") { |
| 2209 | _blue_node_indexcxx . . $ lemon/BpGraphWriter#_blue_node_index..insertcxx . . $ std/map#insert(7843218f68f64a61).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(n, value)); |
| 2210 | } |
| 2211 | *_oscxx . . $ lemon/BpGraphWriter#_os. <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). '\t'; |
| 2212 | } |
| 2213 | *_oscxx . . $ lemon/BpGraphWriter#_os. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 2214 | } |
| 2215 | } |
| 2216 | |
| 2217 | void createRedNodeIndexcxx . . $ lemon/BpGraphWriter#createRedNodeIndex(49f6e7a06ebc5aa8).() { |
| 2218 | _writer_bitscxx . . $ lemon/_writer_bits/::MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<RedNodecxx . . $ lemon/BpGraphWriter#RedNode#>* label = 0; |
| 2219 | for (typename RedNodeMapscxx . . $ lemon/BpGraphWriter#RedNodeMaps#::iterator it = _red_node_mapscxx . . $ lemon/BpGraphWriter#_red_node_maps..begincxx . . $ std/vector#begin(d1e1699016b9d7e6).(); |
| 2220 | it != _red_node_mapscxx . . $ lemon/BpGraphWriter#_red_node_maps..endcxx . . $ std/vector#end(55a6de06420d4903).(); ++it) { |
| 2221 | if (it->first == "label") { |
| 2222 | label = it->second; |
| 2223 | break; |
| 2224 | } |
| 2225 | } |
| 2226 | |
| 2227 | if (label == 0) { |
| 2228 | for (RedNodeItcxx . . $ lemon/BpGraphWriter#RedNodeIt# n(_graphcxx . . $ lemon/BpGraphWriter#_graph.); n != INVALIDcxx . . $ lemon/INVALID.; ++n) { |
| 2229 | stdcxx . . $ std/::ostringstreamcxx . . $ std/ostringstream# oscxx . . $ std/__cxx11/basic_ostringstream#basic_ostringstream(49f6e7a06ebc5aa8).; |
| 2230 | os << _graphcxx . . $ lemon/BpGraphWriter#_graph..id(n); |
| 2231 | _red_node_indexcxx . . $ lemon/BpGraphWriter#_red_node_index..insertcxx . . $ std/map#insert(7843218f68f64a61).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(n, os.strcxx . . $ std/__cxx11/basic_ostringstream#str(d33e1a6fd36255f7).())); |
| 2232 | } |
| 2233 | } else { |
| 2234 | for (RedNodeItcxx . . $ lemon/BpGraphWriter#RedNodeIt# n(_graphcxx . . $ lemon/BpGraphWriter#_graph.); n != INVALIDcxx . . $ lemon/INVALID.; ++n) { |
| 2235 | stdcxx . . $ std/::stringcxx . . $ std/string# value = label->getcxx . . $ lemon/_writer_bits/MapStorageBase#get(23b83986b497e4d5).(n); |
| 2236 | _red_node_indexcxx . . $ lemon/BpGraphWriter#_red_node_index..insertcxx . . $ std/map#insert(850dc27b70fa0624).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(n, value)); |
| 2237 | } |
| 2238 | } |
| 2239 | } |
| 2240 | |
| 2241 | void createBlueNodeIndexcxx . . $ lemon/BpGraphWriter#createBlueNodeIndex(49f6e7a06ebc5aa8).() { |
| 2242 | _writer_bitscxx . . $ lemon/_writer_bits/::MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<BlueNodecxx . . $ lemon/BpGraphWriter#BlueNode#>* label = 0; |
| 2243 | for (typename BlueNodeMapscxx . . $ lemon/BpGraphWriter#BlueNodeMaps#::iterator it = _blue_node_mapscxx . . $ lemon/BpGraphWriter#_blue_node_maps..begincxx . . $ std/vector#begin(55a6de06420d4903).(); |
| 2244 | it != _blue_node_mapscxx . . $ lemon/BpGraphWriter#_blue_node_maps..endcxx . . $ std/vector#end(55a6de06420d4903).(); ++it) { |
| 2245 | if (it->first == "label") { |
| 2246 | label = it->second; |
| 2247 | break; |
| 2248 | } |
| 2249 | } |
| 2250 | |
| 2251 | if (label == 0) { |
| 2252 | for (BlueNodeItcxx . . $ lemon/BpGraphWriter#BlueNodeIt# n(_graphcxx . . $ lemon/BpGraphWriter#_graph.); n != INVALIDcxx . . $ lemon/INVALID.; ++n) { |
| 2253 | stdcxx . . $ std/::ostringstreamcxx . . $ std/ostringstream# oscxx . . $ std/__cxx11/basic_ostringstream#basic_ostringstream(49f6e7a06ebc5aa8).; |
| 2254 | os << _graphcxx . . $ lemon/BpGraphWriter#_graph..id(n); |
| 2255 | _blue_node_indexcxx . . $ lemon/BpGraphWriter#_blue_node_index..insertcxx . . $ std/map#insert(18cfdecbf775ff44).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(n, os.strcxx . . $ std/__cxx11/basic_ostringstream#str(d33e1a6fd36255f7).())); |
| 2256 | } |
| 2257 | } else { |
| 2258 | for (BlueNodeItcxx . . $ lemon/BpGraphWriter#BlueNodeIt# n(_graphcxx . . $ lemon/BpGraphWriter#_graph.); n != INVALIDcxx . . $ lemon/INVALID.; ++n) { |
| 2259 | stdcxx . . $ std/::stringcxx . . $ std/string# value = label->getcxx . . $ lemon/_writer_bits/MapStorageBase#get(23b83986b497e4d5).(n); |
| 2260 | _blue_node_indexcxx . . $ lemon/BpGraphWriter#_blue_node_index..insertcxx . . $ std/map#insert(7843218f68f64a61).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(n, value)); |
| 2261 | } |
| 2262 | } |
| 2263 | } |
| 2264 | |
| 2265 | void writeEdgescxx . . $ lemon/BpGraphWriter#writeEdges(49f6e7a06ebc5aa8).() { |
| 2266 | _writer_bitscxx . . $ lemon/_writer_bits/::MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<Edgecxx . . $ lemon/BpGraphWriter#Edge#>* label = 0; |
| 2267 | for (typename EdgeMapscxx . . $ lemon/BpGraphWriter#EdgeMaps#::iterator it = _edge_mapscxx . . $ lemon/BpGraphWriter#_edge_maps..begincxx . . $ std/vector#begin(55a6de06420d4903).(); |
| 2268 | it != _edge_mapscxx . . $ lemon/BpGraphWriter#_edge_maps..endcxx . . $ std/vector#end(d1e1699016b9d7e6).(); ++it) { |
| 2269 | if (it->first == "label") { |
| 2270 | label = it->second; |
| 2271 | break; |
| 2272 | } |
| 2273 | } |
| 2274 | |
| 2275 | *_oscxx . . $ lemon/BpGraphWriter#_os. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "@edges"; |
| 2276 | if (!_edges_captioncxx . . $ lemon/BpGraphWriter#_edges_caption..emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).()) { |
| 2277 | _writer_bitscxx . . $ lemon/_writer_bits/::writeTokencxx . . $ lemon/_writer_bits/writeToken(b1020aba89db397c).(*_oscxx . . $ lemon/BpGraphWriter#_os. <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). ' ', _edges_captioncxx . . $ lemon/BpGraphWriter#_edges_caption.); |
| 2278 | } |
| 2279 | *_oscxx . . $ lemon/BpGraphWriter#_os. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 2280 | |
| 2281 | *_oscxx . . $ lemon/BpGraphWriter#_os. <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). '\t' <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). '\t'; |
| 2282 | if (label == 0) { |
| 2283 | *_oscxx . . $ lemon/BpGraphWriter#_os. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "label" <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). '\t'; |
| 2284 | } |
| 2285 | for (typename EdgeMapscxx . . $ lemon/BpGraphWriter#EdgeMaps#::iterator it = _edge_mapscxx . . $ lemon/BpGraphWriter#_edge_maps..begincxx . . $ std/vector#begin(55a6de06420d4903).(); |
| 2286 | it != _edge_mapscxx . . $ lemon/BpGraphWriter#_edge_maps..endcxx . . $ std/vector#end(55a6de06420d4903).(); ++it) { |
| 2287 | _writer_bitscxx . . $ lemon/_writer_bits/::writeTokencxx . . $ lemon/_writer_bits/writeToken(b1020aba89db397c).(*_oscxx . . $ lemon/BpGraphWriter#_os., it->first) << '\t'; |
| 2288 | } |
| 2289 | *_oscxx . . $ lemon/BpGraphWriter#_os. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 2290 | |
| 2291 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<Edgecxx . . $ lemon/BpGraphWriter#Edge#> edges; |
| 2292 | for (EdgeItcxx . . $ lemon/BpGraphWriter#EdgeIt# n(_graphcxx . . $ lemon/BpGraphWriter#_graph.); n != INVALIDcxx . . $ lemon/INVALID.; ++n) { |
| 2293 | edges.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(n); |
| 2294 | } |
| 2295 | |
| 2296 | if (label == 0) { |
| 2297 | IdMapcxx . . $ lemon/IdMap#<BGR, Edgecxx . . $ lemon/BpGraphWriter#Edge#> id_map(_graphcxx . . $ lemon/BpGraphWriter#_graph.); |
| 2298 | _writer_bitscxx . . $ lemon/_writer_bits/::MapLesscxx . . $ lemon/_writer_bits/MapLess#<IdMapcxx . . $ lemon/IdMap#<BGR, Edgecxx . . $ lemon/BpGraphWriter#Edge#> > id_less(id_map); |
| 2299 | stdcxx . . $ std/::sortcxx . . $ std/sort(4d3091562df4e52e).(edges.begincxx . . $ std/vector#begin(55a6de06420d4903).(), edges.endcxx . . $ std/vector#end(55a6de06420d4903).(), id_less); |
| 2300 | } else { |
| 2301 | label->sortcxx . . $ lemon/_writer_bits/MapStorageBase#sort(efb54ab086463856).(edges); |
| 2302 | } |
| 2303 | |
| 2304 | for (int i = 0; i < static_cast<int>(edges.sizecxx . . $ std/vector#size(c9b1e749b64d5edc).()); ++i) { |
| 2305 | Edgecxx . . $ lemon/BpGraphWriter#Edge# e = edges[i]; |
| 2306 | _writer_bitscxx . . $ lemon/_writer_bits/::writeTokencxx . . $ lemon/_writer_bits/writeToken(b1020aba89db397c).(*_oscxx . . $ lemon/BpGraphWriter#_os., _red_node_indexcxx . . $ lemon/BpGraphWriter#_red_node_index.. |
| 2307 | findcxx . . $ std/map#find(93703e90eb593a7f).(_graphcxx . . $ lemon/BpGraphWriter#_graph..redNode(e))->second); |
| 2308 | *_oscxx . . $ lemon/BpGraphWriter#_os. <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). '\t'; |
| 2309 | _writer_bitscxx . . $ lemon/_writer_bits/::writeTokencxx . . $ lemon/_writer_bits/writeToken(b1020aba89db397c).(*_oscxx . . $ lemon/BpGraphWriter#_os., _blue_node_indexcxx . . $ lemon/BpGraphWriter#_blue_node_index.. |
| 2310 | findcxx . . $ std/map#find(10b5259e992a5e20).(_graphcxx . . $ lemon/BpGraphWriter#_graph..blueNode(e))->second); |
| 2311 | *_oscxx . . $ lemon/BpGraphWriter#_os. <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). '\t'; |
| 2312 | if (label == 0) { |
| 2313 | stdcxx . . $ std/::ostringstreamcxx . . $ std/ostringstream# oscxx . . $ std/__cxx11/basic_ostringstream#basic_ostringstream(49f6e7a06ebc5aa8).; |
| 2314 | os << _graphcxx . . $ lemon/BpGraphWriter#_graph..id(e); |
| 2315 | _writer_bitscxx . . $ lemon/_writer_bits/::writeTokencxx . . $ lemon/_writer_bits/writeToken(b1020aba89db397c).(*_oscxx . . $ lemon/BpGraphWriter#_os., os.strcxx . . $ std/__cxx11/basic_ostringstream#str(d33e1a6fd36255f7).()); |
| 2316 | *_oscxx . . $ lemon/BpGraphWriter#_os. <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). '\t'; |
| 2317 | _edge_indexcxx . . $ lemon/BpGraphWriter#_edge_index..insertcxx . . $ std/map#insert(cd8975477e12dde2).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(e, os.strcxx . . $ std/__cxx11/basic_ostringstream#str(d33e1a6fd36255f7).())); |
| 2318 | } |
| 2319 | for (typename EdgeMapscxx . . $ lemon/BpGraphWriter#EdgeMaps#::iterator it = _edge_mapscxx . . $ lemon/BpGraphWriter#_edge_maps..begincxx . . $ std/vector#begin(d1e1699016b9d7e6).(); |
| 2320 | it != _edge_mapscxx . . $ lemon/BpGraphWriter#_edge_maps..endcxx . . $ std/vector#end(55a6de06420d4903).(); ++it) { |
| 2321 | stdcxx . . $ std/::stringcxx . . $ std/string# value = it->second->get(e); |
| 2322 | _writer_bitscxx . . $ lemon/_writer_bits/::writeTokencxx . . $ lemon/_writer_bits/writeToken(b1020aba89db397c).(*_oscxx . . $ lemon/BpGraphWriter#_os., value); |
| 2323 | if (it->first == "label") { |
| 2324 | _edge_indexcxx . . $ lemon/BpGraphWriter#_edge_index..insertcxx . . $ std/map#insert(850dc27b70fa0624).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(e, value)); |
| 2325 | } |
| 2326 | *_oscxx . . $ lemon/BpGraphWriter#_os. <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). '\t'; |
| 2327 | } |
| 2328 | *_oscxx . . $ lemon/BpGraphWriter#_os. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 2329 | } |
| 2330 | } |
| 2331 | |
| 2332 | void createEdgeIndexcxx . . $ lemon/BpGraphWriter#createEdgeIndex(49f6e7a06ebc5aa8).() { |
| 2333 | _writer_bitscxx . . $ lemon/_writer_bits/::MapStorageBasecxx . . $ lemon/_writer_bits/MapStorageBase#<Edgecxx . . $ lemon/BpGraphWriter#Edge#>* label = 0; |
| 2334 | for (typename EdgeMapscxx . . $ lemon/BpGraphWriter#EdgeMaps#::iterator it = _edge_mapscxx . . $ lemon/BpGraphWriter#_edge_maps..begincxx . . $ std/vector#begin(d1e1699016b9d7e6).(); |
| 2335 | it != _edge_mapscxx . . $ lemon/BpGraphWriter#_edge_maps..endcxx . . $ std/vector#end(d1e1699016b9d7e6).(); ++it) { |
| 2336 | if (it->first == "label") { |
| 2337 | label = it->second; |
| 2338 | break; |
| 2339 | } |
| 2340 | } |
| 2341 | |
| 2342 | if (label == 0) { |
| 2343 | for (EdgeItcxx . . $ lemon/BpGraphWriter#EdgeIt# e(_graphcxx . . $ lemon/BpGraphWriter#_graph.); e != INVALIDcxx . . $ lemon/INVALID.; ++e) { |
| 2344 | stdcxx . . $ std/::ostringstreamcxx . . $ std/ostringstream# oscxx . . $ std/__cxx11/basic_ostringstream#basic_ostringstream(49f6e7a06ebc5aa8).; |
| 2345 | os << _graphcxx . . $ lemon/BpGraphWriter#_graph..id(e); |
| 2346 | _edge_indexcxx . . $ lemon/BpGraphWriter#_edge_index..insertcxx . . $ std/map#insert(9687e834fb3b5899).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(e, os.strcxx . . $ std/__cxx11/basic_ostringstream#str(d33e1a6fd36255f7).())); |
| 2347 | } |
| 2348 | } else { |
| 2349 | for (EdgeItcxx . . $ lemon/BpGraphWriter#EdgeIt# e(_graphcxx . . $ lemon/BpGraphWriter#_graph.); e != INVALIDcxx . . $ lemon/INVALID.; ++e) { |
| 2350 | stdcxx . . $ std/::stringcxx . . $ std/string# value = label->getcxx . . $ lemon/_writer_bits/MapStorageBase#get(23b83986b497e4d5).(e); |
| 2351 | _edge_indexcxx . . $ lemon/BpGraphWriter#_edge_index..insertcxx . . $ std/map#insert(6a1b50cd68d58189).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(e, value)); |
| 2352 | } |
| 2353 | } |
| 2354 | } |
| 2355 | |
| 2356 | void writeAttributescxx . . $ lemon/BpGraphWriter#writeAttributes(49f6e7a06ebc5aa8).() { |
| 2357 | if (_attributescxx . . $ lemon/BpGraphWriter#_attributes..emptycxx . . $ std/vector#empty(3482b152b9333168).()) return; |
| 2358 | *_oscxx . . $ lemon/BpGraphWriter#_os. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "@attributes"; |
| 2359 | if (!_attributes_captioncxx . . $ lemon/BpGraphWriter#_attributes_caption..emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).()) { |
| 2360 | _writer_bitscxx . . $ lemon/_writer_bits/::writeTokencxx . . $ lemon/_writer_bits/writeToken(b1020aba89db397c).(*_oscxx . . $ lemon/BpGraphWriter#_os. <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). ' ', _attributes_captioncxx . . $ lemon/BpGraphWriter#_attributes_caption.); |
| 2361 | } |
| 2362 | *_oscxx . . $ lemon/BpGraphWriter#_os. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 2363 | for (typename Attributescxx . . $ lemon/BpGraphWriter#Attributes#::iteratorcxx . . $ std/vector#iterator# it = _attributescxx . . $ lemon/BpGraphWriter#_attributes..begincxx . . $ std/vector#begin(55a6de06420d4903).(); |
| 2364 | it !=cxx . . $ __gnu_cxx/`operator!=`(30ee64f2df4eef8b). _attributescxx . . $ lemon/BpGraphWriter#_attributes..endcxx . . $ std/vector#end(55a6de06420d4903).(); ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(1613faa01bc3d014).it) { |
| 2365 | _writer_bitscxx . . $ lemon/_writer_bits/::writeTokencxx . . $ lemon/_writer_bits/writeToken(b1020aba89db397c).(*_oscxx . . $ lemon/BpGraphWriter#_os., it->cxx . . $ __gnu_cxx/__normal_iterator#`operator->`(65c2ec7035a77d3e).firstcxx . . $ std/pair#first.) <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). ' '; |
| 2366 | _writer_bitscxx . . $ lemon/_writer_bits/::writeTokencxx . . $ lemon/_writer_bits/writeToken(b1020aba89db397c).(*_oscxx . . $ lemon/BpGraphWriter#_os., it->cxx . . $ __gnu_cxx/__normal_iterator#`operator->`(65c2ec7035a77d3e).secondcxx . . $ std/pair#second.->getcxx . . $ lemon/_writer_bits/ValueStorageBase#get(efd28698952f529a).()); |
| 2367 | *_oscxx . . $ lemon/BpGraphWriter#_os. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 2368 | } |
| 2369 | } |
| 2370 | |
| 2371 | public: |
| 2372 | |
| 2373 | /// \name Execution of the Writer |
| 2374 | /// @{ |
| 2375 | |
| 2376 | /// \brief Start the batch processing |
| 2377 | /// |
| 2378 | /// This function starts the batch processing. |
| 2379 | void runcxx . . $ lemon/BpGraphWriter#run(49f6e7a06ebc5aa8).() { |
| 2380 | if (!_skip_nodescxx . . $ lemon/BpGraphWriter#_skip_nodes.) { |
| 2381 | writeRedNodescxx . . $ lemon/BpGraphWriter#writeRedNodes(49f6e7a06ebc5aa8).(); |
| 2382 | writeBlueNodescxx . . $ lemon/BpGraphWriter#writeBlueNodes(49f6e7a06ebc5aa8).(); |
| 2383 | } else { |
| 2384 | createRedNodeIndexcxx . . $ lemon/BpGraphWriter#createRedNodeIndex(49f6e7a06ebc5aa8).(); |
| 2385 | createBlueNodeIndexcxx . . $ lemon/BpGraphWriter#createBlueNodeIndex(49f6e7a06ebc5aa8).(); |
| 2386 | } |
| 2387 | if (!_skip_edgescxx . . $ lemon/BpGraphWriter#_skip_edges.) { |
| 2388 | writeEdgescxx . . $ lemon/BpGraphWriter#writeEdges(49f6e7a06ebc5aa8).(); |
| 2389 | } else { |
| 2390 | createEdgeIndexcxx . . $ lemon/BpGraphWriter#createEdgeIndex(49f6e7a06ebc5aa8).(); |
| 2391 | } |
| 2392 | writeAttributescxx . . $ lemon/BpGraphWriter#writeAttributes(49f6e7a06ebc5aa8).(); |
| 2393 | } |
| 2394 | |
| 2395 | /// \brief Give back the stream of the writer |
| 2396 | /// |
| 2397 | /// Give back the stream of the writer |
| 2398 | stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& ostreamcxx . . $ lemon/BpGraphWriter#ostream(3094c9a1b678da92).() { |
| 2399 | return *_oscxx . . $ lemon/BpGraphWriter#_os.; |
| 2400 | } |
| 2401 | |
| 2402 | /// @} |
| 2403 | }; |
| 2404 | |
| 2405 | /// \ingroup lemon_io |
| 2406 | /// |
| 2407 | /// \brief Return a \ref lemon::BpGraphWriter "BpGraphWriter" class |
| 2408 | /// |
| 2409 | /// This function just returns a \ref lemon::BpGraphWriter |
| 2410 | /// "BpGraphWriter" class. |
| 2411 | /// |
| 2412 | /// With this function a bipartite graph can be write to a file or output |
| 2413 | /// stream in \ref lgf-format "LGF" format with several maps and |
| 2414 | /// attributes. For example, with the following code a bipartite |
| 2415 | /// weighted matching problem can be written to the standard output, |
| 2416 | /// i.e. a graph with a \e weight map on the edges: |
| 2417 | /// |
| 2418 | ///\code |
| 2419 | ///ListBpGraph graph; |
| 2420 | ///ListBpGraph::EdgeMap<int> weight(graph); |
| 2421 | /// // Setting the weight map |
| 2422 | ///bpGraphWriter(graph, std::cout). |
| 2423 | /// edgeMap("weight", weight). |
| 2424 | /// run(); |
| 2425 | ///\endcode |
| 2426 | /// |
| 2427 | /// For a complete documentation, please see the |
| 2428 | /// \ref lemon::BpGraphWriter "BpGraphWriter" |
| 2429 | /// class documentation. |
| 2430 | /// \warning Don't forget to put the \ref lemon::BpGraphWriter::run() "run()" |
| 2431 | /// to the end of the parameter list. |
| 2432 | /// \relates BpGraphWriter |
| 2433 | /// \sa bpGraphWriter(const TBGR& graph, const std::string& fn) |
| 2434 | /// \sa bpGraphWriter(const TBGR& graph, const char* fn) |
| 2435 | template <typename TBGR> |
| 2436 | BpGraphWritercxx . . $ lemon/BpGraphWriter#<TBGR> bpGraphWritercxx . . $ lemon/bpGraphWriter(f7f20be7edd9a974).(const TBGR& graph, stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& os) { |
| 2437 | BpGraphWritercxx . . $ lemon/BpGraphWriter#<TBGR> tmp(graph, os); |
| 2438 | return tmp; |
| 2439 | } |
| 2440 | |
| 2441 | /// \brief Return a \ref BpGraphWriter class |
| 2442 | /// |
| 2443 | /// This function just returns a \ref BpGraphWriter class. |
| 2444 | /// \relates BpGraphWriter |
| 2445 | /// \sa graphWriter(const TBGR& graph, std::ostream& os) |
| 2446 | template <typename TBGR> |
| 2447 | BpGraphWritercxx . . $ lemon/BpGraphWriter#<TBGR> bpGraphWritercxx . . $ lemon/bpGraphWriter(1e45cda9b1adcb47).(const TBGR& graph, const stdcxx . . $ std/::stringcxx . . $ std/string#& fn) { |
| 2448 | BpGraphWritercxx . . $ lemon/BpGraphWriter#<TBGR> tmp(graph, fn); |
| 2449 | return tmp; |
| 2450 | } |
| 2451 | |
| 2452 | /// \brief Return a \ref BpGraphWriter class |
| 2453 | /// |
| 2454 | /// This function just returns a \ref BpGraphWriter class. |
| 2455 | /// \relates BpGraphWriter |
| 2456 | /// \sa graphWriter(const TBGR& graph, std::ostream& os) |
| 2457 | template <typename TBGR> |
| 2458 | BpGraphWritercxx . . $ lemon/BpGraphWriter#<TBGR> bpGraphWritercxx . . $ lemon/bpGraphWriter(6d6934745ed9c5b7).(const TBGR& graph, const char* fn) { |
| 2459 | BpGraphWritercxx . . $ lemon/BpGraphWriter#<TBGR> tmp(graph, fn); |
| 2460 | return tmp; |
| 2461 | } |
| 2462 | |
| 2463 | class SectionWritercxx . . $ lemon/SectionWriter#; |
| 2464 | |
| 2465 | SectionWritercxx . . $ lemon/SectionWriter# sectionWritercxx . . $ lemon/sectionWriter(fd9e1ae0acb6f7dc).(stdcxx . . $ std/::istreamcxx . . $ std/istream#& is); |
| 2466 | SectionWritercxx . . $ lemon/SectionWriter# sectionWritercxx . . $ lemon/sectionWriter(9f9ac875952b0abe).(const stdcxx . . $ std/::stringcxx . . $ std/string#& fn); |
| 2467 | SectionWritercxx . . $ lemon/SectionWriter# sectionWritercxx . . $ lemon/sectionWriter(b73a50e3eeb1fc39).(const char* fn); |
| 2468 | |
| 2469 | /// \ingroup lemon_io |
| 2470 | /// |
| 2471 | /// \brief Section writer class |
| 2472 | /// |
| 2473 | /// In the \ref lgf-format "LGF" file extra sections can be placed, |
| 2474 | /// which contain any data in arbitrary format. Such sections can be |
| 2475 | /// written with this class. A writing rule can be added to the |
| 2476 | /// class with two different functions. With the \c sectionLines() |
| 2477 | /// function a generator can write the section line-by-line, while |
| 2478 | /// with the \c sectionStream() member the section can be written to |
| 2479 | /// an output stream. |
| 2480 | class SectionWritercxx . . $ lemon/SectionWriter# { |
| 2481 | private: |
| 2482 | |
| 2483 | stdcxx . . $ std/::ostreamcxx . . $ std/ostream#* _oscxx . . $ lemon/SectionWriter#_os.; |
| 2484 | bool local_oscxx . . $ lemon/SectionWriter#local_os.; |
| 2485 | |
| 2486 | typedef stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::paircxx . . $ std/pair#<stdcxx . . $ std/::stringcxx . . $ std/string#, _writer_bitscxx . . $ lemon/_writer_bits/::Sectioncxx . . $ lemon/_writer_bits/Section#*> > |
| 2487 | Sectionscxx . . $ lemon/SectionWriter#Sections#; |
| 2488 | |
| 2489 | Sectionscxx . . $ lemon/SectionWriter#Sections# _sectionscxx . . $ lemon/SectionWriter#_sections.; |
| 2490 | |
| 2491 | public: |
| 2492 | |
| 2493 | /// \brief Constructor |
| 2494 | /// |
| 2495 | /// Construct a section writer, which writes to the given output |
| 2496 | /// stream. |
| 2497 | SectionWritercxx . . $ lemon/SectionWriter#SectionWriter(f7f45734e6842120).(stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& os) |
| 2498 | : _oscxx . . $ lemon/SectionWriter#_os.(&os), local_oscxx . . $ lemon/SectionWriter#local_os.(false) {} |
| 2499 | |
| 2500 | /// \brief Constructor |
| 2501 | /// |
| 2502 | /// Construct a section writer, which writes into the given file. |
| 2503 | SectionWritercxx . . $ lemon/SectionWriter#SectionWriter(9c546c94e5fcce4e).(const stdcxx . . $ std/::stringcxx . . $ std/string#& fn) |
| 2504 | : _oscxx . . $ lemon/SectionWriter#_os.(new stdcxx . . $ std/basic_ofstream#basic_ofstream(b8cd37071ce335df).::ofstreamcxx . . $ std/ofstream#(fn.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).())), local_oscxx . . $ lemon/SectionWriter#local_os.(true) { |
| 2505 | if (!cxx . . $ std/basic_ios#`operator!`(50ce9a9e25b4a850).(*_oscxx . . $ lemon/SectionWriter#_os.)) { |
| 2506 | delete _oscxx . . $ lemon/SectionWriter#_os.; |
| 2507 | throw IoErrorcxx . . $ lemon/IoError#IoError(6521af5f82091f78).("Cannot write file", fn); |
| 2508 | } |
| 2509 | } |
| 2510 | |
| 2511 | /// \brief Constructor |
| 2512 | /// |
| 2513 | /// Construct a section writer, which writes into the given file. |
| 2514 | SectionWritercxx . . $ lemon/SectionWriter#SectionWriter(85c52e162fed56f9).(const char* fn) |
| 2515 | : _oscxx . . $ lemon/SectionWriter#_os.(new stdcxx . . $ std/::ofstreamcxx . . $ std/ofstream#(fn)), local_oscxx . . $ lemon/SectionWriter#local_os.(true) { |
| 2516 | if (!cxx . . $ std/basic_ios#`operator!`(50ce9a9e25b4a850).(*_oscxx . . $ lemon/SectionWriter#_os.)) { |
| 2517 | delete _oscxx . . $ lemon/SectionWriter#_os.; |
| 2518 | throw IoErrorcxx . . $ lemon/IoError#("Cannot write file", fncxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).); |
| 2519 | } |
| 2520 | } |
| 2521 | |
| 2522 | /// \brief Destructor |
| 2523 | ~cxx . . $ lemon/SectionWriter#`~SectionWriter`(ced63f7c635d850d).SectionWritercxx . . $ lemon/SectionWriter#() { |
| 2524 | for (Sectionscxx . . $ lemon/SectionWriter#Sections#::iteratorcxx . . $ std/vector#iterator# it = _sectionscxx . . $ lemon/SectionWriter#_sections..begincxx . . $ std/vector#begin(55a6de06420d4903).(); |
| 2525 | it !=cxx . . $ __gnu_cxx/`operator!=`(30ee64f2df4eef8b). _sectionscxx . . $ lemon/SectionWriter#_sections..endcxx . . $ std/vector#end(55a6de06420d4903).(); ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(1613faa01bc3d014).it) { |
| 2526 | delete it->cxx . . $ __gnu_cxx/__normal_iterator#`operator->`(65c2ec7035a77d3e).secondcxx . . $ std/pair#second.; |
| 2527 | } |
| 2528 | |
| 2529 | if (local_oscxx . . $ lemon/SectionWriter#local_os.) { |
| 2530 | delete _oscxx . . $ lemon/SectionWriter#_os.; |
| 2531 | } |
| 2532 | |
| 2533 | } |
| 2534 | |
| 2535 | private: |
| 2536 | |
| 2537 | friend SectionWritercxx . . $ lemon/SectionWriter# sectionWritercxx . . $ lemon/sectionWriter(40abaf5138a35633).(stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& os); |
| 2538 | friend SectionWritercxx . . $ lemon/SectionWriter# sectionWritercxx . . $ lemon/sectionWriter(9f9ac875952b0abe).(const stdcxx . . $ std/::stringcxx . . $ std/string#& fn); |
| 2539 | friend SectionWritercxx . . $ lemon/SectionWriter# sectionWritercxx . . $ lemon/sectionWriter(b73a50e3eeb1fc39).(const char* fn); |
| 2540 | |
| 2541 | SectionWritercxx . . $ lemon/SectionWriter#SectionWriter(f478d293e00b6f7b).(SectionWritercxx . . $ lemon/SectionWriter#& other) |
| 2542 | : _oscxx . . $ lemon/SectionWriter#_os.(other._oscxx . . $ lemon/SectionWriter#_os.), local_oscxx . . $ lemon/SectionWriter#local_os.(other.local_oscxx . . $ lemon/SectionWriter#local_os.) { |
| 2543 | |
| 2544 | other._oscxx . . $ lemon/SectionWriter#_os. = 0; |
| 2545 | other.local_oscxx . . $ lemon/SectionWriter#local_os. = false; |
| 2546 | |
| 2547 | _sectionscxx . . $ lemon/SectionWriter#_sections..swapcxx . . $ std/vector#swap(319777021b21d7dd).(other._sectionscxx . . $ lemon/SectionWriter#_sections.); |
| 2548 | } |
| 2549 | |
| 2550 | SectionWritercxx . . $ lemon/SectionWriter#& operatorcxx . . $ lemon/SectionWriter#`operator=`(c83ee7109ab83414).=(const SectionWritercxx . . $ lemon/SectionWriter#&); |
| 2551 | |
| 2552 | public: |
| 2553 | |
| 2554 | /// \name Section Writers |
| 2555 | /// @{ |
| 2556 | |
| 2557 | /// \brief Add a section writer with line oriented writing |
| 2558 | /// |
| 2559 | /// The first parameter is the type descriptor of the section, the |
| 2560 | /// second is a generator with std::string values. At the writing |
| 2561 | /// process, the returned \c std::string will be written into the |
| 2562 | /// output file until it is an empty string. |
| 2563 | /// |
| 2564 | /// For example, an integer vector is written into a section. |
| 2565 | ///\code |
| 2566 | /// @numbers |
| 2567 | /// 12 45 23 78 |
| 2568 | /// 4 28 38 28 |
| 2569 | /// 23 6 16 |
| 2570 | ///\endcode |
| 2571 | /// |
| 2572 | /// The generator is implemented as a struct. |
| 2573 | ///\code |
| 2574 | /// struct NumberSection { |
| 2575 | /// std::vector<int>::const_iterator _it, _end; |
| 2576 | /// NumberSection(const std::vector<int>& data) |
| 2577 | /// : _it(data.begin()), _end(data.end()) {} |
| 2578 | /// std::string operator()() { |
| 2579 | /// int rem_in_line = 4; |
| 2580 | /// std::ostringstream ls; |
| 2581 | /// while (rem_in_line > 0 && _it != _end) { |
| 2582 | /// ls << *(_it++) << ' '; |
| 2583 | /// --rem_in_line; |
| 2584 | /// } |
| 2585 | /// return ls.str(); |
| 2586 | /// } |
| 2587 | /// }; |
| 2588 | /// |
| 2589 | /// // ... |
| 2590 | /// |
| 2591 | /// writer.sectionLines("numbers", NumberSection(vec)); |
| 2592 | ///\endcode |
| 2593 | template <typename Functor> |
| 2594 | SectionWritercxx . . $ lemon/SectionWriter#& sectionLinescxx . . $ lemon/SectionWriter#sectionLines(9615cef66a957cb0).(const stdcxx . . $ std/::stringcxx . . $ std/string#& type, Functor functor) { |
| 2595 | LEMON_ASSERTcxx . . $ `lemon/assert.h:193:13`!(!type.empty(), "Type is empty."); |
| 2596 | _sectionscxx . . $ lemon/SectionWriter#_sections..push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(type, |
| 2597 | new _writer_bitscxx . . $ lemon/_writer_bits/::LineSectioncxx . . $ lemon/_writer_bits/LineSection#<Functor>(functor))); |
| 2598 | return *this; |
| 2599 | } |
| 2600 | |
| 2601 | |
| 2602 | /// \brief Add a section writer with stream oriented writing |
| 2603 | /// |
| 2604 | /// The first parameter is the type of the section, the second is |
| 2605 | /// a functor, which takes a \c std::ostream& parameter. The |
| 2606 | /// functor writes the section to the output stream. |
| 2607 | /// \warning The last line must be closed with end-line character. |
| 2608 | template <typename Functor> |
| 2609 | SectionWritercxx . . $ lemon/SectionWriter#& sectionStreamcxx . . $ lemon/SectionWriter#sectionStream(9615cef66a957cb0).(const stdcxx . . $ std/::stringcxx . . $ std/string#& type, Functor functor) { |
| 2610 | LEMON_ASSERTcxx . . $ `lemon/assert.h:193:13`!(!type.empty(), "Type is empty."); |
| 2611 | _sectionscxx . . $ lemon/SectionWriter#_sections..push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(type, |
| 2612 | new _writer_bitscxx . . $ lemon/_writer_bits/::StreamSectioncxx . . $ lemon/_writer_bits/StreamSection#<Functor>(functor))); |
| 2613 | return *this; |
| 2614 | } |
| 2615 | |
| 2616 | /// @} |
| 2617 | |
| 2618 | public: |
| 2619 | |
| 2620 | |
| 2621 | /// \name Execution of the Writer |
| 2622 | /// @{ |
| 2623 | |
| 2624 | /// \brief Start the batch processing |
| 2625 | /// |
| 2626 | /// This function starts the batch processing. |
| 2627 | void runcxx . . $ lemon/SectionWriter#run(49f6e7a06ebc5aa8).() { |
| 2628 | |
| 2629 | LEMON_ASSERTcxx . . $ `lemon/assert.h:193:13`!(_os != 0, "This writer is assigned to an other writer"); |
| 2630 | |
| 2631 | for (Sectionscxx . . $ lemon/SectionWriter#Sections#::iteratorcxx . . $ std/vector#iterator# it = _sectionscxx . . $ lemon/SectionWriter#_sections..begincxx . . $ std/vector#begin(55a6de06420d4903).(); |
| 2632 | it !=cxx . . $ __gnu_cxx/`operator!=`(30ee64f2df4eef8b). _sectionscxx . . $ lemon/SectionWriter#_sections..endcxx . . $ std/vector#end(55a6de06420d4903).(); ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(1613faa01bc3d014).it) { |
| 2633 | (*_oscxx . . $ lemon/SectionWriter#_os.) <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). '@' <<cxx . . $ std/`operator<<`(88df5bef833f7f83). it->cxx . . $ __gnu_cxx/__normal_iterator#`operator->`(65c2ec7035a77d3e).firstcxx . . $ std/pair#first. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 2634 | it->cxx . . $ __gnu_cxx/__normal_iterator#`operator->`(65c2ec7035a77d3e).secondcxx . . $ std/pair#second.->processcxx . . $ lemon/_writer_bits/Section#process(f7f45734e6842120).(*_oscxx . . $ lemon/SectionWriter#_os.); |
| 2635 | } |
| 2636 | } |
| 2637 | |
| 2638 | /// \brief Give back the stream of the writer |
| 2639 | /// |
| 2640 | /// Returns the stream of the writer |
| 2641 | stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& ostreamcxx . . $ lemon/SectionWriter#ostream(3094c9a1b678da92).() { |
| 2642 | return *_oscxx . . $ lemon/SectionWriter#_os.; |
| 2643 | } |
| 2644 | |
| 2645 | /// @} |
| 2646 | |
| 2647 | }; |
| 2648 | |
| 2649 | /// \ingroup lemon_io |
| 2650 | /// |
| 2651 | /// \brief Return a \ref SectionWriter class |
| 2652 | /// |
| 2653 | /// This function just returns a \ref SectionWriter class. |
| 2654 | /// |
| 2655 | /// Please see SectionWriter documentation about the custom section |
| 2656 | /// output. |
| 2657 | /// |
| 2658 | /// \relates SectionWriter |
| 2659 | /// \sa sectionWriter(const std::string& fn) |
| 2660 | /// \sa sectionWriter(const char *fn) |
| 2661 | inline SectionWritercxx . . $ lemon/SectionWriter# sectionWritercxx . . $ lemon/sectionWriter(40abaf5138a35633).(stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& os) { |
| 2662 | SectionWritercxx . . $ lemon/SectionWriter# tmpcxx . . $ lemon/SectionWriter#SectionWriter(f7f45734e6842120).(os); |
| 2663 | return tmpcxx . . $ lemon/SectionWriter#SectionWriter(f478d293e00b6f7b).; |
| 2664 | } |
| 2665 | |
| 2666 | /// \brief Return a \ref SectionWriter class |
| 2667 | /// |
| 2668 | /// This function just returns a \ref SectionWriter class. |
| 2669 | /// \relates SectionWriter |
| 2670 | /// \sa sectionWriter(std::ostream& os) |
| 2671 | inline SectionWritercxx . . $ lemon/SectionWriter# sectionWritercxx . . $ lemon/sectionWriter(9f9ac875952b0abe).(const stdcxx . . $ std/::stringcxx . . $ std/string#& fn) { |
| 2672 | SectionWritercxx . . $ lemon/SectionWriter# tmpcxx . . $ lemon/SectionWriter#SectionWriter(9c546c94e5fcce4e).(fn); |
| 2673 | return tmpcxx . . $ lemon/SectionWriter#SectionWriter(f478d293e00b6f7b).; |
| 2674 | } |
| 2675 | |
| 2676 | /// \brief Return a \ref SectionWriter class |
| 2677 | /// |
| 2678 | /// This function just returns a \ref SectionWriter class. |
| 2679 | /// \relates SectionWriter |
| 2680 | /// \sa sectionWriter(std::ostream& os) |
| 2681 | inline SectionWritercxx . . $ lemon/SectionWriter# sectionWritercxx . . $ lemon/sectionWriter(b73a50e3eeb1fc39).(const char* fn) { |
| 2682 | SectionWritercxx . . $ lemon/SectionWriter# tmpcxx . . $ lemon/SectionWriter#SectionWriter(85c52e162fed56f9).(fn); |
| 2683 | return tmpcxx . . $ lemon/SectionWriter#SectionWriter(f478d293e00b6f7b).; |
| 2684 | } |
| 2685 | } |
| 2686 | |
| 2687 | #endif |