From 075d17f8ada47e990fe94606c3d21df409223465 Mon Sep 17 00:00:00 2001 From: Stefan Boberg Date: Tue, 2 May 2023 10:01:47 +0200 Subject: moved source directories into `/src` (#264) * moved source directories into `/src` * updated bundle.lua for new `src` path * moved some docs, icon * removed old test trees --- src/zencore/session.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/zencore/session.cpp (limited to 'src/zencore/session.cpp') diff --git a/src/zencore/session.cpp b/src/zencore/session.cpp new file mode 100644 index 000000000..ce4bfae1b --- /dev/null +++ b/src/zencore/session.cpp @@ -0,0 +1,35 @@ +// Copyright Epic Games, Inc. All Rights Reserved. + +#include "zencore/session.h" + +#include + +#include + +namespace zen { + +static Oid GlobalSessionId; +static char GlobalSessionString[Oid::StringLength]; +static std::once_flag SessionInitFlag; + +Oid +GetSessionId() +{ + 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 -- cgit v1.2.3