VirtualBox

Changeset 34402 in vbox


Ignore:
Timestamp:
Nov 26, 2010 4:38:07 PM (14 years ago)
Author:
vboxsync
Message:

whitespace

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/EventImpl.h

    r33963 r34402  
    2020
    2121#include "VirtualBoxBase.h"
    22 #include <iprt/asm.h>
     22
    2323
    2424class ATL_NO_VTABLE VBoxEvent :
     
    4646
    4747    // public initializer/uninitializer for internal purposes only
    48     HRESULT init (IEventSource *aSource, VBoxEventType_T aType, BOOL aWaitable);
     48    HRESULT init(IEventSource *aSource, VBoxEventType_T aType, BOOL aWaitable);
    4949    void uninit();
    5050
    5151    // IEvent properties
    52     STDMETHOD(COMGETTER(Type)) (VBoxEventType_T *aType);
    53     STDMETHOD(COMGETTER(Source)) (IEventSource * *aSource);
    54     STDMETHOD(COMGETTER(Waitable)) (BOOL *aWaitable);
     52    STDMETHOD(COMGETTER(Type))(VBoxEventType_T *aType);
     53    STDMETHOD(COMGETTER(Source))(IEventSource * *aSource);
     54    STDMETHOD(COMGETTER(Waitable))(BOOL *aWaitable);
    5555
    5656    // IEvent methods
     
    8989
    9090    // public initializer/uninitializer for internal purposes only
    91     HRESULT init (IEventSource *aSource, VBoxEventType_T aType);
     91    HRESULT init(IEventSource *aSource, VBoxEventType_T aType);
    9292    void uninit();
    9393
    9494    // IEvent properties
    95     STDMETHOD(COMGETTER(Type)) (VBoxEventType_T *aType)
     95    STDMETHOD(COMGETTER(Type))(VBoxEventType_T *aType)
    9696    {
    9797        return VBoxEvent::COMGETTER(Type)(aType);
    9898    }
    99     STDMETHOD(COMGETTER(Source)) (IEventSource * *aSource)
     99    STDMETHOD(COMGETTER(Source))(IEventSource * *aSource)
    100100    {
    101101        return VBoxEvent::COMGETTER(Source)(aSource);
    102102    }
    103     STDMETHOD(COMGETTER(Waitable)) (BOOL *aWaitable)
     103    STDMETHOD(COMGETTER(Waitable))(BOOL *aWaitable)
    104104    {
    105105        return VBoxEvent::COMGETTER(Waitable)(aWaitable);
     
    145145    END_COM_MAP()
    146146
    147     DECLARE_EMPTY_CTOR_DTOR (EventSource)
     147    DECLARE_EMPTY_CTOR_DTOR(EventSource)
    148148
    149149    HRESULT FinalConstruct();
     
    151151
    152152    // public initializer/uninitializer for internal purposes only
    153     HRESULT init (IUnknown * aParent);
     153    HRESULT init(IUnknown *aParent);
    154154    void uninit();
    155155
    156156    // IEventSource methods
    157     STDMETHOD(CreateListener)(IEventListener ** aListener);
    158     STDMETHOD(CreateAggregator)(ComSafeArrayIn(IEventSource*, aSubordinates),
    159                                 IEventSource **               aAggregator);
    160     STDMETHOD(RegisterListener)(IEventListener * aListener,
     157    STDMETHOD(CreateListener)(IEventListener **aListener);
     158    STDMETHOD(CreateAggregator)(ComSafeArrayIn(IEventSource *, aSubordinates),
     159                                IEventSource **aAggregator);
     160    STDMETHOD(RegisterListener)(IEventListener *aListener,
    161161                                ComSafeArrayIn(VBoxEventType_T, aInterested),
    162                                 BOOL             aActive);
    163     STDMETHOD(UnregisterListener)(IEventListener * aListener);
    164     STDMETHOD(FireEvent)(IEvent * aEvent,
    165                          LONG     aTimeout,
    166                          BOOL     *aProcessed);
    167     STDMETHOD(GetEvent)(IEventListener * aListener,
    168                         LONG      aTimeout,
    169                         IEvent  * *aEvent);
    170     STDMETHOD(EventProcessed)(IEventListener * aListener,
    171                               IEvent *         aEvent);
     162                                BOOL aActive);
     163    STDMETHOD(UnregisterListener)(IEventListener *aListener);
     164    STDMETHOD(FireEvent)(IEvent *aEvent, LONG aTimeout, BOOL *aProcessed);
     165    STDMETHOD(GetEvent)(IEventListener *aListener, LONG aTimeout,
     166                        IEvent **aEvent);
     167    STDMETHOD(EventProcessed)(IEventListener *aListener, IEvent *aEvent);
    172168
    173169private:
     
    182178{
    183179public:
    184  VBoxEventDesc()
    185  : mEvent(0), mEventSource(0)
    186  {}
    187  ~VBoxEventDesc()
    188  {}
    189 
    190  /**
    191   * This function to be used with some care, as arguments order must match attribute declaration order
    192   * event class and its superclasses up to IEvent. If unsure, consult implementation in
    193   * generated VBoxEvents.cpp.
    194   */
    195  HRESULT init(IEventSource* aSource, VBoxEventType_T aType, ...);
    196 
    197  /**
    198   * Function similar to the above, but assumes that init() for this type already called once,
    199   * so no need to allocate memory, and only reinit fields. Assumes event is subtype of
    200   * IReusableEvent, asserts otherwise.
    201   */
    202  HRESULT reinit(VBoxEventType_T aType, ...);
    203 
    204  void uninit()
    205  {
    206      mEvent.setNull();
    207      mEventSource.setNull();
    208  }
    209 
    210  void getEvent(IEvent ** aEvent)
    211  {
    212      mEvent.queryInterfaceTo(aEvent);
    213  }
    214 
    215  BOOL fire(LONG aTimeout)
    216  {
    217      if (mEventSource && mEvent)
    218      {
    219          BOOL fDelivered = FALSE;
    220          int rc = mEventSource->FireEvent(mEvent, aTimeout, &fDelivered);
    221          AssertRCReturn(rc, FALSE);
    222          return fDelivered;
    223      }
    224      return FALSE;
    225  }
    226 
    227 private:
    228  ComPtr<IEvent>        mEvent;
    229  ComPtr<IEventSource>  mEventSource;
     180    VBoxEventDesc() : mEvent(0), mEventSource(0)
     181    {}
     182
     183    ~VBoxEventDesc()
     184    {}
     185
     186    /**
     187     * This function to be used with some care, as arguments order must match
     188     * attribute declaration order event class and its superclasses up to
     189     * IEvent. If unsure, consult implementation in generated VBoxEvents.cpp.
     190     */
     191    HRESULT init(IEventSource* aSource, VBoxEventType_T aType, ...);
     192
     193    /**
     194    * Function similar to the above, but assumes that init() for this type
     195    * already called once, so no need to allocate memory, and only reinit
     196    * fields. Assumes event is subtype of IReusableEvent, asserts otherwise.
     197    */
     198    HRESULT reinit(VBoxEventType_T aType, ...);
     199
     200    void uninit()
     201    {
     202        mEvent.setNull();
     203        mEventSource.setNull();
     204    }
     205
     206    void getEvent(IEvent **aEvent)
     207    {
     208        mEvent.queryInterfaceTo(aEvent);
     209    }
     210
     211    BOOL fire(LONG aTimeout)
     212    {
     213        if (mEventSource && mEvent)
     214        {
     215            BOOL fDelivered = FALSE;
     216            int rc = mEventSource->FireEvent(mEvent, aTimeout, &fDelivered);
     217            AssertRCReturn(rc, FALSE);
     218            return fDelivered;
     219        }
     220        return FALSE;
     221    }
     222
     223private:
     224    ComPtr<IEvent>          mEvent;
     225    ComPtr<IEventSource>    mEventSource;
    230226};
    231227
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette