aGrUM 3.1.1
a C++ library for (probabilistic) graphical models
CSVParser_inl.h
Go to the documentation of this file.
1
20#pragma once
21
22#include <agrum/base/database/CSVParser.h> // to ease IDE parser
23#ifndef DOXYGEN_SHOULD_SKIP_THIS
24
26
27namespace gum {
28
29 namespace learning {
30
31 // gets the next line of the csv stream and parses it
32
33 // search for quote taking into account the '\'...
34
35 // returns the current parsed line
36 INLINE const std::vector< std::string >& CSVParser::current() const {
37 if (_emptyData_) GUM_ERROR(NullElement, "No parsed data")
38
39 return _data_;
40 }
41
42 // returns the current nbLine of parser line
43 INLINE std::size_t CSVParser::nbLine() const {
44 if (_nbLine_ == 0) GUM_ERROR(NullElement, "No parsed data")
45
46 return _nbLine_;
47 }
48
49 } /* namespace learning */
50
51} /* namespace gum */
52
53#endif /* DOXYGEN_SHOULD_SKIP_THIS */
Class for fast parsing of CSV file (never more than one line in application memory).
CSVParser(std::istream &in, const std::string &filename, const std::string &delimiter=",", const char commentmarker='#', const char quoteMarker='"')
default constructor
std::size_t nbLine() const
returns the current line number within the stream
const std::vector< std::string > & current() const
returns the current parsed line
#define GUM_ERROR(type, msg)
Definition exceptions.h:76
include the inlined functions if necessary
Definition CSVParser.h:55
gum is the global namespace for all aGrUM entities
Definition agrum.h:46