aboutsummaryrefslogtreecommitdiff
path: root/zencore/session.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2021-09-19 18:38:31 +0200
committerStefan Boberg <[email protected]>2021-09-19 18:38:31 +0200
commited9d27f5e7b2e8eda835e67af302f097e5932366 (patch)
tree6bcdffd7829290a6c6bbc03b466457fc7b37064a /zencore/session.cpp
parentRemoved unnecessary ATL includes (diff)
downloadzen-ed9d27f5e7b2e8eda835e67af302f097e5932366.tar.xz
zen-ed9d27f5e7b2e8eda835e67af302f097e5932366.zip
Added GetSessionIdString() which returns a text representation of the session id
Diffstat (limited to 'zencore/session.cpp')
-rw-r--r--zencore/session.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/zencore/session.cpp b/zencore/session.cpp
index d57d3685b..ce4bfae1b 100644
--- a/zencore/session.cpp
+++ b/zencore/session.cpp
@@ -9,14 +9,27 @@
namespace zen {
static Oid GlobalSessionId;
+static char GlobalSessionString[Oid::StringLength];
static std::once_flag SessionInitFlag;
Oid
GetSessionId()
{
- std::call_once(SessionInitFlag, [&] { GlobalSessionId.Generate(); });
+ std::call_once(SessionInitFlag, [&] {
+ GlobalSessionId.Generate();
+ GlobalSessionId.ToString(GlobalSessionString);
+ });
return GlobalSessionId;
}
+std::string_view
+GetSessionIdString()
+{
+ // Ensure we actually have a generated session identifier
+ std::ignore = GetSessionId();
+
+ return std::string_view(GlobalSessionString, Oid::StringLength);
+}
+
} // namespace zen \ No newline at end of file