aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/yt/misc/guid.h
diff options
context:
space:
mode:
authorbabenko <babenko@yandex-team.ru>2022-02-10 16:49:19 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:19 +0300
commitf31097c96270919a1f49360bdaaa69ea4f3fefab (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/yt/misc/guid.h
parentcec37806d8847aa3db53bafc9e251d4aaf325c12 (diff)
downloadydb-f31097c96270919a1f49360bdaaa69ea4f3fefab.tar.gz
Restoring authorship annotation for <babenko@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/yt/misc/guid.h')
-rw-r--r--library/cpp/yt/misc/guid.h128
1 files changed, 64 insertions, 64 deletions
diff --git a/library/cpp/yt/misc/guid.h b/library/cpp/yt/misc/guid.h
index 1517c006edb..ec4ba3526af 100644
--- a/library/cpp/yt/misc/guid.h
+++ b/library/cpp/yt/misc/guid.h
@@ -1,14 +1,14 @@
-#pragma once
-
+#pragma once
+
#include <util/generic/string.h>
-#include <util/generic/typetraits.h>
-
-#include <library/cpp/yt/exception/exception.h>
-
-namespace NYT {
-
-////////////////////////////////////////////////////////////////////////////////
-
+#include <util/generic/typetraits.h>
+
+#include <library/cpp/yt/exception/exception.h>
+
+namespace NYT {
+
+////////////////////////////////////////////////////////////////////////////////
+
//! TGuid is 16-byte value that might be interpreted as four little-endian 32-bit integers or two 64-bit little-endian integers.
/*!
* *-------------------------*-------------------------*
@@ -35,75 +35,75 @@ namespace NYT {
* 34 is byte [9]
* ff is byte [15]
*/
-struct TGuid
-{
- union
- {
- ui32 Parts32[4];
- ui64 Parts64[2];
+struct TGuid
+{
+ union
+ {
+ ui32 Parts32[4];
+ ui64 Parts64[2];
ui8 ReversedParts8[16];
- };
-
- //! Constructs a null (zero) guid.
- constexpr TGuid();
-
- //! Constructs guid from parts.
- constexpr TGuid(ui32 part0, ui32 part1, ui32 part2, ui32 part3);
-
- //! Constructs guid from parts.
- constexpr TGuid(ui64 part0, ui64 part1);
-
- //! Copies an existing guid.
- TGuid(const TGuid& other) = default;
-
- //! Checks if TGuid is zero.
- bool IsEmpty() const;
-
+ };
+
+ //! Constructs a null (zero) guid.
+ constexpr TGuid();
+
+ //! Constructs guid from parts.
+ constexpr TGuid(ui32 part0, ui32 part1, ui32 part2, ui32 part3);
+
+ //! Constructs guid from parts.
+ constexpr TGuid(ui64 part0, ui64 part1);
+
+ //! Copies an existing guid.
+ TGuid(const TGuid& other) = default;
+
+ //! Checks if TGuid is zero.
+ bool IsEmpty() const;
+
//! Converts TGuid to bool, returns |false| iff TGuid is zero.
explicit operator bool() const;
- //! Creates a new instance.
- static TGuid Create();
-
- //! Parses guid from TStringBuf, throws an exception if something went wrong.
- static TGuid FromString(TStringBuf str);
-
- //! Parses guid from TStringBuf, returns |true| if everything was ok.
- static bool FromString(TStringBuf str, TGuid* guid);
+ //! Creates a new instance.
+ static TGuid Create();
+
+ //! Parses guid from TStringBuf, throws an exception if something went wrong.
+ static TGuid FromString(TStringBuf str);
+
+ //! Parses guid from TStringBuf, returns |true| if everything was ok.
+ static bool FromString(TStringBuf str, TGuid* guid);
//! Same as FromString, but expects exactly 32 hex digits without dashes.
static TGuid FromStringHex32(TStringBuf str);
//! Same as TryFromString, but expects exactly 32 hex digits without dashes.
static bool FromStringHex32(TStringBuf str, TGuid* guid);
-};
-
+};
+
bool operator == (TGuid lhs, TGuid rhs);
bool operator != (TGuid lhs, TGuid rhs);
bool operator < (TGuid lhs, TGuid rhs);
-
-////////////////////////////////////////////////////////////////////////////////
-
-constexpr int MaxGuidStringSize = 4 * 8 + 3;
+
+////////////////////////////////////////////////////////////////////////////////
+
+constexpr int MaxGuidStringSize = 4 * 8 + 3;
char* WriteGuidToBuffer(char* ptr, TGuid value);
////////////////////////////////////////////////////////////////////////////////
-} // namespace NYT
-
-////////////////////////////////////////////////////////////////////////////////
-
-Y_DECLARE_PODTYPE(NYT::TGuid);
-
-//! A hasher for TGuid.
-template <>
+} // namespace NYT
+
+////////////////////////////////////////////////////////////////////////////////
+
+Y_DECLARE_PODTYPE(NYT::TGuid);
+
+//! A hasher for TGuid.
+template <>
struct THash<NYT::TGuid>
-{
- size_t operator()(const NYT::TGuid& guid) const;
-};
-
-////////////////////////////////////////////////////////////////////////////////
-
-#define GUID_INL_H_
-#include "guid-inl.h"
-#undef GUID_INL_H_
+{
+ size_t operator()(const NYT::TGuid& guid) const;
+};
+
+////////////////////////////////////////////////////////////////////////////////
+
+#define GUID_INL_H_
+#include "guid-inl.h"
+#undef GUID_INL_H_