VirtualBox

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

Last change on this file since 25834 was 25834, checked in by vboxsync, 15 years ago

Main: finish integration of Main lock validation with IPRT; only enabled with VBOX_WITH_STRICT_LOCKS=1 (do NOT enable unless you want Main to stop working now)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.0 KB
Line 
1/** @file
2 *
3 * VirtualBox COM class implementation
4 */
5
6/*
7 * Copyright (C) 2006-2009 Sun Microsystems, Inc.
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 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
18 * Clara, CA 95054 USA or visit http://www.sun.com if you need
19 * additional information or have any questions.
20 */
21
22#ifndef ____H_SNAPSHOTIMPL
23#define ____H_SNAPSHOTIMPL
24
25#include "VirtualBoxBase.h"
26
27#include <iprt/time.h>
28
29class SnapshotMachine;
30class VirtualBox;
31
32namespace settings
33{
34 struct Snapshot;
35}
36
37class ATL_NO_VTABLE Snapshot :
38 public VirtualBoxSupportErrorInfoImpl<Snapshot, ISnapshot>,
39 public VirtualBoxSupportTranslation<Snapshot>,
40 public VirtualBoxBase, // WithTypedChildren<Snapshot>,
41 VBOX_SCRIPTABLE_IMPL(ISnapshot)
42{
43public:
44 DECLARE_NOT_AGGREGATABLE(Snapshot)
45
46 DECLARE_PROTECT_FINAL_CONSTRUCT()
47
48 BEGIN_COM_MAP(Snapshot)
49 COM_INTERFACE_ENTRY (ISupportErrorInfo)
50 COM_INTERFACE_ENTRY (ISnapshot)
51 COM_INTERFACE_ENTRY2 (IDispatch, ISnapshot)
52 END_COM_MAP()
53
54 Snapshot()
55 : m(NULL)
56 { };
57 ~Snapshot()
58 { };
59
60 HRESULT FinalConstruct();
61 void FinalRelease();
62
63 // public initializer/uninitializer only for internal purposes
64 HRESULT init(VirtualBox *aVirtualBox,
65 const Guid &aId,
66 const Utf8Str &aName,
67 const Utf8Str &aDescription,
68 const RTTIMESPEC &aTimeStamp,
69 SnapshotMachine *aMachine,
70 Snapshot *aParent);
71 void uninit();
72
73 void beginDiscard();
74
75 void deparent();
76
77 // ISnapshot properties
78 STDMETHOD(COMGETTER(Id)) (BSTR *aId);
79 STDMETHOD(COMGETTER(Name)) (BSTR *aName);
80 STDMETHOD(COMSETTER(Name)) (IN_BSTR aName);
81 STDMETHOD(COMGETTER(Description)) (BSTR *aDescription);
82 STDMETHOD(COMSETTER(Description)) (IN_BSTR aDescription);
83 STDMETHOD(COMGETTER(TimeStamp)) (LONG64 *aTimeStamp);
84 STDMETHOD(COMGETTER(Online)) (BOOL *aOnline);
85 STDMETHOD(COMGETTER(Machine)) (IMachine **aMachine);
86 STDMETHOD(COMGETTER(Parent)) (ISnapshot **aParent);
87 STDMETHOD(COMGETTER(Children)) (ComSafeArrayOut (ISnapshot *, aChildren));
88
89 // ISnapshot methods
90
91 // public methods only for internal purposes
92
93
94 /**
95 * Simple run-time type identification without having to enable C++ RTTI.
96 * The class IDs are defined in VirtualBoxBase.h.
97 * @return
98 */
99 virtual VBoxClsID getClassID() const
100 {
101 return clsidSnapshot;
102 }
103
104 const ComObjPtr<Snapshot>& getParent() const;
105
106 const Utf8Str& stateFilePath() const;
107
108 ULONG getChildrenCount();
109 ULONG getAllChildrenCount();
110 ULONG getAllChildrenCountImpl();
111
112 const ComObjPtr<SnapshotMachine>& getSnapshotMachine() const;
113
114 Guid getId() const;
115 const Utf8Str& getName() const;
116 RTTIMESPEC getTimeStamp() const;
117
118 ComObjPtr<Snapshot> findChildOrSelf(IN_GUID aId);
119 ComObjPtr<Snapshot> findChildOrSelf(const Utf8Str &aName);
120
121 void updateSavedStatePaths(const char *aOldPath,
122 const char *aNewPath);
123 void updateSavedStatePathsImpl(const char *aOldPath,
124 const char *aNewPath);
125
126 HRESULT saveSnapshot(settings::Snapshot &data, bool aAttrsOnly);
127 HRESULT saveSnapshotImpl(settings::Snapshot &data, bool aAttrsOnly);
128
129 // for VirtualBoxSupportErrorInfoImpl
130 static const wchar_t *getComponentName()
131 {
132 return L"Snapshot";
133 }
134
135private:
136 struct Data; // opaque, defined in SnapshotImpl.cpp
137 Data *m;
138};
139
140#endif // ____H_SNAPSHOTIMPL
141
142/* vi: set tabstop=4 shiftwidth=4 expandtab: */
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette