YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
main.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: LGPL-2.1-or-later
4 */
5
6#include "mainwindow.h"
7#include <QApplication>
9#include <yarp/os/Os.h>
10#include <yarp/os/Time.h>
11#include <cstdio>
12#include <csignal>
13
14static void sighandler (int signal)
15{
16 fprintf(stdout,"This module cannot be closed with CTRL-C. Use <quit> menu to exit\n");
17}
18
19int main(int argc, char *argv[])
20{
22 if (!yarp.checkNetwork())
23 {
24 fprintf(stderr,"ERROR: check YARP network.\n");
25 return -1;
26 }
27
29 rf.setDefaultConfigFile("yarprunLogger.ini"); //overridden by --from parameter
30 rf.setDefaultContext("yarprunLogger"); //overridden by --context parameter
31 rf.configure(argc,argv);
32
33 QApplication a(argc, argv); // Eats the "--name" argument, therefore initialized after the ResourceFinder
34
35 bool cannot_close = rf.check("no_stop");
36 if (cannot_close)
37 {
38 std::signal(SIGINT, sighandler);
39 std::signal(SIGTERM, sighandler);
40 }
41
42 MainWindow w;
43 w.show();
44
45 return a.exec();
46}
MainWindow class.
Definition display.h:22
Utilities for manipulating the YARP network, including initialization and shutdown.
Definition Network.h:706
Helper class for finding config files and other external resources.
bool check(const std::string &key) const override
Check if there exists a property of the given name.
bool setDefaultContext(const std::string &contextName)
Sets the context for the current ResourceFinder object.
bool configure(int argc, char *argv[], bool skipFirstArgument=true)
Sets up the ResourceFinder.
static ResourceFinder & getResourceFinderSingleton()
Access a ResourceFinder singleton whose lifetime will match that of the YARP library.
bool setDefaultConfigFile(const std::string &fname)
Provide a default value for the configuration file (can be overridden from command line with the –fro...
int main(int argc, char *argv[])
Definition main.cpp:385
static void sighandler(int signal)
Definition main.cpp:14
@ YARP_CLOCK_SYSTEM
Definition Time.h:28
The main, catch-all namespace for YARP.
Definition dirs.h:16