SLIP  1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ContainerReader.hpp
Go to the documentation of this file.
1 
9 #ifndef CONTAINERREADER_HPP_
10 #define CONTAINERREADER_HPP_
11 
12 #include <string>
13 
14 namespace slip {
15 
34 template<class Container, typename T, std::size_t Nb_block>
36 
37 public:
38 
39  typedef Container container_type;
40  typedef T value_type;
45 
50  :data_filename_("")
51  {}
52 
58  ContainerReader(std::string data_filename)
59  :data_filename_(data_filename)
60  {}
61 
65  virtual ~ContainerReader(){}
66 
76  const std::string& get_data_filename() const;
77 
81  void set_data_filename(const std::string& data_filename);
85  std::size_t get_nb_block() const;
86 
97  virtual int read(container_type & dat_in) = 0;
98 
99 protected:
100  std::string data_filename_;
101 
102 
103 }; // end of IO group
105 }
107 namespace slip {
108 
109 template<class Container, typename T, std::size_t Nb_block>
110 inline
112  return data_filename_;
113 }
114 
115 template<class Container, typename T, std::size_t Nb_block>
116 inline
117 void ContainerReader<Container, T, Nb_block>::set_data_filename(const std::string& data_filename) {
118  data_filename_ = data_filename;
119 }
120 
121 template<class Container, typename T, std::size_t Nb_block>
122 inline
124  return Nb_block;
125 }
126 
127 }
129 #endif /* CONTAINERREADER_HPP_ */
130 
131 
const std::string & get_data_filename() const
return the name of the file containing the data to read
std::size_t get_nb_block() const
return the number of splitting blocks of the data
ContainerReader(std::string data_filename)
ContainerReader is the base class of the readers classes. All readers are working the same way: ...
void set_data_filename(const std::string &data_filename)
virtual int read(container_type &dat_in)=0
virtual read function. If Nb_block is more than one, it reads only one container, and returns 0...