Clone
ixen <ixen@copyhandler.com>
committed
on 28 Oct 16
Moved file copy main processing loop to ReaderWriter object (CH-270).
ParallelizeReaderWriter + 4 more
src/libchcore/TFeedbackHandlerBase.h (+2 -9)
18 18 // ============================================================================
19 19 #ifndef __TFEEDBACKHANDLERBASE_H__
20 20 #define __TFEEDBACKHANDLERBASE_H__
21 21
22 22 #include "libchcore.h"
23 23 #include "IFeedbackHandler.h"
24 24 #include "ISerializerRowData.h"
25 25 #include "IColumnsDefinition.h"
26 26 #include "ISerializerRowReader.h"
27 27 #include <bitset>
28 28 #include "TSharedModificationTracker.h"
29 29
30 30 namespace chcore
31 31 {
32 32         class LIBCHCORE_API TFeedbackHandlerBase : public IFeedbackHandler
33 33         {
34 34         public:
35 35                 TFeedbackHandlerBase();
36 36                 virtual ~TFeedbackHandlerBase();
37 37
38   /*
39                   virtual TFeedbackResult FileError(const TString& strSrcPath, const TString& strDstPath, EFileError eFileError, unsigned long ulError) override;
40                   virtual TFeedbackResult FileAlreadyExists(const TFileInfo& spSrcFileInfo, const TFileInfo& spDstFileInfo) override;
41                   virtual TFeedbackResult NotEnoughSpace(const TString& strSrcPath, const TString& strDstPath, unsigned long long ullRequiredSize) override;
42  
43                   virtual TFeedbackResult OperationFinished() override;
44                   virtual TFeedbackResult OperationError() override;
45   */
46  
47 38                 // marking responses as permanent
48 39                 void SetFileErrorPermanentResponse(EFeedbackResult ePermanentResult) { m_eFileError = ePermanentResult; }
49 40                 EFeedbackResult GetFileErrorPermanentResponse() const { return m_eFileError; }
50 41                 bool HasFileErrorPermanentResponse() const { return m_eFileError != EFeedbackResult::eResult_Unknown; }
51 42
52 43                 void SetFileAlreadyExistsPermanentResponse(EFeedbackResult ePermanentResult) { m_eFileAlreadyExists = ePermanentResult; }
53 44                 EFeedbackResult GetFileAlreadyExistsPermanentResponse() const { return m_eFileAlreadyExists; }
54 45                 bool HasFileAlreadyExistsPermanentResponse() const { return m_eFileAlreadyExists  != EFeedbackResult::eResult_Unknown; }
55 46
56 47                 void SetNotEnoughSpacePermanentResponse(EFeedbackResult ePermanentResult) { m_eNotEnoughSpace = ePermanentResult; }
57 48                 EFeedbackResult GetNotEnoughSpacePermanentResponse() const { return m_eNotEnoughSpace; }
58 49                 bool HasNotEnoughSpacePermanentResponse() const { return m_eNotEnoughSpace != EFeedbackResult::eResult_Unknown; }
59 50
60 51                 // resets the permanent status from all responses
61 52                 virtual void RestoreDefaults() override;
62 53
63 54                 // serialization
64 55                 void Store(const ISerializerContainerPtr& spContainer) const;
65 56                 static void InitColumns(const ISerializerContainerPtr& spContainer);
66 57                 void Load(const ISerializerContainerPtr& spContainer);
67 58
  59                 virtual DWORD GetRetryInterval() const override;
  60
68 61         private:
69 62                 enum EModifications
70 63                 {
71 64                         eMod_Added = 0,
72 65                         eMod_FileError,
73 66                         eMod_FileAlreadyExists,
74 67                         eMod_NotEnoughSpace,
75 68                         eMod_OperationFinished,
76 69                         eMod_OperationError,
77 70
78 71                         // last item
79 72                         eMod_Last
80 73                 };
81 74
82 75 #pragma warning(push)
83 76 #pragma warning(disable: 4251)
84 77                 mutable boost::shared_mutex m_lock;
85 78
86 79                 using Bitset = std::bitset<eMod_Last>;
87 80                 mutable Bitset m_setModifications;