testcomp.cxx (61dff127) testcomp.cxx (27741b59)
1/**************************************************************
1/**************************************************************
2 *
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
19 *
20 *************************************************************/
21
22
23
24// MARKER(update_precomp.py): autogen include statement, do not remove
25#include "precompiled_bridges.hxx"
26#include <string.h>
27#include <stdlib.h>

--- 44 unchanged lines hidden (view full) ---

72 nArgIndex = 2;
73 }
74
75 OUString sTemp = OUString::createFromAscii( argv[nArgIndex] );
76 sal_Int32 nIndex = sTemp.indexOf( ';' );
77 if( -1 == nIndex )
78 {
79 *pConnection = sTemp;
20 *************************************************************/
21
22
23
24// MARKER(update_precomp.py): autogen include statement, do not remove
25#include "precompiled_bridges.hxx"
26#include <string.h>
27#include <stdlib.h>

--- 44 unchanged lines hidden (view full) ---

72 nArgIndex = 2;
73 }
74
75 OUString sTemp = OUString::createFromAscii( argv[nArgIndex] );
76 sal_Int32 nIndex = sTemp.indexOf( ';' );
77 if( -1 == nIndex )
78 {
79 *pConnection = sTemp;
80 *pProtocol = OUString( RTL_CONSTASCII_USTRINGPARAM( "iiop" ) );
80 *pProtocol = OUString( RTL_CONSTASCII_USTRINGPARAM( "iiop" ) );
81 }
82 else
83 {
84 *pConnection = sTemp.copy( 0 , nIndex );
85 *pProtocol = sTemp.copy( nIndex+1, sTemp.getLength() - (nIndex+1) );
86 }
87}
88
81 }
82 else
83 {
84 *pConnection = sTemp.copy( 0 , nIndex );
85 *pProtocol = sTemp.copy( nIndex+1, sTemp.getLength() - (nIndex+1) );
86 }
87}
88
89Any OInstanceProvider::queryInterface( const Type & aType ) throw ( RuntimeException )
89Any OInstanceProvider::queryInterface( const Type & aType ) throw ( RuntimeException )
90{
91 Any a = ::cppu::queryInterface( aType ,
92 SAL_STATIC_CAST( XInstanceProvider * , this ) );
93 if( a.hasValue() )
94 {
90{
91 Any a = ::cppu::queryInterface( aType ,
92 SAL_STATIC_CAST( XInstanceProvider * , this ) );
93 if( a.hasValue() )
94 {
95 return a;
95 return a;
96 }
97 return OWeakObject::queryInterface( aType );
98}
99
100::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
101 OInstanceProvider::getInstance( const ::rtl::OUString& sObjectName )
102 throw(::com::sun::star::container::NoSuchElementException,
103 ::com::sun::star::uno::RuntimeException)

--- 23 unchanged lines hidden (view full) ---

127 ServiceImpl()
128 : _nRef( 0 )
129 {}
130 ServiceImpl( const Reference< XMultiServiceFactory > & /* xMgr */)
131 : _nRef( 0 )
132 {}
133
134 // XInterface
96 }
97 return OWeakObject::queryInterface( aType );
98}
99
100::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
101 OInstanceProvider::getInstance( const ::rtl::OUString& sObjectName )
102 throw(::com::sun::star::container::NoSuchElementException,
103 ::com::sun::star::uno::RuntimeException)

--- 23 unchanged lines hidden (view full) ---

