xref: /aoo4110/main/svx/source/inc/trace.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 #ifndef _TRACE_HXX_
24 #define _TRACE_HXX_
25 
26 #if defined(DBG_UTIL)
27 
28 #include <tools/string.hxx>
29 #include <vos/thread.hxx>
30 #include <vos/mutex.hxx>
31 #include <comphelper/stl_types.hxx>
32 
33 
34 class Tracer
35 {
36 	ByteString m_sBlockDescription;
37 
38 	DECLARE_STL_STDKEY_MAP( ::vos::OThread::TThreadIdentifier, sal_Int32, MapThreadId2Int );
39 	static MapThreadId2Int s_aThreadIndents;
40 
41 	static ::vos::OMutex	s_aMapSafety;
42 
43 public:
44 	Tracer(const char* _pBlockDescription);
45 	~Tracer();
46 
47 	void TraceString(const char* _pMessage);
48 	void TraceString1StringParam(const char* _pMessage, const char* _pParam);
49 };
50 
51 
52 #define TRACE_RANGE(range_description)			Tracer aTrace(range_description);
53 #define TRACE_RANGE_MESSAGE(message)			{ aTrace.TraceString(message); }
54 #define TRACE_RANGE_MESSAGE1(message, param)	{ aTrace.TraceString1StringParam(message, param); }
55 
56 #else
57 
58 #define TRACE_RANGE(range_description)			;
59 #define TRACE_RANGE_MESSAGE(message)			;
60 #define TRACE_RANGE_MESSAGE1(message, param)	;
61 
62 #endif
63 
64 #endif // _TRACE_HXX_
65