source: pacpusframework/branches/0.0.x/src/DBITEPlayer/src/main.cpp@ 305

Last change on this file since 305 was 91, checked in by DHERBOMEZ Gérald, 11 years ago

Improvement of the build system to avoid some workarounds

  • Property svn:keywords set to Id
File size: 2.3 KB
Line 
1// %pacpus:license{
2// This file is part of the PACPUS framework distributed under the
3// CECILL-C License, Version 1.0.
4// %pacpus:license}
5/// @author Gerald Dherbomez <firstname.surname@utc.fr>
6/// @author Marek Kurdej <firstname.surname@utc.fr>
7/// @date April, 2007
8/// @version $Id: main.cpp 91 2013-05-19 10:32:48Z gdherbom $
9/// @copyright Copyright (c) UTC/CNRS Heudiasyc 2006 - 2013. All rights reserved.
10/// @brief DbitePlayer main function.
11///
12/// Detailed description.
13
14#include <Pacpus/DbitePlayer/DbtPlyEngine.h>
15#include <Pacpus/DbitePlayer/DbtPlyTrigger.h>
16#include <Pacpus/DbitePlayer/DbtPlyUserInterface.h>
17#include <Pacpus/kernel/ComponentManager.h>
18#include <Pacpus/kernel/ComponentFactory.h>
19#include <Pacpus/kernel/Log.h>
20#include <Pacpus/kernel/PacpusApplication.h>
21#include <Pacpus/kernel/PacpusPluginInterface.h>
22
23#include <cassert>
24#include <QApplication>
25
26using namespace pacpus;
27using namespace std;
28
29DECLARE_STATIC_LOGGER("pacpus.core.DbitePlayer");
30
31static const string kDefaultXmlConfigFilePath = "DbitePlayer.xml";
32
33int main(int argc, char * argv[])
34{
35 PacpusApplication app(argc, argv);
36 ComponentManager * mgr = ComponentManager::getInstance();
37
38 static ComponentFactory<DbtPlyEngine> factoryDbtPlyEngine("DbtPlyEngine");
39 Q_UNUSED(factoryDbtPlyEngine);
40 static ComponentFactory<DbtPlyTrigger> factoryDbtPlyTrigger("DbtPlyTrigger");
41 Q_UNUSED(factoryDbtPlyTrigger);
42 static ComponentFactory<DbtPlyUserInterface> factoryDbtPlyUserInterface("DbtPlyUserInterface");
43 Q_UNUSED(factoryDbtPlyUserInterface);
44
45 string configFilePath;
46 if (argc > 1) {
47 configFilePath = argv[1];
48 } else {
49 configFilePath = kDefaultXmlConfigFilePath;
50 LOG_WARN("no XML config file specified. Using default: " << configFilePath);
51 }
52 LOG_INFO("loading file '" << configFilePath << "'");
53 size_t componentCount = mgr->loadComponents(configFilePath.c_str());
54 if (componentCount == 0) {
55 LOG_FATAL("no components, exiting");
56 return EXIT_FAILURE;
57 }
58
59 // start all the components (engine, trigger, user interface and the DBT file managers)
60 mgr->start();
61 // save application exit status
62 int exitStatus = app.exec();
63 // stop all components before exiting app
64 mgr->stop();
65
66 mgr->destroy();
67
68 // return application exit status
69 return exitStatus;
70}
Note: See TracBrowser for help on using the repository browser.