48 |
|
class SnapshotManager { |
49 |
|
public: |
50 |
|
|
51 |
+ |
virtual ~SnapshotManager() { |
52 |
+ |
delete currentSnapshot_; |
53 |
+ |
delete previousSnapshot_; |
54 |
+ |
} |
55 |
+ |
|
56 |
|
virtual bool advance() = 0; |
57 |
|
|
58 |
< |
Snapshot* getSnapshot(int id); |
54 |
< |
|
55 |
< |
Snapshot* getPrevSnapshot(); |
58 |
> |
virtual Snapshot* getSnapshot(int id) = 0; |
59 |
|
|
60 |
< |
void setCurrentSnapshot(); |
61 |
< |
|
62 |
< |
Snapshot* getCurrentSnapshot(); |
60 |
> |
/** |
61 |
> |
* Returns the pointer of previous snapshot |
62 |
> |
* @return the pointer of previous snapshot |
63 |
> |
*/ |
64 |
> |
Snapshot* getPrevSnapshot() { |
65 |
> |
return previousSnapshot_; |
66 |
> |
} |
67 |
|
|
68 |
< |
void setCurrentSnapshot(); |
68 |
> |
/** |
69 |
> |
* Returns the pointer of current snapshot |
70 |
> |
* @return the pointer of current snapshot |
71 |
> |
*/ |
72 |
> |
Snapshot* getCurrentSnapshot() { |
73 |
> |
return currentSnapshot_; |
74 |
> |
} |
75 |
|
|
76 |
|
int getCapacity(); |
77 |
|
|
78 |
< |
void setCapacity(); |
78 |
> |
virtual void setCapacity(int capacity); |
79 |
|
|
80 |
< |
void getNotifyStatus(); |
80 |
> |
//bool getNotifyStatus(); |
81 |
|
|
82 |
< |
void setNotifyStatus(); |
82 |
> |
//void setNotifyStatus(bool status); |
83 |
|
|
84 |
< |
void attach(SnapshotObserver*); |
84 |
> |
//void attach(SnapshotObserver*); |
85 |
|
|
86 |
< |
void detach(SnapshotObserver*); |
86 |
> |
//void detach(SnapshotObserver*); |
87 |
|
|
88 |
< |
void notify(); |
88 |
> |
//void notify(); |
89 |
> |
|
90 |
> |
protected: |
91 |
> |
|
92 |
> |
SnapshotManager() : currentSnapshot_(NULL), previousSnapshot_(NULL) { |
93 |
> |
} |
94 |
|
|
95 |
+ |
Snapshot* currentSnapshot_; |
96 |
+ |
Snapshot* previousSnapshot_; |
97 |
+ |
|
98 |
|
private: |
99 |
< |
vector<Snapshot*> snapshots_; |
100 |
< |
vector<SnapshotObserver*> observers_; |
99 |
> |
//vector<SnapshotObserver*> observers_; |
100 |
> |
|
101 |
|
}; |
102 |
|
|
103 |
|
} |