Thanks Alex, That makes sense. In IA2 there are two styles for passing arrays. One example is IA2::relations and IARelation::targets where the client allocates the array. These two methods will not be in 1.3. The other example is where the server allocates the array: IA2::extendedStates/localizedExtendedStates, IAAction::keyBinding, IATable2::selectedCells/Columns/Rows.
It took quite a bit of study and discussion to settle on the latter style. So I'd like to keep this consistency, i.e. HRESULT IAccessible2_2::targetsByRelationType ( [in] BSTR type, [out, size_is(,*nTargets)] long **targets, [out, retval] long *nTargets ) This does not have the extra [in] count parameter Jamie proposed so the client doesn't need to know before the call how many targets there are. Also please see: http://accessibility.linuxfoundation.org/a11yspecs/ia2/docs/html/_generalinfo.html#_arrayConsideration Note: The last sentence of that section is not quite right. Only the first three methods have the error of providing the unused [in] max count parameter. The first two I could repair when I create IAccessible2_2. Pete On 3/5/12 9:40 AM, Alexander Surkov wrote: > I wonder if AT needs only one target then would the pointer to the > pointer work as an array (like IUnknown* acc and pass &acc to the > method)? > >> IA2_2::nTargetsByRelationType([in] BSTR type, [out,retval] long *nTargets) >> IA2_2::targetByRelationType([in] long targetIndex, [out, retval] IUknown >> **target) > >From implementation point of view that requires us to keep relations > array in the cache to make the impl perfromant and do some cache > invalidation. I wouldn't like this. > > Alex. > > On Tue, Mar 6, 2012 at 12:28 AM, Pete Brunet <[email protected]> wrote: >> Then this would be very simple: >> >> IA2_2::nTargetsByRelationType([in] BSTR type, [out,retval] long *nTargets) >> IA2_2::targetByRelationType([in] long targetIndex, [out, retval] IUknown >> **target) >> >> In the rare cases where there is more than one target it wouldn't be much >> (or noticeable) overheard to fetch the very small number of extra targets. >> And often the count wouldn't even need to be fetched, e.g. nodeChildOf >> should only have one target. >> >> >> On 3/4/12 9:34 PM, Alexander Surkov wrote: >> >> This sounds like a good option with me. The call costs should be lower >> than in IEnumVariant approach. But if you in 99% percents you need >> only one target shouldn't we have a method for this to avoid array >> stuffs? >> >> Thank you. >> Alex. >> >> >> On Mon, Mar 5, 2012 at 10:56 AM, James Teh <[email protected]> wrote: >> >> Hi. >> >> Mick and I were discussing this same issue this morning. We haven't seen use >> cases ourselves where there is a need for multiple targets for a given >> relation type, though I'm sure that there are rare use cases; e.g. one >> object which controls multiple objects, etc. Even where there are multiple >> targets, I can't think of a use case where a client would want to retrieve >> them one by one; it's probably going to be one or all. Therefore, I think >> something like the following makes the most sense: >> >> [propget] HRESULT relationTargetsOfType >> ( >> [in] BSTR type, >> [in] long requestedTargets, >> [out, size_is(,*nTargets,)] IUnknown ***targets, >> [out, retval] long *nTargets >> ); >> requestedTargets specifies the number of targets requested by the client. If >> 0, all targets will be returned. This allows a client to easily retrieve >> just the first target (or first n targets). nTargets is always set to the >> number of targets returned. >> >> Jamie >> >> >> On 5/03/2012 11:36 AM, Pete Brunet wrote: >> >> IATable2::selectedCells/Columns/Rows returns an array but the proposed >> new methods: >> >> https://wiki.mozilla.org/Accessibility/IA2_1.3#Relations >> https://wiki.mozilla.org/Accessibility/IA2_1.3#Hyperlinks_from_hypertext >> >> specify the return of an IEnumVARIANT. >> >> What is the reasoning for that? With the IEnumVARIANT you have to fetch >> the count (so you can allocate an array), the enumerator, and then the >> elements, taking at least three calls (or more if you want to fetch the >> elements one at a time). With the alternative approach we had used for >> IATable2 there is only one call. >> >> -- >> *Pete Brunet* >> >> >> a11ysoft - Accessibility Architecture and Development >> (512) 467-4706 (work), (512) 689-4155 (cell) >> Skype: pete.brunet >> IM: ptbrunet (AOL, Google), [email protected] (MSN) >> http://www.a11ysoft.com/about/ >> Ionosphere: WS4G _______________________________________________ Accessibility-ia2 mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/accessibility-ia2
