BlinkenArea - GitList
Repositories
Blog
Wiki
libetherpix
Code
Commits
Branches
Tags
Search
Tree:
5c70d9d
Branches
Tags
master
libetherpix
simulator
main.cpp
implement receiving packets
Stefan Schuermans
commited
5c70d9d
at 2017-06-11 15:48:14
main.cpp
Blame
History
Raw
/* * EtherPix simulator * * Copyright 2017 Stefan Schuermans <stefan schuermans info> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3 of the License. * * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <gtkmm.h> #include <iostream> #include <string.h> #include "config.h" #include "etherpix_sim.glade.h" #include "main_window.h" int main(int argc, char *argv[]) { // instantiate GTK main loop Gtk::Main kit(argc, argv); // parse arguments if (argc < 2) { std::cerr << "usage: " << argv[0] << " <sim_config.etps>" << std::endl; return 2; } char *configFile = argv[1]; try { // parse config file Config config(configFile); // create window Glib::RefPtr<Gtk::Builder> builder = Gtk::Builder::create_from_string(widgets_etherpix_sim); // connect main window to its class MainWindow *mainWindow; builder->get_widget_derived("MainWindow", mainWindow); mainWindow->setConfig(config); // append config file name to window title mainWindow->set_title(mainWindow->get_title() + " - " + configFile); // start operation config.start(); // run GTK main loop Gtk::Main::run(); // stop operation config.stop(); } catch (std::exception &ex) { std::cerr << ex.what() << std::endl; return 3; } return 0; }