4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** @file
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync *
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * VirtualBox COM class implementation
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/*
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * Copyright (C) 2006-2013 Oracle Corporation
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync *
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * available from http://www.virtualbox.org. This file is free software;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * you can redistribute it and/or modify it under the terms of the GNU
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * General Public License (GPL) as published by the Free Software
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#ifndef ____H_BANDWIDTHCONTROLIMPL
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define ____H_BANDWIDTHCONTROLIMPL
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#include "BandwidthControlWrap.h"
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncclass BandwidthGroup;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncnamespace settings
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync{
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync struct IOSettings;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync}
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncclass ATL_NO_VTABLE BandwidthControl :
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync public BandwidthControlWrap
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync{
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncpublic:
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync DECLARE_EMPTY_CTOR_DTOR(BandwidthControl)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync HRESULT FinalConstruct();
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync void FinalRelease();
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync // public initializer/uninitializer for internal purposes only
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync HRESULT init(Machine *aParent);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync HRESULT init(Machine *aParent, BandwidthControl *aThat);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync HRESULT initCopy(Machine *aParent, BandwidthControl *aThat);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync void uninit();
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync // public internal methods
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync HRESULT i_loadSettings(const settings::IOSettings &data);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync HRESULT i_saveSettings(settings::IOSettings &data);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync void i_rollback();
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync void i_commit();
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync void i_copyFrom(BandwidthControl *aThat);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Machine *i_getMachine() const;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync HRESULT i_getBandwidthGroupByName(const Utf8Str &aName,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ComObjPtr<BandwidthGroup> &aBandwidthGroup,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync bool aSetError /* = false */);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
private:
// wrapped IBandwidthControl properties
HRESULT getNumGroups(ULONG *aNumGroups);
// wrapped IBandwidthControl methods
HRESULT createBandwidthGroup(const com::Utf8Str &aName,
BandwidthGroupType_T aType,
LONG64 aMaxBytesPerSec);
HRESULT deleteBandwidthGroup(const com::Utf8Str &aName);
HRESULT getBandwidthGroup(const com::Utf8Str &aName,
ComPtr<IBandwidthGroup> &aBandwidthGroup);
HRESULT getAllBandwidthGroups(std::vector<ComPtr<IBandwidthGroup> > &aBandwidthGroups);
// Data
typedef std::list< ComObjPtr<BandwidthGroup> > BandwidthGroupList;
struct Data
{
Data(Machine *pMachine)
: pParent(pMachine)
{ }
~Data()
{};
Machine * const pParent;
// peer machine's bandwidth control
const ComObjPtr<BandwidthControl> pPeer;
// the following fields need special backup/rollback/commit handling,
// so they cannot be a part of BackupableData
Backupable<BandwidthGroupList> llBandwidthGroups;
};
Data *m;
};
#endif // ____H_BANDWIDTHCONTROLIMPL
/* vi: set tabstop=4 shiftwidth=4 expandtab: */