xref: /aoo4110/main/binaryurp/source/proxy.hxx (revision b1cdbd2c)
1 /**************************************************************
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
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
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.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef INCLUDED_BINARYURP_SOURCE_PROXY_HXX
25 #define INCLUDED_BINARYURP_SOURCE_PROXY_HXX
26 
27 #include "sal/config.h"
28 
29 #include "boost/noncopyable.hpp"
30 #include "osl/interlck.h"
31 #include "rtl/ref.hxx"
32 #include "rtl/ustring.hxx"
33 #include "typelib/typedescription.h"
34 #include "typelib/typedescription.hxx"
35 #include "uno/any2.h"
36 #include "uno/dispatcher.h"
37 
38 namespace binaryurp { class Bridge; }
39 namespace com { namespace sun { namespace star { namespace uno {
40     class UnoInterfaceReference;
41 } } } }
42 
43 namespace binaryurp {
44 
45 class Proxy: public uno_Interface, private boost::noncopyable {
46 public:
47     Proxy(
48         rtl::Reference< Bridge > const & bridge, rtl::OUString const & oid,
49         com::sun::star::uno::TypeDescription const & type);
50 
51     rtl::OUString getOid() const;
52 
53     com::sun::star::uno::TypeDescription getType() const;
54 
55     void do_acquire();
56 
57     void do_release();
58 
59     void do_free();
60 
61     void do_dispatch(
62         typelib_TypeDescription const * member, void * returnValue,
63         void ** arguments, uno_Any ** exception) const;
64 
65     static bool isProxy(
66         rtl::Reference< Bridge > const & bridge,
67         com::sun::star::uno::UnoInterfaceReference const & object,
68         rtl::OUString * oid);
69 
70 private:
71     ~Proxy();
72 
73     void do_dispatch_throw(
74         typelib_TypeDescription const * member, void * returnValue,
75         void ** arguments, uno_Any ** exception) const;
76 
77     bool isProxy(rtl::Reference< Bridge > const & bridge, rtl::OUString * oid)
78         const;
79 
80     rtl::Reference< Bridge > bridge_;
81     rtl::OUString oid_;
82     com::sun::star::uno::TypeDescription type_;
83     oslInterlockedCount references_;
84 };
85 
86 }
87 
88 #endif
89