MediumImpl.h revision e67c6527ea1482264eb46a12493f9a0a4bcf4690
/* $Id$ */
/** @file
*
* VirtualBox COM class implementation
*/
/*
* Copyright (C) 2008-2010 Sun Microsystems, Inc.
*
* 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.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
*/
#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
bool *pfNeedsSaveSettings);
// initializer used when loading settings
void uninit();
void deparent();
// IMedium properties
// IMedium methods
// public methods for internal purposes only
const MediaList& getChildren() const;
// unsafe methods for internal purposes only (ensure there is
// a caller and a read lock before calling them!)
MediumState_T getState() const;
const Utf8Str& getLocation() const;
const Utf8Str& getLocationFull() const;
MediumType_T getType() const;
const Guid* getFirstMachineBackrefId() const;
const Guid* getFirstMachineBackrefSnapshotId() const;
#ifdef DEBUG
void dumpBackRefs();
#endif
bool isReadOnly();
HRESULT createMediumLockList(bool fMediumWritable, Medium *pToBeParent, MediumLockList &mediumLockList);
bool aWait,
bool *pfNeedsSaveSettings);
const Guid *aMachineId,
const Guid *aSnapshotId,
bool fLockMedia,
bool &fMergeForward,
bool &fMergeForward,
const MediaList &aChildrenToReparent,
bool aWait,
bool *pfNeedsSaveSettings);
/** Returns a preferred format for a differencing hard disk. */
/** For com::SupportErrorInfoImpl. */
static const char *ComponentName() { return "Medium"; }
/**
* Performs extra checks if the medium can be closed and returns S_OK in
* this case. Otherwise, returns a respective error message. Called by
* Close() under the medium tree lock and the medium lock.
*/
/**
* Unregisters this medium with mVirtualBox. Called by Close() under
* the medium tree lock.
*/
const char *pszzValid);
struct Data; // opaque data struct, defined in MediumImpl.cpp
Data *m;
};
#endif /* ____H_MEDIUMIMPL */