Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cAtomManager.h
Go to the documentation of this file.
1 //
4 //
5 
6 #ifndef _INC_cAtomManager_H
7 #define _INC_cAtomManager_H
8 #ifndef NO_PRAGMA_ONCE
9 #pragma once
10 #endif
11 
12 #include "cAtom.h"
13 #include "cLogMgr.h"
14 #include "cArraySortRef.h"
15 #include "cSingleton.h"
16 
17 namespace Gray
18 {
20  : public cSingleton < cAtomManager >
21  {
24 
25  friend class cSingleton < cAtomManager >;
26  friend class cAtomRef;
27 
28  private:
29  cAtomRef m_aEmpty;
30  static const int kRefsBase = 3; // We only have 3 refs = we can be deleted. Magic number.
31 
32  mutable cThreadLockCount m_Lock; // make it thread safe.
36 
37  protected:
38  bool RemoveAtom(cAtomDef* pDef);
39  cAtomDefPtr CreateAtom(ITERATE_t index, COMPARE_t iCompareRes, cStringA sVal);
40  cAtomDefPtr FindorCreateAtomStr(const cStringA& sName);
41  cAtomDefPtr FindorCreateAtomStr(const ATOMCHAR_t* pszName);
42  void SetAtomStatic(cAtomDef* pDef);
43 
44  public:
45  cAtomManager();
46  ~cAtomManager();
47 
48  cAtomRef FindAtomStr(const ATOMCHAR_t* pszText) const;
49  cAtomRef FindAtomHashCode(ATOMCODE_t idAtom) const;
50 
51  HRESULT DebugDumpFile(cStreamOutput& o) const;
52 
55  };
56 }
57 
58 #endif
#define GRAYCORE_LINK
Definition: GrayCore.h:47
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
#define CHEAPOBJECT_IMPL
Definition: cHeapObject.h:32
#define UNITTEST_FRIEND(n)
Define this in the class body to be unit tested. Allow the unit test to access private/protected stuf...
Definition: cUnitTestDecl.h:17
Definition: cArraySortRef.h:60
Definition: cArraySortRef.h:199
Definition: cAtom.h:28
Definition: cAtomManager.h:21
Definition: cAtom.h:63
Definition: cSingleton.h:127
Definition: cStream.h:126
Definition: cThreadLock.h:498
< The main namespace for all Core functions.
Definition: GrayCore.cpp:14
int COMPARE_t
result of compare. 0=same, 1=a>b, -1=a<b
Definition: cValT.h:17
HASHCODE32_t ATOMCODE_t
Encode a atom as a 32 bit hashcode instead of using its name/pointer. StrT::GetHashCode32()
Definition: cAtom.h:18
int ITERATE_t
like size_t but signed
Definition: Index.h:28
char ATOMCHAR_t
the char form (UNICODE or not) for an atom. (for symbolic names)
Definition: StrConst.h:15
uint16 index
Definition: sample3.cpp:29