127 ServiceImpl()
128 : _nRef( 0 )
129 {}
130 ServiceImpl( const Reference< XMultiServiceFactory > & /* xMgr */)
131 : _nRef( 0 )
132 {}
133
134 // XInterface
135 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException)
135 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException)
136 {
137 // execution time remains appr. constant any time
138 Any aRet;
139 if (aType == ::getCppuType( (const Reference< XInterface > *)0 ))
140 {
141 void * p = (XInterface *)(XPerformanceTest *)this;
142 aRet.setValue( &p, ::getCppuType( (const Reference< XInterface > *)0 ) );
143 }

--- 4 unchanged lines hidden (view full) ---

148 }
149 if (! aRet.hasValue())
150 {
151 void * p = (XPerformanceTest *)this;
152 Any aDummy( &p, ::getCppuType( (const Reference< XPerformanceTest > *)0 ) );
153 }
154 return aRet;
155 }
136 {
137 // execution time remains appr. constant any time
138 Any aRet;
139 if (aType == ::getCppuType( (const Reference< XInterface > *)0 ))
140 {
141 void * p = (XInterface *)(XPerformanceTest *)this;
142 aRet.setValue( &p, ::getCppuType( (const Reference< XInterface > *)0 ) );
143 }

--- 4 unchanged lines hidden (view full) ---

148 }
149 if (! aRet.hasValue())
150 {
151 void * p = (XPerformanceTest *)this;
152 Any aDummy( &p, ::getCppuType( (const Reference< XPerformanceTest > *)0 ) );
153 }
154 return aRet;
155 }
156 virtual void SAL_CALL acquire() throw()
156 virtual void SAL_CALL acquire() throw()
157 { osl_incrementInterlockedCount( &_nRef ); }
157 { osl_incrementInterlockedCount( &_nRef ); }
158 virtual void SAL_CALL release() throw()
158 virtual void SAL_CALL release() throw()
159 { if (! osl_decrementInterlockedCount( &_nRef )) delete this; }
160
161 // XServiceInfo
162 virtual OUString SAL_CALL getImplementationName() throw (RuntimeException);
163 virtual sal_Bool SAL_CALL supportsService( const OUString & rServiceName ) throw (RuntimeException);
164 virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (RuntimeException);
165
159 { if (! osl_decrementInterlockedCount( &_nRef )) delete this; }
160
161 // XServiceInfo
162 virtual OUString SAL_CALL getImplementationName() throw (RuntimeException);
163 virtual sal_Bool SAL_CALL supportsService( const OUString & rServiceName ) throw (RuntimeException);
164 virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (RuntimeException);
165
166 // Attributes
167 virtual sal_Int32 SAL_CALL getLong_attr() throw(::com::sun::star::uno::RuntimeException)
166 // Attributes
167 virtual sal_Int32 SAL_CALL getLong_attr() throw(::com::sun::star::uno::RuntimeException)
168 { return 0; }
168 { return 0; }
169 virtual void SAL_CALL setLong_attr( sal_Int32 /* _attributelong */) throw(::com::sun::star::uno::RuntimeException)
169 virtual void SAL_CALL setLong_attr( sal_Int32 /* _attributelong */) throw(::com::sun::star::uno::RuntimeException)
170 {}
170 {}
171 virtual sal_Int64 SAL_CALL getHyper_attr() throw(::com::sun::star::uno::RuntimeException)
171 virtual sal_Int64 SAL_CALL getHyper_attr() throw(::com::sun::star::uno::RuntimeException)
172 { return 0; }
172 { return 0; }
173 virtual void SAL_CALL setHyper_attr( sal_Int64 /* _attributehyper */) throw(::com::sun::star::uno::RuntimeException)
173 virtual void SAL_CALL setHyper_attr( sal_Int64 /* _attributehyper */) throw(::com::sun::star::uno::RuntimeException)
174 {}
174 {}
175 virtual float SAL_CALL getFloat_attr() throw(::com::sun::star::uno::RuntimeException)
175 virtual float SAL_CALL getFloat_attr() throw(::com::sun::star::uno::RuntimeException)
176 { return 0.0; }
176 { return 0.0; }
177 virtual void SAL_CALL setFloat_attr( float /* _attributefloat */) throw(::com::sun::star::uno::RuntimeException)
177 virtual void SAL_CALL setFloat_attr( float /* _attributefloat */) throw(::com::sun::star::uno::RuntimeException)
178 {}
178 {}
179 virtual double SAL_CALL getDouble_attr() throw(::com::sun::star::uno::RuntimeException)
179 virtual double SAL_CALL getDouble_attr() throw(::com::sun::star::uno::RuntimeException)
180 { return 0.0; }
180 { return 0.0; }
181 virtual void SAL_CALL setDouble_attr( double /* _attributedouble */) throw(::com::sun::star::uno::RuntimeException)
181 virtual void SAL_CALL setDouble_attr( double /* _attributedouble */) throw(::com::sun::star::uno::RuntimeException)
182 {}
182 {}
183 virtual OUString SAL_CALL getString_attr() throw(::com::sun::star::uno::RuntimeException)
183 virtual OUString SAL_CALL getString_attr() throw(::com::sun::star::uno::RuntimeException)
184 { return _aDummyString; }
184 { return _aDummyString; }
185 virtual void SAL_CALL setString_attr( const ::rtl::OUString& /* _attributestring */) throw(::com::sun::star::uno::RuntimeException)
185 virtual void SAL_CALL setString_attr( const ::rtl::OUString& /* _attributestring */) throw(::com::sun::star::uno::RuntimeException)
186 {}
186 {}
187 virtual Reference< XInterface > SAL_CALL getInterface_attr() throw(::com::sun::star::uno::RuntimeException)
187 virtual Reference< XInterface > SAL_CALL getInterface_attr() throw(::com::sun::star::uno::RuntimeException)
188 { return Reference< XInterface >(); }
188 { return Reference< XInterface >(); }
189 virtual void SAL_CALL setInterface_attr( const Reference< XInterface >& /* _attributeinterface */) throw(::com::sun::star::uno::RuntimeException)
189 virtual void SAL_CALL setInterface_attr( const Reference< XInterface >& /* _attributeinterface */) throw(::com::sun::star::uno::RuntimeException)
190 {}
190 {}
191 virtual Any SAL_CALL getAny_attr() throw(::com::sun::star::uno::RuntimeException)
191 virtual Any SAL_CALL getAny_attr() throw(::com::sun::star::uno::RuntimeException)
192 { return _aDummyAny; }
192 { return _aDummyAny; }
193 virtual void SAL_CALL setAny_attr( const Any& /* _attributeany */) throw(::com::sun::star::uno::RuntimeException)
193 virtual void SAL_CALL setAny_attr( const Any& /* _attributeany */) throw(::com::sun::star::uno::RuntimeException)
194 {}
194 {}
195 virtual Sequence< Reference< XInterface > > SAL_CALL getSequence_attr() throw(::com::sun::star::uno::RuntimeException)
195 virtual Sequence< Reference< XInterface > > SAL_CALL getSequence_attr() throw(::com::sun::star::uno::RuntimeException)
196 { return _aDummySequence; }
196 { return _aDummySequence; }
197 virtual void SAL_CALL setSequence_attr( const Sequence< Reference< XInterface > >& /* _attributesequence */) throw(::com::sun::star::uno::RuntimeException)
197 virtual void SAL_CALL setSequence_attr( const Sequence< Reference< XInterface > >& /* _attributesequence */) throw(::com::sun::star::uno::RuntimeException)
198 {}
198 {}
199 virtual ComplexTypes SAL_CALL getStruct_attr() throw(::com::sun::star::uno::RuntimeException)
199 virtual ComplexTypes SAL_CALL getStruct_attr() throw(::com::sun::star::uno::RuntimeException)
200 { return _aDummyStruct; }
200 { return _aDummyStruct; }
201 virtual void SAL_CALL setStruct_attr( const ::com::sun::star::test::performance::ComplexTypes& /* _attributestruct */) throw(::com::sun::star::uno::RuntimeException)
201 virtual void SAL_CALL setStruct_attr( const ::com::sun::star::test::performance::ComplexTypes& /* _attributestruct */) throw(::com::sun::star::uno::RuntimeException)
202 {}
203
202 {}
203
204 // Methods
205 virtual sal_Int32 SAL_CALL getLong() throw(::com::sun::star::uno::RuntimeException)
204 // Methods
205 virtual sal_Int32 SAL_CALL getLong() throw(::com::sun::star::uno::RuntimeException)
206 { return 0; }
206 { return 0; }
207 virtual void SAL_CALL setLong( sal_Int32 /* _long */) throw(::com::sun::star::uno::RuntimeException)
207 virtual void SAL_CALL setLong( sal_Int32 /* _long */) throw(::com::sun::star::uno::RuntimeException)
208 {}
208 {}
209 virtual sal_Int64 SAL_CALL getHyper() throw(::com::sun::star::uno::RuntimeException)
209 virtual sal_Int64 SAL_CALL getHyper() throw(::com::sun::star::uno::RuntimeException)
210 { return 0; }
210 { return 0; }
211 virtual void SAL_CALL setHyper( sal_Int64 /* _hyper */) throw(::com::sun::star::uno::RuntimeException)
211 virtual void SAL_CALL setHyper( sal_Int64 /* _hyper */) throw(::com::sun::star::uno::RuntimeException)
212 {}
212 {}
213 virtual float SAL_CALL getFloat() throw(::com::sun::star::uno::RuntimeException)
213 virtual float SAL_CALL getFloat() throw(::com::sun::star::uno::RuntimeException)
214 { return 0; }
214 { return 0; }
215 virtual void SAL_CALL setFloat( float /* _float */) throw(::com::sun::star::uno::RuntimeException)
215 virtual void SAL_CALL setFloat( float /* _float */) throw(::com::sun::star::uno::RuntimeException)
216 {}
216 {}
217 virtual double SAL_CALL getDouble() throw(::com::sun::star::uno::RuntimeException)
217 virtual double SAL_CALL getDouble() throw(::com::sun::star::uno::RuntimeException)
218 { return 0; }
218 { return 0; }
219 virtual void SAL_CALL setDouble( double /* _double */) throw(::com::sun::star::uno::RuntimeException)
219 virtual void SAL_CALL setDouble( double /* _double */) throw(::com::sun::star::uno::RuntimeException)
220 {}
220 {}
221 virtual OUString SAL_CALL getString() throw(::com::sun::star::uno::RuntimeException)
221 virtual OUString SAL_CALL getString() throw(::com::sun::star::uno::RuntimeException)
222 { return _aDummyString; }
222 { return _aDummyString; }
223 virtual void SAL_CALL setString( const ::rtl::OUString& /* _string */) throw(::com::sun::star::uno::RuntimeException)
223 virtual void SAL_CALL setString( const ::rtl::OUString& /* _string */) throw(::com::sun::star::uno::RuntimeException)
224 {}
224 {}
225 virtual Reference< XInterface > SAL_CALL getInterface() throw(::com::sun::star::uno::RuntimeException)
225 virtual Reference< XInterface > SAL_CALL getInterface() throw(::com::sun::star::uno::RuntimeException)
226 { return Reference< XInterface >(); }
226 { return Reference< XInterface >(); }
227 virtual void SAL_CALL setInterface( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& /* _interface */) throw(::com::sun::star::uno::RuntimeException)
227 virtual void SAL_CALL setInterface( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& /* _interface */) throw(::com::sun::star::uno::RuntimeException)
228 {}
228 {}
229 virtual Any SAL_CALL getAny() throw(::com::sun::star::uno::RuntimeException)
229 virtual Any SAL_CALL getAny() throw(::com::sun::star::uno::RuntimeException)
230 { return _aDummyAny; }
230 { return _aDummyAny; }
231 virtual void SAL_CALL setAny( const ::com::sun::star::uno::Any& /* _any */) throw(::com::sun::star::uno::RuntimeException)
231 virtual void SAL_CALL setAny( const ::com::sun::star::uno::Any& /* _any */) throw(::com::sun::star::uno::RuntimeException)
232 {}
232 {}
233 virtual Sequence< Reference< XInterface > > SAL_CALL getSequence() throw(::com::sun::star::uno::RuntimeException)
233 virtual Sequence< Reference< XInterface > > SAL_CALL getSequence() throw(::com::sun::star::uno::RuntimeException)
234 { return _aDummySequence; }
234 { return _aDummySequence; }
235 virtual void SAL_CALL setSequence( const Sequence< Reference< XInterface > >& /*_sequence */) throw(::com::sun::star::uno::RuntimeException)
235 virtual void SAL_CALL setSequence( const Sequence< Reference< XInterface > >& /*_sequence */) throw(::com::sun::star::uno::RuntimeException)
236 {}
236 {}
237 virtual ComplexTypes SAL_CALL getStruct() throw(::com::sun::star::uno::RuntimeException)
237 virtual ComplexTypes SAL_CALL getStruct() throw(::com::sun::star::uno::RuntimeException)
238 { return _aDummyStruct; }
238 { return _aDummyStruct; }
239 virtual void SAL_CALL setStruct( const ::com::sun::star::test::performance::ComplexTypes& /* c */) throw(::com::sun::star::uno::RuntimeException)
239 virtual void SAL_CALL setStruct( const ::com::sun::star::test::performance::ComplexTypes& /* c */) throw(::com::sun::star::uno::RuntimeException)
240 {}
241
240 {}
241
242 virtual void SAL_CALL async() throw(::com::sun::star::uno::RuntimeException);
242 virtual void SAL_CALL async() throw(::com::sun::star::uno::RuntimeException);
243
243
244 virtual void SAL_CALL sync() throw(::com::sun::star::uno::RuntimeException)
244 virtual void SAL_CALL sync() throw(::com::sun::star::uno::RuntimeException)
245 {}
245 {}
246 virtual ComplexTypes SAL_CALL complex_in( const ::com::sun::star::test::performance::ComplexTypes& aVal ) throw(::com::sun::star::uno::RuntimeException)
246 virtual ComplexTypes SAL_CALL complex_in( const ::com::sun::star::test::performance::ComplexTypes& aVal ) throw(::com::sun::star::uno::RuntimeException)
247 { return aVal; }
247 { return aVal; }
248 virtual ComplexTypes SAL_CALL complex_inout( ::com::sun::star::test::performance::ComplexTypes& aVal ) throw(::com::sun::star::uno::RuntimeException)
248 virtual ComplexTypes SAL_CALL complex_inout( ::com::sun::star::test::performance::ComplexTypes& aVal ) throw(::com::sun::star::uno::RuntimeException)
249 { return aVal; }
249 { return aVal; }
250 virtual void SAL_CALL complex_oneway( const ::com::sun::star::test::performance::ComplexTypes& /* aVal */) throw(::com::sun::star::uno::RuntimeException)
250 virtual void SAL_CALL complex_oneway( const ::com::sun::star::test::performance::ComplexTypes& /* aVal */) throw(::com::sun::star::uno::RuntimeException)
251 {}
251 {}
252 virtual void SAL_CALL complex_noreturn( const ::com::sun::star::test::performance::ComplexTypes& /* aVal */) throw(::com::sun::star::uno::RuntimeException)
252 virtual void SAL_CALL complex_noreturn( const ::com::sun::star::test::performance::ComplexTypes& /* aVal */) throw(::com::sun::star::uno::RuntimeException)
253 {}
253 {}
254 virtual Reference< XPerformanceTest > SAL_CALL createObject() throw(::com::sun::star::uno::RuntimeException)
254 virtual Reference< XPerformanceTest > SAL_CALL createObject() throw(::com::sun::star::uno::RuntimeException)
255 { return new ServiceImpl(); }
255 { return new ServiceImpl(); }
256 virtual void SAL_CALL raiseRuntimeException( ) throw(::com::sun::star::uno::RuntimeException)
256 virtual void SAL_CALL raiseRuntimeException( ) throw(::com::sun::star::uno::RuntimeException)
257 { throw _aDummyRE; }
258};
259
260
261void ServiceImpl::async() throw(::com::sun::star::uno::RuntimeException)
262{}
263
264// XServiceInfo

