Limbo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
test_bison.cpp
Go to the documentation of this file.
1 
8 #include <iostream>
9 #include <fstream>
10 
12 
13 using std::cout;
14 using std::cin;
15 using std::endl;
16 using std::string;
17 
21 {
22  public:
25  {
26  cout << "GdfDataBase::" << __func__ << endl;
27  }
31  virtual void add_gdf_cell(GdfParser::Cell& cell)
32  {
33  cout << cell << endl;
34  }
35 };
36 
38 void test1(string const& filename)
39 {
40  cout << "////////////// test1 ////////////////" << endl;
41  GdfDataBase db;
42  GdfParser::read(db, filename);
43 }
44 
46 void test2(string const& filename)
47 {
48  cout << "////////////// test2 ////////////////" << endl;
49  GdfDataBase db;
50  GdfParser::Driver driver (db);
51  //driver.trace_scanning = true;
52  //driver.trace_parsing = true;
53 
54  driver.parse_file(filename);
55 }
56 
61 int main(int argc, char** argv)
62 {
63 
64  if (argc > 1)
65  {
66  test1(argv[1]);
67  //test2(argv[1]);
68  }
69  else
70  cout << "at least 1 argument is required" << endl;
71 
72  return 0;
73 }
Base class for def database. Only pure virtual functions are defined. User needs to inheritate this c...
Definition: GdfDataBase.h:456
bool parse_file(const string &filename)
the whole routing layout is describe by a cell
Definition: GdfDataBase.h:407
void test2(string const &filename)
test 2: use class wrapper BookshelfParser::Driver
Definition: test_bison.cpp:104
virtual void add_gdf_cell(GdfParser::Cell &cell)
add routing cell
Definition: test_bison.cpp:31
void test1(string const &filename)
test 1: use function wrapper BookshelfParser::read
Definition: test_bison.cpp:96
bool read(GdfDataBase &db, const string &filename)
API for GdfParser. Read GDF file and initialize database by calling user-defined callback functions...
Driver for Gdf parser.
int main(int argc, char **argv)
main function
Definition: test_bison.cpp:119
Custom class that inheritates GdfParser::GdfDataBase with all the required callbacks gdfined...
Definition: test_bison.cpp:20
GdfDataBase()
constructor
Definition: test_bison.cpp:24