VirtualBox

source: vbox/trunk/src/VBox/Main/include/SnapshotImpl.h@ 28973

Last change on this file since 28973 was 28835, checked in by vboxsync, 15 years ago

Main: live snapshot merging. initially limited to forward merging (i.e. everything but the first snapshot can be deleted)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.1 KB
Line 
1/* $Id: SnapshotImpl.h 28835 2010-04-27 14:46:23Z vboxsync $ */
2
3/** @file
4 *
5 * VirtualBox COM class implementation
6 */
7
8/*
9 * Copyright (C) 2006-2010 Oracle Corporation
10 *
11 * This file is part of VirtualBox Open Source Edition (OSE), as
12 * available from http://www.virtualbox.org. This file is free software;
13 * you can redistribute it and/or modify it under the terms of the GNU
14 * General Public License (GPL) as published by the Free Software
15 * Foundation, in version 2 as it comes in the "COPYING" file of the
16 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
17 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
18 */
19
20#ifndef ____H_SNAPSHOTIMPL
21#define ____H_SNAPSHOTIMPL
22
23#include "VirtualBoxBase.h"
24
25#include <iprt/time.h>
26
27class SnapshotMachine;
28
29namespace settings
30{
31 struct Snapshot;
32}
33
34class ATL_NO_VTABLE Snapshot :
35 public VirtualBoxSupportErrorInfoImpl<Snapshot, ISnapshot>,
36 public VirtualBoxSupportTranslation<Snapshot>,
37 public VirtualBoxBase, // WithTypedChildren<Snapshot>,
38 VBOX_SCRIPTABLE_IMPL(ISnapshot)
39{
40public:
41 DECLARE_NOT_AGGREGATABLE(Snapshot)
42
43 DECLARE_PROTECT_FINAL_CONSTRUCT()
44
45 BEGIN_COM_MAP(Snapshot)
46 COM_INTERFACE_ENTRY (ISupportErrorInfo)
47 COM_INTERFACE_ENTRY (ISnapshot)
48 COM_INTERFACE_ENTRY2 (IDispatch, ISnapshot)
49 END_COM_MAP()
50
51 Snapshot()
52 : m(NULL)
53 { };
54 ~Snapshot()
55 { };
56
57 HRESULT FinalConstruct();
58 void FinalRelease();
59
60 // public initializer/uninitializer only for internal purposes
61 HRESULT init(VirtualBox *aVirtualBox,
62 const Guid &aId,
63 const Utf8Str &aName,
64 const Utf8Str &aDescription,
65 const RTTIMESPEC &aTimeStamp,
66 SnapshotMachine *aMachine,
67 Snapshot *aParent);
68 void uninit();
69
70 void beginSnapshotDelete();
71
72 void deparent();
73
74 // ISnapshot properties
75 STDMETHOD(COMGETTER(Id)) (BSTR *aId);
76 STDMETHOD(COMGETTER(Name)) (BSTR *aName);
77 STDMETHOD(COMSETTER(Name)) (IN_BSTR aName);
78 STDMETHOD(COMGETTER(Description)) (BSTR *aDescription);
79 STDMETHOD(COMSETTER(Description)) (IN_BSTR aDescription);
80 STDMETHOD(COMGETTER(TimeStamp)) (LONG64 *aTimeStamp);
81 STDMETHOD(COMGETTER(Online)) (BOOL *aOnline);
82 STDMETHOD(COMGETTER(Machine)) (IMachine **aMachine);
83 STDMETHOD(COMGETTER(Parent)) (ISnapshot **aParent);
84 STDMETHOD(COMGETTER(Children)) (ComSafeArrayOut (ISnapshot *, aChildren));
85
86 // ISnapshot methods
87
88 // public methods only for internal purposes
89
90 /**
91 * Simple run-time type identification without having to enable C++ RTTI.
92 * The class IDs are defined in VirtualBoxBase.h.
93 * @return
94 */
95 virtual VBoxClsID getClassID() const
96 {
97 return clsidSnapshot;
98 }
99
100 /**
101 * Override of the default locking class to be used for validating lock
102 * order with the standard member lock handle.
103 */
104 virtual VBoxLockingClass getLockingClass() const
105 {
106 return LOCKCLASS_SNAPSHOTOBJECT;
107 }
108
109 const ComObjPtr<Snapshot>& getParent() const;
110 const ComObjPtr<Snapshot> getFirstChild() const;
111
112 const Utf8Str& stateFilePath() const;
113 HRESULT deleteStateFile();
114
115 ULONG getChildrenCount();
116 ULONG getAllChildrenCount();
117 ULONG getAllChildrenCountImpl();
118
119 const ComObjPtr<SnapshotMachine>& getSnapshotMachine() const;
120
121 Guid getId() const;
122 const Utf8Str& getName() const;
123 RTTIMESPEC getTimeStamp() const;
124
125 ComObjPtr<Snapshot> findChildOrSelf(IN_GUID aId);
126 ComObjPtr<Snapshot> findChildOrSelf(const Utf8Str &aName);
127
128 void updateSavedStatePaths(const char *aOldPath,
129 const char *aNewPath);
130 void updateSavedStatePathsImpl(const char *aOldPath,
131 const char *aNewPath);
132
133 HRESULT saveSnapshot(settings::Snapshot &data, bool aAttrsOnly);
134 HRESULT saveSnapshotImpl(settings::Snapshot &data, bool aAttrsOnly);
135
136 // for VirtualBoxSupportErrorInfoImpl
137 static const wchar_t *getComponentName()
138 {
139 return L"Snapshot";
140 }
141
142private:
143 struct Data; // opaque, defined in SnapshotImpl.cpp
144 Data *m;
145};
146
147#endif // ____H_SNAPSHOTIMPL
148
149/* vi: set tabstop=4 shiftwidth=4 expandtab: */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette