VirtualBox

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

Last change on this file since 21878 was 21878, checked in by vboxsync, 15 years ago

Main: coding style: have Main obey the standard VirtualBox coding style rules (no functional changes)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.8 KB
Line 
1/* $Id: ParallelPortImpl.h 21878 2009-07-30 12:42:08Z 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 VirtualBoxBase,
32 public VirtualBoxSupportErrorInfoImpl<ParallelPort, IParallelPort>,
33 public VirtualBoxSupportTranslation<ParallelPort>,
34 VBOX_SCRIPTABLE_IMPL(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 COM_INTERFACE_ENTRY2 (IDispatch, IParallelPort)
74 END_COM_MAP()
75
76 NS_DECL_ISUPPORTS
77
78 DECLARE_EMPTY_CTOR_DTOR (ParallelPort)
79
80 HRESULT FinalConstruct();
81 void FinalRelease();
82
83 // public initializer/uninitializer for internal purposes only
84 HRESULT init (Machine *aParent, ULONG aSlot);
85 HRESULT init (Machine *aParent, ParallelPort *aThat);
86 HRESULT initCopy (Machine *parent, ParallelPort *aThat);
87 void uninit();
88
89 // IParallelPort properties
90 STDMETHOD(COMGETTER(Slot)) (ULONG *aSlot);
91 STDMETHOD(COMGETTER(Enabled)) (BOOL *aEnabled);
92 STDMETHOD(COMSETTER(Enabled)) (BOOL aEnabled);
93 STDMETHOD(COMGETTER(IRQ)) (ULONG *aIRQ);
94 STDMETHOD(COMSETTER(IRQ)) (ULONG aIRQ);
95 STDMETHOD(COMGETTER(IOBase)) (ULONG *aIOBase);
96 STDMETHOD(COMSETTER(IOBase)) (ULONG aIOBase);
97 STDMETHOD(COMGETTER(Path)) (BSTR *aPath);
98 STDMETHOD(COMSETTER(Path)) (IN_BSTR aPath);
99
100 // public methods only for internal purposes
101
102 HRESULT loadSettings (const settings::Key &aPortNode);
103 HRESULT saveSettings (settings::Key &aPortNode);
104
105 bool isModified() { AutoWriteLock alock (this); return mData.isBackedUp(); }
106 bool isReallyModified() { AutoWriteLock alock (this); return mData.hasActualChanges(); }
107 bool rollback();
108 void commit();
109 void copyFrom (ParallelPort *aThat);
110
111 // public methods for internal purposes only
112 // (ensure there is a caller and a read lock before calling them!)
113
114 // for VirtualBoxSupportErrorInfoImpl
115 static const wchar_t *getComponentName() { return L"ParallelPort"; }
116
117private:
118
119 HRESULT checkSetPath (CBSTR aPath);
120
121 const ComObjPtr<Machine, ComWeakRef> mParent;
122 const ComObjPtr<ParallelPort> mPeer;
123
124 Backupable <Data> mData;
125};
126
127#endif // ____H_FLOPPYDRIVEIMPL
128/* vi: set tabstop=4 shiftwidth=4 expandtab: */
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