Index: src/libchcore/TSubTaskStatsInfo.h =================================================================== diff -u -ra5f396da5ed5ffb3fcd9fdf22afb5a7fd07e1ab8 -rd0bc3c187684f54894c7280a936d5507a5e49f35 --- src/libchcore/TSubTaskStatsInfo.h (.../TSubTaskStatsInfo.h) (revision a5f396da5ed5ffb3fcd9fdf22afb5a7fd07e1ab8) +++ src/libchcore/TSubTaskStatsInfo.h (.../TSubTaskStatsInfo.h) (revision d0bc3c187684f54894c7280a936d5507a5e49f35) @@ -29,6 +29,10 @@ #include "TSpeedTracker.h" #include "ESubTaskTypes.h" #include "TSubTaskStatsSnapshot.h" +#include "ISerializerRowData.h" +#include "ISerializerRowReader.h" +#include "TSharedModificationTracker.h" +#include BEGIN_CHCORE_NAMESPACE @@ -59,8 +63,11 @@ public: TSubTaskStatsInfo(); + void Init(int iCurrentBufferIndex, size_t stTotalCount, size_t stProcessedCount, unsigned long long ullTotalSize, unsigned long long ullProcessedSize, const TString& strCurrentPath); void Clear(); + bool IsInitialized() const; + void GetSnapshot(TSubTaskStatsSnapshotPtr& spStatsSnapshot) const; void IncreaseProcessedCount(size_t stIncreaseBy); @@ -70,12 +77,14 @@ // size stats void IncreaseProcessedSize(unsigned long long ullIncreaseBy); + void DecreaseProcessedSize(unsigned long long ullDecreaseBy); void SetProcessedSize(unsigned long long ullProcessedSize); void SetTotalSize(unsigned long long ullTotalSize); // current item void IncreaseCurrentItemProcessedSize(unsigned long long ullIncreaseBy); + void DecreaseCurrentItemProcessedSize(unsigned long long ullDecreaseBy); void SetCurrentItemProcessedSize(unsigned long long ullProcessedSize); void SetCurrentItemTotalSize(unsigned long long ullTotalSize); @@ -89,6 +98,11 @@ ESubOperationType GetSubOperationType() const { return m_eSubOperationType; } void SetSubOperationType(ESubOperationType val) { m_eSubOperationType = val; } + // serialization + void Store(const ISerializerRowDataPtr& spRowData) const; + static void InitLoader(const IColumnsDefinitionPtr& spColumnDefs); + void Load(const ISerializerRowReaderPtr& spRowReader); + private: TSubTaskStatsInfo(const TSubTaskStatsInfo&); TSubTaskStatsInfo& operator=(const TSubTaskStatsInfo&); @@ -103,26 +117,54 @@ void UpdateTime(boost::upgrade_lock& lock) const; private: - bool m_bSubTaskIsRunning; + enum EModifications + { + eMod_Added = 0, + eMod_IsRunning, + eMod_TotalSize, + eMod_ProcessedSize, + eMod_SizeSpeed, + eMod_TotalCount, + eMod_ProcessedCount, + eMod_CountSpeed, + eMod_CurrentItemProcessedSize, + eMod_CurrentItemTotalSize, + eMod_Timer, + eMod_CurrentBufferIndex, + eMod_CurrentPath, + eMod_SubOperationType, + eMod_IsInitialized, - unsigned long long m_ullTotalSize; - unsigned long long m_ullProcessedSize; - mutable TSpeedTracker m_tSizeSpeed; + // last item + eMod_Last + }; - size_t m_stTotalCount; - size_t m_stProcessedCount; - mutable TSpeedTracker m_tCountSpeed; + typedef std::bitset Bitset; + mutable Bitset m_setModifications; - unsigned long long m_ullCurrentItemProcessedSize; - unsigned long long m_ullCurrentItemTotalSize; + TSharedModificationTracker m_bSubTaskIsRunning; - mutable TSimpleTimer m_tTimer; + TSharedModificationTracker m_ullTotalSize; + TSharedModificationTracker m_ullProcessedSize; + mutable TSharedModificationTracker m_tSizeSpeed; - int m_iCurrentBufferIndex; + TSharedModificationTracker m_stTotalCount; + TSharedModificationTracker m_stProcessedCount; + mutable TSharedModificationTracker m_tCountSpeed; - TString m_strCurrentPath; // currently processed path + TSharedModificationTracker m_ullCurrentItemProcessedSize; + TSharedModificationTracker m_ullCurrentItemTotalSize; - ESubOperationType m_eSubOperationType; + mutable TSharedModificationTracker m_tTimer; + + TSharedModificationTracker m_iCurrentBufferIndex; + + TSharedModificationTracker m_strCurrentPath; // currently processed path + + TSharedModificationTracker m_eSubOperationType; + + TSharedModificationTracker m_bIsInitialized; + #pragma warning(push) #pragma warning(disable: 4251) mutable boost::shared_mutex m_lock;