1 | /** @file
|
---|
2 | *
|
---|
3 | * VirtualBox COM class implementation
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2009 Oracle Corporation
|
---|
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 (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #ifndef ____H_BANDWIDTHCONTROLIMPL
|
---|
19 | #define ____H_BANDWIDTHCONTROLIMPL
|
---|
20 |
|
---|
21 | #include "VirtualBoxBase.h"
|
---|
22 |
|
---|
23 | class BandwidthGroup;
|
---|
24 |
|
---|
25 | namespace settings
|
---|
26 | {
|
---|
27 | struct IoSettings;
|
---|
28 | }
|
---|
29 |
|
---|
30 | class ATL_NO_VTABLE BandwidthControl :
|
---|
31 | public VirtualBoxBase,
|
---|
32 | VBOX_SCRIPTABLE_IMPL(IBandwidthControl)
|
---|
33 | {
|
---|
34 | public:
|
---|
35 | VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(BandwidthControl, IBandwidthControl)
|
---|
36 |
|
---|
37 | DECLARE_NOT_AGGREGATABLE(BandwidthControl)
|
---|
38 |
|
---|
39 | DECLARE_PROTECT_FINAL_CONSTRUCT()
|
---|
40 |
|
---|
41 | BEGIN_COM_MAP(BandwidthControl)
|
---|
42 | VBOX_DEFAULT_INTERFACE_ENTRIES(IBandwidthControl)
|
---|
43 | END_COM_MAP()
|
---|
44 |
|
---|
45 | BandwidthControl() { };
|
---|
46 | ~BandwidthControl() { };
|
---|
47 |
|
---|
48 | // public initializer/uninitializer for internal purposes only
|
---|
49 | HRESULT init(Machine *aParent);
|
---|
50 | HRESULT init(Machine *aParent, BandwidthControl *aThat);
|
---|
51 | HRESULT initCopy(Machine *aParent, BandwidthControl *aThat);
|
---|
52 | void uninit();
|
---|
53 |
|
---|
54 | STDMETHOD(CreateBandwidthGroup) (IN_BSTR aName, BandwidthGroupType_T aType, ULONG aMaxMbPerSec);
|
---|
55 | STDMETHOD(DeleteBandwidthGroup) (IN_BSTR aName);
|
---|
56 | STDMETHOD(COMGETTER(NumGroups)) (ULONG *aGroups);
|
---|
57 | STDMETHOD(GetBandwidthGroup) (IN_BSTR aName, IBandwidthGroup **aBandwidthGroup);
|
---|
58 | STDMETHOD(GetAllBandwidthGroups) (ComSafeArrayOut(IBandwidthGroup *, aBandwidthGroups));
|
---|
59 |
|
---|
60 | HRESULT FinalConstruct();
|
---|
61 | void FinalRelease();
|
---|
62 |
|
---|
63 | // public internal methods
|
---|
64 |
|
---|
65 | HRESULT loadSettings(const settings::IoSettings &data);
|
---|
66 | HRESULT saveSettings(settings::IoSettings &data);
|
---|
67 |
|
---|
68 | void rollback();
|
---|
69 | void commit();
|
---|
70 | void copyFrom (BandwidthControl *aThat);
|
---|
71 |
|
---|
72 | Machine *getMachine() const;
|
---|
73 |
|
---|
74 | HRESULT getBandwidthGroupByName(const Utf8Str &aName,
|
---|
75 | ComObjPtr<BandwidthGroup> &aBandwidthGroup,
|
---|
76 | bool aSetError /* = false */);
|
---|
77 |
|
---|
78 | private:
|
---|
79 | struct Data;
|
---|
80 | Data *m;
|
---|
81 | };
|
---|
82 |
|
---|
83 | #endif // ____H_BANDWIDTHCONTROLIMPL
|
---|
84 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|