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 Elie Al Alam <firstname.surname@utc.fr>
|
---|
6 | /// @author Gerald Dherbomez <firstname.surname@utc.fr>
|
---|
7 | /// @author Marek Kurdej <firstname.surname@utc.fr>
|
---|
8 | /// @date April, 2007
|
---|
9 | /// @version $Id: main.cpp 81 2013-01-11 22:31:02Z kurdejma $
|
---|
10 | /// @copyright Copyright (c) UTC/CNRS Heudiasyc 2006 - 2013. All rights reserved.
|
---|
11 | /// @brief DbitePlayer main function.
|
---|
12 | ///
|
---|
13 | /// Detailed description.
|
---|
14 | /// @todo - barre de temps dans l'affichage graphique
|
---|
15 | /// - am�liorer l'affichage ; ic�ne, emplacement des boutons...
|
---|
16 | /// - ajouter r�pertoire racine des donn�es (fait) :
|
---|
17 | /// ajouter affichage de ce r�pertoire
|
---|
18 | /// - ajouter classe g�n�rique d'�change de donn�es vers
|
---|
19 | /// d'autres applications
|
---|
20 | /// - fen�tre de monitoring des composants : valable pour
|
---|
21 | /// toutes les applis bas�es sur PacpusLib
|
---|
22 | /// avec possibilit� de masquer cette partie
|
---|
23 | /// - faire une classe GraphViewer :
|
---|
24 | /// permet d'afficher un nombre ind�fini de courbes
|
---|
25 | /// offre des param�tres basiques : couleurs de la courbe,
|
---|
26 | /// types de points, reli�s ou pas
|
---|
27 | /// les courbes sont identifi�s par des noms
|
---|
28 | /// voir comment l'utilisateur peut interagir avec les courbes
|
---|
29 | /// par ex recuperer la valeur d'un point
|
---|
30 | /// - associer a chaque composant une fenetre en dock view,
|
---|
31 | /// affichagable ou pas defini dans le fichier de config
|
---|
32 |
|
---|
33 | #include <Pacpus/DbitePlayer/DbtPlyEngine.h>
|
---|
34 | #include <Pacpus/DbitePlayer/DbtPlyTrigger.h>
|
---|
35 | #include <Pacpus/DbitePlayer/DbtPlyUserInterface.h>
|
---|
36 | #include <Pacpus/kernel/ComponentManager.h>
|
---|
37 | #include <Pacpus/kernel/ComponentFactory.h>
|
---|
38 | #include <Pacpus/kernel/Log.h>
|
---|
39 | #include <Pacpus/kernel/PacpusApplication.h>
|
---|
40 | #include <Pacpus/kernel/PacpusPluginInterface.h>
|
---|
41 |
|
---|
42 | #include <cassert>
|
---|
43 | #include <QApplication>
|
---|
44 |
|
---|
45 | using namespace pacpus;
|
---|
46 | using namespace std;
|
---|
47 |
|
---|
48 | DECLARE_STATIC_LOGGER("pacpus.core.DbitePlayer");
|
---|
49 |
|
---|
50 | static const string kDefaultXmlConfigFilePath = "DbitePlayer.xml";
|
---|
51 |
|
---|
52 | int main(int argc, char * argv[])
|
---|
53 | {
|
---|
54 | LogConfigurator::configureLoggerWithFile("DbitePlayer_%N.log");
|
---|
55 |
|
---|
56 | PacpusApplication app(argc, argv);
|
---|
57 | ComponentManager * mgr = ComponentManager::getInstance();
|
---|
58 |
|
---|
59 | static ComponentFactory<DbtPlyEngine> factoryDbtPlyEngine("DbtPlyEngine");
|
---|
60 | Q_UNUSED(factoryDbtPlyEngine);
|
---|
61 | static ComponentFactory<DbtPlyTrigger> factoryDbtPlyTrigger("DbtPlyTrigger");
|
---|
62 | Q_UNUSED(factoryDbtPlyTrigger);
|
---|
63 | static ComponentFactory<DbtPlyUserInterface> factoryDbtPlyUserInterface("DbtPlyUserInterface");
|
---|
64 | Q_UNUSED(factoryDbtPlyUserInterface);
|
---|
65 |
|
---|
66 | string configFilePath;
|
---|
67 | if (argc > 1) {
|
---|
68 | configFilePath = argv[1];
|
---|
69 | } else {
|
---|
70 | configFilePath = kDefaultXmlConfigFilePath;
|
---|
71 | LOG_WARN("no XML config file specified. Using default: " << configFilePath);
|
---|
72 | }
|
---|
73 | LOG_INFO("loading file '" << configFilePath << "'");
|
---|
74 | size_t componentCount = mgr->loadComponents(configFilePath.c_str());
|
---|
75 | if (componentCount == 0) {
|
---|
76 | LOG_FATAL("no components, exiting");
|
---|
77 | return EXIT_FAILURE;
|
---|
78 | }
|
---|
79 |
|
---|
80 | // start all the components (engine, trigger, user interface and the DBT file managers)
|
---|
81 | mgr->start();
|
---|
82 | // save application exit status
|
---|
83 | int exitStatus = app.exec();
|
---|
84 | // stop all components before exiting app
|
---|
85 | mgr->stop();
|
---|
86 |
|
---|
87 | mgr->destroy();
|
---|
88 |
|
---|
89 | // return application exit status
|
---|
90 | return exitStatus;
|
---|
91 | }
|
---|