Changes in / [183:0c6556a8e105:178:d2bac07f1742] in lemon-main
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/lgf_reader.h
r182 r174 2071 2071 /// \ingroup lemon_io 2072 2072 /// 2073 /// \brief Reader for the content sof the \ref lgf-format "LGF" file2073 /// \brief Reader for the content of the \ref lgf-format "LGF" file 2074 2074 /// 2075 2075 /// This class can be used to read the sections, the map names and … … 2077 2077 /// that, which type of graph, which maps and which attributes 2078 2078 /// should be read from a file, but in general tools (like glemon) 2079 /// the content sof an LGF file should be guessed somehow. This class2079 /// the content of an LGF file should be guessed somehow. This class 2080 2080 /// reads the graph and stores the appropriate information for 2081 2081 /// reading the graph. 2082 2082 /// 2083 ///\code LgfContent s contents("graph.lgf");2084 /// content s.run();2083 ///\code LgfContent content("graph.lgf"); 2084 /// content.run(); 2085 2085 /// 2086 2086 /// // does it contain any node section and arc section 2087 /// if (content s.nodeSectionNum() == 0 || contents.arcSectionNum()) {2087 /// if (content.nodeSectionNum() == 0 || content.arcSectionNum()) { 2088 2088 /// std::cerr << "Failure, cannot find graph" << std::endl; 2089 2089 /// return -1; 2090 2090 /// } 2091 2091 /// std::cout << "The name of the default node section : " 2092 /// << content s.nodeSection(0) << std::endl;2092 /// << content.nodeSection(0) << std::endl; 2093 2093 /// std::cout << "The number of the arc maps : " 2094 /// << content s.arcMaps(0).size() << std::endl;2094 /// << content.arcMaps(0).size() << std::endl; 2095 2095 /// std::cout << "The name of second arc map : " 2096 /// << content s.arcMaps(0)[1] << std::endl;2096 /// << content.arcMaps(0)[1] << std::endl; 2097 2097 ///\endcode 2098 class LgfContent s{2098 class LgfContent { 2099 2099 private: 2100 2100 … … 2122 2122 /// \brief Constructor 2123 2123 /// 2124 /// Construct an \e LGF content sreader, which reads from the given2124 /// Construct an \e LGF content reader, which reads from the given 2125 2125 /// input stream. 2126 LgfContent s(std::istream& is)2126 LgfContent(std::istream& is) 2127 2127 : _is(&is), local_is(false) {} 2128 2128 2129 2129 /// \brief Constructor 2130 2130 /// 2131 /// Construct an \e LGF content sreader, which reads from the given2131 /// Construct an \e LGF content reader, which reads from the given 2132 2132 /// file. 2133 LgfContent s(const std::string& fn)2133 LgfContent(const std::string& fn) 2134 2134 : _is(new std::ifstream(fn.c_str())), local_is(true) {} 2135 2135 2136 2136 /// \brief Constructor 2137 2137 /// 2138 /// Construct an \e LGF content sreader, which reads from the given2138 /// Construct an \e LGF content reader, which reads from the given 2139 2139 /// file. 2140 LgfContent s(const char* fn)2140 LgfContent(const char* fn) 2141 2141 : _is(new std::ifstream(fn)), local_is(true) {} 2142 2142 … … 2145 2145 /// The copy constructor transfers all data from the other reader, 2146 2146 /// therefore the copied reader will not be usable more. 2147 LgfContent s(LgfContents& other)2147 LgfContent(LgfContent& other) 2148 2148 : _is(other._is), local_is(other.local_is) { 2149 2149 … … 2164 2164 2165 2165 /// \brief Destructor 2166 ~LgfContent s() {2166 ~LgfContent() { 2167 2167 if (local_is) delete _is; 2168 2168 } … … 2189 2189 /// 2190 2190 /// Gives back the node maps for the given section. 2191 const std::vector<std::string>& nodeMap Names(int i) const {2191 const std::vector<std::string>& nodeMaps(int i) const { 2192 2192 return _node_maps[i]; 2193 2193 } … … 2195 2195 /// @} 2196 2196 2197 /// \name Arc /Edgesections2197 /// \name Arc sections 2198 2198 /// @{ 2199 2199 2200 /// \brief Gives back the number of arc /edgesections in the file.2201 /// 2202 /// Gives back the number of arc /edgesections in the file.2203 /// \note It is synon ym of \c edgeSectionNum().2200 /// \brief Gives back the number of arc sections in the file. 2201 /// 2202 /// Gives back the number of arc sections in the file. 2203 /// \note It is synonim of \c edgeSectionNum(). 2204 2204 int arcSectionNum() const { 2205 2205 return _edge_sections.size(); … … 2209 2209 /// 2210 2210 /// Returns the section name at the given position. 2211 /// \note It is synon ym of \c edgeSection().2211 /// \note It is synonim of \c edgeSection(). 2212 2212 const std::string& arcSection(int i) const { 2213 2213 return _edge_sections[i]; 2214 2214 } 2215 2215 2216 /// \brief Gives back the arc /edgemaps for the given section.2217 /// 2218 /// Gives back the arc /edgemaps for the given section.2219 /// \note It is synon ym of \c edgeMapNames().2220 const std::vector<std::string>& arcMap Names(int i) const {2216 /// \brief Gives back the arc maps for the given section. 2217 /// 2218 /// Gives back the arc maps for the given section. 2219 /// \note It is synonim of \c edgeMaps(). 2220 const std::vector<std::string>& arcMaps(int i) const { 2221 2221 return _edge_maps[i]; 2222 2222 } 2223 2223 2224 /// \brief Returns true when the section type is \c "@arcs". 2225 /// 2226 /// Returns true when the section type is \c "@arcs", and not "@edges". 2227 bool isArcSection(int i) const { 2228 return _arc_sections[i]; 2229 } 2230 2224 2231 /// @} 2225 2232 2226 /// \name Synonyms2233 /// \name Edge sections 2227 2234 /// @{ 2228 2235 2229 /// \brief Gives back the number of arc/edge sections in the file. 2230 /// 2231 /// Gives back the number of arc/edge sections in the file. 2232 /// \note It is synonym of \c arcSectionNum(). 2236 /// \brief Gives back the number of edge sections in the file. 2237 /// 2238 /// Gives back the number of edge sections in the file. 2233 2239 int edgeSectionNum() const { 2234 2240 return _edge_sections.size(); … … 2238 2244 /// 2239 2245 /// Returns the section name at the given position. 2240 /// \note It is synonym of \c arcSection().2241 2246 const std::string& edgeSection(int i) const { 2242 2247 return _edge_sections[i]; … … 2246 2251 /// 2247 2252 /// Gives back the edge maps for the given section. 2248 /// \note It is synonym of \c arcMapNames(). 2249 const std::vector<std::string>& edgeMapNames(int i) const { 2253 const std::vector<std::string>& edgeMaps(int i) const { 2250 2254 return _edge_maps[i]; 2255 } 2256 2257 /// \brief Returns true when the section type is \c "@edges". 2258 /// 2259 /// Returns true when the section type is \c "@edges", and not "@arcs". 2260 bool isEdgeSection(int i) const { 2261 return !_arc_sections[i]; 2251 2262 } 2252 2263 … … 2266 2277 /// 2267 2278 /// Returns the section name at the given position. 2268 const std::string& attributeSection Names(int i) const {2279 const std::string& attributeSection(int i) const { 2269 2280 return _attribute_sections[i]; 2270 2281 } … … 2349 2360 public: 2350 2361 2351 /// \name Execution of the content sreader2362 /// \name Execution of the content reader 2352 2363 /// @{ 2353 2364
Note: See TracChangeset
for help on using the changeset viewer.