MediumImpl.h revision ee00a0b29854e7f513198772bccb6650f6dd2184
/* $Id$ */
/** @file
*
* VirtualBox COM class implementation
*/
/*
* Copyright (C) 2008-2010 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_MEDIUMIMPL
#define ____H_MEDIUMIMPL
#include "VirtualBoxBase.h"
#include "MediumLock.h"
{
struct Medium;
}
////////////////////////////////////////////////////////////////////////////////
/**
* Medium component class for all media types.
*/
{
void FinalRelease();
// have to use a special enum for the overloaded init() below;
// can't use AccessMode_T from XIDL because that's mapped to an int
// and would be ambiguous
// public initializer/uninitializer for internal purposes only
// initializer to create empty medium (VirtualBox::CreateHardDisk())
const Guid &uuidMachineRegistry,
bool *pfNeedsGlobalSaveSettings);
// initializer for opening existing media
// (VirtualBox::OpenMedium(); Machine::AttachDevice())
// initializer used when loading settings
const Guid &uuidMachineRegistry,
const Utf8Str &strMachineFolder);
void uninit();
void deparent();
// IMedium properties
// IMedium methods
// unsafe methods for internal purposes only (ensure there is
// a caller and a read lock before calling them!)
const MediaList& getChildren() const;
MediumState_T getState() const;
MediumVariant_T getVariant() const;
bool isHostDrive() const;
const Utf8Str& getLocationFull() const;
DeviceType_T getDeviceType() const;
MediumType_T getType() const;
bool *pfNeedsSaveSettings);
const Guid& getFirstRegistryMachineId() const;
const Guid* getFirstMachineBackrefId() const;
const Guid* getFirstMachineBackrefSnapshotId() const;
#ifdef DEBUG
void dumpBackRefs();
#endif
bool isReadOnly();
const Utf8Str &strHardDiskFolder);
bool fMediumLockWrite,
bool aWait,
bool *pfNeedsGlobalSaveSettings);
const Guid *aMachineId,
const Guid *aSnapshotId,
bool fLockMedia,
bool &fMergeForward,
bool fMergeForward,
const MediaList &aChildrenToReparent,
bool aWait,
bool *pfNeedsGlobalSaveSettings);
/**
* Used by IAppliance to export disk images.
*
* @param aFilename Filename to create (UTF8).
* @param aFormat Medium format for creating @a aFilename.
* @param aVariant Which exact image format variant to use
* for the destination image.
* @param aVDImageIOCallbacks Pointer to the callback table for a
* VDINTERFACEIO interface. May be NULL.
* @param aVDImageIOUser Opaque data for the callbacks.
* @param aProgress Progress object to use.
* @return
* @note The source format is defined by the Medium instance.
*/
void *aVDImageIOCallbacks, void *aVDImageIOUser,
/**
* Used by IAppliance to import disk images.
*
* @param aFilename Filename to read (UTF8).
* @param aFormat Medium format for reading @a aFilename.
* @param aVariant Which exact image format variant to use
* for the destination image.
* @param aVDImageIOCallbacks Pointer to the callback table for a
* VDINTERFACEIO interface. May be NULL.
* @param aVDImageIOUser Opaque data for the callbacks.
* @param aParent Parent medium. May be NULL.
* @param aProgress Progress object to use.
* @return
* @note The destination format is defined by the Medium instance.
*/
void *aVDImageIOCallbacks, void *aVDImageIOUser,
/** Returns a preferred format for a differencing hard disk. */
const char *pszzValid);
static DECLCALLBACK(int) vdTcpRead(VDSOCKET Sock, void *pvBuffer, size_t cbBuffer, size_t *pcbRead);
struct Data; // opaque data struct, defined in MediumImpl.cpp
Data *m;
};
#endif /* ____H_MEDIUMIMPL */