Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2020-07-03 15:15:05 +0300
committerJacques Lucke <jacques@blender.org>2020-07-03 15:16:02 +0300
commitd64803f63b4311b0abb93542a907e97b47493e9f (patch)
treec9c43b768859393d1b4b1d8c0bca84081606b19a /source/blender/blenlib/BLI_set_slots.hh
parente797c4f28f50f2be9d6d28d4b8e5c080d53ef74f (diff)
Cleanup: Use trailing underscore for non-public data members
This makes the code conform better with our style guide.
Diffstat (limited to 'source/blender/blenlib/BLI_set_slots.hh')
-rw-r--r--source/blender/blenlib/BLI_set_slots.hh102
1 files changed, 51 insertions, 51 deletions
diff --git a/source/blender/blenlib/BLI_set_slots.hh b/source/blender/blenlib/BLI_set_slots.hh
index 581e70ce628..379e81b7644 100644
--- a/source/blender/blenlib/BLI_set_slots.hh
+++ b/source/blender/blenlib/BLI_set_slots.hh
@@ -50,8 +50,8 @@ template<typename Key> class SimpleSetSlot {
Removed = 2,
};
- State m_state;
- AlignedBuffer<sizeof(Key), alignof(Key)> m_buffer;
+ State state_;
+ AlignedBuffer<sizeof(Key), alignof(Key)> buffer_;
public:
/**
@@ -59,7 +59,7 @@ template<typename Key> class SimpleSetSlot {
*/
SimpleSetSlot()
{
- m_state = Empty;
+ state_ = Empty;
}
/**
@@ -67,7 +67,7 @@ template<typename Key> class SimpleSetSlot {
*/
~SimpleSetSlot()
{
- if (m_state == Occupied) {
+ if (state_ == Occupied) {
this->key()->~Key();
}
}
@@ -78,8 +78,8 @@ template<typename Key> class SimpleSetSlot {
*/
SimpleSetSlot(const SimpleSetSlot &other)
{
- m_state = other.m_state;
- if (other.m_state == Occupied) {
+ state_ = other.state_;
+ if (other.state_ == Occupied) {
new ((void *)this->key()) Key(*other.key());
}
}
@@ -91,8 +91,8 @@ template<typename Key> class SimpleSetSlot {
*/
SimpleSetSlot(SimpleSetSlot &&other) noexcept
{
- m_state = other.m_state;
- if (other.m_state == Occupied) {
+ state_ = other.state_;
+ if (other.state_ == Occupied) {
new ((void *)this->key()) Key(std::move(*other.key()));
}
}
@@ -102,7 +102,7 @@ template<typename Key> class SimpleSetSlot {
*/
Key *key()
{
- return (Key *)m_buffer.ptr();
+ return (Key *)buffer_.ptr();
}
/**
@@ -110,7 +110,7 @@ template<typename Key> class SimpleSetSlot {
*/
const Key *key() const
{
- return (const Key *)m_buffer.ptr();
+ return (const Key *)buffer_.ptr();
}
/**
@@ -118,7 +118,7 @@ template<typename Key> class SimpleSetSlot {
*/
bool is_occupied() const
{
- return m_state == Occupied;
+ return state_ == Occupied;
}
/**
@@ -126,7 +126,7 @@ template<typename Key> class SimpleSetSlot {
*/
bool is_empty() const
{
- return m_state == Empty;
+ return state_ == Empty;
}
/**
@@ -147,7 +147,7 @@ template<typename Key> class SimpleSetSlot {
{
BLI_assert(!this->is_occupied());
BLI_assert(other.is_occupied());
- m_state = Occupied;
+ state_ = Occupied;
new ((void *)this->key()) Key(std::move(*other.key()));
other.key()->~Key();
}
@@ -159,7 +159,7 @@ template<typename Key> class SimpleSetSlot {
template<typename ForwardKey, typename IsEqual>
bool contains(const ForwardKey &key, const IsEqual &is_equal, uint32_t UNUSED(hash)) const
{
- if (m_state == Occupied) {
+ if (state_ == Occupied) {
return is_equal(key, *this->key());
}
return false;
@@ -172,7 +172,7 @@ template<typename Key> class SimpleSetSlot {
template<typename ForwardKey> void occupy(ForwardKey &&key, uint32_t UNUSED(hash))
{
BLI_assert(!this->is_occupied());
- m_state = Occupied;
+ state_ = Occupied;
new ((void *)this->key()) Key(std::forward<ForwardKey>(key));
}
@@ -182,7 +182,7 @@ template<typename Key> class SimpleSetSlot {
void remove()
{
BLI_assert(this->is_occupied());
- m_state = Removed;
+ state_ = Removed;
this->key()->~Key();
}
};
@@ -199,73 +199,73 @@ template<typename Key> class HashedSetSlot {
Removed = 2,
};
- uint32_t m_hash;
- State m_state;
- AlignedBuffer<sizeof(Key), alignof(Key)> m_buffer;
+ uint32_t hash_;
+ State state_;
+ AlignedBuffer<sizeof(Key), alignof(Key)> buffer_;
public:
HashedSetSlot()
{
- m_state = Empty;
+ state_ = Empty;
}
~HashedSetSlot()
{
- if (m_state == Occupied) {
+ if (state_ == Occupied) {
this->key()->~Key();
}
}
HashedSetSlot(const HashedSetSlot &other)
{
- m_state = other.m_state;
- if (other.m_state == Occupied) {
- m_hash = other.m_hash;
+ state_ = other.state_;
+ if (other.state_ == Occupied) {
+ hash_ = other.hash_;
new ((void *)this->key()) Key(*other.key());
}
}
HashedSetSlot(HashedSetSlot &&other) noexcept
{
- m_state = other.m_state;
- if (other.m_state == Occupied) {
- m_hash = other.m_hash;
+ state_ = other.state_;
+ if (other.state_ == Occupied) {
+ hash_ = other.hash_;
new ((void *)this->key()) Key(std::move(*other.key()));
}
}
Key *key()
{
- return (Key *)m_buffer.ptr();
+ return (Key *)buffer_.ptr();
}
const Key *key() const
{
- return (const Key *)m_buffer.ptr();
+ return (const Key *)buffer_.ptr();
}
bool is_occupied() const
{
- return m_state == Occupied;
+ return state_ == Occupied;
}
bool is_empty() const
{
- return m_state == Empty;
+ return state_ == Empty;
}
template<typename Hash> uint32_t get_hash(const Hash &UNUSED(hash)) const
{
BLI_assert(this->is_occupied());
- return m_hash;
+ return hash_;
}
void relocate_occupied_here(HashedSetSlot &other, uint32_t hash)
{
BLI_assert(!this->is_occupied());
BLI_assert(other.is_occupied());
- m_state = Occupied;
- m_hash = hash;
+ state_ = Occupied;
+ hash_ = hash;
new ((void *)this->key()) Key(std::move(*other.key()));
other.key()->~Key();
}
@@ -273,9 +273,9 @@ template<typename Key> class HashedSetSlot {
template<typename ForwardKey, typename IsEqual>
bool contains(const ForwardKey &key, const IsEqual &is_equal, uint32_t hash) const
{
- /* m_hash might be uninitialized here, but that is ok. */
- if (m_hash == hash) {
- if (m_state == Occupied) {
+ /* hash_ might be uninitialized here, but that is ok. */
+ if (hash_ == hash) {
+ if (state_ == Occupied) {
return is_equal(key, *this->key());
}
}
@@ -285,15 +285,15 @@ template<typename Key> class HashedSetSlot {
template<typename ForwardKey> void occupy(ForwardKey &&key, uint32_t hash)
{
BLI_assert(!this->is_occupied());
- m_state = Occupied;
- m_hash = hash;
+ state_ = Occupied;
+ hash_ = hash;
new ((void *)this->key()) Key(std::forward<ForwardKey>(key));
}
void remove()
{
BLI_assert(this->is_occupied());
- m_state = Removed;
+ state_ = Removed;
this->key()->~Key();
}
};
@@ -308,7 +308,7 @@ template<typename Key> class HashedSetSlot {
*/
template<typename Key, typename KeyInfo> class IntrusiveSetSlot {
private:
- Key m_key = KeyInfo::get_empty();
+ Key key_ = KeyInfo::get_empty();
public:
IntrusiveSetSlot() = default;
@@ -318,43 +318,43 @@ template<typename Key, typename KeyInfo> class IntrusiveSetSlot {
Key *key()
{
- return &m_key;
+ return &key_;
}
const Key *key() const
{
- return &m_key;
+ return &key_;
}
bool is_occupied() const
{
- return KeyInfo::is_not_empty_or_removed(m_key);
+ return KeyInfo::is_not_empty_or_removed(key_);
}
bool is_empty() const
{
- return KeyInfo::is_empty(m_key);
+ return KeyInfo::is_empty(key_);
}
template<typename Hash> uint32_t get_hash(const Hash &hash) const
{
BLI_assert(this->is_occupied());
- return hash(m_key);
+ return hash(key_);
}
void relocate_occupied_here(IntrusiveSetSlot &other, uint32_t UNUSED(hash))
{
BLI_assert(!this->is_occupied());
BLI_assert(other.is_occupied());
- m_key = std::move(other.m_key);
- other.m_key.~Key();
+ key_ = std::move(other.key_);
+ other.key_.~Key();
}
template<typename ForwardKey, typename IsEqual>
bool contains(const ForwardKey &key, const IsEqual &is_equal, uint32_t UNUSED(hash)) const
{
BLI_assert(KeyInfo::is_not_empty_or_removed(key));
- return is_equal(m_key, key);
+ return is_equal(key_, key);
}
template<typename ForwardKey> void occupy(ForwardKey &&key, uint32_t UNUSED(hash))
@@ -362,13 +362,13 @@ template<typename Key, typename KeyInfo> class IntrusiveSetSlot {
BLI_assert(!this->is_occupied());
BLI_assert(KeyInfo::is_not_empty_or_removed(key));
- m_key = std::forward<ForwardKey>(key);
+ key_ = std::forward<ForwardKey>(key);
}
void remove()
{
BLI_assert(this->is_occupied());
- KeyInfo::remove(m_key);
+ KeyInfo::remove(key_);
}
};