1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 #include <sal/config.h>
27 #include <osl/conditn.hxx>
28 #include <osl/mutex.hxx>
29 #include <rtl/byteseq.hxx>
30 #include <rtl/ref.hxx>
31 #include <rtl/ustring.hxx>
32 #include <salhelper/thread.hxx>
33 #include <typelib/typedescription.hxx>
34 #include <uno/dispatcher.hxx>
36 #include "binaryany.hxx"
37 #include "marshal.hxx"
38 #include "writerstate.hxx"
40 namespace binaryurp
{ class Bridge
; }
44 class Writer
: public salhelper::Thread
47 explicit Writer(rtl::Reference
< Bridge
> const & bridge
);
49 // Only called from Bridge::reader_ thread, and only before Bridge::writer_
50 // thread is unblocked:
51 void sendDirectRequest(
52 rtl::ByteSequence
const & tid
, OUString
const & oid
,
53 com::sun::star::uno::TypeDescription
const & type
,
54 com::sun::star::uno::TypeDescription
const & member
,
55 std::vector
< BinaryAny
> const & inArguments
);
57 // Only called from Bridge::reader_ thread, and only before Bridge::writer_
58 // thread is unblocked:
60 rtl::ByteSequence
const & tid
,
61 com::sun::star::uno::TypeDescription
const & member
,
62 bool exception
, BinaryAny
const & returnValue
,
63 std::vector
< BinaryAny
> const & outArguments
);
66 rtl::ByteSequence
const & tid
, OUString
const & oid
,
67 com::sun::star::uno::TypeDescription
const & type
,
68 com::sun::star::uno::TypeDescription
const & member
,
69 std::vector
< BinaryAny
> const & inArguments
);
72 rtl::ByteSequence
const & tid
,
73 com::sun::star::uno::TypeDescription
const & member
, bool setter
,
74 bool exception
, BinaryAny
const & returnValue
,
75 std::vector
< BinaryAny
> const & outArguments
,
76 bool setCurrentContextMode
);
83 virtual ~Writer() override
;
85 virtual void execute() override
;
88 rtl::ByteSequence
const & tid
, OUString
const & oid
,
89 com::sun::star::uno::TypeDescription
const & type
,
90 com::sun::star::uno::TypeDescription
const & member
,
91 std::vector
< BinaryAny
> const & inArguments
, bool currentContextMode
,
92 com::sun::star::uno::UnoInterfaceReference
const & currentContext
);
95 rtl::ByteSequence
const & tid
,
96 com::sun::star::uno::TypeDescription
const & member
, bool setter
,
97 bool exception
, BinaryAny
const & returnValue
,
98 std::vector
< BinaryAny
> const & outArguments
);
100 void sendMessage(std::vector
< unsigned char > const & buffer
);
107 rtl::ByteSequence
const & theTid
, OUString
const & theOid
,
108 com::sun::star::uno::TypeDescription
const & theType
,
109 com::sun::star::uno::TypeDescription
const & theMember
,
110 std::vector
< BinaryAny
> const & inArguments
,
111 com::sun::star::uno::UnoInterfaceReference
const &
116 rtl::ByteSequence
const & theTid
,
117 com::sun::star::uno::TypeDescription
const & theMember
,
118 bool theSetter
, bool theException
, BinaryAny
const & theReturnValue
,
119 std::vector
< BinaryAny
> const & outArguments
,
120 bool theSetCurrentContextMode
);
124 rtl::ByteSequence tid
; // request + reply
126 OUString oid
; // request
128 com::sun::star::uno::TypeDescription type
; // request
130 com::sun::star::uno::TypeDescription member
; // request + reply
132 bool setter
; // reply
134 std::vector
< BinaryAny
> arguments
;
135 // request: inArguments; reply: outArguments
137 bool exception
; // reply
139 BinaryAny returnValue
; // reply
141 com::sun::star::uno::UnoInterfaceReference currentContext
; // request
143 bool setCurrentContextMode
; // reply
146 rtl::Reference
< Bridge
> bridge_
;
149 com::sun::star::uno::TypeDescription lastType_
;
151 rtl::ByteSequence lastTid_
;
152 osl::Condition unblocked_
;
153 osl::Condition items_
;
156 std::deque
< Item
> queue_
;
162 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */