Code-style consistency improvement:
Apply clang-format-all.sh using the _clang-format file through all the cpp/.h files. make sure not to apply it to certain serialization structures, since some parser expects the * as part of the name, instead of type. This commit contains no other changes aside from adding and applying clang-format-all.sh
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
#include "LinearMath/btHashMap.h"
|
||||
#include "SharedMemoryPublic.h"
|
||||
|
||||
struct SharedMemoryUserData
|
||||
struct SharedMemoryUserData
|
||||
{
|
||||
std::string m_key;
|
||||
int m_type;
|
||||
@@ -16,14 +16,14 @@ struct SharedMemoryUserData
|
||||
int m_visualShapeIndex;
|
||||
|
||||
btAlignedObjectArray<char> m_bytes;
|
||||
|
||||
|
||||
SharedMemoryUserData()
|
||||
:m_type(-1), m_bodyUniqueId(-1), m_linkIndex(-1), m_visualShapeIndex(-1)
|
||||
: m_type(-1), m_bodyUniqueId(-1), m_linkIndex(-1), m_visualShapeIndex(-1)
|
||||
{
|
||||
}
|
||||
|
||||
SharedMemoryUserData(const char* key, int bodyUniqueId, int linkIndex, int visualShapeIndex)
|
||||
:m_key(key), m_type(-1), m_bodyUniqueId(bodyUniqueId), m_linkIndex(linkIndex), m_visualShapeIndex(visualShapeIndex)
|
||||
: m_key(key), m_type(-1), m_bodyUniqueId(bodyUniqueId), m_linkIndex(linkIndex), m_visualShapeIndex(visualShapeIndex)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ struct SharedMemoryUserData
|
||||
{
|
||||
m_type = type;
|
||||
m_bytes.resize(len);
|
||||
for (int i=0;i<len;i++)
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
m_bytes[i] = bytes[i];
|
||||
}
|
||||
@@ -48,7 +48,8 @@ struct SharedMemoryUserData
|
||||
}
|
||||
};
|
||||
|
||||
struct SharedMemoryUserDataHashKey {
|
||||
struct SharedMemoryUserDataHashKey
|
||||
{
|
||||
unsigned int m_hash;
|
||||
|
||||
btHashString m_key;
|
||||
@@ -56,35 +57,40 @@ struct SharedMemoryUserDataHashKey {
|
||||
btHashInt m_linkIndex;
|
||||
btHashInt m_visualShapeIndex;
|
||||
|
||||
SIMD_FORCE_INLINE unsigned int getHash()const {
|
||||
SIMD_FORCE_INLINE unsigned int getHash() const
|
||||
{
|
||||
return m_hash;
|
||||
}
|
||||
|
||||
SharedMemoryUserDataHashKey() : m_hash(0) {}
|
||||
|
||||
SharedMemoryUserDataHashKey(const struct SharedMemoryUserData *userData)
|
||||
: m_key(userData->m_key.c_str()),
|
||||
SharedMemoryUserDataHashKey(const struct SharedMemoryUserData* userData)
|
||||
: m_key(userData->m_key.c_str()),
|
||||
m_bodyUniqueId(userData->m_bodyUniqueId),
|
||||
m_linkIndex(userData->m_linkIndex),
|
||||
m_visualShapeIndex(userData->m_visualShapeIndex) {
|
||||
m_visualShapeIndex(userData->m_visualShapeIndex)
|
||||
{
|
||||
calculateHash();
|
||||
}
|
||||
|
||||
SharedMemoryUserDataHashKey(const char *key, int bodyUniqueId, int linkIndex, int visualShapeIndex)
|
||||
: m_key(key), m_bodyUniqueId(bodyUniqueId), m_linkIndex(linkIndex), m_visualShapeIndex(visualShapeIndex) {
|
||||
SharedMemoryUserDataHashKey(const char* key, int bodyUniqueId, int linkIndex, int visualShapeIndex)
|
||||
: m_key(key), m_bodyUniqueId(bodyUniqueId), m_linkIndex(linkIndex), m_visualShapeIndex(visualShapeIndex)
|
||||
{
|
||||
calculateHash();
|
||||
}
|
||||
|
||||
void calculateHash() {
|
||||
void calculateHash()
|
||||
{
|
||||
m_hash = m_key.getHash() ^ m_bodyUniqueId.getHash() ^ m_linkIndex.getHash() ^ m_visualShapeIndex.getHash();
|
||||
}
|
||||
|
||||
bool equals(const SharedMemoryUserDataHashKey& other) const {
|
||||
bool equals(const SharedMemoryUserDataHashKey& other) const
|
||||
{
|
||||
return m_bodyUniqueId.equals(other.m_bodyUniqueId) &&
|
||||
m_linkIndex.equals(other.m_linkIndex) &&
|
||||
m_visualShapeIndex.equals(other.m_visualShapeIndex) &&
|
||||
m_key.equals(other.m_key);
|
||||
m_linkIndex.equals(other.m_linkIndex) &&
|
||||
m_visualShapeIndex.equals(other.m_visualShapeIndex) &&
|
||||
m_key.equals(other.m_key);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //SHARED_MEMORY_USER_DATA_H
|
||||
#endif //SHARED_MEMORY_USER_DATA_H
|
||||
|
||||
Reference in New Issue
Block a user