Main Page · Modules · All Classes · Class Hierarchy
MSThread.hpp
1 /*
2  * This file is part of libmind library for AiBO+
3  *
4  * Copyright (C) 2005-2016 Csaba Kertész (csaba.kertesz@gmail.com)
5  *
6  * AiBO+ is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * AiBO+ is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
19  *
20  */
21 
22 #pragma once
23 
24 #include <MCDefs.hpp>
25 
26 #include <qmap.h>
27 #include <qthread.h>
28 
32 class MSThread : public QThread
33 {
34  Q_OBJECT
35 public:
36 
45  virtual void run() override;
46 
54  void AddObject(QObject& object);
55 
61  void RemoveObjects();
62 
70  bool IsEmpty();
71 
73  QMap<QObject*, QThread*> ObjectThreads;
74 };
bool IsEmpty()
Whether object is attached to the thread.
Definition: MSThread.cpp:63
void AddObject(QObject &object)
Add an object to this thread.
Definition: MSThread.cpp:33
void RemoveObjects()
Move the objects back to their original thread.
Definition: MSThread.cpp:46
Manages a new thread with objects.
Definition: MSThread.hpp:32
QMap< QObject *, QThread * > ObjectThreads
Remember for the original thread of the moved objects.
Definition: MSThread.hpp:73
virtual void run() override
Run the thread.
Definition: MSThread.cpp:26