VirtualBox

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

Last change on this file since 98299 was 98103, checked in by vboxsync, 23 months ago

Copyright year updates by scm.

  • 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 98103 2023-01-17 14:15:46Z vboxsync $ */
2/** @file
3 * VirtualBox COM class implementation
4 */
5
6/*
7 * Copyright (C) 2006-2023 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
26 */
27
28#ifndef MAIN_INCLUDED_SnapshotImpl_h
29#define MAIN_INCLUDED_SnapshotImpl_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34#include "SnapshotWrap.h"
35
36class SnapshotMachine;
37
38namespace settings
39{
40 struct Snapshot;
41}
42
43class ATL_NO_VTABLE Snapshot :
44 public SnapshotWrap
45{
46public:
47 DECLARE_COMMON_CLASS_METHODS(Snapshot)
48
49 HRESULT FinalConstruct();
50 void FinalRelease();
51
52 // public initializer/uninitializer only for internal purposes
53 HRESULT init(VirtualBox *aVirtualBox,
54 const Guid &aId,
55 const com::Utf8Str &aName,
56 const com::Utf8Str &aDescription,
57 const RTTIMESPEC &aTimeStamp,
58 SnapshotMachine *aMachine,
59 Snapshot *aParent);
60 void uninit();
61
62 void i_beginSnapshotDelete();
63
64 void i_deparent();
65
66 // public methods only for internal purposes
67
68 /**
69 * Override of the default locking class to be used for validating lock
70 * order with the standard member lock handle.
71 */
72 virtual VBoxLockingClass getLockingClass() const
73 {
74 return LOCKCLASS_SNAPSHOTOBJECT;
75 }
76
77 const ComObjPtr<Snapshot>& i_getParent() const;
78 const ComObjPtr<Snapshot> i_getFirstChild() const;
79
80 const Utf8Str& i_getStateFilePath() const;
81
82 uint32_t i_getDepth();
83
84 ULONG i_getChildrenCount();
85 ULONG i_getAllChildrenCount();
86
87 const ComObjPtr<SnapshotMachine>& i_getSnapshotMachine() const;
88
89 Guid i_getId() const;
90 const Utf8Str& i_getName() const;
91 RTTIMESPEC i_getTimeStamp() const;
92
93 ComObjPtr<Snapshot> i_findChildOrSelf(IN_GUID aId);
94 ComObjPtr<Snapshot> i_findChildOrSelf(const com::Utf8Str &aName);
95
96 void i_updateSavedStatePaths(const Utf8Str &strOldPath,
97 const Utf8Str &strNewPath);
98 void i_updateSavedStatePathsImpl(const Utf8Str &strOldPath,
99 const Utf8Str &strNewPath);
100
101 bool i_sharesSavedStateFile(const Utf8Str &strPath,
102 Snapshot *pSnapshotToIgnore);
103
104 void i_updateNVRAMPaths(const Utf8Str &strOldPath,
105 const Utf8Str &strNewPath);
106 void i_updateNVRAMPathsImpl(const Utf8Str &strOldPath,
107 const Utf8Str &strNewPath);
108
109 HRESULT i_saveSnapshotOne(settings::Snapshot &data) const;
110 HRESULT i_saveSnapshot(settings::Snapshot &data) const;
111
112 HRESULT i_uninitAll(AutoWriteLock &writeLock,
113 CleanupMode_T cleanupMode,
114 MediaList &llMedia,
115 std::list<Utf8Str> &llFilenames);
116
117
118private:
119
120 struct Data; // opaque, defined in SnapshotImpl.cpp
121
122 // wrapped ISnapshot properties
123 HRESULT getId(com::Guid &aId);
124 HRESULT getName(com::Utf8Str &aName);
125 HRESULT setName(const com::Utf8Str &aName);
126 HRESULT getDescription(com::Utf8Str &aDescription);
127 HRESULT setDescription(const com::Utf8Str &aDescription);
128 HRESULT getTimeStamp(LONG64 *aTimeStamp);
129 HRESULT getOnline(BOOL *aOnline);
130 HRESULT getMachine(ComPtr<IMachine> &aMachine);
131 HRESULT getParent(ComPtr<ISnapshot> &aParent);
132 HRESULT getChildren(std::vector<ComPtr<ISnapshot> > &aChildren);
133
134 // wrapped ISnapshot methods
135 HRESULT getChildrenCount(ULONG *aChildrenCount);
136
137 Data *m;
138};
139
140#endif /* !MAIN_INCLUDED_SnapshotImpl_h */
141
142/* 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