-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSave.h
87 lines (63 loc) · 2.04 KB
/
Save.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
//---------------------------------------------------------------------------
#pragma once
#ifndef SaveH
#define SaveH
#include "Patient.h"
#include "Util.h"
#include <map>
#include <windows.h>
#include <string>
#include "CheckRecord.h"
using namespace std;
//---------------------------Class:SaveFile--------------------------------
class SavingInformation{
public:
/*Constructor*/
SavingInformation();
/*Destructor*/
~SavingInformation();
/*Copy Constructor*/
SavingInformation(const SavingInformation& r);
/*Overload operator = */
SavingInformation operator = (const SavingInformation& r);
public:
PatientInfo* patientInfo;
CheckedRecord* checkedRecord;
MatrixData<float>* savingDose;
string path;
};
/*A singleton model(Hungry model) for global operation vars*/
class SaveFile{
private:
SaveFile();
SaveFile(const SaveFile& r);
/*Overload operator = (forbidden)*/
SaveFile operator = (const SaveFile &r);
/*Static Member: To store the only one object in software,and
this object is used to collect all the global vars which are wished
to stay during the software lifttime.*/
static SaveFile* saveFileInstance;
/*To recycle to allocated memory of instance*/
class SaveFileGarbo{
public:
/*SaveFile::SaveFileGarbo Constructor*/
SaveFileGarbo();
/*SaveFile::SaveFileGarbo Destructor*/
~SaveFileGarbo();
};
/*The static object:cGarboInstance,while software shut down,this Destructor
of CGarbo is invoked to recycle the memory in class GlobalMembers (for the
static member of globalMembersInstance) */
static SaveFileGarbo saveFileGarboInstance;
public:
~SaveFile();
private:
map<unsigned,SavingInformation> threadMap; //(dwThreadId,SavingInfo)
public:
static void save(SavingInformation savingInformation);
static void releaseInstance();
public:
friend unsigned __stdcall SaveFileThread(LPVOID pvParam);
};
//---------------------------------------------------------------------------
#endif