You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2015/11/17 15:17:25 UTC
ignite git commit: IGNITE-1901: CPP: New marshalling flags are
applied.
Repository: ignite
Updated Branches:
refs/heads/ignite-1816 3f2320e2b -> c46ebd5ed
IGNITE-1901: CPP: New marshalling flags are applied.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c46ebd5e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c46ebd5e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c46ebd5e
Branch: refs/heads/ignite-1816
Commit: c46ebd5edcf12640fcb1c2749cdd9179de1614cb
Parents: 3f2320e
Author: isapego <is...@gridgain.com>
Authored: Tue Nov 17 17:18:03 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Tue Nov 17 17:18:03 2015 +0300
----------------------------------------------------------------------
.../core-test/src/binary_reader_writer_test.cpp | 64 ++++++++++----------
.../include/ignite/impl/binary/binary_common.h | 22 ++++---
.../ignite/impl/binary/binary_reader_impl.h | 58 +++++++++---------
.../include/ignite/impl/binary/binary_schema.h | 6 +-
.../ignite/impl/binary/binary_writer_impl.h | 2 +-
.../core/src/impl/binary/binary_reader_impl.cpp | 8 +--
.../cpp/core/src/impl/binary/binary_schema.cpp | 12 ++--
.../core/src/impl/binary/binary_writer_impl.cpp | 29 ++++-----
8 files changed, 103 insertions(+), 98 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c46ebd5e/modules/platforms/cpp/core-test/src/binary_reader_writer_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/binary_reader_writer_test.cpp b/modules/platforms/cpp/core-test/src/binary_reader_writer_test.cpp
index d273b11..b2551ec 100644
--- a/modules/platforms/cpp/core-test/src/binary_reader_writer_test.cpp
+++ b/modules/platforms/cpp/core-test/src/binary_reader_writer_test.cpp
@@ -70,7 +70,7 @@ void CheckPrimitive(T val)
int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF);
int32_t footerEnd = footerBegin + 5;
- BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_1_BYTE);
+ BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE);
BinaryReader reader(&readerImpl);
try
@@ -150,7 +150,7 @@ void CheckPrimitiveArray(T dflt, T val1, T val2)
int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF);
int32_t footerEnd = footerBegin + 5;
- BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_1_BYTE);
+ BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE);
BinaryReader reader(&readerImpl);
in.Position(IGNITE_DFLT_HDR_LEN);
@@ -183,7 +183,7 @@ void CheckPrimitiveArray(T dflt, T val1, T val2)
int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF);
int32_t footerEnd = footerBegin + 5;
- BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_1_BYTE);
+ BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE);
BinaryReader reader(&readerImpl);
in.Position(IGNITE_DFLT_HDR_LEN);
@@ -220,7 +220,7 @@ void CheckPrimitiveArray(T dflt, T val1, T val2)
int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF);
int32_t footerEnd = footerBegin + 5;
- BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_1_BYTE);
+ BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE);
BinaryReader reader(&readerImpl);
in.Position(IGNITE_DFLT_HDR_LEN);
@@ -260,7 +260,7 @@ void CheckPrimitiveArray(T dflt, T val1, T val2)
int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF);
int32_t footerEnd = footerBegin + 5;
- BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_1_BYTE);
+ BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE);
BinaryReader reader(&readerImpl);
in.Position(IGNITE_DFLT_HDR_LEN);
@@ -512,7 +512,7 @@ void CheckCollectionEmpty(CollectionType* colType)
int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF);
int32_t footerEnd = footerBegin + 5 * 2;
- BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_1_BYTE);
+ BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE);
BinaryReader reader(&readerImpl);
in.Position(IGNITE_DFLT_HDR_LEN);
@@ -602,7 +602,7 @@ void CheckCollection(CollectionType* colType)
int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF);
int32_t footerEnd = footerBegin + 5 * 2;
- BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_1_BYTE);
+ BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE);
BinaryReader reader(&readerImpl);
in.Position(IGNITE_DFLT_HDR_LEN);
@@ -679,7 +679,7 @@ void CheckCollectionIterators(CollectionType* colType)
int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF);
int32_t footerEnd = footerBegin + 5 * 2;
- BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_1_BYTE);
+ BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE);
BinaryReader reader(&readerImpl);
in.Position(IGNITE_DFLT_HDR_LEN);
@@ -755,7 +755,7 @@ void CheckMapEmpty(MapType* mapType)
int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF);
int32_t footerEnd = footerBegin + 5 * 2;
- BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_1_BYTE);
+ BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE);
BinaryReader reader(&readerImpl);
in.Position(IGNITE_DFLT_HDR_LEN);
@@ -848,7 +848,7 @@ void CheckMap(MapType* mapType)
int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF);
int32_t footerEnd = footerBegin + 5 * 2;
- BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_1_BYTE);
+ BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE);
BinaryReader reader(&readerImpl);
in.Position(IGNITE_DFLT_HDR_LEN);
@@ -1030,7 +1030,7 @@ BOOST_AUTO_TEST_CASE(TestGuidNull)
int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF);
int32_t footerEnd = footerBegin + 5;
- BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_1_BYTE);
+ BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE);
BinaryReader reader(&readerImpl);
in.Position(IGNITE_DFLT_HDR_LEN);
@@ -1115,7 +1115,7 @@ BOOST_AUTO_TEST_CASE(TestString) {
int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF);
int32_t footerEnd = footerBegin + 5 * 5;
- BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_1_BYTE);
+ BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE);
BinaryReader reader(&readerImpl);
in.Position(IGNITE_DFLT_HDR_LEN);
@@ -1193,7 +1193,7 @@ BOOST_AUTO_TEST_CASE(TestStringArrayNull)
int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF);
int32_t footerEnd = footerBegin + 5 * 2;
- BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_1_BYTE);
+ BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE);
BinaryReader reader(&readerImpl);
in.Position(IGNITE_DFLT_HDR_LEN);
@@ -1310,7 +1310,7 @@ BOOST_AUTO_TEST_CASE(TestStringArrayEmpty)
int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF);
int32_t footerEnd = footerBegin + 5 * 2;
- BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_1_BYTE);
+ BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE);
BinaryReader reader(&readerImpl);
in.Position(IGNITE_DFLT_HDR_LEN);
@@ -1437,7 +1437,7 @@ BOOST_AUTO_TEST_CASE(TestStringArray)
int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF);
int32_t footerEnd = footerBegin + 5 * 2;
- BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_1_BYTE);
+ BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE);
BinaryReader reader(&readerImpl);
in.Position(IGNITE_DFLT_HDR_LEN);
@@ -1551,7 +1551,7 @@ BOOST_AUTO_TEST_CASE(TestObject)
int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF);
int32_t footerEnd = footerBegin + 5 * 3;
- BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_1_BYTE);
+ BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE);
BinaryReader reader(&readerImpl);
in.Position(IGNITE_DFLT_HDR_LEN);
@@ -1595,7 +1595,7 @@ BOOST_AUTO_TEST_CASE(TestNestedObject)
int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF);
int32_t footerEnd = footerBegin + 5 * 3;
- BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_1_BYTE);
+ BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE);
BinaryReader reader(&readerImpl);
in.Position(IGNITE_DFLT_HDR_LEN);
@@ -1637,7 +1637,7 @@ BOOST_AUTO_TEST_CASE(TestArrayNull)
int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF);
int32_t footerEnd = footerBegin + 5 * 2;
- BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_1_BYTE);
+ BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE);
BinaryReader reader(&readerImpl);
in.Position(IGNITE_DFLT_HDR_LEN);
@@ -1713,7 +1713,7 @@ BOOST_AUTO_TEST_CASE(TestArrayEmpty)
int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF);
int32_t footerEnd = footerBegin + 5 * 2;
- BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_1_BYTE);
+ BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE);
BinaryReader reader(&readerImpl);
in.Position(IGNITE_DFLT_HDR_LEN);
@@ -1797,7 +1797,7 @@ BOOST_AUTO_TEST_CASE(TestArray)
int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF);
int32_t footerEnd = footerBegin + 5 * 2;
- BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_1_BYTE);
+ BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE);
BinaryReader reader(&readerImpl);
in.Position(IGNITE_DFLT_HDR_LEN);
@@ -1858,7 +1858,7 @@ BOOST_AUTO_TEST_CASE(TestCollectionNull)
int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF);
int32_t footerEnd = footerBegin + 5 * 2;
- BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_1_BYTE);
+ BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE);
BinaryReader reader(&readerImpl);
in.Position(IGNITE_DFLT_HDR_LEN);
@@ -1944,7 +1944,7 @@ BOOST_AUTO_TEST_CASE(TestMapNull)
int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF);
int32_t footerEnd = footerBegin + 5 * 2;
- BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_1_BYTE);
+ BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE);
BinaryReader reader(&readerImpl);
in.Position(IGNITE_DFLT_HDR_LEN);
@@ -2035,7 +2035,7 @@ BOOST_AUTO_TEST_CASE(TestRawMode)
int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF);
int32_t footerEnd = footerBegin;
- BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 1000, footerBegin, footerBegin, footerEnd, OFFSET_TYPE_1_BYTE);
+ BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 1000, footerBegin, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE);
BinaryReader reader(&readerImpl);
in.Position(IGNITE_DFLT_HDR_LEN);
@@ -2091,10 +2091,10 @@ BOOST_AUTO_TEST_CASE(TestFieldSeek)
int32_t rawOff;
int32_t footerBegin;
- if (flags & IGNITE_BINARY_FLAG_RAW_ONLY)
- footerBegin = len;
- else
+ if (flags & IGNITE_BINARY_FLAG_HAS_SCHEMA)
footerBegin = schemaOrRawOff;
+ else
+ footerBegin = len;
int32_t trailingBytes = (len - footerBegin) % 8;
@@ -2105,14 +2105,14 @@ BOOST_AUTO_TEST_CASE(TestFieldSeek)
else
rawOff = schemaOrRawOff;
- bool usrType = flags & IGNITE_BINARY_FLAG_USER_OBJECT;
+ bool usrType = flags & IGNITE_BINARY_FLAG_USER_TYPE;
footerBegin += pos;
footerEnd += pos;
BinaryReaderImpl readerImpl(&in, &idRslvr, pos, usrType,
typeId, hashCode, len, rawOff,
- footerBegin, footerEnd, OFFSET_TYPE_1_BYTE);
+ footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE);
BinaryReader reader(&readerImpl);
@@ -2243,7 +2243,7 @@ BOOST_AUTO_TEST_CASE(TestSchemaOffset2ByteFields)
int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF);
int32_t footerEnd = footerBegin + 6 * fieldsNum;
- BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_2_BYTE);
+ BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_TWO_BYTES);
BinaryReader reader(&readerImpl);
in.Position(IGNITE_DFLT_HDR_LEN);
@@ -2288,7 +2288,7 @@ BOOST_AUTO_TEST_CASE(TestSchemaOffset4ByteFields)
int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF);
int32_t footerEnd = footerBegin + 8 * fieldsNum;
- BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_4_BYTE);
+ BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_FOUR_BYTES);
BinaryReader reader(&readerImpl);
in.Position(IGNITE_DFLT_HDR_LEN);
@@ -2328,7 +2328,7 @@ BOOST_AUTO_TEST_CASE(TestSchemaOffset2ByteArray)
int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF);
int32_t footerEnd = footerBegin + 6 * 2;
- BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_2_BYTE);
+ BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_TWO_BYTES);
BinaryReader reader(&readerImpl);
in.Position(IGNITE_DFLT_HDR_LEN);
@@ -2362,7 +2362,7 @@ BOOST_AUTO_TEST_CASE(TestSchemaOffset4ByteArray)
int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF);
int32_t footerEnd = footerBegin + 8 * 2;
- BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_4_BYTE);
+ BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_FOUR_BYTES);
BinaryReader reader(&readerImpl);
in.Position(IGNITE_DFLT_HDR_LEN);
http://git-wip-us.apache.org/repos/asf/ignite/blob/c46ebd5e/modules/platforms/cpp/core/include/ignite/impl/binary/binary_common.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/impl/binary/binary_common.h b/modules/platforms/cpp/core/include/ignite/impl/binary/binary_common.h
index d487941..979d2ed 100644
--- a/modules/platforms/cpp/core/include/ignite/impl/binary/binary_common.h
+++ b/modules/platforms/cpp/core/include/ignite/impl/binary/binary_common.h
@@ -21,7 +21,7 @@
#include <stdint.h>
namespace ignite
-{
+{
namespace impl
{
namespace binary
@@ -164,19 +164,25 @@ namespace ignite
/** Read/write map. */
const int32_t IGNITE_BINARY_MODE_MAP = 3;
- /** User object flag. */
- const int16_t IGNITE_BINARY_FLAG_USER_OBJECT = 0x0001;
+ /** User type flag. */
+ const int16_t IGNITE_BINARY_FLAG_USER_TYPE = 0x0001;
- /** Raw only flag. */
- const int16_t IGNITE_BINARY_FLAG_RAW_ONLY = 0x0002;
+ /** Flag: schema exists. */
+ const int16_t IGNITE_BINARY_FLAG_HAS_SCHEMA = 0x0002;
+
+ /** Flag indicating that object has raw data. */
+ const int16_t IGNITE_BINARY_FLAG_HAS_RAW = 0x0004;
/** Flag indicating that schema field offset is one byte long. */
- const int16_t IGNITE_BINARY_FLAG_OFFSET_1_BYTE = 0x0004;
+ const int16_t IGNITE_BINARY_FLAG_OFFSET_ONE_BYTE = 0x0008;
/** Flag indicating that schema field offset is two byte long. */
- const int16_t IGNITE_BINARY_FLAG_OFFSET_2_BYTE = 0x0008;
+ const int16_t IGNITE_BINARY_FLAG_OFFSET_TWO_BYTES = 0x0010;
+
+ /** Flag: compact footer, no field IDs. */
+ const int16_t IGNITE_BINARY_FLAG_COMPACT_FOOTER = 0x0020;
}
- }
+ }
}
#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/c46ebd5e/modules/platforms/cpp/core/include/ignite/impl/binary/binary_reader_impl.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/impl/binary/binary_reader_impl.h b/modules/platforms/cpp/core/include/ignite/impl/binary/binary_reader_impl.h
index 923553d..0b2b592 100644
--- a/modules/platforms/cpp/core/include/ignite/impl/binary/binary_reader_impl.h
+++ b/modules/platforms/cpp/core/include/ignite/impl/binary/binary_reader_impl.h
@@ -771,6 +771,13 @@ namespace ignite
}
int16_t flags = stream->ReadInt16();
+
+ if (flags & IGNITE_BINARY_FLAG_COMPACT_FOOTER) {
+ IGNITE_ERROR_2(ignite::IgniteError::IGNITE_ERR_BINARY,
+ "Unsupported binary protocol flag: IGNITE_BINARY_FLAG_COMPACT_FOOTER: ",
+ IGNITE_BINARY_FLAG_COMPACT_FOOTER);
+ }
+
int32_t typeId = stream->ReadInt32();
int32_t hashCode = stream->ReadInt32();
int32_t len = stream->ReadInt32();
@@ -783,50 +790,43 @@ namespace ignite
int32_t rawOff;
int32_t footerBegin;
- if (flags & IGNITE_BINARY_FLAG_RAW_ONLY)
- footerBegin = len;
+ if (flags & IGNITE_BINARY_FLAG_HAS_SCHEMA)
+ footerBegin = pos + schemaOrRawOff;
else
- footerBegin = schemaOrRawOff;
+ footerBegin = pos + len;
BinaryOffsetType schemaType;
- int32_t trailingBytes;
- if (flags & IGNITE_BINARY_FLAG_OFFSET_1_BYTE)
- {
- schemaType = OFFSET_TYPE_1_BYTE;
+ if (flags & IGNITE_BINARY_FLAG_OFFSET_ONE_BYTE)
+ schemaType = OFFSET_TYPE_ONE_BYTE;
+ else if (flags & IGNITE_BINARY_FLAG_OFFSET_TWO_BYTES)
+ schemaType = OFFSET_TYPE_TWO_BYTES;
+ else
+ schemaType = OFFSET_TYPE_FOUR_BYTES;
- trailingBytes = (len - footerBegin) % 5;
- }
- else if (flags & IGNITE_BINARY_FLAG_OFFSET_2_BYTE)
+ int32_t footerEnd;
+
+ if (flags & IGNITE_BINARY_FLAG_HAS_RAW)
{
- schemaType = OFFSET_TYPE_2_BYTE;
+ // 4 is the size of RawOffset field at the end of the packet.
+ footerEnd = pos + len - 4;
- trailingBytes = (len - footerBegin) % 6;
+ rawOff = stream->ReadInt32(footerEnd);
}
else
{
- schemaType = OFFSET_TYPE_4_BYTE;
-
- trailingBytes = (len - footerBegin) % 8;
- }
-
- int32_t footerEnd = len - trailingBytes;
+ footerEnd = pos + len;
- if (trailingBytes)
- rawOff = stream->ReadInt32(pos + len - 4);
- else
rawOff = schemaOrRawOff;
+ }
- bool usrType = flags & IGNITE_BINARY_FLAG_USER_OBJECT;
-
- footerBegin += pos;
- footerEnd += pos;
+ bool usrType = flags & IGNITE_BINARY_FLAG_USER_TYPE;
ignite::binary::BinaryType<T> type;
TemplatedBinaryIdResolver<T> idRslvr(type);
BinaryReaderImpl readerImpl(stream, &idRslvr, pos, usrType,
- typeId, hashCode, len, rawOff,
- footerBegin, footerEnd, schemaType);
+ typeId, hashCode, len, rawOff,
+ footerBegin, footerEnd, schemaType);
ignite::binary::BinaryReader reader(&readerImpl);
T val = type.Read(reader);
@@ -1038,9 +1038,7 @@ namespace ignite
{
CheckRawMode(false);
CheckSingleMode(true);
-
- int32_t pos = stream->Position();
-
+
int32_t fieldId = idRslvr->GetFieldId(typeId, fieldName);
int32_t fieldPos = FindField(fieldId);
http://git-wip-us.apache.org/repos/asf/ignite/blob/c46ebd5e/modules/platforms/cpp/core/include/ignite/impl/binary/binary_schema.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/impl/binary/binary_schema.h b/modules/platforms/cpp/core/include/ignite/impl/binary/binary_schema.h
index d0a9f26..b100b8c 100644
--- a/modules/platforms/cpp/core/include/ignite/impl/binary/binary_schema.h
+++ b/modules/platforms/cpp/core/include/ignite/impl/binary/binary_schema.h
@@ -39,13 +39,13 @@ namespace ignite
enum BinaryOffsetType
{
/** Means all field offsets can be fit in one byte. */
- OFFSET_TYPE_1_BYTE,
+ OFFSET_TYPE_ONE_BYTE,
/** Means all field offsets can be fit in two bytes. */
- OFFSET_TYPE_2_BYTE,
+ OFFSET_TYPE_TWO_BYTES,
/** Means field offsets should be stored in four bytes. */
- OFFSET_TYPE_4_BYTE
+ OFFSET_TYPE_FOUR_BYTES
};
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/c46ebd5e/modules/platforms/cpp/core/include/ignite/impl/binary/binary_writer_impl.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/impl/binary/binary_writer_impl.h b/modules/platforms/cpp/core/include/ignite/impl/binary/binary_writer_impl.h
index fe31ece..1b47d9e 100644
--- a/modules/platforms/cpp/core/include/ignite/impl/binary/binary_writer_impl.h
+++ b/modules/platforms/cpp/core/include/ignite/impl/binary/binary_writer_impl.h
@@ -601,7 +601,7 @@ namespace ignite
stream->WriteInt8(IGNITE_HDR_FULL);
stream->WriteInt8(IGNITE_PROTO_VER);
- stream->WriteInt16(IGNITE_BINARY_FLAG_USER_OBJECT);
+ stream->WriteInt16(IGNITE_BINARY_FLAG_USER_TYPE);
stream->WriteInt32(idRslvr.GetTypeId());
stream->WriteInt32(type.GetHashCode(obj));
http://git-wip-us.apache.org/repos/asf/ignite/blob/c46ebd5e/modules/platforms/cpp/core/src/impl/binary/binary_reader_impl.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/src/impl/binary/binary_reader_impl.cpp b/modules/platforms/cpp/core/src/impl/binary/binary_reader_impl.cpp
index e189273..5fcbc75 100644
--- a/modules/platforms/cpp/core/src/impl/binary/binary_reader_impl.cpp
+++ b/modules/platforms/cpp/core/src/impl/binary/binary_reader_impl.cpp
@@ -47,7 +47,7 @@ namespace ignite
BinaryReaderImpl::BinaryReaderImpl(InteropInputStream* stream) :
stream(stream), idRslvr(NULL), pos(0), usrType(false), typeId(0), hashCode(0), len(0),
rawOff(0), rawMode(true), elemIdGen(0), elemId(0), elemCnt(-1), elemRead(0), footerBegin(-1),
- footerEnd(-1), schemaType(OFFSET_TYPE_4_BYTE)
+ footerEnd(-1), schemaType(OFFSET_TYPE_FOUR_BYTES)
{
// No-op.
}
@@ -637,7 +637,7 @@ namespace ignite
switch (schemaType)
{
- case OFFSET_TYPE_1_BYTE:
+ case OFFSET_TYPE_ONE_BYTE:
{
for (int32_t schemaPos = footerBegin; schemaPos < footerEnd; schemaPos += 5)
{
@@ -649,7 +649,7 @@ namespace ignite
break;
}
- case OFFSET_TYPE_2_BYTE:
+ case OFFSET_TYPE_TWO_BYTES:
{
for (int32_t schemaPos = footerBegin; schemaPos < footerEnd; schemaPos += 6)
{
@@ -661,7 +661,7 @@ namespace ignite
break;
}
- case OFFSET_TYPE_4_BYTE:
+ case OFFSET_TYPE_FOUR_BYTES:
{
for (int32_t schemaPos = footerBegin; schemaPos < footerEnd; schemaPos += 8)
{
http://git-wip-us.apache.org/repos/asf/ignite/blob/c46ebd5e/modules/platforms/cpp/core/src/impl/binary/binary_schema.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/src/impl/binary/binary_schema.cpp b/modules/platforms/cpp/core/src/impl/binary/binary_schema.cpp
index 1596557..0b8025a 100644
--- a/modules/platforms/cpp/core/src/impl/binary/binary_schema.cpp
+++ b/modules/platforms/cpp/core/src/impl/binary/binary_schema.cpp
@@ -70,7 +70,7 @@ namespace ignite
{
switch (GetType())
{
- case OFFSET_TYPE_1_BYTE:
+ case OFFSET_TYPE_ONE_BYTE:
{
for (FieldContainer::const_iterator i = fieldsInfo->begin(); i != fieldsInfo->end(); ++i)
{
@@ -80,7 +80,7 @@ namespace ignite
break;
}
- case OFFSET_TYPE_2_BYTE:
+ case OFFSET_TYPE_TWO_BYTES:
{
for (FieldContainer::const_iterator i = fieldsInfo->begin(); i != fieldsInfo->end(); ++i)
{
@@ -90,7 +90,7 @@ namespace ignite
break;
}
- case OFFSET_TYPE_4_BYTE:
+ case OFFSET_TYPE_FOUR_BYTES:
{
for (FieldContainer::const_iterator i = fieldsInfo->begin(); i != fieldsInfo->end(); ++i)
{
@@ -124,11 +124,11 @@ namespace ignite
int32_t maxOffset = fieldsInfo->back().offset;
if (maxOffset < 0x100)
- return OFFSET_TYPE_1_BYTE;
+ return OFFSET_TYPE_ONE_BYTE;
else if (maxOffset < 0x10000)
- return OFFSET_TYPE_2_BYTE;
+ return OFFSET_TYPE_TWO_BYTES;
- return OFFSET_TYPE_4_BYTE;
+ return OFFSET_TYPE_FOUR_BYTES;
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/c46ebd5e/modules/platforms/cpp/core/src/impl/binary/binary_writer_impl.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/src/impl/binary/binary_writer_impl.cpp b/modules/platforms/cpp/core/src/impl/binary/binary_writer_impl.cpp
index 47df19d..d03d6ba 100644
--- a/modules/platforms/cpp/core/src/impl/binary/binary_writer_impl.cpp
+++ b/modules/platforms/cpp/core/src/impl/binary/binary_writer_impl.cpp
@@ -563,11 +563,15 @@ namespace ignite
int32_t lenWithoutSchema = stream->Position() - start;
int32_t nonRawLen = rawPos == -1 ? lenWithoutSchema : rawPos - start;
-
- if (schema.Empty())
+
+ uint16_t flags = IGNITE_BINARY_FLAG_USER_TYPE;
+
+ if (rawPos > 0)
+ flags |= IGNITE_BINARY_FLAG_HAS_RAW;
+
+ if (!HasSchema())
{
- stream->WriteInt16(start + IGNITE_OFFSET_FLAGS, IGNITE_BINARY_FLAG_USER_OBJECT |
- IGNITE_BINARY_FLAG_RAW_ONLY);
+ stream->WriteInt16(start + IGNITE_OFFSET_FLAGS, flags);
stream->WriteInt32(start + IGNITE_OFFSET_LEN, lenWithoutSchema);
stream->WriteInt32(start + IGNITE_OFFSET_SCHEMA_ID, 0);
stream->WriteInt32(start + IGNITE_OFFSET_SCHEMA_OR_RAW_OFF, GetRawPosition() - start);
@@ -584,17 +588,14 @@ namespace ignite
int32_t length = stream->Position() - start;
- if (schemaType == OFFSET_TYPE_1_BYTE)
- {
- stream->WriteInt16(start + IGNITE_OFFSET_FLAGS,
- IGNITE_BINARY_FLAG_USER_OBJECT | IGNITE_BINARY_FLAG_OFFSET_1_BYTE);
- }
- else if (schemaType == OFFSET_TYPE_2_BYTE)
- {
- stream->WriteInt16(start + IGNITE_OFFSET_FLAGS,
- IGNITE_BINARY_FLAG_USER_OBJECT | IGNITE_BINARY_FLAG_OFFSET_2_BYTE);
- }
+ flags |= IGNITE_BINARY_FLAG_HAS_SCHEMA;
+
+ if (schemaType == OFFSET_TYPE_ONE_BYTE)
+ flags |= IGNITE_BINARY_FLAG_OFFSET_ONE_BYTE;
+ else if (schemaType == OFFSET_TYPE_TWO_BYTES)
+ flags |= IGNITE_BINARY_FLAG_OFFSET_TWO_BYTES;
+ stream->WriteInt16(start + IGNITE_OFFSET_FLAGS, flags);
stream->WriteInt32(start + IGNITE_OFFSET_LEN, length);
stream->WriteInt32(start + IGNITE_OFFSET_SCHEMA_ID, schemaId);
stream->WriteInt32(start + IGNITE_OFFSET_SCHEMA_OR_RAW_OFF, lenWithoutSchema);