VirtualBox

source: vbox/trunk/src/VBox/Main/include/SerialPortImpl.h@ 4071

Last change on this file since 4071 was 4071, checked in by vboxsync, 18 years ago

Biggest check-in ever. New source code headers for all (C) innotek files.

File size: 3.5 KB
Line 
1/** @file
2 *
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.215389.xyz. 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_SERIALPORTIMPL
19#define ____H_SERIALPORTIMPL
20
21#include "VirtualBoxBase.h"
22
23#include <VBox/cfgldr.h>
24
25class Machine;
26
27class ATL_NO_VTABLE SerialPort :
28 public VirtualBoxBaseNEXT,
29 public VirtualBoxSupportErrorInfoImpl <SerialPort, ISerialPort>,
30 public VirtualBoxSupportTranslation <SerialPort>,
31 public ISerialPort
32{
33public:
34
35 struct Data
36 {
37 Data()
38 : mSlot (0)
39 , mEnabled(FALSE)
40 , mIRQ (4)
41 , mIOBase (0x3f8)
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 }
52
53 ULONG mSlot;
54 BOOL mEnabled;
55 ULONG mIRQ;
56 ULONG mIOBase;
57 Bstr mPipe;
58 BOOL mServer;
59 };
60
61 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (SerialPort)
62
63 DECLARE_NOT_AGGREGATABLE(SerialPort)
64
65 DECLARE_PROTECT_FINAL_CONSTRUCT()
66
67 BEGIN_COM_MAP(SerialPort)
68 COM_INTERFACE_ENTRY(ISupportErrorInfo)
69 COM_INTERFACE_ENTRY(ISerialPort)
70 END_COM_MAP()
71
72 NS_DECL_ISUPPORTS
73
74 DECLARE_EMPTY_CTOR_DTOR (SerialPort)
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, SerialPort *aThat);
82 HRESULT initCopy (Machine *parent, SerialPort *aThat);
83 void uninit();
84
85 // ISerialPort 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(Pipe)) (BSTR *aPipe);
94 STDMETHOD(COMSETTER(Pipe)) (INPTR BSTR aPipe);
95 STDMETHOD(COMGETTER(Server)) (BOOL *aServer);
96 STDMETHOD(COMSETTER(Server)) (BOOL aServer);
97
98 // public methods only for internal purposes
99 bool isModified() { AutoLock alock (this); return mData.isBackedUp(); }
100 bool isReallyModified() { AutoLock alock (this); return mData.hasActualChanges(); }
101 bool rollback();
102 void commit();
103 void copyFrom (SerialPort *aThat);
104
105 // public methods for internal purposes only
106 // (ensure there is a caller and a read lock before calling them!)
107
108 HRESULT loadSettings (CFGNODE aMachine, ULONG aSlot);
109 HRESULT saveSettings (CFGNODE aMachine);
110
111 // for VirtualBoxSupportErrorInfoImpl
112 static const wchar_t *getComponentName() { return L"SerialPort"; }
113
114private:
115
116 const ComObjPtr <Machine, ComWeakRef> mParent;
117 const ComObjPtr <SerialPort> mPeer;
118
119 Backupable <Data> mData;
120};
121
122#endif // ____H_FLOPPYDRIVEIMPL
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette