VirtualBox

source: vbox/trunk/src/VBox/Main/HostFloppyDriveImpl.cpp@ 2929

Last change on this file since 2929 was 2929, checked in by vboxsync, 17 years ago

Main: Removed devNode from the host DVD drive description (it's up to UI to decide how to visually represent things); switched HostDVDDrive and HostFloppyDrive objects to the new locking scheme.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.5 KB
Line 
1/** @file
2 *
3 * VirtualBox COM class implementation
4 */
5
6/*
7 * Copyright (C) 2006 InnoTek Systemberatung GmbH
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
12 * General Public License as published by the Free Software Foundation,
13 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
14 * distribution. VirtualBox OSE is distributed in the hope that it will
15 * be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * If you received this file as part of a commercial VirtualBox
18 * distribution, then only the terms of your commercial VirtualBox
19 * license agreement apply instead of the previous paragraph.
20 */
21
22#include "HostFloppyDriveImpl.h"
23
24// constructor / destructor
25/////////////////////////////////////////////////////////////////////////////
26
27DEFINE_EMPTY_CTOR_DTOR (HostFloppyDrive)
28
29HRESULT HostFloppyDrive::FinalConstruct()
30{
31 return S_OK;
32}
33
34void HostFloppyDrive::FinalRelease()
35{
36 uninit();
37}
38
39// public initializer/uninitializer for internal purposes only
40/////////////////////////////////////////////////////////////////////////////
41
42/**
43 * Initializes the host floppy drive object.
44 *
45 * @param aName Name of the drive.
46 *
47 * @return COM result indicator.
48 */
49HRESULT HostFloppyDrive::init (INPTR BSTR aName)
50{
51 ComAssertRet (aName, E_INVALIDARG);
52
53 /* Enclose the state transition NotReady->InInit->Ready */
54 AutoInitSpan autoInitSpan (this);
55 AssertReturn (autoInitSpan.isOk(), E_UNEXPECTED);
56
57 unconst (mName) = aName;
58
59 /* Confirm the successful initialization */
60 autoInitSpan.setSucceeded();
61
62 return S_OK;
63}
64
65/**
66 * Uninitializes the instance and sets the ready flag to FALSE.
67 * Called either from FinalRelease() or by the parent when it gets destroyed.
68 */
69void HostFloppyDrive::uninit()
70{
71 /* Enclose the state transition Ready->InUninit->NotReady */
72 AutoUninitSpan autoUninitSpan (this);
73 if (autoUninitSpan.uninitDone())
74 return;
75
76 unconst (mName).setNull();
77}
78
79// IHostFloppyDrive properties
80/////////////////////////////////////////////////////////////////////////////
81
82STDMETHODIMP HostFloppyDrive::COMGETTER(Name) (BSTR *aName)
83{
84 if (!aName)
85 return E_POINTER;
86
87 AutoCaller autoCaller (this);
88 CheckComRCReturnRC (autoCaller.rc());
89
90 /* mName is constant during life time, no need to lock */
91
92 mName.cloneTo (aName);
93
94 return S_OK;
95}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette