VirtualBox

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

Last change on this file since 50874 was 44528, checked in by vboxsync, 12 years ago

header (C) fixes

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.0 KB
Line 
1/* $Id: ProgressProxyImpl.h 44528 2013-02-04 14:27:54Z vboxsync $ */
2/** @file
3 * IProgress implementation for Machine::openRemoteSession in VBoxSVC.
4 */
5
6/*
7 * Copyright (C) 2006-2012 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 VBOX_DEFAULT_INTERFACE_ENTRIES (IProgress)
40 END_COM_MAP()
41
42 HRESULT FinalConstruct();
43 void FinalRelease();
44 HRESULT init(
45#if !defined (VBOX_COM_INPROC)
46 VirtualBox *pParent,
47#endif
48 IUnknown *pInitiator,
49 CBSTR bstrDescription,
50 BOOL fCancelable);
51 HRESULT init(
52#if !defined (VBOX_COM_INPROC)
53 VirtualBox *pParent,
54#endif
55 IUnknown *pInitiator,
56 CBSTR bstrDescription,
57 BOOL fCancelable,
58 ULONG uTotalOperationsWeight,
59 CBSTR bstrFirstOperationDescription,
60 ULONG uFirstOperationWeight,
61 ULONG cOtherProgressObjectOperations);
62 void uninit();
63
64 // IProgress properties
65 STDMETHOD(COMGETTER(Cancelable))(BOOL *aCancelable);
66 STDMETHOD(COMGETTER(Percent))(ULONG *aPercent);
67 STDMETHOD(COMGETTER(TimeRemaining))(LONG *aTimeRemaining);
68 STDMETHOD(COMGETTER(Completed))(BOOL *aCompleted);
69 STDMETHOD(COMGETTER(Canceled))(BOOL *aCanceled);
70 STDMETHOD(COMGETTER(ResultCode))(LONG *aResultCode);
71 STDMETHOD(COMGETTER(ErrorInfo))(IVirtualBoxErrorInfo **aErrorInfo);
72 //STDMETHOD(COMGETTER(OperationCount))(ULONG *aOperationCount); - not necessary
73 STDMETHOD(COMGETTER(Operation))(ULONG *aOperation);
74 STDMETHOD(COMGETTER(OperationDescription))(BSTR *aOperationDescription);
75 STDMETHOD(COMGETTER(OperationPercent))(ULONG *aOperationPercent);
76 STDMETHOD(COMSETTER(Timeout))(ULONG aTimeout);
77 STDMETHOD(COMGETTER(Timeout))(ULONG *aTimeout);
78
79 // IProgress methods
80 STDMETHOD(WaitForCompletion)(LONG aTimeout);
81 STDMETHOD(WaitForOperationCompletion)(ULONG aOperation, LONG aTimeout);
82 STDMETHOD(Cancel)();
83 STDMETHOD(SetCurrentOperationProgress)(ULONG aPercent);
84 STDMETHOD(SetNextOperation)(IN_BSTR bstrNextOperationDescription, ULONG ulNextOperationsWeight);
85
86 // public methods only for internal purposes
87
88 HRESULT notifyComplete(HRESULT aResultCode);
89 HRESULT notifyComplete(HRESULT aResultCode,
90 const GUID &aIID,
91 const char *pcszComponent,
92 const char *aText, ...);
93 bool setOtherProgressObject(IProgress *pOtherProgress);
94
95protected:
96 void clearOtherProgressObjectInternal(bool fEarly);
97 void copyProgressInfo(IProgress *pOtherProgress, bool fEarly);
98
99private:
100 /** The other progress object. This can be NULL. */
101 ComPtr<IProgress> mptrOtherProgress;
102 /** Set if the other progress object has multiple operations. */
103 bool mfMultiOperation;
104 /** The weight the other progress object started at. */
105 ULONG muOtherProgressStartWeight;
106 /** The weight of other progress object. */
107 ULONG muOtherProgressWeight;
108 /** The operation number the other progress object started at. */
109 ULONG muOtherProgressStartOperation;
110
111};
112
113#endif /* !____H_PROGRESSPROXYIMPL */
114
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