VirtualBox

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

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

Main/Machine+Snapshot+Medium: Big medium locking cleanup and straightened up the responsibilities between Snapshot and Medium. Rewritten task handling and cleaned up task implementation for medium operations. Implemented IMedium::mergeTo (no way to call it via any frontend yet), making the method parameters similar to IMedium::cloneto. Plus lots of other minor cleanups.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.2 KB
Line 
1/* $Id: SnapshotImpl.h 28401 2010-04-16 09:14:54Z 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.215389.xyz. 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
117 ULONG getChildrenCount();
118 ULONG getAllChildrenCount();
119 ULONG getAllChildrenCountImpl();
120
121 const ComObjPtr<SnapshotMachine>& getSnapshotMachine() const;
122
123 Guid getId() const;
124 const Utf8Str& getName() const;
125 RTTIMESPEC getTimeStamp() const;
126
127 ComObjPtr<Snapshot> findChildOrSelf(IN_GUID aId);
128 ComObjPtr<Snapshot> findChildOrSelf(const Utf8Str &aName);
129
130 void updateSavedStatePaths(const char *aOldPath,
131 const char *aNewPath);
132 void updateSavedStatePathsImpl(const char *aOldPath,
133 const char *aNewPath);
134
135 HRESULT saveSnapshot(settings::Snapshot &data, bool aAttrsOnly);
136 HRESULT saveSnapshotImpl(settings::Snapshot &data, bool aAttrsOnly);
137
138 // for VirtualBoxSupportErrorInfoImpl
139 static const wchar_t *getComponentName()
140 {
141 return L"Snapshot";
142 }
143
144private:
145 struct Data; // opaque, defined in SnapshotImpl.cpp
146 Data *m;
147};
148
149#endif // ____H_SNAPSHOTIMPL
150
151/* vi: set tabstop=4 shiftwidth=4 expandtab: */
Note: See TracBrowser for help on using the repository browser.

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