Clone
ixen <ixen@copyhandler.com>
committed
on 19 Mar 16
Fixed problem with directories' timestamps not being preserved (CH-240)
LoggerImprovements + 5 more
src/libchcore/TOverlappedReader.cpp (+0 -6)
11 11 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 12 //  GNU General Public License for more details.
13 13 //
14 14 //  You should have received a copy of the GNU Library General Public
15 15 //  License along with this program; if not, write to the
16 16 //  Free Software Foundation, Inc.,
17 17 //  59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18 18 // ============================================================================
19 19 #include "stdafx.h"
20 20 #include "TOverlappedReader.h"
21 21 #include "TOverlappedDataBuffer.h"
22 22 #include "TCoreException.h"
23 23 #include "ErrorCodes.h"
24 24
25 25 namespace chcore
26 26 {
27 27         TOverlappedReader::TOverlappedReader(const logger::TLogFileDataPtr& spLogFileData, const TBufferListPtr& spEmptyBuffers,
28 28                 const TOverlappedProcessorRangePtr& spDataRange,
29 29                 DWORD dwChunkSize) :
30 30                 m_spLog(logger::MakeLogger(spLogFileData, L"DataBuffer")),
31                   m_spEmptyBuffers(spEmptyBuffers),
32 31                 m_tInputBuffers(spEmptyBuffers, spDataRange ? spDataRange->GetResumePosition() : 0, dwChunkSize),
33 32                 m_spFullBuffers(std::make_shared<TOrderedBufferQueue>(spDataRange ? spDataRange->GetResumePosition() : 0))
34 33         {
35 34                 if(!spLogFileData)
36 35                         throw TCoreException(eErr_InvalidArgument, L"spLogFileData is NULL", LOCATION);
37 36                 if(!spEmptyBuffers)
38 37                         throw TCoreException(eErr_InvalidArgument, L"spMemoryPool", LOCATION);
39 38                 if(!spDataRange)
40 39                         throw TCoreException(eErr_InvalidArgument, L"spDataRange is NULL", LOCATION);
41 40
42 41                 m_dataRangeChanged = spDataRange->GetNotifier().connect(boost::bind(&TOverlappedReader::UpdateProcessingRange, this, _1));
43 42         }
44 43
45 44         TOverlappedReader::~TOverlappedReader()
46 45         {
47 46                 m_dataRangeChanged.disconnect();
48 47         }
49 48
50 49         TOverlappedDataBuffer* TOverlappedReader::GetEmptyBuffer()
51 50         {
 
156 155                 // Do not clear full buffers as they might be in use
157 156                 //m_spFullBuffers->ClearBuffers(m_spEmptyBuffers);
158 157         }
159 158
160 159         void TOverlappedReader::UpdateProcessingRange(unsigned long long ullNewPosition)
161 160         {
162 161                 m_tInputBuffers.UpdateProcessingRange(ullNewPosition);
163 162                 m_spFullBuffers->UpdateProcessingRange(ullNewPosition);
164 163         }
165 164
166 165         HANDLE TOverlappedReader::GetEventReadPossibleHandle() const
167 166         {
168 167                 return m_tInputBuffers.GetHasBuffersEvent();
169 168         }
170 169
171 170         HANDLE TOverlappedReader::GetEventReadFailedHandle() const
172 171         {
173 172                 return m_spFullBuffers->GetHasErrorEvent();
174 173         }
175 174
176           HANDLE TOverlappedReader::GetEventReadFinishedHandle() const
177           {
178                   return m_spFullBuffers->GetHasBuffersEvent();
179           }
180  
181 175         HANDLE TOverlappedReader::GetEventDataSourceFinishedHandle() const
182 176         {
183 177                 return m_spFullBuffers->GetHasReadingFinished();
184 178         }
185 179 }