15 static unsigned int constexpr BUFFER_SIZE = 128 * 1024 * 1024;
32 int64_t count(
stream->read(
end, size).gcount());
34 LOG(2,
"Scanner") << count <<
" bytes fetched." << std::endl;
54 std::string
nextLine(
char const delimiter =
'\n') {
55 std::stringstream lineStream;
56 bool terminated(
false);
60 case 0: terminated =
true;
break;
63 if (c != delimiter) lineStream.put(c);
64 else terminated =
true;
67 }
while (!terminated);
68 return lineStream.str();
71 template <
typename NumberType>
76template <
typename NumberType = Float64>
82 : scanner(scanner_) {}
84 scanner->refillBuffer();
85 return scanReal(&scanner->pos);
88 return std::strtod(*position, position);
96template <
typename Real>
100 : scanner(scanner_) {}
102 scanner->refillBuffer();
103 while (isspace(*scanner->pos) || *scanner->pos ==
'(') ++scanner->pos;
#define LOG(...)
Definition Log.hpp:119
NumberScanner(Scanner *scanner_)
Definition Scanner.hpp:99
Complex< Real > nextNumber()
Definition Scanner.hpp:101
Scanner * scanner
Definition Scanner.hpp:116
Float64 nextNumber()
Definition Scanner.hpp:83
Scanner * scanner
Definition Scanner.hpp:92
NumberScanner(Scanner *scanner_)
Definition Scanner.hpp:81
static Float64 scanReal(char **position)
Definition Scanner.hpp:87
Definition Scanner.hpp:77
Definition Scanner.hpp:13
bool eof
Definition Scanner.hpp:20
std::string nextLine(char const delimiter='\n')
Definition Scanner.hpp:54
void refillBuffer()
Definition Scanner.hpp:22
std::istream * stream
Definition Scanner.hpp:18
Scanner(std::istream *stream_)
Definition Scanner.hpp:47
static unsigned int constexpr REFILL_SIZE
Definition Scanner.hpp:16
char * buffer
Definition Scanner.hpp:19
char * pos
Definition Scanner.hpp:19
char * end
Definition Scanner.hpp:19
static unsigned int constexpr BUFFER_SIZE
Definition Scanner.hpp:15
Definition Algorithm.hpp:10
FloatTypes< 64 >::type Float64
Definition Float.hpp:30
std::complex< Real > Complex
Definition Complex.hpp:10
Complex< real > complex
Definition Complex.hpp:17