VirtualBox

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

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

Main: kill VirtualBoxBaseWithTypedChildren template and rework Medium to no longer use it; adjust Snapshot for consistency

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.8 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 const ComObjPtr<Snapshot>& getParent() const;
93
94 const Utf8Str& stateFilePath() const;
95
96 ULONG getChildrenCount();
97 ULONG getAllChildrenCount();
98 ULONG getAllChildrenCountImpl();
99
100 const ComObjPtr<SnapshotMachine>& getSnapshotMachine() const;
101
102 Guid getId() const;
103 const Utf8Str& getName() const;
104 RTTIMESPEC getTimeStamp() const;
105
106 ComObjPtr<Snapshot> findChildOrSelf(IN_GUID aId);
107 ComObjPtr<Snapshot> findChildOrSelf(const Utf8Str &aName);
108
109 void updateSavedStatePaths(const char *aOldPath,
110 const char *aNewPath);
111 void updateSavedStatePathsImpl(const char *aOldPath,
112 const char *aNewPath);
113
114 HRESULT saveSnapshot(settings::Snapshot &data, bool aAttrsOnly);
115 HRESULT saveSnapshotImpl(settings::Snapshot &data, bool aAttrsOnly);
116
117 // for VirtualBoxSupportErrorInfoImpl
118 static const wchar_t *getComponentName()
119 {
120 return L"Snapshot";
121 }
122
123private:
124 struct Data; // opaque, defined in SnapshotImpl.cpp
125 Data *m;
126};
127
128#endif // ____H_SNAPSHOTIMPL
129
130/* 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