VirtualBox

source: vbox/trunk/src/VBox/Main/include/ParallelPortImpl.h@ 8971

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

The Big Sun Rebranding Header Change

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.7 KB
Line 
1/* $Id: ParallelPortImpl.h 8155 2008-04-18 15:16:47Z vboxsync $ */
2
3/** @file
4 * VirtualBox COM class implementation.
5 */
6
7/*
8 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
9 *
10 * This file is part of VirtualBox Open Source Edition (OSE), as
11 * available from http://www.virtualbox.org. This file is free software;
12 * you can redistribute it and/or modify it under the terms of the GNU
13 * General Public License (GPL) as published by the Free Software
14 * Foundation, in version 2 as it comes in the "COPYING" file of the
15 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
16 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
17 *
18 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
19 * Clara, CA 95054 USA or visit http://www.sun.com if you need
20 * additional information or have any questions.
21 */
22
23#ifndef ____H_PARALLELPORTIMPL
24#define ____H_PARALLELPORTIMPL
25
26#include "VirtualBoxBase.h"
27
28class Machine;
29
30class ATL_NO_VTABLE ParallelPort :
31 public VirtualBoxBaseNEXT,
32 public VirtualBoxSupportErrorInfoImpl <ParallelPort, IParallelPort>,
33 public VirtualBoxSupportTranslation <ParallelPort>,
34 public IParallelPort
35{
36public:
37
38 struct Data
39 {
40 Data()
41 : mSlot (0)
42 , mEnabled (FALSE)
43 , mIRQ (4)
44 , mIOBase (0x378)
45 {}
46
47 bool operator== (const Data &that) const
48 {
49 return this == &that ||
50 (mSlot == that.mSlot &&
51 mEnabled == that.mEnabled &&
52 mIRQ == that.mIRQ &&
53 mIOBase == that.mIOBase &&
54 mPath == that.mPath);
55 }
56
57 ULONG mSlot;
58 BOOL mEnabled;
59 ULONG mIRQ;
60 ULONG mIOBase;
61 Bstr mPath;
62 };
63
64 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (ParallelPort)
65
66 DECLARE_NOT_AGGREGATABLE(ParallelPort)
67
68 DECLARE_PROTECT_FINAL_CONSTRUCT()
69
70 BEGIN_COM_MAP(ParallelPort)
71 COM_INTERFACE_ENTRY(ISupportErrorInfo)
72 COM_INTERFACE_ENTRY(IParallelPort)
73 END_COM_MAP()
74
75 NS_DECL_ISUPPORTS
76
77 DECLARE_EMPTY_CTOR_DTOR (ParallelPort)
78
79 HRESULT FinalConstruct();
80 void FinalRelease();
81
82 // public initializer/uninitializer for internal purposes only
83 HRESULT init (Machine *aParent, ULONG aSlot);
84 HRESULT init (Machine *aParent, ParallelPort *aThat);
85 HRESULT initCopy (Machine *parent, ParallelPort *aThat);
86 void uninit();
87
88 // IParallelPort properties
89 STDMETHOD(COMGETTER(Slot)) (ULONG *aSlot);
90 STDMETHOD(COMGETTER(Enabled)) (BOOL *aEnabled);
91 STDMETHOD(COMSETTER(Enabled)) (BOOL aEnabled);
92 STDMETHOD(COMGETTER(IRQ)) (ULONG *aIRQ);
93 STDMETHOD(COMSETTER(IRQ)) (ULONG aIRQ);
94 STDMETHOD(COMGETTER(IOBase)) (ULONG *aIOBase);
95 STDMETHOD(COMSETTER(IOBase)) (ULONG aIOBase);
96 STDMETHOD(COMGETTER(Path)) (BSTR *aPath);
97 STDMETHOD(COMSETTER(Path)) (INPTR BSTR aPath);
98
99 // public methods only for internal purposes
100
101 HRESULT loadSettings (const settings::Key &aPortNode);
102 HRESULT saveSettings (settings::Key &aPortNode);
103
104 bool isModified() { AutoWriteLock alock (this); return mData.isBackedUp(); }
105 bool isReallyModified() { AutoWriteLock alock (this); return mData.hasActualChanges(); }
106 bool rollback();
107 void commit();
108 void copyFrom (ParallelPort *aThat);
109
110 // public methods for internal purposes only
111 // (ensure there is a caller and a read lock before calling them!)
112
113 // for VirtualBoxSupportErrorInfoImpl
114 static const wchar_t *getComponentName() { return L"ParallelPort"; }
115
116private:
117
118 HRESULT checkSetPath (const BSTR aPath);
119
120 const ComObjPtr <Machine, ComWeakRef> mParent;
121 const ComObjPtr <ParallelPort> mPeer;
122
123 Backupable <Data> mData;
124};
125
126#endif // ____H_FLOPPYDRIVEIMPL
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