HardDiskAttachmentImpl.h revision c7ede00506e75acd368eeba9f264f2e09297fd21
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync * VirtualBox COM class implementation
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync * Copyright (C) 2006-2007 Sun Microsystems, Inc.
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync * available from http://www.virtualbox.org. This file is free software;
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync * you can redistribute it and/or modify it under the terms of the GNU
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync * General Public License (GPL) as published by the Free Software
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync * additional information or have any questions.
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync public com::SupportErrorInfoImpl<HardDiskAttachment, IHardDiskAttachment>,
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync public VirtualBoxSupportTranslation<HardDiskAttachment>,
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync /** Equality predicate for stdc++. */
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync : public std::unary_function <ComObjPtr<HardDiskAttachment>, bool>
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync explicit EqualsTo (StorageBus_T aBus, LONG aChannel, LONG aDevice)
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync : bus (aBus), channel (aChannel), device (aDevice) {}
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync return aThat->bus() == bus && aThat->channel() == channel &&
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync /** Hard disk reference predicate for stdc++. */
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync : public std::unary_function< ComObjPtr<HardDiskAttachment>, bool>
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync explicit RefersTo (HardDisk *aHardDisk) : hardDisk (aHardDisk) {}
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync // public initializer/uninitializer for internal purposes only
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync HRESULT init(HardDisk *aHD, StorageBus_T aBus, LONG aChannel,
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync // IHardDiskAttachment properties
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync STDMETHOD(COMGETTER(HardDisk)) (IHardDisk **aHardDisk);
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync // unsafe inline public methods for internal purposes only (ensure there is
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync // a caller and a read lock before calling them!)
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync void setImplicit (bool aImplicit) { m.implicit = aImplicit; }
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync const ComObjPtr<HardDisk> &hardDisk() const { return m.hardDisk; }
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync /** Must be called from under this object's write lock. */
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync void updateHardDisk (const ComObjPtr<HardDisk> &aHardDisk, bool aImplicit)
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync /** For com::SupportErrorInfoImpl. */
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync static const char *ComponentName() { return "HardDiskAttachment"; }
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync Data() : bus (StorageBus_Null), channel (0), device (0)
d90eec53c9dcaa0f3d1054e8734ed46875b9093avboxsync , implicit (false) {}
d90eec53c9dcaa0f3d1054e8734ed46875b9093avboxsync /// @todo NEWMEDIA shouldn't it be constant too? It'd be nice to get
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync /// rid of locks at all in this simple readonly structure-like interface
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync#endif // ____H_HARDDISKATTACHMENTIMPL
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync/* vi: set tabstop=4 shiftwidth=4 expandtab: */