VirtualBox

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

Last change on this file since 28770 was 28585, checked in by vboxsync, 15 years ago

Main/Console+Machine+Snapshot+Medium: Start with online snapshot merging. Not complete, as the actual merge operation is missing and thus triggers a controlled failure. Made snapshot deletion retryable, by updating the to-be-deleted snapshot, and only deleting it completely if everything was successful.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.3 KB
Line 
1/* $Id: SnapshotImpl.h 28585 2010-04-22 10:16:57Z vboxsync $ */
2
3/** @file
4 *
5 * VirtualBox COM class implementation
6 */
7
8/*
9 * Copyright (C) 2006-2010 Sun Microsystems, Inc.
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 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
20 * Clara, CA 95054 USA or visit http://www.sun.com if you need
21 * additional information or have any questions.
22 */
23
24#ifndef ____H_SNAPSHOTIMPL
25#define ____H_SNAPSHOTIMPL
26
27#include "VirtualBoxBase.h"
28
29#include <iprt/time.h>
30
31class SnapshotMachine;
32
33namespace settings
34{
35 struct Snapshot;
36}
37
38class ATL_NO_VTABLE Snapshot :
39 public VirtualBoxSupportErrorInfoImpl<Snapshot, ISnapshot>,
40 public VirtualBoxSupportTranslation<Snapshot>,
41 public VirtualBoxBase, // WithTypedChildren<Snapshot>,
42 VBOX_SCRIPTABLE_IMPL(ISnapshot)
43{
44public:
45 DECLARE_NOT_AGGREGATABLE(Snapshot)
46
47 DECLARE_PROTECT_FINAL_CONSTRUCT()
48
49 BEGIN_COM_MAP(Snapshot)
50 COM_INTERFACE_ENTRY (ISupportErrorInfo)
51 COM_INTERFACE_ENTRY (ISnapshot)
52 COM_INTERFACE_ENTRY2 (IDispatch, ISnapshot)
53 END_COM_MAP()
54
55 Snapshot()
56 : m(NULL)
57 { };
58 ~Snapshot()
59 { };
60
61 HRESULT FinalConstruct();
62 void FinalRelease();
63
64 // public initializer/uninitializer only for internal purposes
65 HRESULT init(VirtualBox *aVirtualBox,
66 const Guid &aId,
67 const Utf8Str &aName,
68 const Utf8Str &aDescription,
69 const RTTIMESPEC &aTimeStamp,
70 SnapshotMachine *aMachine,
71 Snapshot *aParent);
72 void uninit();
73
74 void beginSnapshotDelete();
75
76 void deparent();
77
78 // ISnapshot properties
79 STDMETHOD(COMGETTER(Id)) (BSTR *aId);
80 STDMETHOD(COMGETTER(Name)) (BSTR *aName);
81 STDMETHOD(COMSETTER(Name)) (IN_BSTR aName);
82 STDMETHOD(COMGETTER(Description)) (BSTR *aDescription);
83 STDMETHOD(COMSETTER(Description)) (IN_BSTR aDescription);
84 STDMETHOD(COMGETTER(TimeStamp)) (LONG64 *aTimeStamp);
85 STDMETHOD(COMGETTER(Online)) (BOOL *aOnline);
86 STDMETHOD(COMGETTER(Machine)) (IMachine **aMachine);
87 STDMETHOD(COMGETTER(Parent)) (ISnapshot **aParent);
88 STDMETHOD(COMGETTER(Children)) (ComSafeArrayOut (ISnapshot *, aChildren));
89
90 // ISnapshot methods
91
92 // public methods only for internal purposes
93
94 /**
95 * Simple run-time type identification without having to enable C++ RTTI.
96 * The class IDs are defined in VirtualBoxBase.h.
97 * @return
98 */
99 virtual VBoxClsID getClassID() const
100 {
101 return clsidSnapshot;
102 }
103
104 /**
105 * Override of the default locking class to be used for validating lock
106 * order with the standard member lock handle.
107 */
108 virtual VBoxLockingClass getLockingClass() const
109 {
110 return LOCKCLASS_SNAPSHOTOBJECT;
111 }
112
113 const ComObjPtr<Snapshot>& getParent() const;
114
115 const Utf8Str& stateFilePath() const;
116 HRESULT deleteStateFile();
117
118 ULONG getChildrenCount();
119 ULONG getAllChildrenCount();
120 ULONG getAllChildrenCountImpl();
121
122 const ComObjPtr<SnapshotMachine>& getSnapshotMachine() const;
123
124 Guid getId() const;
125 const Utf8Str& getName() const;
126 RTTIMESPEC getTimeStamp() const;
127
128 ComObjPtr<Snapshot> findChildOrSelf(IN_GUID aId);
129 ComObjPtr<Snapshot> findChildOrSelf(const Utf8Str &aName);
130
131 void updateSavedStatePaths(const char *aOldPath,
132 const char *aNewPath);
133 void updateSavedStatePathsImpl(const char *aOldPath,
134 const char *aNewPath);
135
136 HRESULT saveSnapshot(settings::Snapshot &data, bool aAttrsOnly);
137 HRESULT saveSnapshotImpl(settings::Snapshot &data, bool aAttrsOnly);
138
139 // for VirtualBoxSupportErrorInfoImpl
140 static const wchar_t *getComponentName()
141 {
142 return L"Snapshot";
143 }
144
145private:
146 struct Data; // opaque, defined in SnapshotImpl.cpp
147 Data *m;
148};
149
150#endif // ____H_SNAPSHOTIMPL
151
152/* 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