63b785c3291332a86a9bc473e68f08121368898bvboxsync/** @file
63b785c3291332a86a9bc473e68f08121368898bvboxsync *
63b785c3291332a86a9bc473e68f08121368898bvboxsync * VirtualBox COM class implementation
63b785c3291332a86a9bc473e68f08121368898bvboxsync */
63b785c3291332a86a9bc473e68f08121368898bvboxsync
63b785c3291332a86a9bc473e68f08121368898bvboxsync/*
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync * Copyright (C) 2006-2013 Oracle Corporation
63b785c3291332a86a9bc473e68f08121368898bvboxsync *
63b785c3291332a86a9bc473e68f08121368898bvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
63b785c3291332a86a9bc473e68f08121368898bvboxsync * available from http://www.virtualbox.org. This file is free software;
63b785c3291332a86a9bc473e68f08121368898bvboxsync * you can redistribute it and/or modify it under the terms of the GNU
63b785c3291332a86a9bc473e68f08121368898bvboxsync * General Public License (GPL) as published by the Free Software
63b785c3291332a86a9bc473e68f08121368898bvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
63b785c3291332a86a9bc473e68f08121368898bvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
63b785c3291332a86a9bc473e68f08121368898bvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
63b785c3291332a86a9bc473e68f08121368898bvboxsync */
63b785c3291332a86a9bc473e68f08121368898bvboxsync
63b785c3291332a86a9bc473e68f08121368898bvboxsync#ifndef ____H_BANDWIDTHGROUPIMPL
63b785c3291332a86a9bc473e68f08121368898bvboxsync#define ____H_BANDWIDTHGROUPIMPL
63b785c3291332a86a9bc473e68f08121368898bvboxsync
63b785c3291332a86a9bc473e68f08121368898bvboxsync#include "BandwidthControlImpl.h"
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync#include "BandwidthGroupWrap.h"
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync
63b785c3291332a86a9bc473e68f08121368898bvboxsync
63b785c3291332a86a9bc473e68f08121368898bvboxsyncclass ATL_NO_VTABLE BandwidthGroup :
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync public BandwidthGroupWrap
63b785c3291332a86a9bc473e68f08121368898bvboxsync{
63b785c3291332a86a9bc473e68f08121368898bvboxsyncpublic:
63b785c3291332a86a9bc473e68f08121368898bvboxsync
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync DECLARE_EMPTY_CTOR_DTOR(BandwidthGroup)
63b785c3291332a86a9bc473e68f08121368898bvboxsync
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync HRESULT FinalConstruct();
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync void FinalRelease();
63b785c3291332a86a9bc473e68f08121368898bvboxsync
63b785c3291332a86a9bc473e68f08121368898bvboxsync // public initializer/uninitializer for internal purposes only
63b785c3291332a86a9bc473e68f08121368898bvboxsync HRESULT init(BandwidthControl *aParent,
63b785c3291332a86a9bc473e68f08121368898bvboxsync const Utf8Str &aName,
63b785c3291332a86a9bc473e68f08121368898bvboxsync BandwidthGroupType_T aType,
af7209255033c3b77816f81ef6293ff8070ee156vboxsync LONG64 aMaxBytesPerSec);
63b785c3291332a86a9bc473e68f08121368898bvboxsync HRESULT init(BandwidthControl *aParent, BandwidthGroup *aThat, bool aReshare = false);
63b785c3291332a86a9bc473e68f08121368898bvboxsync HRESULT initCopy(BandwidthControl *aParent, BandwidthGroup *aThat);
63b785c3291332a86a9bc473e68f08121368898bvboxsync void uninit();
63b785c3291332a86a9bc473e68f08121368898bvboxsync
63b785c3291332a86a9bc473e68f08121368898bvboxsync // public methods only for internal purposes
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync void i_rollback();
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync void i_commit();
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync void i_unshare();
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync void i_reference();
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync void i_release();
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync ComObjPtr<BandwidthGroup> i_getPeer() { return m->pPeer; }
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync const Utf8Str &i_getName() const { return m->bd->strName; }
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync BandwidthGroupType_T i_getType() const { return m->bd->enmType; }
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync LONG64 i_getMaxBytesPerSec() const { return m->bd->aMaxBytesPerSec; }
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync ULONG i_getReferences() const { return m->bd->cReferences; }
63b785c3291332a86a9bc473e68f08121368898bvboxsync
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsyncprivate:
63b785c3291332a86a9bc473e68f08121368898bvboxsync
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync // wrapped IBandwidthGroup properties
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync HRESULT getName(com::Utf8Str &aName);
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync HRESULT getType(BandwidthGroupType_T *aType);
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync HRESULT getReference(ULONG *aReferences);
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync HRESULT getMaxBytesPerSec(LONG64 *aMaxBytesPerSec);
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync HRESULT setMaxBytesPerSec(LONG64 MaxBytesPerSec);
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync ////////////////////////////////////////////////////////////////////////////////
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync ////
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync //// private member data definition
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync ////
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync //////////////////////////////////////////////////////////////////////////////////
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync //
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync struct BackupableBandwidthGroupData
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync {
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync BackupableBandwidthGroupData()
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync : enmType(BandwidthGroupType_Null),
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync aMaxBytesPerSec(0),
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync cReferences(0)
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync { }
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync Utf8Str strName;
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync BandwidthGroupType_T enmType;
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync LONG64 aMaxBytesPerSec;
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync ULONG cReferences;
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync };
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync struct Data
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync {
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync Data(BandwidthControl * const aBandwidthControl)
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync : pParent(aBandwidthControl),
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync pPeer(NULL)
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync { }
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync BandwidthControl * const pParent;
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync ComObjPtr<BandwidthGroup> pPeer;
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync // use the XML settings structure in the members for simplicity
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync Backupable<BackupableBandwidthGroupData> bd;
7b01db654c23d4e432465aebc1a1853e8d6b3194vboxsync };
63b785c3291332a86a9bc473e68f08121368898bvboxsync
63b785c3291332a86a9bc473e68f08121368898bvboxsync Data *m;
63b785c3291332a86a9bc473e68f08121368898bvboxsync};
63b785c3291332a86a9bc473e68f08121368898bvboxsync
63b785c3291332a86a9bc473e68f08121368898bvboxsync#endif // ____H_BANDWIDTHGROUPIMPL
63b785c3291332a86a9bc473e68f08121368898bvboxsync/* vi: set tabstop=4 shiftwidth=4 expandtab: */