VirtualBox

source: vbox/trunk/src/VBox/Main/include/ProgressProxyImpl.h@ 98526

Last change on this file since 98526 was 98103, checked in by vboxsync, 23 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.5 KB
Line 
1/* $Id: ProgressProxyImpl.h 98103 2023-01-17 14:15:46Z vboxsync $ */
2/** @file
3 * IProgress implementation for Machine::LaunchVMProcess in VBoxSVC.
4 */
5
6/*
7 * Copyright (C) 2006-2023 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
26 */
27
28#ifndef MAIN_INCLUDED_ProgressProxyImpl_h
29#define MAIN_INCLUDED_ProgressProxyImpl_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34#include "ProgressImpl.h"
35#include "AutoCaller.h"
36
37
38/**
39 * The ProgressProxy class allows proxying the important Progress calls and
40 * attributes to a different IProgress object for a period of time.
41 */
42class ATL_NO_VTABLE ProgressProxy :
43 public Progress
44{
45public:
46 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(ProgressProxy, IProgress)
47
48 DECLARE_NOT_AGGREGATABLE(ProgressProxy)
49 DECLARE_PROTECT_FINAL_CONSTRUCT()
50
51 BEGIN_COM_MAP(ProgressProxy)
52 COM_INTERFACE_ENTRY(ISupportErrorInfo)
53 COM_INTERFACE_ENTRY(IProgress)
54 COM_INTERFACE_ENTRY2(IDispatch, IProgress)
55 VBOX_TWEAK_INTERFACE_ENTRY(IProgress)
56 END_COM_MAP()
57
58 HRESULT FinalConstruct();
59 void FinalRelease();
60 HRESULT init(
61#ifndef VBOX_COM_INPROC
62 VirtualBox *pParent,
63#endif
64 IUnknown *pInitiator,
65 Utf8Str strDescription,
66 BOOL fCancelable);
67 HRESULT init(
68#ifndef VBOX_COM_INPROC
69 VirtualBox *pParent,
70#endif
71 IUnknown *pInitiator,
72 Utf8Str strDescription,
73 BOOL fCancelable,
74 ULONG uTotalOperationsWeight,
75 Utf8Str strFirstOperationDescription,
76 ULONG uFirstOperationWeight,
77 ULONG cOtherProgressObjectOperations);
78 void uninit();
79
80 // IProgress properties
81 STDMETHOD(COMGETTER(Cancelable))(BOOL *aCancelable);
82 STDMETHOD(COMGETTER(Percent))(ULONG *aPercent);
83 STDMETHOD(COMGETTER(TimeRemaining))(LONG *aTimeRemaining);
84 STDMETHOD(COMGETTER(Completed))(BOOL *aCompleted);
85 STDMETHOD(COMGETTER(Canceled))(BOOL *aCanceled);
86 STDMETHOD(COMGETTER(ResultCode))(LONG *aResultCode);
87 STDMETHOD(COMGETTER(ErrorInfo))(IVirtualBoxErrorInfo **aErrorInfo);
88 //STDMETHOD(COMGETTER(OperationCount))(ULONG *aOperationCount); - not necessary
89 STDMETHOD(COMGETTER(Operation))(ULONG *aOperation);
90 STDMETHOD(COMGETTER(OperationDescription))(BSTR *aOperationDescription);
91 STDMETHOD(COMGETTER(OperationPercent))(ULONG *aOperationPercent);
92 STDMETHOD(COMSETTER(Timeout))(ULONG aTimeout);
93 STDMETHOD(COMGETTER(Timeout))(ULONG *aTimeout);
94
95 // IProgress methods
96 STDMETHOD(WaitForCompletion)(LONG aTimeout);
97 STDMETHOD(WaitForOperationCompletion)(ULONG aOperation, LONG aTimeout);
98 STDMETHOD(Cancel)();
99 STDMETHOD(SetCurrentOperationProgress)(ULONG aPercent);
100 STDMETHOD(SetNextOperation)(IN_BSTR bstrNextOperationDescription, ULONG ulNextOperationsWeight);
101
102 // public methods only for internal purposes
103
104 HRESULT notifyComplete(HRESULT aResultCode);
105 HRESULT notifyComplete(HRESULT aResultCode,
106 const GUID &aIID,
107 const char *pcszComponent,
108 const char *aText, ...);
109 bool setOtherProgressObject(IProgress *pOtherProgress);
110
111protected:
112 void clearOtherProgressObjectInternal(bool fEarly);
113 void copyProgressInfo(IProgress *pOtherProgress, bool fEarly);
114
115private:
116 /** The other progress object. This can be NULL. */
117 ComPtr<IProgress> mptrOtherProgress;
118 /** Set if the other progress object has multiple operations. */
119 bool mfMultiOperation;
120 /** The weight the other progress object started at. */
121 ULONG muOtherProgressStartWeight;
122 /** The weight of other progress object. */
123 ULONG muOtherProgressWeight;
124 /** The operation number the other progress object started at. */
125 ULONG muOtherProgressStartOperation;
126
127};
128
129#endif /* !MAIN_INCLUDED_ProgressProxyImpl_h */
130
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