PPL Assignment
IRM2015006
csv_creator.h
Go to the documentation of this file.
1 #include <iostream>
2 #include <fstream>
3 #include <vector>
4 #include <cstdlib>
5 
6 #ifndef CSV_CREATOR_H
7 #define CSV_CREATOR_H
8 
9 /* Generatlized class to generate CSV file */
11 {
12 private:
13  std::vector <std::string> headers; /* Vector of headers of CSV file */
14  std::vector <int> min_value; /* List of min values for numeric arguments */
15  std::vector <int> max_value; /* List of max values for numeric arguments */
16  std::string filename; /* The filename to write CSV to */
17  std::string type; /* The type of datas in CSV which becomes prefix of names */
18  int fields; /* The number of fields in CSV file */
19 
20  /* Method to generate random number within a range */
21  int get_random_int(int min, int max);
22 public:
23 
24  /* Constructor with CSV parameters as arguments */
25  CSVCreator(std::string filename,
26  std::string type,
27  std::vector<std::string> headers,
28  std::vector<int> min_value,
29  std::vector<int> max_value);
30 
31  /* Method to generate CSV file */
32  void generate(int n);
33 };
34 
35 #endif
std::string filename
Definition: csv_creator.h:16
std::vector< int > max_value
Definition: csv_creator.h:15
int get_random_int(int min, int max)
Definition: csv_creator.cpp:49
void generate(int n)
Definition: csv_creator.cpp:25
std::string type
Definition: csv_creator.h:17
std::vector< int > min_value
Definition: csv_creator.h:14
std::vector< std::string > headers
Definition: csv_creator.h:13
CSVCreator(std::string filename, std::string type, std::vector< std::string > headers, std::vector< int > min_value, std::vector< int > max_value)
Definition: csv_creator.cpp:7