From 4997eb8da24d6188aabaf201bfc40c1cfe68f785 Mon Sep 17 00:00:00 2001 From: erwincoumans Date: Sat, 2 Jun 2018 13:52:00 -0700 Subject: [PATCH] add new file related to PyBullet userData --- examples/SharedMemory/SharedMemoryUserData.h | 48 ++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 examples/SharedMemory/SharedMemoryUserData.h diff --git a/examples/SharedMemory/SharedMemoryUserData.h b/examples/SharedMemory/SharedMemoryUserData.h new file mode 100644 index 000000000..a29f59eb0 --- /dev/null +++ b/examples/SharedMemory/SharedMemoryUserData.h @@ -0,0 +1,48 @@ +#ifndef SHARED_MEMORY_USER_DATA_H +#define SHARED_MEMORY_USER_DATA_H + +#include +#include "LinearMath/btAlignedObjectArray.h" +#include "SharedMemoryPublic.h" + +struct SharedMemoryUserData +{ + std::string m_key; + int m_type; + + btAlignedObjectArray m_bytes; + + SharedMemoryUserData() + :m_type(-1) + { + } + + // Takes ownership of the passed key and value arguments. + SharedMemoryUserData(const char* key) + :m_key(key) + { + } + + // Takes ownership of the data pointed to by newValue. + void replaceValue(const char* bytes, int len, int type) + { + m_type = type; + m_bytes.resize(len); + for (int i=0;i