ReplicaNet and RNLobby  1
ScanChecksum.h
1 /* START_LICENSE_HEADER
2 
3 Copyright (C) 2000 Martin Piper, original design and program code
4 Copyright (C) 2001 Replica Software
5 
6 This program file is copyright (C) Replica Software and can only be used under license.
7 For more information visit: http://www.replicanet.com/
8 Or email: info@replicanet.com
9 
10 END_LICENSE_HEADER */
11 #include "RNPlatform/Inc/MemoryTracking.h"
12 #ifndef _SCANCHECKSUM_H_
13 #define _SCANCHECKSUM_H_
14 #include <string>
15 #include <list>
16 #include <stddef.h>
17 // MPi: TODO: Make cross platform
18 #include <windows.h>
19 #include "RNPlatform/Inc/ThreadClass.h"
20 #include "RNPlatform/Inc/Thread.h"
21 #include "RNLobby/Inc/ScanPath.h"
22 
23 namespace RNReplicaNet
24 {
25 
26 namespace RNLobby
27 {
28 
30 class ScanChecksum : private ThreadClass , private Thread
31 {
32 public:
33  ScanChecksum();
34  virtual ~ScanChecksum();
35 
36 
42  bool Start(std::list<ScanPath::Entry> &paths,const bool multiThread = false,const size_t chunkSize = 1024*1024);
43 
44  bool Start(ScanPath::Entry &entry,const size_t chunkSize = 1024*1024);
45 
48  bool Stop(void);
49 
52  bool GetCompleted(void);
53 
56  virtual bool CallbackUpdate(const size_t numFiles,const ScanPath::Entry &currentEntry,const size_t currentBytesScanned);
57 
59  virtual void CallbackComplete(void);
60 
61 private:
62 
63  int ThreadEntry(void);
64  int RealThreadEntry(std::list<ScanPath::Entry> &paths,const size_t chunkSize);
65 
66  std::list<ScanPath::Entry> *mPaths;
67  size_t mChunkSize;
68  FILE *mFP;
69  void *mBuffer;
70 };
71 
72 } // namespace RNLobby
73 
74 } // namespace RNReplicaNet
75 
76 #endif
This scans a supplied path and stores the results.
Definition: ScanChecksum.h:30
virtual void CallbackComplete(void)
A virtual callback that is triggered when the scanning is complete.
bool Start(std::list< ScanPath::Entry > &paths, const bool multiThread=false, const size_t chunkSize=1024 *1024)
An entry in the list updated by ScanPath::Start()
Definition: ScanPath.h:37
virtual bool CallbackUpdate(const size_t numFiles, const ScanPath::Entry &currentEntry, const size_t currentBytesScanned)
Definition: ThreadClass.h:96
Definition: Thread.h:29