VirtualBox

source: vbox/trunk/src/VBox/Main/include/BandwidthControlImpl.h@ 94249

Last change on this file since 94249 was 93115, checked in by vboxsync, 3 years ago

scm --update-copyright-year

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.0 KB
Line 
1/* $Id: BandwidthControlImpl.h 93115 2022-01-01 11:31:46Z vboxsync $ */
2/** @file
3 *
4 * VirtualBox COM class implementation
5 */
6
7/*
8 * Copyright (C) 2006-2022 Oracle Corporation
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
19#ifndef MAIN_INCLUDED_BandwidthControlImpl_h
20#define MAIN_INCLUDED_BandwidthControlImpl_h
21#ifndef RT_WITHOUT_PRAGMA_ONCE
22# pragma once
23#endif
24
25#include "BandwidthControlWrap.h"
26
27class BandwidthGroup;
28
29namespace settings
30{
31 struct IOSettings;
32}
33
34class ATL_NO_VTABLE BandwidthControl :
35 public BandwidthControlWrap
36{
37public:
38
39 DECLARE_COMMON_CLASS_METHODS(BandwidthControl)
40
41 HRESULT FinalConstruct();
42 void FinalRelease();
43
44 // public initializer/uninitializer for internal purposes only
45 HRESULT init(Machine *aParent);
46 HRESULT init(Machine *aParent, BandwidthControl *aThat);
47 HRESULT initCopy(Machine *aParent, BandwidthControl *aThat);
48 void uninit();
49
50 // public internal methods
51 HRESULT i_loadSettings(const settings::IOSettings &data);
52 HRESULT i_saveSettings(settings::IOSettings &data);
53 void i_rollback();
54 void i_commit();
55 void i_copyFrom(BandwidthControl *aThat);
56 Machine *i_getMachine() const;
57 HRESULT i_getBandwidthGroupByName(const Utf8Str &aName,
58 ComObjPtr<BandwidthGroup> &aBandwidthGroup,
59 bool aSetError /* = false */);
60
61private:
62
63 // wrapped IBandwidthControl properties
64 HRESULT getNumGroups(ULONG *aNumGroups);
65
66 // wrapped IBandwidthControl methods
67 HRESULT createBandwidthGroup(const com::Utf8Str &aName,
68 BandwidthGroupType_T aType,
69 LONG64 aMaxBytesPerSec);
70 HRESULT deleteBandwidthGroup(const com::Utf8Str &aName);
71 HRESULT getBandwidthGroup(const com::Utf8Str &aName,
72 ComPtr<IBandwidthGroup> &aBandwidthGroup);
73 HRESULT getAllBandwidthGroups(std::vector<ComPtr<IBandwidthGroup> > &aBandwidthGroups);
74
75 // Data
76 typedef std::list< ComObjPtr<BandwidthGroup> > BandwidthGroupList;
77
78 struct Data
79 {
80 Data(Machine *pMachine)
81 : pParent(pMachine)
82 { }
83
84 ~Data()
85 {};
86
87 Machine * const pParent;
88
89 // peer machine's bandwidth control
90 const ComObjPtr<BandwidthControl> pPeer;
91
92 // the following fields need special backup/rollback/commit handling,
93 // so they cannot be a part of BackupableData
94 Backupable<BandwidthGroupList> llBandwidthGroups;
95 };
96
97 Data *m;
98};
99
100#endif /* !MAIN_INCLUDED_BandwidthControlImpl_h */
101/* 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