| 65 | } |
| 66 | template<typename T> |
| 67 | T At(size_t iElement) |
| 68 | { |
| 69 | const auto off = qInfo_[iElement].offset; |
| 70 | switch (qInfo_[iElement].type) { |
| 71 | case PM_DATA_TYPE_BOOL: return (T)reinterpret_cast<const bool&>(pFirstByteTarget_[off]); |
| 72 | case PM_DATA_TYPE_DOUBLE: return reinterpret_cast<const double&>(pFirstByteTarget_[off]); |
| 73 | case PM_DATA_TYPE_ENUM: return (T)reinterpret_cast<const int&>(pFirstByteTarget_[off]); |
| 74 | case PM_DATA_TYPE_INT32: return (T)reinterpret_cast<const int32_t&>(pFirstByteTarget_[off]); |
| 75 | case PM_DATA_TYPE_STRING: return (T)-1; |
| 76 | case PM_DATA_TYPE_UINT32: return (T)reinterpret_cast<const uint32_t&>(pFirstByteTarget_[off]); |
| 77 | case PM_DATA_TYPE_UINT64: return (T)reinterpret_cast<const uint64_t&>(pFirstByteTarget_[off]); |
| 78 | case PM_DATA_TYPE_VOID: return (T)-1; |
| 79 | } |
| 80 | return (T)-1; |
| 81 | } |
| 82 | private: |
| 83 | const uint8_t* pFirstByteTarget_ = nullptr; |
| 84 | std::vector<LookupInfo_> qInfo_; |
no outgoing calls