Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 5DCFA200D15 for ; Thu, 21 Sep 2017 07:20:14 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 5B57D1609E3; Thu, 21 Sep 2017 05:20:14 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 4BB361609E2 for ; Thu, 21 Sep 2017 07:20:11 +0200 (CEST) Received: (qmail 24894 invoked by uid 500); 21 Sep 2017 05:20:10 -0000 Mailing-List: contact commits-help@geode.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@geode.apache.org Delivered-To: mailing list commits@geode.apache.org Received: (qmail 24879 invoked by uid 99); 21 Sep 2017 05:20:10 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Sep 2017 05:20:10 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 62F8581702; Thu, 21 Sep 2017 05:20:09 +0000 (UTC) Date: Thu, 21 Sep 2017 05:20:09 +0000 To: "commits@geode.apache.org" Subject: [geode-native] branch develop updated: Revert "GEODE-3630: Change to void Serializable::fromData(...)" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <150597120930.25493.2419432210609242765@gitbox.apache.org> From: jbarrett@apache.org Reply-To: "commits@geode.apache.org" X-Git-Host: gitbox.apache.org X-Git-Repo: geode-native X-Git-Refname: refs/heads/develop X-Git-Reftype: branch X-Git-Oldrev: 5ddb7bd0d0c4c221075a020912fb264239cc8c4f X-Git-Newrev: b0545b7d9739fea764db862b6d923b0af21c7c9a X-Git-Rev: b0545b7d9739fea764db862b6d923b0af21c7c9a X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated archived-at: Thu, 21 Sep 2017 05:20:14 -0000 This is an automated email from the ASF dual-hosted git repository. jbarrett pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode-native.git The following commit(s) were added to refs/heads/develop by this push: new b0545b7 Revert "GEODE-3630: Change to void Serializable::fromData(...)" b0545b7 is described below commit b0545b7d9739fea764db862b6d923b0af21c7c9a Author: Jacob Barrett AuthorDate: Thu Sep 21 02:39:56 2017 +0000 Revert "GEODE-3630: Change to void Serializable::fromData(...)" This reverts commit ed74ca26ee43765663bd26ea60f0a7093429fee3. --- clicache/src/Properties.cpp | 7 +- clicache/src/RegionAttributes.cpp | 6 +- clicache/src/Serializable.cpp | 7 +- clicache/src/impl/ManagedCacheableDelta.cpp | 3 +- clicache/src/impl/ManagedCacheableDelta.hpp | 2 +- clicache/src/impl/ManagedCacheableDeltaBytes.cpp | 3 +- clicache/src/impl/ManagedCacheableDeltaBytes.hpp | 2 +- clicache/src/impl/ManagedCacheableKey.cpp | 8 +- clicache/src/impl/ManagedCacheableKey.hpp | 2 +- clicache/src/impl/ManagedCacheableKeyBytes.cpp | 3 +- clicache/src/impl/ManagedCacheableKeyBytes.hpp | 2 +- clicache/src/impl/PdxManagedCacheableKey.cpp | 3 +- clicache/src/impl/PdxManagedCacheableKey.hpp | 2 +- clicache/src/impl/PdxManagedCacheableKeyBytes.cpp | 3 +- clicache/src/impl/PdxManagedCacheableKeyBytes.hpp | 2 +- cppcache/include/geode/CacheableBuiltins.hpp | 102 +-- cppcache/include/geode/CacheableDate.hpp | 14 +- cppcache/include/geode/CacheableEnum.hpp | 88 ++- cppcache/include/geode/CacheableFileName.hpp | 14 +- cppcache/include/geode/CacheableObjectArray.hpp | 14 +- cppcache/include/geode/CacheableString.hpp | 13 +- cppcache/include/geode/CacheableUndefined.hpp | 13 +- cppcache/include/geode/PdxInstance.hpp | 814 +++++++++++---------- cppcache/include/geode/PdxSerializable.hpp | 13 +- cppcache/include/geode/PdxWrapper.hpp | 2 +- cppcache/include/geode/Properties.hpp | 13 +- cppcache/include/geode/RegionAttributes.hpp | 18 +- cppcache/include/geode/Serializable.hpp | 28 +- cppcache/include/geode/Struct.hpp | 5 +- .../geode/UserFunctionExecutionException.hpp | 14 +- cppcache/integration-test/DeltaEx.hpp | 13 +- cppcache/integration-test/testSerialization.cpp | 3 +- cppcache/src/BucketServerLocation.hpp | 17 +- cppcache/src/CacheFactory.cpp | 16 +- cppcache/src/CacheableDate.cpp | 5 +- cppcache/src/CacheableEnum.cpp | 5 +- cppcache/src/CacheableFileName.cpp | 5 +- cppcache/src/CacheableObjectArray.cpp | 3 +- cppcache/src/CacheableObjectPartList.cpp | 3 +- cppcache/src/CacheableObjectPartList.hpp | 14 +- cppcache/src/CacheableString.cpp | 3 +- cppcache/src/CacheableToken.cpp | 3 +- cppcache/src/CacheableToken.hpp | 13 +- cppcache/src/CacheableUndefined.cpp | 2 +- cppcache/src/CachedDeserializableHelper.hpp | 106 +++ cppcache/src/ClientConnectionRequest.cpp | 16 +- cppcache/src/ClientConnectionRequest.hpp | 33 +- cppcache/src/ClientConnectionResponse.cpp | 8 +- cppcache/src/ClientConnectionResponse.hpp | 24 +- cppcache/src/ClientHealthStats.cpp | 3 +- cppcache/src/ClientHealthStats.hpp | 13 +- cppcache/src/ClientProxyMembershipID.cpp | 4 +- cppcache/src/ClientProxyMembershipID.hpp | 14 +- cppcache/src/ClientReplacementRequest.cpp | 9 +- cppcache/src/ClientReplacementRequest.hpp | 15 +- cppcache/src/DiskStoreId.hpp | 18 +- cppcache/src/EnumInfo.cpp | 3 +- cppcache/src/EnumInfo.hpp | 13 +- cppcache/src/EventId.cpp | 3 +- cppcache/src/EventId.hpp | 15 +- cppcache/src/FixedPartitionAttributesImpl.hpp | 15 +- ...equest.hpp => GatewayEventCallbackArgument.hpp} | 62 +- .../src/GatewaySenderEventCallbackArgument.hpp | 76 ++ cppcache/src/GetAllServersRequest.cpp | 3 +- cppcache/src/GetAllServersRequest.hpp | 14 +- cppcache/src/GetAllServersResponse.cpp | 3 +- cppcache/src/GetAllServersResponse.hpp | 14 +- cppcache/src/LocatorListRequest.cpp | 8 +- cppcache/src/LocatorListRequest.hpp | 16 +- cppcache/src/LocatorListResponse.cpp | 11 +- cppcache/src/LocatorListResponse.hpp | 16 +- ...heableUndefined.cpp => PdxEnumInstantiator.cpp} | 34 +- ...atorListRequest.hpp => PdxEnumInstantiator.hpp} | 45 +- cppcache/src/PdxFieldType.cpp | 3 +- cppcache/src/PdxFieldType.hpp | 15 +- cppcache/src/PdxInstanceImpl.hpp | 2 +- .../{PdxSerializable.cpp => PdxInstantiator.cpp} | 44 +- ...{LocatorListRequest.hpp => PdxInstantiator.hpp} | 42 +- cppcache/src/PdxSerializable.cpp | 2 +- cppcache/src/PdxType.cpp | 12 +- cppcache/src/PdxType.hpp | 13 +- cppcache/src/PdxWrapper.cpp | 2 +- cppcache/src/Properties.cpp | 7 +- cppcache/src/PutAllPartialResult.hpp | 15 +- .../src/PutAllPartialResultServerException.cpp | 5 +- .../src/PutAllPartialResultServerException.hpp | 13 +- cppcache/src/QueueConnectionRequest.cpp | 15 +- cppcache/src/QueueConnectionRequest.hpp | 16 +- cppcache/src/QueueConnectionResponse.cpp | 6 +- cppcache/src/QueueConnectionResponse.hpp | 21 +- cppcache/src/RegionAttributes.cpp | 4 +- cppcache/src/SerializationRegistry.cpp | 118 ++- cppcache/src/ServerLocation.hpp | 21 +- cppcache/src/ServerLocationRequest.hpp | 15 +- cppcache/src/ServerLocationResponse.hpp | 16 +- cppcache/src/Struct.cpp | 3 +- cppcache/src/TXCommitMessage.cpp | 18 +- cppcache/src/TXCommitMessage.hpp | 21 +- cppcache/src/UserFunctionExecutionException.cpp | 3 +- cppcache/src/VersionTag.cpp | 3 +- cppcache/src/VersionTag.hpp | 15 +- cppcache/src/VersionedCacheableObjectPartList.cpp | 4 +- cppcache/src/VersionedCacheableObjectPartList.hpp | 25 +- quickstart/cpp/queryobjects/Position.hpp | 5 +- tests/cpp/testobject/BatchObject.cpp | 6 +- tests/cpp/testobject/BatchObject.hpp | 13 +- tests/cpp/testobject/DeltaFastAssetAccount.cpp | 6 +- tests/cpp/testobject/DeltaFastAssetAccount.hpp | 13 +- tests/cpp/testobject/DeltaPSTObject.cpp | 9 +- tests/cpp/testobject/DeltaPSTObject.hpp | 13 +- tests/cpp/testobject/DeltaTestImpl.cpp | 3 +- tests/cpp/testobject/DeltaTestImpl.hpp | 21 +- tests/cpp/testobject/EqStruct.cpp | 6 +- tests/cpp/testobject/EqStruct.hpp | 13 +- tests/cpp/testobject/FastAsset.cpp | 5 +- tests/cpp/testobject/FastAsset.hpp | 13 +- tests/cpp/testobject/FastAssetAccount.cpp | 9 +- tests/cpp/testobject/FastAssetAccount.hpp | 13 +- tests/cpp/testobject/PSTObject.cpp | 7 +- tests/cpp/testobject/PSTObject.hpp | 13 +- tests/cpp/testobject/Portfolio.cpp | 3 +- tests/cpp/testobject/Portfolio.hpp | 12 +- tests/cpp/testobject/Position.cpp | 4 +- tests/cpp/testobject/Position.hpp | 13 +- tests/cpp/testobject/TestObject1.cpp | 3 +- tests/cpp/testobject/TestObject1.hpp | 18 +- tests/cpp/testobject/TimestampedObject.hpp | 14 +- tests/cpp/testobject/VariousPdxTypes.cpp | 5 +- tests/cpp/testobject/VariousPdxTypes.hpp | 18 +- 129 files changed, 1458 insertions(+), 1238 deletions(-) diff --git a/clicache/src/Properties.cpp b/clicache/src/Properties.cpp index b4f00d1..af41931 100644 --- a/clicache/src/Properties.cpp +++ b/clicache/src/Properties.cpp @@ -263,9 +263,12 @@ namespace Apache { _GF_MG_EXCEPTION_TRY2 - try + try { - m_nativeptr->get()->fromData(input); + auto p = static_cast(m_nativeptr->get()->fromData(input)); + if (m_nativeptr->get() != p) { + m_nativeptr->get_shared_ptr().reset(p); + } } finally { diff --git a/clicache/src/RegionAttributes.cpp b/clicache/src/RegionAttributes.cpp index a4ab1ec..7bc639a 100644 --- a/clicache/src/RegionAttributes.cpp +++ b/clicache/src/RegionAttributes.cpp @@ -71,7 +71,11 @@ namespace Apache { try { - m_nativeptr->get()->fromData(*nativeInput); + auto temp = static_cast(m_nativeptr->get()->fromData(*nativeInput)); + if (temp != m_nativeptr->get()) + { + m_nativeptr->get_shared_ptr().reset(temp); + } } finally { diff --git a/clicache/src/Serializable.cpp b/clicache/src/Serializable.cpp index 2a3b4e7..8760bab 100644 --- a/clicache/src/Serializable.cpp +++ b/clicache/src/Serializable.cpp @@ -99,7 +99,12 @@ namespace Apache try { - m_nativeptr->get()->fromData(*nativeInput); + auto temp = m_nativeptr->get()->fromData(*nativeInput); + if (temp != m_nativeptr->get()) + { + m_nativeptr->get_shared_ptr().reset(temp); + } + if (input->IsManagedObject()) { input->SetBuffer(); } diff --git a/clicache/src/impl/ManagedCacheableDelta.cpp b/clicache/src/impl/ManagedCacheableDelta.cpp index 33ba766..8c0c0d1 100644 --- a/clicache/src/impl/ManagedCacheableDelta.cpp +++ b/clicache/src/impl/ManagedCacheableDelta.cpp @@ -55,7 +55,7 @@ namespace apache } } - void ManagedCacheableDeltaGeneric::fromData(DataInput& input) + Serializable* ManagedCacheableDeltaGeneric::fromData(DataInput& input) { try { int pos = input.getBytesRead(); @@ -77,6 +77,7 @@ namespace apache catch (System::Exception^ ex) { Apache::Geode::Client::GeodeException::ThrowNative(ex); } + return this; } System::UInt32 ManagedCacheableDeltaGeneric::objectSize() const diff --git a/clicache/src/impl/ManagedCacheableDelta.hpp b/clicache/src/impl/ManagedCacheableDelta.hpp index efeb2c9..9211a8d 100644 --- a/clicache/src/impl/ManagedCacheableDelta.hpp +++ b/clicache/src/impl/ManagedCacheableDelta.hpp @@ -97,7 +97,7 @@ namespace apache /// deserialize this object, typical implementation should return /// the 'this' pointer. /// - virtual void fromData(apache::geode::client::DataInput& input); + virtual apache::geode::client::Serializable* fromData(apache::geode::client::DataInput& input); virtual void toDelta(apache::geode::client::DataOutput& output) const; diff --git a/clicache/src/impl/ManagedCacheableDeltaBytes.cpp b/clicache/src/impl/ManagedCacheableDeltaBytes.cpp index 510d4f9..18472c4 100644 --- a/clicache/src/impl/ManagedCacheableDeltaBytes.cpp +++ b/clicache/src/impl/ManagedCacheableDeltaBytes.cpp @@ -50,7 +50,7 @@ namespace apache } } - void ManagedCacheableDeltaBytesGeneric::fromData(DataInput& input) + Serializable* ManagedCacheableDeltaBytesGeneric::fromData(DataInput& input) { try { Apache::Geode::Client::Log::Debug("ManagedCacheableDeltaBytes::fromData: classid " + m_classId); @@ -77,6 +77,7 @@ namespace apache catch (System::Exception^ ex) { Apache::Geode::Client::GeodeException::ThrowNative(ex); } + return this; } System::UInt32 ManagedCacheableDeltaBytesGeneric::objectSize() const diff --git a/clicache/src/impl/ManagedCacheableDeltaBytes.hpp b/clicache/src/impl/ManagedCacheableDeltaBytes.hpp index b45c737..c5fcbb2 100644 --- a/clicache/src/impl/ManagedCacheableDeltaBytes.hpp +++ b/clicache/src/impl/ManagedCacheableDeltaBytes.hpp @@ -113,7 +113,7 @@ namespace apache /// deserialize this object, typical implementation should return /// the 'this' pointer. /// - virtual void fromData(apache::geode::client::DataInput& input); + virtual apache::geode::client::Serializable* fromData(apache::geode::client::DataInput& input); virtual void toDelta(apache::geode::client::DataOutput& output) const; diff --git a/clicache/src/impl/ManagedCacheableKey.cpp b/clicache/src/impl/ManagedCacheableKey.cpp index 0ee0141..8cefef9 100644 --- a/clicache/src/impl/ManagedCacheableKey.cpp +++ b/clicache/src/impl/ManagedCacheableKey.cpp @@ -57,16 +57,21 @@ namespace apache } } - void ManagedCacheableKeyGeneric::fromData(apache::geode::client::DataInput& input) + apache::geode::client::Serializable* ManagedCacheableKeyGeneric::fromData(apache::geode::client::DataInput& input) { try { int pos = input.getBytesRead(); + //Apache::Geode::Client::Log::Debug("ManagedCacheableKeyGeneric::fromData"); Apache::Geode::Client::DataInput mg_input(&input, true, input.getCache()); m_managedptr = m_managedptr->FromData(%mg_input); //this will move the cursor in c++ layer input.advanceCursor(mg_input.BytesReadInternally); m_objectSize = input.getBytesRead() - pos; + //if(m_hashcode == 0) + //m_hashcode = m_managedptr->GetHashCode(); + + } catch (Apache::Geode::Client::GeodeException^ ex) { ex->ThrowNative(); @@ -74,6 +79,7 @@ namespace apache catch (System::Exception^ ex) { Apache::Geode::Client::GeodeException::ThrowNative(ex); } + return this; } System::UInt32 ManagedCacheableKeyGeneric::objectSize() const diff --git a/clicache/src/impl/ManagedCacheableKey.hpp b/clicache/src/impl/ManagedCacheableKey.hpp index bc40f09..1f3c27f 100644 --- a/clicache/src/impl/ManagedCacheableKey.hpp +++ b/clicache/src/impl/ManagedCacheableKey.hpp @@ -83,7 +83,7 @@ namespace apache /// deserialize this object, typical implementation should return /// the 'this' pointer. /// - virtual void fromData(apache::geode::client::DataInput& input); + virtual apache::geode::client::Serializable* fromData(apache::geode::client::DataInput& input); /// diff --git a/clicache/src/impl/ManagedCacheableKeyBytes.cpp b/clicache/src/impl/ManagedCacheableKeyBytes.cpp index 364b103..93e01bc 100644 --- a/clicache/src/impl/ManagedCacheableKeyBytes.cpp +++ b/clicache/src/impl/ManagedCacheableKeyBytes.cpp @@ -53,7 +53,7 @@ namespace apache } } - void ManagedCacheableKeyBytesGeneric::fromData(apache::geode::client::DataInput& input) + apache::geode::client::Serializable* ManagedCacheableKeyBytesGeneric::fromData(apache::geode::client::DataInput& input) { try { @@ -82,6 +82,7 @@ namespace apache catch (System::Exception^ ex) { Apache::Geode::Client::GeodeException::ThrowNative(ex); } + return this; } System::UInt32 ManagedCacheableKeyBytesGeneric::objectSize() const diff --git a/clicache/src/impl/ManagedCacheableKeyBytes.hpp b/clicache/src/impl/ManagedCacheableKeyBytes.hpp index 2e47899..10f0466 100644 --- a/clicache/src/impl/ManagedCacheableKeyBytes.hpp +++ b/clicache/src/impl/ManagedCacheableKeyBytes.hpp @@ -104,7 +104,7 @@ namespace apache /// deserialize this object, typical implementation should return /// the 'this' pointer. /// - virtual void fromData(apache::geode::client::DataInput& input); + virtual apache::geode::client::Serializable* fromData(apache::geode::client::DataInput& input); /// diff --git a/clicache/src/impl/PdxManagedCacheableKey.cpp b/clicache/src/impl/PdxManagedCacheableKey.cpp index c3d2a3b..2764b36 100644 --- a/clicache/src/impl/PdxManagedCacheableKey.cpp +++ b/clicache/src/impl/PdxManagedCacheableKey.cpp @@ -59,7 +59,7 @@ namespace apache } } - void PdxManagedCacheableKey::fromData(apache::geode::client::DataInput& input) + Serializable* PdxManagedCacheableKey::fromData(apache::geode::client::DataInput& input) { try { int pos = input.getBytesRead(); @@ -80,6 +80,7 @@ namespace apache catch (System::Exception^ ex) { Apache::Geode::Client::GeodeException::ThrowNative(ex); } + return this; } System::UInt32 PdxManagedCacheableKey::objectSize() const diff --git a/clicache/src/impl/PdxManagedCacheableKey.hpp b/clicache/src/impl/PdxManagedCacheableKey.hpp index b1c82c2..02bea8c 100644 --- a/clicache/src/impl/PdxManagedCacheableKey.hpp +++ b/clicache/src/impl/PdxManagedCacheableKey.hpp @@ -96,7 +96,7 @@ namespace apache /// deserialize this object, typical implementation should return /// the 'this' pointer. /// - virtual void fromData(apache::geode::client::DataInput& input); + virtual apache::geode::client::Serializable* fromData(apache::geode::client::DataInput& input); virtual void toDelta(apache::geode::client::DataOutput& output) const; diff --git a/clicache/src/impl/PdxManagedCacheableKeyBytes.cpp b/clicache/src/impl/PdxManagedCacheableKeyBytes.cpp index aa58ff6..f811449 100644 --- a/clicache/src/impl/PdxManagedCacheableKeyBytes.cpp +++ b/clicache/src/impl/PdxManagedCacheableKeyBytes.cpp @@ -51,7 +51,7 @@ namespace apache } } - void PdxManagedCacheableKeyBytes::fromData(apache::geode::client::DataInput& input) + apache::geode::client::Serializable* PdxManagedCacheableKeyBytes::fromData(apache::geode::client::DataInput& input) { try { @@ -75,6 +75,7 @@ namespace apache catch (System::Exception^ ex) { Apache::Geode::Client::GeodeException::ThrowNative(ex); } + return this; } System::UInt32 PdxManagedCacheableKeyBytes::objectSize() const diff --git a/clicache/src/impl/PdxManagedCacheableKeyBytes.hpp b/clicache/src/impl/PdxManagedCacheableKeyBytes.hpp index 442f5ef..4480268 100644 --- a/clicache/src/impl/PdxManagedCacheableKeyBytes.hpp +++ b/clicache/src/impl/PdxManagedCacheableKeyBytes.hpp @@ -128,7 +128,7 @@ namespace apache /// deserialize this object, typical implementation should return /// the 'this' pointer. /// - virtual void fromData( apache::geode::client::DataInput& input ); + virtual apache::geode::client::Serializable* fromData( apache::geode::client::DataInput& input ); virtual void toDelta( apache::geode::client::DataOutput& output) const; diff --git a/cppcache/include/geode/CacheableBuiltins.hpp b/cppcache/include/geode/CacheableBuiltins.hpp index 03b8e4a..af12149 100644 --- a/cppcache/include/geode/CacheableBuiltins.hpp +++ b/cppcache/include/geode/CacheableBuiltins.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_CACHEABLEBUILTINS_H_ +#define GEODE_CACHEABLEBUILTINS_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -15,11 +20,6 @@ * limitations under the License. */ -#pragma once - -#ifndef GEODE_CACHEABLEBUILTINS_H_ -#define GEODE_CACHEABLEBUILTINS_H_ - /** @file CacheableBuiltins.hpp * @brief Contains generic template definitions for Cacheable types * and instantiations for built-in types. @@ -70,8 +70,9 @@ class CacheableKeyType : public CacheableKey { } /** Deserialize this object from given DataInput. */ - virtual void fromData(DataInput& input) { + virtual Serializable* fromData(DataInput& input) { apache::geode::client::serializer::readObject(input, m_value); + return this; } /** @@ -237,9 +238,10 @@ class CacheableArrayType : public Cacheable { } /** Deserialize this object from the given DataInput. */ - virtual void fromData(DataInput& input) { + virtual Serializable* fromData(DataInput& input) { GF_SAFE_DELETE_ARRAY(m_value); apache::geode::client::serializer::readObject(input, m_value, m_length); + return this; } /** @@ -290,8 +292,9 @@ class CacheableContainerType : public Cacheable, public TBase { } /** Deserialize this object from the given DataInput. */ - virtual void fromData(DataInput& input) { + virtual Serializable* fromData(DataInput& input) { apache::geode::client::serializer::readObject(input, *this); + return this; } /** @@ -377,47 +380,47 @@ class CacheableContainerType : public Cacheable, public TBase { typedef std::shared_ptr> c##Ptr; // use a class instead of typedef for bug #283 -#define _GF_CACHEABLE_ARRAY_TYPE_(p, c) \ - class CPPCACHE_EXPORT c : public _##c { \ - protected: \ - inline c() : _##c() {} \ - inline c(int32_t length) : _##c(length) {} \ - inline c(p* value, int32_t length) : _##c(value, length) {} \ - inline c(const p* value, int32_t length, bool copy) \ - : _##c(value, length, true) {} \ - \ - private: \ - /* Private to disable copy constructor and assignment operator. */ \ - c(const c& other); \ - c& operator=(const c& other); \ - \ - FRIEND_STD_SHARED_PTR(c) \ - \ - public: \ - /** Factory function registered with serialization registry. */ \ - static Serializable* createDeserializable() { return new c(); } \ - /** Factory function to create a new default instance. */ \ - inline static c##Ptr create() { return std::make_shared(); } \ - /** Factory function to create a cacheable array of given size. */ \ - inline static c##Ptr create(int32_t length) { \ - return std::make_shared(length); \ - } \ - /** Create a cacheable array copying from the given array. */ \ - inline static c##Ptr create(const p* value, int32_t length) { \ - return nullptr == value ? nullptr \ - : std::make_shared(value, length, true); \ - } \ - /** \ - * Create a cacheable array taking ownership of the given array \ - * without creating a copy. \ - * \ - * Note that the application has to ensure that the given array is \ - * not deleted (apart from this class) and is allocated on the heap \ - * using the "new" operator. \ - */ \ - inline static c##Ptr createNoCopy(p* value, int32_t length) { \ - return nullptr == value ? nullptr : std::make_shared(value, length); \ - } \ +#define _GF_CACHEABLE_ARRAY_TYPE_(p, c) \ + class CPPCACHE_EXPORT c : public _##c { \ + protected: \ + inline c() : _##c() {} \ + inline c(int32_t length) : _##c(length) {} \ + inline c(p* value, int32_t length) : _##c(value, length) {} \ + inline c(const p* value, int32_t length, bool copy) \ + : _##c(value, length, true) {} \ + \ + private: \ + /* Private to disable copy constructor and assignment operator. */ \ + c(const c& other); \ + c& operator=(const c& other); \ + \ + FRIEND_STD_SHARED_PTR(c) \ + \ + public: \ + /** Factory function registered with serialization registry. */ \ + static Serializable* createDeserializable() { return new c(); } \ + /** Factory function to create a new default instance. */ \ + inline static c##Ptr create() { return std::make_shared(); } \ + /** Factory function to create a cacheable array of given size. */ \ + inline static c##Ptr create(int32_t length) { \ + return std::make_shared(length); \ + } \ + /** Create a cacheable array copying from the given array. */ \ + inline static c##Ptr create(const p* value, int32_t length) { \ + return nullptr == value ? nullptr \ + : std::make_shared(value, length, true); \ + } \ + /** \ + * Create a cacheable array taking ownership of the given array \ + * without creating a copy. \ + * \ + * Note that the application has to ensure that the given array is \ + * not deleted (apart from this class) and is allocated on the heap \ + * using the "new" operator. \ + */ \ + inline static c##Ptr createNoCopy(p* value, int32_t length) { \ + return nullptr == value ? nullptr : std::make_shared(value, length); \ + } \ }; #define _GF_CACHEABLE_CONTAINER_TYPE_DEF_(p, c) \ @@ -641,7 +644,6 @@ _GF_CACHEABLE_CONTAINER_TYPE_DEF_(HashSetOfCacheableKey, * iteration semantics of java LinkedHashSet. */ _GF_CACHEABLE_CONTAINER_TYPE_(HashSetOfCacheableKey, CacheableLinkedHashSet); - } // namespace client } // namespace geode } // namespace apache diff --git a/cppcache/include/geode/CacheableDate.hpp b/cppcache/include/geode/CacheableDate.hpp index 99dce9c..3af1884 100644 --- a/cppcache/include/geode/CacheableDate.hpp +++ b/cppcache/include/geode/CacheableDate.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_CACHEABLEDATE_H_ +#define GEODE_CACHEABLEDATE_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -15,11 +20,6 @@ * limitations under the License. */ -#pragma once - -#ifndef GEODE_CACHEABLEDATE_H_ -#define GEODE_CACHEABLEDATE_H_ - #include "geode_globals.hpp" #include "geode_types.hpp" #include "CacheableKey.hpp" @@ -32,7 +32,7 @@ #include /** @file - */ +*/ namespace apache { namespace geode { namespace client { @@ -63,7 +63,7 @@ class CPPCACHE_EXPORT CacheableDate : public CacheableKey { /** * @brief deserialize this object **/ - virtual void fromData(DataInput& input); + virtual Serializable* fromData(DataInput& input); /** * @brief creation function for dates. diff --git a/cppcache/include/geode/CacheableEnum.hpp b/cppcache/include/geode/CacheableEnum.hpp index e9ee088..1967fe9 100644 --- a/cppcache/include/geode/CacheableEnum.hpp +++ b/cppcache/include/geode/CacheableEnum.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_CACHEABLEENUM_H_ +#define GEODE_CACHEABLEENUM_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -15,11 +20,6 @@ * limitations under the License. */ -#pragma once - -#ifndef GEODE_CACHEABLEENUM_H_ -#define GEODE_CACHEABLEENUM_H_ - #include "CacheableKey.hpp" #include "CacheableString.hpp" @@ -28,18 +28,18 @@ namespace geode { namespace client { /** - * Since C++ enums cannot be directly passed as a parameter to PdxWriter's - * writeObject and PdxReader's readObject api - * wrap C++ enum in to a immutable wrapper CacheableEnum class type by - * specifying enum class name, enum value name and its ordinal. C++ enum allows - * explicit setting of ordinal number, but it is up to the user to map java - * enumName with that of C++ enumName. Currently this wrapper only works as part - * of PdxSerializable member object and cannot be directly used in Region - * operations. - * - * @see PdxWriter#writeObject - * @see PdxReader#readObject - */ +* Since C++ enums cannot be directly passed as a parameter to PdxWriter's +* writeObject and PdxReader's readObject api +* wrap C++ enum in to a immutable wrapper CacheableEnum class type by specifying +* enum class name, enum value name and its ordinal. +* C++ enum allows explicit setting of ordinal number, but it is up to the user +* to map java enumName with that of C++ enumName. +* Currently this wrapper only works as part of PdxSerializable member object and +* cannot be directly used in Region operations. +* +* @see PdxWriter#writeObject +* @see PdxReader#readObject +*/ class CPPCACHE_EXPORT CacheableEnum : public CacheableKey { private: @@ -53,18 +53,18 @@ class CPPCACHE_EXPORT CacheableEnum : public CacheableKey { ~CacheableEnum(); /** - * @brief creation function for enum. - */ + * @brief creation function for enum. + */ static Serializable* createDeserializable() { return new CacheableEnum(); } /** - * @brief serialize this object - **/ + * @brief serialize this object + **/ virtual void toData(DataOutput& output) const; /** - * @brief deserialize this object - **/ - virtual void fromData(DataInput& input); + * @brief deserialize this object + **/ + virtual Serializable* fromData(DataInput& input); /** @return the size of the object in bytes */ virtual uint32_t objectSize() const { @@ -76,39 +76,38 @@ class CPPCACHE_EXPORT CacheableEnum : public CacheableKey { } /** - * @brief Return the classId of the instance being serialized. - * This is used by deserialization to determine what instance - * type to create and deserialize into. - */ + * @brief Return the classId of the instance being serialized. + * This is used by deserialization to determine what instance + * type to create and deserialize into. + */ virtual int32_t classId() const { return 0; } /** - * @brief return the typeId byte of the instance being serialized. - * This is used by deserialization to determine what instance - * type to create and deserialize into. - */ + * @brief return the typeId byte of the instance being serialized. + * This is used by deserialization to determine what instance + * type to create and deserialize into. + */ virtual int8_t typeId() const { // return 0; return static_cast(GeodeTypeIds::CacheableEnum); } /** - * Display this object as c string. - */ + * Display this object as c string. + */ virtual CacheableStringPtr toString() const { return CacheableString::create("CacheableEnum"); } /** - * Factory method for creating an instance of CacheableEnum. - * @param className the name of the enum class that maps to the java enum - * type. - * @param enumName the name of the enum constant that maps to the java enum - * type. - * @param ordinal the ordinal value of the enum constant that maps to the java - * enum type. - * @return a {@link CacheableEnum} representing C++ enum. - */ + * Factory method for creating an instance of CacheableEnum. + * @param className the name of the enum class that maps to the java enum type. + * @param enumName the name of the enum constant that maps to the java enum + * type. + * @param ordinal the ordinal value of the enum constant that maps to the java + * enum type. + * @return a {@link CacheableEnum} representing C++ enum. + */ static CacheableEnumPtr create(const char* enumClassName, const char* enumName, int32_t ordinal) { return std::make_shared(enumClassName, enumName, ordinal); @@ -138,10 +137,9 @@ class CPPCACHE_EXPORT CacheableEnum : public CacheableKey { // never implemented. void operator=(const CacheableEnum& other); CacheableEnum(const CacheableEnum& other); - + FRIEND_STD_SHARED_PTR(CacheableEnum) }; - } // namespace client } // namespace geode } // namespace apache diff --git a/cppcache/include/geode/CacheableFileName.hpp b/cppcache/include/geode/CacheableFileName.hpp index bab3e52..5db13c1 100644 --- a/cppcache/include/geode/CacheableFileName.hpp +++ b/cppcache/include/geode/CacheableFileName.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_CACHEABLEFILENAME_H_ +#define GEODE_CACHEABLEFILENAME_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -15,11 +20,6 @@ * limitations under the License. */ -#pragma once - -#ifndef GEODE_CACHEABLEFILENAME_H_ -#define GEODE_CACHEABLEFILENAME_H_ - #include "geode_globals.hpp" #include "geode_types.hpp" #include "CacheableKey.hpp" @@ -31,7 +31,6 @@ namespace apache { namespace geode { namespace client { - /** * Implement an immutable wrapper for filenames that can serve as a * distributable filename object for caching as both key and value. @@ -48,7 +47,7 @@ class CPPCACHE_EXPORT CacheableFileName : public CacheableString { * Throw IllegalArgumentException if the packed CacheableString is not less * than 64K bytes. **/ - virtual void fromData(DataInput& input); + virtual Serializable* fromData(DataInput& input); /** *@brief Return the classId of the instance being serialized. @@ -117,7 +116,6 @@ class CPPCACHE_EXPORT CacheableFileName : public CacheableString { private: mutable int m_hashcode; }; - } // namespace client } // namespace geode } // namespace apache diff --git a/cppcache/include/geode/CacheableObjectArray.hpp b/cppcache/include/geode/CacheableObjectArray.hpp index 2c86604..a3f1745 100644 --- a/cppcache/include/geode/CacheableObjectArray.hpp +++ b/cppcache/include/geode/CacheableObjectArray.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_CACHEABLEOBJECTARRAY_H_ +#define GEODE_CACHEABLEOBJECTARRAY_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -15,11 +20,6 @@ * limitations under the License. */ -#pragma once - -#ifndef GEODE_CACHEABLEOBJECTARRAY_H_ -#define GEODE_CACHEABLEOBJECTARRAY_H_ - #include "geode_globals.hpp" #include "geode_types.hpp" #include "VectorT.hpp" @@ -38,6 +38,7 @@ namespace client { class CPPCACHE_EXPORT CacheableObjectArray : public Cacheable, public VectorOfCacheable { public: + /** *@brief serialize this object **/ @@ -46,7 +47,7 @@ class CPPCACHE_EXPORT CacheableObjectArray : public Cacheable, /** *@brief deserialize this object **/ - virtual void fromData(DataInput& input); + virtual Serializable* fromData(DataInput& input); /** * @brief creation function for java Object[] @@ -99,7 +100,6 @@ class CPPCACHE_EXPORT CacheableObjectArray : public Cacheable, FRIEND_STD_SHARED_PTR(CacheableObjectArray) }; - } // namespace client } // namespace geode } // namespace apache diff --git a/cppcache/include/geode/CacheableString.hpp b/cppcache/include/geode/CacheableString.hpp index 7a33e4b..3af78d2 100644 --- a/cppcache/include/geode/CacheableString.hpp +++ b/cppcache/include/geode/CacheableString.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_CACHEABLESTRING_H_ +#define GEODE_CACHEABLESTRING_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -15,11 +20,6 @@ * limitations under the License. */ -#pragma once - -#ifndef GEODE_CACHEABLESTRING_H_ -#define GEODE_CACHEABLESTRING_H_ - #include "geode_globals.hpp" #include "geode_types.hpp" #include "CacheableKey.hpp" @@ -62,7 +62,7 @@ class CPPCACHE_EXPORT CacheableString : public CacheableKey { * Throw IllegalArgumentException if the packed CacheableString is not less * than 64K bytes. **/ - virtual void fromData(DataInput& input); + virtual Serializable* fromData(DataInput& input); /** creation function for strings */ static Serializable* createDeserializable(); @@ -307,7 +307,6 @@ inline CacheablePtr createValueArr(const char* value) { inline CacheablePtr createValueArr(const wchar_t* value) { return CacheableString::create(value); } - } // namespace client } // namespace geode } // namespace apache diff --git a/cppcache/include/geode/CacheableUndefined.hpp b/cppcache/include/geode/CacheableUndefined.hpp index b287298..40b5d5a 100644 --- a/cppcache/include/geode/CacheableUndefined.hpp +++ b/cppcache/include/geode/CacheableUndefined.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_CACHEABLEUNDEFINED_H_ +#define GEODE_CACHEABLEUNDEFINED_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -15,11 +20,6 @@ * limitations under the License. */ -#pragma once - -#ifndef GEODE_CACHEABLEUNDEFINED_H_ -#define GEODE_CACHEABLEUNDEFINED_H_ - #include "geode_globals.hpp" #include "geode_types.hpp" #include "Cacheable.hpp" @@ -44,7 +44,7 @@ class CPPCACHE_EXPORT CacheableUndefined : public Cacheable { /** *@brief deserialize this object **/ - virtual void fromData(DataInput& input); + virtual Serializable* fromData(DataInput& input); /** * @brief creation function for undefined query result @@ -93,7 +93,6 @@ class CPPCACHE_EXPORT CacheableUndefined : public Cacheable { FRIEND_STD_SHARED_PTR(CacheableUndefined) }; - } // namespace client } // namespace geode } // namespace apache diff --git a/cppcache/include/geode/PdxInstance.hpp b/cppcache/include/geode/PdxInstance.hpp index 3676c04..3e92515 100644 --- a/cppcache/include/geode/PdxInstance.hpp +++ b/cppcache/include/geode/PdxInstance.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_PDXINSTANCE_H_ +#define GEODE_PDXINSTANCE_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -15,11 +20,6 @@ * limitations under the License. */ -#pragma once - -#ifndef GEODE_PDXINSTANCE_H_ -#define GEODE_PDXINSTANCE_H_ - #include "PdxSerializable.hpp" #include "CacheableBuiltins.hpp" #include "PdxFieldTypes.hpp" @@ -29,467 +29,468 @@ namespace geode { namespace client { /** - * PdxInstance provides run time access to the fields of a PDX without - * deserializing the PDX. Preventing deserialization saves time - * and memory. - * The PdxInstance implementation - * is a light weight wrapper that simply refers to the raw bytes of the PDX - * that are kept in the cache. - * Applications can choose to access PdxInstances instead of C++ objects by - * configuring the Cache to prefer PDX instances during deserialization. - * This can be done in cache.xml by setting the attribute - * read-serialized - * to true on the pdx element. Or it can be done programmatically - * using - * {@link CacheFactory#setPdxReadSerialized(boolean) setPdxReadSerialized} - * method. Once this preference is configured, then any time deserialization of - * a PDX is done it will deserialize into a PdxInstance. PdxInstance are - * immutable. If you want to change one call {@link #createWriter}. - */ +* PdxInstance provides run time access to the fields of a PDX without +* deserializing the PDX. Preventing deserialization saves time +* and memory. +* The PdxInstance implementation +* is a light weight wrapper that simply refers to the raw bytes of the PDX +* that are kept in the cache. +* Applications can choose to access PdxInstances instead of C++ objects by +* configuring the Cache to prefer PDX instances during deserialization. +* This can be done in cache.xml by setting the attribute +* read-serialized +* to true on the pdx element. Or it can be done programmatically +* using +* {@link CacheFactory#setPdxReadSerialized(boolean) setPdxReadSerialized} +* method. Once this preference is configured, then any time deserialization of a +* PDX is done it will deserialize into a PdxInstance. +* PdxInstance are immutable. If you want to change one call {@link +* #createWriter}. +*/ class CPPCACHE_EXPORT PdxInstance : public PdxSerializable { public: /** - * @brief destructor - */ + * @brief destructor + */ virtual ~PdxInstance() {} /** - * Deserializes and returns the domain object that this instance represents. - * For deserialization C++ Native Client requires the domain class to be - * registered. - * @return the deserialized domain object. - * - * @see serializationRegistry->addPdxType - */ + * Deserializes and returns the domain object that this instance represents. + * For deserialization C++ Native Client requires the domain class to be + * registered. + * @return the deserialized domain object. + * + * @see serializationRegistry->addPdxType + */ virtual PdxSerializablePtr getObject() = 0; /** - * Checks if the named field exists and returns the result. - * This can be useful when writing code that handles more than one version of - * a PDX class. - * @param fieldname the name of the field to check - * @return true if the named field exists; otherwise - * false - */ + * Checks if the named field exists and returns the result. + * This can be useful when writing code that handles more than one version of + * a PDX class. + * @param fieldname the name of the field to check + * @return true if the named field exists; otherwise + * false + */ virtual bool hasField(const char* fieldname) = 0; /** - * Reads the named field and set its value in CacheablePtr type out param. - * CacheablePtr type is corresponding to java object type. - * @param fieldname name of the field to read - * @param value value of the field to be set with CacheablePtr type. - * @throws IllegalStateException if PdxInstance doesn't has the named field. - * For deserialization C++ Native Client requires the domain class to be - * registered. - * - * @see serializationRegistry->addPdxType - * @see PdxInstance#hasField - */ + * Reads the named field and set its value in CacheablePtr type out param. + * CacheablePtr type is corresponding to java object type. + * @param fieldname name of the field to read + * @param value value of the field to be set with CacheablePtr type. + * @throws IllegalStateException if PdxInstance doesn't has the named field. + * For deserialization C++ Native Client requires the domain class to be + * registered. + * + * @see serializationRegistry->addPdxType + * @see PdxInstance#hasField + */ virtual void getField(const char* fieldname, CacheablePtr& value) const = 0; /** - * Reads the named field and set its value in bool type out param. - * bool type is corresponding to java boolean type. - * @param fieldname name of the field to read - * @param value value of the field to be set with bool type. - * @throws IllegalStateException if PdxInstance doesn't has the named field. - * - * @see PdxInstance#hasField - */ + * Reads the named field and set its value in bool type out param. + * bool type is corresponding to java boolean type. + * @param fieldname name of the field to read + * @param value value of the field to be set with bool type. + * @throws IllegalStateException if PdxInstance doesn't has the named field. + * + * @see PdxInstance#hasField + */ virtual void getField(const char* fieldname, bool& value) const = 0; /** - * Reads the named field and set its value in signed char type out param. - * signed char type is corresponding to java byte type. - * For C++ on Windows and Linux, signed char type is corresponding to int8_t - * type. - * However C++ users on Solaris should always use this api after casting - * int8_t to signed char. - * @param fieldname name of the field to read - * @param value value of the field to be set with signed char type. - * @throws IllegalStateException if PdxInstance doesn't has the named field. - * - * @see PdxInstance#hasField - */ + * Reads the named field and set its value in signed char type out param. + * signed char type is corresponding to java byte type. + * For C++ on Windows and Linux, signed char type is corresponding to int8_t + * type. + * However C++ users on Solaris should always use this api after casting int8_t + * to signed char. + * @param fieldname name of the field to read + * @param value value of the field to be set with signed char type. + * @throws IllegalStateException if PdxInstance doesn't has the named field. + * + * @see PdxInstance#hasField + */ virtual void getField(const char* fieldname, signed char& value) const = 0; /** - * Reads the named field and set its value in unsigned char type out param. - * unsigned char type is corresponding to java byte type. - * For C++ on Windows and Linux, unsigned char type is corresponding to int8_t - * type. - * However C++ users on Solaris should always use this api after casting - * int8_t to unsigned char. - * @param fieldname name of the field to read - * @param value value of the field to be set with unsigned char type. - * @throws IllegalStateException if PdxInstance doesn't has the named field. - * - * @see PdxInstance#hasField - */ + * Reads the named field and set its value in unsigned char type out param. + * unsigned char type is corresponding to java byte type. + * For C++ on Windows and Linux, unsigned char type is corresponding to int8_t + * type. + * However C++ users on Solaris should always use this api after casting int8_t + * to unsigned char. + * @param fieldname name of the field to read + * @param value value of the field to be set with unsigned char type. + * @throws IllegalStateException if PdxInstance doesn't has the named field. + * + * @see PdxInstance#hasField + */ virtual void getField(const char* fieldname, unsigned char& value) const = 0; /** - * Reads the named field and set its value in int16_t type out param. - * int16_t type is corresponding to java short type. - * @param fieldname name of the field to read - * @param value value of the field to be set with int16_t type. - * @throws IllegalStateException if PdxInstance doesn't has the named field. - * - * @see PdxInstance#hasField - */ + * Reads the named field and set its value in int16_t type out param. + * int16_t type is corresponding to java short type. + * @param fieldname name of the field to read + * @param value value of the field to be set with int16_t type. + * @throws IllegalStateException if PdxInstance doesn't has the named field. + * + * @see PdxInstance#hasField + */ virtual void getField(const char* fieldname, int16_t& value) const = 0; /** - * Reads the named field and set its value in int32_t type out param. - * int32_t type is corresponding to java int type. - * @param fieldname name of the field to read - * @param value value of the field to be set with int32_t type. - * @throws IllegalStateException if PdxInstance doesn't has the named field. - */ + * Reads the named field and set its value in int32_t type out param. + * int32_t type is corresponding to java int type. + * @param fieldname name of the field to read + * @param value value of the field to be set with int32_t type. + * @throws IllegalStateException if PdxInstance doesn't has the named field. + */ virtual void getField(const char* fieldname, int32_t& value) const = 0; /** - * Reads the named field and set its value in int64_t type out param. - * int64_t type is corresponding to java long type. - * @param fieldname name of the field to read - * @param value value of the field to be set with int64_t type. - * @throws IllegalStateException if PdxInstance doesn't has the named field. - * - * @see PdxInstance#hasField - */ + * Reads the named field and set its value in int64_t type out param. + * int64_t type is corresponding to java long type. + * @param fieldname name of the field to read + * @param value value of the field to be set with int64_t type. + * @throws IllegalStateException if PdxInstance doesn't has the named field. + * + * @see PdxInstance#hasField + */ virtual void getField(const char* fieldname, int64_t& value) const = 0; /** - * Reads the named field and set its value in float type out param. - * float type is corresponding to java float type. - * @param fieldname name of the field to read - * @param value value of the field to be set with float type. - * @throws IllegalStateException if PdxInstance doesn't has the named field. - * - * @see PdxInstance#hasField - */ + * Reads the named field and set its value in float type out param. + * float type is corresponding to java float type. + * @param fieldname name of the field to read + * @param value value of the field to be set with float type. + * @throws IllegalStateException if PdxInstance doesn't has the named field. + * + * @see PdxInstance#hasField + */ virtual void getField(const char* fieldname, float& value) const = 0; /** - * Reads the named field and set its value in double type out param. - * double type is corresponding to java double type. - * @param fieldname name of the field to read - * @param value value of the field to be set with double type. - * @throws IllegalStateException if PdxInstance doesn't has the named field. - * - * @see PdxInstance#hasField - */ + * Reads the named field and set its value in double type out param. + * double type is corresponding to java double type. + * @param fieldname name of the field to read + * @param value value of the field to be set with double type. + * @throws IllegalStateException if PdxInstance doesn't has the named field. + * + * @see PdxInstance#hasField + */ virtual void getField(const char* fieldname, double& value) const = 0; /** - * Reads the named field and set its value in wchar_t type out param. - * wchar_t type is corresponding to java char type. - * @param fieldname name of the field to read - * @param value value of the field to be set with wchar_t type. - * @throws IllegalStateException if PdxInstance doesn't has the named field. - * - * @see PdxInstance#hasField - */ + * Reads the named field and set its value in wchar_t type out param. + * wchar_t type is corresponding to java char type. + * @param fieldname name of the field to read + * @param value value of the field to be set with wchar_t type. + * @throws IllegalStateException if PdxInstance doesn't has the named field. + * + * @see PdxInstance#hasField + */ virtual void getField(const char* fieldName, wchar_t& value) const = 0; /** - * Reads the named field and set its value in char type out param. - * char type is corresponding to java char type. - * @param fieldname name of the field to read - * @param value value of the field to be set with char type. - * @throws IllegalStateException if PdxInstance doesn't has the named field. - * - * @see PdxInstance#hasField - */ + * Reads the named field and set its value in char type out param. + * char type is corresponding to java char type. + * @param fieldname name of the field to read + * @param value value of the field to be set with char type. + * @throws IllegalStateException if PdxInstance doesn't has the named field. + * + * @see PdxInstance#hasField + */ virtual void getField(const char* fieldName, char& value) const = 0; /** - * Reads the named field and set its value in bool array type out param. - * bool* type is corresponding to java boolean[] type. - * @param fieldname name of the field to read - * @param value value of the field to be set with bool array type. - * @param length length is set with number of bool elements. - * @throws IllegalStateException if PdxInstance doesn't has the named field. - * - * @see PdxInstance#hasField - */ + * Reads the named field and set its value in bool array type out param. + * bool* type is corresponding to java boolean[] type. + * @param fieldname name of the field to read + * @param value value of the field to be set with bool array type. + * @param length length is set with number of bool elements. + * @throws IllegalStateException if PdxInstance doesn't has the named field. + * + * @see PdxInstance#hasField + */ virtual void getField(const char* fieldname, bool** value, int32_t& length) const = 0; /** - * Reads the named field and set its value in signed char array type out - * param. signed char* type is corresponding to java byte[] type. For C++ on - * Windows and Linux, signed char* type is corresponding to int8_t* type. - * However C++ users on Solaris should always use this api after casting - * int8_t* to signed char*. - * @param fieldname name of the field to read - * @param value value of the field to be set with signed char array type. - * @param length length is set with number of signed char elements. - * @throws IllegalStateException if PdxInstance doesn't has the named field. - * - * @see PdxInstance#hasField - */ + * Reads the named field and set its value in signed char array type out param. + * signed char* type is corresponding to java byte[] type. + * For C++ on Windows and Linux, signed char* type is corresponding to int8_t* + * type. + * However C++ users on Solaris should always use this api after casting + * int8_t* to signed char*. + * @param fieldname name of the field to read + * @param value value of the field to be set with signed char array type. + * @param length length is set with number of signed char elements. + * @throws IllegalStateException if PdxInstance doesn't has the named field. + * + * @see PdxInstance#hasField + */ virtual void getField(const char* fieldname, signed char** value, int32_t& length) const = 0; /** - * Reads the named field and set its value in unsigned char array type out - * param. - * unsigned char* type is corresponding to java byte[] type. - * For C++ on Windows and Linux, unsigned char* type is corresponding to - * int8_t* type. - * However C++ users on Solaris should always use this api after casting - * int8_t* to unsigned char*. - * @param fieldname name of the field to read - * @param value value of the field to be set with unsigned char array type. - * @param length length is set with number of unsigned char elements. - * @throws IllegalStateException if PdxInstance doesn't has the named field. - * - * @see PdxInstance#hasField - */ + * Reads the named field and set its value in unsigned char array type out + * param. + * unsigned char* type is corresponding to java byte[] type. + * For C++ on Windows and Linux, unsigned char* type is corresponding to + * int8_t* type. + * However C++ users on Solaris should always use this api after casting + * int8_t* to unsigned char*. + * @param fieldname name of the field to read + * @param value value of the field to be set with unsigned char array type. + * @param length length is set with number of unsigned char elements. + * @throws IllegalStateException if PdxInstance doesn't has the named field. + * + * @see PdxInstance#hasField + */ virtual void getField(const char* fieldname, unsigned char** value, int32_t& length) const = 0; /** - * Reads the named field and set its value in int16_t array type out param. - * int16_t* type is corresponding to java short[] type. - * @param fieldname name of the field to read - * @param value value of the field to be set with int16_t array type. - * @param length length is set with number of int16_t elements. - * @throws IllegalStateException if PdxInstance doesn't has the named field. - * - * @see PdxInstance#hasField - */ + * Reads the named field and set its value in int16_t array type out param. + * int16_t* type is corresponding to java short[] type. + * @param fieldname name of the field to read + * @param value value of the field to be set with int16_t array type. + * @param length length is set with number of int16_t elements. + * @throws IllegalStateException if PdxInstance doesn't has the named field. + * + * @see PdxInstance#hasField + */ virtual void getField(const char* fieldname, int16_t** value, int32_t& length) const = 0; /** - * Reads the named field and set its value in int32_t array type out param. - * int32_t* type is corresponding to java int[] type. - * @param fieldname name of the field to read - * @param value value of the field to be set with int32_t array type. - * @param length length is set with number of int32_t elements. - * @throws IllegalStateException if PdxInstance doesn't has the named field. - * - * @see PdxInstance#hasField - */ + * Reads the named field and set its value in int32_t array type out param. + * int32_t* type is corresponding to java int[] type. + * @param fieldname name of the field to read + * @param value value of the field to be set with int32_t array type. + * @param length length is set with number of int32_t elements. + * @throws IllegalStateException if PdxInstance doesn't has the named field. + * + * @see PdxInstance#hasField + */ virtual void getField(const char* fieldname, int32_t** value, int32_t& length) const = 0; /** - * Reads the named field and set its value in int64_t array type out param. - * int64_t* type is corresponding to java long[] type. - * @param fieldname name of the field to read - * @param value value of the field to be set with int64_t array type. - * @param length length is set with number of int64_t elements. - * @throws IllegalStateException if PdxInstance doesn't has the named field. - * - * @see PdxInstance#hasField - */ + * Reads the named field and set its value in int64_t array type out param. + * int64_t* type is corresponding to java long[] type. + * @param fieldname name of the field to read + * @param value value of the field to be set with int64_t array type. + * @param length length is set with number of int64_t elements. + * @throws IllegalStateException if PdxInstance doesn't has the named field. + * + * @see PdxInstance#hasField + */ virtual void getField(const char* fieldname, int64_t** value, int32_t& length) const = 0; /** - * Reads the named field and set its value in float array type out param. - * float* type is corresponding to java float[] type. - * @param fieldname name of the field to read - * @param value value of the field to be set with float array type. - * @param length length is set with number of float elements. - * @throws IllegalStateException if PdxInstance doesn't has the named field. - * - * @see PdxInstance#hasField - */ + * Reads the named field and set its value in float array type out param. + * float* type is corresponding to java float[] type. + * @param fieldname name of the field to read + * @param value value of the field to be set with float array type. + * @param length length is set with number of float elements. + * @throws IllegalStateException if PdxInstance doesn't has the named field. + * + * @see PdxInstance#hasField + */ virtual void getField(const char* fieldname, float** value, int32_t& length) const = 0; /** - * Reads the named field and set its value in double array type out param. - * double* type is corresponding to java double[] type. - * @param fieldname name of the field to read - * @param value value of the field to be set with double array type. - * @param length length is set with number of double elements. - * @throws IllegalStateException if PdxInstance doesn't has the named field. - * - * @see PdxInstance#hasField - */ + * Reads the named field and set its value in double array type out param. + * double* type is corresponding to java double[] type. + * @param fieldname name of the field to read + * @param value value of the field to be set with double array type. + * @param length length is set with number of double elements. + * @throws IllegalStateException if PdxInstance doesn't has the named field. + * + * @see PdxInstance#hasField + */ virtual void getField(const char* fieldname, double** value, int32_t& length) const = 0; // charArray /** - * Reads the named field and set its value in wchar_t array type out param. - * wchar_t* type is corresponding to java String type. - * @param fieldname name of the field to read - * @param value value of the field to be set with wchar_t array type. - * @param length length is set with number of wchar_t* elements. - * @throws IllegalStateException if PdxInstance doesn't has the named field. - * - * @see PdxInstance#hasField - */ + * Reads the named field and set its value in wchar_t array type out param. + * wchar_t* type is corresponding to java String type. + * @param fieldname name of the field to read + * @param value value of the field to be set with wchar_t array type. + * @param length length is set with number of wchar_t* elements. + * @throws IllegalStateException if PdxInstance doesn't has the named field. + * + * @see PdxInstance#hasField + */ virtual void getField(const char* fieldName, wchar_t** value, int32_t& length) const = 0; /** - * Reads the named field and set its value in char array type out param. - * char* type is corresponding to java String type. - * @param fieldname name of the field to read - * @param value value of the field to be set with char array type. - * @param length length is set with number of char* elements. - * @throws IllegalStateException if PdxInstance doesn't has the named field. - * - * @see PdxInstance#hasField - */ + * Reads the named field and set its value in char array type out param. + * char* type is corresponding to java String type. + * @param fieldname name of the field to read + * @param value value of the field to be set with char array type. + * @param length length is set with number of char* elements. + * @throws IllegalStateException if PdxInstance doesn't has the named field. + * + * @see PdxInstance#hasField + */ virtual void getField(const char* fieldName, char** value, int32_t& length) const = 0; // String /** - * Reads the named field and set its value in wchar_t* type out param. - * wchar_t* type is corresponding to java String type. - * @param fieldname name of the field to read - * @param value value of the field to be set with wchar_t type. - * @throws IllegalStateException if PdxInstance doesn't has the named field. - * - * @see PdxInstance#hasField - */ + * Reads the named field and set its value in wchar_t* type out param. + * wchar_t* type is corresponding to java String type. + * @param fieldname name of the field to read + * @param value value of the field to be set with wchar_t type. + * @throws IllegalStateException if PdxInstance doesn't has the named field. + * + * @see PdxInstance#hasField + */ virtual void getField(const char* fieldname, wchar_t** value) const = 0; /** - * Reads the named field and set its value in char* type out param. - * char* type is corresponding to java String type. - * @param fieldname name of the field to read - * @param value value of the field to be set with char* type. - * @throws IllegalStateException if PdxInstance doesn't has the named field. - * - * @see PdxInstance#hasField - */ + * Reads the named field and set its value in char* type out param. + * char* type is corresponding to java String type. + * @param fieldname name of the field to read + * @param value value of the field to be set with char* type. + * @throws IllegalStateException if PdxInstance doesn't has the named field. + * + * @see PdxInstance#hasField + */ virtual void getField(const char* fieldname, char** value) const = 0; // StringArray /** - * Reads the named field and set its value in wchar_t* array type out param. - * wchar_t** type is corresponding to java String[] type. - * @param fieldname name of the field to read - * @param value value of the field to be set with wchar_t* array type. - * @param length length is set with number of wchar_t** elements. - * @throws IllegalStateException if PdxInstance doesn't has the named field. - * - * @see PdxInstance#hasField - */ + * Reads the named field and set its value in wchar_t* array type out param. + * wchar_t** type is corresponding to java String[] type. + * @param fieldname name of the field to read + * @param value value of the field to be set with wchar_t* array type. + * @param length length is set with number of wchar_t** elements. + * @throws IllegalStateException if PdxInstance doesn't has the named field. + * + * @see PdxInstance#hasField + */ virtual void getField(const char* fieldname, wchar_t*** value, int32_t& length) const = 0; /** - * Reads the named field and set its value in char* array type out param. - * char** type is corresponding to java String[] type. - * @param fieldname name of the field to read - * @param value value of the field to be set with char* array type. - * @param length length is set with number of char** elements. - * @throws IllegalStateException if PdxInstance doesn't has the named field. - * - * @see PdxInstance#hasField - */ + * Reads the named field and set its value in char* array type out param. + * char** type is corresponding to java String[] type. + * @param fieldname name of the field to read + * @param value value of the field to be set with char* array type. + * @param length length is set with number of char** elements. + * @throws IllegalStateException if PdxInstance doesn't has the named field. + * + * @see PdxInstance#hasField + */ virtual void getField(const char* fieldname, char*** value, int32_t& length) const = 0; /** - * Reads the named field and set its value in CacheableDatePtr type out param. - * CacheableDatePtr type is corresponding to java Java.util.date type. - * @param fieldname name of the field to read - * @param value value of the field to be set with CacheableDatePtr type. - * @throws IllegalStateException if PdxInstance doesn't has the named field. - * - * @see PdxInstance#hasField - */ + * Reads the named field and set its value in CacheableDatePtr type out param. + * CacheableDatePtr type is corresponding to java Java.util.date type. + * @param fieldname name of the field to read + * @param value value of the field to be set with CacheableDatePtr type. + * @throws IllegalStateException if PdxInstance doesn't has the named field. + * + * @see PdxInstance#hasField + */ virtual void getField(const char* fieldname, CacheableDatePtr& value) const = 0; /** - * Reads the named field and set its value in array of byte arrays type out - * param. - * int8_t** type is corresponding to java byte[][] type. - * @param fieldname name of the field to read. - * @param value value of the field to be set with array of byte arrays type. - * @param arrayLength arrayLength is set to the number of byte arrays. - * @param elementLength elementLength is set to individual byte array lengths. - * @throws IllegalStateException if PdxInstance doesn't has the named field. - * - * @see PdxInstance#hasField - */ + * Reads the named field and set its value in array of byte arrays type out + * param. + * int8_t** type is corresponding to java byte[][] type. + * @param fieldname name of the field to read. + * @param value value of the field to be set with array of byte arrays type. + * @param arrayLength arrayLength is set to the number of byte arrays. + * @param elementLength elementLength is set to individual byte array lengths. + * @throws IllegalStateException if PdxInstance doesn't has the named field. + * + * @see PdxInstance#hasField + */ virtual void getField(const char* fieldName, int8_t*** value, int32_t& arrayLength, int32_t*& elementLength) const = 0; /** - * Reads the named field and set its value in CacheableObjectArrayPtr type out - * param. - * For deserialization C++ Native Client requires the domain class to be - * registered. - * CacheableObjectArrayPtr type is corresponding to java Object[] type. - * @param fieldname name of the field to read. - * @param value value of the field to be set with CacheableObjectArrayPtr - * type. - * @throws IllegalStateException if PdxInstance doesn't has the named field. - * - * @see serializationRegistry->addPdxType - * @see PdxInstance#hasField - */ + * Reads the named field and set its value in CacheableObjectArrayPtr type out + * param. + * For deserialization C++ Native Client requires the domain class to be + * registered. + * CacheableObjectArrayPtr type is corresponding to java Object[] type. + * @param fieldname name of the field to read. + * @param value value of the field to be set with CacheableObjectArrayPtr type. + * @throws IllegalStateException if PdxInstance doesn't has the named field. + * + * @see serializationRegistry->addPdxType + * @see PdxInstance#hasField + */ virtual void getField(const char* fieldname, CacheableObjectArrayPtr& value) const = 0; /** - * Checks if the named field was {@link PdxWriter#markIdentityField}marked as - * an identity field. - * Note that if no fields have been marked then all the fields are used as - * identity fields even though - * this method will return false since none of them have been - * marked. - * @param fieldname the name of the field to check - * @return true if the named field exists and was marked as an - * identify field; otherwise false - */ + * Checks if the named field was {@link PdxWriter#markIdentityField}marked as + * an identity field. + * Note that if no fields have been marked then all the fields are used as + * identity fields even though + * this method will return false since none of them have been + * marked. + * @param fieldname the name of the field to check + * @return true if the named field exists and was marked as an + * identify field; otherwise false + */ virtual bool isIdentityField(const char* fieldname) = 0; /** - * Creates and returns a {@link WritablePdxInstance} whose initial - * values are those of this PdxInstance. - * This call returns a copy of the current field values so modifications - * made to the returned value will not modify this PdxInstance. - * @return a {@link WritablePdxInstance} - */ + * Creates and returns a {@link WritablePdxInstance} whose initial + * values are those of this PdxInstance. + * This call returns a copy of the current field values so modifications + * made to the returned value will not modify this PdxInstance. + * @return a {@link WritablePdxInstance} + */ virtual WritablePdxInstancePtr createWriter() = 0; /** - * Generates a hashcode based on the identity fields of - * this PdxInstance. - *

If a PdxInstance has marked identity fields using {@link - * PdxWriter#markIdentityField} - * then only the marked identity fields are its identity fields. - * Otherwise all its fields are identity fields. - *

- * For deserialization C++ Native Client requires the domain class to be - * registered. - * If the field is an array then all array - * elements are used for hashcode computation. - * Otherwise the raw bytes of its value are used to compute the hash code. - * @throws IllegalStateException if the field contains an element that is not - * of CacheableKey derived type. - * - * @see serializationRegistry->addPdxType - */ + * Generates a hashcode based on the identity fields of + * this PdxInstance. + *

If a PdxInstance has marked identity fields using {@link + * PdxWriter#markIdentityField} + * then only the marked identity fields are its identity fields. + * Otherwise all its fields are identity fields. + *

+ * For deserialization C++ Native Client requires the domain class to be + * registered. + * If the field is an array then all array + * elements are used for hashcode computation. + * Otherwise the raw bytes of its value are used to compute the hash code. + * @throws IllegalStateException if the field contains an element that is not + * of CacheableKey derived type. + * + * @see serializationRegistry->addPdxType + */ virtual int32_t hashcode() const = 0; /** - * Prints out all of the identity fields of this PdxInstance. - *

If a PdxInstance has marked identity fields using {@link - * PdxWriter#markIdentityField} - * then only the marked identity fields are its identity fields. - * Otherwise all its fields are identity fields

. - * For deserialization C++ Native Client requires the domain class to be - * registered. - * - * @see serializationRegistry->addPdxType - */ + * Prints out all of the identity fields of this PdxInstance. + *

If a PdxInstance has marked identity fields using {@link + * PdxWriter#markIdentityField} + * then only the marked identity fields are its identity fields. + * Otherwise all its fields are identity fields

. + * For deserialization C++ Native Client requires the domain class to be + * registered. + * + * @see serializationRegistry->addPdxType + */ virtual CacheableStringPtr toString() const = 0; /** @@ -503,52 +504,53 @@ class CPPCACHE_EXPORT PdxInstance : public PdxSerializable { * @brief deserialize this object, typical implementation should return * the 'this' pointer. This is an internal method. */ - virtual void fromData(DataInput& input) { + virtual Serializable* fromData(DataInput& input) { return PdxSerializable::fromData(input); } /** - * Returns true if the given CacheableKey derived object is equals to this - * instance. - *

If other is not a PdxInstance then it is not equal to this - * instance. - * NOTE: Even if other is the result of calling {@link - * #getObject()} it will not - * be equal to this instance

. - *

Otherwise equality of two PdxInstances is determined as follows: - *

    - *
  1. The domain class name must be equal for both PdxInstances - *
  2. Each identity field must be equal. - *

- * If one of the instances does not have a field that the other one does then - * equals will assume it - * has the field with a default value. - * If a PdxInstance has marked identity fields using {@link - * PdxWriter#markIdentityField markIdentityField} - * then only the marked identity fields are its identity fields. - * Otherwise all its fields are identity fields. - *

An identity field is equal if all the following are true: - *

    - *
  1. The field name is equal. - *
  2. The field type is equal. - *
  3. The field value is equal. - *

- * If an identity field is of type derived from Cacheable then it - * is deserialized. For deserialization C++ Native Client requires the domain - * class to be registered. - * If the deserialized object is an array then all array elements - * are used to determine equality. - * If an identity field is of type CacheableObjectArray then it - * is deserialized and all array elements are used to determine equality. For - * all other field types the value does not need to be deserialized. Instead - * the serialized raw bytes are compared and used to determine equality. - * @param other the other instance to compare to this. - * @return true if this instance is equal to other. - * @throws IllegalStateException if the field contains an element that is not - * of CacheableKey derived type. - * - * @see serializationRegistry->addPdxType - */ + * Returns true if the given CacheableKey derived object is equals to this + * instance. + *

If other is not a PdxInstance then it is not equal to this + * instance. + * NOTE: Even if other is the result of calling {@link + * #getObject()} it will not + * be equal to this instance

. + *

Otherwise equality of two PdxInstances is determined as follows: + *

    + *
  1. The domain class name must be equal for both PdxInstances + *
  2. Each identity field must be equal. + *

+ * If one of the instances does not have a field that the other one does then + * equals will assume it + * has the field with a default value. + * If a PdxInstance has marked identity fields using {@link + * PdxWriter#markIdentityField markIdentityField} + * then only the marked identity fields are its identity fields. + * Otherwise all its fields are identity fields. + *

An identity field is equal if all the following are true: + *

    + *
  1. The field name is equal. + *
  2. The field type is equal. + *
  3. The field value is equal. + *

+ * If an identity field is of type derived from Cacheable then it + * is deserialized. For deserialization C++ Native Client requires the domain + * class to be registered. + * If the deserialized object is an array then all array elements + * are used to determine equality. + * If an identity field is of type CacheableObjectArray then it is + * deserialized and all array elements are used to determine equality. + * For all other field types the value does not need to be deserialized. + * Instead the serialized raw bytes are compared and used to determine + * equality. + * @param other the other instance to compare to this. + * @return true if this instance is equal to other. + * @throws IllegalStateException if the field contains an element that is not + * of CacheableKey derived type. + * + * @see serializationRegistry->addPdxType + */ virtual bool operator==(const CacheableKey& other) const = 0; /** @return the size of the object in bytes @@ -558,9 +560,9 @@ class CPPCACHE_EXPORT PdxInstance : public PdxSerializable { virtual uint32_t objectSize() const = 0; /** - * Return an unmodifiable list of the field names on this PdxInstance. - * @return an unmodifiable list of the field names on this PdxInstance - */ + * Return an unmodifiable list of the field names on this PdxInstance. + * @return an unmodifiable list of the field names on this PdxInstance + */ virtual CacheableStringArrayPtr getFieldNames() = 0; // From PdxSerializable @@ -572,35 +574,36 @@ class CPPCACHE_EXPORT PdxInstance : public PdxSerializable { virtual void toData(PdxWriterPtr output) = 0; /** - * @brief Deserialize this object. This is an internal method. - * @param PdxReader to Deserialize the PDX object - */ + * @brief Deserialize this object. This is an internal method. + * @param PdxReader to Deserialize the PDX object + */ virtual void fromData(PdxReaderPtr input) = 0; /** - * Return the full name of the class that this pdx instance represents. - * @return the name of the class that this pdx instance represents. - * @throws IllegalStateException if the PdxInstance typeid is not defined yet, - * to get classname - * or if PdxType is not defined for PdxInstance. - */ + * Return the full name of the class that this pdx instance represents. + * @return the name of the class that this pdx instance represents. + * @throws IllegalStateException if the PdxInstance typeid is not defined yet, + * to get classname + * or if PdxType is not defined for PdxInstance. + */ virtual const char* getClassName() const = 0; /** - * Return the type @see PdxInstance::PdxFieldTypes of the field in the pdx - * instance. - * @return the type @see PdxInstance::PdxFieldTypes of the field in the pdx - * instance. - * @throws IllegalStateException if the PdxInstance typeid is not defined yet, - * to get classname or if PdxType is not defined for PdxInstance. - */ +* Return the type @see PdxInstance::PdxFieldTypes of the field in the pdx +* instance. +* @return the type @see PdxInstance::PdxFieldTypes of the field in the pdx +* instance. +* @throws IllegalStateException if the PdxInstance typeid is not defined yet, to +* get classname +* or if PdxType is not defined for PdxInstance. +*/ virtual PdxFieldTypes::PdxFieldType getFieldType( const char* fieldname) const = 0; protected: /** - * @brief constructors - */ + * @brief constructors + */ PdxInstance() {} private: @@ -608,7 +611,6 @@ class CPPCACHE_EXPORT PdxInstance : public PdxSerializable { PdxInstance(const PdxInstance& other); void operator=(const PdxInstance& other); }; - } // namespace client } // namespace geode } // namespace apache diff --git a/cppcache/include/geode/PdxSerializable.hpp b/cppcache/include/geode/PdxSerializable.hpp index fa411dd..eb096d0 100644 --- a/cppcache/include/geode/PdxSerializable.hpp +++ b/cppcache/include/geode/PdxSerializable.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_PDXSERIALIZABLE_H_ +#define GEODE_PDXSERIALIZABLE_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -15,11 +20,6 @@ * limitations under the License. */ -#pragma once - -#ifndef GEODE_PDXSERIALIZABLE_H_ -#define GEODE_PDXSERIALIZABLE_H_ - #include "CacheableKey.hpp" namespace apache { @@ -80,7 +80,7 @@ class CPPCACHE_EXPORT PdxSerializable : public CacheableKey { *@brief deserialize this object, typical implementation should return * the 'this' pointer. **/ - virtual void fromData(DataInput& input); + virtual Serializable* fromData(DataInput& input); /** *@brief return the classId of the instance being serialized. @@ -101,7 +101,6 @@ class CPPCACHE_EXPORT PdxSerializable : public CacheableKey { */ virtual const char* getClassName() const = 0; }; - } // namespace client } // namespace geode } // namespace apache diff --git a/cppcache/include/geode/PdxWrapper.hpp b/cppcache/include/geode/PdxWrapper.hpp index 139384b..594fb08 100644 --- a/cppcache/include/geode/PdxWrapper.hpp +++ b/cppcache/include/geode/PdxWrapper.hpp @@ -85,7 +85,7 @@ class CPPCACHE_EXPORT PdxWrapper : public PdxSerializable { *@brief deserialize this object, typical implementation should return * the 'this' pointer. **/ - void fromData(DataInput& input); + Serializable* fromData(DataInput& input); /** *@brief return the classId of the instance being serialized. * This is used by deserialization to determine what instance diff --git a/cppcache/include/geode/Properties.hpp b/cppcache/include/geode/Properties.hpp index 5fb0a61..e0f7861 100644 --- a/cppcache/include/geode/Properties.hpp +++ b/cppcache/include/geode/Properties.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_PROPERTIES_H_ +#define GEODE_PROPERTIES_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -15,11 +20,6 @@ * limitations under the License. */ -#pragma once - -#ifndef GEODE_PROPERTIES_H_ -#define GEODE_PROPERTIES_H_ - /** * @file */ @@ -130,7 +130,7 @@ class CPPCACHE_EXPORT Properties : public Serializable { /** *@brief deserialize this object **/ - virtual void fromData(DataInput& input); + virtual Serializable* fromData(DataInput& input); /** Return an empty instance for deserialization. */ static Serializable* createDeserializable(); @@ -157,7 +157,6 @@ class CPPCACHE_EXPORT Properties : public Serializable { Properties(const Properties&); const Properties& operator=(const Properties&); }; - } // namespace client } // namespace geode } // namespace apache diff --git a/cppcache/include/geode/RegionAttributes.hpp b/cppcache/include/geode/RegionAttributes.hpp index f3b7813..9d24293 100644 --- a/cppcache/include/geode/RegionAttributes.hpp +++ b/cppcache/include/geode/RegionAttributes.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_REGIONATTRIBUTES_H_ +#define GEODE_REGIONATTRIBUTES_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -15,11 +20,6 @@ * limitations under the License. */ -#pragma once - -#ifndef GEODE_REGIONATTRIBUTES_H_ -#define GEODE_REGIONATTRIBUTES_H_ - /** * @file */ @@ -39,7 +39,6 @@ namespace apache { namespace geode { namespace client { - class CacheImpl; /** @@ -189,7 +188,7 @@ class CPPCACHE_EXPORT RegionAttributes : public Serializable { virtual void toData(DataOutput& out) const; /** Initialize members from serialized data. */ - virtual void fromData(DataInput& in); + virtual Serializable* fromData(DataInput& in); /** Return an empty instance for deserialization. */ static Serializable* createDeserializable(); @@ -314,7 +313,6 @@ class CPPCACHE_EXPORT RegionAttributes : public Serializable { */ bool getConcurrencyChecksEnabled() { return m_isConcurrencyChecksEnabled; } const RegionAttributes& operator=(const RegionAttributes&) = delete; - private: // Helper function that safely compares two attribute string // taking into consideration the fact the one or the other @@ -350,6 +348,7 @@ class CPPCACHE_EXPORT RegionAttributes : public Serializable { RegionAttributes(const RegionAttributes& rhs); RegionAttributes(); + ExpirationAction::Action m_regionTimeToLiveExpirationAction; ExpirationAction::Action m_regionIdleTimeoutExpirationAction; ExpirationAction::Action m_entryTimeToLiveExpirationAction; @@ -395,10 +394,11 @@ class CPPCACHE_EXPORT RegionAttributes : public Serializable { friend class RegionInternal; friend class RegionXmlCreation; + private: + FRIEND_STD_SHARED_PTR(RegionAttributes) }; - } // namespace client } // namespace geode } // namespace apache diff --git a/cppcache/include/geode/Serializable.hpp b/cppcache/include/geode/Serializable.hpp index 751b4d7..6e21260 100644 --- a/cppcache/include/geode/Serializable.hpp +++ b/cppcache/include/geode/Serializable.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_SERIALIZABLE_H_ +#define GEODE_SERIALIZABLE_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -15,11 +20,6 @@ * limitations under the License. */ -#pragma once - -#ifndef GEODE_SERIALIZABLE_H_ -#define GEODE_SERIALIZABLE_H_ - /** * @file */ @@ -35,16 +35,16 @@ namespace client { class DataOutput; class DataInput; -typedef void (*CliCallbackMethod)(Cache &cache); +typedef void (*CliCallbackMethod)(Cache& cache); /** @brief signature of functions passed to registerType. Such functions * should return an empty instance of the type they represent. The instance * will typically be initialized immediately after creation by a call to * fromData(). */ -using TypeFactoryMethod = std::function; +using TypeFactoryMethod = std::function; -typedef PdxSerializable *(*TypeFactoryMethodPdx)(); +typedef PdxSerializable* (*TypeFactoryMethodPdx)(); /** * @class Serializable Serializable.hpp * This abstract base class is the superclass of all user objects @@ -57,12 +57,13 @@ class CPPCACHE_EXPORT Serializable /** *@brief serialize this object **/ - virtual void toData(DataOutput &output) const = 0; + virtual void toData(DataOutput& output) const = 0; /** - *@brief deserialize this object. + *@brief deserialize this object, typical implementation should return + * the 'this' pointer. **/ - virtual void fromData(DataInput &input) = 0; + virtual Serializable* fromData(DataInput& input) = 0; /** *@brief Return the classId of the instance being serialized. @@ -134,10 +135,9 @@ class CPPCACHE_EXPORT Serializable private: // Never defined. - Serializable(const Serializable &other); - void operator=(const Serializable &other); + Serializable(const Serializable& other); + void operator=(const Serializable& other); }; - } // namespace client } // namespace geode } // namespace apache diff --git a/cppcache/include/geode/Struct.hpp b/cppcache/include/geode/Struct.hpp index 6dbd296..345363a 100644 --- a/cppcache/include/geode/Struct.hpp +++ b/cppcache/include/geode/Struct.hpp @@ -111,7 +111,7 @@ class CPPCACHE_EXPORT Struct : public Serializable { /** * Deserializes the Struct object from the DataInput. @TODO KN: better comment */ - virtual void fromData(DataInput& input); + virtual Serializable* fromData(DataInput& input); /** * Serializes this Struct object. @TODO KN: better comment @@ -153,7 +153,8 @@ class CPPCACHE_EXPORT Struct : public Serializable { Struct(); - typedef std::unordered_map FieldNames; + typedef std::unordered_map + FieldNames; FieldNames m_fieldNames; std::vector m_fieldValues; diff --git a/cppcache/include/geode/UserFunctionExecutionException.hpp b/cppcache/include/geode/UserFunctionExecutionException.hpp index 0d0efb6..01e5a40 100644 --- a/cppcache/include/geode/UserFunctionExecutionException.hpp +++ b/cppcache/include/geode/UserFunctionExecutionException.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_USERFUNCTIONEXECUTIONEXCEPTION_H_ +#define GEODE_USERFUNCTIONEXECUTIONEXCEPTION_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -15,18 +20,12 @@ * limitations under the License. */ -#pragma once - -#ifndef GEODE_USERFUNCTIONEXECUTIONEXCEPTION_H_ -#define GEODE_USERFUNCTIONEXECUTIONEXCEPTION_H_ - #include "Serializable.hpp" #include "CacheableString.hpp" namespace apache { namespace geode { namespace client { - class UserFunctionExecutionException; typedef std::shared_ptr UserFunctionExecutionExceptionPtr; @@ -62,7 +61,7 @@ class UserFunctionExecutionException : public Serializable { * the 'this' pointer. * @throws IllegalStateException If this api is called from User code. **/ - virtual void fromData(DataInput& input); + virtual Serializable* fromData(DataInput& input); /** *@brief Return the classId of the instance being serialized. @@ -119,7 +118,6 @@ class UserFunctionExecutionException : public Serializable { CacheableStringPtr m_message; // error message }; - } // namespace client } // namespace geode } // namespace apache diff --git a/cppcache/integration-test/DeltaEx.hpp b/cppcache/integration-test/DeltaEx.hpp index 2b0115d..263f652 100644 --- a/cppcache/integration-test/DeltaEx.hpp +++ b/cppcache/integration-test/DeltaEx.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_INTEGRATION_TEST_DELTAEX_H_ +#define GEODE_INTEGRATION_TEST_DELTAEX_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -15,11 +20,6 @@ * limitations under the License. */ -#pragma once - -#ifndef GEODE_INTEGRATION_TEST_DELTAEX_H_ -#define GEODE_INTEGRATION_TEST_DELTAEX_H_ - #include "fw_dunit.hpp" #include #include @@ -64,9 +64,10 @@ class DeltaEx : public Cacheable, public Delta { output.writeInt(counter); toDataCount++; } - virtual void fromData(DataInput& input) { + virtual Serializable* fromData(DataInput& input) { input.readInt(&counter); fromDataCount++; + return this; } virtual int32_t classId() const { return 1; } virtual uint32_t objectSize() const { return 0; } diff --git a/cppcache/integration-test/testSerialization.cpp b/cppcache/integration-test/testSerialization.cpp index 4e96700..8f9bf79 100644 --- a/cppcache/integration-test/testSerialization.cpp +++ b/cppcache/integration-test/testSerialization.cpp @@ -84,11 +84,12 @@ class OtherType : public Serializable { virtual uint32_t objectSize() const { return sizeof(CData); } - virtual void fromData(DataInput& input) { + virtual Serializable* fromData(DataInput& input) { int32_t size = 0; input.readArrayLen(&size); input.readBytesOnly(reinterpret_cast(&m_struct), size); input.readInt(&m_classIdToReturn); + return this; } static Serializable* createDeserializable() { diff --git a/cppcache/src/BucketServerLocation.hpp b/cppcache/src/BucketServerLocation.hpp index 53e2264..78398ab 100644 --- a/cppcache/src/BucketServerLocation.hpp +++ b/cppcache/src/BucketServerLocation.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_BUCKETSERVERLOCATION_H_ +#define GEODE_BUCKETSERVERLOCATION_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -15,18 +20,12 @@ * limitations under the License. */ -#pragma once - -#ifndef GEODE_BUCKETSERVERLOCATION_H_ -#define GEODE_BUCKETSERVERLOCATION_H_ - #include "ServerLocation.hpp" #include namespace apache { namespace geode { namespace client { - _GF_PTR_DEF_(BucketServerLocation, BucketServerLocationPtr) class BucketServerLocation : public ServerLocation { @@ -110,9 +109,9 @@ class BucketServerLocation : public ServerLocation { } } - void fromData(apache::geode::client::DataInput& input) { + BucketServerLocation* fromData(apache::geode::client::DataInput& input) { ServerLocation::fromData(input); - input.readInt(&m_bucketId); + input.readInt((int32_t*)&m_bucketId); input.readBoolean(&m_isPrimary); input.read(&m_version); input.read((&m_numServerGroups)); @@ -127,6 +126,7 @@ class BucketServerLocation : public ServerLocation { m_serverGroups = CacheableStringArray::createNoCopy(serverGroups, m_numServerGroups); } + return this; } uint32_t objectSize() const { @@ -173,7 +173,6 @@ class BucketServerLocation : public ServerLocation { inline CacheableStringArrayPtr getServerGroups() { return m_serverGroups; } }; - } // namespace client } // namespace geode } // namespace apache diff --git a/cppcache/src/CacheFactory.cpp b/cppcache/src/CacheFactory.cpp index 8ef89f9..ca9d92b 100644 --- a/cppcache/src/CacheFactory.cpp +++ b/cppcache/src/CacheFactory.cpp @@ -30,6 +30,8 @@ #include #include #include +#include +#include #include #include #include "DiskVersionTag.hpp" @@ -50,8 +52,9 @@ CacheFactoryPtr CacheFactory::createCacheFactory( return std::make_shared(configPtr); } -void CacheFactory::create_(const char* name, const char* id_data, - CachePtr& cptr, bool readPdxSerialized) { +void CacheFactory::create_(const char* name, + const char* id_data, CachePtr& cptr, + bool readPdxSerialized) { cptr = nullptr; if (name == nullptr) { throw IllegalArgumentException("CacheFactory::create: name is nullptr"); @@ -93,11 +96,10 @@ CachePtr CacheFactory::create() { TXCommitMessage::create, std::ref(*(cache->m_cacheImpl->getMemberListForVersionStamp())))); - // cache->m_cacheImpl->getSerializationRegistry()->addType( - // GeodeTypeIdsImpl::PDX, PdxInstantiator::createDeserializable); - // cache->m_cacheImpl->getSerializationRegistry()->addType( - // GeodeTypeIds::CacheableEnum, - // PdxEnumInstantiator::createDeserializable); + cache->m_cacheImpl->getSerializationRegistry()->addType( + GeodeTypeIdsImpl::PDX, PdxInstantiator::createDeserializable); + cache->m_cacheImpl->getSerializationRegistry()->addType( + GeodeTypeIds::CacheableEnum, PdxEnumInstantiator::createDeserializable); cache->m_cacheImpl->getSerializationRegistry()->addType( GeodeTypeIds::PdxType, std::bind(PdxType::CreateDeserializable, diff --git a/cppcache/src/CacheableDate.cpp b/cppcache/src/CacheableDate.cpp index 04b7b7b..40adad8 100644 --- a/cppcache/src/CacheableDate.cpp +++ b/cppcache/src/CacheableDate.cpp @@ -40,7 +40,10 @@ void CacheableDate::toData(DataOutput& output) const { output.writeInt(m_timevalue); } -void CacheableDate::fromData(DataInput& input) { input.readInt(&m_timevalue); } +Serializable* CacheableDate::fromData(DataInput& input) { + input.readInt(&m_timevalue); + return this; +} Serializable* CacheableDate::createDeserializable() { return new CacheableDate(); diff --git a/cppcache/src/CacheableEnum.cpp b/cppcache/src/CacheableEnum.cpp index 32e678f..5e76483 100644 --- a/cppcache/src/CacheableEnum.cpp +++ b/cppcache/src/CacheableEnum.cpp @@ -49,19 +49,20 @@ void CacheableEnum::toData(apache::geode::client::DataOutput& output) const { output.writeArrayLen(enumVal & 0xFFFFFF); } -void CacheableEnum::fromData(apache::geode::client::DataInput& input) { +Serializable* CacheableEnum::fromData(apache::geode::client::DataInput& input) { int8_t dsId; input.read(&dsId); int32_t arrLen; input.readArrayLen(&arrLen); int enumId = (dsId << 24) | (arrLen & 0xFFFFFF); - auto enumVal = PdxHelper::getEnum( + EnumInfoPtr enumVal = PdxHelper::getEnum( enumId, CacheRegionHelper::getCacheImpl(input.getCache())->getPdxTypeRegistry()); m_enumClassName = enumVal->getEnumClassName(); m_enumName = enumVal->getEnumName(); m_ordinal = enumVal->getEnumOrdinal(); + return enumVal.get(); } int32_t CacheableEnum::hashcode() const { diff --git a/cppcache/src/CacheableFileName.cpp b/cppcache/src/CacheableFileName.cpp index 7f46047..16715e2 100644 --- a/cppcache/src/CacheableFileName.cpp +++ b/cppcache/src/CacheableFileName.cpp @@ -31,9 +31,10 @@ void CacheableFileName::toData(DataOutput& output) const { CacheableString::toData(output); } -void CacheableFileName::fromData(DataInput& input) { +Serializable* CacheableFileName::fromData(DataInput& input) { input.read(&m_type); - CacheableString::fromData(input); + (void)CacheableString::fromData(input); + return this; } int32_t CacheableFileName::classId() const { return 0; } diff --git a/cppcache/src/CacheableObjectArray.cpp b/cppcache/src/CacheableObjectArray.cpp index 35de170..75a38e9 100644 --- a/cppcache/src/CacheableObjectArray.cpp +++ b/cppcache/src/CacheableObjectArray.cpp @@ -36,7 +36,7 @@ void CacheableObjectArray::toData(DataOutput& output) const { } } -void CacheableObjectArray::fromData(DataInput& input) { +Serializable* CacheableObjectArray::fromData(DataInput& input) { int32_t len; input.readArrayLen(&len); if (len >= 0) { @@ -52,6 +52,7 @@ void CacheableObjectArray::fromData(DataInput& input) { push_back(obj); } } + return this; } int32_t CacheableObjectArray::classId() const { return 0; } diff --git a/cppcache/src/CacheableObjectPartList.cpp b/cppcache/src/CacheableObjectPartList.cpp index 93dd7c8..2484423 100644 --- a/cppcache/src/CacheableObjectPartList.cpp +++ b/cppcache/src/CacheableObjectPartList.cpp @@ -31,7 +31,7 @@ void CacheableObjectPartList::toData(DataOutput& output) const { "CacheableObjectPartList::toData not implemented"); } -void CacheableObjectPartList::fromData(DataInput& input) { +Serializable* CacheableObjectPartList::fromData(DataInput& input) { bool hasKeys; input.readBoolean(&hasKeys); int32_t len; @@ -121,6 +121,7 @@ void CacheableObjectPartList::fromData(DataInput& input) { *m_keysOffset += len; } } + return this; } int32_t CacheableObjectPartList::classId() const { return 0; } diff --git a/cppcache/src/CacheableObjectPartList.hpp b/cppcache/src/CacheableObjectPartList.hpp index eba59b6..35e9d39 100644 --- a/cppcache/src/CacheableObjectPartList.hpp +++ b/cppcache/src/CacheableObjectPartList.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_CACHEABLEOBJECTPARTLIST_H_ +#define GEODE_CACHEABLEOBJECTPARTLIST_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -15,11 +20,6 @@ * limitations under the License. */ -#pragma once - -#ifndef GEODE_CACHEABLEOBJECTPARTLIST_H_ -#define GEODE_CACHEABLEOBJECTPARTLIST_H_ - #include #include #include @@ -37,7 +37,6 @@ namespace apache { namespace geode { namespace client { - class ThinClientRegion; /** @@ -120,7 +119,7 @@ class CacheableObjectPartList : public Cacheable { /** *@brief deserialize this object **/ - virtual void fromData(DataInput& input); + virtual Serializable* fromData(DataInput& input); /** * @brief creation function for java Object[] @@ -154,7 +153,6 @@ class CacheableObjectPartList : public Cacheable { }; typedef std::shared_ptr CacheableObjectPartListPtr; - } // namespace client } // namespace geode } // namespace apache diff --git a/cppcache/src/CacheableString.cpp b/cppcache/src/CacheableString.cpp index b609df8..eddba1c 100644 --- a/cppcache/src/CacheableString.cpp +++ b/cppcache/src/CacheableString.cpp @@ -42,7 +42,7 @@ void CacheableString::toData(DataOutput& output) const { } } -void CacheableString::fromData(DataInput& input) { +Serializable* CacheableString::fromData(DataInput& input) { uint16_t shortLen = 0; if (m_type == GF_STRING) { input.readASCII(reinterpret_cast(&m_str), &shortLen); @@ -55,6 +55,7 @@ void CacheableString::fromData(DataInput& input) { } else if (m_type == GF_WIDESTRING_HUGE) { input.readUTFHuge(reinterpret_cast(&m_str), &m_len); } + return this; } Serializable* CacheableString::createDeserializable() { diff --git a/cppcache/src/CacheableToken.cpp b/cppcache/src/CacheableToken.cpp index d0918af..50de562 100644 --- a/cppcache/src/CacheableToken.cpp +++ b/cppcache/src/CacheableToken.cpp @@ -46,8 +46,9 @@ void CacheableToken::toData(DataOutput& output) const { output.writeInt(static_cast(m_value)); } -void CacheableToken::fromData(DataInput& input) { +Serializable* CacheableToken::fromData(DataInput& input) { input.readInt(reinterpret_cast(&m_value)); + return this; } int32_t CacheableToken::classId() const { return 0; } diff --git a/cppcache/src/CacheableToken.hpp b/cppcache/src/CacheableToken.hpp index 99e67a9..d4a2720 100644 --- a/cppcache/src/CacheableToken.hpp +++ b/cppcache/src/CacheableToken.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_CACHEABLETOKEN_H_ +#define GEODE_CACHEABLETOKEN_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -15,11 +20,6 @@ * limitations under the License. */ -#pragma once - -#ifndef GEODE_CACHEABLETOKEN_H_ -#define GEODE_CACHEABLETOKEN_H_ - #include #include @@ -56,7 +56,7 @@ class CPPCACHE_EXPORT CacheableToken : public Cacheable { /** *@brief deserialize this object **/ - virtual void fromData(DataInput& input); + virtual Serializable* fromData(DataInput& input); /** * @brief creation function for strings. @@ -126,7 +126,6 @@ class CPPCACHE_EXPORT CacheableToken : public Cacheable { void operator=(const CacheableToken& other); CacheableToken(const CacheableToken& other); }; - } // namespace client } // namespace geode } // namespace apache diff --git a/cppcache/src/CacheableUndefined.cpp b/cppcache/src/CacheableUndefined.cpp index d7fd1ee..5d3bcf6 100644 --- a/cppcache/src/CacheableUndefined.cpp +++ b/cppcache/src/CacheableUndefined.cpp @@ -26,7 +26,7 @@ namespace client { void CacheableUndefined::toData(DataOutput& output) const {} -void CacheableUndefined::fromData(DataInput& input) {} +Serializable* CacheableUndefined::fromData(DataInput& input) { return this; } int32_t CacheableUndefined::classId() const { return 0; } diff --git a/cppcache/src/CachedDeserializableHelper.hpp b/cppcache/src/CachedDeserializableHelper.hpp new file mode 100644 index 0000000..8a96705 --- /dev/null +++ b/cppcache/src/CachedDeserializableHelper.hpp @@ -0,0 +1,106 @@ +#pragma once + +#ifndef GEODE_CACHEDDESERIALIZABLEHELPER_H_ +#define GEODE_CACHEDDESERIALIZABLEHELPER_H_ + +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include +#include "GeodeTypeIdsImpl.hpp" + +namespace apache { +namespace geode { +namespace client { +/** + * Helper class to deserialize bytes received from GFE in the form of + * PREFER_BYTES_CACHED_DESERIALIZABLE = -65, or + * VM_CACHED_DESERIALIZABLE = -64. + * + * + */ +class CachedDeserializableHelper : public Cacheable, + private NonCopyable, + private NonAssignable { + private: + int8_t m_typeId; + SerializablePtr m_intermediate; + + // default constructor disabled + CachedDeserializableHelper(); + CachedDeserializableHelper(int8_t typeId) : m_typeId(typeId) {} + + public: + /** + *@brief serialize this object + **/ + virtual void toData(DataOutput& output) const { + throw IllegalStateException( + "CachedDeserializableHelper::toData should never have been called."); + } + + /** + *@brief deserialize this object + **/ + virtual Serializable* fromData(DataInput& input) { + int32_t arrayLen; + input.readArrayLen(&arrayLen); + input.readObject(m_intermediate); + return m_intermediate.get(); + } + + /** + * @brief creation function + */ + inline static Serializable* createForPreferBytesDeserializable() { + return new CachedDeserializableHelper( + GeodeTypeIdsImpl::PreferBytesCachedDeserializable); + } + + /** + * @brief creation function + */ + inline static Serializable* createForVmCachedDeserializable() { + return new CachedDeserializableHelper( + GeodeTypeIdsImpl::VmCachedDeserializable); + } + + /** + *@brief return the typeId byte of the instance being serialized. + * This is used by deserialization to determine what instance + * type to create and derserialize into. + */ + virtual int8_t typeId() const { return m_typeId; } + + /** + * Return the data serializable fixed ID size type for internal use. + * @since GFE 5.7 + */ + virtual int8_t DSFID() const { return GeodeTypeIdsImpl::FixedIDByte; } + + int32_t classId() const { return 0; } +}; + +typedef std::shared_ptr + CachedDeserializableHelperPtr; +} // namespace client +} // namespace geode +} // namespace apache + +#endif // GEODE_CACHEDDESERIALIZABLEHELPER_H_ diff --git a/cppcache/src/ClientConnectionRequest.cpp b/cppcache/src/ClientConnectionRequest.cpp index aca8788..adac50c 100644 --- a/cppcache/src/ClientConnectionRequest.cpp +++ b/cppcache/src/ClientConnectionRequest.cpp @@ -14,27 +14,27 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - #include "ClientConnectionRequest.hpp" #include #include #include "GeodeTypeIdsImpl.hpp" - using namespace apache::geode::client; - void ClientConnectionRequest::toData(DataOutput& output) const { + // output.writeASCII( m_servergroup.c_str() ); + // writeSetOfServerLocation( output ); + // CacheableStringPtr abe = CacheableString::create( m_servergroup.c_str()); + // output.writeObject(abe);// Changed output.writeNativeString(m_servergroup.c_str()); writeSetOfServerLocation(output); } - -void ClientConnectionRequest::fromData(DataInput& input) {} - +Serializable* ClientConnectionRequest::fromData(DataInput& input) { + return nullptr; // not needed as of now and my guess is it will never be + // needed. +} uint32_t ClientConnectionRequest::objectSize() const { return 0; } - int8_t ClientConnectionRequest::typeId() const { return static_cast(GeodeTypeIdsImpl::ClientConnectionRequest); } - void ClientConnectionRequest::writeSetOfServerLocation( DataOutput& output) const { output.writeInt( diff --git a/cppcache/src/ClientConnectionRequest.hpp b/cppcache/src/ClientConnectionRequest.hpp index a465175..5fe5dcc 100644 --- a/cppcache/src/ClientConnectionRequest.hpp +++ b/cppcache/src/ClientConnectionRequest.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_CLIENTCONNECTIONREQUEST_H_ +#define GEODE_CLIENTCONNECTIONREQUEST_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -14,44 +19,52 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -#pragma once - -#ifndef GEODE_CLIENTCONNECTIONREQUEST_H_ -#define GEODE_CLIENTCONNECTIONREQUEST_H_ - #include "ServerLocationRequest.hpp" #include "TcrEndpoint.hpp" #include #include #include "ServerLocation.hpp" - +#define _TEST_ namespace apache { namespace geode { namespace client { - class ClientConnectionRequest : public ServerLocationRequest { public: +#ifdef _TEST_ ClientConnectionRequest(const std::set& excludeServergroup, std::string servergroup = "") : ServerLocationRequest(), m_servergroup(servergroup), m_excludeServergroup_serverLocation(excludeServergroup) {} +#else + ClientConnectionRequest(const std::set& excludeServergroup, + std::string servergroup = "") + : m_excludeServergroup(excludeServergroup), m_servergroup(servergroup) {} +#endif virtual void toData(DataOutput& output) const; - virtual void fromData(DataInput& input); + virtual Serializable* fromData(DataInput& input); virtual uint32_t objectSize() const; virtual int8_t typeId() const; std::string getServerGroup() const { return m_servergroup; } +#ifdef _TEST_ const std::set& getExcludedServerGroup() const { return m_excludeServergroup_serverLocation; } +#else + const std::set& getExcludedServerGroup() const { + return m_excludeServergroup; + } +#endif virtual ~ClientConnectionRequest() {} // Virtual destructor private: void writeSetOfServerLocation(DataOutput& output) const; std::string m_servergroup; +#ifdef _TEST_ const std::set& m_excludeServergroup_serverLocation; +#else + const std::set& m_excludeServergroup; +#endif }; - } // namespace client } // namespace geode } // namespace apache diff --git a/cppcache/src/ClientConnectionResponse.cpp b/cppcache/src/ClientConnectionResponse.cpp index 79f6fdf..8e6dd95 100644 --- a/cppcache/src/ClientConnectionResponse.cpp +++ b/cppcache/src/ClientConnectionResponse.cpp @@ -17,24 +17,20 @@ #include "ClientConnectionResponse.hpp" #include #include - using namespace apache::geode::client; - -void ClientConnectionResponse::fromData(DataInput& input) { +ClientConnectionResponse* ClientConnectionResponse::fromData(DataInput& input) { input.readBoolean(&m_serverFound); if (m_serverFound) { m_server.fromData(input); } + return this; } - int8_t ClientConnectionResponse::typeId() const { return static_cast(GeodeTypeIdsImpl::ClientConnectionResponse); } - uint32_t ClientConnectionResponse::objectSize() const { return (m_server.objectSize()); } - ServerLocation ClientConnectionResponse::getServerLocation() const { return m_server; } diff --git a/cppcache/src/ClientConnectionResponse.hpp b/cppcache/src/ClientConnectionResponse.hpp index 1eead76..0dd11fb 100644 --- a/cppcache/src/ClientConnectionResponse.hpp +++ b/cppcache/src/ClientConnectionResponse.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_CLIENTCONNECTIONRESPONSE_H_ +#define GEODE_CLIENTCONNECTIONRESPONSE_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -14,24 +19,22 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -#pragma once - -#ifndef GEODE_CLIENTCONNECTIONRESPONSE_H_ -#define GEODE_CLIENTCONNECTIONRESPONSE_H_ - #include "ServerLocationResponse.hpp" #include "ServerLocation.hpp" #include - namespace apache { namespace geode { namespace client { - class ClientConnectionResponse : public ServerLocationResponse { public: - ClientConnectionResponse() : ServerLocationResponse(), m_serverFound(false) {} - virtual void fromData(DataInput& input); + ClientConnectionResponse() + : ServerLocationResponse() + /* adongre + * CID 28927: Uninitialized scalar field (UNINIT_CTOR) + */ + , + m_serverFound(false) {} + virtual ClientConnectionResponse* fromData(DataInput& input); virtual int8_t typeId() const; virtual uint32_t objectSize() const; virtual ServerLocation getServerLocation() const; @@ -45,7 +48,6 @@ class ClientConnectionResponse : public ServerLocationResponse { ServerLocation m_server; }; typedef std::shared_ptr ClientConnectionResponsePtr; - } // namespace client } // namespace geode } // namespace apache diff --git a/cppcache/src/ClientHealthStats.cpp b/cppcache/src/ClientHealthStats.cpp index a7a960d..c9ffa2e 100644 --- a/cppcache/src/ClientHealthStats.cpp +++ b/cppcache/src/ClientHealthStats.cpp @@ -32,7 +32,7 @@ void ClientHealthStats::toData(DataOutput& output) const { m_updateTime->toData(output); } -void ClientHealthStats::fromData(DataInput& input) { +Serializable* ClientHealthStats::fromData(DataInput& input) { input.readInt(&m_numGets); input.readInt(&m_numPuts); input.readInt(&m_numMisses); @@ -41,6 +41,7 @@ void ClientHealthStats::fromData(DataInput& input) { input.readInt(&m_processCpuTime); input.readInt(&m_cpus); m_updateTime->fromData(input); + return this; } Serializable* ClientHealthStats::createDeserializable() { diff --git a/cppcache/src/ClientHealthStats.hpp b/cppcache/src/ClientHealthStats.hpp index e842443..00954d2 100644 --- a/cppcache/src/ClientHealthStats.hpp +++ b/cppcache/src/ClientHealthStats.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_CLIENTHEALTHSTATS_H_ +#define GEODE_CLIENTHEALTHSTATS_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -15,11 +20,6 @@ * limitations under the License. */ -#pragma once - -#ifndef GEODE_CLIENTHEALTHSTATS_H_ -#define GEODE_CLIENTHEALTHSTATS_H_ - #include #include #include @@ -39,7 +39,7 @@ class ClientHealthStats : public Serializable { /** *@brief deserialize this object **/ - virtual void fromData(DataInput& input); + virtual Serializable* fromData(DataInput& input); /** * @brief creation function for dates. @@ -88,7 +88,6 @@ class ClientHealthStats : public Serializable { int m_cpus; CacheableDatePtr m_updateTime; // Last updateTime }; - } // namespace client } // namespace geode } // namespace apache diff --git a/cppcache/src/ClientProxyMembershipID.cpp b/cppcache/src/ClientProxyMembershipID.cpp index f14e8e3..cbf7d6b 100644 --- a/cppcache/src/ClientProxyMembershipID.cpp +++ b/cppcache/src/ClientProxyMembershipID.cpp @@ -214,7 +214,7 @@ void ClientProxyMembershipID::toData(DataOutput& output) const { throw IllegalStateException("Member ID toData() not implemented."); } -void ClientProxyMembershipID::fromData(DataInput& input) { +Serializable* ClientProxyMembershipID::fromData(DataInput& input) { // deserialization for PR FX HA uint8_t* hostAddr; int32_t len, hostPort, dcport, vPID, durableClntTimeOut; @@ -259,6 +259,8 @@ void ClientProxyMembershipID::fromData(DataInput& input) { } readAdditionalData(input); + + return this; } Serializable* ClientProxyMembershipID::readEssentialData(DataInput& input) { diff --git a/cppcache/src/ClientProxyMembershipID.hpp b/cppcache/src/ClientProxyMembershipID.hpp index 02f4653..4e86423 100644 --- a/cppcache/src/ClientProxyMembershipID.hpp +++ b/cppcache/src/ClientProxyMembershipID.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_CLIENTPROXYMEMBERSHIPID_H_ +#define GEODE_CLIENTPROXYMEMBERSHIPID_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -15,11 +20,6 @@ * limitations under the License. */ -#pragma once - -#ifndef GEODE_CLIENTPROXYMEMBERSHIPID_H_ -#define GEODE_CLIENTPROXYMEMBERSHIPID_H_ - #include #include #include "GeodeTypeIdsImpl.hpp" @@ -30,7 +30,6 @@ namespace apache { namespace geode { namespace client { - class ClientProxyMembershipID; typedef std::shared_ptr ClientProxyMembershipIDPtr; @@ -63,7 +62,7 @@ class ClientProxyMembershipID : public DSMemberForVersionStamp { // Serializable interface: void toData(DataOutput& output) const; - void fromData(DataInput& input); + Serializable* fromData(DataInput& input); int32_t classId() const { return 0; } int8_t typeId() const { return GeodeTypeIdsImpl::InternalDistributedMember; } uint32_t objectSize() const { return 0; } @@ -129,7 +128,6 @@ class ClientProxyMembershipID : public DSMemberForVersionStamp { void readAdditionalData(DataInput& input); }; - } // namespace client } // namespace geode } // namespace apache diff --git a/cppcache/src/ClientReplacementRequest.cpp b/cppcache/src/ClientReplacementRequest.cpp index e88fa5e..08e4358 100644 --- a/cppcache/src/ClientReplacementRequest.cpp +++ b/cppcache/src/ClientReplacementRequest.cpp @@ -19,16 +19,15 @@ #include #include #include "GeodeTypeIdsImpl.hpp" - using namespace apache::geode::client; - void ClientReplacementRequest::toData(DataOutput& output) const { ClientConnectionRequest::toData(output); this->m_serverLocation.toData(output); } - -void ClientReplacementRequest::fromData(DataInput& input) {} - +Serializable* ClientReplacementRequest::fromData(DataInput& input) { + return nullptr; // not needed as of now and my guess is it will never be + // needed. +} int8_t ClientReplacementRequest::typeId() const { return static_cast(GeodeTypeIdsImpl::ClientReplacementRequest); } diff --git a/cppcache/src/ClientReplacementRequest.hpp b/cppcache/src/ClientReplacementRequest.hpp index bdb74da..78567ff 100644 --- a/cppcache/src/ClientReplacementRequest.hpp +++ b/cppcache/src/ClientReplacementRequest.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_CLIENTREPLACEMENTREQUEST_H_ +#define GEODE_CLIENTREPLACEMENTREQUEST_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -14,12 +19,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -#pragma once - -#ifndef GEODE_CLIENTREPLACEMENTREQUEST_H_ -#define GEODE_CLIENTREPLACEMENTREQUEST_H_ - #include "ServerLocationRequest.hpp" #include "ClientConnectionRequest.hpp" #include "TcrEndpoint.hpp" @@ -30,7 +29,6 @@ namespace apache { namespace geode { namespace client { - class ClientReplacementRequest : public ClientConnectionRequest { public: ClientReplacementRequest(const std::string& serverName, @@ -39,13 +37,12 @@ class ClientReplacementRequest : public ClientConnectionRequest { : ClientConnectionRequest(excludeServergroup, servergroup), m_serverLocation(ServerLocation(serverName)) {} virtual void toData(DataOutput& output) const; - virtual void fromData(DataInput& input); + virtual Serializable* fromData(DataInput& input); virtual int8_t typeId() const; virtual ~ClientReplacementRequest() {} // Virtual destructor private: const ServerLocation m_serverLocation; }; - } // namespace client } // namespace geode } // namespace apache diff --git a/cppcache/src/DiskStoreId.hpp b/cppcache/src/DiskStoreId.hpp index baf5ee4..886baec 100644 --- a/cppcache/src/DiskStoreId.hpp +++ b/cppcache/src/DiskStoreId.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_DISKSTOREID_H_ +#define GEODE_DISKSTOREID_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -15,11 +20,6 @@ * limitations under the License. */ -#pragma once - -#ifndef GEODE_DISKSTOREID_H_ -#define GEODE_DISKSTOREID_H_ - #include #include #include "DSMemberForVersionStamp.hpp" @@ -34,8 +34,8 @@ class DiskStoreId : public DSMemberForVersionStamp { DiskStoreId() : m_hashCode(""), m_mostSig(0), m_leastSig(0) {} /** - * for internal testing - */ + * for internal testing + */ DiskStoreId(int64_t mostSig, int64_t leastSig) : m_hashCode(""), m_mostSig(mostSig), m_leastSig(leastSig) {} @@ -52,9 +52,10 @@ class DiskStoreId : public DSMemberForVersionStamp { virtual void toData(DataOutput& output) const { throw IllegalStateException("DiskStoreId::toData not implemented"); } - virtual void fromData(DataInput& input) { + virtual Serializable* fromData(DataInput& input) { input.readInt(&m_mostSig); input.readInt(&m_leastSig); + return this; } virtual int32_t classId() const { return 0; } @@ -100,7 +101,6 @@ class DiskStoreId : public DSMemberForVersionStamp { int64_t m_mostSig; int64_t m_leastSig; }; - } // namespace client } // namespace geode } // namespace apache diff --git a/cppcache/src/EnumInfo.cpp b/cppcache/src/EnumInfo.cpp index 21e4156..a19400a 100644 --- a/cppcache/src/EnumInfo.cpp +++ b/cppcache/src/EnumInfo.cpp @@ -69,10 +69,11 @@ void EnumInfo::toData(apache::geode::client::DataOutput &output) const { output.writeInt(m_ordinal); } -void EnumInfo::fromData(apache::geode::client::DataInput &input) { +Serializable *EnumInfo::fromData(apache::geode::client::DataInput &input) { input.readObject(m_enumClassName); input.readObject(m_enumName); input.readInt(&m_ordinal); + return this; } int8_t EnumInfo::DSFID() const { diff --git a/cppcache/src/EnumInfo.hpp b/cppcache/src/EnumInfo.hpp index f993bb1..cba0677 100644 --- a/cppcache/src/EnumInfo.hpp +++ b/cppcache/src/EnumInfo.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_ENUMINFO_H_ +#define GEODE_ENUMINFO_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -15,11 +20,6 @@ * limitations under the License. */ -#pragma once - -#ifndef GEODE_ENUMINFO_H_ -#define GEODE_ENUMINFO_H_ - #include #include #include @@ -40,7 +40,7 @@ class CPPCACHE_EXPORT EnumInfo : public CacheableKey { EnumInfo(const char* enumClassName, const char* enumName, int32_t m_ordinal); static Serializable* createDeserializable() { return new EnumInfo(); } virtual void toData(DataOutput& output) const; - virtual void fromData(DataInput& input); + virtual Serializable* fromData(DataInput& input); virtual uint32_t objectSize() const { uint32_t size = sizeof(EnumInfo); size += sizeof(int32_t); @@ -62,7 +62,6 @@ class CPPCACHE_EXPORT EnumInfo : public CacheableKey { int32_t getEnumOrdinal() const { return m_ordinal; } }; typedef std::shared_ptr EnumInfoPtr; - } // namespace client } // namespace geode } // namespace apache diff --git a/cppcache/src/EventId.cpp b/cppcache/src/EventId.cpp index d17983b..6f944a6 100644 --- a/cppcache/src/EventId.cpp +++ b/cppcache/src/EventId.cpp @@ -71,7 +71,7 @@ void EventId::toData(DataOutput& output) const { output.write(m_breadcrumbCounter); } -void EventId::fromData(DataInput& input) { +Serializable* EventId::fromData(DataInput& input) { // TODO: statics being assigned; not thread-safe?? input.readArrayLen(&m_eidMemLen); input.readBytesOnly(reinterpret_cast(m_eidMem), m_eidMemLen); @@ -84,6 +84,7 @@ void EventId::fromData(DataInput& input) { m_eidSeq = getEventIdData(input, numberCode); input.readInt(&m_bucketId); input.read(&m_breadcrumbCounter); + return this; } const char* EventId::getMemId() const { return m_eidMem; } diff --git a/cppcache/src/EventId.hpp b/cppcache/src/EventId.hpp index 1f995a9..cae6bdd 100644 --- a/cppcache/src/EventId.hpp +++ b/cppcache/src/EventId.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_EVENTID_H_ +#define GEODE_EVENTID_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -15,11 +20,6 @@ * limitations under the License. */ -#pragma once - -#ifndef GEODE_EVENTID_H_ -#define GEODE_EVENTID_H_ - #include #include #include @@ -29,7 +29,7 @@ #include /** @file - */ +*/ namespace apache { namespace geode { @@ -65,7 +65,7 @@ class CPPCACHE_EXPORT EventId : public Cacheable { /** *@brief deserialize this object **/ - virtual void fromData(DataInput& input); + virtual Serializable* fromData(DataInput& input); virtual uint32_t objectSize() const { uint32_t objectSize = 0; @@ -149,7 +149,6 @@ class CPPCACHE_EXPORT EventId : public Cacheable { void operator=(const EventId& other); EventId(const EventId& other); }; - } // namespace client } // namespace geode } // namespace apache diff --git a/cppcache/src/FixedPartitionAttributesImpl.hpp b/cppcache/src/FixedPartitionAttributesImpl.hpp index a14bc87..7d2671e 100644 --- a/cppcache/src/FixedPartitionAttributesImpl.hpp +++ b/cppcache/src/FixedPartitionAttributesImpl.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_FIXEDPARTITIONATTRIBUTESIMPL_H_ +#define GEODE_FIXEDPARTITIONATTRIBUTESIMPL_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -15,11 +20,6 @@ * limitations under the License. */ -#pragma once - -#ifndef GEODE_FIXEDPARTITIONATTRIBUTESIMPL_H_ -#define GEODE_FIXEDPARTITIONATTRIBUTESIMPL_H_ - #include #include #include @@ -29,7 +29,6 @@ namespace apache { namespace geode { namespace client { - _GF_PTR_DEF_(FixedPartitionAttributesImpl, FixedPartitionAttributesImplPtr) class FixedPartitionAttributesImpl : public Serializable { @@ -67,11 +66,12 @@ class FixedPartitionAttributesImpl : public Serializable { output.writeInt(m_startingBucketId); } - void fromData(DataInput& input) { + FixedPartitionAttributesImpl* fromData(DataInput& input) { input.readNativeString(m_partitionName); input.readBoolean(&m_isPrimary); input.readInt((int32_t*)&m_numBuckets); input.readInt((int32_t*)&m_startingBucketId); + return this; } uint32_t objectSize() const { @@ -121,7 +121,6 @@ class FixedPartitionAttributesImpl : public Serializable { return getStartingBucketID() <= bucketId && bucketId <= getLastBucketID(); } }; - } // namespace client } // namespace geode } // namespace apache diff --git a/cppcache/src/GetAllServersRequest.hpp b/cppcache/src/GatewayEventCallbackArgument.hpp similarity index 51% copy from cppcache/src/GetAllServersRequest.hpp copy to cppcache/src/GatewayEventCallbackArgument.hpp index 77e4e02..8c465b5 100644 --- a/cppcache/src/GetAllServersRequest.hpp +++ b/cppcache/src/GatewayEventCallbackArgument.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_GATEWAYEVENTCALLBACKARGUMENT_H_ +#define GEODE_GATEWAYEVENTCALLBACKARGUMENT_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -15,44 +20,53 @@ * limitations under the License. */ -#pragma once - -#ifndef GEODE_GETALLSERVERSREQUEST_H_ -#define GEODE_GETALLSERVERSREQUEST_H_ - #include -#include -#include -#include #include "GeodeTypeIdsImpl.hpp" -#include namespace apache { namespace geode { namespace client { +class GatewayEventCallbackArgument : public Serializable { + SerializablePtr m_callback; -class GetAllServersRequest : public Serializable { - CacheableStringPtr m_serverGroup; - - public: - GetAllServersRequest(const std::string& serverGroup) : Serializable() { - m_serverGroup = CacheableString::create(serverGroup.c_str()); - } - virtual void toData(DataOutput& output) const; - virtual void fromData(DataInput& input); virtual int32_t classId() const { return 0; } + virtual int8_t typeId() const { - return GeodeTypeIdsImpl::GetAllServersRequest; + return static_cast(GeodeTypeIdsImpl::GatewayEventCallbackArgument); } + virtual int8_t DSFID() const { - return static_cast(GeodeTypeIdsImpl::FixedIDByte); + return static_cast(GeodeTypeIdsImpl::FixedIDByte); + } + + virtual uint32_t objectSize() const { return 0; } + + virtual void toData(DataOutput& output) const { + throw IllegalStateException( + "GatewayEventCallbackArgument::toData not implemented"); } - virtual uint32_t objectSize() const { return m_serverGroup->length(); } - virtual ~GetAllServersRequest() {} -}; + virtual Serializable* fromData(DataInput& input) { + input.readObject(m_callback); + CacheableStringPtr ignored; + // input.readObject(ignored);// Changed + input.readNativeString(ignored); + int32_t items; + input.readInt(&items); + for (int32_t item = 0; item < items; item++) { + // input.readObject(ignored);// Changed + input.readNativeString(ignored); + } + return m_callback.get(); + } + + public: + inline static Serializable* createDeserializable() { + return new GatewayEventCallbackArgument(); + } +}; } // namespace client } // namespace geode } // namespace apache -#endif // GEODE_GETALLSERVERSREQUEST_H_ +#endif // GEODE_GATEWAYEVENTCALLBACKARGUMENT_H_ diff --git a/cppcache/src/GatewaySenderEventCallbackArgument.hpp b/cppcache/src/GatewaySenderEventCallbackArgument.hpp new file mode 100644 index 0000000..d6a87d8 --- /dev/null +++ b/cppcache/src/GatewaySenderEventCallbackArgument.hpp @@ -0,0 +1,76 @@ +#pragma once + +#ifndef GEODE_GATEWAYSENDEREVENTCALLBACKARGUMENT_H_ +#define GEODE_GATEWAYSENDEREVENTCALLBACKARGUMENT_H_ + +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include "GeodeTypeIdsImpl.hpp" + +namespace apache { +namespace geode { +namespace client { +class GatewaySenderEventCallbackArgument : public Serializable { + SerializablePtr m_callback; + + virtual int32_t classId() const { + return static_cast( + GeodeTypeIdsImpl::GatewaySenderEventCallbackArgument); + ; + } + + virtual int8_t typeId() const { + throw IllegalStateException( + "GatewaySenderEventCallbackArgument::typeId not implemented use " + "classid"); + } + + virtual int8_t DSFID() const { + return static_cast(GeodeTypeIdsImpl::FixedIDShort); + } + + virtual uint32_t objectSize() const { return 0; } + + virtual void toData(DataOutput& output) const { + throw IllegalStateException( + "GatewaySenderEventCallbackArgument::toData not implemented"); + } + + virtual Serializable* fromData(DataInput& input) { + input.readObject(m_callback); + int ignoreInt; + input.readInt(&ignoreInt); + int32_t items; + input.readInt(&items); + for (int32_t item = 0; item < items; item++) { + input.readInt(&ignoreInt); + } + return m_callback.get(); + } + + public: + inline static Serializable* createDeserializable() { + return new GatewaySenderEventCallbackArgument(); + } +}; +} // namespace client +} // namespace geode +} // namespace apache + +#endif // GEODE_GATEWAYSENDEREVENTCALLBACKARGUMENT_H_ diff --git a/cppcache/src/GetAllServersRequest.cpp b/cppcache/src/GetAllServersRequest.cpp index b53edef..a849990 100644 --- a/cppcache/src/GetAllServersRequest.cpp +++ b/cppcache/src/GetAllServersRequest.cpp @@ -23,6 +23,7 @@ void GetAllServersRequest::toData(DataOutput& output) const { output.writeObject(m_serverGroup); } -void GetAllServersRequest::fromData(DataInput& input) { +Serializable* GetAllServersRequest::fromData(DataInput& input) { input.readObject(m_serverGroup); + return this; } diff --git a/cppcache/src/GetAllServersRequest.hpp b/cppcache/src/GetAllServersRequest.hpp index 77e4e02..f1d06cf 100644 --- a/cppcache/src/GetAllServersRequest.hpp +++ b/cppcache/src/GetAllServersRequest.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_GETALLSERVERSREQUEST_H_ +#define GEODE_GETALLSERVERSREQUEST_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -15,11 +20,6 @@ * limitations under the License. */ -#pragma once - -#ifndef GEODE_GETALLSERVERSREQUEST_H_ -#define GEODE_GETALLSERVERSREQUEST_H_ - #include #include #include @@ -30,7 +30,6 @@ namespace apache { namespace geode { namespace client { - class GetAllServersRequest : public Serializable { CacheableStringPtr m_serverGroup; @@ -39,7 +38,7 @@ class GetAllServersRequest : public Serializable { m_serverGroup = CacheableString::create(serverGroup.c_str()); } virtual void toData(DataOutput& output) const; - virtual void fromData(DataInput& input); + virtual Serializable* fromData(DataInput& input); virtual int32_t classId() const { return 0; } virtual int8_t typeId() const { return GeodeTypeIdsImpl::GetAllServersRequest; @@ -50,7 +49,6 @@ class GetAllServersRequest : public Serializable { virtual uint32_t objectSize() const { return m_serverGroup->length(); } virtual ~GetAllServersRequest() {} }; - } // namespace client } // namespace geode } // namespace apache diff --git a/cppcache/src/GetAllServersResponse.cpp b/cppcache/src/GetAllServersResponse.cpp index 4ee8ccd..86aa8d7 100644 --- a/cppcache/src/GetAllServersResponse.cpp +++ b/cppcache/src/GetAllServersResponse.cpp @@ -25,7 +25,7 @@ void GetAllServersResponse::toData(DataOutput& output) const { output.writeObject(&m_servers.at(i)); } } -void GetAllServersResponse::fromData(DataInput& input) { +Serializable* GetAllServersResponse::fromData(DataInput& input) { int length = 0; input.readInt(&length); @@ -35,4 +35,5 @@ void GetAllServersResponse::fromData(DataInput& input) { sLoc.fromData(input); m_servers.push_back(sLoc); } + return this; } diff --git a/cppcache/src/GetAllServersResponse.hpp b/cppcache/src/GetAllServersResponse.hpp index 707dbfb..b467eff 100644 --- a/cppcache/src/GetAllServersResponse.hpp +++ b/cppcache/src/GetAllServersResponse.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_GETALLSERVERSRESPONSE_H_ +#define GEODE_GETALLSERVERSRESPONSE_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -15,11 +20,6 @@ * limitations under the License. */ -#pragma once - -#ifndef GEODE_GETALLSERVERSRESPONSE_H_ -#define GEODE_GETALLSERVERSRESPONSE_H_ - #include #include "ServerLocation.hpp" #include @@ -29,7 +29,6 @@ namespace apache { namespace geode { namespace client { - class GetAllServersResponse : public Serializable { std::vector m_servers; @@ -37,7 +36,7 @@ class GetAllServersResponse : public Serializable { static Serializable* create() { return new GetAllServersResponse(); } GetAllServersResponse() : Serializable() {} virtual void toData(DataOutput& output) const; - virtual void fromData(DataInput& input); + virtual Serializable* fromData(DataInput& input); virtual int32_t classId() const { return 0; } virtual int8_t typeId() const { return GeodeTypeIdsImpl::GetAllServersResponse; @@ -52,7 +51,6 @@ class GetAllServersResponse : public Serializable { virtual ~GetAllServersResponse() {} }; typedef std::shared_ptr GetAllServersResponsePtr; - } // namespace client } // namespace geode } // namespace apache diff --git a/cppcache/src/LocatorListRequest.cpp b/cppcache/src/LocatorListRequest.cpp index 753f074..f745b71 100644 --- a/cppcache/src/LocatorListRequest.cpp +++ b/cppcache/src/LocatorListRequest.cpp @@ -19,19 +19,17 @@ #include #include "GeodeTypeIdsImpl.hpp" #include - using namespace apache::geode::client; - LocatorListRequest::LocatorListRequest(const std::string& servergroup) : m_servergroup(servergroup) {} void LocatorListRequest::toData(DataOutput& output) const { + // CacheableStringPtr pxr = CacheableString::create( m_servergroup.c_str()); + // output.writeObject(pxr);// changed output.writeNativeString(m_servergroup.c_str()); } -void LocatorListRequest::fromData(DataInput& input) {} - +Serializable* LocatorListRequest::fromData(DataInput& input) { return nullptr; } int8_t LocatorListRequest::typeId() const { return static_cast(GeodeTypeIdsImpl::LocatorListRequest); } - uint32_t LocatorListRequest::objectSize() const { return 0; } diff --git a/cppcache/src/LocatorListRequest.hpp b/cppcache/src/LocatorListRequest.hpp index 0db77cd..ea444d5 100644 --- a/cppcache/src/LocatorListRequest.hpp +++ b/cppcache/src/LocatorListRequest.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_LOCATORLISTREQUEST_H_ +#define GEODE_LOCATORLISTREQUEST_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -14,20 +19,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -#pragma once - -#ifndef GEODE_LOCATORLISTREQUEST_H_ -#define GEODE_LOCATORLISTREQUEST_H_ - #include #include "ServerLocationRequest.hpp" #include "GeodeTypeIdsImpl.hpp" - namespace apache { namespace geode { namespace client { - class DataOutput; class DataInput; class Serializable; @@ -38,11 +35,10 @@ class LocatorListRequest : public ServerLocationRequest { public: LocatorListRequest(const std::string& servergroup = ""); virtual void toData(DataOutput& output) const; - virtual void fromData(DataInput& input); + virtual Serializable* fromData(DataInput& input); virtual int8_t typeId() const; virtual uint32_t objectSize() const; }; - } // namespace client } // namespace geode } // namespace apache diff --git a/cppcache/src/LocatorListResponse.cpp b/cppcache/src/LocatorListResponse.cpp index adeb97c..e5260dd 100644 --- a/cppcache/src/LocatorListResponse.cpp +++ b/cppcache/src/LocatorListResponse.cpp @@ -14,24 +14,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - #include "LocatorListResponse.hpp" #include #include - using namespace apache::geode::client; - -void LocatorListResponse::fromData(DataInput& input) { +LocatorListResponse* LocatorListResponse::fromData(DataInput& input) { readList(input); input.readBoolean(&m_isBalanced); + return this; } - int8_t LocatorListResponse::typeId() const { return static_cast(GeodeTypeIdsImpl::LocatorListResponse); } - uint32_t LocatorListResponse::objectSize() const { return 0; } - void LocatorListResponse::readList(DataInput& input) { uint32_t size = 0; input.readInt(&size); @@ -41,11 +36,9 @@ void LocatorListResponse::readList(DataInput& input) { m_locators.push_back(temp); } } - const std::vector& LocatorListResponse::getLocators() const { return m_locators; } - bool LocatorListResponse::isBalanced() const { return m_isBalanced; } Serializable* LocatorListResponse::create() { diff --git a/cppcache/src/LocatorListResponse.hpp b/cppcache/src/LocatorListResponse.hpp index eeab3c6..8b7b6fa 100644 --- a/cppcache/src/LocatorListResponse.hpp +++ b/cppcache/src/LocatorListResponse.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_LOCATORLISTRESPONSE_H_ +#define GEODE_LOCATORLISTRESPONSE_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -14,21 +19,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -#pragma once - -#ifndef GEODE_LOCATORLISTRESPONSE_H_ -#define GEODE_LOCATORLISTRESPONSE_H_ - #include #include "GeodeTypeIdsImpl.hpp" #include "ServerLocationResponse.hpp" #include "ServerLocation.hpp" - namespace apache { namespace geode { namespace client { - class DataInput; class LocatorListResponse : public ServerLocationResponse { private: @@ -42,7 +39,7 @@ class LocatorListResponse : public ServerLocationResponse { * CID 28938: Uninitialized scalar field (UNINIT_CTOR) * */ m_isBalanced(false) {} // Default constru needed for de-serialization - virtual void fromData(DataInput& input); + virtual LocatorListResponse* fromData(DataInput& input); virtual int8_t typeId() const; virtual uint32_t objectSize() const; const std::vector& getLocators() const; @@ -51,7 +48,6 @@ class LocatorListResponse : public ServerLocationResponse { static Serializable* create(); }; typedef std::shared_ptr LocatorListResponsePtr; - } // namespace client } // namespace geode } // namespace apache diff --git a/cppcache/src/CacheableUndefined.cpp b/cppcache/src/PdxEnumInstantiator.cpp similarity index 54% copy from cppcache/src/CacheableUndefined.cpp copy to cppcache/src/PdxEnumInstantiator.cpp index d7fd1ee..8584186 100644 --- a/cppcache/src/CacheableUndefined.cpp +++ b/cppcache/src/PdxEnumInstantiator.cpp @@ -14,31 +14,41 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include -#include +/* +* PdxEnumInstantiator.cpp +*/ + +#include "PdxEnumInstantiator.hpp" +#include "GeodeTypeIdsImpl.hpp" +#include #include -#include -#include namespace apache { namespace geode { namespace client { -void CacheableUndefined::toData(DataOutput& output) const {} +PdxEnumInstantiator::PdxEnumInstantiator() {} -void CacheableUndefined::fromData(DataInput& input) {} +PdxEnumInstantiator::~PdxEnumInstantiator() {} -int32_t CacheableUndefined::classId() const { return 0; } +int8_t PdxEnumInstantiator::typeId() const { + return static_cast(GeodeTypeIds::CacheableEnum); +} -int8_t CacheableUndefined::typeId() const { - return GeodeTypeIds::CacheableUndefined; +void PdxEnumInstantiator::toData(DataOutput& output) const { + throw UnsupportedOperationException( + "operation PdxEnumInstantiator::toData() is not supported "); } -int8_t CacheableUndefined::DSFID() const { - return GeodeTypeIdsImpl::FixedIDByte; +Serializable* PdxEnumInstantiator::fromData(DataInput& input) { + m_enumObject = CacheableEnum::create(" ", " ", 0); + m_enumObject->fromData(input); + return m_enumObject.get(); } -uint32_t CacheableUndefined::objectSize() const { return 0; } +CacheableStringPtr PdxEnumInstantiator::toString() const { + return CacheableString::create("PdxEnumInstantiator"); +} } // namespace client } // namespace geode } // namespace apache diff --git a/cppcache/src/LocatorListRequest.hpp b/cppcache/src/PdxEnumInstantiator.hpp similarity index 65% copy from cppcache/src/LocatorListRequest.hpp copy to cppcache/src/PdxEnumInstantiator.hpp index 0db77cd..1d60c9b 100644 --- a/cppcache/src/LocatorListRequest.hpp +++ b/cppcache/src/PdxEnumInstantiator.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_PDXENUMINSTANTIATOR_H_ +#define GEODE_PDXENUMINSTANTIATOR_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -15,36 +20,38 @@ * limitations under the License. */ -#pragma once - -#ifndef GEODE_LOCATORLISTREQUEST_H_ -#define GEODE_LOCATORLISTREQUEST_H_ - -#include -#include "ServerLocationRequest.hpp" -#include "GeodeTypeIdsImpl.hpp" +#include +#include namespace apache { namespace geode { namespace client { -class DataOutput; -class DataInput; -class Serializable; -class LocatorListRequest : public ServerLocationRequest { +class PdxEnumInstantiator : public Serializable { private: - std::string m_servergroup; + CacheableEnumPtr m_enumObject; public: - LocatorListRequest(const std::string& servergroup = ""); - virtual void toData(DataOutput& output) const; - virtual void fromData(DataInput& input); + PdxEnumInstantiator(); + + virtual ~PdxEnumInstantiator(); + + static Serializable* createDeserializable() { + return new PdxEnumInstantiator(); + } + virtual int8_t typeId() const; - virtual uint32_t objectSize() const; -}; + virtual void toData(DataOutput& output) const; + + virtual Serializable* fromData(DataInput& input); + + virtual int32_t classId() const { return 0; } + + CacheableStringPtr toString() const; +}; } // namespace client } // namespace geode } // namespace apache -#endif // GEODE_LOCATORLISTREQUEST_H_ +#endif // GEODE_PDXENUMINSTANTIATOR_H_ diff --git a/cppcache/src/PdxFieldType.cpp b/cppcache/src/PdxFieldType.cpp index e8a074a..09225d4 100644 --- a/cppcache/src/PdxFieldType.cpp +++ b/cppcache/src/PdxFieldType.cpp @@ -78,7 +78,7 @@ void PdxFieldType::toData(DataOutput& output) const { output.writeBoolean(m_isIdentityField); } -void PdxFieldType::fromData(DataInput& input) { +Serializable* PdxFieldType::fromData(DataInput& input) { int8_t typeId; input.read(&typeId); char* fname = nullptr; @@ -98,6 +98,7 @@ void PdxFieldType::fromData(DataInput& input) { } else { m_isVariableLengthType = true; } + return this; } bool PdxFieldType::equals(PdxFieldTypePtr otherObj) { diff --git a/cppcache/src/PdxFieldType.hpp b/cppcache/src/PdxFieldType.hpp index 3c52c64..87ec5ed 100644 --- a/cppcache/src/PdxFieldType.hpp +++ b/cppcache/src/PdxFieldType.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_PDXFIELDTYPE_H_ +#define GEODE_PDXFIELDTYPE_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -15,11 +20,6 @@ * limitations under the License. */ -#pragma once - -#ifndef GEODE_PDXFIELDTYPE_H_ -#define GEODE_PDXFIELDTYPE_H_ - #include #include #include @@ -30,10 +30,8 @@ namespace apache { namespace geode { namespace client { - class PdxFieldType; typedef std::shared_ptr PdxFieldTypePtr; - class CPPCACHE_EXPORT PdxFieldType : public Serializable { private: std::string m_fieldName; @@ -85,7 +83,7 @@ class CPPCACHE_EXPORT PdxFieldType : public Serializable { virtual void toData(DataOutput& output) const; - virtual void fromData(DataInput& input); + virtual Serializable* fromData(DataInput& input); virtual int32_t classId() const { return m_typeId; } @@ -106,7 +104,6 @@ class CPPCACHE_EXPORT PdxFieldType : public Serializable { int32_t getRelativeOffset() const { return m_relativeOffset; } }; - } // namespace client } // namespace geode } // namespace apache diff --git a/cppcache/src/PdxInstanceImpl.hpp b/cppcache/src/PdxInstanceImpl.hpp index 0ca4ef0..795eada 100644 --- a/cppcache/src/PdxInstanceImpl.hpp +++ b/cppcache/src/PdxInstanceImpl.hpp @@ -959,7 +959,7 @@ class CPPCACHE_EXPORT PdxInstanceImpl : public WritablePdxInstance { * @brief deserialize this object, typical implementation should return * the 'this' pointer. This is an internal method. */ - virtual void fromData(DataInput& input) { + virtual Serializable* fromData(DataInput& input) { return PdxInstance::fromData(input); } diff --git a/cppcache/src/PdxSerializable.cpp b/cppcache/src/PdxInstantiator.cpp similarity index 54% copy from cppcache/src/PdxSerializable.cpp copy to cppcache/src/PdxInstantiator.cpp index 0efba08..e4a5958 100644 --- a/cppcache/src/PdxSerializable.cpp +++ b/cppcache/src/PdxInstantiator.cpp @@ -15,51 +15,43 @@ * limitations under the License. */ /* - * PdxSerializable.cpp + * PdxInstantiator.cpp * - * Created on: Sep 29, 2011 + * Created on: Dec 28, 2011 * Author: npatel */ -#include -#include +#include "PdxInstantiator.hpp" +#include "GeodeTypeIdsImpl.hpp" #include -#include -#include +#include +#include "PdxHelper.hpp" +#include namespace apache { namespace geode { namespace client { -PdxSerializable::PdxSerializable() {} -PdxSerializable::~PdxSerializable() {} +PdxInstantiator::PdxInstantiator() {} -int8_t PdxSerializable::typeId() const { - return static_cast(GeodeTypeIdsImpl::PDX); -} +PdxInstantiator::~PdxInstantiator() {} -void PdxSerializable::toData(DataOutput& output) const { - LOGDEBUG("SerRegistry.cpp:serializePdx:86: PDX Object Type = %s", - typeid(*this).name()); - PdxHelper::serializePdx(output, *this); +int8_t PdxInstantiator::typeId() const { + return static_cast(GeodeTypeIdsImpl::PDX); } -void PdxSerializable::fromData(DataInput& input) { +void PdxInstantiator::toData(DataOutput& output) const { throw UnsupportedOperationException( - "operation PdxSerializable::fromData() is not supported "); -} - -CacheableStringPtr PdxSerializable::toString() const { - return CacheableString::create("PdxSerializable"); + "operation PdxInstantiator::toData() is not supported "); } -bool PdxSerializable::operator==(const CacheableKey& other) const { - return (this == &other); +Serializable* PdxInstantiator::fromData(DataInput& input) { + m_userObject = PdxHelper::deserializePdx(input, false); + return m_userObject.get(); } -int32_t PdxSerializable::hashcode() const { - uint64_t hash = static_cast((intptr_t)this); - return apache::geode::client::serializer::hashcode(hash); +CacheableStringPtr PdxInstantiator::toString() const { + return CacheableString::create("PdxInstantiator"); } } // namespace client } // namespace geode diff --git a/cppcache/src/LocatorListRequest.hpp b/cppcache/src/PdxInstantiator.hpp similarity index 67% copy from cppcache/src/LocatorListRequest.hpp copy to cppcache/src/PdxInstantiator.hpp index 0db77cd..3c01088 100644 --- a/cppcache/src/LocatorListRequest.hpp +++ b/cppcache/src/PdxInstantiator.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_PDXINSTANTIATOR_H_ +#define GEODE_PDXINSTANTIATOR_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -15,36 +20,35 @@ * limitations under the License. */ -#pragma once - -#ifndef GEODE_LOCATORLISTREQUEST_H_ -#define GEODE_LOCATORLISTREQUEST_H_ - -#include -#include "ServerLocationRequest.hpp" -#include "GeodeTypeIdsImpl.hpp" +#include namespace apache { namespace geode { namespace client { -class DataOutput; -class DataInput; -class Serializable; -class LocatorListRequest : public ServerLocationRequest { +class PdxInstantiator : public Serializable { private: - std::string m_servergroup; + PdxSerializablePtr m_userObject; public: - LocatorListRequest(const std::string& servergroup = ""); - virtual void toData(DataOutput& output) const; - virtual void fromData(DataInput& input); + PdxInstantiator(); + + virtual ~PdxInstantiator(); + + static Serializable* createDeserializable() { return new PdxInstantiator(); } + virtual int8_t typeId() const; - virtual uint32_t objectSize() const; -}; + virtual void toData(DataOutput& output) const; + + virtual Serializable* fromData(DataInput& input); + + virtual int32_t classId() const { return 0x10; } + + CacheableStringPtr toString() const; +}; } // namespace client } // namespace geode } // namespace apache -#endif // GEODE_LOCATORLISTREQUEST_H_ +#endif // GEODE_PDXINSTANTIATOR_H_ diff --git a/cppcache/src/PdxSerializable.cpp b/cppcache/src/PdxSerializable.cpp index 0efba08..fcb833e 100644 --- a/cppcache/src/PdxSerializable.cpp +++ b/cppcache/src/PdxSerializable.cpp @@ -44,7 +44,7 @@ void PdxSerializable::toData(DataOutput& output) const { PdxHelper::serializePdx(output, *this); } -void PdxSerializable::fromData(DataInput& input) { +Serializable* PdxSerializable::fromData(DataInput& input) { throw UnsupportedOperationException( "operation PdxSerializable::fromData() is not supported "); } diff --git a/cppcache/src/PdxType.cpp b/cppcache/src/PdxType.cpp index 4d66e66..50bfa38 100644 --- a/cppcache/src/PdxType.cpp +++ b/cppcache/src/PdxType.cpp @@ -43,10 +43,9 @@ PdxType::~PdxType() { GF_SAFE_DELETE_ARRAY(m_className); } -// PdxType::PdxType() : PdxType(nullptr, false) {} +//PdxType::PdxType() : PdxType(nullptr, false) {} -PdxType::PdxType(PdxTypeRegistryPtr pdxTypeRegistryPtr, - const char* pdxDomainClassName, bool isLocal) +PdxType::PdxType(PdxTypeRegistryPtr pdxTypeRegistryPtr, const char* pdxDomainClassName, bool isLocal) : Serializable(), m_className(Utils::copyString(pdxDomainClassName)), m_isLocal(isLocal), @@ -89,7 +88,7 @@ void PdxType::toData(DataOutput& output) const { } } -void PdxType::fromData(DataInput& input) { +Serializable* PdxType::fromData(DataInput& input) { int8_t dsByte; input.read(&dsByte); @@ -132,6 +131,7 @@ void PdxType::fromData(DataInput& input) { } InitializeType(); + return this; } void PdxType::addFixedLengthTypeField(const char* fieldName, @@ -447,8 +447,7 @@ PdxTypePtr PdxType::isContains(PdxTypePtr first, PdxTypePtr second) { } PdxTypePtr PdxType::clone() { - auto clone = - std::make_shared(m_pdxTypeRegistryPtr, m_className, false); + auto clone = std::make_shared(m_pdxTypeRegistryPtr, m_className, false); clone->m_geodeTypeId = 0; clone->m_numberOfVarLenFields = m_numberOfVarLenFields; @@ -599,6 +598,7 @@ bool PdxType::operator<(const PdxType& other) const { return ACE_OS::strcmp(this->m_className, other.m_className) < 0; } + } // namespace client } // namespace geode } // namespace apache diff --git a/cppcache/src/PdxType.hpp b/cppcache/src/PdxType.hpp index 99e056f..5b094b4 100644 --- a/cppcache/src/PdxType.hpp +++ b/cppcache/src/PdxType.hpp @@ -41,7 +41,7 @@ typedef std::map NameVsPdxType; class PdxType; typedef std::shared_ptr PdxTypePtr; class PdxTypeRegistry; -typedef std::shared_ptr PdxTypeRegistryPtr; +typedef std::shared_ptr PdxTypeRegistryPtr; class PdxType : public Serializable, private NonCopyable, @@ -100,21 +100,18 @@ class PdxType : public Serializable, } public: - PdxType(PdxTypeRegistryPtr pdxTypeRegistryPtr, const char* pdxDomainClassName, - bool isLocal); + + PdxType(PdxTypeRegistryPtr pdxTypeRegistryPtr, const char* pdxDomainClassName, bool isLocal); virtual ~PdxType(); virtual void toData(DataOutput& output) const; - virtual void fromData(DataInput& input); + virtual Serializable* fromData(DataInput& input); virtual int32_t classId() const { return GeodeTypeIds::PdxType; } - static Serializable* CreateDeserializable( - PdxTypeRegistryPtr pdxTypeRegistryPtr) { - return new PdxType(pdxTypeRegistryPtr, nullptr, false); - } + static Serializable* CreateDeserializable(PdxTypeRegistryPtr pdxTypeRegistryPtr) { return new PdxType(pdxTypeRegistryPtr, nullptr, false); } virtual uint32_t objectSize() const { uint32_t size = sizeof(PdxType); diff --git a/cppcache/src/PdxWrapper.cpp b/cppcache/src/PdxWrapper.cpp index a27b28b..1c73947 100644 --- a/cppcache/src/PdxWrapper.cpp +++ b/cppcache/src/PdxWrapper.cpp @@ -144,7 +144,7 @@ void PdxWrapper::toData(DataOutput &output) const { PdxHelper::serializePdx(output, *this); } -void PdxWrapper::fromData(DataInput &input) { +Serializable *PdxWrapper::fromData(DataInput &input) { LOGERROR("PdxWrapper fromData should not have been called"); throw IllegalStateException( "PdxWrapper fromData should not have been called"); diff --git a/cppcache/src/Properties.cpp b/cppcache/src/Properties.cpp index 0e2d178..8bf09d6 100644 --- a/cppcache/src/Properties.cpp +++ b/cppcache/src/Properties.cpp @@ -14,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - #include #include @@ -26,6 +25,8 @@ #include "ace/Versioned_Namespace.h" #include +using namespace apache::geode::client; + ACE_BEGIN_VERSIONED_NAMESPACE_DECL template <> @@ -307,7 +308,7 @@ void Properties::toData(DataOutput& output) const { } } -void Properties::fromData(DataInput& input) { +Serializable* Properties::fromData(DataInput& input) { int32_t mapSize = 0; input.readArrayLen(&mapSize); for (int i = 0; i < mapSize; i++) { @@ -332,8 +333,8 @@ void Properties::fromData(DataInput& input) { } } } + return this; } - } // namespace client } // namespace geode } // namespace apache diff --git a/cppcache/src/PutAllPartialResult.hpp b/cppcache/src/PutAllPartialResult.hpp index 1bdf4e8..f0ad50f 100644 --- a/cppcache/src/PutAllPartialResult.hpp +++ b/cppcache/src/PutAllPartialResult.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_PUTALLPARTIALRESULT_H_ +#define GEODE_PUTALLPARTIALRESULT_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -15,11 +20,6 @@ * limitations under the License. */ -#pragma once - -#ifndef GEODE_PUTALLPARTIALRESULT_H_ -#define GEODE_PUTALLPARTIALRESULT_H_ - #include #include #include "VersionedCacheableObjectPartList.hpp" @@ -28,7 +28,6 @@ namespace apache { namespace geode { namespace client { - class PutAllPartialResult; typedef std::shared_ptr PutAllPartialResultPtr; @@ -114,9 +113,10 @@ class PutAllPartialResult : public Serializable { "PutAllPartialResult::toData is not intended for use."); } - void fromData(DataInput& input) { + Serializable* fromData(DataInput& input) { throw IllegalStateException( "PutAllPartialResult::fromData is not intended for use."); + return nullptr; } int32_t classId() const { @@ -133,7 +133,6 @@ class PutAllPartialResult : public Serializable { int8_t typeId() const { return static_cast(0); } }; - } // namespace client } // namespace geode } // namespace apache diff --git a/cppcache/src/PutAllPartialResultServerException.cpp b/cppcache/src/PutAllPartialResultServerException.cpp index d9858d9..6588bff 100644 --- a/cppcache/src/PutAllPartialResultServerException.cpp +++ b/cppcache/src/PutAllPartialResultServerException.cpp @@ -14,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - #include "PutAllPartialResultServerException.hpp" namespace apache { @@ -73,9 +72,10 @@ void PutAllPartialResultServerException::toData(DataOutput& output) const { "PutAllPartialResultServerException::toData is not intended for use."); } -void PutAllPartialResultServerException::fromData(DataInput& input) { +Serializable* PutAllPartialResultServerException::fromData(DataInput& input) { throw IllegalStateException( "PutAllPartialResultServerException::fromData is not intended for use."); + return nullptr; } int32_t PutAllPartialResultServerException::classId() const { @@ -98,7 +98,6 @@ int8_t PutAllPartialResultServerException::typeId() const { PutAllPartialResultServerException::PutAllPartialResultServerException( CacheableStringPtr msg) : m_message(msg) {} - } // namespace client } // namespace geode } // namespace apache diff --git a/cppcache/src/PutAllPartialResultServerException.hpp b/cppcache/src/PutAllPartialResultServerException.hpp index 793881a..1457408 100644 --- a/cppcache/src/PutAllPartialResultServerException.hpp +++ b/cppcache/src/PutAllPartialResultServerException.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_PUTALLPARTIALRESULTSERVEREXCEPTION_H_ +#define GEODE_PUTALLPARTIALRESULTSERVEREXCEPTION_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -15,11 +20,6 @@ * limitations under the License. */ -#pragma once - -#ifndef GEODE_PUTALLPARTIALRESULTSERVEREXCEPTION_H_ -#define GEODE_PUTALLPARTIALRESULTSERVEREXCEPTION_H_ - #include #include #include "VersionedCacheableObjectPartList.hpp" @@ -88,7 +88,7 @@ class CPPCACHE_EXPORT PutAllPartialResultServerException : public Serializable { * the 'this' pointer. * @throws IllegalStateException If this api is called from User code. **/ - virtual void fromData(DataInput& input); + virtual Serializable* fromData(DataInput& input); /** *@brief Return the classId of the instance being serialized. @@ -141,7 +141,6 @@ class CPPCACHE_EXPORT PutAllPartialResultServerException : public Serializable { CacheableStringPtr m_message; // error message PutAllPartialResultPtr m_result; }; - } // namespace client } // namespace geode } // namespace apache diff --git a/cppcache/src/QueueConnectionRequest.cpp b/cppcache/src/QueueConnectionRequest.cpp index 0b8c28e..d2e2ddc 100644 --- a/cppcache/src/QueueConnectionRequest.cpp +++ b/cppcache/src/QueueConnectionRequest.cpp @@ -14,12 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - #include "QueueConnectionRequest.hpp" #include "GeodeTypeIdsImpl.hpp" #include #include - using namespace apache::geode::client; void QueueConnectionRequest::toData(DataOutput& output) const { @@ -36,21 +34,20 @@ void QueueConnectionRequest::toData(DataOutput& output) const { writeSetOfServerLocation(output); output.writeBoolean(m_findDurable); } - -void QueueConnectionRequest::fromData(DataInput& input) {} - +QueueConnectionRequest* QueueConnectionRequest::fromData( + DataInput& input) // NOt needed as of now. +{ + return nullptr; +} int8_t QueueConnectionRequest::typeId() const { return static_cast(GeodeTypeIdsImpl::QueueConnectionRequest); } - uint32_t QueueConnectionRequest::objectSize() const { return 0; // will implement later. } - std::set QueueConnectionRequest::getExcludedServer() const { return m_excludedServers; } - const ClientProxyMembershipID& QueueConnectionRequest::getProxyMemberShipId() const { return m_membershipID; @@ -59,9 +56,7 @@ const ClientProxyMembershipID& QueueConnectionRequest::getProxyMemberShipId() int QueueConnectionRequest::getRedundentCopies() const { return m_redundantCopies; } - bool QueueConnectionRequest::isFindDurable() const { return m_findDurable; } - void QueueConnectionRequest::writeSetOfServerLocation( DataOutput& output) const { output.writeInt(static_cast(m_excludedServers.size())); diff --git a/cppcache/src/QueueConnectionRequest.hpp b/cppcache/src/QueueConnectionRequest.hpp index 5e18223..138c699 100644 --- a/cppcache/src/QueueConnectionRequest.hpp +++ b/cppcache/src/QueueConnectionRequest.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_QUEUECONNECTIONREQUEST_H_ +#define GEODE_QUEUECONNECTIONREQUEST_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -14,22 +19,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -#pragma once - -#ifndef GEODE_QUEUECONNECTIONREQUEST_H_ -#define GEODE_QUEUECONNECTIONREQUEST_H_ - #include "ServerLocationRequest.hpp" #include "ServerLocation.hpp" #include "ClientProxyMembershipID.hpp" #include #include - namespace apache { namespace geode { namespace client { - class QueueConnectionRequest : public ServerLocationRequest { public: QueueConnectionRequest(const ClientProxyMembershipID& memId, @@ -44,7 +41,7 @@ class QueueConnectionRequest : public ServerLocationRequest { m_serverGp(serverGp) {} // No need for default constructor as creating // request with it does not make sense. virtual void toData(DataOutput& output) const; - virtual void fromData(DataInput& input); + virtual QueueConnectionRequest* fromData(DataInput& input); virtual int8_t typeId() const; virtual uint32_t objectSize() const; virtual std::set getExcludedServer() const; @@ -63,7 +60,6 @@ class QueueConnectionRequest : public ServerLocationRequest { const bool m_findDurable; std::string m_serverGp; }; - } // namespace client } // namespace geode } // namespace apache diff --git a/cppcache/src/QueueConnectionResponse.cpp b/cppcache/src/QueueConnectionResponse.cpp index 2ff9066..3b02ef3 100644 --- a/cppcache/src/QueueConnectionResponse.cpp +++ b/cppcache/src/QueueConnectionResponse.cpp @@ -19,14 +19,12 @@ #include "GeodeTypeIdsImpl.hpp" #include #include "ServerLocation.hpp" - using namespace apache::geode::client; - -void QueueConnectionResponse::fromData(DataInput& input) { +QueueConnectionResponse* QueueConnectionResponse::fromData(DataInput& input) { input.readBoolean(&m_durableQueueFound); readList(input); + return this; } - int8_t QueueConnectionResponse::typeId() const { return static_cast(GeodeTypeIdsImpl::QueueConnectionResponse); } diff --git a/cppcache/src/QueueConnectionResponse.hpp b/cppcache/src/QueueConnectionResponse.hpp index cf04e4f..4023c18 100644 --- a/cppcache/src/QueueConnectionResponse.hpp +++ b/cppcache/src/QueueConnectionResponse.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_QUEUECONNECTIONRESPONSE_H_ +#define GEODE_QUEUECONNECTIONRESPONSE_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -14,12 +19,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -#pragma once - -#ifndef GEODE_QUEUECONNECTIONRESPONSE_H_ -#define GEODE_QUEUECONNECTIONRESPONSE_H_ - #include #include "ServerLocationResponse.hpp" #include @@ -27,12 +26,15 @@ namespace apache { namespace geode { namespace client { - class QueueConnectionResponse : public ServerLocationResponse { public: QueueConnectionResponse() - : ServerLocationResponse(), m_durableQueueFound(false) {} - virtual void fromData(DataInput& input); + : ServerLocationResponse(), + /* adongre + * CID 28940: Uninitialized scalar field (UNINIT_CTOR) * + */ + m_durableQueueFound(false) {} + virtual QueueConnectionResponse* fromData(DataInput& input); virtual int8_t typeId() const; virtual uint32_t objectSize() const; virtual std::list getServers() { return m_list; } @@ -47,7 +49,6 @@ class QueueConnectionResponse : public ServerLocationResponse { bool m_durableQueueFound; }; typedef std::shared_ptr QueueConnectionResponsePtr; - } // namespace client } // namespace geode } // namespace apache diff --git a/cppcache/src/RegionAttributes.cpp b/cppcache/src/RegionAttributes.cpp index 0e2f66e..256dc89 100644 --- a/cppcache/src/RegionAttributes.cpp +++ b/cppcache/src/RegionAttributes.cpp @@ -513,7 +513,7 @@ void RegionAttributes::toData(DataOutput& out) const { apache::geode::client::impl::writeBool(out, m_isConcurrencyChecksEnabled); } -void RegionAttributes::fromData(DataInput& in) { +Serializable* RegionAttributes::fromData(DataInput& in) { in.readInt(reinterpret_cast(&m_regionTimeToLive)); in.readInt(reinterpret_cast(&m_regionTimeToLiveExpirationAction)); in.readInt(reinterpret_cast(&m_regionIdleTimeout)); @@ -547,6 +547,8 @@ void RegionAttributes::fromData(DataInput& in) { in.readObject(m_persistenceProperties, true); apache::geode::client::impl::readCharStar(in, &m_poolName); apache::geode::client::impl::readBool(in, &m_isConcurrencyChecksEnabled); + + return this; } /** Return true if all the attributes are equal to those of other. */ diff --git a/cppcache/src/SerializationRegistry.cpp b/cppcache/src/SerializationRegistry.cpp index c2fd153..4f308b4 100644 --- a/cppcache/src/SerializationRegistry.cpp +++ b/cppcache/src/SerializationRegistry.cpp @@ -38,6 +38,8 @@ #include "ClientConnectionResponse.hpp" #include "QueueConnectionResponse.hpp" #include "LocatorListResponse.hpp" +#include "GatewayEventCallbackArgument.hpp" +#include "GatewaySenderEventCallbackArgument.hpp" #include "ClientProxyMembershipID.hpp" #include #include @@ -51,10 +53,9 @@ #include "VersionTag.hpp" #include "DiskStoreId.hpp" #include "DiskVersionTag.hpp" +#include "CachedDeserializableHelper.hpp" #include #include -#include "PdxHelper.hpp" -#include namespace apache { namespace geode { @@ -108,10 +109,15 @@ void TheTypeMap::setup() { bind2(QueueConnectionResponse::create); bind2(LocatorListResponse::create); bind2(ClientProxyMembershipID::createDeserializable); + bind2(GatewayEventCallbackArgument::createDeserializable); + bind2(GatewaySenderEventCallbackArgument::createDeserializable); bind2(GetAllServersResponse::create); bind2(EnumInfo::createDeserializable); rebind2(GeodeTypeIdsImpl::DiskStoreId, DiskStoreId::createDeserializable); + + bind2(CachedDeserializableHelper::createForVmCachedDeserializable); + bind2(CachedDeserializableHelper::createForPreferBytesDeserializable); } /** This starts at reading the typeid.. assumes the length has been read. */ @@ -125,95 +131,73 @@ SerializablePtr SerializationRegistry::deserialize(DataInput& input, LOGDEBUG("SerializationRegistry::deserialize typeid = %d currentTypeId= %d ", typeId, currentTypeId); - - switch (compId) { - case GeodeTypeIds::NullObj: { - return nullptr; - break; - } - case GeodeTypeIds::CacheableNullString: { - return SerializablePtr(CacheableString::createDeserializable()); - break; - } - case GeodeTypeIdsImpl::PDX: { - return PdxHelper::deserializePdx(input, false); - break; - } - case GeodeTypeIds::CacheableEnum: { - auto enumObject = CacheableEnum::create(" ", " ", 0); - enumObject->fromData(input); - return enumObject; - break; - } - case GeodeTypeIdsImpl::CacheableUserData: { - int8_t classId = 0; - input.read(&classId); - compId |= ((static_cast(classId)) << 32); - break; - } - case GeodeTypeIdsImpl::CacheableUserData2: { - int16_t classId = 0; - input.readInt(&classId); - compId |= ((static_cast(classId)) << 32); - break; - } - case GeodeTypeIdsImpl::CacheableUserData4: { - int32_t classId = 0; - input.readInt(&classId); - compId |= ((static_cast(classId)) << 32); - break; - } - case GeodeTypeIdsImpl::FixedIDByte: { - int8_t fixedId; - input.read(&fixedId); - compId = fixedId; - findinternal = true; - break; - } - case GeodeTypeIdsImpl::FixedIDShort: { - int16_t fixedId; - input.readInt(&fixedId); - compId = fixedId; - findinternal = true; - break; - } - case GeodeTypeIdsImpl::FixedIDInt: { - int32_t fixedId; - input.readInt(&fixedId); - compId = fixedId; - findinternal = true; - break; - } + if (compId == GeodeTypeIds::NullObj) { + return nullptr; + } else if (compId == GeodeTypeIds::CacheableNullString) { + return SerializablePtr(CacheableString::createDeserializable()); + } else if (compId == GeodeTypeIdsImpl::CacheableUserData) { + int8_t classId = 0; + input.read(&classId); + compId |= ((static_cast(classId)) << 32); + } else if (compId == GeodeTypeIdsImpl::CacheableUserData2) { + int16_t classId = 0; + input.readInt(&classId); + compId |= ((static_cast(classId)) << 32); + } else if (compId == GeodeTypeIdsImpl::CacheableUserData4) { + int32_t classId = 0; + input.readInt(&classId); + compId |= ((static_cast(classId)) << 32); } TypeFactoryMethod createType = nullptr; + if (compId == GeodeTypeIdsImpl::FixedIDByte) { + int8_t fixedId; + input.read(&fixedId); + compId = fixedId; + findinternal = true; + } else if (compId == GeodeTypeIdsImpl::FixedIDShort) { + int16_t fixedId; + input.readInt(&fixedId); + compId = fixedId; + findinternal = true; + } else if (compId == GeodeTypeIdsImpl::FixedIDInt) { + int32_t fixedId; + input.readInt(&fixedId); + compId = fixedId; + findinternal = true; + } + if (findinternal) { theTypeMap.find2(compId, createType); } else { theTypeMap.find(compId, createType); } - if (createType == nullptr) { if (findinternal) { LOGERROR( "Unregistered class ID %d during deserialization: Did the " - "application register serialization types?", + "application register " + "serialization types?", compId); } else { LOGERROR( "Unregistered class ID %d during deserialization: Did the " - "application register serialization types?", + "application register " + "serialization types?", (compId >> 32)); } // instead of a null key or null value... an Exception should be thrown.. throw IllegalStateException("Unregistered class ID in deserialization"); } - SerializablePtr obj(createType()); - obj->fromData(input); - return obj; + // This assignment allows the fromData method to return a different object. + auto tmp = obj->fromData(input); + if (obj.get() == tmp) { + return obj; + } + return tmp->shared_from_this(); } void SerializationRegistry::addType(TypeFactoryMethod func) { diff --git a/cppcache/src/ServerLocation.hpp b/cppcache/src/ServerLocation.hpp index bb1e548..ca7661a 100644 --- a/cppcache/src/ServerLocation.hpp +++ b/cppcache/src/ServerLocation.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_SERVERLOCATION_H_ +#define GEODE_SERVERLOCATION_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -14,12 +19,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -#pragma once - -#ifndef GEODE_SERVERLOCATION_H_ -#define GEODE_SERVERLOCATION_H_ - #include #include #include @@ -29,11 +28,9 @@ #include "GeodeTypeIdsImpl.hpp" #include #include - namespace apache { namespace geode { namespace client { - class CPPCACHE_EXPORT ServerLocation : public Serializable { public: ServerLocation(std::string serverName, int port) @@ -74,14 +71,17 @@ class CPPCACHE_EXPORT ServerLocation : public Serializable { int getPort() const { return m_port; } void toData(DataOutput& output) const { if (m_serverName != nullptr) { - output.writeNativeString(m_serverName->asChar()); + // output.writeObject( m_serverName ); + output.writeNativeString(m_serverName->asChar()); // changed } output.writeInt(m_port); } - void fromData(DataInput& input) { + ServerLocation* fromData(DataInput& input) { + // input.readObject(m_serverName); input.readNativeString(m_serverName); input.readInt((int32_t*)&m_port); makeEpString(); + return this; } uint32_t objectSize() const { if (m_serverName != nullptr) { @@ -160,7 +160,6 @@ class CPPCACHE_EXPORT ServerLocation : public Serializable { int m_port; std::string m_epString; }; - } // namespace client } // namespace geode } // namespace apache diff --git a/cppcache/src/ServerLocationRequest.hpp b/cppcache/src/ServerLocationRequest.hpp index 8c13370..7dd59ac 100644 --- a/cppcache/src/ServerLocationRequest.hpp +++ b/cppcache/src/ServerLocationRequest.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_SERVERLOCATIONREQUEST_H_ +#define GEODE_SERVERLOCATIONREQUEST_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -14,14 +19,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -#pragma once - -#ifndef GEODE_SERVERLOCATIONREQUEST_H_ -#define GEODE_SERVERLOCATIONREQUEST_H_ - #include - namespace apache { namespace geode { namespace client { @@ -29,14 +27,13 @@ class ServerLocationRequest : public Serializable { public: ServerLocationRequest() : Serializable() {} virtual void toData(DataOutput& output) const = 0; - virtual void fromData(DataInput& input) = 0; + virtual Serializable* fromData(DataInput& input) = 0; virtual int32_t classId() const; virtual int8_t typeId() const = 0; virtual int8_t DSFID() const; virtual uint32_t objectSize() const = 0; virtual ~ServerLocationRequest() {} }; - } // namespace client } // namespace geode } // namespace apache diff --git a/cppcache/src/ServerLocationResponse.hpp b/cppcache/src/ServerLocationResponse.hpp index 3f92615..105f2d9 100644 --- a/cppcache/src/ServerLocationResponse.hpp +++ b/cppcache/src/ServerLocationResponse.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_SERVERLOCATIONRESPONSE_H_ +#define GEODE_SERVERLOCATIONRESPONSE_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -14,24 +19,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -#pragma once - -#ifndef GEODE_SERVERLOCATIONRESPONSE_H_ -#define GEODE_SERVERLOCATIONRESPONSE_H_ - #include #include "GeodeTypeIdsImpl.hpp" - namespace apache { namespace geode { namespace client { - class ServerLocationResponse : public Serializable { public: ServerLocationResponse() : Serializable() {} virtual void toData(DataOutput& output) const {} // Not needed as of now - virtual void fromData( + virtual Serializable* fromData( DataInput& input) = 0; // Has to be implemented by concerte class virtual int32_t classId() const { return 0; } virtual int8_t typeId() const = 0; // Has to be implemented by concrete class @@ -42,7 +39,6 @@ class ServerLocationResponse : public Serializable { const = 0; // Has to be implemented by concrete class virtual ~ServerLocationResponse() {} // Virtual destructor }; - } // namespace client } // namespace geode } // namespace apache diff --git a/cppcache/src/Struct.cpp b/cppcache/src/Struct.cpp index 6b28f6b..d84c00a 100644 --- a/cppcache/src/Struct.cpp +++ b/cppcache/src/Struct.cpp @@ -64,7 +64,7 @@ int32_t Struct::length() const { return static_cast(m_fieldValues.size()); } -void Struct::fromData(DataInput& input) { +Serializable* Struct::fromData(DataInput& input) { int8_t classType; input.read(&classType); input.read(&classType); @@ -96,6 +96,7 @@ void Struct::fromData(DataInput& input) { input.readObject(val); // need to look m_fieldValues.push_back(val); } + return this; } const std::string& Struct::getFieldName(const int32_t index) const { diff --git a/cppcache/src/TXCommitMessage.cpp b/cppcache/src/TXCommitMessage.cpp index 938f30f..933d980 100644 --- a/cppcache/src/TXCommitMessage.cpp +++ b/cppcache/src/TXCommitMessage.cpp @@ -33,9 +33,7 @@ namespace apache { namespace geode { namespace client { -TXCommitMessage::TXCommitMessage( - MemberListForVersionStamp& memberListForVersionStamp) - : m_memberListForVersionStamp(memberListForVersionStamp) +TXCommitMessage::TXCommitMessage(MemberListForVersionStamp & memberListForVersionStamp) : m_memberListForVersionStamp(memberListForVersionStamp) // UNUSED : m_processorId(0) {} @@ -43,7 +41,7 @@ TXCommitMessage::~TXCommitMessage() {} bool TXCommitMessage::isAckRequired() { return false; } -void TXCommitMessage::fromData(DataInput& input) { +Serializable* TXCommitMessage::fromData(DataInput& input) { int32_t pId; input.readInt(&pId); /* @@ -147,6 +145,10 @@ m_processorId = -1; CacheablePtr tmp; input.readObject(tmp); } + + // input.readObject(farSiders); + + return this; } void TXCommitMessage::toData(DataOutput& output) const {} @@ -157,16 +159,12 @@ int8_t TXCommitMessage::typeId() const { return static_cast(GeodeTypeIdsImpl::TXCommitMessage); } -Serializable* TXCommitMessage::create( - MemberListForVersionStamp& memberListForVersionStamp) { - return new TXCommitMessage(memberListForVersionStamp); -} +Serializable* TXCommitMessage::create(MemberListForVersionStamp & memberListForVersionStamp) { return new TXCommitMessage(memberListForVersionStamp); } void TXCommitMessage::apply(Cache* cache) { for (std::vector::iterator iter = m_regions.begin(); m_regions.end() != iter; iter++) { - RegionCommitPtr regionCommit = - std::static_pointer_cast(*iter); + RegionCommitPtr regionCommit = std::static_pointer_cast(*iter); regionCommit->apply(cache); } } diff --git a/cppcache/src/TXCommitMessage.hpp b/cppcache/src/TXCommitMessage.hpp index eb12895..09bc702 100644 --- a/cppcache/src/TXCommitMessage.hpp +++ b/cppcache/src/TXCommitMessage.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_TXCOMMITMESSAGE_H_ +#define GEODE_TXCOMMITMESSAGE_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -15,11 +20,6 @@ * limitations under the License. */ -#pragma once - -#ifndef GEODE_TXCOMMITMESSAGE_H_ -#define GEODE_TXCOMMITMESSAGE_H_ - #include #include #include @@ -28,20 +28,18 @@ namespace apache { namespace geode { namespace client { - _GF_PTR_DEF_(TXCommitMessage, TXCommitMessagePtr); class TXCommitMessage : public apache::geode::client::Cacheable { public: - TXCommitMessage(MemberListForVersionStamp& memberListForVersionStamp); + TXCommitMessage(MemberListForVersionStamp & memberListForVersionStamp); virtual ~TXCommitMessage(); - virtual void fromData(DataInput& input); + virtual Serializable* fromData(DataInput& input); virtual void toData(DataOutput& output) const; virtual int32_t classId() const; int8_t typeId() const; - static Serializable* create( - MemberListForVersionStamp& memberListForVersionStamp); + static Serializable* create(MemberListForVersionStamp & memberListForVersionStamp); // VectorOfEntryEvent getEvents(Cache* cache); void apply(Cache* cache); @@ -49,10 +47,9 @@ class TXCommitMessage : public apache::geode::client::Cacheable { private: // UNUSED int32_t m_processorId; bool isAckRequired(); - MemberListForVersionStamp& m_memberListForVersionStamp; + MemberListForVersionStamp & m_memberListForVersionStamp; std::vector m_regions; }; - } // namespace client } // namespace geode } // namespace apache diff --git a/cppcache/src/UserFunctionExecutionException.cpp b/cppcache/src/UserFunctionExecutionException.cpp index b3de8d0..f4097ed 100644 --- a/cppcache/src/UserFunctionExecutionException.cpp +++ b/cppcache/src/UserFunctionExecutionException.cpp @@ -25,9 +25,10 @@ void UserFunctionExecutionException::toData(DataOutput& output) const { "UserFunctionExecutionException::toData is not intended for use."); } -void UserFunctionExecutionException::fromData(DataInput& input) { +Serializable* UserFunctionExecutionException::fromData(DataInput& input) { throw IllegalStateException( "UserFunctionExecutionException::fromData is not intended for use."); + return nullptr; } int32_t UserFunctionExecutionException::classId() const { diff --git a/cppcache/src/VersionTag.cpp b/cppcache/src/VersionTag.cpp index 9a3a023..8d57e81 100644 --- a/cppcache/src/VersionTag.cpp +++ b/cppcache/src/VersionTag.cpp @@ -50,7 +50,7 @@ void VersionTag::toData(DataOutput& output) const { throw IllegalStateException("VersionTag::toData not implemented"); } -void VersionTag::fromData(DataInput& input) { +Serializable* VersionTag::fromData(DataInput& input) { uint16_t flags; input.readInt(&flags); input.readInt(&m_bits); @@ -71,6 +71,7 @@ void VersionTag::fromData(DataInput& input) { input.readInt(&m_regionVersionLowBytes); input.readUnsignedVL(&m_timeStamp); readMembers(flags, input); + return this; } Serializable* VersionTag::createDeserializable( diff --git a/cppcache/src/VersionTag.hpp b/cppcache/src/VersionTag.hpp index dd7479c..0489009 100644 --- a/cppcache/src/VersionTag.hpp +++ b/cppcache/src/VersionTag.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_VERSIONTAG_H_ +#define GEODE_VERSIONTAG_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -15,15 +20,9 @@ * limitations under the License. */ -#pragma once - -#ifndef GEODE_VERSIONTAG_H_ -#define GEODE_VERSIONTAG_H_ - #include #include "GeodeTypeIdsImpl.hpp" #include "MemberListForVersionStamp.hpp" - namespace apache { namespace geode { namespace client { @@ -65,7 +64,7 @@ class VersionTag : public Cacheable { virtual void toData(DataOutput& output) const; - virtual void fromData(DataInput& input); + virtual Serializable* fromData(DataInput& input); static Serializable* createDeserializable( MemberListForVersionStamp& memberListForVersionStamp); @@ -76,6 +75,7 @@ class VersionTag : public Cacheable { uint16_t getInternalMemID() const { return m_internalMemId; } uint16_t getPreviousMemID() const { return m_previousMemId; } void replaceNullMemberId(uint16_t memId); + // DSMemberForVersionStampPtr getMemberID(uint16_t memID); void setInternalMemID(uint16_t internalMemId) { m_internalMemId = internalMemId; } @@ -88,7 +88,6 @@ class VersionTag : public Cacheable { uint16_t previousMemId, MemberListForVersionStamp& memberListForVersionStamp); }; - } // namespace client } // namespace geode } // namespace apache diff --git a/cppcache/src/VersionedCacheableObjectPartList.cpp b/cppcache/src/VersionedCacheableObjectPartList.cpp index 1caa489..ecfc350 100644 --- a/cppcache/src/VersionedCacheableObjectPartList.cpp +++ b/cppcache/src/VersionedCacheableObjectPartList.cpp @@ -96,7 +96,7 @@ void VersionedCacheableObjectPartList::readObjectPart(int32_t index, } } -void VersionedCacheableObjectPartList::fromData(DataInput& input) { +Serializable* VersionedCacheableObjectPartList::fromData(DataInput& input) { ACE_Guard guard(m_responseLock); LOGDEBUG("VersionedCacheableObjectPartList::fromData"); uint8_t flags = 0; @@ -123,6 +123,7 @@ void VersionedCacheableObjectPartList::fromData(DataInput& input) { LOGDEBUG( "VersionedCacheableObjectPartList::fromData: Looks like message has no " "data. Returning,"); + return nullptr; } auto localKeys = std::make_shared(); @@ -316,6 +317,7 @@ void VersionedCacheableObjectPartList::fromData(DataInput& input) { } if (m_keysOffset != nullptr) *m_keysOffset += len; if (valuesNULL) m_values = nullptr; + return this; } int32_t VersionedCacheableObjectPartList::classId() const { return 0; } diff --git a/cppcache/src/VersionedCacheableObjectPartList.hpp b/cppcache/src/VersionedCacheableObjectPartList.hpp index df4b10a..9ebd6f4 100644 --- a/cppcache/src/VersionedCacheableObjectPartList.hpp +++ b/cppcache/src/VersionedCacheableObjectPartList.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_VERSIONEDCACHEABLEOBJECTPARTLIST_H_ +#define GEODE_VERSIONEDCACHEABLEOBJECTPARTLIST_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -15,13 +20,19 @@ * limitations under the License. */ -#pragma once - -#ifndef GEODE_VERSIONEDCACHEABLEOBJECTPARTLIST_H_ -#define GEODE_VERSIONEDCACHEABLEOBJECTPARTLIST_H_ - +/* +#include +#include +#include +#include +#include +#include +#include +#include "MapWithLock.hpp" +*/ #include "CacheableObjectPartList.hpp" #include "VersionTag.hpp" +//#include "DiskVersionTag.hpp" #include #include @@ -31,7 +42,6 @@ namespace apache { namespace geode { namespace client { - class ThinClientRegion; /** @@ -257,7 +267,7 @@ class VersionedCacheableObjectPartList : public CacheableObjectPartList { /** *@brief deserialize this object **/ - virtual void fromData(DataInput& input); + virtual Serializable* fromData(DataInput& input); /** * @brief creation function for java Object[] @@ -289,7 +299,6 @@ class VersionedCacheableObjectPartList : public CacheableObjectPartList { virtual uint32_t objectSize() const; }; - } // namespace client } // namespace geode } // namespace apache diff --git a/quickstart/cpp/queryobjects/Position.hpp b/quickstart/cpp/queryobjects/Position.hpp index 34d8a9a..aac3c93 100644 --- a/quickstart/cpp/queryobjects/Position.hpp +++ b/quickstart/cpp/queryobjects/Position.hpp @@ -19,8 +19,6 @@ * @brief User class for testing the put functionality for object. */ -#pragma once - #ifndef __POSITION_HPP__ #define __POSITION_HPP__ @@ -68,7 +66,8 @@ class TESTOBJECT_EXPORT Position : public apache::geode::client::Serializable { Position(const char* id, int32_t out); virtual ~Position(); virtual void toData(apache::geode::client::DataOutput& output) const; - virtual void fromData(apache::geode::client::DataInput& input); + virtual apache::geode::client::Serializable* fromData( + apache::geode::client::DataInput& input); virtual int32_t classId() const { return 0x02; } CacheableStringPtr toString() const; diff --git a/tests/cpp/testobject/BatchObject.cpp b/tests/cpp/testobject/BatchObject.cpp index d581596..c93e907 100644 --- a/tests/cpp/testobject/BatchObject.cpp +++ b/tests/cpp/testobject/BatchObject.cpp @@ -14,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - #include "BatchObject.hpp" using namespace apache::geode::client; @@ -40,13 +39,14 @@ void BatchObject::toData(apache::geode::client::DataOutput& output) const { output.writeObject(byteArray); } -void BatchObject::fromData(apache::geode::client::DataInput& input) { +apache::geode::client::Serializable* BatchObject::fromData( + apache::geode::client::DataInput& input) { input.readInt(&index); input.readInt(reinterpret_cast(×tamp)); input.readInt(&batch); input.readObject(byteArray); + return this; } - CacheableStringPtr BatchObject::toString() const { char buf[102500]; sprintf(buf, diff --git a/tests/cpp/testobject/BatchObject.hpp b/tests/cpp/testobject/BatchObject.hpp index ea1fcfb..96e819b 100644 --- a/tests/cpp/testobject/BatchObject.hpp +++ b/tests/cpp/testobject/BatchObject.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_TESTOBJECT_BATCHOBJECT_H_ +#define GEODE_TESTOBJECT_BATCHOBJECT_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -15,11 +20,6 @@ * limitations under the License. */ - #pragma once - - #ifndef GEODE_TESTOBJECT_BATCHOBJECT_H_ - #define GEODE_TESTOBJECT_BATCHOBJECT_H_ - /* * @brief User class for testing the cq functionality. */ @@ -62,7 +62,8 @@ class TESTOBJECT_EXPORT BatchObject : public TimestampedObject { BatchObject(int32_t anIndex, int32_t batchSize, int32_t size); virtual ~BatchObject(); virtual void toData(apache::geode::client::DataOutput& output) const; - virtual void fromData(apache::geode::client::DataInput& input); + virtual apache::geode::client::Serializable* fromData( + apache::geode::client::DataInput& input); virtual int32_t classId() const { return 25; } CacheableStringPtr toString() const; diff --git a/tests/cpp/testobject/DeltaFastAssetAccount.cpp b/tests/cpp/testobject/DeltaFastAssetAccount.cpp index 010584c..8530b63 100644 --- a/tests/cpp/testobject/DeltaFastAssetAccount.cpp +++ b/tests/cpp/testobject/DeltaFastAssetAccount.cpp @@ -14,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - #include "DeltaFastAssetAccount.hpp" using namespace apache::geode::client; @@ -52,12 +51,14 @@ void DeltaFastAssetAccount::toData( output.writeInt(static_cast(timestamp)); } -void DeltaFastAssetAccount::fromData(apache::geode::client::DataInput& input) { +apache::geode::client::Serializable* DeltaFastAssetAccount::fromData( + apache::geode::client::DataInput& input) { input.readInt(&acctId); input.readObject(customerName); input.readDouble(&netWorth); input.readObject(assets); input.readInt(reinterpret_cast(×tamp)); + return this; } void DeltaFastAssetAccount::toDelta( @@ -67,7 +68,6 @@ void DeltaFastAssetAccount::toDelta( output.writeInt(static_cast(timestamp)); } } - void DeltaFastAssetAccount::fromDelta(apache::geode::client::DataInput& input) { if (getBeforeUpdate) { input.readDouble(&netWorth); diff --git a/tests/cpp/testobject/DeltaFastAssetAccount.hpp b/tests/cpp/testobject/DeltaFastAssetAccount.hpp index 1808292..f27cb09 100644 --- a/tests/cpp/testobject/DeltaFastAssetAccount.hpp +++ b/tests/cpp/testobject/DeltaFastAssetAccount.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_TESTOBJECT_DELTAFASTASSETACCOUNT_H_ +#define GEODE_TESTOBJECT_DELTAFASTASSETACCOUNT_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -15,11 +20,6 @@ * limitations under the License. */ -#pragma once - -#ifndef GEODE_TESTOBJECT_DELTAFASTASSETACCOUNT_H_ -#define GEODE_TESTOBJECT_DELTAFASTASSETACCOUNT_H_ - /* * @brief User class for testing the query functionality. */ @@ -76,7 +76,8 @@ class TESTOBJECT_EXPORT DeltaFastAssetAccount : public Cacheable, public Delta { virtual ~DeltaFastAssetAccount() {} void toData(apache::geode::client::DataOutput& output) const; - void fromData(apache::geode::client::DataInput& input); + apache::geode::client::Serializable* fromData( + apache::geode::client::DataInput& input); void toDelta(apache::geode::client::DataOutput& output) const; void fromDelta(apache::geode::client::DataInput& input); diff --git a/tests/cpp/testobject/DeltaPSTObject.cpp b/tests/cpp/testobject/DeltaPSTObject.cpp index 6581b55..94246e6 100644 --- a/tests/cpp/testobject/DeltaPSTObject.cpp +++ b/tests/cpp/testobject/DeltaPSTObject.cpp @@ -14,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - #include "fwklib/GsRandom.hpp" #include "ArrayOfByte.hpp" #include "DeltaPSTObject.hpp" @@ -39,17 +38,14 @@ DeltaPSTObject::DeltaPSTObject(int size, bool encodeKey, bool encodeTimestamp) valueData = ArrayOfByte::init(size, encodeKey, false); } } - void DeltaPSTObject::fromDelta(DataInput& input) { input.readInt(&field1); input.readInt(reinterpret_cast(×tamp)); } - void DeltaPSTObject::toDelta(DataOutput& output) const { output.writeInt(static_cast(field1)); output.writeInt(static_cast(timestamp)); } - void DeltaPSTObject::toData(apache::geode::client::DataOutput& output) const { output.writeInt(static_cast(timestamp)); output.writeInt(static_cast(field1)); @@ -57,13 +53,14 @@ void DeltaPSTObject::toData(apache::geode::client::DataOutput& output) const { output.writeObject(valueData); } -void DeltaPSTObject::fromData(apache::geode::client::DataInput& input) { +apache::geode::client::Serializable* DeltaPSTObject::fromData( + apache::geode::client::DataInput& input) { input.readInt(reinterpret_cast(×tamp)); input.readInt(&field1); input.read(&field2); input.readObject(valueData); + return this; } - CacheableStringPtr DeltaPSTObject::toString() const { char buf[102500]; sprintf( diff --git a/tests/cpp/testobject/DeltaPSTObject.hpp b/tests/cpp/testobject/DeltaPSTObject.hpp index 08cdf53..2b581a1 100644 --- a/tests/cpp/testobject/DeltaPSTObject.hpp +++ b/tests/cpp/testobject/DeltaPSTObject.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_TESTOBJECT_DELTAPSTOBJECT_H_ +#define GEODE_TESTOBJECT_DELTAPSTOBJECT_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -15,11 +20,6 @@ * limitations under the License. */ -#pragma once - -#ifndef GEODE_TESTOBJECT_DELTAPSTOBJECT_H_ -#define GEODE_TESTOBJECT_DELTAPSTOBJECT_H_ - /* * @brief User class for testing the put functionality for object. */ @@ -63,7 +63,8 @@ class TESTOBJECT_EXPORT DeltaPSTObject : public Cacheable, public Delta { DeltaPSTObject(int size, bool encodeKey, bool encodeTimestamp); virtual ~DeltaPSTObject() {} void toData(apache::geode::client::DataOutput& output) const; - void fromData(apache::geode::client::DataInput& input); + apache::geode::client::Serializable* fromData( + apache::geode::client::DataInput& input); void fromDelta(DataInput& input); void toDelta(DataOutput& output) const; CacheableStringPtr toString() const; diff --git a/tests/cpp/testobject/DeltaTestImpl.cpp b/tests/cpp/testobject/DeltaTestImpl.cpp index 6031c21..f77bdcc 100644 --- a/tests/cpp/testobject/DeltaTestImpl.cpp +++ b/tests/cpp/testobject/DeltaTestImpl.cpp @@ -65,12 +65,13 @@ DeltaTestImpl::DeltaTestImpl(DeltaTestImplPtr rhs) : Delta(nullptr) { fromDeltaCounter = rhs->getFromDeltaCounter(); } -void DeltaTestImpl::fromData(DataInput& input) { +Serializable* DeltaTestImpl::fromData(DataInput& input) { input.readInt(&intVar); input.readObject(str); input.readDouble(&doubleVar); input.readObject(byteArr); input.readObject(testObj); + return this; } void DeltaTestImpl::toData(DataOutput& output) const { diff --git a/tests/cpp/testobject/DeltaTestImpl.hpp b/tests/cpp/testobject/DeltaTestImpl.hpp index 1d87624..ee4ebed 100644 --- a/tests/cpp/testobject/DeltaTestImpl.hpp +++ b/tests/cpp/testobject/DeltaTestImpl.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_TESTOBJECT_DELTATESTIMPL_H_ +#define GEODE_TESTOBJECT_DELTATESTIMPL_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -14,11 +19,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -#pragma once - -#ifndef GEODE_TESTOBJECT_DELTATESTIMPL_H_ -#define GEODE_TESTOBJECT_DELTATESTIMPL_H_ +/* + * DeltaTestImpl.hpp + * + * Created on: Jul 14, 2009 + * Author: abhaware + */ #include #include @@ -41,10 +47,8 @@ using namespace apache::geode::client; namespace testobject { - class DeltaTestImpl; typedef std::shared_ptr DeltaTestImplPtr; - class TESTOBJECT_EXPORT DeltaTestImpl : public Cacheable, public Delta { private: static uint8_t INT_MASK; @@ -70,7 +74,7 @@ class TESTOBJECT_EXPORT DeltaTestImpl : public Cacheable, public Delta { DeltaTestImpl(); DeltaTestImpl(int intValue, CacheableStringPtr strptr); DeltaTestImpl(DeltaTestImplPtr rhs); - void fromData(DataInput& input); + Serializable* fromData(DataInput& input); void toData(DataOutput& output) const; void fromDelta(DataInput& input); @@ -116,7 +120,6 @@ class TESTOBJECT_EXPORT DeltaTestImpl : public Cacheable, public Delta { void setTestObjFlag() { deltaBits = deltaBits | TEST_OBJ_MASK; } CacheableStringPtr toString() const; }; - } // namespace testobject #endif // GEODE_TESTOBJECT_DELTATESTIMPL_H_ diff --git a/tests/cpp/testobject/EqStruct.cpp b/tests/cpp/testobject/EqStruct.cpp index 755789e..559aef9 100644 --- a/tests/cpp/testobject/EqStruct.cpp +++ b/tests/cpp/testobject/EqStruct.cpp @@ -14,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - #include "EqStruct.hpp" using namespace apache::geode::client; @@ -140,7 +139,8 @@ void EqStruct::toData(apache::geode::client::DataOutput &out) const { out.writeDouble(discretionOffset); } -void EqStruct::fromData(apache::geode::client::DataInput &in) { +apache::geode::client::Serializable *EqStruct::fromData( + apache::geode::client::DataInput &in) { // Strings in.readUTF(&state); in.readUTF(&demandInd); @@ -198,8 +198,8 @@ void EqStruct::fromData(apache::geode::client::DataInput &in) { in.readDouble(&stopPx); in.readDouble(&pegDifference); in.readDouble(&discretionOffset); + return this; } - CacheableStringPtr EqStruct::toString() const { char buf[102500]; sprintf(buf, "EqStruct:[timestamp = %lld myIndex = %d cxlQty = %d ]", diff --git a/tests/cpp/testobject/EqStruct.hpp b/tests/cpp/testobject/EqStruct.hpp index 0019ed7..19cef03 100644 --- a/tests/cpp/testobject/EqStruct.hpp +++ b/tests/cpp/testobject/EqStruct.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_TESTOBJECT_EQSTRUCT_H_ +#define GEODE_TESTOBJECT_EQSTRUCT_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -15,11 +20,6 @@ * limitations under the License. */ -#pragma once - -#ifndef GEODE_TESTOBJECT_EQSTRUCT_H_ -#define GEODE_TESTOBJECT_EQSTRUCT_H_ - /* * @brief User class for testing the put functionality for object. */ @@ -108,7 +108,8 @@ class TESTOBJECT_EXPORT EqStruct : public TimestampedObject { EqStruct(int index); virtual ~EqStruct(); virtual void toData(apache::geode::client::DataOutput& output) const; - virtual void fromData(apache::geode::client::DataInput& input); + virtual apache::geode::client::Serializable* fromData( + apache::geode::client::DataInput& input); virtual int32_t classId() const { return 101; } CacheableStringPtr toString() const; diff --git a/tests/cpp/testobject/FastAsset.cpp b/tests/cpp/testobject/FastAsset.cpp index 005a289..7595993 100644 --- a/tests/cpp/testobject/FastAsset.cpp +++ b/tests/cpp/testobject/FastAsset.cpp @@ -14,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - #include "FastAsset.hpp" #include "fwklib/GsRandom.hpp" @@ -32,7 +31,9 @@ void FastAsset::toData(apache::geode::client::DataOutput& output) const { output.writeDouble(value); } -void FastAsset::fromData(apache::geode::client::DataInput& input) { +apache::geode::client::Serializable* FastAsset::fromData( + apache::geode::client::DataInput& input) { input.readInt(&assetId); input.readDouble(&value); + return this; } diff --git a/tests/cpp/testobject/FastAsset.hpp b/tests/cpp/testobject/FastAsset.hpp index ca866c1..6890943 100644 --- a/tests/cpp/testobject/FastAsset.hpp +++ b/tests/cpp/testobject/FastAsset.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_TESTOBJECT_FASTASSET_H_ +#define GEODE_TESTOBJECT_FASTASSET_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -15,11 +20,6 @@ * limitations under the License. */ -#pragma once - -#ifndef GEODE_TESTOBJECT_FASTASSET_H_ -#define GEODE_TESTOBJECT_FASTASSET_H_ - /* * @brief User class for testing the query functionality. */ @@ -63,7 +63,8 @@ class TESTOBJECT_EXPORT FastAsset : public TimestampedObject { FastAsset(int size, int maxVal); virtual ~FastAsset(); virtual void toData(apache::geode::client::DataOutput& output) const; - virtual void fromData(apache::geode::client::DataInput& input); + virtual apache::geode::client::Serializable* fromData( + apache::geode::client::DataInput& input); virtual int32_t classId() const { return 24; } virtual uint32_t objectSize() const { diff --git a/tests/cpp/testobject/FastAssetAccount.cpp b/tests/cpp/testobject/FastAssetAccount.cpp index 8f8bf83..8ef234d 100644 --- a/tests/cpp/testobject/FastAssetAccount.cpp +++ b/tests/cpp/testobject/FastAssetAccount.cpp @@ -14,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - #include "FastAssetAccount.hpp" #include "FastAsset.hpp" @@ -45,8 +44,8 @@ FastAssetAccount::FastAssetAccount(int idx, bool encodeTimestp, int maxVal, } FastAssetAccount::~FastAssetAccount() {} - void FastAssetAccount::toData(apache::geode::client::DataOutput& output) const { + // output.writeBoolean(encodeTimestamp); output.writeInt(static_cast(acctId)); output.writeObject(customerName); output.writeDouble(netWorth); @@ -54,14 +53,16 @@ void FastAssetAccount::toData(apache::geode::client::DataOutput& output) const { output.writeInt(static_cast(timestamp)); } -void FastAssetAccount::fromData(apache::geode::client::DataInput& input) { +apache::geode::client::Serializable* FastAssetAccount::fromData( + apache::geode::client::DataInput& input) { + // input.readBoolean(&encodeTimestamp); input.readInt(&acctId); input.readObject(customerName); input.readDouble(&netWorth); input.readObject(assets); input.readInt(reinterpret_cast(×tamp)); + return this; } - CacheableStringPtr FastAssetAccount::toString() const { char buf[102500]; sprintf(buf, diff --git a/tests/cpp/testobject/FastAssetAccount.hpp b/tests/cpp/testobject/FastAssetAccount.hpp index 126e247..2e0376c 100644 --- a/tests/cpp/testobject/FastAssetAccount.hpp +++ b/tests/cpp/testobject/FastAssetAccount.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_TESTOBJECT_FASTASSETACCOUNT_H_ +#define GEODE_TESTOBJECT_FASTASSETACCOUNT_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -15,11 +20,6 @@ * limitations under the License. */ -#pragma once - -#ifndef GEODE_TESTOBJECT_FASTASSETACCOUNT_H_ -#define GEODE_TESTOBJECT_FASTASSETACCOUNT_H_ - /* * @brief User class for testing the query functionality. */ @@ -70,7 +70,8 @@ class TESTOBJECT_EXPORT FastAssetAccount : public TimestampedObject { FastAssetAccount(int index, bool encodeTimestp, int maxVal, int asstSize = 0); virtual ~FastAssetAccount(); virtual void toData(apache::geode::client::DataOutput& output) const; - virtual void fromData(apache::geode::client::DataInput& input); + virtual apache::geode::client::Serializable* fromData( + apache::geode::client::DataInput& input); virtual int32_t classId() const { return 23; } CacheableStringPtr toString() const; diff --git a/tests/cpp/testobject/PSTObject.cpp b/tests/cpp/testobject/PSTObject.cpp index 66b50b5..a9299cc 100644 --- a/tests/cpp/testobject/PSTObject.cpp +++ b/tests/cpp/testobject/PSTObject.cpp @@ -14,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - #include "PSTObject.hpp" #include "fwklib/GsRandom.hpp" #include "ArrayOfByte.hpp" @@ -40,7 +39,6 @@ PSTObject::PSTObject(int size, bool encodeKey, bool encodeTimestamp) { } PSTObject::~PSTObject() {} - void PSTObject::toData(apache::geode::client::DataOutput& output) const { output.writeInt(static_cast(timestamp)); output.writeInt(static_cast(field1)); @@ -48,13 +46,14 @@ void PSTObject::toData(apache::geode::client::DataOutput& output) const { output.writeObject(valueData); } -void PSTObject::fromData(apache::geode::client::DataInput& input) { +apache::geode::client::Serializable* PSTObject::fromData( + apache::geode::client::DataInput& input) { input.readInt(reinterpret_cast(×tamp)); input.readInt(&field1); input.read(&field2); input.readObject(valueData); + return this; } - CacheableStringPtr PSTObject::toString() const { char buf[102500]; sprintf(buf, diff --git a/tests/cpp/testobject/PSTObject.hpp b/tests/cpp/testobject/PSTObject.hpp index 5f9c784..ccd74f2 100644 --- a/tests/cpp/testobject/PSTObject.hpp +++ b/tests/cpp/testobject/PSTObject.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_TESTOBJECT_PSTOBJECT_H_ +#define GEODE_TESTOBJECT_PSTOBJECT_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -15,11 +20,6 @@ * limitations under the License. */ -#pragma once - -#ifndef GEODE_TESTOBJECT_PSTOBJECT_H_ -#define GEODE_TESTOBJECT_PSTOBJECT_H_ - /* * @brief User class for testing the put functionality for object. */ @@ -62,7 +62,8 @@ class TESTOBJECT_EXPORT PSTObject : public TimestampedObject { PSTObject(int size, bool encodeKey, bool encodeTimestamp); virtual ~PSTObject(); virtual void toData(apache::geode::client::DataOutput& output) const; - virtual void fromData(apache::geode::client::DataInput& input); + virtual apache::geode::client::Serializable* fromData( + apache::geode::client::DataInput& input); virtual int32_t classId() const { return 0x04; } CacheableStringPtr toString() const; diff --git a/tests/cpp/testobject/Portfolio.cpp b/tests/cpp/testobject/Portfolio.cpp index d78638d..4277d64 100644 --- a/tests/cpp/testobject/Portfolio.cpp +++ b/tests/cpp/testobject/Portfolio.cpp @@ -82,7 +82,7 @@ void Portfolio::toData(DataOutput& output) const { output.writeBytes(arrayZeroSize, 0); } -void Portfolio::fromData(DataInput& input) { +Serializable* Portfolio::fromData(DataInput& input) { input.readInt(&ID); input.readObject(pkid); input.readObject(position1); @@ -96,6 +96,7 @@ void Portfolio::fromData(DataInput& input) { int tmp = 0; input.readBytes(&arrayNull, &tmp); input.readBytes(&arrayZeroSize, &tmp); + return this; } CacheableStringPtr Portfolio::toString() const { diff --git a/tests/cpp/testobject/Portfolio.hpp b/tests/cpp/testobject/Portfolio.hpp index d842e15..d147cfb 100644 --- a/tests/cpp/testobject/Portfolio.hpp +++ b/tests/cpp/testobject/Portfolio.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_TESTOBJECT_PORTFOLIO_H_ +#define GEODE_TESTOBJECT_PORTFOLIO_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -15,11 +20,6 @@ * limitations under the License. */ -#pragma once - -#ifndef GEODE_TESTOBJECT_PORTFOLIO_H_ -#define GEODE_TESTOBJECT_PORTFOLIO_H_ - /* * @brief User class for testing the put functionality for object. */ @@ -123,7 +123,7 @@ class TESTOBJECT_EXPORT Portfolio : public Serializable { static Serializable* createDeserializable() { return new Portfolio(); } virtual void toData(DataOutput& output) const; - virtual void fromData(DataInput& input); + virtual Serializable* fromData(DataInput& input); virtual int32_t classId() const { return 0x03; } CacheableStringPtr toString() const; }; diff --git a/tests/cpp/testobject/Position.cpp b/tests/cpp/testobject/Position.cpp index 3885a47..04a11f2 100644 --- a/tests/cpp/testobject/Position.cpp +++ b/tests/cpp/testobject/Position.cpp @@ -99,7 +99,8 @@ void Position::toData(apache::geode::client::DataOutput& output) const { output.writeInt(pid); } -void Position::fromData(apache::geode::client::DataInput& input) { +apache::geode::client::Serializable* Position::fromData( + apache::geode::client::DataInput& input) { input.readInt(&avg20DaysVol); input.readObject(bondRating); input.readDouble(&convRatio); @@ -116,6 +117,7 @@ void Position::fromData(apache::geode::client::DataInput& input) { input.readObject(underlyer); input.readInt(&volatility); input.readInt(&pid); + return this; } CacheableStringPtr Position::toString() const { diff --git a/tests/cpp/testobject/Position.hpp b/tests/cpp/testobject/Position.hpp index bedbd13..5e91e0a 100644 --- a/tests/cpp/testobject/Position.hpp +++ b/tests/cpp/testobject/Position.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_TESTOBJECT_POSITION_H_ +#define GEODE_TESTOBJECT_POSITION_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -15,11 +20,6 @@ * limitations under the License. */ -#pragma once - -#ifndef GEODE_TESTOBJECT_POSITION_H_ -#define GEODE_TESTOBJECT_POSITION_H_ - /* * @brief User class for testing the put functionality for object. */ @@ -74,7 +74,8 @@ class TESTOBJECT_EXPORT Position : public apache::geode::client::Serializable { Position(int32_t iForExactVal); virtual ~Position(); virtual void toData(apache::geode::client::DataOutput& output) const; - virtual void fromData(apache::geode::client::DataInput& input); + virtual apache::geode::client::Serializable* fromData( + apache::geode::client::DataInput& input); virtual int32_t classId() const { return 0x02; } CacheableStringPtr toString() const; diff --git a/tests/cpp/testobject/TestObject1.cpp b/tests/cpp/testobject/TestObject1.cpp index 9567bb4..fab0ee5 100644 --- a/tests/cpp/testobject/TestObject1.cpp +++ b/tests/cpp/testobject/TestObject1.cpp @@ -53,7 +53,7 @@ void TestObject1::toData(DataOutput& output) const { output.writeInt(identifier); } -void TestObject1::fromData(DataInput& input) { +Serializable* TestObject1::fromData(DataInput& input) { uint8_t* bytes; int32_t len; input.readBytes(&bytes, &len); @@ -61,6 +61,7 @@ void TestObject1::fromData(DataInput& input) { delete bytes; input.readObject(name); input.readInt(&identifier); + return this; } Serializable* TestObject1::create() { return new TestObject1(); } diff --git a/tests/cpp/testobject/TestObject1.hpp b/tests/cpp/testobject/TestObject1.hpp index 85c08f3..921c8e7 100644 --- a/tests/cpp/testobject/TestObject1.hpp +++ b/tests/cpp/testobject/TestObject1.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_TESTOBJECT_TESTOBJECT1_H_ +#define GEODE_TESTOBJECT_TESTOBJECT1_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -14,11 +19,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -#pragma once - -#ifndef GEODE_TESTOBJECT_TESTOBJECT1_H_ -#define GEODE_TESTOBJECT_TESTOBJECT1_H_ +/* + * TestObject1.hpp + * + * Created on: Jul 15, 2009 + * Author: abhaware + */ #include #include @@ -48,7 +54,7 @@ class TESTOBJECT_EXPORT TestObject1 : public Cacheable { TestObject1(std::string& str, int32_t id); TestObject1(TestObject1& rhs); void toData(DataOutput& output) const; - void fromData(DataInput& input); + Serializable* fromData(DataInput& input); int32_t getIdentifier() { return identifier; } diff --git a/tests/cpp/testobject/TimestampedObject.hpp b/tests/cpp/testobject/TimestampedObject.hpp index 0cd30ad..d12ad12 100644 --- a/tests/cpp/testobject/TimestampedObject.hpp +++ b/tests/cpp/testobject/TimestampedObject.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_TESTOBJECT_TIMESTAMPEDOBJECT_H_ +#define GEODE_TESTOBJECT_TIMESTAMPEDOBJECT_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -15,11 +20,6 @@ * limitations under the License. */ -#pragma once - -#ifndef GEODE_TESTOBJECT_TIMESTAMPEDOBJECT_H_ -#define GEODE_TESTOBJECT_TIMESTAMPEDOBJECT_H_ - #include #ifdef _WIN32 @@ -42,7 +42,9 @@ class TESTOBJECT_EXPORT TimestampedObject public: virtual uint64_t getTimestamp() { return 0; } virtual void resetTimestamp() {} - virtual void fromData(apache::geode::client::DataInput& input) {} + virtual Serializable* fromData(apache::geode::client::DataInput& input) { + return this; + } virtual void toData(apache::geode::client::DataOutput& output) const {} virtual int32_t classId() const { return 0; } virtual uint32_t objectSize() const { return 0; } diff --git a/tests/cpp/testobject/VariousPdxTypes.cpp b/tests/cpp/testobject/VariousPdxTypes.cpp index daa172d..52d7f7b 100644 --- a/tests/cpp/testobject/VariousPdxTypes.cpp +++ b/tests/cpp/testobject/VariousPdxTypes.cpp @@ -917,7 +917,7 @@ void PdxInsideIGeodeSerializable::toData(DataOutput &output) const { output.writeInt(m_i4); } -void PdxInsideIGeodeSerializable::fromData(DataInput &input) { +Serializable *PdxInsideIGeodeSerializable::fromData(DataInput &input) { input.readInt(&m_i1); input.readObject(m_npdx); input.readInt(&m_i2); @@ -926,6 +926,7 @@ void PdxInsideIGeodeSerializable::fromData(DataInput &input) { input.readObject(m_pdx3); input.readInt(&m_i3); input.readInt(&m_i4); -} + return this; +} } /* namespace PdxTests */ diff --git a/tests/cpp/testobject/VariousPdxTypes.hpp b/tests/cpp/testobject/VariousPdxTypes.hpp index 0e313ce..80c24d8 100644 --- a/tests/cpp/testobject/VariousPdxTypes.hpp +++ b/tests/cpp/testobject/VariousPdxTypes.hpp @@ -1,3 +1,8 @@ +#pragma once + +#ifndef GEODE_TESTOBJECT_VARIOUSPDXTYPES_H_ +#define GEODE_TESTOBJECT_VARIOUSPDXTYPES_H_ + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -14,11 +19,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - - #pragma once - -#ifndef GEODE_TESTOBJECT_VARIOUSPDXTYPES_H_ -#define GEODE_TESTOBJECT_VARIOUSPDXTYPES_H_ +/* + * VariousPdxTypes.hpp + * + * Created on: Feb 10, 2012 + * Author: npatel + */ #include #include @@ -514,7 +520,7 @@ class TESTOBJECT_EXPORT PdxInsideIGeodeSerializable : public Serializable { CacheableStringPtr toString() const; - virtual void fromData(DataInput& input); + virtual Serializable* fromData(DataInput& input); virtual void toData(DataOutput& output) const; -- To stop receiving notification emails like this one, please contact ['"commits@geode.apache.org" '].