1 #ifndef GENESIS_UTILS_IO_INPUT_SOURCE_H_
2 #define GENESIS_UTILS_IO_INPUT_SOURCE_H_
69 std::string
const& file_name,
70 bool detect_compression =
true
73 return std::make_shared<utils::GzipInputSource>(
74 std::make_shared< FileInputSource >( file_name )
77 return std::make_shared< FileInputSource >( file_name );
91 inline std::vector<std::shared_ptr<BaseInputSource>>
from_files(
92 std::vector<std::string>
const& file_names,
93 bool detect_compression =
true
95 std::vector<std::shared_ptr<BaseInputSource>> ret;
96 for(
size_t i = 0; i < file_names.size(); ++i ) {
97 ret.emplace_back(
from_file( file_names[i], detect_compression ));
111 template<
typename InputIterator>
112 inline std::vector<std::shared_ptr<BaseInputSource>>
from_files(
115 bool detect_compression =
true
117 std::vector<std::shared_ptr<BaseInputSource>> ret;
118 while( first != last ) {
119 ret.emplace_back(
from_file( *first, detect_compression ));
135 std::string
const& input_string
137 return std::make_shared< StringInputSource >( input_string );
149 std::vector<std::string>
const& input_strings
151 std::vector<std::shared_ptr<BaseInputSource>> ret;
152 for(
size_t i = 0; i < input_strings.size(); ++i ) {
153 ret.emplace_back(
from_string( input_strings[i] ));
166 template<
typename InputIterator>
171 std::vector<std::shared_ptr<BaseInputSource>> ret;
172 while( first != last ) {
190 std::istream& input_stream
192 return std::make_shared< StreamInputSource >( input_stream );
206 return std::make_shared< StreamInputSource >( std::cin );
212 #endif // include guard