diff options
author | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2021-06-22 02:38:30 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-22 02:38:30 +0200 |
commit | ca7bcf9f7dc5eb47ccbec1049b323f0604dabadd (patch) | |
tree | 33d7d2673ba0da8a92323b07d061f655c719ae40 /external/optick/optick_serialization.cpp | |
parent | Merge pull request #44 from LaG1924/fix/protocol_support (diff) | |
parent | Updated build instructions and added MacOS #49 (diff) | |
download | AltCraft-ca7bcf9f7dc5eb47ccbec1049b323f0604dabadd.tar AltCraft-ca7bcf9f7dc5eb47ccbec1049b323f0604dabadd.tar.gz AltCraft-ca7bcf9f7dc5eb47ccbec1049b323f0604dabadd.tar.bz2 AltCraft-ca7bcf9f7dc5eb47ccbec1049b323f0604dabadd.tar.lz AltCraft-ca7bcf9f7dc5eb47ccbec1049b323f0604dabadd.tar.xz AltCraft-ca7bcf9f7dc5eb47ccbec1049b323f0604dabadd.tar.zst AltCraft-ca7bcf9f7dc5eb47ccbec1049b323f0604dabadd.zip |
Diffstat (limited to '')
-rw-r--r-- | external/optick/optick_serialization.cpp | 178 |
1 files changed, 0 insertions, 178 deletions
diff --git a/external/optick/optick_serialization.cpp b/external/optick/optick_serialization.cpp deleted file mode 100644 index a47a9b7..0000000 --- a/external/optick/optick_serialization.cpp +++ /dev/null @@ -1,178 +0,0 @@ -#include "optick.config.h" - -#if USE_OPTICK - -#include "optick_common.h" -#include "optick_serialization.h" - -namespace Optick -{ - string OutputDataStream::GetData() - { - flush(); - return str(); - } - - OutputDataStream & OutputDataStream::Write(const char * buffer, size_t size) - { - write(buffer, size); - return *this; - } - - OutputDataStream OutputDataStream::Empty; - - OutputDataStream &operator << ( OutputDataStream &stream, const char* val ) - { - uint32 length = val == nullptr ? 0 : (uint32)strlen(val); - stream << length; - - if (length > 0) - { - stream.write( val, length ); - } - return stream; - } - - OutputDataStream &operator << ( OutputDataStream &stream, int val ) - { - stream.write( (char*)&val, sizeof(int) ); - return stream; - } - - OutputDataStream &operator << ( OutputDataStream &stream, int64 val ) - { - stream.write( (char*)&val, sizeof(int64) ); - return stream; - } - - OutputDataStream &operator << ( OutputDataStream &stream, char val ) - { - stream.write( (char*)&val, sizeof(char) ); - return stream; - } - - OutputDataStream &operator << (OutputDataStream &stream, int8 val) - { - stream.write((char*)&val, sizeof(val)); - return stream; - } - - OutputDataStream &operator << ( OutputDataStream &stream, byte val ) - { - stream.write( (char*)&val, sizeof(byte) ); - return stream; - } - - OutputDataStream & operator<<(OutputDataStream &stream, uint64 val) - { - stream.write( (char*)&val, sizeof(uint64) ); - return stream; - } - - OutputDataStream & operator<<(OutputDataStream &stream, uint32 val) - { - stream.write( (char*)&val, sizeof(uint32) ); - return stream; - } - - OutputDataStream & operator<<(OutputDataStream &stream, float val) - { - stream.write((char*)&val, sizeof(float)); - return stream; - } - - OutputDataStream & operator<<(OutputDataStream &stream, const string& val) - { - stream << (uint32)val.length(); - if (!val.empty()) - stream.write(&val[0], sizeof(val[0]) * val.length()); - return stream; - } - - OutputDataStream & operator<<(OutputDataStream &stream, const wstring& val) - { - size_t count = val.length() * sizeof(wchar_t); - stream << (uint32)count; - if (!val.empty()) - stream.write((char*)(&val[0]), count); - return stream; - } - - InputDataStream &operator >> (InputDataStream &stream, int16 &val) - { - stream.read((char*)&val, sizeof(int16)); - return stream; - } - - InputDataStream &operator >> ( InputDataStream &stream, int32 &val ) - { - stream.read( (char*)&val, sizeof(int) ); - return stream; - } - - InputDataStream &operator >> ( InputDataStream &stream, int64 &val ) - { - stream.read( (char*)&val, sizeof(int64) ); - return stream; - } - - InputDataStream & operator>>( InputDataStream &stream, byte &val ) - { - stream.read( (char*)&val, sizeof(byte) ); - return stream; - } - - InputDataStream & operator >> (InputDataStream &stream, uint16 &val) - { - stream.read((char*)&val, sizeof(uint16)); - return stream; - } - - InputDataStream & operator>>( InputDataStream &stream, uint32 &val ) - { - stream.read( (char*)&val, sizeof(uint32) ); - return stream; - } - - InputDataStream & operator>>( InputDataStream &stream, uint64 &val ) - { - stream.read( (char*)&val, sizeof(uint64) ); - return stream; - } - - InputDataStream & operator >> ( InputDataStream &stream, string &val) - { - int32 length = 0; - stream >> length; - val.resize(length + 1); - stream.read( (char*)&val[0], length); - return stream; - } - - InputDataStream::InputDataStream() : - stringstream( ios_base::in | ios_base::out ) - { - } - - void InputDataStream::Append(const char *buffer, size_t length) - { - write( buffer, length ); - } - - size_t InputDataStream::Length() - { - return (size_t)(tellp() - tellg()); - } - - bool InputDataStream::Skip(size_t length) - { - bool result = Length() <= length; - seekg(length, ios_base::cur); - return result; - } - - - -} - -#endif //USE_OPTICK
\ No newline at end of file |