xref: /aoo4110/main/binaryurp/source/reader.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_READER_HXX
25 #define INCLUDED_BINARYURP_SOURCE_READER_HXX
26 
27 #include "sal/config.h"
28 
29 #include <cstddef>
30 
31 #include "boost/noncopyable.hpp"
32 #include "osl/thread.hxx"
33 #include "rtl/byteseq.hxx"
34 #include "rtl/ref.hxx"
35 #include "rtl/ustring.hxx"
36 #include "sal/types.h"
37 #include "salhelper/simplereferenceobject.hxx"
38 #include "typelib/typedescription.hxx"
39 
40 #include "readerstate.hxx"
41 
42 namespace binaryurp {
43     class BinaryAny;
44     class Bridge;
45     class Unmarshal;
46 }
47 
48 namespace binaryurp {
49 
50 class Reader:
51     public osl::Thread, public salhelper::SimpleReferenceObject,
52     private boost::noncopyable
53 {
54 public:
operator new(std::size_t size)55     static void * operator new(std::size_t size)
56     { return Thread::operator new(size); }
57 
operator delete(void * pointer)58     static void operator delete(void * pointer)
59     { Thread::operator delete(pointer); }
60 
61     explicit Reader(rtl::Reference< Bridge > const & bridge);
62 
63 private:
64     virtual ~Reader();
65 
66     virtual void SAL_CALL run();
67 
68     virtual void SAL_CALL onTerminated();
69 
70     void readMessage(Unmarshal & unmarshal);
71 
72     void readReplyMessage(Unmarshal & unmarshal, sal_uInt8 flags1);
73 
74     rtl::ByteSequence getTid(Unmarshal & unmarshal, bool newTid) const;
75 
76     rtl::Reference< Bridge > bridge_;
77     com::sun::star::uno::TypeDescription lastType_;
78     rtl::OUString lastOid_;
79     rtl::ByteSequence lastTid_;
80     ReaderState state_;
81 };
82 
83 }
84 
85 #endif
86