VirtualBox

source: vbox/trunk/src/VBox/Main/include/BandwidthGroupImpl.h@ 94579

Last change on this file since 94579 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.1 KB
Line 
1/* $Id: BandwidthGroupImpl.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_BandwidthGroupImpl_h
20#define MAIN_INCLUDED_BandwidthGroupImpl_h
21#ifndef RT_WITHOUT_PRAGMA_ONCE
22# pragma once
23#endif
24
25#include <VBox/settings.h>
26#include "BandwidthControlImpl.h"
27#include "BandwidthGroupWrap.h"
28
29
30class ATL_NO_VTABLE BandwidthGroup :
31 public BandwidthGroupWrap
32{
33public:
34
35 DECLARE_COMMON_CLASS_METHODS(BandwidthGroup)
36
37 HRESULT FinalConstruct();
38 void FinalRelease();
39
40 // public initializer/uninitializer for internal purposes only
41 HRESULT init(BandwidthControl *aParent,
42 const com::Utf8Str &aName,
43 BandwidthGroupType_T aType,
44 LONG64 aMaxBytesPerSec);
45 HRESULT init(BandwidthControl *aParent, BandwidthGroup *aThat, bool aReshare = false);
46 HRESULT initCopy(BandwidthControl *aParent, BandwidthGroup *aThat);
47 void uninit();
48
49 // public methods only for internal purposes
50 void i_rollback();
51 void i_commit();
52 void i_unshare();
53 void i_reference();
54 void i_release();
55
56 ComObjPtr<BandwidthGroup> i_getPeer() { return m->pPeer; }
57 const Utf8Str &i_getName() const { return m->bd->mData.strName; }
58 BandwidthGroupType_T i_getType() const { return m->bd->mData.enmType; }
59 LONG64 i_getMaxBytesPerSec() const { return (LONG64)m->bd->mData.cMaxBytesPerSec; }
60 ULONG i_getReferences() const { return m->bd->cReferences; }
61
62private:
63
64 // wrapped IBandwidthGroup properties
65 HRESULT getName(com::Utf8Str &aName);
66 HRESULT getType(BandwidthGroupType_T *aType);
67 HRESULT getReference(ULONG *aReferences);
68 HRESULT getMaxBytesPerSec(LONG64 *aMaxBytesPerSec);
69 HRESULT setMaxBytesPerSec(LONG64 MaxBytesPerSec);
70
71 ////////////////////////////////////////////////////////////////////////////////
72 ////
73 //// private member data definition
74 ////
75 //////////////////////////////////////////////////////////////////////////////////
76 //
77 struct BackupableBandwidthGroupData
78 {
79 BackupableBandwidthGroupData()
80 : cReferences(0)
81 { }
82
83 settings::BandwidthGroup mData;
84 ULONG cReferences;
85 };
86
87 struct Data
88 {
89 Data(BandwidthControl * const aBandwidthControl)
90 : pParent(aBandwidthControl),
91 pPeer(NULL)
92 { }
93
94 BandwidthControl * const pParent;
95 ComObjPtr<BandwidthGroup> pPeer;
96
97 // use the XML settings structure in the members for simplicity
98 Backupable<BackupableBandwidthGroupData> bd;
99 };
100
101 Data *m;
102};
103
104#endif /* !MAIN_INCLUDED_BandwidthGroupImpl_h */
105/* 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