LayoutWorkerCreator.h
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#pragma once
25
26#include <map>
27#include <memory>
28
29#include <QObject>
30
31#include "Layout.h"
32#include "LayoutController.h" //for MediatorPtr
33#include "LayoutWorker.h"
34
35namespace armarx
36{
37
38 using LayoutWorkerPtr = std::unique_ptr<LayoutWorker>;
39 using WorkerMap = std::map<size_t, LayoutWorkerPtr>;
40
42 using LayoutWorkerCreatorPtr = std::unique_ptr<LayoutWorkerCreator>;
43
44 class LayoutWorkerCreator : public QObject
45 {
46 Q_OBJECT
47
48 public:
50
51 signals:
52 /**
53 * @brief connectedWorkerAndMediator Notifies that the worker's signals and slots are now
54 * connected to its mediator.
55 * @param id The id of the worker and mediator.
56 */
58
59 public slots:
60 /**
61 * @brief createWorker Create worker with given id and connect it to mediator via signals and slots.
62 * @param mediator Manages the communication between the new worker and the associated state.
63 * @param id The mediator's and worker's id.
64 */
65 void createWorker(MediatorPtr mediator, size_t id, QString name);
66
67 /**
68 * @brief deleteWorker Calls the destructor of the worker with the given id.
69 * @param id ID of the worker that is to be deleted.
70 */
71 void deleteWorker(size_t id);
72
73 /**
74 * @brief deleteWorkers Calls the destructor of every worker.
75 */
76 void deleteWorkers();
77
78 private:
79 /**
80 * @brief workers Maps the ids to the workers.
81 */
82 WorkerMap workers;
83
84 /**
85 * @brief graphvizContext Needed for layouting the graphs.
86 */
87 GvcPtr graphvizContext;
88 };
89} //namespace armarx
void deleteWorkers()
deleteWorkers Calls the destructor of every worker.
void connectedWorkerAndMediator(size_t id)
connectedWorkerAndMediator Notifies that the worker's signals and slots are now connected to its medi...
void deleteWorker(size_t id)
deleteWorker Calls the destructor of the worker with the given id.
void createWorker(MediatorPtr mediator, size_t id, QString name)
createWorker Create worker with given id and connect it to mediator via signals and slots.
This file offers overloads of toIce() and fromIce() functions for STL container types.
std::unique_ptr< LayoutWorkerCreator > LayoutWorkerCreatorPtr
std::map< size_t, LayoutWorkerPtr > WorkerMap
GVC_t * GvcPtr
Definition Layout.h:39
std::unique_ptr< LayoutWorker > LayoutWorkerPtr
std::shared_ptr< StateModelLayoutMediator > MediatorPtr