Index: src/libchcore/TSubTaskStatsInfo.h =================================================================== diff -u -N -rc66b22f786f8434075a09e92de52bba8a53a85db -re96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3 --- src/libchcore/TSubTaskStatsInfo.h (.../TSubTaskStatsInfo.h) (revision c66b22f786f8434075a09e92de52bba8a53a85db) +++ src/libchcore/TSubTaskStatsInfo.h (.../TSubTaskStatsInfo.h) (revision e96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3) @@ -36,150 +36,149 @@ #include "CommonDataTypes.h" #include "IRunningTimeControl.h" -BEGIN_CHCORE_NAMESPACE - -class TSubTaskStatsInfo; -class TSubTaskStatsSnapshot; - -class TSubTaskStatsInfo : public IRunningTimeControl +namespace chcore { -private: - static const unsigned long long DefaultSpeedTrackTime = 1000; // in miliseconds - static const unsigned long long DefaultSpeedSampleTime = 100; // in miliseconds + class TSubTaskStatsInfo; + class TSubTaskStatsSnapshot; -public: - TSubTaskStatsInfo(ESubOperationType eSubTaskType); + class TSubTaskStatsInfo : public IRunningTimeControl + { + private: + static const unsigned long long DefaultSpeedTrackTime = 1000; // in miliseconds + static const unsigned long long DefaultSpeedSampleTime = 100; // in miliseconds - void Init(int iCurrentBufferIndex, file_count_t fcTotalCount, file_count_t fcProcessedCount, unsigned long long ullTotalSize, unsigned long long ullProcessedSize, const TString& strCurrentPath); - void Clear(); - bool WasAdded() const; + public: + TSubTaskStatsInfo(ESubOperationType eSubTaskType); - bool IsInitialized() const; + void Init(int iCurrentBufferIndex, file_count_t fcTotalCount, file_count_t fcProcessedCount, unsigned long long ullTotalSize, unsigned long long ullProcessedSize, const TString& strCurrentPath); + void Clear(); + bool WasAdded() const; - void GetSnapshot(TSubTaskStatsSnapshotPtr& spStatsSnapshot) const; + bool IsInitialized() const; - void IncreaseProcessedCount(file_count_t fcIncreaseBy); - void SetProcessedCount(file_count_t fcIndex); + void GetSnapshot(TSubTaskStatsSnapshotPtr& spStatsSnapshot) const; - void SetTotalCount(file_count_t fcCount); - file_count_t GetTotalCount() const; + void IncreaseProcessedCount(file_count_t fcIncreaseBy); + void SetProcessedCount(file_count_t fcIndex); - // size stats - void IncreaseProcessedSize(unsigned long long ullIncreaseBy); - void DecreaseProcessedSize(unsigned long long ullDecreaseBy); - void SetProcessedSize(unsigned long long ullProcessedSize); + void SetTotalCount(file_count_t fcCount); + file_count_t GetTotalCount() const; - void IncreaseTotalSize(unsigned long long ullIncreaseBy); - void DecreaseTotalSize(unsigned long long ullDecreaseBy); - void SetTotalSize(unsigned long long ullTotalSize); + // size stats + void IncreaseProcessedSize(unsigned long long ullIncreaseBy); + void DecreaseProcessedSize(unsigned long long ullDecreaseBy); + void SetProcessedSize(unsigned long long ullProcessedSize); - // current item - void IncreaseCurrentItemProcessedSize(unsigned long long ullIncreaseBy); - void DecreaseCurrentItemProcessedSize(unsigned long long ullDecreaseBy); - void SetCurrentItemProcessedSize(unsigned long long ullProcessedSize); + void IncreaseTotalSize(unsigned long long ullIncreaseBy); + void DecreaseTotalSize(unsigned long long ullDecreaseBy); + void SetTotalSize(unsigned long long ullTotalSize); - void IncreaseCurrentItemTotalSize(unsigned long long ullIncreaseBy); - void DecreaseCurrentItemTotalSize(unsigned long long ullDecreaseBy); - void SetCurrentItemTotalSize(unsigned long long ullTotalSize); + // current item + void IncreaseCurrentItemProcessedSize(unsigned long long ullIncreaseBy); + void DecreaseCurrentItemProcessedSize(unsigned long long ullDecreaseBy); + void SetCurrentItemProcessedSize(unsigned long long ullProcessedSize); - unsigned long long GetCurrentItemProcessedSize() const; - unsigned long long GetCurrentItemTotalSize() const; + void IncreaseCurrentItemTotalSize(unsigned long long ullIncreaseBy); + void DecreaseCurrentItemTotalSize(unsigned long long ullDecreaseBy); + void SetCurrentItemTotalSize(unsigned long long ullTotalSize); - bool CanCurrentItemSilentResume() const; - void SetCurrentItemSilentResume(bool bEnableSilentResume); + unsigned long long GetCurrentItemProcessedSize() const; + unsigned long long GetCurrentItemTotalSize() const; - // current index - void SetCurrentIndex(file_count_t fcIndex); - file_count_t GetCurrentIndex() const; + bool CanCurrentItemSilentResume() const; + void SetCurrentItemSilentResume(bool bEnableSilentResume); - // buffer index - void SetCurrentBufferIndex(int iCurrentIndex); + // current index + void SetCurrentIndex(file_count_t fcIndex); + file_count_t GetCurrentIndex() const; - // current path - void SetCurrentPath(const TString& strPath); + // buffer index + void SetCurrentBufferIndex(int iCurrentIndex); - ESubOperationType GetSubOperationType() const { return m_eSubOperationType; } + // current path + void SetCurrentPath(const TString& strPath); - // serialization - void Store(ISerializerRowData& rRowData) const; - static void InitColumns(IColumnsDefinition& rColumnDefs); - void Load(const ISerializerRowReaderPtr& spRowReader); + ESubOperationType GetSubOperationType() const { return m_eSubOperationType; } -private: - TSubTaskStatsInfo(const TSubTaskStatsInfo&) = delete; - TSubTaskStatsInfo& operator=(const TSubTaskStatsInfo&) = delete; + // serialization + void Store(ISerializerRowData& rRowData) const; + static void InitColumns(IColumnsDefinition& rColumnDefs); + void Load(const ISerializerRowReaderPtr& spRowReader); - // is running? - virtual void MarkAsRunning() override; - virtual void MarkAsNotRunning() override; + private: + TSubTaskStatsInfo(const TSubTaskStatsInfo&) = delete; + TSubTaskStatsInfo& operator=(const TSubTaskStatsInfo&) = delete; - // time tracking - virtual void EnableTimeTracking() override; - virtual void DisableTimeTracking() override; + // is running? + virtual void MarkAsRunning() override; + virtual void MarkAsNotRunning() override; - void UpdateTime(boost::upgrade_lock& lock) const; + // time tracking + virtual void EnableTimeTracking() override; + virtual void DisableTimeTracking() override; -private: - 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_IsInitialized, - eMod_CurrentItemIndex, - eMod_CurrentItemCanResumeSilently, + void UpdateTime(boost::upgrade_lock& lock) const; - // last item - eMod_Last - }; + private: + 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_IsInitialized, + eMod_CurrentItemIndex, + eMod_CurrentItemCanResumeSilently, - typedef std::bitset Bitset; - mutable Bitset m_setModifications; + // last item + eMod_Last + }; - TSharedModificationTracker m_bSubTaskIsRunning; + typedef std::bitset Bitset; + mutable Bitset m_setModifications; - TSharedModificationTracker m_ullTotalSize; - TSharedModificationTracker m_ullProcessedSize; - mutable TSharedModificationTracker m_tSizeSpeed; + TSharedModificationTracker m_bSubTaskIsRunning; - TSharedModificationTracker m_fcTotalCount; - TSharedModificationTracker m_fcProcessedCount; - mutable TSharedModificationTracker m_tCountSpeed; + TSharedModificationTracker m_ullTotalSize; + TSharedModificationTracker m_ullProcessedSize; + mutable TSharedModificationTracker m_tSizeSpeed; - TSharedModificationTracker m_fcCurrentIndex; + TSharedModificationTracker m_fcTotalCount; + TSharedModificationTracker m_fcProcessedCount; + mutable TSharedModificationTracker m_tCountSpeed; - TSharedModificationTracker m_ullCurrentItemProcessedSize; - TSharedModificationTracker m_ullCurrentItemTotalSize; - TSharedModificationTracker m_bCurrentItemSilentResume; + TSharedModificationTracker m_fcCurrentIndex; - mutable TSharedModificationTracker m_tTimer; + TSharedModificationTracker m_ullCurrentItemProcessedSize; + TSharedModificationTracker m_ullCurrentItemTotalSize; + TSharedModificationTracker m_bCurrentItemSilentResume; - TSharedModificationTracker m_iCurrentBufferIndex; + mutable TSharedModificationTracker m_tTimer; - TSharedModificationTracker m_strCurrentPath; // currently processed path + TSharedModificationTracker m_iCurrentBufferIndex; - TSharedModificationTracker m_bIsInitialized; + TSharedModificationTracker m_strCurrentPath; // currently processed path - const ESubOperationType m_eSubOperationType; + TSharedModificationTracker m_bIsInitialized; + const ESubOperationType m_eSubOperationType; + #pragma warning(push) #pragma warning(disable: 4251) - mutable boost::shared_mutex m_lock; + mutable boost::shared_mutex m_lock; #pragma warning(pop) - friend class TSubTaskProcessingGuard; -}; + friend class TSubTaskProcessingGuard; + }; +} -END_CHCORE_NAMESPACE - #endif