Index: src/libchcore/TSubTaskStatsInfo.cpp =================================================================== diff -u -N -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 -rd76d3ce6c8c55fa23009dbb03b8bc06f482c5b72 --- src/libchcore/TSubTaskStatsInfo.cpp (.../TSubTaskStatsInfo.cpp) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) +++ src/libchcore/TSubTaskStatsInfo.cpp (.../TSubTaskStatsInfo.cpp) (revision d76d3ce6c8c55fa23009dbb03b8bc06f482c5b72) @@ -27,6 +27,7 @@ #include "TSubTaskStatsSnapshot.h" #include "TCoreException.h" #include "ErrorCodes.h" +#include "SerializerDataTypes.h" BEGIN_CHCORE_NAMESPACE @@ -62,8 +63,10 @@ m_ullCurrentItemTotalSize(m_setModifications, 0), m_eSubOperationType(m_setModifications, eSubOperation_None), m_tTimer(m_setModifications), - m_bIsInitialized(m_setModifications, false) + m_bIsInitialized(m_setModifications, false), + m_fcCurrentIndex(m_setModifications, 0) { + m_setModifications[eMod_Added] = true; } void TSubTaskStatsInfo::Clear() @@ -82,6 +85,7 @@ m_ullCurrentItemTotalSize = 0; m_eSubOperationType = eSubOperation_None; m_bIsInitialized = false; + m_fcCurrentIndex = 0; } void TSubTaskStatsInfo::GetSnapshot(TSubTaskStatsSnapshotPtr& spStatsSnapshot) const @@ -108,6 +112,7 @@ spStatsSnapshot->SetCurrentItemProcessedSize(m_ullCurrentItemProcessedSize); spStatsSnapshot->SetCurrentItemTotalSize(m_ullCurrentItemTotalSize); spStatsSnapshot->SetSubOperationType(m_eSubOperationType); + spStatsSnapshot->SetCurrentIndex(m_fcCurrentIndex); } // is running? @@ -305,6 +310,8 @@ rRowData.SetValue(_T("ci_processed_size"), m_ullCurrentItemProcessedSize); if(m_ullCurrentItemTotalSize.IsModified()) rRowData.SetValue(_T("ci_total_size"), m_ullCurrentItemTotalSize); + if(m_fcCurrentIndex.IsModified()) + rRowData.SetValue(_T("current_index"), m_fcCurrentIndex); if(m_tTimer.IsModified()) rRowData.SetValue(_T("timer"), m_tTimer.Get().GetTotalTime()); @@ -322,6 +329,7 @@ void TSubTaskStatsInfo::InitColumns(IColumnsDefinition& rColumnDefs) { + rColumnDefs.AddColumn(_T("id"), ColumnType::value); rColumnDefs.AddColumn(_T("is_running"), IColumnsDefinition::eType_bool); rColumnDefs.AddColumn(_T("is_initialized"), IColumnsDefinition::eType_bool); rColumnDefs.AddColumn(_T("total_size"), IColumnsDefinition::eType_ulonglong); @@ -332,6 +340,7 @@ rColumnDefs.AddColumn(_T("count_speed"), IColumnsDefinition::eType_string); rColumnDefs.AddColumn(_T("ci_processed_size"), IColumnsDefinition::eType_ulonglong); rColumnDefs.AddColumn(_T("ci_total_size"), IColumnsDefinition::eType_ulonglong); + rColumnDefs.AddColumn(_T("current_index"), ColumnType::value); rColumnDefs.AddColumn(_T("timer"), IColumnsDefinition::eType_ulonglong); rColumnDefs.AddColumn(_T("buffer_index"), IColumnsDefinition::eType_int); rColumnDefs.AddColumn(_T("current_path"), IColumnsDefinition::eType_string); @@ -361,6 +370,7 @@ spRowReader->GetValue(_T("ci_processed_size"), m_ullCurrentItemProcessedSize.Modify()); spRowReader->GetValue(_T("ci_total_size"), m_ullCurrentItemTotalSize.Modify()); + spRowReader->GetValue(_T("current_index"), m_fcCurrentIndex.Modify()); unsigned long long ullTimer = 0; spRowReader->GetValue(_T("timer"), ullTimer); @@ -409,4 +419,34 @@ return bInitialized; } +void TSubTaskStatsInfo::SetCurrentIndex(file_count_t fcIndex) +{ + boost::unique_lock lock(m_lock); + m_fcCurrentIndex = fcIndex; +} + +chcore::file_count_t TSubTaskStatsInfo::GetCurrentIndex() const +{ + boost::shared_lock lock(m_lock); + return m_fcCurrentIndex.Get(); +} + +unsigned long long TSubTaskStatsInfo::GetCurrentItemProcessedSize() const +{ + boost::shared_lock lock(m_lock); + return m_ullCurrentItemProcessedSize; +} + +unsigned long long TSubTaskStatsInfo::GetCurrentItemTotalSize() const +{ + boost::shared_lock lock(m_lock); + return m_ullCurrentItemTotalSize; +} + +bool TSubTaskStatsInfo::WasAdded() const +{ + boost::shared_lock lock(m_lock); + return m_setModifications[eMod_Added]; +} + END_CHCORE_NAMESPACE