CoinViewer.cpp
Go to the documentation of this file.
1
/*
2
* This file is part of ArmarX.
3
*
4
* ArmarX is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 2 as
6
* published by the Free Software Foundation.
7
*
8
* ArmarX is distributed in the hope that it will be useful, but
9
* WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
12
*
13
* You should have received a copy of the GNU General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
15
*
16
* @package ArmarX::Gui
17
* @author Nikolaus Vahrenkamp
18
* @date 2014
19
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20
* GNU General Public License
21
*/
22
23
24
#include "
CoinViewer.h
"
25
26
#include <
ArmarXCore/core/logging/Logging.h
>
27
28
namespace
armarx
29
{
30
31
32
CoinViewer::CoinViewer
(QWidget* parent,
33
const
char
* name,
34
SbBool embed,
35
SoQtFullViewer::BuildFlag flag,
36
SoQtViewer::Type
type) :
37
SoQtExaminerViewer(parent, name, embed, flag, type),
38
mutex(
std
::
make_shared
<
RecursiveMutex
>())
39
{
40
}
41
42
CoinViewer::~CoinViewer
() =
default
;
43
44
void
45
CoinViewer::setMutex
(
RecursiveMutexPtr
const
& m)
46
{
47
mutex
= m;
48
}
49
50
auto
51
CoinViewer::getScopedLock
() ->
RecursiveMutexLockPtr
52
{
53
RecursiveMutexLockPtr
l;
54
55
if
(mutex)
56
{
57
l.reset(
new
RecursiveMutexLock
(*mutex));
58
}
59
60
return
l;
61
}
62
63
void
64
CoinViewer::actualRedraw
()
65
{
66
// require lock
67
clock_t start = clock();
68
auto
l =
getScopedLock
();
69
clock_t end = clock();
70
long
timeMS = (long)(((
float
)(end - start) / (
float
)CLOCKS_PER_SEC) * 1000.0);
71
72
if
(timeMS > 50)
73
{
74
ARMARX_IMPORTANT_S
<<
" Redraw lock time:"
<< timeMS;
75
}
76
77
// Render normal scenegraph.
78
SoQtExaminerViewer::actualRedraw();
79
}
80
}
// namespace armarx
ARMARX_IMPORTANT_S
#define ARMARX_IMPORTANT_S
Definition:
Logging.h:210
armarx::CoinViewer::RecursiveMutexLock
std::unique_lock< RecursiveMutex > RecursiveMutexLock
Definition:
CoinViewer.h:52
armarx::make_shared
auto make_shared(Args &&... args)
Definition:
ManagedIceObject.h:92
armarx::CoinViewer::~CoinViewer
~CoinViewer() override
armarx::CoinViewer::mutex
RecursiveMutexPtr mutex
Definition:
CoinViewer.h:72
armarx::CoinViewer::RecursiveMutexPtr
std::shared_ptr< RecursiveMutex > RecursiveMutexPtr
Definition:
CoinViewer.h:51
armarx::aron::similarity::FloatSimilarity::Type
Type
The Type enum.
Definition:
FloatSimilarity.h:10
armarx::CoinViewer::CoinViewer
CoinViewer(QWidget *parent, const char *name=NULL, SbBool embed=TRUE, SoQtFullViewer::BuildFlag flag=BUILD_ALL, SoQtViewer::Type type=BROWSER)
Definition:
CoinViewer.cpp:32
std
Definition:
Application.h:66
armarx::CoinViewer::RecursiveMutex
std::recursive_mutex RecursiveMutex
Definition:
CoinViewer.h:50
armarx::CoinViewer::actualRedraw
void actualRedraw(void) override
actualRedraw Reimplement the redraw method in order to lock engine mutex
Definition:
CoinViewer.cpp:64
armarx::CoinViewer::RecursiveMutexLockPtr
std::shared_ptr< RecursiveMutexLock > RecursiveMutexLockPtr
Definition:
CoinViewer.h:53
Logging.h
armarx::CoinViewer::setMutex
void setMutex(RecursiveMutexPtr const &m)
Definition:
CoinViewer.cpp:45
CoinViewer.h
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition:
ArmarXTimeserver.cpp:27
armarx::CoinViewer::getScopedLock
RecursiveMutexLockPtr getScopedLock()
Definition:
CoinViewer.cpp:51
ArmarXGui
libraries
ArmarXGuiBase
widgets
CoinViewer.cpp
Generated on Sat Mar 29 2025 09:17:23 for armarx_documentation by
1.8.17