VirtualBox

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

Last change on this file since 3254 was 2981, checked in by vboxsync, 17 years ago

InnoTek -> innotek: all the headers and comments.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.7 KB
Line 
1/** @file
2 *
3 * VirtualBox COM class implementation
4 */
5
6/*
7 * Copyright (C) 2006-2007 innotek GmbH
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 as published by the Free Software Foundation,
13 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
14 * distribution. VirtualBox OSE is distributed in the hope that it will
15 * be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * If you received this file as part of a commercial VirtualBox
18 * distribution, then only the terms of your commercial VirtualBox
19 * license agreement apply instead of the previous paragraph.
20 */
21
22#ifndef ____H_SNAPSHOTIMPL
23#define ____H_SNAPSHOTIMPL
24
25#include "VirtualBoxBase.h"
26#include "Collection.h"
27
28#include <list>
29
30class SnapshotMachine;
31
32class ATL_NO_VTABLE Snapshot :
33 public VirtualBoxSupportErrorInfoImpl <Snapshot, ISnapshot>,
34 public VirtualBoxSupportTranslation <Snapshot>,
35 public VirtualBoxBaseWithTypedChildren <Snapshot>,
36 public ISnapshot
37{
38public:
39
40 struct Data
41 {
42 Data();
43 ~Data();
44
45 Guid mId;
46 Bstr mName;
47 Bstr mDescription;
48 LONG64 mTimeStamp;
49 ComObjPtr <SnapshotMachine> mMachine;
50 };
51
52 typedef VirtualBoxBaseWithTypedChildren <Snapshot>::DependentChildren
53 SnapshotList;
54
55 DECLARE_NOT_AGGREGATABLE(Snapshot)
56
57 DECLARE_PROTECT_FINAL_CONSTRUCT()
58
59 BEGIN_COM_MAP(Snapshot)
60 COM_INTERFACE_ENTRY(ISupportErrorInfo)
61 COM_INTERFACE_ENTRY(ISnapshot)
62 END_COM_MAP()
63
64 NS_DECL_ISUPPORTS
65
66 HRESULT FinalConstruct();
67 void FinalRelease();
68
69 // public initializer/uninitializer only for internal purposes
70 HRESULT init (const Guid &aId, INPTR BSTR aName, INPTR BSTR aDescription,
71 LONG64 aTimeStamp, SnapshotMachine *aMachine,
72 Snapshot *aParent);
73 void uninit();
74
75 void discard();
76
77 // ISnapshot properties
78 STDMETHOD(COMGETTER(Id)) (GUIDPARAMOUT aId);
79 STDMETHOD(COMGETTER(Name)) (BSTR *aName);
80 STDMETHOD(COMSETTER(Name)) (INPTR BSTR aName);
81 STDMETHOD(COMGETTER(Description)) (BSTR *aDescription);
82 STDMETHOD(COMSETTER(Description)) (INPTR 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)) (ISnapshotCollection **aChildren);
88
89 // ISnapshot methods
90
91 // public methods only for internal purposes
92
93 /** Do |AutoLock alock (this);| before acceessing the returned data! */
94 const Data &data() const { return mData; }
95
96 const Bstr &stateFilePath() const;
97
98 ComObjPtr <Snapshot> parent() const { return (Snapshot *) mParent; }
99
100 /** Shortcut to #dependentChildrenLock() */
101 AutoLock::Handle &childrenLock() const { return dependentChildrenLock(); }
102
103 /**
104 * Shortcut to #dependentChildren().
105 * Do |AutoLock alock (childrenLock());| before acceessing the returned list!
106 */
107 const SnapshotList &children() const { return dependentChildren(); }
108
109 ULONG descendantCount();
110 ComObjPtr <Snapshot> findChildOrSelf (INPTR GUIDPARAM aId);
111 ComObjPtr <Snapshot> findChildOrSelf (INPTR BSTR aName);
112
113 void updateSavedStatePaths (const char *aOldPath, const char *aNewPath);
114
115 // for VirtualBoxSupportErrorInfoImpl
116 static const wchar_t *getComponentName() { return L"Snapshot"; }
117
118private:
119
120 ComObjPtr <Snapshot, ComWeakRef> mParent;
121
122 Data mData;
123};
124
125COM_DECL_READONLY_ENUM_AND_COLLECTION (Snapshot)
126
127#endif // ____H_SNAPSHOTIMPL
128
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