VirtualBox

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

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

Parallel port support. Contributed by: Alexander Eichner

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.6 KB
Line 
1/* $Id: ParallelPortImpl.h 3653 2007-07-16 16:03:07Z 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 * 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#ifndef ____H_PARALLELPORTIMPL
23#define ____H_PARALLELPORTIMPL
24
25#include "VirtualBoxBase.h"
26
27#include <VBox/cfgldr.h>
28
29class Machine;
30
31class ATL_NO_VTABLE ParallelPort :
32 public VirtualBoxBaseNEXT,
33 public VirtualBoxSupportErrorInfoImpl <ParallelPort, IParallelPort>,
34 public VirtualBoxSupportTranslation <ParallelPort>,
35 public IParallelPort
36{
37public:
38
39 struct Data
40 {
41 Data()
42 : mSlot (0)
43 , mEnabled(FALSE)
44 , mIRQ (4)
45 , mIOBase (0x378)
46 {}
47
48 bool operator== (const Data &that) const
49 {
50 return this == &that ||
51 (mSlot == that.mSlot &&
52 mEnabled == that.mEnabled &&
53 mIRQ == that.mIRQ &&
54 mIOBase == that.mIOBase);
55 }
56
57 ULONG mSlot;
58 BOOL mEnabled;
59 ULONG mIRQ;
60 ULONG mIOBase;
61 Bstr mDevicePath;
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(DevicePath)) (BSTR *aDevicePath);
97 STDMETHOD(COMSETTER(DevicePath)) (INPTR BSTR aDevicePath);
98
99 // public methods only for internal purposes
100 bool isModified() { AutoLock alock (this); return mData.isBackedUp(); }
101 bool isReallyModified() { AutoLock alock (this); return mData.hasActualChanges(); }
102 bool rollback();
103 void commit();
104 void copyFrom (ParallelPort *aThat);
105
106 // public methods for internal purposes only
107 // (ensure there is a caller and a read lock before calling them!)
108
109 HRESULT loadSettings (CFGNODE aMachine, ULONG aSlot);
110 HRESULT saveSettings (CFGNODE aMachine);
111
112 // for VirtualBoxSupportErrorInfoImpl
113 static const wchar_t *getComponentName() { return L"ParallelPort"; }
114
115private:
116
117 const ComObjPtr <Machine, ComWeakRef> mParent;
118 const ComObjPtr <ParallelPort> mPeer;
119
120 Backupable <Data> mData;
121};
122
123#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