Apache Log4cxx  Version 1.2.0
Loading...
Searching...
No Matches
threadspecificdata.h
Go to the documentation of this file.
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_THREAD_SPECIFIC_DATA_H
19#define _LOG4CXX_HELPERS_THREAD_SPECIFIC_DATA_H
20
21#include <log4cxx/ndc.h>
22#include <log4cxx/mdc.h>
23
24namespace LOG4CXX_NS
25{
26namespace helpers
27{
32class LOG4CXX_EXPORT ThreadSpecificData
33{
34 public:
37
46 void recycle();
47
48 static void put(const LogString& key, const LogString& val);
49 static void push(const LogString& val);
50 static void inherit(const LOG4CXX_NS::NDC::Stack& stack);
51
52 LOG4CXX_NS::NDC::Stack& getStack();
53 LOG4CXX_NS::MDC::Map& getMap();
54
55
56 private:
57 static ThreadSpecificData& getDataNoThreads();
58 static ThreadSpecificData* createCurrentData();
59 LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(ThreadSpecificDataPrivate, m_priv)
60};
61
62} // namespace helpers
63} // namespace log4cxx
64
65
66#endif
This class contains all the thread-specific data in use by log4cxx.
Definition: threadspecificdata.h:33
static void push(const LogString &val)
static void inherit(const log4cxx::NDC::Stack &stack)
static ThreadSpecificData * getCurrentData()
Gets current thread specific data.
static void put(const LogString &key, const LogString &val)
log4cxx::NDC::Stack & getStack()
void recycle()
Release this ThreadSpecficData if empty.
std::basic_string< logchar > LogString
Definition: logstring.h:60