VirtualBox

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

Last change on this file since 8217 was 8155, checked in by vboxsync, 17 years ago

The Big Sun Rebranding Header Change

  • 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-2007 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#include "Collection.h"
27
28#include <iprt/time.h>
29
30#include <list>
31
32class SnapshotMachine;
33
34class ATL_NO_VTABLE Snapshot :
35 public VirtualBoxSupportErrorInfoImpl <Snapshot, ISnapshot>,
36 public VirtualBoxSupportTranslation <Snapshot>,
37 public VirtualBoxBaseWithTypedChildren <Snapshot>,
38 public ISnapshot
39{
40public:
41
42 struct Data
43 {
44 Data();
45 ~Data();
46
47 Guid mId;
48 Bstr mName;
49 Bstr mDescription;
50 RTTIMESPEC mTimeStamp;
51 ComObjPtr <SnapshotMachine> mMachine;
52 };
53
54 typedef VirtualBoxBaseWithTypedChildren <Snapshot>::DependentChildren
55 SnapshotList;
56
57 DECLARE_NOT_AGGREGATABLE(Snapshot)
58
59 DECLARE_PROTECT_FINAL_CONSTRUCT()
60
61 BEGIN_COM_MAP(Snapshot)
62 COM_INTERFACE_ENTRY(ISupportErrorInfo)
63 COM_INTERFACE_ENTRY(ISnapshot)
64 END_COM_MAP()
65
66 NS_DECL_ISUPPORTS
67
68 HRESULT FinalConstruct();
69 void FinalRelease();
70
71 // public initializer/uninitializer only for internal purposes
72 HRESULT init (const Guid &aId, INPTR BSTR aName, INPTR BSTR aDescription,
73 RTTIMESPEC aTimeStamp, SnapshotMachine *aMachine,
74 Snapshot *aParent);
75 void uninit();
76
77 void discard();
78
79 // ISnapshot properties
80 STDMETHOD(COMGETTER(Id)) (GUIDPARAMOUT aId);
81 STDMETHOD(COMGETTER(Name)) (BSTR *aName);
82 STDMETHOD(COMSETTER(Name)) (INPTR BSTR aName);
83 STDMETHOD(COMGETTER(Description)) (BSTR *aDescription);
84 STDMETHOD(COMSETTER(Description)) (INPTR BSTR aDescription);
85 STDMETHOD(COMGETTER(TimeStamp)) (LONG64 *aTimeStamp);
86 STDMETHOD(COMGETTER(Online)) (BOOL *aOnline);
87 STDMETHOD(COMGETTER(Machine)) (IMachine **aMachine);
88 STDMETHOD(COMGETTER(Parent)) (ISnapshot **aParent);
89 STDMETHOD(COMGETTER(Children)) (ISnapshotCollection **aChildren);
90
91 // ISnapshot methods
92
93 // public methods only for internal purposes
94
95 /** Do |AutoWriteLock alock (this);| before acceessing the returned data! */
96 const Data &data() const { return mData; }
97
98 const Bstr &stateFilePath() const;
99
100 ComObjPtr <Snapshot> parent() const { return (Snapshot *) mParent; }
101
102 /** Shortcut to #dependentChildrenLock() */
103 RWLockHandle *childrenLock() const { return dependentChildrenLock(); }
104
105 /**
106 * Shortcut to #dependentChildren().
107 * Do |AutoWriteLock alock (childrenLock());| before acceessing the returned list!
108 */
109 const SnapshotList &children() const { return dependentChildren(); }
110
111 ULONG descendantCount();
112 ComObjPtr <Snapshot> findChildOrSelf (INPTR GUIDPARAM aId);
113 ComObjPtr <Snapshot> findChildOrSelf (INPTR BSTR aName);
114
115 bool isDVDImageUsed (const Guid &aId);
116 bool isFloppyImageUsed (const Guid &aId);
117
118 void updateSavedStatePaths (const char *aOldPath, const char *aNewPath);
119
120 // for VirtualBoxSupportErrorInfoImpl
121 static const wchar_t *getComponentName() { return L"Snapshot"; }
122
123private:
124
125 ComObjPtr <Snapshot, ComWeakRef> mParent;
126
127 Data mData;
128};
129
130COM_DECL_READONLY_ENUM_AND_COLLECTION (Snapshot)
131
132#endif // ____H_SNAPSHOTIMPL
133
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