|
| |
46 |
46 |
|
|
| |
47 |
47 |
|
|
| |
48 |
48 |
TFastMoveProgressInfo::TFastMoveProgressInfo() : |
|
| |
49 |
|
m_stCurrentIndex(0) |
|
| |
|
49 |
m_stCurrentIndex(0), |
|
| |
|
50 |
m_stLastStoredIndex(std::numeric_limits<size_t>::max()) |
|
| |
50 |
51 |
{ |
|
| |
51 |
52 |
} |
|
| |
52 |
53 |
|
|
| |
53 |
54 |
TFastMoveProgressInfo::~TFastMoveProgressInfo() |
|
| |
54 |
55 |
{ |
|
| |
55 |
56 |
} |
|
| |
56 |
57 |
|
|
| |
57 |
|
|
|
| |
58 |
|
|
|
| |
59 |
|
|
|
| |
60 |
|
|
|
| |
61 |
|
|
|
| |
62 |
|
|
|
| |
63 |
|
|
|
| |
64 |
|
|
|
| |
65 |
|
|
|
| |
66 |
|
|
|
| |
67 |
|
|
|
| |
68 |
|
|
|
| |
69 |
|
|
|
| |
70 |
|
|
|
| |
71 |
58 |
void TFastMoveProgressInfo::ResetProgress() |
|
| |
72 |
59 |
{ |
|
| |
73 |
60 |
boost::unique_lock<boost::shared_mutex> lock(m_lock); |
|
|
| |
91 |
78 |
boost::shared_lock<boost::shared_mutex> lock(m_lock); |
|
| |
92 |
79 |
return m_stCurrentIndex; |
|
| |
93 |
80 |
} |
|
| |
|
81 |
|
|
| |
|
82 |
void TFastMoveProgressInfo::Store(const ISerializerRowDataPtr& spRowData) const |
|
| |
|
83 |
{ |
|
| |
|
84 |
boost::shared_lock<boost::shared_mutex> lock(m_lock); |
|
| |
|
85 |
if(m_stCurrentIndex != m_stLastStoredIndex) |
|
| |
|
86 |
{ |
|
| |
|
87 |
*spRowData % TRowData(_T("current_index"), m_stCurrentIndex); |
|
| |
|
88 |
m_stLastStoredIndex = m_stCurrentIndex; |
|
| |
|
89 |
} |
|
| |
|
90 |
} |
|
| |
|
91 |
|
|
| |
|
92 |
void TFastMoveProgressInfo::InitLoader(const IColumnsDefinitionPtr& spColumns) |
|
| |
|
93 |
{ |
|
| |
|
94 |
*spColumns % _T("current_index"); |
|
| |
|
95 |
} |
|
| |
|
96 |
|
|
| |
|
97 |
void TFastMoveProgressInfo::Load(const ISerializerRowReaderPtr& spRowReader) |
|
| |
|
98 |
{ |
|
| |
|
99 |
boost::unique_lock<boost::shared_mutex> lock(m_lock); |
|
| |
|
100 |
|
|
| |
|
101 |
spRowReader->GetValue(_T("current_index"), m_stCurrentIndex); |
|
| |
|
102 |
m_stLastStoredIndex = m_stCurrentIndex; |
|
| |
|
103 |
} |
|
| |
|
104 |
|
|
| |
|
105 |
bool TFastMoveProgressInfo::WasSerialized() const |
|
| |
|
106 |
{ |
|
| |
|
107 |
boost::shared_lock<boost::shared_mutex> lock(m_lock); |
|
| |
|
108 |
return m_stLastStoredIndex != std::numeric_limits<size_t>::max(); |
|
| |
|
109 |
} |
|
| |
94 |
110 |
} |
|
| |
95 |
111 |
|
|
| |
96 |
112 |
TSubTaskFastMove::TSubTaskFastMove(TSubTaskContext& rContext) : |
|
|
| |
295 |
311 |
|
|
| |
296 |
312 |
void TSubTaskFastMove::Store(const ISerializerPtr& spSerializer) const |
|
| |
297 |
313 |
{ |
|
| |
298 |
|
spSerializer; |
|
| |
|
314 |
ISerializerContainerPtr spContainer = spSerializer->GetContainer(_T("subtask_fastmove")); |
|
| |
|
315 |
ISerializerRowDataPtr spRow; |
|
| |
|
316 |
|
|
| |
|
317 |
if(m_tProgressInfo.WasSerialized()) |
|
| |
|
318 |
spRow = spContainer->GetRow(0); |
|
| |
|
319 |
else |
|
| |
|
320 |
spRow = spContainer->AddRow(0); |
|
| |
|
321 |
|
|
| |
|
322 |
m_tProgressInfo.Store(spRow); |
|
| |
|
323 |
m_tSubTaskStats.Store(spRow); |
|
| |
299 |
324 |
} |
|
| |
300 |
325 |
|
|
| |
301 |
326 |
void TSubTaskFastMove::Load(const ISerializerPtr& spSerializer) |
|
| |
302 |
327 |
{ |
|
| |
303 |
|
spSerializer; |
|
| |
|
328 |
ISerializerContainerPtr spContainer = spSerializer->GetContainer(_T("subtask_fastmove")); |
|
| |
|
329 |
|
|
| |
|
330 |
IColumnsDefinitionPtr spColumns = spContainer->GetColumnsDefinition(); |
|
| |
|
331 |
if(spColumns->IsEmpty()) |
|
| |
|
332 |
{ |
|
| |
|
333 |
details::TFastMoveProgressInfo::InitLoader(spColumns); |
|
| |
|
334 |
TSubTaskStatsInfo::InitLoader(spColumns); |
|
| |
|
335 |
} |
|
| |
|
336 |
|
|
| |
|
337 |
ISerializerRowReaderPtr spRowReader = spContainer->GetRowReader(); |
|
| |
|
338 |
if(spRowReader->Next()) |
|
| |
|
339 |
{ |
|
| |
|
340 |
m_tProgressInfo.Load(spRowReader); |
|
| |
|
341 |
m_tSubTaskStats.Load(spRowReader); |
|
| |
|
342 |
} |
|
| |
304 |
343 |
} |
|
| |
305 |
344 |
|
|
| |
306 |
345 |
END_CHCORE_NAMESPACE |