EMMA Coverage Report (generated Mon Mar 20 21:34:30 PST 2006)
[all classes][com.moesol.bindings.platform_sdk.component_services]

COVERAGE SUMMARY FOR SOURCE FILE [ComIUnknownOuter.java]

nameclass, %method, %block, %line, %
ComIUnknownOuter.java100% (1/1)40%  (2/5)32%  (18/57)50%  (7/14)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ComIUnknownOuter100% (1/1)40%  (2/5)32%  (18/57)50%  (7/14)
addRef (): long 0%   (0/1)0%   (0/4)0%   (0/1)
queryInterface (GUID): IUnknown 0%   (0/1)0%   (0/31)0%   (0/5)
release (): long 0%   (0/1)0%   (0/4)0%   (0/1)
ComIUnknownOuter (IUnknown): void 100% (1/1)100% (7/7)100% (3/3)
aggregate (ComObject): void 100% (1/1)100% (11/11)100% (4/4)

1/*
2 * $Id: ComIUnknownOuter.java,v 1.1 2005/12/03 08:14:40 hastings Exp $
3 *
4 * (c) Copyright, Moebius Solutions, Inc., 2004
5 *
6 *                       All Rights Reserved
7 *
8 * This material may be reproduced by or for the U. S. Government
9 * pursuant to the copyright license under the clause at
10 * DFARS 252.227-7014 (OCT 2001).
11 */
12package com.moesol.bindings.platform_sdk.component_services;
13 
14import java.nio.ByteBuffer;
15 
16/**
17 * Implements ComIUnknown by delegating to an actual "outer" native IUnknown.
18 * When we are aggregated we use this class to link lifespan and QueryInterface
19 * control to the "outer" COM server.
20 * 
21 * @author Hastings
22 */
23class ComIUnknownOuter implements ComIUnknown {
24        private final long m_iface_ptr;
25        
26        public ComIUnknownOuter(IUnknown unk) {
27                m_iface_ptr = jni_ctor(unk);
28        }
29 
30        public IUnknown queryInterface(GUID iid) {
31                InterfaceBuilder ib = new InterfaceBuilder(IUnknown.class);
32                int hr = jni_QueryInterface(m_iface_ptr, iid.getByteBuffer(), ib.getResult());
33                if (HRESULT.FAILED(hr)) {
34                        throw new COMException(hr);
35                }
36                return ib.getResult();
37        }
38 
39        public long addRef() {
40                return jni_AddRef(m_iface_ptr);
41        }
42 
43        public long release() {
44                return jni_Release(m_iface_ptr);
45        }
46 
47        /**
48         * Take over all of the {@code m_unknown_support} pointers
49         * except @{code inner}. See the graph in the Reverse COM
50         * design guide.
51         * 
52         * @param inner
53         */
54        public void aggregate(ComObject inner) {
55                ComIUnknownImpl inner_unk_impl = (ComIUnknownImpl)inner.m_iunknown_support; // save
56                inner_unk_impl.linkTo(this);
57                inner.m_iunknown_support = inner_unk_impl; // restore
58        }
59 
60        private static native long jni_ctor(IUnknown unk);
61        private static native int jni_QueryInterface(long ptr, ByteBuffer bb_iid, IUnknown result);
62        private static native long jni_AddRef(long ptr);
63        private static native long jni_Release(long ptr);
64}

[all classes][com.moesol.bindings.platform_sdk.component_services]
EMMA 2.0.5312 (C) Vladimir Roubtsov