VirtualBox

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

Last change on this file since 40532 was 37449, checked in by vboxsync, 14 years ago

Main;VBoxManage: more clone vm work

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.0 KB
Line 
1/* $Id: SnapshotImpl.h 37449 2011-06-14 16:34:16Z 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 VirtualBoxBase,
36 VBOX_SCRIPTABLE_IMPL(ISnapshot)
37{
38public:
39 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(Snapshot, ISnapshot)
40
41 DECLARE_NOT_AGGREGATABLE(Snapshot)
42
43 DECLARE_PROTECT_FINAL_CONSTRUCT()
44
45 BEGIN_COM_MAP(Snapshot)
46 VBOX_DEFAULT_INTERFACE_ENTRIES (ISnapshot)
47 END_COM_MAP()
48
49 Snapshot()
50 : m(NULL)
51 { };
52 ~Snapshot()
53 { };
54
55 HRESULT FinalConstruct();
56 void FinalRelease();
57
58 // public initializer/uninitializer only for internal purposes
59 HRESULT init(VirtualBox *aVirtualBox,
60 const Guid &aId,
61 const Utf8Str &aName,
62 const Utf8Str &aDescription,
63 const RTTIMESPEC &aTimeStamp,
64 SnapshotMachine *aMachine,
65 Snapshot *aParent);
66 void uninit();
67
68 void beginSnapshotDelete();
69
70 void deparent();
71
72 // ISnapshot properties
73 STDMETHOD(COMGETTER(Id)) (BSTR *aId);
74 STDMETHOD(COMGETTER(Name)) (BSTR *aName);
75 STDMETHOD(COMSETTER(Name)) (IN_BSTR aName);
76 STDMETHOD(COMGETTER(Description)) (BSTR *aDescription);
77 STDMETHOD(COMSETTER(Description)) (IN_BSTR aDescription);
78 STDMETHOD(COMGETTER(TimeStamp)) (LONG64 *aTimeStamp);
79 STDMETHOD(COMGETTER(Online)) (BOOL *aOnline);
80 STDMETHOD(COMGETTER(Machine)) (IMachine **aMachine);
81 STDMETHOD(COMGETTER(Parent)) (ISnapshot **aParent);
82 STDMETHOD(COMGETTER(Children)) (ComSafeArrayOut (ISnapshot *, aChildren));
83
84 // ISnapshot methods
85 STDMETHOD(GetChildrenCount)(ULONG* count);
86
87 // public methods only for internal purposes
88
89 /**
90 * Override of the default locking class to be used for validating lock
91 * order with the standard member lock handle.
92 */
93 virtual VBoxLockingClass getLockingClass() const
94 {
95 return LOCKCLASS_SNAPSHOTOBJECT;
96 }
97
98 const ComObjPtr<Snapshot>& getParent() const;
99 const ComObjPtr<Snapshot> getFirstChild() const;
100
101 const Utf8Str& getStateFilePath() const;
102
103 ULONG getChildrenCount();
104 ULONG getAllChildrenCount();
105 ULONG getAllChildrenCountImpl();
106
107 const ComObjPtr<SnapshotMachine>& getSnapshotMachine() const;
108
109 Guid getId() const;
110 const Utf8Str& getName() const;
111 RTTIMESPEC getTimeStamp() const;
112
113 ComObjPtr<Snapshot> findChildOrSelf(IN_GUID aId);
114 ComObjPtr<Snapshot> findChildOrSelf(const Utf8Str &aName);
115
116 void updateSavedStatePaths(const Utf8Str &strOldPath,
117 const Utf8Str &strNewPath);
118 void updateSavedStatePathsImpl(const Utf8Str &strOldPath,
119 const Utf8Str &strNewPath);
120
121 bool sharesSavedStateFile(const Utf8Str &strPath,
122 Snapshot *pSnapshotToIgnore);
123
124 HRESULT saveSnapshot(settings::Snapshot &data, bool aAttrsOnly);
125 HRESULT saveSnapshotImpl(settings::Snapshot &data, bool aAttrsOnly);
126
127 HRESULT uninitRecursively(AutoWriteLock &writeLock,
128 CleanupMode_T cleanupMode,
129 MediaList &llMedia,
130 std::list<Utf8Str> &llFilenames);
131
132private:
133 struct Data; // opaque, defined in SnapshotImpl.cpp
134 Data *m;
135};
136
137#endif // ____H_SNAPSHOTIMPL
138
139/* 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