libRDataFrame  0.815
A library with R style datatypes and associated utilities
 All Classes Files Functions Variables Pages
utilCSV.hpp
1 #ifndef UTILCSV_HPP_INCLUDED
2 #define UTILCSV_HPP_INCLUDED
3 
4 
5 #include <typeinfo>
6 #include <cxxabi.h>
7 #include <iostream>
8 #include <ostream>
9 #include <string>
10 #include <vector>
11 #include <map>
12 #include <array>
13 #include <initializer_list>
14 #include <boost/any.hpp>
15 
16 
17 class utilCSV
18 {
19 protected:
20  std::string fromCSVFile;
21  int readToLine;
22  bool hasHeader;
23  int nrows;
24  int ncols;
25  std::string lineToParse;
26  std::vector<std::string> parsedLine;
27  std::vector<std::string> colNames;
28  std::vector<std::string> colTypes;
29  std::vector<std::string> csvToParse;
30  std::vector<std::vector<std::string> > strDataStruct;
31 
32 public:
33  utilCSV();
34  utilCSV(std::string frCSV, bool header, int rtoline = 0);
35  int getNcols();
36  int getNrows();
37  void setNcols();
38  void setNrows();
39  void setColNames(std::vector<std::string> cnames);
40  std::vector<std::string> getColNames();
41  std::vector<std::string> getColTypes();
42  std::vector<std::string> getCVS();
43  std::vector<std::vector<std::string> > getStrDataStruct();
44  std::vector<std::string> readCSV(std::string iFileN);
45  std::vector<std::string> parseLine(std::string lineToParse);
46  std::vector<std::vector<std::string> > buildDataStruct(std::vector<std::string> csvToParse);
47  void writeCSV(std::vector<std::vector<std::string> > strDataStruct, std::string oFName);
48  void displayColNames();
49  void displayInternCSV();
50  void displayStrDataStruct();
51  std::string toString();
52 };
53 
54 
55 #endif // UTILCSV_HPP_INCLUDED
void displayStrDataStruct()
Definition: utilCSV.cpp:269
std::vector< std::string > readCSV(std::string iFileN)
Definition: utilCSV.cpp:147
void setColNames(std::vector< std::string > cnames)
Definition: utilCSV.cpp:123
int getNcols()
Definition: utilCSV.cpp:106
void setNrows()
Definition: utilCSV.cpp:118
std::vector< std::vector< std::string > > buildDataStruct(std::vector< std::string > csvToParse)
Definition: utilCSV.cpp:183
void displayColNames()
Definition: utilCSV.cpp:240
utilCSV()
Contains the data structures receiving the imported data from the CSV file (or going to be written to...
Definition: utilCSV.cpp:63
std::vector< std::string > getCVS()
Definition: utilCSV.cpp:140
int getNrows()
Definition: utilCSV.cpp:110
void writeCSV(std::vector< std::vector< std::string > > strDataStruct, std::string oFName)
Definition: utilCSV.cpp:200
void setNcols()
Definition: utilCSV.cpp:114
Definition: utilCSV.hpp:17
std::vector< std::string > getColTypes()
Definition: utilCSV.cpp:137
std::vector< std::vector< std::string > > getStrDataStruct()
Definition: utilCSV.cpp:143
std::string toString()
Definition: utilCSV.cpp:299
void displayInternCSV()
Definition: utilCSV.cpp:253
std::vector< std::string > getColNames()
Definition: utilCSV.cpp:134
std::vector< std::string > parseLine(std::string lineToParse)
Definition: utilCSV.cpp:166