VirtualBox

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

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

Main: Cleaned up the long standing const BSTR = const (OLECHAR *) on WIn32 vs (const PRunichar) * on XPCOM clash. Cleaned up BSTR/GUID macros (IN_BSTR replaces INPTR BSTR, IN_GUID replaces INPTR GUIDPARAM, OUT_GUID replaces GUIDPARAMOUT).

  • 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, IN_BSTR aName, IN_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)) (OUT_GUID aId);
81 STDMETHOD(COMGETTER(Name)) (BSTR *aName);
82 STDMETHOD(COMSETTER(Name)) (IN_BSTR aName);
83 STDMETHOD(COMGETTER(Description)) (BSTR *aDescription);
84 STDMETHOD(COMSETTER(Description)) (IN_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 (IN_GUID aId);
113 ComObjPtr <Snapshot> findChildOrSelf (IN_BSTR aName);
114
115 void updateSavedStatePaths (const char *aOldPath, const char *aNewPath);
116
117 // for VirtualBoxSupportErrorInfoImpl
118 static const wchar_t *getComponentName() { return L"Snapshot"; }
119
120private:
121
122 ComObjPtr <Snapshot, ComWeakRef> mParent;
123
124 Data mData;
125};
126
127COM_DECL_READONLY_ENUM_AND_COLLECTION (Snapshot)
128
129#endif // ____H_SNAPSHOTIMPL
130
131/* vi: set tabstop=4 shiftwidth=4 expandtab: */
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use