HoverRace  2.0
ClassicRecordFile.h
Go to the documentation of this file.
1 
2 // ClassicRecordFile.h
3 //
4 // Copyright (c) 2010, 2012, 2015 Michael Imamura.
5 //
6 // Licensed under GrokkSoft HoverRace SourceCode License v1.0(the "License");
7 // you may not use this file except in compliance with the License.
8 //
9 // A copy of the license should have been attached to the package from which
10 // you have taken this file. If you can not find the license you can not use
11 // this file.
12 //
13 //
14 // The author makes no representations about the suitability of
15 // this software for any purpose. It is provided "as is" "AS IS",
16 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
17 // implied.
18 //
19 // See the License for the specific language governing permissions
20 // and limitations under the License.
21 
22 #pragma once
23 
24 #include <fstream>
25 
26 #include "RecordFile.h"
27 
28 #if defined(_WIN32) && defined(HR_ENGINE_SHARED)
29 # ifdef MR_ENGINE
30 # define MR_DllDeclare __declspec( dllexport )
31 # else
32 # define MR_DllDeclare __declspec( dllimport )
33 # endif
34 #else
35 # define MR_DllDeclare
36 #endif
37 
38 namespace HoverRace {
39 namespace Parcel {
40 
41 class ClassicRecordFileHeader;
42 
48 {
49  using SUPER = RecordFile;
50 
51 public:
53  virtual ~ClassicRecordFile();
54 
55  bool CreateForWrite(const Util::OS::path_t &filename, MR_UInt32 numRecords,
56  const char *title = nullptr) override;
57  bool OpenForWrite(const Util::OS::path_t &filename) override;
58  bool OpenForRead(const Util::OS::path_t &filename,
59  bool validateChecksum = false) override;
60 
61 protected:
62  static DWORD ComputeSum(const Util::OS::path_t &filename);
63 public:
64  bool ApplyChecksum(const Util::OS::path_t &filename) override;
65 
66  DWORD GetAlignMode() override;
67 
68  MR_UInt32 GetNbRecords() const override;
69  void SelectRecord(MR_UInt32 i) override;
70  bool BeginANewRecord() override;
71 
72  void Inspect(Util::InspectMapNode &node) const override;
73 
74  ObjStreamPtr StreamIn() override;
75  ObjStreamPtr StreamOut() override;
76 
77 private:
83 };
84 
85 } // namespace Parcel
86 } // namespace HoverRace
87 
88 #undef MR_DllDeclare
boost::filesystem::path path_t
Definition: OS.h:57
bool constructionMode
Definition: ClassicRecordFile.h:78
An inspection node which maps field names to values (either strings or inspectable subobjects)...
Definition: InspectMapNode.h:88
#define MR_DllDeclare
Definition: ClassicRecordFile.h:35
Base class for parcel implementations.
Definition: RecordFile.h:46
FILE * fileStream
Definition: ClassicRecordFile.h:81
std::shared_ptr< ObjStream > ObjStreamPtr
Definition: ObjStream.h:129
Definition: ClassicRecordFile.cpp:53
MR_UInt32 curRecord
Definition: ClassicRecordFile.h:79
ClassicRecordFileHeader * header
Definition: ClassicRecordFile.h:80
Standard HoverRace 1.x parcel format.
Definition: ClassicRecordFile.h:47
Definition: Announcement.h:24
uint32_t MR_UInt32
Definition: MR_Types.h:44
Util::OS::path_t filename
Definition: ClassicRecordFile.h:82
Definition: Symbol.h:253