-
Notifications
You must be signed in to change notification settings - Fork 1
/
NavigationTestBase.cxx
65 lines (51 loc) · 1.63 KB
/
NavigationTestBase.cxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*=========================================================================
Program: BRP Prostate Robot: Testing Simulator (Client)
Language: C++
Copyright (c) Brigham and Women's Hospital. All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
Please see
http://wiki.na-mic.org/Wiki/index.php/ProstateBRP_OpenIGTLink_Communication_June_2013
for the detail of the testing protocol.
=========================================================================*/
#include "NavigationTestBase.h"
#include <string.h>
#include <stdlib.h>
#include "igtlOSUtil.h"
#include "igtlStringMessage.h"
#include "igtlClientSocket.h"
#include "igtlStatusMessage.h"
#include "igtlTransformMessage.h"
#include <cmath>
NavigationTestBase::NavigationTestBase()
{
this->TimeoutShort = DEFULT_TIMEOUT_SHORT;
this->TimeoutMedium = DEFULT_TIMEOUT_MEDIUM;
this->TimeoutLong = DEFULT_TIMEOUT_LONG;
}
NavigationTestBase::~NavigationTestBase()
{
}
int NavigationTestBase::Exec()
{
if (this->Socket.IsNotNull())
{
ErrorPointType errorPoint = this->Test();
if (errorPoint == SUCCESS)
{
std::cerr << "MESSAGE: The test has been completed successfully." << std::endl;
return 1;
}
else
{
std::cerr << "ERROR: Test failed at check point #" << GetStep(errorPoint) << "." << GetPoint(errorPoint) << std::endl;
return 0;
}
}
else
{
std::cerr << "ERROR: Socket is not available." << std::endl;
return 0;
}
}