1 | /* $Id: ParallelPortImpl.h 4324 2007-08-23 19:01:31Z vboxsync $ */
|
---|
2 | /** @file
|
---|
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 |
|
---|
18 | #ifndef ____H_PARALLELPORTIMPL
|
---|
19 | #define ____H_PARALLELPORTIMPL
|
---|
20 |
|
---|
21 | #include "VirtualBoxBase.h"
|
---|
22 |
|
---|
23 | #include <VBox/cfgldr.h>
|
---|
24 |
|
---|
25 | class Machine;
|
---|
26 |
|
---|
27 | class ATL_NO_VTABLE ParallelPort :
|
---|
28 | public VirtualBoxBaseNEXT,
|
---|
29 | public VirtualBoxSupportErrorInfoImpl <ParallelPort, IParallelPort>,
|
---|
30 | public VirtualBoxSupportTranslation <ParallelPort>,
|
---|
31 | public IParallelPort
|
---|
32 | {
|
---|
33 | public:
|
---|
34 |
|
---|
35 | struct Data
|
---|
36 | {
|
---|
37 | Data()
|
---|
38 | : mSlot (0)
|
---|
39 | , mEnabled(FALSE)
|
---|
40 | , mIRQ (4)
|
---|
41 | , mIOBase (0x378)
|
---|
42 | {}
|
---|
43 |
|
---|
44 | bool operator== (const Data &that) const
|
---|
45 | {
|
---|
46 | return this == &that ||
|
---|
47 | (mSlot == that.mSlot &&
|
---|
48 | mEnabled == that.mEnabled &&
|
---|
49 | mIRQ == that.mIRQ &&
|
---|
50 | mIOBase == that.mIOBase &&
|
---|
51 | mPath == that.mPath);
|
---|
52 | }
|
---|
53 |
|
---|
54 | ULONG mSlot;
|
---|
55 | BOOL mEnabled;
|
---|
56 | ULONG mIRQ;
|
---|
57 | ULONG mIOBase;
|
---|
58 | Bstr mPath;
|
---|
59 | };
|
---|
60 |
|
---|
61 | VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (ParallelPort)
|
---|
62 |
|
---|
63 | DECLARE_NOT_AGGREGATABLE(ParallelPort)
|
---|
64 |
|
---|
65 | DECLARE_PROTECT_FINAL_CONSTRUCT()
|
---|
66 |
|
---|
67 | BEGIN_COM_MAP(ParallelPort)
|
---|
68 | COM_INTERFACE_ENTRY(ISupportErrorInfo)
|
---|
69 | COM_INTERFACE_ENTRY(IParallelPort)
|
---|
70 | END_COM_MAP()
|
---|
71 |
|
---|
72 | NS_DECL_ISUPPORTS
|
---|
73 |
|
---|
74 | DECLARE_EMPTY_CTOR_DTOR (ParallelPort)
|
---|
75 |
|
---|
76 | HRESULT FinalConstruct();
|
---|
77 | void FinalRelease();
|
---|
78 |
|
---|
79 | // public initializer/uninitializer for internal purposes only
|
---|
80 | HRESULT init (Machine *aParent, ULONG aSlot);
|
---|
81 | HRESULT init (Machine *aParent, ParallelPort *aThat);
|
---|
82 | HRESULT initCopy (Machine *parent, ParallelPort *aThat);
|
---|
83 | void uninit();
|
---|
84 |
|
---|
85 | // IParallelPort properties
|
---|
86 | STDMETHOD(COMGETTER(Slot)) (ULONG *aSlot);
|
---|
87 | STDMETHOD(COMGETTER(Enabled)) (BOOL *aEnabled);
|
---|
88 | STDMETHOD(COMSETTER(Enabled)) (BOOL aEnabled);
|
---|
89 | STDMETHOD(COMGETTER(IRQ)) (ULONG *aIRQ);
|
---|
90 | STDMETHOD(COMSETTER(IRQ)) (ULONG aIRQ);
|
---|
91 | STDMETHOD(COMGETTER(IOBase)) (ULONG *aIOBase);
|
---|
92 | STDMETHOD(COMSETTER(IOBase)) (ULONG aIOBase);
|
---|
93 | STDMETHOD(COMGETTER(Path)) (BSTR *aPath);
|
---|
94 | STDMETHOD(COMSETTER(Path)) (INPTR BSTR aPath);
|
---|
95 |
|
---|
96 | // public methods only for internal purposes
|
---|
97 | bool isModified() { AutoLock alock (this); return mData.isBackedUp(); }
|
---|
98 | bool isReallyModified() { AutoLock alock (this); return mData.hasActualChanges(); }
|
---|
99 | bool rollback();
|
---|
100 | void commit();
|
---|
101 | void copyFrom (ParallelPort *aThat);
|
---|
102 |
|
---|
103 | // public methods for internal purposes only
|
---|
104 | // (ensure there is a caller and a read lock before calling them!)
|
---|
105 |
|
---|
106 | HRESULT loadSettings (CFGNODE aMachine, ULONG aSlot);
|
---|
107 | HRESULT saveSettings (CFGNODE aMachine);
|
---|
108 |
|
---|
109 | // for VirtualBoxSupportErrorInfoImpl
|
---|
110 | static const wchar_t *getComponentName() { return L"ParallelPort"; }
|
---|
111 |
|
---|
112 | private:
|
---|
113 |
|
---|
114 | const ComObjPtr <Machine, ComWeakRef> mParent;
|
---|
115 | const ComObjPtr <ParallelPort> mPeer;
|
---|
116 |
|
---|
117 | Backupable <Data> mData;
|
---|
118 | };
|
---|
119 |
|
---|
120 | #endif // ____H_FLOPPYDRIVEIMPL
|
---|