-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cxx
39 lines (28 loc) · 1.28 KB
/
main.cxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <iostream>
#include <vector>
#include <rapidcsv/view.h>
#include <cxxopts/cxxopts.hpp>
#include <cpp-properties/PropertiesParser.h>
#include "gtest/gtest.h"
#include "gmock/gmock.h"
int main(int argc, char** argv)
{
cxxopts::Options options("MyProgram", "One line description of MyProgram");
options.add_options()
("p,propfilename", "The property filename", cxxopts::value<std::string>());
//options.parse_positional({"script", "server", "filenames"});
std::cout << "start parse" << std::endl << std::flush;
// Parse options the usual way
auto result = options.parse(argc, argv);
std::cout << "end parse" << std::endl << std::flush;
std::string propFileName = result["propfilename"].as<std::string>();
std::cout << "propFileName=" << propFileName << std::endl;
cppproperties::Properties props = cppproperties::PropertiesParser::Read(propFileName);
std::string csvFileName = props.GetPropertyExpanded("csvfilename");
//rapidcsv::Document doc("/home/vishnu/repositories/rapidcsv_FilterSort/examples/colhdr.csv");
rapidcsv::Document doc(csvFileName);
std::vector<float> col = doc.GetColumn<float>("Close");
std::cout << "Read " << col.size() << " values." << std::endl;
EXPECT_EQ(5, col.size());
return 0;
}