--- 16 unchanged lines hidden (view full) ---

281 return Sequence< OUString > ();
282}
283
284/******************
285 * OCallMe
286 *
287 *****************/
288
257 { throw _aDummyRE; }
258};
259
260
261void ServiceImpl::async() throw(::com::sun::star::uno::RuntimeException)
262{}
263
264// XServiceInfo

--- 16 unchanged lines hidden (view full) ---

281 return Sequence< OUString > ();
282}
283
284/******************
285 * OCallMe
286 *
287 *****************/
288
289Any OCallMe::queryInterface( const Type & aType ) throw ( RuntimeException )
289Any OCallMe::queryInterface( const Type & aType ) throw ( RuntimeException )
290{
291 Any a = ::cppu::queryInterface( aType,
292 SAL_STATIC_CAST( XCallMe * , this ) );
293
294 if( a.hasValue() )
295 {
290{
291 Any a = ::cppu::queryInterface( aType,
292 SAL_STATIC_CAST( XCallMe * , this ) );
293
294 if( a.hasValue() )
295 {
296 return a;
296 return a;
297 }
298
299 return OWeakObject::queryInterface( aType );
300}
301
302void OCallMe::call( const ::rtl::OUString& s, sal_Int32 nToDo )
303 throw( RuntimeException, ::test::TestBridgeException)
304{

--- 26 unchanged lines hidden (view full) ---

331 m_nLastToDos = nToDo;
332
333
334 if( nToDo )
335 {
336 printf( "+" );
337 fflush( stdout );
338
297 }
298
299 return OWeakObject::queryInterface( aType );
300}
301
302void OCallMe::call( const ::rtl::OUString& s, sal_Int32 nToDo )
303 throw( RuntimeException, ::test::TestBridgeException)
304{

--- 26 unchanged lines hidden (view full) ---

331 m_nLastToDos = nToDo;
332
333
334 if( nToDo )
335 {
336 printf( "+" );
337 fflush( stdout );
338
339 TimeValue val = { nToDo , 0 };
339 TimeValue val = { nToDo , 0 };
340 osl_waitThread( &val );
341 printf( "-\n" );
342 }
343
344}
345
346::test::TestTypes SAL_CALL OCallMe::transport( const ::test::TestTypes& types )
347 throw(::com::sun::star::uno::RuntimeException)

--- 27 unchanged lines hidden (view full) ---

375 callAgainArg->callAgain( Reference< XCallMe > ( (XCallMe *) this ) , nToCall -1 );
376 }
377}
378
379/********************
380 * OInterfaceTest
381 *
382 *******************/
340 osl_waitThread( &val );
341 printf( "-\n" );
342 }
343
344}
345
346::test::TestTypes SAL_CALL OCallMe::transport( const ::test::TestTypes& types )
347 throw(::com::sun::star::uno::RuntimeException)

