[ox/claw] Add Claw

This commit is contained in:
2020-05-06 20:38:06 -05:00
parent 9560ccf476
commit e2952ec8c1
14 changed files with 493 additions and 9 deletions

View File

@@ -14,6 +14,7 @@
#include <ox/std/byteswap.hpp>
#include <ox/std/string.hpp>
#include <ox/std/types.hpp>
#include <ox/std/units.hpp>
#include <ox/std/vector.hpp>
#include "intops.hpp"
@@ -183,6 +184,15 @@ void MetalClawWriter::setTypeInfo(const char*, int fields) {
memset(m_buff, 0, m_buffIt);
}
template<typename T>
ValErr<Vector<char>> writeMC(T *val) {
Vector<char> buff(10 * units::MB);
MetalClawWriter writer(bit_cast<uint8_t*>(buff.data()), buff.size());
oxReturnError(model(&writer, val));
buff.resize(writer.size());
return buff;
}
template<typename T>
Error writeMC(uint8_t *buff, std::size_t buffLen, T *val, std::size_t *sizeOut = nullptr) {
MetalClawWriter writer(buff, buffLen);