[1] | 1 | /** @file
|
---|
| 2 | *
|
---|
| 3 | * VirtualBox COM class implementation
|
---|
| 4 | */
|
---|
| 5 |
|
---|
| 6 | /*
|
---|
[8155] | 7 | * Copyright (C) 2006-2007 Sun Microsystems, Inc.
|
---|
[1] | 8 | *
|
---|
| 9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
| 10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
| 11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
[5999] | 12 | * General Public License (GPL) as published by the Free Software
|
---|
| 13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
| 14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
| 15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
[8155] | 16 | *
|
---|
| 17 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
| 18 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
| 19 | * additional information or have any questions.
|
---|
[1] | 20 | */
|
---|
| 21 |
|
---|
| 22 | #include "HostFloppyDriveImpl.h"
|
---|
[3007] | 23 | #include <iprt/cpputils.h>
|
---|
[1] | 24 |
|
---|
| 25 | // constructor / destructor
|
---|
| 26 | /////////////////////////////////////////////////////////////////////////////
|
---|
| 27 |
|
---|
[2929] | 28 | DEFINE_EMPTY_CTOR_DTOR (HostFloppyDrive)
|
---|
| 29 |
|
---|
| 30 | HRESULT HostFloppyDrive::FinalConstruct()
|
---|
[1] | 31 | {
|
---|
[2929] | 32 | return S_OK;
|
---|
[1] | 33 | }
|
---|
| 34 |
|
---|
[2929] | 35 | void HostFloppyDrive::FinalRelease()
|
---|
[1] | 36 | {
|
---|
[2929] | 37 | uninit();
|
---|
[1] | 38 | }
|
---|
| 39 |
|
---|
| 40 | // public initializer/uninitializer for internal purposes only
|
---|
| 41 | /////////////////////////////////////////////////////////////////////////////
|
---|
| 42 |
|
---|
| 43 | /**
|
---|
| 44 | * Initializes the host floppy drive object.
|
---|
| 45 | *
|
---|
[2929] | 46 | * @param aName Name of the drive.
|
---|
[2961] | 47 | * @param aUdi Universal device identifier (currently may be NULL).
|
---|
[2957] | 48 | * @param aDescription Human-readable drive description (may be NULL).
|
---|
[2929] | 49 | *
|
---|
| 50 | * @return COM result indicator.
|
---|
[1] | 51 | */
|
---|
[15051] | 52 | HRESULT HostFloppyDrive::init (IN_BSTR aName,
|
---|
| 53 | IN_BSTR aUdi /* = NULL */,
|
---|
| 54 | IN_BSTR aDescription /* = NULL */)
|
---|
[1] | 55 | {
|
---|
[2929] | 56 | ComAssertRet (aName, E_INVALIDARG);
|
---|
[1] | 57 |
|
---|
[2929] | 58 | /* Enclose the state transition NotReady->InInit->Ready */
|
---|
| 59 | AutoInitSpan autoInitSpan (this);
|
---|
[14579] | 60 | AssertReturn (autoInitSpan.isOk(), E_FAIL);
|
---|
[2929] | 61 |
|
---|
| 62 | unconst (mName) = aName;
|
---|
[2957] | 63 | unconst (mUdi) = aUdi;
|
---|
| 64 | unconst (mDescription) = aDescription;
|
---|
[2929] | 65 |
|
---|
| 66 | /* Confirm the successful initialization */
|
---|
| 67 | autoInitSpan.setSucceeded();
|
---|
| 68 |
|
---|
[1] | 69 | return S_OK;
|
---|
| 70 | }
|
---|
| 71 |
|
---|
[2957] | 72 |
|
---|
[2929] | 73 | /**
|
---|
| 74 | * Uninitializes the instance and sets the ready flag to FALSE.
|
---|
| 75 | * Called either from FinalRelease() or by the parent when it gets destroyed.
|
---|
| 76 | */
|
---|
| 77 | void HostFloppyDrive::uninit()
|
---|
| 78 | {
|
---|
| 79 | /* Enclose the state transition Ready->InUninit->NotReady */
|
---|
| 80 | AutoUninitSpan autoUninitSpan (this);
|
---|
| 81 | if (autoUninitSpan.uninitDone())
|
---|
| 82 | return;
|
---|
| 83 |
|
---|
| 84 | unconst (mName).setNull();
|
---|
| 85 | }
|
---|
| 86 |
|
---|
[1] | 87 | // IHostFloppyDrive properties
|
---|
| 88 | /////////////////////////////////////////////////////////////////////////////
|
---|
| 89 |
|
---|
[2929] | 90 | STDMETHODIMP HostFloppyDrive::COMGETTER(Name) (BSTR *aName)
|
---|
[1] | 91 | {
|
---|
[14972] | 92 | CheckComArgOutPointerValid(aName);
|
---|
[2929] | 93 |
|
---|
| 94 | AutoCaller autoCaller (this);
|
---|
| 95 | CheckComRCReturnRC (autoCaller.rc());
|
---|
| 96 |
|
---|
| 97 | /* mName is constant during life time, no need to lock */
|
---|
| 98 |
|
---|
| 99 | mName.cloneTo (aName);
|
---|
| 100 |
|
---|
[1] | 101 | return S_OK;
|
---|
| 102 | }
|
---|
[2957] | 103 |
|
---|
| 104 | STDMETHODIMP HostFloppyDrive::COMGETTER(Description) (BSTR *aDescription)
|
---|
| 105 | {
|
---|
[14972] | 106 | CheckComArgOutPointerValid(aDescription);
|
---|
[2957] | 107 |
|
---|
| 108 | AutoCaller autoCaller (this);
|
---|
| 109 | CheckComRCReturnRC (autoCaller.rc());
|
---|
| 110 |
|
---|
| 111 | /* mDescription is constant during life time, no need to lock */
|
---|
| 112 |
|
---|
| 113 | mDescription.cloneTo (aDescription);
|
---|
| 114 |
|
---|
| 115 | return S_OK;
|
---|
| 116 | }
|
---|
| 117 |
|
---|
| 118 | STDMETHODIMP HostFloppyDrive::COMGETTER(Udi) (BSTR *aUdi)
|
---|
| 119 | {
|
---|
[14972] | 120 | CheckComArgOutPointerValid(aUdi);
|
---|
[2957] | 121 |
|
---|
| 122 | AutoCaller autoCaller (this);
|
---|
| 123 | CheckComRCReturnRC (autoCaller.rc());
|
---|
| 124 |
|
---|
[2961] | 125 | /* mUdi is constant during life time, no need to lock */
|
---|
[2957] | 126 |
|
---|
| 127 | mUdi.cloneTo (aUdi);
|
---|
| 128 |
|
---|
| 129 | return S_OK;
|
---|
| 130 | }
|
---|
[14772] | 131 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|