[28401] | 1 | /* $Id: SnapshotImpl.h 98103 2023-01-17 14:15:46Z vboxsync $ */
|
---|
[1] | 2 | /** @file
|
---|
| 3 | * VirtualBox COM class implementation
|
---|
| 4 | */
|
---|
| 5 |
|
---|
| 6 | /*
|
---|
[98103] | 7 | * Copyright (C) 2006-2023 Oracle and/or its affiliates.
|
---|
[1] | 8 | *
|
---|
[96407] | 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
|
---|
[1] | 26 | */
|
---|
| 27 |
|
---|
[76562] | 28 | #ifndef MAIN_INCLUDED_SnapshotImpl_h
|
---|
| 29 | #define MAIN_INCLUDED_SnapshotImpl_h
|
---|
[76487] | 30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
| 31 | # pragma once
|
---|
| 32 | #endif
|
---|
[1] | 33 |
|
---|
[49960] | 34 | #include "SnapshotWrap.h"
|
---|
[1] | 35 |
|
---|
[30764] | 36 | class SnapshotMachine;
|
---|
| 37 |
|
---|
| 38 | namespace settings
|
---|
| 39 | {
|
---|
| 40 | struct Snapshot;
|
---|
| 41 | }
|
---|
| 42 |
|
---|
[1] | 43 | class ATL_NO_VTABLE Snapshot :
|
---|
[49960] | 44 | public SnapshotWrap
|
---|
[1] | 45 | {
|
---|
| 46 | public:
|
---|
[90828] | 47 | DECLARE_COMMON_CLASS_METHODS(Snapshot)
|
---|
[30714] | 48 |
|
---|
[1] | 49 | HRESULT FinalConstruct();
|
---|
| 50 | void FinalRelease();
|
---|
| 51 |
|
---|
| 52 | // public initializer/uninitializer only for internal purposes
|
---|
[21823] | 53 | HRESULT init(VirtualBox *aVirtualBox,
|
---|
| 54 | const Guid &aId,
|
---|
[65088] | 55 | const com::Utf8Str &aName,
|
---|
| 56 | const com::Utf8Str &aDescription,
|
---|
[22173] | 57 | const RTTIMESPEC &aTimeStamp,
|
---|
[21823] | 58 | SnapshotMachine *aMachine,
|
---|
| 59 | Snapshot *aParent);
|
---|
[1] | 60 | void uninit();
|
---|
| 61 |
|
---|
[49960] | 62 | void i_beginSnapshotDelete();
|
---|
[1] | 63 |
|
---|
[49960] | 64 | void i_deparent();
|
---|
[25152] | 65 |
|
---|
[1] | 66 | // public methods only for internal purposes
|
---|
[25834] | 67 |
|
---|
| 68 | /**
|
---|
[25836] | 69 | * Override of the default locking class to be used for validating lock
|
---|
| 70 | * order with the standard member lock handle.
|
---|
| 71 | */
|
---|
[50504] | 72 | virtual VBoxLockingClass getLockingClass() const
|
---|
[25836] | 73 | {
|
---|
| 74 | return LOCKCLASS_SNAPSHOTOBJECT;
|
---|
| 75 | }
|
---|
| 76 |
|
---|
[49960] | 77 | const ComObjPtr<Snapshot>& i_getParent() const;
|
---|
| 78 | const ComObjPtr<Snapshot> i_getFirstChild() const;
|
---|
[1] | 79 |
|
---|
[49960] | 80 | const Utf8Str& i_getStateFilePath() const;
|
---|
[1] | 81 |
|
---|
[49960] | 82 | uint32_t i_getDepth();
|
---|
[46720] | 83 |
|
---|
[49960] | 84 | ULONG i_getChildrenCount();
|
---|
| 85 | ULONG i_getAllChildrenCount();
|
---|
[21686] | 86 |
|
---|
[49960] | 87 | const ComObjPtr<SnapshotMachine>& i_getSnapshotMachine() const;
|
---|
[21823] | 88 |
|
---|
[49960] | 89 | Guid i_getId() const;
|
---|
| 90 | const Utf8Str& i_getName() const;
|
---|
| 91 | RTTIMESPEC i_getTimeStamp() const;
|
---|
[21823] | 92 |
|
---|
[49960] | 93 | ComObjPtr<Snapshot> i_findChildOrSelf(IN_GUID aId);
|
---|
[65088] | 94 | ComObjPtr<Snapshot> i_findChildOrSelf(const com::Utf8Str &aName);
|
---|
[1] | 95 |
|
---|
[49960] | 96 | void i_updateSavedStatePaths(const Utf8Str &strOldPath,
|
---|
| 97 | const Utf8Str &strNewPath);
|
---|
| 98 | void i_updateSavedStatePathsImpl(const Utf8Str &strOldPath,
|
---|
| 99 | const Utf8Str &strNewPath);
|
---|
[1] | 100 |
|
---|
[49960] | 101 | bool i_sharesSavedStateFile(const Utf8Str &strPath,
|
---|
| 102 | Snapshot *pSnapshotToIgnore);
|
---|
[36074] | 103 |
|
---|
[81425] | 104 | void i_updateNVRAMPaths(const Utf8Str &strOldPath,
|
---|
| 105 | const Utf8Str &strNewPath);
|
---|
| 106 | void i_updateNVRAMPathsImpl(const Utf8Str &strOldPath,
|
---|
| 107 | const Utf8Str &strNewPath);
|
---|
| 108 |
|
---|
[94598] | 109 | HRESULT i_saveSnapshotOne(settings::Snapshot &data) const;
|
---|
[54948] | 110 | HRESULT i_saveSnapshot(settings::Snapshot &data) const;
|
---|
[21823] | 111 |
|
---|
[94598] | 112 | HRESULT i_uninitAll(AutoWriteLock &writeLock,
|
---|
[54948] | 113 | CleanupMode_T cleanupMode,
|
---|
| 114 | MediaList &llMedia,
|
---|
| 115 | std::list<Utf8Str> &llFilenames);
|
---|
[31228] | 116 |
|
---|
[49960] | 117 |
|
---|
[1] | 118 | private:
|
---|
[49960] | 119 |
|
---|
[21823] | 120 | struct Data; // opaque, defined in SnapshotImpl.cpp
|
---|
[49960] | 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 |
|
---|
[21823] | 137 | Data *m;
|
---|
[1] | 138 | };
|
---|
| 139 |
|
---|
[76562] | 140 | #endif /* !MAIN_INCLUDED_SnapshotImpl_h */
|
---|
[1] | 141 |
|
---|
[14949] | 142 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|