OCILIB (C and C++ Driver for Oracle)  4.7.4
Open source and cross platform Oracle Driver delivering efficient access to Oracle databases.
Lockable.hpp
1 /*
2  * OCILIB - C Driver for Oracle (C Wrapper for Oracle OCI)
3  *
4  * Website: http://www.ocilib.net
5  *
6  * Copyright (c) 2007-2021 Vincent ROGIER <vince.rogier@ocilib.net>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 #pragma once
22 
23 #include "ocilibcpp/core.hpp"
24 
25 // ReSharper disable CppClangTidyHicppUseEqualsDefault
26 // ReSharper disable CppClangTidyModernizeUseEqualsDefault
27 // ReSharper disable CppClangTidyHicppUseAuto
28 // ReSharper disable CppClangTidyModernizeUseAuto
29 
30 namespace ocilib
31 {
32  namespace core
33  {
34  inline Lockable::Lockable() : _locker(nullptr)
35  {
36 
37  }
38 
39  inline Lockable::~Lockable() noexcept
40  {
41 
42  }
43 
44  inline void Lockable::Lock() const
45  {
46  if (_locker)
47  {
48  _locker->Lock();
49  }
50  }
51 
52  inline void Lockable::Unlock() const
53  {
54  if (_locker)
55  {
56  _locker->Unlock();
57  }
58  }
59 
60  inline void Lockable::SetLocker(Locker* locker)
61  {
62  _locker = locker;
63  }
64 
65  }
66 }
OCILIB ++ Namespace.