VirtualBox

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

Last change on this file since 86506 was 82968, checked in by vboxsync, 4 years 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.2 KB
Line 
1/* $Id: ProgressProxyImpl.h 82968 2020-02-04 10:35:17Z vboxsync $ */
2/** @file
3 * IProgress implementation for Machine::LaunchVMProcess in VBoxSVC.
4 */
5
6/*
7 * Copyright (C) 2006-2020 Oracle Corporation
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
18#ifndef MAIN_INCLUDED_ProgressProxyImpl_h
19#define MAIN_INCLUDED_ProgressProxyImpl_h
20#ifndef RT_WITHOUT_PRAGMA_ONCE
21# pragma once
22#endif
23
24#include "ProgressImpl.h"
25#include "AutoCaller.h"
26
27
28/**
29 * The ProgressProxy class allows proxying the important Progress calls and
30 * attributes to a different IProgress object for a period of time.
31 */
32class ATL_NO_VTABLE ProgressProxy :
33 public Progress
34{
35public:
36 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(ProgressProxy, IProgress)
37
38 DECLARE_NOT_AGGREGATABLE(ProgressProxy)
39 DECLARE_PROTECT_FINAL_CONSTRUCT()
40
41 BEGIN_COM_MAP(ProgressProxy)
42 COM_INTERFACE_ENTRY(ISupportErrorInfo)
43 COM_INTERFACE_ENTRY(IProgress)
44 COM_INTERFACE_ENTRY2(IDispatch, IProgress)
45 VBOX_TWEAK_INTERFACE_ENTRY(IProgress)
46 END_COM_MAP()
47
48 HRESULT FinalConstruct();
49 void FinalRelease();
50 HRESULT init(
51#ifndef VBOX_COM_INPROC
52 VirtualBox *pParent,
53#endif
54 IUnknown *pInitiator,
55 Utf8Str strDescription,
56 BOOL fCancelable);
57 HRESULT init(
58#ifndef VBOX_COM_INPROC
59 VirtualBox *pParent,
60#endif
61 IUnknown *pInitiator,
62 Utf8Str strDescription,
63 BOOL fCancelable,
64 ULONG uTotalOperationsWeight,
65 Utf8Str strFirstOperationDescription,
66 ULONG uFirstOperationWeight,
67 ULONG cOtherProgressObjectOperations);
68 void uninit();
69
70 // IProgress properties
71 STDMETHOD(COMGETTER(Cancelable))(BOOL *aCancelable);
72 STDMETHOD(COMGETTER(Percent))(ULONG *aPercent);
73 STDMETHOD(COMGETTER(TimeRemaining))(LONG *aTimeRemaining);
74 STDMETHOD(COMGETTER(Completed))(BOOL *aCompleted);
75 STDMETHOD(COMGETTER(Canceled))(BOOL *aCanceled);
76 STDMETHOD(COMGETTER(ResultCode))(LONG *aResultCode);
77 STDMETHOD(COMGETTER(ErrorInfo))(IVirtualBoxErrorInfo **aErrorInfo);
78 //STDMETHOD(COMGETTER(OperationCount))(ULONG *aOperationCount); - not necessary
79 STDMETHOD(COMGETTER(Operation))(ULONG *aOperation);
80 STDMETHOD(COMGETTER(OperationDescription))(BSTR *aOperationDescription);
81 STDMETHOD(COMGETTER(OperationPercent))(ULONG *aOperationPercent);
82 STDMETHOD(COMSETTER(Timeout))(ULONG aTimeout);
83 STDMETHOD(COMGETTER(Timeout))(ULONG *aTimeout);
84
85 // IProgress methods
86 STDMETHOD(WaitForCompletion)(LONG aTimeout);
87 STDMETHOD(WaitForOperationCompletion)(ULONG aOperation, LONG aTimeout);
88 STDMETHOD(Cancel)();
89 STDMETHOD(SetCurrentOperationProgress)(ULONG aPercent);
90 STDMETHOD(SetNextOperation)(IN_BSTR bstrNextOperationDescription, ULONG ulNextOperationsWeight);
91
92 // public methods only for internal purposes
93
94 HRESULT notifyComplete(HRESULT aResultCode);
95 HRESULT notifyComplete(HRESULT aResultCode,
96 const GUID &aIID,
97 const char *pcszComponent,
98 const char *aText, ...);
99 bool setOtherProgressObject(IProgress *pOtherProgress);
100
101protected:
102 void clearOtherProgressObjectInternal(bool fEarly);
103 void copyProgressInfo(IProgress *pOtherProgress, bool fEarly);
104
105private:
106 /** The other progress object. This can be NULL. */
107 ComPtr<IProgress> mptrOtherProgress;
108 /** Set if the other progress object has multiple operations. */
109 bool mfMultiOperation;
110 /** The weight the other progress object started at. */
111 ULONG muOtherProgressStartWeight;
112 /** The weight of other progress object. */
113 ULONG muOtherProgressWeight;
114 /** The operation number the other progress object started at. */
115 ULONG muOtherProgressStartOperation;
116
117};
118
119#endif /* !MAIN_INCLUDED_ProgressProxyImpl_h */
120
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use