VirtualBox

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

Last change on this file since 67885 was 60765, checked in by vboxsync, 9 years ago

API: stop using ATL and use a vastly smaller lookalike instead, plus a lot of cleanups

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