Files
test/source/blender/blenlib/BLI_session_uid.h
Jacques Lucke 311ca3e6af Core: rename Session UUID to Session UID
`UUID` generally stands for "universally unique identifier". The session identifier that
we use is neither universally unique, nor does it follow the standard. Therefor, the term
"session uuid" is confusing and should be replaced.

In #116888 we briefly talked about a better name and ended up with "session uid".
The reason for "uid" instead of "id" is that the latter is a very overloaded term in Blender
already.

This patch changes all uses of "uuid" to "uid" where it's used in the context of a
"session uid". It's not always trivial to see whether a specific mention of "uuid" refers
to an actual uuid or something else. Therefore, I might have missed some renames.
I can't think of an automated way to differentiate the case.

BMesh also uses the term "uuid" sometimes in a the wrong context (e.g. `UUIDFaceStepItem`)
but there it also does not mean "session uid", so it's *not* changed by this patch.

Pull Request: https://projects.blender.org/blender/blender/pulls/117350
2024-01-22 13:47:13 +01:00

65 lines
1.5 KiB
C++

/* SPDX-FileCopyrightText: 2023 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
/** \file
* \ingroup bli
*
* Functions for generating and handling "Session UIDs".
*
* Note that these are not true universally-unique identifiers, but only unique during the current
* Blender session.
*
* For true UUIDs, see `BLI_uuid.h`.
*/
#ifdef __cplusplus
extern "C" {
#endif
#include "DNA_session_uid_types.h"
/** Generate new UID which is unique throughout the Blender session. */
SessionUID BLI_session_uid_generate(void);
/** Check whether the UID is properly generated. */
bool BLI_session_uid_is_generated(const SessionUID *uid);
/** Check whether two UIDs are identical. */
bool BLI_session_uid_is_equal(const SessionUID *lhs, const SessionUID *rhs);
uint64_t BLI_session_uid_hash_uint64(const SessionUID *uid);
/* Utility functions to make it possible to create GHash/GSet with UID as a key. */
uint BLI_session_uid_ghash_hash(const void *uid_v);
bool BLI_session_uid_ghash_compare(const void *lhs_v, const void *rhs_v);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
namespace blender {
inline const bool operator==(const SessionUID &lhs, const SessionUID &rhs)
{
return BLI_session_uid_is_equal(&lhs, &rhs);
}
template<typename T> struct DefaultHash;
template<> struct DefaultHash<SessionUID> {
uint64_t operator()(const SessionUID &value) const
{
return BLI_session_uid_hash_uint64(&value);
}
};
} // namespace blender
#endif