1 | /* $Id: ParallelPortImpl.h 22183 2009-08-11 17:00:33Z 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 |
|
---|
28 | class Machine;
|
---|
29 |
|
---|
30 | namespace settings
|
---|
31 | {
|
---|
32 | struct ParallelPort;
|
---|
33 | }
|
---|
34 |
|
---|
35 | class ATL_NO_VTABLE ParallelPort :
|
---|
36 | public VirtualBoxBase,
|
---|
37 | public VirtualBoxSupportErrorInfoImpl<ParallelPort, IParallelPort>,
|
---|
38 | public VirtualBoxSupportTranslation<ParallelPort>,
|
---|
39 | VBOX_SCRIPTABLE_IMPL(IParallelPort)
|
---|
40 | {
|
---|
41 | public:
|
---|
42 |
|
---|
43 | struct Data
|
---|
44 | {
|
---|
45 | Data()
|
---|
46 | : mSlot (0)
|
---|
47 | , mEnabled (FALSE)
|
---|
48 | , mIRQ (4)
|
---|
49 | , mIOBase (0x378)
|
---|
50 | {}
|
---|
51 |
|
---|
52 | bool operator== (const Data &that) const
|
---|
53 | {
|
---|
54 | return this == &that ||
|
---|
55 | (mSlot == that.mSlot &&
|
---|
56 | mEnabled == that.mEnabled &&
|
---|
57 | mIRQ == that.mIRQ &&
|
---|
58 | mIOBase == that.mIOBase &&
|
---|
59 | mPath == that.mPath);
|
---|
60 | }
|
---|
61 |
|
---|
62 | ULONG mSlot;
|
---|
63 | BOOL mEnabled;
|
---|
64 | ULONG mIRQ;
|
---|
65 | ULONG mIOBase;
|
---|
66 | Bstr mPath;
|
---|
67 | };
|
---|
68 |
|
---|
69 | VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (ParallelPort)
|
---|
70 |
|
---|
71 | DECLARE_NOT_AGGREGATABLE(ParallelPort)
|
---|
72 |
|
---|
73 | DECLARE_PROTECT_FINAL_CONSTRUCT()
|
---|
74 |
|
---|
75 | BEGIN_COM_MAP(ParallelPort)
|
---|
76 | COM_INTERFACE_ENTRY (ISupportErrorInfo)
|
---|
77 | COM_INTERFACE_ENTRY (IParallelPort)
|
---|
78 | COM_INTERFACE_ENTRY2 (IDispatch, IParallelPort)
|
---|
79 | END_COM_MAP()
|
---|
80 |
|
---|
81 | NS_DECL_ISUPPORTS
|
---|
82 |
|
---|
83 | DECLARE_EMPTY_CTOR_DTOR (ParallelPort)
|
---|
84 |
|
---|
85 | HRESULT FinalConstruct();
|
---|
86 | void FinalRelease();
|
---|
87 |
|
---|
88 | // public initializer/uninitializer for internal purposes only
|
---|
89 | HRESULT init (Machine *aParent, ULONG aSlot);
|
---|
90 | HRESULT init (Machine *aParent, ParallelPort *aThat);
|
---|
91 | HRESULT initCopy (Machine *parent, ParallelPort *aThat);
|
---|
92 | void uninit();
|
---|
93 |
|
---|
94 | // IParallelPort properties
|
---|
95 | STDMETHOD(COMGETTER(Slot)) (ULONG *aSlot);
|
---|
96 | STDMETHOD(COMGETTER(Enabled)) (BOOL *aEnabled);
|
---|
97 | STDMETHOD(COMSETTER(Enabled)) (BOOL aEnabled);
|
---|
98 | STDMETHOD(COMGETTER(IRQ)) (ULONG *aIRQ);
|
---|
99 | STDMETHOD(COMSETTER(IRQ)) (ULONG aIRQ);
|
---|
100 | STDMETHOD(COMGETTER(IOBase)) (ULONG *aIOBase);
|
---|
101 | STDMETHOD(COMSETTER(IOBase)) (ULONG aIOBase);
|
---|
102 | STDMETHOD(COMGETTER(Path)) (BSTR *aPath);
|
---|
103 | STDMETHOD(COMSETTER(Path)) (IN_BSTR aPath);
|
---|
104 |
|
---|
105 | // public methods only for internal purposes
|
---|
106 |
|
---|
107 | HRESULT loadSettings(const settings::ParallelPort &data);
|
---|
108 | HRESULT saveSettings(settings::ParallelPort &data);
|
---|
109 |
|
---|
110 | bool isModified() { AutoWriteLock alock (this); return mData.isBackedUp(); }
|
---|
111 | bool isReallyModified() { AutoWriteLock alock (this); return mData.hasActualChanges(); }
|
---|
112 | bool rollback();
|
---|
113 | void commit();
|
---|
114 | void copyFrom (ParallelPort *aThat);
|
---|
115 |
|
---|
116 | // public methods for internal purposes only
|
---|
117 | // (ensure there is a caller and a read lock before calling them!)
|
---|
118 |
|
---|
119 | // for VirtualBoxSupportErrorInfoImpl
|
---|
120 | static const wchar_t *getComponentName() { return L"ParallelPort"; }
|
---|
121 |
|
---|
122 | private:
|
---|
123 |
|
---|
124 | HRESULT checkSetPath (CBSTR aPath);
|
---|
125 |
|
---|
126 | const ComObjPtr<Machine, ComWeakRef> mParent;
|
---|
127 | const ComObjPtr<ParallelPort> mPeer;
|
---|
128 |
|
---|
129 | Backupable <Data> mData;
|
---|
130 | };
|
---|
131 |
|
---|
132 | #endif // ____H_FLOPPYDRIVEIMPL
|
---|
133 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|