VirtualBox

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

Last change on this file since 77110 was 76562, checked in by vboxsync, 6 years ago

Main: Use MAIN_INCLUDED_ and MAIN_INCLUDED_SRC_ as header guard prefixes with scm.

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