1*d48fe848SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*d48fe848SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*d48fe848SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*d48fe848SAndrew Rist  * distributed with this work for additional information
6*d48fe848SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*d48fe848SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*d48fe848SAndrew Rist  * "License"); you may not use this file except in compliance
9*d48fe848SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*d48fe848SAndrew Rist  *
11*d48fe848SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*d48fe848SAndrew Rist  *
13*d48fe848SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*d48fe848SAndrew Rist  * software distributed under the License is distributed on an
15*d48fe848SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*d48fe848SAndrew Rist  * KIND, either express or implied.  See the License for the
17*d48fe848SAndrew Rist  * specific language governing permissions and limitations
18*d48fe848SAndrew Rist  * under the License.
19*d48fe848SAndrew Rist  *
20*d48fe848SAndrew Rist  *************************************************************/
21*d48fe848SAndrew Rist 
22*d48fe848SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_testtools.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <osl/diagnose.h>
28cdf0e10cSrcweir #include <osl/interlck.h>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir #include <cppuhelper/factory.hxx>
31cdf0e10cSrcweir 
32cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
33cdf0e10cSrcweir #include <com/sun/star/lang/XComponent.hpp>
34cdf0e10cSrcweir #include <com/sun/star/registry/XRegistryKey.hpp>
35cdf0e10cSrcweir 
36cdf0e10cSrcweir #include <com/sun/star/test/performance/XPerformanceTest.hpp>
37cdf0e10cSrcweir 
38cdf0e10cSrcweir using namespace rtl;
39cdf0e10cSrcweir using namespace osl;
40cdf0e10cSrcweir using namespace cppu;
41cdf0e10cSrcweir using namespace com::sun::star::uno;
42cdf0e10cSrcweir using namespace com::sun::star::lang;
43cdf0e10cSrcweir using namespace com::sun::star::registry;
44cdf0e10cSrcweir using namespace com::sun::star::test::performance;
45cdf0e10cSrcweir 
46cdf0e10cSrcweir #define SERVICENAME		"com.sun.star.test.performance.PerformanceTestObject"
47cdf0e10cSrcweir #define IMPLNAME		"com.sun.star.comp.performance.PerformanceTestObject"
48cdf0e10cSrcweir 
49cdf0e10cSrcweir namespace benchmark_object
50cdf0e10cSrcweir {
51cdf0e10cSrcweir 
52cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------
getSupportedServiceNames()53cdf0e10cSrcweir inline static Sequence< OUString > getSupportedServiceNames()
54cdf0e10cSrcweir {
55cdf0e10cSrcweir 	OUString aName( RTL_CONSTASCII_USTRINGPARAM(SERVICENAME) );
56cdf0e10cSrcweir 	return Sequence< OUString >( &aName, 1 );
57cdf0e10cSrcweir }
58cdf0e10cSrcweir 
59cdf0e10cSrcweir //==================================================================================================
60cdf0e10cSrcweir class ServiceImpl
61cdf0e10cSrcweir 	: public XServiceInfo
62cdf0e10cSrcweir 	, public XPerformanceTest
63cdf0e10cSrcweir {
64cdf0e10cSrcweir 	OUString _aDummyString;
65cdf0e10cSrcweir 	Any _aDummyAny;
66cdf0e10cSrcweir 	Sequence< Reference< XInterface > > _aDummySequence;
67cdf0e10cSrcweir 	ComplexTypes _aDummyStruct;
68cdf0e10cSrcweir 	RuntimeException _aDummyRE;
69cdf0e10cSrcweir 
70cdf0e10cSrcweir 	sal_Int32 _nRef;
71cdf0e10cSrcweir 
72cdf0e10cSrcweir public:
ServiceImpl()73cdf0e10cSrcweir 	ServiceImpl()
74cdf0e10cSrcweir 		: _nRef( 0 )
75cdf0e10cSrcweir 		{}
ServiceImpl(const Reference<XMultiServiceFactory> & xMgr)76cdf0e10cSrcweir 	ServiceImpl( const Reference< XMultiServiceFactory > & xMgr )
77cdf0e10cSrcweir 		: _nRef( 0 )
78cdf0e10cSrcweir 		{}
79cdf0e10cSrcweir 
80cdf0e10cSrcweir 	// XInterface
queryInterface(const::com::sun::star::uno::Type & aType)81cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException)
82cdf0e10cSrcweir 	{
83cdf0e10cSrcweir 		// execution time remains appr. constant any time
84cdf0e10cSrcweir 		Any aRet;
85cdf0e10cSrcweir 		if (aType == ::getCppuType( (const Reference< XInterface > *)0 ))
86cdf0e10cSrcweir 		{
87cdf0e10cSrcweir 			void * p = (XInterface *)(XPerformanceTest *)this;
88cdf0e10cSrcweir 			aRet.setValue( &p, ::getCppuType( (const Reference< XInterface > *)0 ) );
89cdf0e10cSrcweir 		}
90cdf0e10cSrcweir 		if (aType == ::getCppuType( (const Reference< XPerformanceTest > *)0 ))
91cdf0e10cSrcweir 		{
92cdf0e10cSrcweir 			void * p = (XPerformanceTest *)this;
93cdf0e10cSrcweir 			aRet.setValue( &p, ::getCppuType( (const Reference< XPerformanceTest > *)0 ) );
94cdf0e10cSrcweir 		}
95cdf0e10cSrcweir 		if (! aRet.hasValue())
96cdf0e10cSrcweir 		{
97cdf0e10cSrcweir 			void * p = (XPerformanceTest *)this;
98cdf0e10cSrcweir 			Any aDummy( &p, ::getCppuType( (const Reference< XPerformanceTest > *)0 ) );
99cdf0e10cSrcweir 		}
100cdf0e10cSrcweir 		return aRet;
101cdf0e10cSrcweir 	}
acquire()102cdf0e10cSrcweir     virtual void SAL_CALL acquire() throw()
103cdf0e10cSrcweir 		{ osl_incrementInterlockedCount( &_nRef ); }
release()104cdf0e10cSrcweir     virtual void SAL_CALL release() throw()
105cdf0e10cSrcweir 		{ if (! osl_decrementInterlockedCount( &_nRef )) delete this; }
106cdf0e10cSrcweir 
107cdf0e10cSrcweir 	// XServiceInfo
108cdf0e10cSrcweir 	virtual OUString SAL_CALL getImplementationName() throw (RuntimeException);
109cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL supportsService( const OUString & rServiceName ) throw (RuntimeException);
110cdf0e10cSrcweir 	virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (RuntimeException);
111cdf0e10cSrcweir 
112cdf0e10cSrcweir     // Attributes
getLong_attr()113cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getLong_attr() throw(::com::sun::star::uno::RuntimeException)
114cdf0e10cSrcweir 		{ return 0; }
setLong_attr(sal_Int32 _attributelong)115cdf0e10cSrcweir     virtual void SAL_CALL setLong_attr( sal_Int32 _attributelong ) throw(::com::sun::star::uno::RuntimeException)
116cdf0e10cSrcweir 		{}
getHyper_attr()117cdf0e10cSrcweir     virtual sal_Int64 SAL_CALL getHyper_attr() throw(::com::sun::star::uno::RuntimeException)
118cdf0e10cSrcweir 		{ return 0; }
setHyper_attr(sal_Int64 _attributehyper)119cdf0e10cSrcweir     virtual void SAL_CALL setHyper_attr( sal_Int64 _attributehyper ) throw(::com::sun::star::uno::RuntimeException)
120cdf0e10cSrcweir 		{}
getFloat_attr()121cdf0e10cSrcweir     virtual float SAL_CALL getFloat_attr() throw(::com::sun::star::uno::RuntimeException)
122cdf0e10cSrcweir 		{ return 0.0; }
setFloat_attr(float _attributefloat)123cdf0e10cSrcweir     virtual void SAL_CALL setFloat_attr( float _attributefloat ) throw(::com::sun::star::uno::RuntimeException)
124cdf0e10cSrcweir 		{}
getDouble_attr()125cdf0e10cSrcweir     virtual double SAL_CALL getDouble_attr() throw(::com::sun::star::uno::RuntimeException)
126cdf0e10cSrcweir 		{ return 0.0; }
setDouble_attr(double _attributedouble)127cdf0e10cSrcweir     virtual void SAL_CALL setDouble_attr( double _attributedouble ) throw(::com::sun::star::uno::RuntimeException)
128cdf0e10cSrcweir 		{}
getString_attr()129cdf0e10cSrcweir     virtual OUString SAL_CALL getString_attr() throw(::com::sun::star::uno::RuntimeException)
130cdf0e10cSrcweir 		{ return _aDummyString; }
setString_attr(const::rtl::OUString & _attributestring)131cdf0e10cSrcweir     virtual void SAL_CALL setString_attr( const ::rtl::OUString& _attributestring ) throw(::com::sun::star::uno::RuntimeException)
132cdf0e10cSrcweir 		{}
getInterface_attr()133cdf0e10cSrcweir     virtual Reference< XInterface > SAL_CALL getInterface_attr() throw(::com::sun::star::uno::RuntimeException)
134cdf0e10cSrcweir 		{ return Reference< XInterface >(); }
setInterface_attr(const Reference<XInterface> & _attributeinterface)135cdf0e10cSrcweir     virtual void SAL_CALL setInterface_attr( const Reference< XInterface >& _attributeinterface ) throw(::com::sun::star::uno::RuntimeException)
136cdf0e10cSrcweir 		{}
getAny_attr()137cdf0e10cSrcweir     virtual Any SAL_CALL getAny_attr() throw(::com::sun::star::uno::RuntimeException)
138cdf0e10cSrcweir 		{ return _aDummyAny; }
setAny_attr(const Any & _attributeany)139cdf0e10cSrcweir     virtual void SAL_CALL setAny_attr( const Any& _attributeany ) throw(::com::sun::star::uno::RuntimeException)
140cdf0e10cSrcweir 		{}
getSequence_attr()141cdf0e10cSrcweir     virtual Sequence< Reference< XInterface > > SAL_CALL getSequence_attr() throw(::com::sun::star::uno::RuntimeException)
142cdf0e10cSrcweir 		{ return _aDummySequence; }
setSequence_attr(const Sequence<Reference<XInterface>> & _attributesequence)143cdf0e10cSrcweir     virtual void SAL_CALL setSequence_attr( const Sequence< Reference< XInterface > >& _attributesequence ) throw(::com::sun::star::uno::RuntimeException)
144cdf0e10cSrcweir 		{}
getStruct_attr()145cdf0e10cSrcweir     virtual ComplexTypes SAL_CALL getStruct_attr() throw(::com::sun::star::uno::RuntimeException)
146cdf0e10cSrcweir 		{ return _aDummyStruct; }
setStruct_attr(const::com::sun::star::test::performance::ComplexTypes & _attributestruct)147cdf0e10cSrcweir     virtual void SAL_CALL setStruct_attr( const ::com::sun::star::test::performance::ComplexTypes& _attributestruct ) throw(::com::sun::star::uno::RuntimeException)
148cdf0e10cSrcweir 		{}
149cdf0e10cSrcweir 
150cdf0e10cSrcweir     // Methods
getLong()151cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getLong() throw(::com::sun::star::uno::RuntimeException)
152cdf0e10cSrcweir 		{ return 0; }
setLong(sal_Int32 _long)153cdf0e10cSrcweir     virtual void SAL_CALL setLong( sal_Int32 _long ) throw(::com::sun::star::uno::RuntimeException)
154cdf0e10cSrcweir 		{}
getHyper()155cdf0e10cSrcweir     virtual sal_Int64 SAL_CALL getHyper() throw(::com::sun::star::uno::RuntimeException)
156cdf0e10cSrcweir 		{ return 0; }
setHyper(sal_Int64 _hyper)157cdf0e10cSrcweir     virtual void SAL_CALL setHyper( sal_Int64 _hyper ) throw(::com::sun::star::uno::RuntimeException)
158cdf0e10cSrcweir 		{}
getFloat()159cdf0e10cSrcweir     virtual float SAL_CALL getFloat() throw(::com::sun::star::uno::RuntimeException)
160cdf0e10cSrcweir 		{ return 0; }
setFloat(float _float)161cdf0e10cSrcweir     virtual void SAL_CALL setFloat( float _float ) throw(::com::sun::star::uno::RuntimeException)
162cdf0e10cSrcweir 		{}
getDouble()163cdf0e10cSrcweir     virtual double SAL_CALL getDouble() throw(::com::sun::star::uno::RuntimeException)
164cdf0e10cSrcweir 		{ return 0; }
setDouble(double _double)165cdf0e10cSrcweir     virtual void SAL_CALL setDouble( double _double ) throw(::com::sun::star::uno::RuntimeException)
166cdf0e10cSrcweir 		{}
getString()167cdf0e10cSrcweir     virtual OUString SAL_CALL getString() throw(::com::sun::star::uno::RuntimeException)
168cdf0e10cSrcweir 		{ return _aDummyString; }
setString(const::rtl::OUString & _string)169cdf0e10cSrcweir     virtual void SAL_CALL setString( const ::rtl::OUString& _string ) throw(::com::sun::star::uno::RuntimeException)
170cdf0e10cSrcweir 		{}
getInterface()171cdf0e10cSrcweir     virtual Reference< XInterface > SAL_CALL getInterface() throw(::com::sun::star::uno::RuntimeException)
172cdf0e10cSrcweir 		{ return Reference< XInterface >(); }
setInterface(const::com::sun::star::uno::Reference<::com::sun::star::uno::XInterface> & _interface)173cdf0e10cSrcweir     virtual void SAL_CALL setInterface( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _interface ) throw(::com::sun::star::uno::RuntimeException)
174cdf0e10cSrcweir 		{}
getAny()175cdf0e10cSrcweir     virtual Any SAL_CALL getAny() throw(::com::sun::star::uno::RuntimeException)
176cdf0e10cSrcweir 		{ return _aDummyAny; }
setAny(const::com::sun::star::uno::Any & _any)177cdf0e10cSrcweir     virtual void SAL_CALL setAny( const ::com::sun::star::uno::Any& _any ) throw(::com::sun::star::uno::RuntimeException)
178cdf0e10cSrcweir 		{}
getSequence()179cdf0e10cSrcweir     virtual Sequence< Reference< XInterface > > SAL_CALL getSequence() throw(::com::sun::star::uno::RuntimeException)
180cdf0e10cSrcweir 		{ return _aDummySequence; }
setSequence(const Sequence<Reference<XInterface>> & _sequence)181cdf0e10cSrcweir     virtual void SAL_CALL setSequence( const Sequence< Reference< XInterface > >& _sequence ) throw(::com::sun::star::uno::RuntimeException)
182cdf0e10cSrcweir 		{}
getStruct()183cdf0e10cSrcweir     virtual ComplexTypes SAL_CALL getStruct() throw(::com::sun::star::uno::RuntimeException)
184cdf0e10cSrcweir 		{ return _aDummyStruct; }
setStruct(const::com::sun::star::test::performance::ComplexTypes & c)185cdf0e10cSrcweir     virtual void SAL_CALL setStruct( const ::com::sun::star::test::performance::ComplexTypes& c ) throw(::com::sun::star::uno::RuntimeException)
186cdf0e10cSrcweir 		{}
187cdf0e10cSrcweir 
async()188cdf0e10cSrcweir     virtual void SAL_CALL async() throw(::com::sun::star::uno::RuntimeException)
189cdf0e10cSrcweir 		{}
sync()190cdf0e10cSrcweir     virtual void SAL_CALL sync() throw(::com::sun::star::uno::RuntimeException)
191cdf0e10cSrcweir 		{}
complex_in(const::com::sun::star::test::performance::ComplexTypes & aVal)192cdf0e10cSrcweir     virtual ComplexTypes SAL_CALL complex_in( const ::com::sun::star::test::performance::ComplexTypes& aVal ) throw(::com::sun::star::uno::RuntimeException)
193cdf0e10cSrcweir 		{ return aVal; }
complex_inout(::com::sun::star::test::performance::ComplexTypes & aVal)194cdf0e10cSrcweir     virtual ComplexTypes SAL_CALL complex_inout( ::com::sun::star::test::performance::ComplexTypes& aVal ) throw(::com::sun::star::uno::RuntimeException)
195cdf0e10cSrcweir 		{ return aVal; }
complex_oneway(const::com::sun::star::test::performance::ComplexTypes & aVal)196cdf0e10cSrcweir     virtual void SAL_CALL complex_oneway( const ::com::sun::star::test::performance::ComplexTypes& aVal ) throw(::com::sun::star::uno::RuntimeException)
197cdf0e10cSrcweir 		{}
complex_noreturn(const::com::sun::star::test::performance::ComplexTypes & aVal)198cdf0e10cSrcweir     virtual void SAL_CALL complex_noreturn( const ::com::sun::star::test::performance::ComplexTypes& aVal ) throw(::com::sun::star::uno::RuntimeException)
199cdf0e10cSrcweir 		{}
createObject()200cdf0e10cSrcweir     virtual Reference< XPerformanceTest > SAL_CALL createObject() throw(::com::sun::star::uno::RuntimeException)
201cdf0e10cSrcweir 		{ return new ServiceImpl(); }
raiseRuntimeException()202cdf0e10cSrcweir     virtual void SAL_CALL raiseRuntimeException(  ) throw(::com::sun::star::uno::RuntimeException)
203cdf0e10cSrcweir 		{ throw _aDummyRE; }
204cdf0e10cSrcweir };
205cdf0e10cSrcweir 
206cdf0e10cSrcweir //##################################################################################################
207cdf0e10cSrcweir 
208cdf0e10cSrcweir // XServiceInfo
209cdf0e10cSrcweir //__________________________________________________________________________________________________
getImplementationName()210cdf0e10cSrcweir OUString ServiceImpl::getImplementationName()
211cdf0e10cSrcweir 	throw (RuntimeException)
212cdf0e10cSrcweir {
213cdf0e10cSrcweir 	return OUString( RTL_CONSTASCII_USTRINGPARAM(IMPLNAME) );
214cdf0e10cSrcweir }
215cdf0e10cSrcweir //__________________________________________________________________________________________________
supportsService(const OUString & rServiceName)216cdf0e10cSrcweir sal_Bool ServiceImpl::supportsService( const OUString & rServiceName )
217cdf0e10cSrcweir 	throw (RuntimeException)
218cdf0e10cSrcweir {
219cdf0e10cSrcweir 	const Sequence< OUString > & rSNL = getSupportedServiceNames();
220cdf0e10cSrcweir 	const OUString * pArray = rSNL.getConstArray();
221cdf0e10cSrcweir 	for ( sal_Int32 nPos = rSNL.getLength(); nPos--; )
222cdf0e10cSrcweir 	{
223cdf0e10cSrcweir 		if (pArray[nPos] == rServiceName)
224cdf0e10cSrcweir 			return sal_True;
225cdf0e10cSrcweir 	}
226cdf0e10cSrcweir 	return sal_False;
227cdf0e10cSrcweir }
228cdf0e10cSrcweir //__________________________________________________________________________________________________
getSupportedServiceNames()229cdf0e10cSrcweir Sequence< OUString > ServiceImpl::getSupportedServiceNames()
230cdf0e10cSrcweir 	throw (RuntimeException)
231cdf0e10cSrcweir {
232cdf0e10cSrcweir 	return benchmark_object::getSupportedServiceNames();
233cdf0e10cSrcweir }
234cdf0e10cSrcweir 
235cdf0e10cSrcweir // ...
236cdf0e10cSrcweir 
237cdf0e10cSrcweir //==================================================================================================
ServiceImpl_create(const Reference<XMultiServiceFactory> & xSMgr)238cdf0e10cSrcweir static Reference< XInterface > SAL_CALL ServiceImpl_create( const Reference< XMultiServiceFactory > & xSMgr )
239cdf0e10cSrcweir {
240cdf0e10cSrcweir 	return Reference< XInterface >( (XPerformanceTest *)new ServiceImpl( xSMgr ) );
241cdf0e10cSrcweir }
242cdf0e10cSrcweir 
243cdf0e10cSrcweir }
244cdf0e10cSrcweir 
245cdf0e10cSrcweir 
246cdf0e10cSrcweir //##################################################################################################
247cdf0e10cSrcweir //##################################################################################################
248cdf0e10cSrcweir //##################################################################################################
249cdf0e10cSrcweir 
250cdf0e10cSrcweir 
251cdf0e10cSrcweir extern "C"
252cdf0e10cSrcweir {
253cdf0e10cSrcweir //==================================================================================================
component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName,uno_Environment ** ppEnv)254cdf0e10cSrcweir void SAL_CALL component_getImplementationEnvironment(
255cdf0e10cSrcweir 	const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv )
256cdf0e10cSrcweir {
257cdf0e10cSrcweir 	*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
258cdf0e10cSrcweir }
259cdf0e10cSrcweir //==================================================================================================
component_writeInfo(void * pServiceManager,void * pRegistryKey)260cdf0e10cSrcweir sal_Bool SAL_CALL component_writeInfo(
261cdf0e10cSrcweir 	void * pServiceManager, void * pRegistryKey )
262cdf0e10cSrcweir {
263cdf0e10cSrcweir 	if (pRegistryKey)
264cdf0e10cSrcweir 	{
265cdf0e10cSrcweir 		try
266cdf0e10cSrcweir 		{
267cdf0e10cSrcweir 			Reference< XRegistryKey > xNewKey(
268cdf0e10cSrcweir 				reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey(
269cdf0e10cSrcweir 					OUString( RTL_CONSTASCII_USTRINGPARAM("/" IMPLNAME "/UNO/SERVICES") ) ) );
270cdf0e10cSrcweir 			xNewKey->createKey( OUString( RTL_CONSTASCII_USTRINGPARAM(SERVICENAME) ) );
271cdf0e10cSrcweir 
272cdf0e10cSrcweir 			return sal_True;
273cdf0e10cSrcweir 		}
274cdf0e10cSrcweir 		catch (InvalidRegistryException &)
275cdf0e10cSrcweir 		{
276cdf0e10cSrcweir 			OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
277cdf0e10cSrcweir 		}
278cdf0e10cSrcweir 	}
279cdf0e10cSrcweir 	return sal_False;
280cdf0e10cSrcweir }
281cdf0e10cSrcweir //==================================================================================================
component_getFactory(const sal_Char * pImplName,void * pServiceManager,void * pRegistryKey)282cdf0e10cSrcweir void * SAL_CALL component_getFactory(
283cdf0e10cSrcweir 	const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
284cdf0e10cSrcweir {
285cdf0e10cSrcweir 	void * pRet = 0;
286cdf0e10cSrcweir 
287cdf0e10cSrcweir 	if (pServiceManager && rtl_str_compare( pImplName, IMPLNAME ) == 0)
288cdf0e10cSrcweir 	{
289cdf0e10cSrcweir 		Reference< XSingleServiceFactory > xFactory( createSingleFactory(
290cdf0e10cSrcweir 			reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
291cdf0e10cSrcweir 			OUString( RTL_CONSTASCII_USTRINGPARAM(IMPLNAME) ),
292cdf0e10cSrcweir 			benchmark_object::ServiceImpl_create,
293cdf0e10cSrcweir 			benchmark_object::getSupportedServiceNames() ) );
294cdf0e10cSrcweir 
295cdf0e10cSrcweir 		if (xFactory.is())
296cdf0e10cSrcweir 		{
297cdf0e10cSrcweir 			xFactory->acquire();
298cdf0e10cSrcweir 			pRet = xFactory.get();
299cdf0e10cSrcweir 		}
300cdf0e10cSrcweir 	}
301cdf0e10cSrcweir 
302cdf0e10cSrcweir 	return pRet;
303cdf0e10cSrcweir }
304cdf0e10cSrcweir }
305