2 // File: logloguser.cxx
4 // Author: Tad E. Smith
7 // Copyright 2003-2009 Tad E. Smith
9 // Licensed under the Apache License, Version 2.0 (the "License");
10 // you may not use this file except in compliance with the License.
11 // You may obtain a copy of the License at
13 // http://www.apache.org/licenses/LICENSE-2.0
15 // Unless required by applicable law or agreed to in writing, software
16 // distributed under the License is distributed on an "AS IS" BASIS,
17 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 // See the License for the specific language governing permissions and
19 // limitations under the License.
21 #include <log4cplus/streams.h>
22 #include <log4cplus/helpers/logloguser.h>
23 #include <log4cplus/helpers/loglog.h>
26 using namespace log4cplus
;
27 using namespace log4cplus::helpers
;
29 typedef SharedObjectPtr
<LogLog
> LogLogPtr
;
33 ///////////////////////////////////////////////////////////////////////////////
34 // log4cplus::helpers::LogLogUser ctor and dtor
35 ///////////////////////////////////////////////////////////////////////////////
37 LogLogUser::LogLogUser()
39 loglogRef
= new SharedObjectPtr
<LogLog
>(LogLog::getLogLog());
43 LogLogUser::LogLogUser(const LogLogUser
& rhs
)
45 loglogRef
= new SharedObjectPtr
<LogLog
>(*static_cast<LogLogPtr
*>(rhs
.loglogRef
));
49 LogLogUser::~LogLogUser()
51 delete static_cast<LogLogPtr
*>(loglogRef
);
56 ///////////////////////////////////////////////////////////////////////////////
57 // log4cplus::helpers::LogLogUser public methods
58 ///////////////////////////////////////////////////////////////////////////////
61 LogLogUser::getLogLog() const
63 LogLogPtr
* ptr
= static_cast<LogLogPtr
*>(loglogRef
);
69 LogLogUser::operator=(const LogLogUser
& rhs
)
75 delete static_cast<LogLogPtr
*>(loglogRef
);
76 loglogRef
= new SharedObjectPtr
<LogLog
>(*static_cast<LogLogPtr
*>(rhs
.loglogRef
));