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 "LayoutController.h"
25 #include "LayoutWorkerCreator.h"
26 #include "LayoutThread.h"
27 
28 #include <utility>
29 
31  : QObject(),
32  controller(state, startEnabled)
33 {
34  if (state)
35  {
36  setState(state);
37  }
38 }
39 
41 {
42  // exit();
43  // wait();
44 }
45 
47 {
48  // quit();
49  topState = state;
50  controller.setTopState(state);
51 }
52 
54 {
55  //construct LayoutWorkerCreator
56  workerCreator.reset(new LayoutWorkerCreator());
57 
58  //connect controller and workerCreator
59  connect(&controller, SIGNAL(createWorker(MediatorPtr, size_t, QString)),
60  workerCreator.get(), SLOT(createWorker(MediatorPtr, size_t, QString)), Qt::QueuedConnection);
61 
62  connect(&controller, SIGNAL(reset()),
63  workerCreator.get(), SLOT(deleteWorkers()), Qt::QueuedConnection);
64 
65  //für alle mediator die der controller zu diesem Zeitpunkt schon hat (das ist mindestens der
66  //topState) müssen worker kreiert werden
67  controller.createAllWorkers();
68 
69  // exec();
70 }
LayoutWorkerCreator.h
armarx::LayoutWorkerCreator
Definition: LayoutWorkerCreator.h:44
LayoutController.h
armarx::LayoutThread::setState
void setState(armarx::statechartmodel::StatePtr state)
setState Stops the event loop and resets the top state.
Definition: LayoutThread.cpp:46
controller
Definition: AddOperation.h:39
armarx::LayoutThread::run
void run()
Definition: LayoutThread.cpp:53
LayoutThread.h
armarx::MediatorPtr
std::shared_ptr< StateModelLayoutMediator > MediatorPtr
Definition: LayoutController.h:41
armarx::statechartmodel::StatePtr
std::shared_ptr< State > StatePtr
Definition: State.h:46
armarx::LayoutThread::~LayoutThread
~LayoutThread() override
Definition: LayoutThread.cpp:40
armarx::LayoutThread::LayoutThread
LayoutThread(armarx::statechartmodel::StatePtr state=statechartmodel::StatePtr(new statechartmodel::State()), bool startEnabled=true)
Definition: LayoutThread.cpp:30