SMTK
@SMTK_VERSION@
Simulation Modeling Tool Kit
smtk
extension
paraview
appcomponents
pqSMTKCallObserversOnMainThreadBehavior.h
1
//=========================================================================
2
// Copyright (c) Kitware, Inc.
3
// All rights reserved.
4
// See LICENSE.txt for details.
5
//
6
// This software is distributed WITHOUT ANY WARRANTY; without even
7
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8
// PURPOSE. See the above copyright notice for more information.
9
//=========================================================================
10
#ifndef smtk_extension_paraview_appcomponents_pqSMTKCallObserversOnMainThreadBehavior_h
11
#define smtk_extension_paraview_appcomponents_pqSMTKCallObserversOnMainThreadBehavior_h
12
13
#include "smtk/extension/paraview/appcomponents/smtkPQComponentsExtModule.h"
14
15
#include "smtk/common/UUID.h"
16
#include "smtk/operation/Manager.h"
17
#include "smtk/resource/Manager.h"
18
#include "smtk/view/Selection.h"
19
20
#include "smtk/extension/paraview/appcomponents/pqQtKeywordWrapping.h"
21
22
#include <QObject>
23
24
#include <mutex>
25
26
class
pqServer;
27
class
pqSMTKWrapper;
28
46
class
SMTKPQCOMPONENTSEXT_EXPORT
pqSMTKCallObserversOnMainThreadBehavior
:
public
QObject
47
{
48
Q_OBJECT
49
using
Superclass = QObject;
50
51
public
:
52
static
pqSMTKCallObserversOnMainThreadBehavior
* instance(QObject* parent =
nullptr
);
53
~
pqSMTKCallObserversOnMainThreadBehavior
()
override
;
54
55
Q_SIGNALS:
59
void
resourceEvent(QString resourceId,
int
event, QPrivateSignal);
60
64
void
operationEvent(QString opId,
int
event, QString resultName, QPrivateSignal);
65
68
void
selectionEvent(QString selectionId, QString str, QPrivateSignal);
69
70
protected
:
71
pqSMTKCallObserversOnMainThreadBehavior
(QObject* parent =
nullptr
);
72
73
protected
Q_SLOTS:
78
void
forceObserversToBeCalledOnMainThread(pqSMTKWrapper* rsrcMgr, pqServer* server);
79
80
private
:
81
std::map<smtk::common::UUID, std::shared_ptr<smtk::resource::Resource>> m_activeResources;
82
std::map<smtk::common::UUID, std::shared_ptr<smtk::operation::Operation>> m_activeOperations;
83
std::map<smtk::common::UUID, std::shared_ptr<smtk::view::Selection>> m_activeSelection;
84
85
// A mutex to make access to m_activeOperations thread-safe
86
std::mutex m_activeOperationMutex;
87
88
Q_DISABLE_COPY(
pqSMTKCallObserversOnMainThreadBehavior
);
89
};
90
91
#endif // smtk_extension_paraview_appcomponents_pqSMTKCallObserversOnMainThreadBehavior_h
pqSMTKCallObserversOnMainThreadBehavior
Add logic to new servers to ensure that operation and resource observers are called on the main threa...
Definition:
pqSMTKCallObserversOnMainThreadBehavior.h:46
Generated by
1.8.17