From ccc1ca066fa7c1fb35929eceb52f2f36179aea37 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Thu, 8 Dec 2016 17:02:26 +0000 Subject: Remove inline from read_graph (now inline) Remove Edge_t template (not needed) Add documentation on template params git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/distance_matrix_in_rips_module@1839 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: a011b11cddf1a20e29743e6b170dac054ac79c12 --- src/common/include/gudhi/reader_utils.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/common/include') diff --git a/src/common/include/gudhi/reader_utils.h b/src/common/include/gudhi/reader_utils.h index 2d774d4d..4c8d85cd 100644 --- a/src/common/include/gudhi/reader_utils.h +++ b/src/common/include/gudhi/reader_utils.h @@ -74,6 +74,10 @@ inline void read_points(std::string file_name, std::vector< std::vector< double /** * @brief Read a graph from a file. * + * \tparam Graph_t Type for the return graph. Must be constructible from iterators on pairs of Vertex_handle + * \tparam Filtration_value Type for the value of the read filtration + * \tparam Vertex_handle Type for the value of the read vertices + * * File format: 1 simplex per line
* Dim1 X11 X12 ... X1d Fil1
* Dim2 X21 X22 ... X2d Fil2
@@ -83,13 +87,14 @@ inline void read_points(std::string file_name, std::vector< std::vector< double * Every simplex must appear exactly once. * Simplices of dimension more than 1 are ignored. */ -template< typename Graph_t, typename Edge_t, typename Filtration_value, typename Vertex_handle > -inline Graph_t read_graph(std::string file_name) { +template< typename Graph_t, typename Filtration_value, typename Vertex_handle > +Graph_t read_graph(std::string file_name) { std::ifstream in_(file_name.c_str(), std::ios::in); if (!in_.is_open()) { std::cerr << "Unable to open file " << file_name << std::endl; } + typedef std::pair< Vertex_handle, Vertex_handle > Edge_t; std::vector< Edge_t > edges; std::vector< Filtration_value > edges_fil; std::map< Vertex_handle, Filtration_value > vertices; -- cgit v1.2.3