LayoutThread.cpp
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5 *
6 * ArmarX is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * ArmarX is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * @package
19 * @author
20 * @date
21 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22 * GNU General Public License
23 */
24#include "LayoutThread.h"
25
26#include <utility>
27
28#include "LayoutController.h"
29#include "LayoutWorkerCreator.h"
30
32 QObject(), controller(state, startEnabled)
33{
34 if (state)
35 {
36 setState(state);
37 }
38}
39
41{
42 // exit();
43 // wait();
44}
45
46void
48{
49 // quit();
50 topState = state;
51 controller.setTopState(state);
52}
53
54void
56{
57 //construct LayoutWorkerCreator
58 workerCreator.reset(new LayoutWorkerCreator());
59
60 //connect controller and workerCreator
61 connect(&controller,
62 SIGNAL(createWorker(MediatorPtr, size_t, QString)),
63 workerCreator.get(),
64 SLOT(createWorker(MediatorPtr, size_t, QString)),
65 Qt::QueuedConnection);
66
67 connect(&controller,
68 SIGNAL(reset()),
69 workerCreator.get(),
70 SLOT(deleteWorkers()),
71 Qt::QueuedConnection);
72
73 //für alle mediator die der controller zu diesem Zeitpunkt schon hat (das ist mindestens der
74 //topState) müssen worker kreiert werden
75 controller.createAllWorkers();
76
77 // exec();
78}
void setState(armarx::statechartmodel::StatePtr state)
setState Stops the event loop and resets the top state.
LayoutThread(armarx::statechartmodel::StatePtr state=statechartmodel::StatePtr(new statechartmodel::State()), bool startEnabled=true)
std::shared_ptr< State > StatePtr
Definition State.h:48
std::shared_ptr< StateModelLayoutMediator > MediatorPtr