ProgressImpl.h revision 26d2a42f095ded346df2e41cc4837cb426b4753a
c936b605260fac01308e3f63b869f401321c52b3vboxsync * VirtualBox COM class implementation
c936b605260fac01308e3f63b869f401321c52b3vboxsync * Copyright (C) 2006-2008 Sun Microsystems, Inc.
c936b605260fac01308e3f63b869f401321c52b3vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
c936b605260fac01308e3f63b869f401321c52b3vboxsync * available from http://www.virtualbox.org. This file is free software;
c936b605260fac01308e3f63b869f401321c52b3vboxsync * you can redistribute it and/or modify it under the terms of the GNU
c936b605260fac01308e3f63b869f401321c52b3vboxsync * General Public License (GPL) as published by the Free Software
c936b605260fac01308e3f63b869f401321c52b3vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
c936b605260fac01308e3f63b869f401321c52b3vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
c936b605260fac01308e3f63b869f401321c52b3vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
c936b605260fac01308e3f63b869f401321c52b3vboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
c936b605260fac01308e3f63b869f401321c52b3vboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
c936b605260fac01308e3f63b869f401321c52b3vboxsync * additional information or have any questions.
c936b605260fac01308e3f63b869f401321c52b3vboxsync////////////////////////////////////////////////////////////////////////////////
c936b605260fac01308e3f63b869f401321c52b3vboxsync * Base component class for progress objects.
c936b605260fac01308e3f63b869f401321c52b3vboxsync public VirtualBoxSupportTranslation <ProgressBase>,
c936b605260fac01308e3f63b869f401321c52b3vboxsync VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (ProgressBase)
c936b605260fac01308e3f63b869f401321c52b3vboxsync // protected initializer/uninitializer for internal purposes only
c936b605260fac01308e3f63b869f401321c52b3vboxsync HRESULT protectedInit (AutoInitSpan &aAutoInitSpan,
c936b605260fac01308e3f63b869f401321c52b3vboxsync HRESULT protectedInit (AutoInitSpan &aAutoInitSpan);
c936b605260fac01308e3f63b869f401321c52b3vboxsync void protectedUninit (AutoUninitSpan &aAutoUninitSpan);
c936b605260fac01308e3f63b869f401321c52b3vboxsync // IProgress properties
9246d7f57490c7fa3f8344fe370066568ba2121avboxsync STDMETHOD(COMGETTER(Description)) (BSTR *aDescription);
c936b605260fac01308e3f63b869f401321c52b3vboxsync STDMETHOD(COMGETTER(Initiator)) (IUnknown **aInitiator);
c936b605260fac01308e3f63b869f401321c52b3vboxsync // IProgress properties
c936b605260fac01308e3f63b869f401321c52b3vboxsync STDMETHOD(COMGETTER(Cancelable)) (BOOL *aCancelable);
c936b605260fac01308e3f63b869f401321c52b3vboxsync STDMETHOD(COMGETTER(Completed)) (BOOL *aCompleted);
c936b605260fac01308e3f63b869f401321c52b3vboxsync STDMETHOD(COMGETTER(ResultCode)) (HRESULT *aResultCode);
c936b605260fac01308e3f63b869f401321c52b3vboxsync STDMETHOD(COMGETTER(ErrorInfo)) (IVirtualBoxErrorInfo **aErrorInfo);
c936b605260fac01308e3f63b869f401321c52b3vboxsync STDMETHOD(COMGETTER(OperationCount)) (ULONG *aOperationCount);
c936b605260fac01308e3f63b869f401321c52b3vboxsync STDMETHOD(COMGETTER(OperationDescription)) (BSTR *aOperationDescription);
c936b605260fac01308e3f63b869f401321c52b3vboxsync STDMETHOD(COMGETTER(OperationPercent)) (LONG *aOperationPercent);
c936b605260fac01308e3f63b869f401321c52b3vboxsync // public methods only for internal purposes
c936b605260fac01308e3f63b869f401321c52b3vboxsync static HRESULT setErrorInfoOnThread (IProgress *aProgress);
c936b605260fac01308e3f63b869f401321c52b3vboxsync // unsafe inline public methods for internal purposes only (ensure there is
c936b605260fac01308e3f63b869f401321c52b3vboxsync // a caller and a read lock before calling them!)
c936b605260fac01308e3f63b869f401321c52b3vboxsync /** Weak parent. */
c936b605260fac01308e3f63b869f401321c52b3vboxsync /* The fields below are to be properly initalized by subclasses */
c936b605260fac01308e3f63b869f401321c52b3vboxsync////////////////////////////////////////////////////////////////////////////////
c936b605260fac01308e3f63b869f401321c52b3vboxsync * Normal progress object.
c936b605260fac01308e3f63b869f401321c52b3vboxsync public com::SupportErrorInfoDerived <ProgressBase, Progress, IProgress>,
c936b605260fac01308e3f63b869f401321c52b3vboxsync // public initializer/uninitializer for internal purposes only
c936b605260fac01308e3f63b869f401321c52b3vboxsync aInitiator, aDescription, aCancelable, 1, aDescription, aId);
c936b605260fac01308e3f63b869f401321c52b3vboxsync ULONG aOperationCount, const BSTR aOperationDescription,
c936b605260fac01308e3f63b869f401321c52b3vboxsync HRESULT init (BOOL aCancelable, ULONG aOperationCount,
c936b605260fac01308e3f63b869f401321c52b3vboxsync // IProgress methods
c936b605260fac01308e3f63b869f401321c52b3vboxsync STDMETHOD(WaitForOperationCompletion) (ULONG aOperation, LONG aTimeout);
c936b605260fac01308e3f63b869f401321c52b3vboxsync // public methods only for internal purposes
c936b605260fac01308e3f63b869f401321c52b3vboxsync HRESULT advanceOperation (const BSTR aOperationDescription);
c936b605260fac01308e3f63b869f401321c52b3vboxsync HRESULT notifyComplete (HRESULT aResultCode, const GUID &aIID,
90e8b000bdf708e8465e9c2cd7ecf1339c27c4aavboxsync const char *aText, ...);
90e8b000bdf708e8465e9c2cd7ecf1339c27c4aavboxsync HRESULT notifyCompleteBstr (HRESULT aResultCode, const GUID &aIID,
90e8b000bdf708e8465e9c2cd7ecf1339c27c4aavboxsync /** For com::SupportErrorInfoImpl. */
90e8b000bdf708e8465e9c2cd7ecf1339c27c4aavboxsync static const char *ComponentName() { return "Progress"; }
c936b605260fac01308e3f63b869f401321c52b3vboxsync////////////////////////////////////////////////////////////////////////////////
c936b605260fac01308e3f63b869f401321c52b3vboxsync * The CombinedProgress class allows to combine several progress objects to a
c936b605260fac01308e3f63b869f401321c52b3vboxsync * single progress component. This single progress component will treat all
c936b605260fac01308e3f63b869f401321c52b3vboxsync * operations of individual progress objects as a single sequence of operations
c936b605260fac01308e3f63b869f401321c52b3vboxsync * that follow each other in the same order as progress objects are passed to
c936b605260fac01308e3f63b869f401321c52b3vboxsync * the #init() method.
c936b605260fac01308e3f63b869f401321c52b3vboxsync * Individual progress objects are sequentially combined so that this progress
c936b605260fac01308e3f63b869f401321c52b3vboxsync * - is cancelable only if all progresses are cancelable.
c936b605260fac01308e3f63b869f401321c52b3vboxsync * - is canceled once a progress that follows next to successfully completed
void FinalRelease();
// public initializer/uninitializer for internal purposes only
#if !defined (VBOX_COM_INPROC)
#if !defined (VBOX_COM_INPROC)
#if !defined (VBOX_COM_INPROC)
return rc;
#if !defined (VBOX_COM_INPROC)
void uninit();