--- 27 unchanged lines hidden (view full) ---

375 callAgainArg->callAgain( Reference< XCallMe > ( (XCallMe *) this ) , nToCall -1 );
376 }
377}
378
379/********************
380 * OInterfaceTest
381 *
382 *******************/
383Any OInterfaceTest::queryInterface( const Type & aType ) throw ( RuntimeException )
383Any OInterfaceTest::queryInterface( const Type & aType ) throw ( RuntimeException )
384{
385 Any a = ::cppu::queryInterface( aType,
386 SAL_STATIC_CAST( XInterfaceTest * , this ) );
387 if( a.hasValue() )
388 {
389 return a;
390 }
391 return OWeakObject::queryInterface( aType );

--- 35 unchanged lines hidden (view full) ---

427{
428 if( m_rCallMe.is() )
429 {
430 m_rCallMe->call( OUString( RTL_CONSTASCII_USTRINGPARAM("This is my String during a callback!")) , 5);
431 }
432}
433
434
384{
385 Any a = ::cppu::queryInterface( aType,
386 SAL_STATIC_CAST( XInterfaceTest * , this ) );
387 if( a.hasValue() )
388 {
389 return a;
390 }
391 return OWeakObject::queryInterface( aType );

--- 35 unchanged lines hidden (view full) ---

427{
428 if( m_rCallMe.is() )
429 {
430 m_rCallMe->call( OUString( RTL_CONSTASCII_USTRINGPARAM("This is my String during a callback!")) , 5);
431 }
432}
433
434
435Any OTestFactory::queryInterface( const Type & aType ) throw ( RuntimeException )
435Any OTestFactory::queryInterface( const Type & aType ) throw ( RuntimeException )
436{
437 Any a = ::cppu::queryInterface( aType,
438 SAL_STATIC_CAST( XTestFactory * , this ) );
439
440 if( a.hasValue() )
441 {
436{
437 Any a = ::cppu::queryInterface( aType,
438 SAL_STATIC_CAST( XTestFactory * , this ) );
439
440 if( a.hasValue() )
441 {
442 return a;
442 return a;
443 }
444
445 return OWeakObject::queryInterface( aType );
446}
447
448Reference< ::test::XCallMe > OTestFactory::createCallMe( )
449 throw(RuntimeException)
450{

--- 56 unchanged lines hidden (view full) ---

507 int nToDo,
508 double *pdAfterExecution
509 )
510{
511 TimeValue aStartTime, aEndTime, aAfterExecution;
512 osl_getSystemTime( &aStartTime );
513 for( sal_Int32 i = 0; i < nLoops; i ++ )
514 {
443 }
444
445 return OWeakObject::queryInterface( aType );
446}
447
448Reference< ::test::XCallMe > OTestFactory::createCallMe( )
449 throw(RuntimeException)
450{

--- 56 unchanged lines hidden (view full) ---

507 int nToDo,
508 double *pdAfterExecution
509 )
510{
511 TimeValue aStartTime, aEndTime, aAfterExecution;
512 osl_getSystemTime( &aStartTime );
513 for( sal_Int32 i = 0; i < nLoops; i ++ )
514 {
515// rCall->callOneway( OUString( RTL_CONSTASCII_USTRINGPARAM("Performance test string" )), 0 );
516 rCall->drawLine( 0 , 0 , 500 , 123 );
515// rCall->callOneway( OUString( RTL_CONSTASCII_USTRINGPARAM("Performance test string" )), 0 );
516 rCall->drawLine( 0 , 0 , 500 , 123 );
517 }
518 osl_getSystemTime( &aEndTime );
519
520 rCall->call( OUString( RTL_CONSTASCII_USTRINGPARAM("Performance test string")) , nToDo );
521 osl_getSystemTime( &aAfterExecution );
522
523 double fStart = (double)aStartTime.Seconds + ((double)aStartTime.Nanosec / 1000000000.0);
524 double fEnd = (double)aEndTime.Seconds + ((double)aEndTime.Nanosec / 1000000000.0);
517 }
518 osl_getSystemTime( &aEndTime );
519
520 rCall->call( OUString( RTL_CONSTASCII_USTRINGPARAM("Performance test string")) , nToDo );
521 osl_getSystemTime( &aAfterExecution );
522
523 double fStart = (double)aStartTime.Seconds + ((double)aStartTime.Nanosec / 1000000000.0);
524 double fEnd = (double)aEndTime.Seconds + ((double)aEndTime.Nanosec / 1000000000.0);
525 *pdAfterExecution = (double)aAfterExecution.Seconds +
526 ((double)aAfterExecution.Nanosec / 1000000000.0) - fStart;
525 *pdAfterExecution = (double)aAfterExecution.Seconds +
526 ((double)aAfterExecution.Nanosec / 1000000000.0) - fStart;
527 return fEnd-fStart;
528}
529
530void testOnewayPerformanceOnTwoInterfaces(
531 const Reference < XCallMe > &rRemote1, const Reference < XCallMe > &rRemote2 )
532{
527 return fEnd-fStart;
528}
529
530void testOnewayPerformanceOnTwoInterfaces(
531 const Reference < XCallMe > &rRemote1, const Reference < XCallMe > &rRemote2 )
532{
533 printf( "Doing oneway performance test on two interfaces ...\n" );
533 printf( "Doing one way performance test on two interfaces ...\n" );
534 const sal_Int32 nLoops = 10000;
535 TimeValue aStartTime, aEndTime;
536 osl_getSystemTime( &aStartTime );
537 for( sal_Int32 i = 0; i < nLoops ; i ++ )
538 {
534 const sal_Int32 nLoops = 10000;
535 TimeValue aStartTime, aEndTime;
536 osl_getSystemTime( &aStartTime );
537 for( sal_Int32 i = 0; i < nLoops ; i ++ )
538 {
539 rRemote1->drawLine( 0 , 0 , 500 , 123 );
540 rRemote2->drawLine( 0 , 0 , 500 , 123 );
539 rRemote1->drawLine( 0 , 0 , 500 , 123 );
540 rRemote2->drawLine( 0 , 0 , 500 , 123 );
541 }
542 osl_getSystemTime( &aEndTime );
543 double fStart = (double)aStartTime.Seconds + ((double)aStartTime.Nanosec / 1000000000.0);
544 double fEnd = (double)aEndTime.Seconds + ((double)aEndTime.Nanosec / 1000000000.0);
545
541 }
542 osl_getSystemTime( &aEndTime );
543 double fStart = (double)aStartTime.Seconds + ((double)aStartTime.Nanosec / 1000000000.0);
544 double fEnd = (double)aEndTime.Seconds + ((double)aEndTime.Nanosec / 1000000000.0);
545
546 printf( "Overhead per Call [ms] %g\n" , ((fEnd-fStart)/((double)nLoops/1000 ))/2. );
546 printf( "Overhead per Call [ms] %g\n" , ((fEnd-fStart)/((double)nLoops/1000 ))/2. );
547}
548
549void testPerformance( const Reference < XCallMe > &rRemote,
550 const Reference < XCallMe > &rLocal )
551{
552 OUString aTestString;
553
554 sal_Int32 nDoSomething = 1;
555 sal_Int32 nCalls = 80000;
556 double dRemote, dLocal,dAfterExecution;
557
547}
548
549void testPerformance( const Reference < XCallMe > &rRemote,
550 const Reference < XCallMe > &rLocal )
551{
552 OUString aTestString;
553
554 sal_Int32 nDoSomething = 1;
555 sal_Int32 nCalls = 80000;
556 double dRemote, dLocal,dAfterExecution;
557
558 printf( "performance test oneway...\n" );
559 dLocal = getCallsPerSecOneway( rLocal , nCalls , nDoSomething , &dAfterExecution);
560 dRemote = getCallsPerSecOneway( rRemote , nCalls , nDoSomething , &dAfterExecution);
561 printf( "Local=%g s,"
562 "Remote : %g s\n" , dLocal, dRemote );
563 if( dLocal > 0. )
564 {
565 printf( "Remote/Local : %g\n", dRemote/dLocal );
566 }
558 printf( "performance test oneway...\n" );
559 dLocal = getCallsPerSecOneway( rLocal , nCalls , nDoSomething , &dAfterExecution);
560 dRemote = getCallsPerSecOneway( rRemote , nCalls , nDoSomething , &dAfterExecution);
561 printf( "Local=%g s,"
562 "Remote : %g s\n" , dLocal, dRemote );
563 if( dLocal > 0. )
564 {
565 printf( "Remote/Local : %g\n", dRemote/dLocal );
566 }
567
567
568 printf( "Overhead per Call [ms] %g\n" , (dRemote - dLocal)/((double)nCalls/1000 ) );
569 printf( "Overhead per Call after completion [ms] %g\n" , (dAfterExecution - dLocal)/((double)nCalls/1000 ) );
568 printf( "Overhead per Call [ms] %g\n" , (dRemote - dLocal)/((double)nCalls/1000 ) );
569 printf( "Overhead per Call after completion [ms] %g\n" , (dAfterExecution - dLocal)/((double)nCalls/1000 ) );
570
570
571 nCalls = 2000;
571 nCalls = 2000;
572
572
573 printf( "Doing performance test ...\n" );
574 dRemote = getCallsPerSec( rRemote , nCalls , nDoSomething );
575 dLocal = getCallsPerSec( rLocal , nCalls , nDoSomething );
576 printf( "Local=%g s,\n"
577 "Remote=%g s\n" , dLocal, dRemote );
578 if( dLocal > 0. )
579 {
580 printf( "Remote/Local : %g\n", dRemote/dLocal );
581 }
582 printf( "Overhead per synchron Call [ms] %g\n" , ((dRemote - dLocal)/((double)nCalls/1000 )) );
573 printf( "Doing performance test ...\n" );
574 dRemote = getCallsPerSec( rRemote , nCalls , nDoSomething );
575 dLocal = getCallsPerSec( rLocal , nCalls , nDoSomething );
576 printf( "Local=%g s,\n"
577 "Remote=%g s\n" , dLocal, dRemote );
578 if( dLocal > 0. )
579 {
580 printf( "Remote/Local : %g\n", dRemote/dLocal );
581 }
582 printf( "Overhead per synchron Call [ms] %g\n" , ((dRemote - dLocal)/((double)nCalls/1000 )) );
583}
584
585void testException( const Reference < XCallMe > &r )
586{
587 try {
588 r->call( OUString( RTL_CONSTASCII_USTRINGPARAM("dummy")) , -1 );
583}
584
585void testException( const Reference < XCallMe > &r )
586{
587 try {
588 r->call( OUString( RTL_CONSTASCII_USTRINGPARAM("dummy")) , -1 );
589 OSL_ASSERT( ! "no exception flown !" );
589 OSL_ASSERT( ! "no exception flown!" );
590 }
590 }
591 catch( TestBridgeException & e )
591 catch( TestBridgeException & e )
592 {
593 // Exception flew successfully !
594 }
595 catch( Exception & e )
596 {
592 {
593 // Exception flew successfully !
594 }
595 catch( Exception & e )
596 {
597 OSL_ASSERT( ! "only base class of exception could be catched!" );
597 OSL_ASSERT( ! "only base class of exception could be caught!" );
598 }
599 catch(...)
600 {
598 }
599 catch(...)
600 {
601 OSL_ASSERT(! "wrong unknown exception !" );
601 OSL_ASSERT(! "wrong unknown exception!" );
602 }
603}
604
605void testSequenceOfCalls( const Reference< XCallMe > & rRCallMe )
606{
607 printf( "Testing sequence of calls\n" );
608 for( sal_Int32 i = 0 ; i < 800 ; i ++ )
609 {

--- 21 unchanged lines hidden (view full) ---

631 types.Float = (float)123.239;
632 types.Double = 1279.12490012;
633 types.String = OUString( RTL_CONSTASCII_USTRINGPARAM("abcdefghijklmnopqrstuvwxyz"));
634 types.Interface = Reference< XInterface >( rRCallMe , UNO_QUERY);
635 types.Any <<= types.Double;
636
637 TestTypes retTypes = rRCallMe->transport( types );
638
602 }
603}
604
605void testSequenceOfCalls( const Reference< XCallMe > & rRCallMe )
606{
607 printf( "Testing sequence of calls\n" );
608 for( sal_Int32 i = 0 ; i < 800 ; i ++ )
609 {

--- 21 unchanged lines hidden (view full) ---

631 types.Float = (float)123.239;
632 types.Double = 1279.12490012;
633 types.String = OUString( RTL_CONSTASCII_USTRINGPARAM("abcdefghijklmnopqrstuvwxyz"));
634 types.Interface = Reference< XInterface >( rRCallMe , UNO_QUERY);
635 types.Any <<= types.Double;
636
637 TestTypes retTypes = rRCallMe->transport( types );
638
639 OSL_ASSERT( ( types.Bool && retTypes.Bool ) || ( ! types.Bool && ! retTypes.Bool ) );
639 OSL_ASSERT( ( types.Bool && retTypes.Bool ) || ( ! types.Bool && ! retTypes.Bool ) );
640 OSL_ASSERT( types.Char == retTypes.Char );
641 OSL_ASSERT( types.Byte == retTypes.Byte );
642 OSL_ASSERT( types.Short == retTypes.Short );
643 OSL_ASSERT( types.UShort == retTypes.UShort );
644 OSL_ASSERT( types.Long == retTypes.Long );
645 OSL_ASSERT( types.ULong == retTypes.ULong );
646 OSL_ASSERT( types.Hyper == retTypes.Hyper );
647 OSL_ASSERT( types.UHyper == retTypes.UHyper );

--- 4 unchanged lines hidden (view full) ---

652 OSL_ASSERT( types.Any == retTypes.Any );
653 }
654
655}
656
657void testRemote( const Reference< XInterface > &rRemote )
658{
659 char a;
640 OSL_ASSERT( types.Char == retTypes.Char );
641 OSL_ASSERT( types.Byte == retTypes.Byte );
642 OSL_ASSERT( types.Short == retTypes.Short );
643 OSL_ASSERT( types.UShort == retTypes.UShort );
644 OSL_ASSERT( types.Long == retTypes.Long );
645 OSL_ASSERT( types.ULong == retTypes.ULong );
646 OSL_ASSERT( types.Hyper == retTypes.Hyper );
647 OSL_ASSERT( types.UHyper == retTypes.UHyper );

--- 4 unchanged lines hidden (view full) ---

652 OSL_ASSERT( types.Any == retTypes.Any );
653 }
654
655}
656
657void testRemote( const Reference< XInterface > &rRemote )
658{
659 char a;
660 getCppuType( (sal_Int8*)&a );
660 getCppuType( (sal_Int8*)&a );
661
662 Reference< XTestFactory > rRFact( rRemote , UNO_QUERY );
663 if( ! rRFact.is() )
664 {
665 printf( "remote object doesn't support XTestFactory\n" );
666 return;
667 }
668 OSL_ASSERT( rRFact.is() );
669 Reference< XCallMe > rLCallMe = (XCallMe * ) new OCallMe();
670 Reference< XCallMe > rRCallMe = rRFact->createCallMe();
671
661
662 Reference< XTestFactory > rRFact( rRemote , UNO_QUERY );
663 if( ! rRFact.is() )
664 {
665 printf( "remote object doesn't support XTestFactory\n" );
666 return;
667 }
668 OSL_ASSERT( rRFact.is() );
669 Reference< XCallMe > rLCallMe = (XCallMe * ) new OCallMe();
670 Reference< XCallMe > rRCallMe = rRFact->createCallMe();
671
672 testAllTypes( rLCallMe );
673 testAllTypes( rRCallMe );
672 testAllTypes( rLCallMe );
673 testAllTypes( rRCallMe );
674
674
675 printf( "Testing exception local ...\n" );
676 testException( rLCallMe );
675 printf( "Testing exception local ...\n" );
676 testException( rLCallMe );
677 printf( "Testing exception remote ...\n" );
678 testException( rRCallMe );
679
677 printf( "Testing exception remote ...\n" );
678 testException( rRCallMe );
679
680 //--------------------
681 // Test attributes
682 //----------------------
683 OUString ow = OUString::createFromAscii( "dum didel dum dideldei" );
684 rLCallMe->setsAttribute( ow );
685 OSL_ASSERT( rLCallMe->getsAttribute() == ow );
680 //--------------------
681 // Test attributes
682 //----------------------
683 OUString ow = OUString::createFromAscii( "dum didel dum dideldei" );
684 rLCallMe->setsAttribute( ow );
685 OSL_ASSERT( rLCallMe->getsAttribute() == ow );
686
686
687 rRCallMe->setsAttribute( ow );
688 OSL_ASSERT( rRCallMe->getsAttribute() == ow );
687 rRCallMe->setsAttribute( ow );
688 OSL_ASSERT( rRCallMe->getsAttribute() == ow );
689
690 //-------------------
691 // Performance test
692 //-------------------
693 testPerformance( rRCallMe , rLCallMe );
694 testOnewayPerformanceOnTwoInterfaces( rRFact->createCallMe(), rRCallMe );
695
696 //----------------
697 // Test sequence
698 //----------------
689
690 //-------------------
691 // Performance test
692 //-------------------
693 testPerformance( rRCallMe , rLCallMe );
694 testOnewayPerformanceOnTwoInterfaces( rRFact->createCallMe(), rRCallMe );
695
696 //----------------
697 // Test sequence
698 //----------------
699 testSequenceOfCalls( rRCallMe );
699 testSequenceOfCalls( rRCallMe );
700
701
702 // test triple to check if transporting the same interface multiple
703 // times causes any problems
700
701
702 // test triple to check if transporting the same interface multiple
703 // times causes any problems
704 Reference< XInterfaceTest > rRTest = rRFact->createInterfaceTest();
705 Reference< XInterfaceTest > rRTest2 = rRFact->createInterfaceTest();
706 Reference< XInterfaceTest > rRTest3 = rRFact->createInterfaceTest();
704 Reference< XInterfaceTest > rRTest = rRFact->createInterfaceTest();
705 Reference< XInterfaceTest > rRTest2 = rRFact->createInterfaceTest();
706 Reference< XInterfaceTest > rRTest3 = rRFact->createInterfaceTest();
707
708 rRTest->setIn( rRCallMe );
709 rRTest2->setIn( rRCallMe );
710 rRTest3->setIn( rRCallMe );
711
712 OSL_ASSERT( rRTest->get() == rRCallMe );
713 OSL_ASSERT( rRTest2->get() == rRCallMe );
714 OSL_ASSERT( rRTest3->get() == rRCallMe );
715
707
708 rRTest->setIn( rRCallMe );
709 rRTest2->setIn( rRCallMe );
710 rRTest3->setIn( rRCallMe );
711
712 OSL_ASSERT( rRTest->get() == rRCallMe );
713 OSL_ASSERT( rRTest2->get() == rRCallMe );
714 OSL_ASSERT( rRTest3->get() == rRCallMe );
715
716 rRTest->setIn( rLCallMe );
717 rRTest2->setIn( rLCallMe );
718 rRTest3->setIn( rLCallMe );
716 rRTest->setIn( rLCallMe );
717 rRTest2->setIn( rLCallMe );
718 rRTest3->setIn( rLCallMe );
719
720 {
721 Reference< XCallMe > rLCallMe1 = (XCallMe * ) new OCallMe();
722 Reference< XCallMe > rLCallMe2 = (XCallMe * ) new OCallMe();
723 Reference< XCallMe > rLCallMe3 = (XCallMe * ) new OCallMe();
724 rRTest->setIn( rLCallMe1 );
725 rRTest2->setIn( rLCallMe2 );
726 rRTest3->setIn( rLCallMe3 );

--- 13 unchanged lines hidden (view full) ---

740 Reference < XCallMe > r = rRCallMe;
741 rRTest->setInOut( r );
742 OSL_ASSERT( r == rLCallMe );
743 OSL_ASSERT( ! ( r == rRCallMe ) );
744
745 // test empty references
746 rRTest->setIn( Reference < XCallMe > () );
747
719
720 {
721 Reference< XCallMe > rLCallMe1 = (XCallMe * ) new OCallMe();
722 Reference< XCallMe > rLCallMe2 = (XCallMe * ) new OCallMe();
723 Reference< XCallMe > rLCallMe3 = (XCallMe * ) new OCallMe();
724 rRTest->setIn( rLCallMe1 );
725 rRTest2->setIn( rLCallMe2 );
726 rRTest3->setIn( rLCallMe3 );

--- 13 unchanged lines hidden (view full) ---

740 Reference < XCallMe > r = rRCallMe;
741 rRTest->setInOut( r );
742 OSL_ASSERT( r == rLCallMe );
743 OSL_ASSERT( ! ( r == rRCallMe ) );
744
745 // test empty references
746 rRTest->setIn( Reference < XCallMe > () );
747
748 //--------------------------------
749 // test thread deadlocking
750 //--------------------------------
751 rLCallMe->callAgain( rRCallMe, 20 );
748 //--------------------------------
749 // test thread deadlocking
750 //--------------------------------
751 rLCallMe->callAgain( rRCallMe, 20 );
752
753}
754
755
756
757
758
759
760Reference <XInterface > createComponent( const ::rtl::OUString &sService ,
761 const ::rtl::OUString &sDllName,
762 const Reference < XMultiServiceFactory > &rSMgr )
763{
764 Reference< XInterface > rInterface;
765 rInterface = rSMgr->createInstance( sService );
766
767 if( ! rInterface.is() )
768 {
752
753}
754
755
756
757
758
759
760Reference <XInterface > createComponent( const ::rtl::OUString &sService ,
761 const ::rtl::OUString &sDllName,
762 const Reference < XMultiServiceFactory > &rSMgr )
763{
764 Reference< XInterface > rInterface;
765 rInterface = rSMgr->createInstance( sService );
766
767 if( ! rInterface.is() )
768 {
769 // erst registrieren
769 // register first
770 Reference < XImplementationRegistration > rReg (
771 rSMgr->createInstance(
772 OUString::createFromAscii( "com.sun.star.registry.ImplementationRegistration" )),
773 UNO_QUERY );
774
775 OSL_ASSERT( rReg.is() );
776 OUString aDllName = sDllName;
770 Reference < XImplementationRegistration > rReg (
771 rSMgr->createInstance(
772 OUString::createFromAscii( "com.sun.star.registry.ImplementationRegistration" )),
773 UNO_QUERY );
774
775 OSL_ASSERT( rReg.is() );
776 OUString aDllName = sDllName;
777
777
778 try
779 {
780 rReg->registerImplementation(
781 OUString::createFromAscii( "com.sun.star.loader.SharedLibrary" ),
782 aDllName,
783 Reference< XSimpleRegistry > () );
784 rInterface = rSMgr->createInstance( sService );
785 }
786 catch( Exception & )
787 {
788 printf( "couldn't register dll %s\n" ,
778 try
779 {
780 rReg->registerImplementation(
781 OUString::createFromAscii( "com.sun.star.loader.SharedLibrary" ),
782 aDllName,
783 Reference< XSimpleRegistry > () );
784 rInterface = rSMgr->createInstance( sService );
785 }
786 catch( Exception & )
787 {
788 printf( "couldn't register dll %s\n" ,
789 OUStringToOString( aDllName, RTL_TEXTENCODING_ASCII_US ).getStr() );
789 OUStringToOString( aDllName, RTL_TEXTENCODING_ASCII_US ).getStr() );
790 }
791 }
792 return rInterface;
793}
794
790 }
791 }
792 return rInterface;
793}
794
795