diff options
author | chai <chaifix@163.com> | 2019-08-14 22:50:43 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-08-14 22:50:43 +0800 |
commit | 15740faf9fe9fe4be08965098bbf2947e096aeeb (patch) | |
tree | a730ec236656cc8cab5b13f088adfaed6bb218fb /Runtime/GfxDevice/threaded/WorkerIDMapper.h |
Diffstat (limited to 'Runtime/GfxDevice/threaded/WorkerIDMapper.h')
-rw-r--r-- | Runtime/GfxDevice/threaded/WorkerIDMapper.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/Runtime/GfxDevice/threaded/WorkerIDMapper.h b/Runtime/GfxDevice/threaded/WorkerIDMapper.h new file mode 100644 index 0000000..9b563f5 --- /dev/null +++ b/Runtime/GfxDevice/threaded/WorkerIDMapper.h @@ -0,0 +1,33 @@ +#ifndef WORKERIDMAPPER_H +#define WORKERIDMAPPER_H + +#include "ClientIDMapper.h" +#include "Runtime/Utilities/dynamic_array.h" + +template <class T> +class WorkerIDMapper { +public: + + WorkerIDMapper () + { + (*this)[0] = NULL; + } + + T*& operator [] (ClientIDMapper::ClientID cid) + { + if (m_IDMapping.size() <= cid) + m_IDMapping.resize_uninitialized(cid+1); + return m_IDMapping[cid]; + } + +private: + dynamic_array<T*> m_IDMapping; +}; + +#if ENABLE_GFXDEVICE_REMOTE_PROCESS +#define WorkerIDWrapper(type,val) m_##type##Mapper[val] +#else +#define WorkerIDWrapper(type,val) val +#endif + +#endif
\ No newline at end of file |