VirtualBox

source: vbox/trunk/src/VBox/Main/HostDVDDriveImpl.cpp@ 3007

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

Moved the template code out of cdefs.h, partly because it didn't belong there but mostly because it was at the end of the file and would screw up any attempts made by the object cache at avoid recompiling on cdefs.h changes.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.4 KB
Line 
1/** @file
2 *
3 * VirtualBox COM class implementation
4 */
5
6/*
7 * Copyright (C) 2006-2007 innotek 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 "HostDVDDriveImpl.h"
23#include <iprt/cpputils.h>
24
25// constructor / destructor
26/////////////////////////////////////////////////////////////////////////////
27
28DEFINE_EMPTY_CTOR_DTOR (HostDVDDrive)
29
30HRESULT HostDVDDrive::FinalConstruct()
31{
32 return S_OK;
33}
34
35void HostDVDDrive::FinalRelease()
36{
37 uninit();
38}
39
40// public initializer/uninitializer for internal purposes only
41/////////////////////////////////////////////////////////////////////////////
42
43/**
44 * Initializes the host DVD drive object.
45 *
46 * @param aName Name of the drive.
47 * @param aUdi Universal device identifier (currently may be NULL).
48 * @param aDescription Human-readable drive description (may be NULL).
49 *
50 * @return COM result indicator.
51 */
52HRESULT HostDVDDrive::init (INPTR BSTR aName,
53 INPTR BSTR aUdi /* = NULL */,
54 INPTR BSTR aDescription /* = NULL */)
55{
56 ComAssertRet (aName, E_INVALIDARG);
57
58 /* Enclose the state transition NotReady->InInit->Ready */
59 AutoInitSpan autoInitSpan (this);
60 AssertReturn (autoInitSpan.isOk(), E_UNEXPECTED);
61
62 unconst (mName) = aName;
63 unconst (mUdi) = aUdi;
64 unconst (mDescription) = aDescription;
65
66 /* Confirm the successful initialization */
67 autoInitSpan.setSucceeded();
68
69 return S_OK;
70}
71
72/**
73 * Uninitializes the instance and sets the ready flag to FALSE.
74 * Called either from FinalRelease() or by the parent when it gets destroyed.
75 */
76void HostDVDDrive::uninit()
77{
78 /* Enclose the state transition Ready->InUninit->NotReady */
79 AutoUninitSpan autoUninitSpan (this);
80 if (autoUninitSpan.uninitDone())
81 return;
82
83 unconst (mDescription).setNull();
84 unconst (mName).setNull();
85}
86
87// IHostDVDDrive properties
88/////////////////////////////////////////////////////////////////////////////
89
90STDMETHODIMP HostDVDDrive::COMGETTER(Name) (BSTR *aName)
91{
92 if (!aName)
93 return E_POINTER;
94
95 AutoCaller autoCaller (this);
96 CheckComRCReturnRC (autoCaller.rc());
97
98 /* mName is constant during life time, no need to lock */
99
100 mName.cloneTo (aName);
101
102 return S_OK;
103}
104
105STDMETHODIMP HostDVDDrive::COMGETTER(Description) (BSTR *aDescription)
106{
107 if (!aDescription)
108 return E_POINTER;
109
110 AutoCaller autoCaller (this);
111 CheckComRCReturnRC (autoCaller.rc());
112
113 /* mDescription is constant during life time, no need to lock */
114
115 mDescription.cloneTo (aDescription);
116
117 return S_OK;
118}
119
120STDMETHODIMP HostDVDDrive::COMGETTER(Udi) (BSTR *aUdi)
121{
122 if (!aUdi)
123 return E_POINTER;
124
125 AutoCaller autoCaller (this);
126 CheckComRCReturnRC (autoCaller.rc());
127
128 /* mUdi is constant during life time, no need to lock */
129
130 mUdi.cloneTo (aUdi);
131
132 return S_OK;
133}
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