- Timestamp:
- Nov 26, 2008 9:56:07 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/VirtualBoxBase.h
r14588 r14624 305 305 306 306 307 /** Special version of ComAssert that eva ulates eval and breaks if expr fails */307 /** Special version of ComAssert that evaluates eval and breaks if expr fails */ 308 308 #define ComAssertBreak(expr, eval) \ 309 309 if (1) { ComAssert (expr); if (!(expr)) { eval; break; } } else do {} while (0) 310 /** Special version of ComAssertMsg that eva ulates eval and breaks if expr fails */310 /** Special version of ComAssertMsg that evaluates eval and breaks if expr fails */ 311 311 #define ComAssertMsgBreak(expr, a, eval) \ 312 312 if (1) { ComAssertMsg (expr, a); if (!(expr)) { eval; break; } } else do {} while (0) 313 /** Special version of ComAssertRC that eva ulates eval and breaks if vrc does not succeed */313 /** Special version of ComAssertRC that evaluates eval and breaks if vrc does not succeed */ 314 314 #define ComAssertRCBreak(vrc, eval) \ 315 315 if (1) { ComAssertRC (vrc); if (!RT_SUCCESS (vrc)) { eval; break; } } else do {} while (0) 316 /** Special version of ComAssertMsgRC that eva ulates eval and breaks if vrc does not succeed */316 /** Special version of ComAssertMsgRC that evaluates eval and breaks if vrc does not succeed */ 317 317 #define ComAssertMsgRCBreak(vrc, msg, eval) \ 318 318 if (1) { ComAssertMsgRC (vrc, msg); if (!RT_SUCCESS (vrc)) { eval; break; } } else do {} while (0) 319 /** Special version of ComAssertFailed that eva ulates eval and breaks */319 /** Special version of ComAssertFailed that evaluates eval and breaks */ 320 320 #define ComAssertFailedBreak(eval) \ 321 321 if (1) { ComAssertFailed(); { eval; break; } } else do {} while (0) 322 /** Special version of ComAssertMsgFailed that eva ulates eval and breaks */322 /** Special version of ComAssertMsgFailed that evaluates eval and breaks */ 323 323 #define ComAssertMsgFailedBreak(msg, eval) \ 324 324 if (1) { ComAssertMsgFailed (msg); { eval; break; } } else do {} while (0) 325 /** Special version of ComAssertComRC that eva ulates eval and breaks if rc does not succeed */325 /** Special version of ComAssertComRC that evaluates eval and breaks if rc does not succeed */ 326 326 #define ComAssertComRCBreak(rc, eval) \ 327 327 if (1) { ComAssertComRC (rc); if (!SUCCEEDED (rc)) { eval; break; } } else do {} while (0) … … 331 331 332 332 333 /** Special version of ComAssert that eva ulates eval and throws it if expr fails */333 /** Special version of ComAssert that evaluates eval and throws it if expr fails */ 334 334 #define ComAssertThrow(expr, eval) \ 335 335 if (1) { ComAssert (expr); if (!(expr)) { throw (eval); } } else do {} while (0) 336 /** Special version of ComAssertMsg that eva ulates eval and throws it if expr fails */336 /** Special version of ComAssertMsg that evaluates eval and throws it if expr fails */ 337 337 #define ComAssertMsgThrow(expr, a, eval) \ 338 338 if (1) { ComAssertMsg (expr, a); if (!(expr)) { throw (eval); } } else do {} while (0) 339 /** Special version of ComAssertRC that eva ulates eval and throws it if vrc does not succeed */339 /** Special version of ComAssertRC that evaluates eval and throws it if vrc does not succeed */ 340 340 #define ComAssertRCThrow(vrc, eval) \ 341 341 if (1) { ComAssertRC (vrc); if (!RT_SUCCESS (vrc)) { throw (eval); } } else do {} while (0) 342 /** Special version of ComAssertMsgRC that eva ulates eval and throws it if vrc does not succeed */342 /** Special version of ComAssertMsgRC that evaluates eval and throws it if vrc does not succeed */ 343 343 #define ComAssertMsgRCThrow(vrc, msg, eval) \ 344 344 if (1) { ComAssertMsgRC (vrc, msg); if (!RT_SUCCESS (vrc)) { throw (eval); } } else do {} while (0) 345 /** Special version of ComAssertFailed that eva ulates eval and throws it */345 /** Special version of ComAssertFailed that evaluates eval and throws it */ 346 346 #define ComAssertFailedThrow(eval) \ 347 347 if (1) { ComAssertFailed(); { throw (eval); } } else do {} while (0) 348 /** Special version of ComAssertMsgFailed that eva ulates eval and throws it */348 /** Special version of ComAssertMsgFailed that evaluates eval and throws it */ 349 349 #define ComAssertMsgFailedThrow(msg, eval) \ 350 350 if (1) { ComAssertMsgFailed (msg); { throw (eval); } } else do {} while (0) 351 /** Special version of ComAssertComRC that eva ulates eval and throws it if rc does not succeed */351 /** Special version of ComAssertComRC that evaluates eval and throws it if rc does not succeed */ 352 352 #define ComAssertComRCThrow(rc, eval) \ 353 353 if (1) { ComAssertComRC (rc); if (!SUCCEEDED (rc)) { throw (eval); } } else do {} while (0) … … 361 361 * Checks that the pointer argument is not NULL and returns E_INVALIDARG + 362 362 * extended error info on failure. 363 * @param arg Input pointer-type argument (strings, inter ace pointers...)363 * @param arg Input pointer-type argument (strings, interface pointers...) 364 364 */ 365 365 #define CheckComArgNotNull(arg) \ … … 372 372 * Checks that safe array argument is not NULL and returns E_INVALIDARG + 373 373 * extended error info on failure. 374 * @param arg Input safe array argument (strings, inter ace pointers...)374 * @param arg Input safe array argument (strings, interface pointers...) 375 375 */ 376 376 #define CheckComArgSafeArrayNotNull(arg) \ … … 448 448 449 449 /** 450 * Sets the extended error info and returns E_NOTIM IL.450 * Sets the extended error info and returns E_NOTIMPL. 451 451 * @param method Method that is not implemented. 452 452 */ … … 462 462 * Checks whether this object is ready or not. Objects are typically ready 463 463 * after they are successfully created by their parent objects and become 464 * not ready when the respective parent itse f becomes not ready or gets464 * not ready when the respective parent itself becomes not ready or gets 465 465 * destroyed while a reference to the child is still held by the caller 466 466 * (which prevents it from destruction). … … 481 481 482 482 /** 483 * Declares an empty constru tor and destructor for the given class.483 * Declares an empty constructor and destructor for the given class. 484 484 * This is useful to prevent the compiler from generating the default 485 485 * ctor and dtor, which in turn allows to use forward class statements … … 488 488 * by constructors and by the destructor of the class). 489 489 * 490 * This macro is to be p alced within (the public section of) the class490 * This macro is to be placed within (the public section of) the class 491 491 * declaration. Its counterpart, DEFINE_EMPTY_CTOR_DTOR, must be placed 492 492 * somewhere in one of the translation units (usually .cpp source files). … … 497 497 498 498 /** 499 * Defines an empty constru tor and destructor for the given class.499 * Defines an empty constructor and destructor for the given class. 500 500 * See DECLARE_EMPTY_CTOR_DTOR for more info. 501 501 */ … … 547 547 * 548 548 * This makes it possible to have intermediate base classes used by several 549 * components that implement some common interface fu ctionality but still let550 * the final component classe choose what VirtualBoxBase variant it wants to549 * components that implement some common interface functionality but still let 550 * the final component classes choose what VirtualBoxBase variant it wants to 551 551 * use. 552 552 * 553 553 * Among the basic functionality implemented by this class is the primary object 554 554 * state that indicates if the object is ready to serve the calls, and if not, 555 * what stage it is currently at. Here is the p irmary state diagram:555 * what stage it is currently at. Here is the primary state diagram: 556 556 * 557 557 * +-------------------------------------------------------+ … … 594 594 * 595 595 * 1) Use the above Auto*Span classes to perform state transitions. See the 596 * individual class d oescriptions for details.596 * individual class descriptions for details. 597 597 * 598 598 * 2) All public methods of subclasses (i.e. all methods that can be called … … 600 600 * standard prolog as described in the AutoCaller and AutoLimitedCaller 601 601 * documentation. Alternatively, they must use addCaller()/releaseCaller() 602 * directly (and theref ire have both the prolog and the epilog), but this is602 * directly (and therefore have both the prolog and the epilog), but this is 603 603 * not recommended. 604 604 */ … … 668 668 * used. 669 669 * 670 * @note It is prefer rable to use the AutoCaller and AutoLimitedCaller670 * @note It is preferable to use the AutoCaller and AutoLimitedCaller 671 671 * classes than specify the @a aLimited argument, for better 672 672 * self-descriptiveness. … … 856 856 * #setLimited() or to Result::Failed using #setFailed(). Please don't 857 857 * forget to set the correct success status before getting the AutoInitSpan 858 * variable destr yed (for example, by performing an early return from858 * variable destroyed (for example, by performing an early return from 859 859 * the init() method)! 860 860 * … … 1032 1032 * AutoUninitSpan autoUninitSpan (this); 1033 1033 * if (autoUninitSpan.uninitDone()) 1034 * ret run;1034 * return; 1035 1035 * ... 1036 1036 * } … … 1221 1221 { \ 1222 1222 if (state == VirtualBoxBaseProto::Limited) \ 1223 rc = setError (rc, tr ("The object funct onality is limited")); \1223 rc = setError (rc, tr ("The object functionality is limited")); \ 1224 1224 else \ 1225 1225 rc = setError (rc, tr ("The object is not ready")); \ … … 1254 1254 * Virtual unintialization method. Called during parent object's 1255 1255 * uninitialization, if the given subclass instance is a dependent child of 1256 * a class der vived from VirtualBoxBaseWithChildren (@sa1256 * a class derived from VirtualBoxBaseWithChildren (@sa 1257 1257 * VirtualBoxBaseWithChildren::addDependentChild). In this case, this 1258 * method's imp elemtation must call setReady (false),1258 * method's implementation must call setReady (false), 1259 1259 */ 1260 1260 virtual void uninit() {} … … 1347 1347 * @return Translated version of the source string in UTF-8 encoding, or 1348 1348 * the source string itself if the translation is not found in the 1349 * specifie cd context.1349 * specified context. 1350 1350 */ 1351 1351 inline static const char *tr (const char *aSourceText, … … 1430 1430 * This way, error/warning objects are stacked together and form a chain of 1431 1431 * errors where the most recent error is the first one retrieved by the 1432 * calling party, the prece eding error is what the1432 * calling party, the preceding error is what the 1433 1433 * IVirtualBoxErrorInfo::next attribute of the first error points to, and so 1434 * on, up to the first error or warning occured which is the last in the1434 * on, up to the first error or warning occurred which is the last in the 1435 1435 * chain. See IVirtualBoxErrorInfo documentation for more info. 1436 1436 * … … 1441 1441 * next error or warning object overwrites the previous one. 1442 1442 * 1443 * Note that the caller of a COM meth id uses a non-S_OK result code to1443 * Note that the caller of a COM method uses a non-S_OK result code to 1444 1444 * decide if the method has returned an error (negative codes) or a warning 1445 1445 * (positive non-zero codes) and will query extended error info only in … … 1448 1448 * error or warning but continues its execution, the functionality provided 1449 1449 * by the base com::FWResult class becomes very useful because it allows to 1450 * prese ve the error or the warning result code even if it is later assigned1450 * preserve the error or the warning result code even if it is later assigned 1451 1451 * a S_OK value multiple times. See com::FWResult for details. 1452 1452 * … … 1503 1503 * it in case of expressions like |MultiResult rc = E_FAIL;|. But 1504 1504 * we assert since the optimizer should actually avoid the 1505 * temporary and call the other constructor directly i stead. */1505 * temporary and call the other constructor directly instead. */ 1506 1506 AssertFailed(); 1507 1507 init(); … … 1521 1521 * it in case of expressions like |MultiResult rc = E_FAIL;|. But 1522 1522 * we assert since the optimizer should actually avoid the 1523 * temporary and call the other constructor directly i stead. */1523 * temporary and call the other constructor directly instead. */ 1524 1524 AssertFailed(); 1525 1525 com::FWResult::operator= (aThat); … … 1672 1672 * 1673 1673 * @param aResultCode result (error) code, must not be S_OK 1674 * @param aIID IID of the int rface that defines the error1674 * @param aIID IID of the interface that defines the error 1675 1675 * @param aComponent name of the component that generates the error 1676 1676 * @param aText error message (must not be null), an RTStrPrintf-like … … 1679 1679 * 1680 1680 * @return 1681 * the error argument, for convenience, If an error occur es while1681 * the error argument, for convenience, If an error occurs while 1682 1682 * creating error info itself, that error is returned instead of the 1683 1683 * error argument. … … 1697 1697 /** 1698 1698 * This method is the same as #setError() except that it makes sure @a 1699 * aResultCode doesn't have the error sever ty bit (31) set when passed1699 * aResultCode doesn't have the error severity bit (31) set when passed 1700 1700 * down to the created IVirtualBoxErrorInfo object. 1701 1701 * 1702 * The error severity bit is always cleared by this call, thereof eyou can1703 * use ordinary E_XXX result code constan cs, for convenience. However, this1704 * behavior may be non-stan rard on some COM platforms.1702 * The error severity bit is always cleared by this call, thereof you can 1703 * use ordinary E_XXX result code constants, for convenience. However, this 1704 * behavior may be non-standard on some COM platforms. 1705 1705 */ 1706 1706 static HRESULT setWarning (HRESULT aResultCode, const GUID &aIID, … … 1751 1751 /** 1752 1752 * This method is the same as #setError() except that it makes sure @a 1753 * aResultCode doesn't have the error sever ty bit (31) set when passed1753 * aResultCode doesn't have the error severity bit (31) set when passed 1754 1754 * down to the created IVirtualBoxErrorInfo object. 1755 1755 * 1756 * The error severity bit is always cleared by this call, thereof eyou can1757 * use ordinary E_XXX result code constan cs, for convenience. However, this1758 * behavior may be non-stan rard on some COM platforms.1756 * The error severity bit is always cleared by this call, thereof you can 1757 * use ordinary E_XXX result code constants, for convenience. However, this 1758 * behavior may be non-standard on some COM platforms. 1759 1759 */ 1760 1760 static HRESULT setWarning (HRESULT aResultCode, const char *aText, ...) … … 1787 1787 /** 1788 1788 * This method is the same as #setErrorV() except that it makes sure @a 1789 * aResultCode doesn't have the error sever ty bit (31) set when passed1789 * aResultCode doesn't have the error severity bit (31) set when passed 1790 1790 * down to the created IVirtualBoxErrorInfo object. 1791 1791 * 1792 * The error severity bit is always cleared by this call, thereof eyou can1793 * use ordinary E_XXX result code constan cs, for convenience. However, this1794 * behavior may be non-stan rard on some COM platforms.1792 * The error severity bit is always cleared by this call, thereof you can 1793 * use ordinary E_XXX result code constants, for convenience. However, this 1794 * behavior may be non-standard on some COM platforms. 1795 1795 */ 1796 1796 static HRESULT setWarningV (HRESULT aResultCode, const char *aText, … … 1808 1808 * (a value of C::getComponentName()). 1809 1809 * 1810 * This method is preferred i yyou have a ready (translated and formatted)1810 * This method is preferred if you have a ready (translated and formatted) 1811 1811 * Bstr string, because it omits an extra conversion Utf8Str -> Bstr. 1812 1812 * … … 1823 1823 /** 1824 1824 * This method is the same as #setErrorBstr() except that it makes sure @a 1825 * aResultCode doesn't have the error sever ty bit (31) set when passed1825 * aResultCode doesn't have the error severity bit (31) set when passed 1826 1826 * down to the created IVirtualBoxErrorInfo object. 1827 1827 * 1828 * The error severity bit is always cleared by this call, thereof eyou can1829 * use ordinary E_XXX result code constan cs, for convenience. However, this1830 * behavior may be non-stan rard on some COM platforms.1828 * The error severity bit is always cleared by this call, thereof you can 1829 * use ordinary E_XXX result code constants, for convenience. However, this 1830 * behavior may be non-standard on some COM platforms. 1831 1831 */ 1832 1832 static HRESULT setWarningBstr (HRESULT aResultCode, const Bstr &aText) … … 1859 1859 /** 1860 1860 * This method is the same as #setError() except that it makes sure @a 1861 * aResultCode doesn't have the error sever ty bit (31) set when passed1861 * aResultCode doesn't have the error severity bit (31) set when passed 1862 1862 * down to the created IVirtualBoxErrorInfo object. 1863 1863 * 1864 * The error severity bit is always cleared by this call, thereof eyou can1865 * use ordinary E_XXX result code constan cs, for convenience. However, this1866 * behavior may be non-stan rard on some COM platforms.1864 * The error severity bit is always cleared by this call, thereof you can 1865 * use ordinary E_XXX result code constants, for convenience. However, this 1866 * behavior may be non-standard on some COM platforms. 1867 1867 */ 1868 1868 static HRESULT setWarning (HRESULT aResultCode, const GUID &aIID, … … 1901 1901 1902 1902 /** 1903 * Base class to track VirtualBoxBase ch lidren of the component.1904 * 1905 * This class is a prefer rable VirtualBoxBase replacement for components1903 * Base class to track VirtualBoxBase children of the component. 1904 * 1905 * This class is a preferable VirtualBoxBase replacement for components 1906 1906 * that operate with collections of child components. It gives two useful 1907 1907 * possibilities: … … 2033 2033 * actual class of the child object (to get access to its "internal" 2034 2034 * non-interface methods) provided that no other child components implement 2035 * the same orig nial COM interface IUnknown is queried from.2035 * the same original COM interface IUnknown is queried from. 2036 2036 * </li><li> 2037 2037 * When the parent object uninitializes itself, it can easily unintialize … … 2053 2053 * it gets uninitialized, it must call uninit() methods of individual children 2054 2054 * manually to disconnect them; a failure to do so will cause crashes in these 2055 * methods when chi dren get destroyed. The same applies to children not calling2056 * #removeDependentChild() when getting destro oyed.2055 * methods when children get destroyed. The same applies to children not calling 2056 * #removeDependentChild() when getting destroyed. 2057 2057 * 2058 2058 * Note that children added by #addDependentChild() are <b>weakly</b> referenced … … 2071 2071 * 2072 2072 * @todo This is a VirtualBoxBaseWithChildren equivalent that uses the 2073 * VirtualBoxBaseNEXT implementation. Will completely super cede2073 * VirtualBoxBaseNEXT implementation. Will completely supersede 2074 2074 * VirtualBoxBaseWithChildren after the old VirtualBoxBase implementation 2075 2075 * has gone. … … 2359 2359 2360 2360 /** 2361 * Base class to track component's ch lidren of the particular type.2361 * Base class to track component's children of the particular type. 2362 2362 * 2363 2363 * This class is similar to VirtualBoxBaseWithChildrenNEXT with the exception … … 2379 2379 * 2380 2380 * @todo This is a VirtualBoxBaseWithChildren equivalent that uses the 2381 * VirtualBoxBaseNEXT implementation. Will completely super cede2381 * VirtualBoxBaseNEXT implementation. Will completely supersede 2382 2382 * VirtualBoxBaseWithChildren after the old VirtualBoxBase implementation 2383 2383 * has gone. … … 2508 2508 * these methods need to call the parent object during uninitialization, 2509 2509 * #uninitDependentChildren() must be called before the relevant part of the 2510 * parent is uninitialized: usually at the beg nning of the parent2510 * parent is uninitialized: usually at the beginning of the parent 2511 2511 * uninitialization sequence. 2512 2512 * … … 2829 2829 2830 2830 /** 2831 * Settin sgAPI additions.2831 * Settings API additions. 2832 2832 */ 2833 2833 namespace settings
Note:
See TracChangeset
for help on using the changeset viewer.