DGtal  1.5.beta
TableReader.h
1 
17 #pragma once
18 
31 #if defined(TableReader_RECURSES)
32 #error Recursive header files inclusion detected in TableReader.h
33 #else // defined(TableReader_RECURSES)
35 #define TableReader_RECURSES
36 
37 #if !defined TableReader_h
39 #define TableReader_h
40 
42 // Inclusions
43 #include <iostream>
44 #include <vector>
45 #include "DGtal/base/Common.h"
46 #include "DGtal/geometry/curves/FreemanChain.h"
48 
49 namespace DGtal
50 {
51 
53  // class TableReader
85  template <typename TQuantity>
86  struct TableReader
87  {
88  // ----------------------- Standard services ------------------------------
89  public:
102  static std::vector<TQuantity>
103  getColumnElementsFromFile( const std::string & aFilename,
104  unsigned int aPosition );
105 
118  static std::vector<TQuantity>
119  getColumnElementsFromInputStream( std::istream & in, unsigned int aPosition );
120 
130  static std::vector<std::vector<TQuantity>>
131  getLinesElementsFromFile( const std::string & aFilename );
132 
143  static std::vector<std::vector<TQuantity>>
144  getLinesElementsFromInputStream( std::istream & in );
145 
146  }; // end of class TableReader
147 
148 
149 
150 } // namespace DGtal
151 
152 
154 // Includes inline functions.
155 #include "DGtal/io/readers/TableReader.ih"
156 
157 
158 // //
160 
161 #endif // !defined TableReader_h
162 
163 #undef TableReader_RECURSES
164 #endif // else defined(TableReader_RECURSES)
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: Implements method to read a set of numbers represented in each line of a file.
Definition: TableReader.h:87
static std::vector< TQuantity > getColumnElementsFromInputStream(std::istream &in, unsigned int aPosition)
static std::vector< TQuantity > getColumnElementsFromFile(const std::string &aFilename, unsigned int aPosition)
static std::vector< std::vector< TQuantity > > getLinesElementsFromFile(const std::string &aFilename)
static std::vector< std::vector< TQuantity > > getLinesElementsFromInputStream(std::istream &in)