source: pacpusframework/trunk/3rd/apache-log4cxx/include/log4cxx/helpers/objectoutputstream.h@ 184

Last change on this file since 184 was 89, checked in by morasjul, 12 years ago

PACPUS 2.0 Beta deployed in new branch

Major changes:
-Add communication interface between components
-Add examples for communications interface (TestComponents)
-Move to Qt5 support

  • Property svn:executable set to *
File size: 3.6 KB
Line 
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef _LOG4CXX_HELPERS_OBJECTOUTPUTSTREAM_H
19#define _LOG4CXX_HELPERS_OBJECTOUTPUTSTREAM_H
20
21#include <log4cxx/helpers/objectimpl.h>
22#include <log4cxx/mdc.h>
23#include <log4cxx/helpers/outputstream.h>
24#include <log4cxx/helpers/charsetencoder.h>
25
26namespace log4cxx
27{
28
29 namespace helpers {
30
31 /**
32 * Emulates java serialization.
33 */
34 class LOG4CXX_EXPORT ObjectOutputStream : public ObjectImpl
35 {
36 public:
37 DECLARE_ABSTRACT_LOG4CXX_OBJECT(ObjectOutputStream)
38 BEGIN_LOG4CXX_CAST_MAP()
39 LOG4CXX_CAST_ENTRY(ObjectOutputStream)
40 END_LOG4CXX_CAST_MAP()
41
42 ObjectOutputStream(OutputStreamPtr os, Pool& p);
43 virtual ~ObjectOutputStream();
44
45 void close(Pool& p);
46 void flush(Pool& p);
47 void writeObject(const LogString&, Pool& p);
48 void writeUTFString(const std::string&, Pool& p);
49 void writeObject(const MDC::Map& mdc, Pool& p);
50 void writeInt(int val, Pool& p);
51 void writeLong(log4cxx_time_t val, Pool& p);
52 void writeProlog(const char* className,
53 int classDescIncrement,
54 char* bytes,
55 size_t len,
56 Pool& p);
57 void writeNull(Pool& p);
58
59 enum { STREAM_MAGIC = 0xACED };
60 enum { STREAM_VERSION = 5 };
61 enum { TC_NULL = 0x70,
62 TC_REFERENCE = 0x71,
63 TC_CLASSDESC = 0x72,
64 TC_OBJECT = 0x73,
65 TC_STRING = 0x74,
66 TC_ARRAY = 0x75,
67 TC_CLASS = 0x76,
68 TC_BLOCKDATA = 0x77,
69 TC_ENDBLOCKDATA = 0x78 };
70 enum {
71 SC_WRITE_METHOD = 0x01,
72 SC_SERIALIZABLE = 0x02 };
73
74 void writeByte(char val, Pool& p);
75 void writeBytes(const char* bytes, size_t len, Pool& p);
76
77 private:
78 ObjectOutputStream(const ObjectOutputStream&);
79 ObjectOutputStream& operator=(const ObjectOutputStream&);
80
81 OutputStreamPtr os;
82 log4cxx::helpers::CharsetEncoderPtr utf8Encoder;
83 unsigned int objectHandle;
84 typedef std::map<std::string, unsigned int> ClassDescriptionMap;
85 ClassDescriptionMap* classDescriptions;
86 };
87
88 LOG4CXX_PTR_DEF(ObjectOutputStream);
89
90 } // namespace helpers
91
92} //namespace log4cxx
93
94#endif //_LOG4CXX_HELPERS_OUTPUTSTREAM_H
95
Note: See TracBrowser for help on using the repository browser.