VirtualBox

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

Last change on this file since 47148 was 46720, checked in by vboxsync, 12 years ago

Main/xml/Settings.cpp: limit snapshot depth to 250, avoiding crashes
Main/Snapshot: limit snapshot depth to 250
Main/Medium: eliminate some spurious error messages when saving a VM config

  • 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 46720 2013-06-21 10:07:31Z vboxsync $ */
2
3/** @file
4 *
5 * VirtualBox COM class implementation
6 */
7
8/*
9 * Copyright (C) 2006-2012 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 uint32_t getDepth();
104
105 ULONG getChildrenCount();
106 ULONG getAllChildrenCount();
107 ULONG getAllChildrenCountImpl();
108
109 const ComObjPtr<SnapshotMachine>& getSnapshotMachine() const;
110
111 Guid getId() const;
112 const Utf8Str& getName() const;
113 RTTIMESPEC getTimeStamp() const;
114
115 ComObjPtr<Snapshot> findChildOrSelf(IN_GUID aId);
116 ComObjPtr<Snapshot> findChildOrSelf(const Utf8Str &aName);
117
118 void updateSavedStatePaths(const Utf8Str &strOldPath,
119 const Utf8Str &strNewPath);
120 void updateSavedStatePathsImpl(const Utf8Str &strOldPath,
121 const Utf8Str &strNewPath);
122
123 bool sharesSavedStateFile(const Utf8Str &strPath,
124 Snapshot *pSnapshotToIgnore);
125
126 HRESULT saveSnapshot(settings::Snapshot &data, bool aAttrsOnly);
127 HRESULT saveSnapshotImpl(settings::Snapshot &data, bool aAttrsOnly);
128
129 HRESULT uninitRecursively(AutoWriteLock &writeLock,
130 CleanupMode_T cleanupMode,
131 MediaList &llMedia,
132 std::list<Utf8Str> &llFilenames);
133
134private:
135 struct Data; // opaque, defined in SnapshotImpl.cpp
136 Data *m;
137};
138
139#endif // ____H_SNAPSHOTIMPL
140
141/* 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