Merge-related fix for C++
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/02427284 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/02427284 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/02427284 Branch: refs/heads/ignite-4587 Commit: 024272844e6507482c2bee4bbb0cfdfa993fbe5e Parents: 2c4ef9e Author: Igor Sapego <[email protected]> Authored: Thu Apr 13 18:18:43 2017 +0300 Committer: Igor Sapego <[email protected]> Committed: Thu Apr 13 18:18:43 2017 +0300 ---------------------------------------------------------------------- .../core-test/include/ignite/binary_test_defs.h | 10 ++++---- .../cpp/core-test/src/continuous_query_test.cpp | 2 +- .../examples/include/ignite/examples/address.h | 26 +++++++++----------- .../include/ignite/examples/organization.h | 26 +++++++++----------- .../examples/include/ignite/examples/person.h | 16 ++++++------ 5 files changed, 37 insertions(+), 43 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/02427284/modules/platforms/cpp/core-test/include/ignite/binary_test_defs.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core-test/include/ignite/binary_test_defs.h b/modules/platforms/cpp/core-test/include/ignite/binary_test_defs.h index 6c2bde7..9d7dcd2 100644 --- a/modules/platforms/cpp/core-test/include/ignite/binary_test_defs.h +++ b/modules/platforms/cpp/core-test/include/ignite/binary_test_defs.h @@ -158,7 +158,7 @@ namespace ignite return GetBinaryStringHashCode(name); } - bool IsNull(const gt::BinaryInner& obj) + static bool IsNull(const gt::BinaryInner& obj) { return false; } @@ -197,7 +197,7 @@ namespace ignite return GetBinaryStringHashCode(name); } - bool IsNull(const gt::BinaryInner& obj) + static bool IsNull(const gt::BinaryInner& obj) { return obj.GetValue() == 0; } @@ -238,7 +238,7 @@ namespace ignite return GetBinaryStringHashCode(name); } - bool IsNull(const gt::BinaryOuter& obj) + static bool IsNull(const gt::BinaryOuter& obj) { return obj.GetValue() == 0 && obj.GetInner().GetValue(); } @@ -281,7 +281,7 @@ namespace ignite return GetBinaryStringHashCode(name); } - bool IsNull(const gt::BinaryFields& obj) + static bool IsNull(const gt::BinaryFields& obj) { return false; } @@ -334,7 +334,7 @@ namespace ignite return GetBinaryStringHashCode(name); } - bool IsNull(const gt::PureRaw& obj) + static bool IsNull(const gt::PureRaw& obj) { return false; } http://git-wip-us.apache.org/repos/asf/ignite/blob/02427284/modules/platforms/cpp/core-test/src/continuous_query_test.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core-test/src/continuous_query_test.cpp b/modules/platforms/cpp/core-test/src/continuous_query_test.cpp index ea3d665..e092728 100644 --- a/modules/platforms/cpp/core-test/src/continuous_query_test.cpp +++ b/modules/platforms/cpp/core-test/src/continuous_query_test.cpp @@ -295,7 +295,7 @@ namespace ignite IGNITE_BINARY_GET_FIELD_ID_AS_HASH - bool IsNull(const RangeFilter<K,V>&) + static bool IsNull(const RangeFilter<K,V>&) { return false; } http://git-wip-us.apache.org/repos/asf/ignite/blob/02427284/modules/platforms/cpp/examples/include/ignite/examples/address.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/examples/include/ignite/examples/address.h b/modules/platforms/cpp/examples/include/ignite/examples/address.h index b19fb4d..6a06f60 100644 --- a/modules/platforms/cpp/examples/include/ignite/examples/address.h +++ b/modules/platforms/cpp/examples/include/ignite/examples/address.h @@ -59,48 +59,46 @@ namespace ignite template<> struct BinaryType<ignite::examples::Address> { - int32_t GetTypeId() + static int32_t GetTypeId() { return GetBinaryStringHashCode("Address"); } - std::string GetTypeName() + static void GetTypeName(std::string& dst) { - return "Address"; + dst = "Address"; } - int32_t GetFieldId(const char* name) + static int32_t GetFieldId(const char* name) { return GetBinaryStringHashCode(name); } - int32_t GetHashCode(ignite::examples::Address obj) + static int32_t GetHashCode(ignite::examples::Address obj) { return 0; } - bool IsNull(ignite::examples::Address obj) + static bool IsNull(ignite::examples::Address obj) { return false; } - ignite::examples::Address GetNull() + static void GetNull(ignite::examples::Address& dst) { - return ignite::examples::Address("", 0); + dst = ignite::examples::Address("", 0); } - void Write(BinaryWriter& writer, ignite::examples::Address obj) + static void Write(BinaryWriter& writer, const ignite::examples::Address& obj) { writer.WriteString("street", obj.street); writer.WriteInt32("zip", obj.zip); } - ignite::examples::Address Read(BinaryReader& reader) + static void Read(BinaryReader& reader, ignite::examples::Address& dst) { - std::string street = reader.ReadString("street"); - int zip = reader.ReadInt32("zip"); - - return ignite::examples::Address(street, zip); + dst.street = reader.ReadString("street"); + dst.zip = reader.ReadInt32("zip"); } }; } http://git-wip-us.apache.org/repos/asf/ignite/blob/02427284/modules/platforms/cpp/examples/include/ignite/examples/organization.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/examples/include/ignite/examples/organization.h b/modules/platforms/cpp/examples/include/ignite/examples/organization.h index e819d69..942897d 100644 --- a/modules/platforms/cpp/examples/include/ignite/examples/organization.h +++ b/modules/platforms/cpp/examples/include/ignite/examples/organization.h @@ -68,48 +68,46 @@ namespace ignite template<> struct BinaryType<ignite::examples::Organization> { - int32_t GetTypeId() + static int32_t GetTypeId() { return GetBinaryStringHashCode("Organization"); } - std::string GetTypeName() + static void GetTypeName(std::string& dst) { - return "Organization"; + dst = "Organization"; } - int32_t GetFieldId(const char* name) + static int32_t GetFieldId(const char* name) { return GetBinaryStringHashCode(name); } - int32_t GetHashCode(ignite::examples::Organization obj) + static int32_t GetHashCode(ignite::examples::Organization obj) { return 0; } - bool IsNull(ignite::examples::Organization obj) + static bool IsNull(ignite::examples::Organization obj) { return false; } - ignite::examples::Organization GetNull() + static void GetNull(ignite::examples::Organization& dst) { - return ignite::examples::Organization("", ignite::examples::Address()); + dst = ignite::examples::Organization("", ignite::examples::Address()); } - void Write(BinaryWriter& writer, ignite::examples::Organization obj) + static void Write(BinaryWriter& writer, const ignite::examples::Organization& obj) { writer.WriteString("name", obj.name); writer.WriteObject<ignite::examples::Address>("addr", obj.addr); } - ignite::examples::Organization Read(BinaryReader& reader) + static void Read(BinaryReader& reader, ignite::examples::Organization& dst) { - std::string name = reader.ReadString("name"); - ignite::examples::Address addr = reader.ReadObject<ignite::examples::Address>("addr"); - - return ignite::examples::Organization(name, addr); + dst.name = reader.ReadString("name"); + dst.addr = reader.ReadObject<ignite::examples::Address>("addr"); } }; } http://git-wip-us.apache.org/repos/asf/ignite/blob/02427284/modules/platforms/cpp/examples/include/ignite/examples/person.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/examples/include/ignite/examples/person.h b/modules/platforms/cpp/examples/include/ignite/examples/person.h index 64693a9..9a87ef2 100644 --- a/modules/platforms/cpp/examples/include/ignite/examples/person.h +++ b/modules/platforms/cpp/examples/include/ignite/examples/person.h @@ -82,7 +82,7 @@ namespace ignite IGNITE_BINARY_IS_NULL_FALSE(Person) IGNITE_BINARY_GET_NULL_DEFAULT_CTOR(Person) - void Write(BinaryWriter& writer, ignite::examples::Person obj) + static void Write(BinaryWriter& writer, const ignite::examples::Person& obj) { writer.WriteInt64("orgId", obj.orgId); writer.WriteString("firstName", obj.firstName); @@ -91,15 +91,13 @@ namespace ignite writer.WriteDouble("salary", obj.salary); } - ignite::examples::Person Read(BinaryReader& reader) + static void Read(BinaryReader& reader, ignite::examples::Person& dst) { - int64_t orgId = reader.ReadInt64("orgId"); - std::string firstName = reader.ReadString("firstName"); - std::string lastName = reader.ReadString("lastName"); - std::string resume = reader.ReadString("resume"); - double salary = reader.ReadDouble("salary"); - - return ignite::examples::Person(orgId, firstName, lastName, resume, salary); + dst.orgId = reader.ReadInt64("orgId"); + dst.firstName = reader.ReadString("firstName"); + dst.lastName = reader.ReadString("lastName"); + dst.resume = reader.ReadString("resume"); + dst.salary = reader.ReadDouble("salary"); } IGNITE_BINARY_TYPE_END
