MediumImpl.h revision dcea3eadf1ecc8f4ac868185a05a63be42a199e4
/* $Id$ */
/** @file
*
* VirtualBox COM class implementation
*/
/*
* Copyright (C) 2008 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 <list>
#include <algorithm>
////////////////////////////////////////////////////////////////////////////////
/**
* Base component class for all media types.
*
* Provides the basic implementation of the IMedium interface.
*
* @note Subclasses must initialize the mVirtualBox data member in their init()
* implementations with the valid VirtualBox instance because some
* MediaBase methods call its methods.
*/
{
/** Describes how a machine refers to this image. */
struct BackRef
{
/** Equality predicate for stdc++. */
{
{
}
};
BackRef() : inCurState (false) {}
: machineId (aMachineId)
{
if (!aSnapshotId.isEmpty())
}
bool inCurState : 1;
};
// IMedium properties
// IMedium methods
// public methods for internal purposes only
// unsafe inline public methods for internal purposes only (ensure there is
// a caller and a read lock before calling them!)
{
}
/**
* 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() from within this object's AutoMayUninitSpan and from under
* mVirtualBox write lock.
*/
/**
* Performs extra checks if the medium can be attached to the specified
* VM and shapshot at the given time and returns S_OK in this case.
* Otherwise, returns a respective error message. Called by attachTo() from
* within this object's AutoWriteLock.
*/
const Guid &aSnapshotId)
{ return S_OK; }
/**
* Unregisters this medium with mVirtualBox. Called by Close() from within
* this object's AutoMayUninitSpan and from under mVirtualBox write lock.
*/
/** weak VirualBox parent */
struct Data
{
, queryInfoCallers (0), accessibleInLock (false) {}
bool accessibleInLock : 1;
};
Data m;
};
////////////////////////////////////////////////////////////////////////////////
/**
* images or Floppy images.
*
* Adds specific protectedInit() and saveSettings() methods that can load image
* data from the settings files.
*/
{
void FinalRelease() { uninit(); }
// protected initializer/uninitializer for internal purposes only
void protectedUninit();
// public methods for internal purposes only
};
////////////////////////////////////////////////////////////////////////////////
/**
* The DVDImage2 component class implements the IDVDImage2 interface.
*/
{
// public initializer/uninitializer for internal purposes only
{
}
{
}
void uninit() { protectedUninit(); }
/** For com::SupportErrorInfoImpl. */
static const char *ComponentName() { return "DVDImage2"; }
};
////////////////////////////////////////////////////////////////////////////////
/**
* The FloppyImage2 component class implements the IFloppyImage2 interface.
*/
{
// public initializer/uninitializer for internal purposes only
{
}
{
}
void uninit() { protectedUninit(); }
/** For com::SupportErrorInfoImpl. */
static const char *ComponentName() { return "FloppyImage2"; }
};
#endif /* ____H_MEDIUMIMPL */