VirtualBox

Changeset 12942 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Oct 2, 2008 2:53:11 PM (16 years ago)
Author:
vboxsync
Message:

PerfAPI: Fixed the problem with passing null/empty arrays to PerfAPI methods.
Enabled attributes of type IUnknown in SOAP, JAX-WS, WSDL, CPP and Python style sheets.
Added PerfCollector python class to shellcommon.py to provide more 'pythonic' way to access metric data.
Added the reference to shellcommon.py to IDL docs as an example of PerfAPI usage in python.

Location:
trunk/src/VBox/Main
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/Performance.cpp

    r12802 r12942  
    417417               ComSafeArrayIn(IUnknown *, objects))
    418418{
     419    /*
     420     * Let's work around null/empty safe array mess. I am not sure there is
     421     * a way to pass null arrays via webservice, I haven't found one. So I
     422     * guess the users will be forced to use empty arrays instead. Constructing
     423     * an empty SafeArray is a bit awkward, so what we do in this method is
     424     * actually convert null arrays to empty arrays and pass them down to
     425     * init() method. If someone knows how to do it better, please be my guest,
     426     * fix it.
     427     */
     428    if (ComSafeArrayInIsNull(metricNames))
     429    {
     430        com::SafeArray <BSTR> nameArray;
     431        if (ComSafeArrayInIsNull(objects))
     432        {
     433            com::SafeIfaceArray <IUnknown> objectArray;
     434            objectArray.reset(0);
     435            init(ComSafeArrayAsInParam(nameArray),
     436                 ComSafeArrayAsInParam(objectArray));
     437        }
     438        else
     439        {
     440            com::SafeIfaceArray <IUnknown> objectArray(ComSafeArrayInArg(objects));
     441            init(ComSafeArrayAsInParam(nameArray),
     442                 ComSafeArrayAsInParam(objectArray));
     443        }
     444    }
     445    else
     446    {
     447        com::SafeArray <INPTR BSTR> nameArray(ComSafeArrayInArg(metricNames));
     448        if (ComSafeArrayInIsNull(objects))
     449        {
     450            com::SafeIfaceArray <IUnknown> objectArray;
     451            objectArray.reset(0);
     452            init(ComSafeArrayAsInParam(nameArray),
     453                 ComSafeArrayAsInParam(objectArray));
     454        }
     455        else
     456        {
     457            com::SafeIfaceArray <IUnknown> objectArray(ComSafeArrayInArg(objects));
     458            init(ComSafeArrayAsInParam(nameArray),
     459                 ComSafeArrayAsInParam(objectArray));
     460        }
     461    }
     462}
     463
     464void Filter::init(ComSafeArrayIn(INPTR BSTR, metricNames),
     465                  ComSafeArrayIn(IUnknown *, objects))
     466{
    419467    com::SafeArray <INPTR BSTR> nameArray(ComSafeArrayInArg(metricNames));
    420 
    421     if (ComSafeArrayInIsNull(objects))
     468    com::SafeIfaceArray <IUnknown> objectArray(ComSafeArrayInArg(objects));
     469
     470    if (!objectArray.size())
    422471    {
    423472        if (nameArray.size())
     
    431480    else
    432481    {
    433         com::SafeIfaceArray <IUnknown> objectArray(ComSafeArrayInArg(objects));
    434 
     482 
    435483        for (size_t i = 0; i < objectArray.size(); ++i)
    436484            switch (nameArray.size())
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r12889 r12942  
    1049410494        </li>
    1049510495      </ul>
     10496
     10497      For an example of usage refer to the following files in VirtualBox SDK:
     10498      <ul>
     10499        <li>Python: <tt>bindings/xpcom/python/sample/shellcommon.py</tt></li>
     10500      </ul>
    1049610501    </desc>
    1049710502
  • trunk/src/VBox/Main/include/Performance.h

    r12678 r12942  
    380380        bool match(const ComPtr<IUnknown> object, const std::string &name) const;
    381381    private:
     382        void init(ComSafeArrayIn(INPTR BSTR, metricNames),
     383                  ComSafeArrayIn(IUnknown * , objects));
     384
    382385        typedef std::pair<const ComPtr<IUnknown>, const std::string> FilterElement;
    383386        typedef std::list<FilterElement> ElementList;
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