NCBI C++ ToolKit
tse_loadlock.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #ifndef OBJECTS_OBJMGR_IMPL___TSE_LOADLOCK__HPP
2 #define OBJECTS_OBJMGR_IMPL___TSE_LOADLOCK__HPP
3 
4 /* $Id: tse_loadlock.hpp 100466 2023-08-03 17:36:57Z grichenk $
5 * ===========================================================================
6 *
7 * PUBLIC DOMAIN NOTICE
8 * National Center for Biotechnology Information
9 *
10 * This software/database is a "United States Government Work" under the
11 * terms of the United States Copyright Act. It was written as part of
12 * the author's official duties as a United States Government employee and
13 * thus cannot be copyrighted. This software/database is freely available
14 * to the public for use. The National Library of Medicine and the U.S.
15 * Government have not placed any restriction on its use or reproduction.
16 *
17 * Although all reasonable efforts have been taken to ensure the accuracy
18 * and reliability of the software and data, the NLM and the U.S.
19 * Government do not and cannot warrant the performance or results that
20 * may be obtained by using this software or data. The NLM and the U.S.
21 * Government disclaim all warranties, express or implied, including
22 * warranties of performance, merchantability or fitness for any particular
23 * purpose.
24 *
25 * Please cite the author in any work or product based on this material.
26 *
27 * ===========================================================================
28 *
29 * Author: Eugene Vasilchenko
30 *
31 * File Description:
32 * CTSE_Lock -- class to lock TSEs from garbage collector
33 *
34 */
35 
36 
37 #include <corelib/ncbiobj.hpp>
38 #include <objmgr/impl/tse_info.hpp>
40 
43 
44 class CTSE_Info;
45 class CTSE_LoadLockGuard;
46 
48 {
49 public:
50  CTSE_LoadLock(void) : m_LoadLockOwner{}
51  {
52  }
54  {
55  Reset();
56  }
57 
59  {
60  *this = lock;
61  }
62  CTSE_LoadLock& operator=(const CTSE_LoadLock& lock);
63 
65 
67  {
68  return *m_Info;
69  }
70  const CTSE_Info& operator*(void) const
71  {
72  return *m_Info;
73  }
75  {
76  return &*m_Info;
77  }
78  const CTSE_Info* operator->(void) const
79  {
80  return &*m_Info;
81  }
82 
83  bool IsLoaded(void) const;
84  void SetLoaded(void);
85 
86  void Reset(void);
87  void ReleaseLoadLock(void);
88 
89 protected:
90  friend class CDataSource;
91 
93  {
94  return *reinterpret_cast<CTSE_LoadLockGuard*>(m_LoadLock.GetPointer());
95  }
96 
97 private:
102 };
103 
104 /////////////////////////////////////////////////////////////////////
105 //
106 // Inline methods
107 //
108 /////////////////////////////////////////////////////////////////////
109 
112 
113 #endif//OBJECTS_OBJMGR_IMPL___TSE_LOADLOCK__HPP
TThreadSystemID m_LoadLockOwner
CTSE_LoadLockGuard & x_GetGuard()
const CTSE_Info & operator*(void) const
CTSE_LoadLock(const CTSE_LoadLock &lock)
CRef< CTSE_Info > m_Info
const CTSE_Info * operator->(void) const
CRef< CDataSource > m_DataSource
~CTSE_LoadLock(void)
CTSE_Info & operator*(void)
CTSE_Info * operator->(void)
DECLARE_OPERATOR_BOOL_REF(m_Info)
CRef< CObject > m_LoadLock
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define END_SCOPE(ns)
End the previously defined scope.
Definition: ncbistl.hpp:75
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:72
pthread_t TThreadSystemID
Define platform-dependent thread ID type.
#define NCBI_XOBJMGR_EXPORT
Definition: ncbi_export.h:1307
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
Modified on Mon Dec 11 02:41:14 2023 by modify_doxy.py rev. 669887