RequestFramesUpdate.cpp
2.16 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#include "RequestFramesUpdate.h"
#include "../FrameManager/FrameManager.h"
#include "../Transformation/TransformationCDPP3DView.h"
using namespace TREPS::FrameManager;
using namespace TREPS::Transformation;
namespace TREPS
{
namespace RequestManager
{
RequestFramesUpdateClass::RequestFramesUpdateClass(void):RequestAbstractClass()
{
this->outputType = OUTPUT_XMLFILE;
}
RequestFramesUpdateClass::~RequestFramesUpdateClass(void)
{
}
string RequestFramesUpdateClass::getRequestId(void)
{
return "frames_update";
}
bool RequestFramesUpdateClass::load(RequestLoaderClass *loader)
{
//nothing to do
return true;
}
bool RequestFramesUpdateClass::run(void)
{
this->updatedFile = "";
//create a transformation manager
TransformationAbstractClass *transMgr = new TransformationCDPP3DViewClass(this);
//get the available frame list for this engine
t_StringList frameList = transMgr->getAvailableFrameList();
delete transMgr;
if (frameList.empty())
{
LOG4CXX_ERROR(this->app->getLog()->getPtr(),"Empty frame list");
return false;
}
string framesFile = this->app->getConf()->getFramesFilePath();
if (framesFile.compare("") == 0)
return false;
//create frame manager class
FrameManagerClass *frameMgr = new FrameManagerClass();
if (!frameMgr->init(framesFile.c_str()))
{
delete frameMgr;
LOG4CXX_ERROR(this->app->getLog()->getPtr(),"Cannot init frames manager");
return false;
}
//create result file path
string newFrameFile = framesFile;
newFrameFile += ".new";
//update frame list
bool res = frameMgr->updateFrameList(frameList,newFrameFile.c_str());
if (res)
this->updatedFile = newFrameFile;
delete frameMgr;
return res;
}
void RequestFramesUpdateClass::writeResult(ResultWriterClass *writer)
{
//No result file for this request
}
string RequestFramesUpdateClass::getResultFileSuffix(void)
{
return "";
}
string RequestFramesUpdateClass::getXMLFilePath(void)
{
return this->updatedFile;
}
string RequestFramesUpdateClass::getStringResult(void)
{
return "";
}
}
}