![]() |
aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
|
Class for fast parsing of CSV file (never more than one line in application memory) More...
#include <agrum/tools/database/CSVParser.h>
Public Member Functions | |
Constructors / Destructors | |
CSVParser (std::istream &in, const std::string &delimiter=",", const char commentmarker='#', const char quoteMarker='"', const allocator_type& alloc = allocator_type () ) | |
default constructor More... | |
virtual | ~CSVParser () |
destructor More... | |
Accessors / Modifiers | |
bool | next () |
gets the next line of the csv stream and parses it More... | |
const std::vector< std::string, ALLOC< std::string > > & | current () const |
returns the current parsed line More... | |
const std::size_t | nbLine () const |
returns the current line number within the stream More... | |
void | useNewStream (std::istream &in, const std::string &delimiter=",", const char commentmarker='#', const char quoteMarker='"' ) |
reopens a new input stream to parse More... | |
Public Types | |
using | allocator_type = ALLOC< std::string > |
type for the allocators passed in arguments of methods More... | |
Class for fast parsing of CSV file (never more than one line in application memory)
Typical use:
Definition at line 78 of file CSVParser.h.
using gum::learning::CSVParser< ALLOC >::allocator_type = ALLOC<std::string> |
type for the allocators passed in arguments of methods
Definition at line 82 of file CSVParser.h.
gum::learning::CSVParser< ALLOC >::CSVParser | ( | std::istream & | in, |
const std::string & | delimiter = "," , |
||
const char | commentmarker = '#' , |
||
const char | quoteMarker = '"' , |
||
const allocator_type & | alloc = allocator_type () |
||
) |
default constructor
in | an input stream containing the CSV |
delimiter | the character that acts as the column separator in the CSV |
commentmarker | the character that marks the beginning of a comment |
quoteMarker | the character that is used to quote the sentences in the CSV |
alloc | the allocator used by all the methods |
|
virtual |
destructor
const std::vector<std::string,ALLOC<std::string> >& gum::learning::CSVParser< ALLOC >::current | ( | ) | const |
returns the current parsed line
NullElement | is raised if there is no data |
const std::size_t gum::learning::CSVParser< ALLOC >::nbLine | ( | ) | const |
returns the current line number within the stream
bool gum::learning::CSVParser< ALLOC >::next | ( | ) |
gets the next line of the csv stream and parses it
void gum::learning::CSVParser< ALLOC >::useNewStream | ( | std::istream & | in, |
const std::string & | delimiter = "," , |
||
const char | commentmarker = '#' , |
||
const char | quoteMarker = '"' |
||
) |
reopens a new input stream to parse