Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
CurrentIdentity.inl
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3 */
4
6
7namespace Stroika::Frameworks::Auth {
8
9 /*
10 ********************************************************************************
11 ************************* Auth::CurrentIdentityManager *************************
12 ********************************************************************************
13 */
14 template <IIdentityManagerCompatibleID ID_OBJ>
16 {
17#if qCompilerAndStdLib_thread_local_static_inline_twice_Buggy
18 Require (!sCurrent_BWA_ ());
19 sCurrent_BWA_ () = id;
20#else
21 Require (!sCurrent_);
22 sCurrent_ = id;
23#endif
24 }
25 template <IIdentityManagerCompatibleID ID_OBJ>
27 {
28#if qCompilerAndStdLib_thread_local_static_inline_twice_Buggy
29 sCurrent_BWA_ () = IDType{};
30 Ensure (!sCurrent_BWA_ ());
31#else
32 sCurrent_ = IDType{};
33 Ensure (!sCurrent_);
34#endif
35 }
36 template <IIdentityManagerCompatibleID ID_OBJ>
37 inline auto CurrentIdentityManager<ID_OBJ>::Get () -> IDType
38 {
39#if qCompilerAndStdLib_thread_local_static_inline_twice_Buggy
40 return sCurrent_BWA_ ();
41#else
42 return sCurrent_;
43#endif
44 }
45 template <IIdentityManagerCompatibleID ID_OBJ>
47 {
48#if qCompilerAndStdLib_thread_local_static_inline_twice_Buggy
49 sCurrent_BWA_ () = id;
50#else
51 sCurrent_ = id;
52#endif
53 }
54 template <IIdentityManagerCompatibleID ID_OBJ>
56 {
57#if qCompilerAndStdLib_thread_local_static_inline_twice_Buggy
58 sCurrent_BWA_ () = ID_OBJ{};
59#else
60 sCurrent_ = ID_OBJ{};
61#endif
62 }
63
64}
static/thread_local storage of the some notion of identity, which can be used to 'pass data' to funct...
static IDType Get()
if no identity set with Establish, and maybe even if it has been set, Get() == false
static void Set(IDType id)
if no identity set with Establish, and maybe even if it has been set, Get() == false