ProgressImpl.h revision b10a13ee0c4f4df2aa7cf2b164f0073fbd42e93c
/* $Id$ */
/** @file
*
* VirtualBox COM class implementation
*/
/*
* Copyright (C) 2006-2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#ifndef ____H_PROGRESSIMPL
#define ____H_PROGRESSIMPL
#include "ProgressWrap.h"
#include "VirtualBoxBase.h"
#include <iprt/semaphore.h>
////////////////////////////////////////////////////////////////////////////////
/**
* Class for progress objects.
*/
{
void i_checkForAutomaticTimeout(void);
#if !defined (VBOX_COM_INPROC)
/** Weak parent. */
VirtualBox * const mParent;
#endif
void (*m_pfnCancelCallback)(void *);
void *m_pvCancelUserArg;
/* The fields below are to be properly initialized by subclasses */
// display something like 1/3)
ULONG m_ulOperationsCompletedWeight; // summed-up weight of operations that have been completed; initially 0
// each setNextOperation()
// from constructor, changed with setNextOperation()
ULONG m_ulOperationPercent; // percentage of current operation, set with setCurrentOperationProgress()
void FinalRelease();
// public initializer/uninitializer for internal purposes only
/**
* Simplified constructor for progress objects that have only one
* operation as a task.
* @param aParent
* @param aInitiator
* @param aDescription
* @param aCancelable
* @param aId
* @return
*/
#if !defined (VBOX_COM_INPROC)
#endif
{
return init(
#if !defined (VBOX_COM_INPROC)
#endif
1, // cOperations
1, // ulTotalOperationsWeight
aDescription, // aFirstOperationDescription
1, // ulFirstOperationWeight
aId);
}
/**
* Not quite so simplified constructor for progress objects that have
* more than one operation, but all sub-operations are weighed the same.
* @param aParent
* @param aInitiator
* @param aDescription
* @param aCancelable
* @param cOperations
* @param bstrFirstOperationDescription
* @param aId
* @return
*/
#if !defined (VBOX_COM_INPROC)
#endif
{
return init(
#if !defined (VBOX_COM_INPROC)
#endif
cOperations, // cOperations
cOperations, // ulTotalOperationsWeight = cOperations
aFirstOperationDescription, // aFirstOperationDescription
1, // ulFirstOperationWeight: weigh them all the same
aId);
}
#if !defined (VBOX_COM_INPROC)
#endif
// initializer/uninitializer for internal purposes only
#if !defined (VBOX_COM_INPROC)
#endif
void uninit();
// public methods only for internal purposes
const char *pcszComponent,
const char *aText,
...);
const char *pcszComponent,
const char *aText,
bool i_notifyPointOfNoReturn(void);
// public methods only for internal purposes
// unsafe inline public methods for internal purposes only (ensure there is
// a caller and a read lock before calling them!)
double i_calcTotalPercent();
// Wrapped IProgress Data
// Wrapped Iprogress methods
};
#endif /* ____H_PROGRESSIMPL */