geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From echobr...@apache.org
Subject [geode-native] branch develop updated: Geode-4853: Use serializer from type registry in pdx wrapper
Date Tue, 24 Apr 2018 19:09:32 GMT
This is an automated email from the ASF dual-hosted git repository.

echobravo 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 636835b  Geode-4853: Use serializer from type registry in pdx wrapper
636835b is described below

commit 636835b5728d1f8755cc0f681ed5598fd5e5cfb9
Author: M. Oleske <moleske@users.noreply.github.com>
AuthorDate: Tue Apr 24 12:09:29 2018 -0700

    Geode-4853: Use serializer from type registry in pdx wrapper
    
    * Make test more readable
    
    * Getting serializer through PdxWriter/PdxReader
    Signed-off-by: Ryan McMahon <mcmellawat@gmail.com>
    
    *  get Pdx Serializer from PdxWriter/PdxReader in PdxWrapper
    
    * remove objectsizer override from pdxwrapper
    
    * remove unused variable in test
    
    * remove special snowflake constructor
    
    * update examples
    
    * Remove unneeded virtual and better variable names
---
 cppcache/include/geode/Cache.hpp                   |   2 +-
 cppcache/include/geode/DataInput.hpp               |   2 +-
 cppcache/include/geode/DataOutput.hpp              |   2 +-
 cppcache/include/geode/PdxReader.hpp               |   7 +-
 cppcache/include/geode/PdxWrapper.hpp              |  18 +-
 cppcache/include/geode/PdxWriter.hpp               |  17 +-
 cppcache/include/geode/TypeRegistry.hpp            |   5 +-
 .../integration-test/ThinClientPdxSerializer.hpp   | 196 ++++++------
 .../integration-test/ThinClientPdxSerializers.hpp  | 327 ++++++++++-----------
 cppcache/src/Cache.cpp                             |   2 +-
 cppcache/src/DataInput.cpp                         |   2 +-
 cppcache/src/DataOutput.cpp                        |   2 +-
 cppcache/src/PdxLocalReader.cpp                    |   4 +
 cppcache/src/PdxLocalReader.hpp                    |   2 +
 cppcache/src/PdxLocalWriter.cpp                    |   4 +
 cppcache/src/PdxLocalWriter.hpp                    |   2 +
 cppcache/src/PdxWrapper.cpp                        |  45 +--
 cppcache/src/SerializationRegistry.cpp             |  10 +-
 cppcache/src/TypeRegistry.cpp                      |  13 +-
 examples/cpp/customserializer/main.cpp             |   4 +-
 tests/cpp/testobject/NonPdxType.hpp                |  29 +-
 21 files changed, 319 insertions(+), 376 deletions(-)

diff --git a/cppcache/include/geode/Cache.hpp b/cppcache/include/geode/Cache.hpp
index 4b67070..17a0ca8 100644
--- a/cppcache/include/geode/Cache.hpp
+++ b/cppcache/include/geode/Cache.hpp
@@ -106,7 +106,7 @@ class APACHE_GEODE_EXPORT Cache : public GeodeCache {
    * Returns the type registry that this cache was
    * {@link CacheFactory::create created} with.
    */
-  virtual TypeRegistry& getTypeRegistry();
+  TypeRegistry& getTypeRegistry() const;
 
   /**
    * Terminates this object cache and releases all the local resources.
diff --git a/cppcache/include/geode/DataInput.hpp b/cppcache/include/geode/DataInput.hpp
index 1b0f4ad..ebaa828 100644
--- a/cppcache/include/geode/DataInput.hpp
+++ b/cppcache/include/geode/DataInput.hpp
@@ -481,7 +481,7 @@ class APACHE_GEODE_EXPORT DataInput {
     return result;
   }
 
-  virtual const Cache* getCache();
+  virtual Cache* getCache() const;
 
   ~DataInput() = default;
   DataInput() = delete;
diff --git a/cppcache/include/geode/DataOutput.hpp b/cppcache/include/geode/DataOutput.hpp
index 2f162e7..69014c1 100644
--- a/cppcache/include/geode/DataOutput.hpp
+++ b/cppcache/include/geode/DataOutput.hpp
@@ -490,7 +490,7 @@ class APACHE_GEODE_EXPORT DataOutput {
 
   static void safeDelete(uint8_t* src) { _GEODE_SAFE_DELETE(src); }
 
-  virtual const Cache* getCache();
+  virtual Cache* getCache() const;
 
   /** Destruct a DataOutput, including releasing the created buffer. */
   ~DataOutput() {
diff --git a/cppcache/include/geode/PdxReader.hpp b/cppcache/include/geode/PdxReader.hpp
index f3575b2..302820c 100644
--- a/cppcache/include/geode/PdxReader.hpp
+++ b/cppcache/include/geode/PdxReader.hpp
@@ -27,9 +27,10 @@ namespace apache {
 namespace geode {
 namespace client {
 
-class PdxReader;
-class CacheableObjectArray;
 class CacheableDate;
+class CacheableObjectArray;
+class PdxReader;
+class PdxSerializer;
 
 /**
  * A PdxReader will be passed to PdxSerializable.fromData or
@@ -366,6 +367,8 @@ class APACHE_GEODE_EXPORT PdxReader {
    * @return an object that represents the unread fields.
    */
   virtual std::shared_ptr<PdxUnreadFields> readUnreadFields() = 0;
+
+  virtual std::shared_ptr<PdxSerializer> getPdxSerializer() const = 0;
 };
 }  // namespace client
 }  // namespace geode
diff --git a/cppcache/include/geode/PdxWrapper.hpp b/cppcache/include/geode/PdxWrapper.hpp
index ec76ec1..c2f5264 100644
--- a/cppcache/include/geode/PdxWrapper.hpp
+++ b/cppcache/include/geode/PdxWrapper.hpp
@@ -53,8 +53,7 @@ class APACHE_GEODE_EXPORT PdxWrapper : public PdxSerializable {
    * @param className the fully qualified class name to map this user object to
    * the Java side.
    */
-  PdxWrapper(std::shared_ptr<void> userObject, std::string className,
-             std::shared_ptr<PdxSerializer> pdxSerializerPtr);
+  PdxWrapper(std::shared_ptr<void> userObject, std::string className);
 
   /**
    * Returns the pointer to the user object which is deserialized with a
@@ -108,16 +107,6 @@ class APACHE_GEODE_EXPORT PdxWrapper : public PdxSerializable {
   int32_t classId() const override { return 0; }
 
   /**
-   *@brief return the size in bytes of the instance being serialized.
-   * This is used to determine whether the cache is using up more
-   * physical memory than it has been configured to use. The method can
-   * return zero if the user does not require the ability to control
-   * cache memory utilization.
-   * Note that you must implement this only if you use the HeapLRU feature.
-   */
-  size_t objectSize() const override;
-
-  /**
    * Display this object as 'string', which depends on the implementation in
    * the subclasses.
    * The default implementation renders the classname.
@@ -128,16 +117,11 @@ class APACHE_GEODE_EXPORT PdxWrapper : public PdxSerializable {
 
  private:
   PdxWrapper() = delete;
-  PdxWrapper(std::string className,
-             std::shared_ptr<PdxSerializer> pdxSerializerPtr);
 
   _GEODE_FRIEND_STD_SHARED_PTR(PdxWrapper)
 
   std::shared_ptr<void> m_userObject;
   std::string m_className;
-  std::shared_ptr<PdxSerializer> m_serializer;
-  UserObjectSizer m_sizer;
-
 };
 }  // namespace client
 }  // namespace geode
diff --git a/cppcache/include/geode/PdxWriter.hpp b/cppcache/include/geode/PdxWriter.hpp
index 3aae1e3..f1e9a2f 100644
--- a/cppcache/include/geode/PdxWriter.hpp
+++ b/cppcache/include/geode/PdxWriter.hpp
@@ -29,7 +29,9 @@ namespace geode {
 namespace client {
 
 class CacheableObjectArray;
+class PdxSerializer;
 class PdxUnreadFields;
+
 /**
  * A PdxWriter will be passed to PdxSerializable.toData
  * when it is serializing the domain class. The domain class needs to serialize
@@ -173,7 +175,7 @@ class APACHE_GEODE_EXPORT PdxWriter {
    * or fieldName is nullptr or empty
    */
   virtual PdxWriter& writeString(const std::string& fieldName,
-                                                 const std::string& value) = 0;
+                                 const std::string& value) = 0;
 
   /**
    * Writes the named field with the given value to the serialized form.
@@ -220,8 +222,8 @@ class APACHE_GEODE_EXPORT PdxWriter {
    * @throws IllegalStateException if the named field has already been written
    * or fieldName is nullptr or empty.
    */
-  virtual PdxWriter& writeCharArray(
-      const std::string& fieldName, const std::vector<char16_t>& array) = 0;
+  virtual PdxWriter& writeCharArray(const std::string& fieldName,
+                                    const std::vector<char16_t>& array) = 0;
 
   /**
    * Writes the named field with the given value to the serialized form.
@@ -352,9 +354,10 @@ class APACHE_GEODE_EXPORT PdxWriter {
    * @throws IllegalStateException if the named field has already been written
    * or fieldName is nullptr or empty.
    */
-  virtual PdxWriter& writeArrayOfByteArrays(
-      const std::string& fieldName, int8_t* const* const array, int arrayLength,
-      const int* elementLength) = 0;
+  virtual PdxWriter& writeArrayOfByteArrays(const std::string& fieldName,
+                                            int8_t* const* const array,
+                                            int arrayLength,
+                                            const int* elementLength) = 0;
 
   /**
    * Indicate that the given field name should be included in hashCode and
@@ -395,6 +398,8 @@ class APACHE_GEODE_EXPORT PdxWriter {
    */
   virtual PdxWriter& writeUnreadFields(
       std::shared_ptr<PdxUnreadFields> unread) = 0;
+
+  virtual std::shared_ptr<PdxSerializer> getPdxSerializer() const = 0;
 };
 }  // namespace client
 }  // namespace geode
diff --git a/cppcache/include/geode/TypeRegistry.hpp b/cppcache/include/geode/TypeRegistry.hpp
index d372e74..c7da804 100644
--- a/cppcache/include/geode/TypeRegistry.hpp
+++ b/cppcache/include/geode/TypeRegistry.hpp
@@ -61,8 +61,9 @@ class APACHE_GEODE_EXPORT TypeRegistry {
    */
   void registerPdxSerializer(std::shared_ptr<PdxSerializer> pdxSerializer);
 
- private:
+  std::shared_ptr<PdxSerializer> getPdxSerializer();
 
+ private:
   CacheImpl* m_cache;
 };
 
@@ -70,4 +71,4 @@ class APACHE_GEODE_EXPORT TypeRegistry {
 }  // namespace geode
 }  // namespace apache
 
-#endif //GEODE_TYPEREGISTRY_H_
+#endif  // GEODE_TYPEREGISTRY_H_
diff --git a/cppcache/integration-test/ThinClientPdxSerializer.hpp b/cppcache/integration-test/ThinClientPdxSerializer.hpp
index acbeea2..9d9fcaf 100644
--- a/cppcache/integration-test/ThinClientPdxSerializer.hpp
+++ b/cppcache/integration-test/ThinClientPdxSerializer.hpp
@@ -148,105 +148,98 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepTwoPoolLoc_PDX)
   }
 END_TASK_DEFINITION
 
-void checkPdxInstanceToStringAtServer(std::shared_ptr<Region> regionPtr) {
-  auto keyport = CacheableKey::create("success");
-  auto boolPtr =
-      std::dynamic_pointer_cast<CacheableBoolean>(regionPtr->get(keyport));
-  bool val = boolPtr->value();
-  ASSERT(val == true, "checkPdxInstanceToStringAtServer: Val should be true");
+void checkPdxInstanceToStringAtServer(std::shared_ptr<Region> region) {
+  auto keyPort = CacheableKey::create("success");
+  auto checkPdxInstanceToStringAtServer =
+      std::dynamic_pointer_cast<CacheableBoolean>(region->get(keyPort));
+  bool actualValue = checkPdxInstanceToStringAtServer->value();
+  ASSERT(actualValue == true,
+         "checkPdxInstanceToStringAtServer: Val should be true");
 }
 
 DUNIT_TASK_DEFINITION(CLIENT1, JavaPutGet)
   {
-    auto serializationRegistry =
-        CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
-            ->getSerializationRegistry();
-    serializationRegistry->setPdxSerializer(
-        std::make_shared<TestPdxSerializer>());
+    CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
+        ->getTypeRegistry()
+        .registerPdxSerializer(std::make_shared<TestPdxSerializer>());
 
-    auto pdxSerializer =
-        CacheRegionHelper::getCacheImpl(getHelper()->getCache().get())
-            ->getSerializationRegistry()
-            ->getPdxSerializer();
+    auto region0 = getHelper()->getRegion("DistRegionAck");
+    auto keyPort = CacheableKey::create(1);
 
-    auto regPtr0 = getHelper()->getRegion("DistRegionAck");
-    auto keyport = CacheableKey::create(1);
+    auto nonPdxType1 = std::make_shared<PdxTests::NonPdxType>();
+    auto pdxWrapper1 = std::make_shared<PdxWrapper>(nonPdxType1, CLASSNAME1);
+    region0->put(keyPort, pdxWrapper1);
 
-    auto npt1 = std::make_shared<PdxTests::NonPdxType>(pdxSerializer);
-    auto pdxobj = std::make_shared<PdxWrapper>(npt1, CLASSNAME1, pdxSerializer);
-    regPtr0->put(keyport, pdxobj);
+    auto pdxWrapper2 =
+        std::dynamic_pointer_cast<PdxWrapper>(region0->get(keyPort));
 
-    auto obj2 = std::dynamic_pointer_cast<PdxWrapper>(regPtr0->get(keyport));
+    auto regionGetSuccess =
+        std::dynamic_pointer_cast<CacheableBoolean>(region0->get("success"));
+    bool actualValue = regionGetSuccess.get()->value();
 
-    auto boolPtr =
-        std::dynamic_pointer_cast<CacheableBoolean>(regPtr0->get("success"));
-    bool isEqual = boolPtr.get()->value();
-    ASSERT(isEqual == true,
+    ASSERT(actualValue == true,
            "Task JavaPutGet:Objects of type NonPdxType should be equal");
 
-    auto npt2 =
-        std::static_pointer_cast<PdxTests::NonPdxType>(obj2->getObject());
-    ASSERT(npt1->equals(*npt2, false), "NonPdxType compare");
+    auto nonPdxType2 = std::static_pointer_cast<PdxTests::NonPdxType>(
+        pdxWrapper2->getObject());
+
+    ASSERT(nonPdxType1->equals(*nonPdxType2, false), "NonPdxType compare");
   }
 END_TASK_DEFINITION
 
 DUNIT_TASK_DEFINITION(CLIENT2, JavaGet)
   {
-    auto serializationRegistry =
-        CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
-            ->getSerializationRegistry();
-    serializationRegistry->setPdxSerializer(
-        std::make_shared<TestPdxSerializer>());
+    CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
+        ->getTypeRegistry()
+        .registerPdxSerializer(std::make_shared<TestPdxSerializer>());
 
     LOGDEBUG("JavaGet-1 Line_309");
-    auto regPtr0 = getHelper()->getRegion("DistRegionAck");
+    auto region0 = getHelper()->getRegion("DistRegionAck");
+
+    auto keyPort1 = CacheableKey::create(1);
 
-    auto keyport1 = CacheableKey::create(1);
     LOGDEBUG("JavaGet-2 Line_314");
-    auto obj1 = std::dynamic_pointer_cast<PdxWrapper>(regPtr0->get(keyport1));
-    auto npt1 =
-        std::static_pointer_cast<PdxTests::NonPdxType>(obj1->getObject());
+    auto pdxWrapper1 =
+        std::dynamic_pointer_cast<PdxWrapper>(region0->get(keyPort1));
+    auto nonPdxType1 = std::static_pointer_cast<PdxTests::NonPdxType>(
+        pdxWrapper1->getObject());
+
     LOGDEBUG("JavaGet-3 Line_316");
-    auto keyport2 = CacheableKey::create("putFromjava");
+    auto keyPort2 = CacheableKey::create("putFromjava");
+
     LOGDEBUG("JavaGet-4 Line_316");
-    auto obj2 = std::dynamic_pointer_cast<PdxWrapper>(regPtr0->get(keyport2));
-    auto npt2 =
-        std::static_pointer_cast<PdxTests::NonPdxType>(obj2->getObject());
+    auto pdxWrapper2 =
+        std::dynamic_pointer_cast<PdxWrapper>(region0->get(keyPort2));
+    auto nonPdxWrapper2 = std::static_pointer_cast<PdxTests::NonPdxType>(
+        pdxWrapper2->getObject());
+
     LOGDEBUG("JavaGet-5 Line_320");
   }
 END_TASK_DEFINITION
 
 DUNIT_TASK_DEFINITION(CLIENT1, putFromVersion1_PS)
   {
-    auto regPtr0 = getHelper()->getRegion("DistRegionAck");
+    auto region0 = getHelper()->getRegion("DistRegionAck");
     auto key = CacheableKey::create(1);
 
-    auto serializationRegistry =
-        CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
-            ->getSerializationRegistry();
-    serializationRegistry->setPdxSerializer(
-        std::make_shared<TestPdxSerializerForV1>());
-
-    auto pdxSerializer =
-        CacheRegionHelper::getCacheImpl(getHelper()->getCache().get())
-            ->getSerializationRegistry()
-            ->getPdxSerializer();
+    CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
+        ->getTypeRegistry()
+        .registerPdxSerializer(std::make_shared<TestPdxSerializerForV1>());
 
     // Create New object and wrap it in PdxWrapper (owner)
-    auto npt1 = std::make_shared<PdxTests::TestDiffTypePdxSV1>(true);
-    auto pdxobj =
-        std::make_shared<PdxWrapper>(npt1, V1CLASSNAME2, pdxSerializer);
+    auto nonPdxType1 = std::make_shared<PdxTests::TestDiffTypePdxSV1>(true);
+    auto pdxWrapper = std::make_shared<PdxWrapper>(nonPdxType1, V1CLASSNAME2);
 
     // PUT
-    regPtr0->put(key, pdxobj);
+    region0->put(key, pdxWrapper);
 
     // GET
-    auto obj2 = std::dynamic_pointer_cast<PdxWrapper>(regPtr0->get(key));
-    auto npt2 = std::static_pointer_cast<PdxTests::TestDiffTypePdxSV1>(
-        obj2->getObject());
+    auto pdxWrapper2 = std::dynamic_pointer_cast<PdxWrapper>(region0->get(key));
+    auto nonPdxType2 = std::static_pointer_cast<PdxTests::TestDiffTypePdxSV1>(
+        pdxWrapper2->getObject());
 
     // Equal check
-    bool isEqual = npt1->equals(*npt2);
+    bool isEqual = nonPdxType1->equals(*nonPdxType2);
     LOGDEBUG("putFromVersion1_PS isEqual = %d", isEqual);
     ASSERT(isEqual == true,
            "Task putFromVersion1_PS:Objects of type TestPdxSerializerForV1 "
@@ -256,102 +249,89 @@ END_TASK_DEFINITION
 
 DUNIT_TASK_DEFINITION(CLIENT2, putFromVersion2_PS)
   {
-    auto regPtr0 = getHelper()->getRegion("DistRegionAck");
+    auto region0 = getHelper()->getRegion("DistRegionAck");
     auto key = CacheableKey::create(1);
 
-    auto serializationRegistry =
-        CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
-            ->getSerializationRegistry();
-    serializationRegistry->setPdxSerializer(
-        std::shared_ptr<PdxSerializer>(new TestPdxSerializerForV2));
-
-    auto pdxSerializer =
-        CacheRegionHelper::getCacheImpl(getHelper()->getCache().get())
-            ->getSerializationRegistry()
-            ->getPdxSerializer();
+    CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
+        ->getTypeRegistry()
+        .registerPdxSerializer(
+            std::shared_ptr<PdxSerializer>(new TestPdxSerializerForV2));
 
     // Create New object and wrap it in PdxWrapper (owner)
-    auto npt1 = std::make_shared<PdxTests::TestDiffTypePdxSV2>(true);
-    auto pdxobj =
-        std::make_shared<PdxWrapper>(npt1, V2CLASSNAME4, pdxSerializer);
+    auto nonPdxType1 = std::make_shared<PdxTests::TestDiffTypePdxSV2>(true);
+    auto pdxWrapper = std::make_shared<PdxWrapper>(nonPdxType1, V2CLASSNAME4);
 
     // PUT
-    regPtr0->put(key, pdxobj);
+    region0->put(key, pdxWrapper);
 
     // GET
-    auto obj2 = std::dynamic_pointer_cast<PdxWrapper>(regPtr0->get(key));
-    auto npt2 = std::static_pointer_cast<PdxTests::TestDiffTypePdxSV2>(
-        obj2->getObject());
+    auto pdxWrapper2 = std::dynamic_pointer_cast<PdxWrapper>(region0->get(key));
+    auto nonPdxType2 = std::static_pointer_cast<PdxTests::TestDiffTypePdxSV2>(
+        pdxWrapper2->getObject());
 
     // Equal check
-    bool isEqual = npt1->equals(*npt2);
+    bool isEqual = nonPdxType1->equals(*nonPdxType2);
     LOGDEBUG("putFromVersion2_PS isEqual = %d", isEqual);
     ASSERT(isEqual == true,
            "Task putFromVersion2_PS:Objects of type TestPdxSerializerForV2 "
            "should be equal");
 
     auto key2 = CacheableKey::create(2);
-    regPtr0->put(key2, pdxobj);
+    region0->put(key2, pdxWrapper);
   }
 END_TASK_DEFINITION
 
 DUNIT_TASK_DEFINITION(CLIENT1, getputFromVersion1_PS)
   {
-    auto regPtr0 = getHelper()->getRegion("DistRegionAck");
+    auto region0 = getHelper()->getRegion("DistRegionAck");
     auto key = CacheableKey::create(1);
 
     // GET
-    auto obj2 = std::dynamic_pointer_cast<PdxWrapper>(regPtr0->get(key));
-    auto npt2 = std::static_pointer_cast<PdxTests::TestDiffTypePdxSV1>(
-        obj2->getObject());
+    auto pdxWrapper2 = std::dynamic_pointer_cast<PdxWrapper>(region0->get(key));
+    auto nonPdxType2 = std::static_pointer_cast<PdxTests::TestDiffTypePdxSV1>(
+        pdxWrapper2->getObject());
 
     // Create New object and Compare
-    auto npt1 = std::make_shared<PdxTests::TestDiffTypePdxSV1>(true);
-    bool isEqual = npt1->equals(*npt2);
+    auto nonPdxType1 = std::make_shared<PdxTests::TestDiffTypePdxSV1>(true);
+    bool isEqual = nonPdxType1->equals(*nonPdxType2);
     LOGDEBUG("getputFromVersion1_PS-1 isEqual = %d", isEqual);
     ASSERT(isEqual == true,
            "Task getputFromVersion1_PS:Objects of type TestPdxSerializerForV1 "
            "should be equal");
 
     // PUT
-    regPtr0->put(key, obj2);
+    region0->put(key, pdxWrapper2);
 
     auto key2 = CacheableKey::create(2);
-    obj2 = std::dynamic_pointer_cast<PdxWrapper>(regPtr0->get(key2));
+    pdxWrapper2 = std::dynamic_pointer_cast<PdxWrapper>(region0->get(key2));
     auto pRet = std::static_pointer_cast<PdxTests::TestDiffTypePdxSV1>(
-        obj2->getObject());
-    isEqual = npt1->equals(*pRet);
+        pdxWrapper2->getObject());
+    isEqual = nonPdxType1->equals(*pRet);
     LOGDEBUG("getputFromVersion1_PS-2 isEqual = %d", isEqual);
     ASSERT(isEqual == true,
            "Task getputFromVersion1_PS:Objects of type TestPdxSerializerForV1 "
            "should be equal");
 
-    auto pdxSerializer =
-        CacheRegionHelper::getCacheImpl(getHelper()->getCache().get())
-            ->getSerializationRegistry()
-            ->getPdxSerializer();
-
     // Get then Put.. this should Not merge data back
-    auto pdxobj =
-        std::make_shared<PdxWrapper>(npt1, V1CLASSNAME2, pdxSerializer);
-    regPtr0->put(key2, pdxobj);
+    auto pdxWrapper = std::make_shared<PdxWrapper>(nonPdxType1, V1CLASSNAME2);
+    region0->put(key2, pdxWrapper);
   }
 END_TASK_DEFINITION
 
 DUNIT_TASK_DEFINITION(CLIENT2, getAtVersion2_PS)
   {
-    auto regPtr0 = getHelper()->getRegion("DistRegionAck");
+    auto region0 = getHelper()->getRegion("DistRegionAck");
     auto key = CacheableKey::create(1);
 
     // New object
-    auto np = new PdxTests::TestDiffTypePdxSV2(true);
+    auto testDiffTpePdxSV2 = new PdxTests::TestDiffTypePdxSV2(true);
 
     // GET
-    auto obj2 = std::dynamic_pointer_cast<PdxWrapper>(regPtr0->get(key));
+    auto pdxWrapper2 = std::dynamic_pointer_cast<PdxWrapper>(region0->get(key));
     auto pRet = std::static_pointer_cast<PdxTests::TestDiffTypePdxSV2>(
-        obj2->getObject());
+        pdxWrapper2->getObject());
 
-    bool isEqual = np->equals(*pRet);
+    bool isEqual = testDiffTpePdxSV2->equals(*pRet);
     LOGDEBUG("getAtVersion2_PS-1 isEqual = %d", isEqual);
     ASSERT(
         isEqual == true,
@@ -359,12 +339,12 @@ DUNIT_TASK_DEFINITION(CLIENT2, getAtVersion2_PS)
         "be equal");
 
     auto key2 = CacheableKey::create(2);
-    np = new PdxTests::TestDiffTypePdxSV2(true);
+    testDiffTpePdxSV2 = new PdxTests::TestDiffTypePdxSV2(true);
 
-    obj2 = std::dynamic_pointer_cast<PdxWrapper>(regPtr0->get(key2));
+    pdxWrapper2 = std::dynamic_pointer_cast<PdxWrapper>(region0->get(key2));
     pRet = std::static_pointer_cast<PdxTests::TestDiffTypePdxSV2>(
-        obj2->getObject());
-    isEqual = np->equals(*pRet);
+        pdxWrapper2->getObject());
+    isEqual = testDiffTpePdxSV2->equals(*pRet);
 
     LOGDEBUG("getAtVersion2_PS-2 isEqual = %d", isEqual);
     ASSERT(
diff --git a/cppcache/integration-test/ThinClientPdxSerializers.hpp b/cppcache/integration-test/ThinClientPdxSerializers.hpp
index 336df75..66e2293 100644
--- a/cppcache/integration-test/ThinClientPdxSerializers.hpp
+++ b/cppcache/integration-test/ThinClientPdxSerializers.hpp
@@ -30,17 +30,17 @@ class TestPdxSerializer : public PdxSerializer {
            "Unexpected classname in deallocate()");
     LOG("TestPdxSerializer::deallocate called");
     if (className == CLASSNAME1) {
-      PdxTests::NonPdxType *npt =
+      PdxTests::NonPdxType *nonPdxType =
           reinterpret_cast<PdxTests::NonPdxType *>(testObject);
-      delete npt;
+      delete nonPdxType;
     } else {
-      PdxTests::NonPdxAddress *npa =
+      PdxTests::NonPdxAddress *nonPdxAddress =
           reinterpret_cast<PdxTests::NonPdxAddress *>(testObject);
-      delete npa;
+      delete nonPdxAddress;
     }
   }
 
-  static size_t objectSize(const std::shared_ptr<const void> & /*testObject*/,
+  static size_t objectSize(const std::shared_ptr<const void> &,
                            const std::string &className) {
     ASSERT(className == CLASSNAME1 || className == CLASSNAME2,
            "Unexpected classname in objectSize()");
@@ -56,126 +56,120 @@ class TestPdxSerializer : public PdxSerializer {
 
   std::shared_ptr<void> fromDataForAddress(PdxReader &pr) {
     try {
-      auto npa = std::make_shared<PdxTests::NonPdxAddress>();
-      npa->_aptNumber = pr.readInt("_aptNumber");
-      npa->_street = pr.readString("_street");
-      npa->_city = pr.readString("_city");
-      return npa;
+      auto nonPdxAddress = std::make_shared<PdxTests::NonPdxAddress>();
+      nonPdxAddress->_aptNumber = pr.readInt("_aptNumber");
+      nonPdxAddress->_street = pr.readString("_street");
+      nonPdxAddress->_city = pr.readString("_city");
+      return nonPdxAddress;
     } catch (...) {
       return nullptr;
     }
   }
 
   std::shared_ptr<void> fromData(const std::string &className,
-                                 PdxReader &pr) override {
+                                 PdxReader &pdxReader) override {
     ASSERT(className == CLASSNAME1 || className == CLASSNAME2,
            "Unexpected classname in fromData");
 
     if (className == CLASSNAME2) {
-      return fromDataForAddress(pr);
+      return fromDataForAddress(pdxReader);
     }
 
-    auto npt = std::make_shared<PdxTests::NonPdxType>(
-        CacheRegionHelper::getCacheImpl(getHelper()->getCache().get())
-            ->getSerializationRegistry()
-            ->getPdxSerializer());
+    auto nonPdxType = std::make_shared<PdxTests::NonPdxType>();
 
     try {
       auto Lengtharr = new int32_t[2];
       int32_t arrLen = 0;
-      npt->m_byteByteArray =
-          pr.readArrayOfByteArrays("m_byteByteArray", arrLen, &Lengtharr);
+      nonPdxType->m_byteByteArray = pdxReader.readArrayOfByteArrays(
+          "m_byteByteArray", arrLen, &Lengtharr);
       // TODO::need to write compareByteByteArray() and check for
       // m_byteByteArray elements
 
-      npt->m_char = pr.readChar("m_char");
+      nonPdxType->m_char = pdxReader.readChar("m_char");
       // GenericValCompare
 
-      npt->m_bool = pr.readBoolean("m_bool");
+      nonPdxType->m_bool = pdxReader.readBoolean("m_bool");
       // GenericValCompare
-      npt->m_boolArray = pr.readBooleanArray("m_boolArray");
+      nonPdxType->m_boolArray = pdxReader.readBooleanArray("m_boolArray");
 
-      npt->m_byte = pr.readByte("m_byte");
-      npt->m_byteArray = pr.readByteArray("m_byteArray");
-      npt->m_charArray = pr.readCharArray("m_charArray");
+      nonPdxType->m_byte = pdxReader.readByte("m_byte");
+      nonPdxType->m_byteArray = pdxReader.readByteArray("m_byteArray");
+      nonPdxType->m_charArray = pdxReader.readCharArray("m_charArray");
 
-      npt->m_arraylist = std::dynamic_pointer_cast<CacheableArrayList>(
-          pr.readObject("m_arraylist"));
+      nonPdxType->m_arraylist = std::dynamic_pointer_cast<CacheableArrayList>(
+          pdxReader.readObject("m_arraylist"));
 
-      npt->m_map =
-          std::dynamic_pointer_cast<CacheableHashMap>(pr.readObject("m_map"));
+      nonPdxType->m_map = std::dynamic_pointer_cast<CacheableHashMap>(
+          pdxReader.readObject("m_map"));
       // TODO:Check for the size
 
-      npt->m_hashtable = std::dynamic_pointer_cast<CacheableHashTable>(
-          pr.readObject("m_hashtable"));
+      nonPdxType->m_hashtable = std::dynamic_pointer_cast<CacheableHashTable>(
+          pdxReader.readObject("m_hashtable"));
       // TODO:Check for the size
 
-      npt->m_vector =
-          std::dynamic_pointer_cast<CacheableVector>(pr.readObject("m_vector"));
+      nonPdxType->m_vector = std::dynamic_pointer_cast<CacheableVector>(
+          pdxReader.readObject("m_vector"));
       // TODO::Check for size
 
-      npt->m_chs =
-          std::dynamic_pointer_cast<CacheableHashSet>(pr.readObject("m_chs"));
+      nonPdxType->m_chs = std::dynamic_pointer_cast<CacheableHashSet>(
+          pdxReader.readObject("m_chs"));
       // TODO::Size check
 
-      npt->m_clhs = std::dynamic_pointer_cast<CacheableLinkedHashSet>(
-          pr.readObject("m_clhs"));
+      nonPdxType->m_clhs = std::dynamic_pointer_cast<CacheableLinkedHashSet>(
+          pdxReader.readObject("m_clhs"));
       // TODO:Size check
 
-      npt->m_string = pr.readString("m_string");  // GenericValCompare
-      npt->m_date = pr.readDate("m_dateTime");    // compareData
-
-      npt->m_double = pr.readDouble("m_double");
-
-      npt->m_doubleArray =
-          pr.readDoubleArray("m_doubleArray");
-      npt->m_float = pr.readFloat("m_float");
-      npt->m_floatArray =
-          pr.readFloatArray("m_floatArray");
-      npt->m_int16 = pr.readShort("m_int16");
-      npt->m_int32 = pr.readInt("m_int32");
-      npt->m_long = pr.readLong("m_long");
-      npt->m_int32Array = pr.readIntArray("m_int32Array");
-      npt->m_longArray = pr.readLongArray("m_longArray");
-      npt->m_int16Array =
-          pr.readShortArray("m_int16Array");
-      npt->m_sbyte = pr.readByte("m_sbyte");
-      npt->m_sbyteArray = pr.readByteArray("m_sbyteArray");
-      npt->m_stringArray = pr.readStringArray("m_stringArray");
-      npt->m_uint16 = pr.readShort("m_uint16");
-      npt->m_uint32 = pr.readInt("m_uint32");
-      npt->m_ulong = pr.readLong("m_ulong");
-      npt->m_uint32Array = pr.readIntArray("m_uint32Array");
-      npt->m_ulongArray = pr.readLongArray("m_ulongArray");
-      npt->m_uint16Array = pr.readShortArray("m_uint16Array");
-      // LOGINFO("PdxType::readInt() start...");
-
-      npt->m_byte252 = pr.readByteArray("m_byte252");
-      npt->m_byte253 = pr.readByteArray("m_byte253");
-      npt->m_byte65535 = pr.readByteArray("m_byte65535");
-      npt->m_byte65536 = pr.readByteArray("m_byte65536");
-
-      npt->m_pdxEnum = pr.readObject("m_pdxEnum");
-
-      npt->m_address = pr.readObject("m_address");
-
-      npt->m_objectArray = pr.readObjectArray("m_objectArray");
+      nonPdxType->m_string =
+          pdxReader.readString("m_string");  // GenericValCompare
+      nonPdxType->m_date = pdxReader.readDate("m_dateTime");  // compareData
+
+      nonPdxType->m_double = pdxReader.readDouble("m_double");
+
+      nonPdxType->m_doubleArray = pdxReader.readDoubleArray("m_doubleArray");
+      nonPdxType->m_float = pdxReader.readFloat("m_float");
+      nonPdxType->m_floatArray = pdxReader.readFloatArray("m_floatArray");
+      nonPdxType->m_int16 = pdxReader.readShort("m_int16");
+      nonPdxType->m_int32 = pdxReader.readInt("m_int32");
+      nonPdxType->m_long = pdxReader.readLong("m_long");
+      nonPdxType->m_int32Array = pdxReader.readIntArray("m_int32Array");
+      nonPdxType->m_longArray = pdxReader.readLongArray("m_longArray");
+      nonPdxType->m_int16Array = pdxReader.readShortArray("m_int16Array");
+      nonPdxType->m_sbyte = pdxReader.readByte("m_sbyte");
+      nonPdxType->m_sbyteArray = pdxReader.readByteArray("m_sbyteArray");
+      nonPdxType->m_stringArray = pdxReader.readStringArray("m_stringArray");
+      nonPdxType->m_uint16 = pdxReader.readShort("m_uint16");
+      nonPdxType->m_uint32 = pdxReader.readInt("m_uint32");
+      nonPdxType->m_ulong = pdxReader.readLong("m_ulong");
+      nonPdxType->m_uint32Array = pdxReader.readIntArray("m_uint32Array");
+      nonPdxType->m_ulongArray = pdxReader.readLongArray("m_ulongArray");
+      nonPdxType->m_uint16Array = pdxReader.readShortArray("m_uint16Array");
+
+      nonPdxType->m_byte252 = pdxReader.readByteArray("m_byte252");
+      nonPdxType->m_byte253 = pdxReader.readByteArray("m_byte253");
+      nonPdxType->m_byte65535 = pdxReader.readByteArray("m_byte65535");
+      nonPdxType->m_byte65536 = pdxReader.readByteArray("m_byte65536");
+
+      nonPdxType->m_pdxEnum = pdxReader.readObject("m_pdxEnum");
+
+      nonPdxType->m_address = pdxReader.readObject("m_address");
+
+      nonPdxType->m_objectArray = pdxReader.readObjectArray("m_objectArray");
 
       LOGINFO("TestPdxSerializer: NonPdxType fromData() Done.");
     } catch (...) {
       return nullptr;
     }
-    return npt;
+    return nonPdxType;
   }
 
   bool toDataForAddress(const std::shared_ptr<const void> &testObject,
-                        PdxWriter &pw) {
+                        PdxWriter &pdxWriter) {
     try {
-      auto npa =
+      auto nonPdxAddress =
           std::static_pointer_cast<const PdxTests::NonPdxAddress>(testObject);
-      pw.writeInt("_aptNumber", npa->_aptNumber);
-      pw.writeString("_street", npa->_street);
-      pw.writeString("_city", npa->_city);
+      pdxWriter.writeInt("_aptNumber", nonPdxAddress->_aptNumber);
+      pdxWriter.writeString("_street", nonPdxAddress->_street);
+      pdxWriter.writeString("_city", nonPdxAddress->_city);
       return true;
     } catch (...) {
       return false;
@@ -183,109 +177,110 @@ class TestPdxSerializer : public PdxSerializer {
   }
 
   bool toData(const std::shared_ptr<const void> &testObject,
-              const std::string &className, PdxWriter &pw) override {
+              const std::string &className, PdxWriter &pdxWriter) override {
     ASSERT(className == CLASSNAME1 || className == CLASSNAME2,
            "Unexpected classname in toData");
 
     if (className == CLASSNAME2) {
-      return toDataForAddress(testObject, pw);
+      return toDataForAddress(testObject, pdxWriter);
     }
 
-    auto npt = std::static_pointer_cast<const PdxTests::NonPdxType>(testObject);
+    auto nonPdxType =
+        std::static_pointer_cast<const PdxTests::NonPdxType>(testObject);
 
     try {
       int *lengthArr = new int[2];
 
       lengthArr[0] = 1;
       lengthArr[1] = 2;
-      pw.writeArrayOfByteArrays("m_byteByteArray", npt->m_byteByteArray, 2,
-                                lengthArr);
-      pw.writeChar("m_char", npt->m_char);
-      pw.markIdentityField("m_char");
-      pw.writeBoolean("m_bool", npt->m_bool);  // 1
-      pw.markIdentityField("m_bool");
-      pw.writeBooleanArray("m_boolArray", npt->m_boolArray);
-      pw.markIdentityField("m_boolArray");
-      pw.writeByte("m_byte", npt->m_byte);
-      pw.markIdentityField("m_byte");
-      pw.writeByteArray("m_byteArray", npt->m_byteArray);
-      pw.markIdentityField("m_byteArray");
-      pw.writeCharArray("m_charArray", npt->m_charArray);
-      pw.markIdentityField("m_charArray");
-      pw.writeObject("m_arraylist", npt->m_arraylist);
-      pw.markIdentityField("m_arraylist");
-      pw.writeObject("m_map", npt->m_map);
-      pw.markIdentityField("m_map");
-      pw.writeObject("m_hashtable", npt->m_hashtable);
-      pw.markIdentityField("m_hashtable");
-      pw.writeObject("m_vector", npt->m_vector);
-      pw.markIdentityField("m_vector");
-      pw.writeObject("m_chs", npt->m_chs);
-      pw.markIdentityField("m_chs");
-      pw.writeObject("m_clhs", npt->m_clhs);
-      pw.markIdentityField("m_clhs");
-      pw.writeString("m_string", npt->m_string);
-      pw.markIdentityField("m_string");
-      pw.writeDate("m_dateTime", npt->m_date);
-      pw.markIdentityField("m_dateTime");
-      pw.writeDouble("m_double", npt->m_double);
-      pw.markIdentityField("m_double");
-      pw.writeDoubleArray("m_doubleArray", npt->m_doubleArray);
-      pw.markIdentityField("m_doubleArray");
-      pw.writeFloat("m_float", npt->m_float);
-      pw.markIdentityField("m_float");
-      pw.writeFloatArray("m_floatArray", npt->m_floatArray);
-      pw.markIdentityField("m_floatArray");
-      pw.writeShort("m_int16", npt->m_int16);
-      pw.markIdentityField("m_int16");
-      pw.writeInt("m_int32", npt->m_int32);
-      pw.markIdentityField("m_int32");
-      pw.writeLong("m_long", npt->m_long);
-      pw.markIdentityField("m_long");
-      pw.writeIntArray("m_int32Array", npt->m_int32Array);
-      pw.markIdentityField("m_int32Array");
-      pw.writeLongArray("m_longArray", npt->m_longArray);
-      pw.markIdentityField("m_longArray");
-      pw.writeShortArray("m_int16Array", npt->m_int16Array);
-      pw.markIdentityField("m_int16Array");
-      pw.writeByte("m_sbyte", npt->m_sbyte);
-      pw.markIdentityField("m_sbyte");
-      pw.writeByteArray("m_sbyteArray", npt->m_sbyteArray);
-      pw.markIdentityField("m_sbyteArray");
+      pdxWriter.writeArrayOfByteArrays(
+          "m_byteByteArray", nonPdxType->m_byteByteArray, 2, lengthArr);
+      pdxWriter.writeChar("m_char", nonPdxType->m_char);
+      pdxWriter.markIdentityField("m_char");
+      pdxWriter.writeBoolean("m_bool", nonPdxType->m_bool);  // 1
+      pdxWriter.markIdentityField("m_bool");
+      pdxWriter.writeBooleanArray("m_boolArray", nonPdxType->m_boolArray);
+      pdxWriter.markIdentityField("m_boolArray");
+      pdxWriter.writeByte("m_byte", nonPdxType->m_byte);
+      pdxWriter.markIdentityField("m_byte");
+      pdxWriter.writeByteArray("m_byteArray", nonPdxType->m_byteArray);
+      pdxWriter.markIdentityField("m_byteArray");
+      pdxWriter.writeCharArray("m_charArray", nonPdxType->m_charArray);
+      pdxWriter.markIdentityField("m_charArray");
+      pdxWriter.writeObject("m_arraylist", nonPdxType->m_arraylist);
+      pdxWriter.markIdentityField("m_arraylist");
+      pdxWriter.writeObject("m_map", nonPdxType->m_map);
+      pdxWriter.markIdentityField("m_map");
+      pdxWriter.writeObject("m_hashtable", nonPdxType->m_hashtable);
+      pdxWriter.markIdentityField("m_hashtable");
+      pdxWriter.writeObject("m_vector", nonPdxType->m_vector);
+      pdxWriter.markIdentityField("m_vector");
+      pdxWriter.writeObject("m_chs", nonPdxType->m_chs);
+      pdxWriter.markIdentityField("m_chs");
+      pdxWriter.writeObject("m_clhs", nonPdxType->m_clhs);
+      pdxWriter.markIdentityField("m_clhs");
+      pdxWriter.writeString("m_string", nonPdxType->m_string);
+      pdxWriter.markIdentityField("m_string");
+      pdxWriter.writeDate("m_dateTime", nonPdxType->m_date);
+      pdxWriter.markIdentityField("m_dateTime");
+      pdxWriter.writeDouble("m_double", nonPdxType->m_double);
+      pdxWriter.markIdentityField("m_double");
+      pdxWriter.writeDoubleArray("m_doubleArray", nonPdxType->m_doubleArray);
+      pdxWriter.markIdentityField("m_doubleArray");
+      pdxWriter.writeFloat("m_float", nonPdxType->m_float);
+      pdxWriter.markIdentityField("m_float");
+      pdxWriter.writeFloatArray("m_floatArray", nonPdxType->m_floatArray);
+      pdxWriter.markIdentityField("m_floatArray");
+      pdxWriter.writeShort("m_int16", nonPdxType->m_int16);
+      pdxWriter.markIdentityField("m_int16");
+      pdxWriter.writeInt("m_int32", nonPdxType->m_int32);
+      pdxWriter.markIdentityField("m_int32");
+      pdxWriter.writeLong("m_long", nonPdxType->m_long);
+      pdxWriter.markIdentityField("m_long");
+      pdxWriter.writeIntArray("m_int32Array", nonPdxType->m_int32Array);
+      pdxWriter.markIdentityField("m_int32Array");
+      pdxWriter.writeLongArray("m_longArray", nonPdxType->m_longArray);
+      pdxWriter.markIdentityField("m_longArray");
+      pdxWriter.writeShortArray("m_int16Array", nonPdxType->m_int16Array);
+      pdxWriter.markIdentityField("m_int16Array");
+      pdxWriter.writeByte("m_sbyte", nonPdxType->m_sbyte);
+      pdxWriter.markIdentityField("m_sbyte");
+      pdxWriter.writeByteArray("m_sbyteArray", nonPdxType->m_sbyteArray);
+      pdxWriter.markIdentityField("m_sbyteArray");
 
       int *strlengthArr = new int[2];
 
       strlengthArr[0] = 5;
       strlengthArr[1] = 5;
-      pw.writeStringArray("m_stringArray", npt->m_stringArray);
-      pw.markIdentityField("m_stringArray");
-      pw.writeShort("m_uint16", npt->m_uint16);
-      pw.markIdentityField("m_uint16");
-      pw.writeInt("m_uint32", npt->m_uint32);
-      pw.markIdentityField("m_uint32");
-      pw.writeLong("m_ulong", npt->m_ulong);
-      pw.markIdentityField("m_ulong");
-      pw.writeIntArray("m_uint32Array", npt->m_uint32Array);
-      pw.markIdentityField("m_uint32Array");
-      pw.writeLongArray("m_ulongArray", npt->m_ulongArray);
-      pw.markIdentityField("m_ulongArray");
-      pw.writeShortArray("m_uint16Array", npt->m_uint16Array);
-      pw.markIdentityField("m_uint16Array");
-
-      pw.writeByteArray("m_byte252", npt->m_byte252);
-      pw.markIdentityField("m_byte252");
-      pw.writeByteArray("m_byte253", npt->m_byte253);
-      pw.markIdentityField("m_byte253");
-      pw.writeByteArray("m_byte65535", npt->m_byte65535);
-      pw.markIdentityField("m_byte65535");
-      pw.writeByteArray("m_byte65536", npt->m_byte65536);
-      pw.markIdentityField("m_byte65536");
-
-      pw.writeObject("m_pdxEnum", npt->m_pdxEnum);
-      pw.markIdentityField("m_pdxEnum");
-
-      pw.writeObject("m_address", npt->m_objectArray);
-      pw.writeObjectArray("m_objectArray", npt->m_objectArray);
+      pdxWriter.writeStringArray("m_stringArray", nonPdxType->m_stringArray);
+      pdxWriter.markIdentityField("m_stringArray");
+      pdxWriter.writeShort("m_uint16", nonPdxType->m_uint16);
+      pdxWriter.markIdentityField("m_uint16");
+      pdxWriter.writeInt("m_uint32", nonPdxType->m_uint32);
+      pdxWriter.markIdentityField("m_uint32");
+      pdxWriter.writeLong("m_ulong", nonPdxType->m_ulong);
+      pdxWriter.markIdentityField("m_ulong");
+      pdxWriter.writeIntArray("m_uint32Array", nonPdxType->m_uint32Array);
+      pdxWriter.markIdentityField("m_uint32Array");
+      pdxWriter.writeLongArray("m_ulongArray", nonPdxType->m_ulongArray);
+      pdxWriter.markIdentityField("m_ulongArray");
+      pdxWriter.writeShortArray("m_uint16Array", nonPdxType->m_uint16Array);
+      pdxWriter.markIdentityField("m_uint16Array");
+
+      pdxWriter.writeByteArray("m_byte252", nonPdxType->m_byte252);
+      pdxWriter.markIdentityField("m_byte252");
+      pdxWriter.writeByteArray("m_byte253", nonPdxType->m_byte253);
+      pdxWriter.markIdentityField("m_byte253");
+      pdxWriter.writeByteArray("m_byte65535", nonPdxType->m_byte65535);
+      pdxWriter.markIdentityField("m_byte65535");
+      pdxWriter.writeByteArray("m_byte65536", nonPdxType->m_byte65536);
+      pdxWriter.markIdentityField("m_byte65536");
+
+      pdxWriter.writeObject("m_pdxEnum", nonPdxType->m_pdxEnum);
+      pdxWriter.markIdentityField("m_pdxEnum");
+
+      pdxWriter.writeObject("m_address", nonPdxType->m_objectArray);
+      pdxWriter.writeObjectArray("m_objectArray", nonPdxType->m_objectArray);
 
       LOG("TestPdxSerializer: NonPdxType toData() Done......");
     } catch (...) {
diff --git a/cppcache/src/Cache.cpp b/cppcache/src/Cache.cpp
index 83baeba..b0350b1 100644
--- a/cppcache/src/Cache.cpp
+++ b/cppcache/src/Cache.cpp
@@ -55,7 +55,7 @@ bool Cache::isClosed() const { return m_cacheImpl->isClosed(); }
  * Returns the type registry that this cache was
  * {@link CacheFactory::create created} with.
  */
-TypeRegistry& Cache::getTypeRegistry() {
+TypeRegistry& Cache::getTypeRegistry() const {
   return m_cacheImpl->getTypeRegistry();
 }
 
diff --git a/cppcache/src/DataInput.cpp b/cppcache/src/DataInput.cpp
index 6ff55d7..051f4fc 100644
--- a/cppcache/src/DataInput.cpp
+++ b/cppcache/src/DataInput.cpp
@@ -44,7 +44,7 @@ const SerializationRegistry& DataInput::getSerializationRegistry() const {
   return *m_cache->getSerializationRegistry();
 }
 
-const Cache* DataInput::getCache() { return m_cache->getCache(); }
+Cache* DataInput::getCache() const { return m_cache->getCache(); }
 
 template <class _Traits, class _Allocator>
 void DataInput::readJavaModifiedUtf8(
diff --git a/cppcache/src/DataOutput.cpp b/cppcache/src/DataOutput.cpp
index 98b9837..46c2577 100644
--- a/cppcache/src/DataOutput.cpp
+++ b/cppcache/src/DataOutput.cpp
@@ -138,7 +138,7 @@ const SerializationRegistry& DataOutput::getSerializationRegistry() const {
   return *m_cache->getSerializationRegistry();
 }
 
-const Cache* DataOutput::getCache() { return m_cache->getCache(); }
+Cache* DataOutput::getCache() const { return m_cache->getCache(); }
 
 template <class _Traits, class _Allocator>
 void DataOutput::writeJavaModifiedUtf8(
diff --git a/cppcache/src/PdxLocalReader.cpp b/cppcache/src/PdxLocalReader.cpp
index 97c3d50..cdc5806 100644
--- a/cppcache/src/PdxLocalReader.cpp
+++ b/cppcache/src/PdxLocalReader.cpp
@@ -278,6 +278,10 @@ std::shared_ptr<PdxUnreadFields> PdxLocalReader::readUnreadFields() {
   return m_pdxRemotePreserveData;
 }
 
+std::shared_ptr<PdxSerializer> PdxLocalReader::getPdxSerializer() const {
+  return m_dataInput->getCache()->getTypeRegistry().getPdxSerializer();
+}
+
 }  // namespace client
 }  // namespace geode
 }  // namespace apache
diff --git a/cppcache/src/PdxLocalReader.hpp b/cppcache/src/PdxLocalReader.hpp
index b837914..e955fb0 100644
--- a/cppcache/src/PdxLocalReader.hpp
+++ b/cppcache/src/PdxLocalReader.hpp
@@ -128,6 +128,8 @@ class PdxLocalReader : public PdxReader {
 
   virtual std::shared_ptr<PdxUnreadFields> readUnreadFields() override;
 
+  std::shared_ptr<PdxSerializer> getPdxSerializer() const override;
+
  protected:
   std::shared_ptr<PdxTypeRegistry> m_pdxTypeRegistry;
 };
diff --git a/cppcache/src/PdxLocalWriter.cpp b/cppcache/src/PdxLocalWriter.cpp
index 3734bed..6e2ad12 100644
--- a/cppcache/src/PdxLocalWriter.cpp
+++ b/cppcache/src/PdxLocalWriter.cpp
@@ -138,6 +138,10 @@ PdxWriter& PdxLocalWriter::writeUnreadFields(
   return *this;
 }
 
+std::shared_ptr<PdxSerializer> PdxLocalWriter::getPdxSerializer() const {
+  return m_dataOutput->getCache()->getTypeRegistry().getPdxSerializer();
+}
+
 int32_t PdxLocalWriter::calculateLenWithOffsets() {
   auto bufferLen = m_dataOutput->getBufferLength() - m_startPositionOffset;
   int32_t totalOffsets = 0;
diff --git a/cppcache/src/PdxLocalWriter.hpp b/cppcache/src/PdxLocalWriter.hpp
index 14f7697..9b2c74c 100644
--- a/cppcache/src/PdxLocalWriter.hpp
+++ b/cppcache/src/PdxLocalWriter.hpp
@@ -194,6 +194,8 @@ class PdxLocalWriter : public PdxWriter {
   virtual PdxWriter& writeUnreadFields(
       std::shared_ptr<PdxUnreadFields> unread) override;
 
+  std::shared_ptr<PdxSerializer> getPdxSerializer() const override;
+
   // this is used to get pdx stream when WriteablePdxStream udpadates the field
   // It should be called after pdx stream has been written to output
   uint8_t* getPdxStream(int& pdxLen);
diff --git a/cppcache/src/PdxWrapper.cpp b/cppcache/src/PdxWrapper.cpp
index 57bdb1e..135b081 100644
--- a/cppcache/src/PdxWrapper.cpp
+++ b/cppcache/src/PdxWrapper.cpp
@@ -25,35 +25,8 @@ namespace apache {
 namespace geode {
 namespace client {
 
-PdxWrapper::PdxWrapper(std::shared_ptr<void> userObject, std::string className,
-                       std::shared_ptr<PdxSerializer> pdxSerializerPtr)
-    : m_userObject(userObject),
-      m_className(className),
-      m_serializer(pdxSerializerPtr) {
-  if (m_serializer == nullptr) {
-    LOGERROR("No registered PDX serializer found for PdxWrapper");
-    throw IllegalArgumentException(
-        "No registered PDX serializer found for PdxWrapper");
-  }
-
-  /* m_sizer can be nullptr - required only if heap LRU is enabled */
-  m_sizer = m_serializer->getObjectSizer(className);
-}
-
-PdxWrapper::PdxWrapper(std::string className,
-                       std::shared_ptr<PdxSerializer> pdxSerializerPtr)
-    : m_className(className), m_serializer(pdxSerializerPtr) {
-  if (m_serializer == nullptr) {
-    LOGERROR(
-        "No registered PDX serializer found for PdxWrapper deserialization");
-    throw IllegalArgumentException(
-        "No registered PDX serializer found for PdxWrapper deserialization");
-  }
-
-  /* m_sizer can be nullptr - required only if heap LRU is enabled */
-  m_sizer = m_serializer->getObjectSizer(className);
-
-  m_userObject = nullptr;
+PdxWrapper::PdxWrapper(std::shared_ptr<void> userObject, std::string className)
+    : m_userObject(userObject), m_className(className) {
 }
 
 std::shared_ptr<void> PdxWrapper::getObject() { return m_userObject; }
@@ -76,7 +49,7 @@ int32_t PdxWrapper::hashcode() const {
 
 void PdxWrapper::toData(PdxWriter& output) const {
   if (m_userObject != nullptr) {
-    m_serializer->toData(m_userObject, m_className.c_str(), output);
+    output.getPdxSerializer()->toData(m_userObject, m_className, output);
   } else {
     LOGERROR("User object is nullptr or detached in PdxWrapper toData");
     throw IllegalStateException(
@@ -85,7 +58,7 @@ void PdxWrapper::toData(PdxWriter& output) const {
 }
 
 void PdxWrapper::fromData(PdxReader& input) {
-  m_userObject = m_serializer->fromData(m_className.c_str(), input);
+  m_userObject = input.getPdxSerializer()->fromData(m_className, input);
 }
 
 void PdxWrapper::toData(DataOutput& output) const {
@@ -98,18 +71,10 @@ void PdxWrapper::fromData(DataInput&) {
       "PdxWrapper fromData should not have been called");
 }
 
-size_t PdxWrapper::objectSize() const {
-  if (m_sizer == nullptr || m_userObject == nullptr) {
-    return 0;
-  } else {
-    return m_sizer(m_userObject, m_className.c_str());
-  }
-}
-
 std::string PdxWrapper::toString() const {
   std::string message = "PdxWrapper for ";
   message += m_className;
-  return message.c_str();
+  return message;
 }
 
 }  // namespace client
diff --git a/cppcache/src/SerializationRegistry.cpp b/cppcache/src/SerializationRegistry.cpp
index 625b360..51c9760 100644
--- a/cppcache/src/SerializationRegistry.cpp
+++ b/cppcache/src/SerializationRegistry.cpp
@@ -233,14 +233,16 @@ void SerializationRegistry::addType2(int64_t compId, TypeFactoryMethod func) {
 void SerializationRegistry::removeType2(int64_t compId) {
   theTypeMap.unbind2(compId);
 }
+
 std::shared_ptr<PdxSerializable> SerializationRegistry::getPdxType(
     const std::string& className) const {
   TypeFactoryMethodPdx objectType = nullptr;
   theTypeMap.findPdxType(className, objectType);
-  std::shared_ptr<PdxSerializable> pdxObj;
+  std::shared_ptr<PdxSerializable> pdxSerializable;
+
   if (nullptr == objectType) {
     try {
-      pdxObj = std::make_shared<PdxWrapper>(className, pdxSerializer);
+      pdxSerializable = std::make_shared<PdxWrapper>(nullptr, className);
     } catch (const Exception&) {
       LOGERROR("Unregistered class " + className +
                " during PDX deserialization: Did the application register the "
@@ -249,9 +251,9 @@ std::shared_ptr<PdxSerializable> SerializationRegistry::getPdxType(
           "Unregistered class or serializer in PDX deserialization");
     }
   } else {
-    pdxObj = objectType();
+    pdxSerializable = objectType();
   }
-  return pdxObj;
+  return pdxSerializable;
 }
 
 void SerializationRegistry::setPdxSerializer(
diff --git a/cppcache/src/TypeRegistry.cpp b/cppcache/src/TypeRegistry.cpp
index e5d2314..2529270 100644
--- a/cppcache/src/TypeRegistry.cpp
+++ b/cppcache/src/TypeRegistry.cpp
@@ -26,17 +26,18 @@
 TypeRegistry::TypeRegistry(CacheImpl* cache) : m_cache(cache) {}
 
 void TypeRegistry::registerType(TypeFactoryMethod creationFunction) {
-  m_cache->getSerializationRegistry()
-         ->addType(creationFunction);
+  m_cache->getSerializationRegistry()->addType(creationFunction);
 }
 
 void TypeRegistry::registerPdxType(TypeFactoryMethodPdx creationFunction) {
-  m_cache->getSerializationRegistry()
-         ->addPdxType(creationFunction);
+  m_cache->getSerializationRegistry()->addPdxType(creationFunction);
 }
 
 void TypeRegistry::registerPdxSerializer(
     std::shared_ptr<PdxSerializer> pdxSerializer) {
-  m_cache->getSerializationRegistry()
-         ->setPdxSerializer(pdxSerializer);
+  m_cache->getSerializationRegistry()->setPdxSerializer(pdxSerializer);
+}
+
+std::shared_ptr<PdxSerializer> TypeRegistry::getPdxSerializer() {
+  return m_cache->getSerializationRegistry()->getPdxSerializer();
 }
diff --git a/examples/cpp/customserializer/main.cpp b/examples/cpp/customserializer/main.cpp
index 51cc9f6..c5ad221 100644
--- a/examples/cpp/customserializer/main.cpp
+++ b/examples/cpp/customserializer/main.cpp
@@ -47,10 +47,10 @@ int main(int argc, char **argv) {
 
   auto order1 = std::make_shared<Order>(1, "product x", 42);
   auto pdxobj1 = std::make_shared<PdxWrapper>(
-      order1, OrderSerializer::CLASS_NAME_, orderSer);
+      order1, OrderSerializer::CLASS_NAME_);
   auto order2 = std::make_shared<Order>(2, "product y", 37);
   auto pdxobj2 = std::make_shared<PdxWrapper>(
-      order2, OrderSerializer::CLASS_NAME_, orderSer);
+      order2, OrderSerializer::CLASS_NAME_);
 
   std::cout << "Storing orders in the region" << std::endl;
   region->put("Customer1", pdxobj1);
diff --git a/tests/cpp/testobject/NonPdxType.hpp b/tests/cpp/testobject/NonPdxType.hpp
index 1683076..92fd1f1 100644
--- a/tests/cpp/testobject/NonPdxType.hpp
+++ b/tests/cpp/testobject/NonPdxType.hpp
@@ -159,7 +159,7 @@ class TESTOBJECT_EXPORT NonPdxType {
  public:
   bool selfCheck();
 
-  inline void init(std::shared_ptr<PdxSerializer> pdxSerializer) {
+  inline void init() {
     m_char = 'C';
     m_bool = true;
     m_byte = 0x74;
@@ -179,9 +179,6 @@ class TESTOBJECT_EXPORT NonPdxType {
     m_boolArray[0] = true;
     m_boolArray[1] = false;
     m_boolArray[2] = true;
-    /*for(int i=0; i<3; i++){
-      m_boolArray[i] = true;
-    };*/
 
     m_byteArray = std::vector<int8_t>(2);
     m_byteArray[0] = 0x34;
@@ -289,34 +286,34 @@ class TESTOBJECT_EXPORT NonPdxType {
     m_objectArray = CacheableObjectArray::create();
     m_objectArray->push_back(std::shared_ptr<PdxWrapper>(
         new PdxWrapper(std::make_shared<NonPdxAddress>(1, "street0", "city0"),
-                       "PdxTests.Address", pdxSerializer)));
+                       "PdxTests.Address")));
     m_objectArray->push_back(std::shared_ptr<PdxWrapper>(
         new PdxWrapper(std::make_shared<NonPdxAddress>(2, "street1", "city1"),
-                       "PdxTests.Address", pdxSerializer)));
+                       "PdxTests.Address")));
     m_objectArray->push_back(std::shared_ptr<PdxWrapper>(
         new PdxWrapper(std::make_shared<NonPdxAddress>(3, "street2", "city2"),
-                       "PdxTests.Address", pdxSerializer)));
+                       "PdxTests.Address")));
     m_objectArray->push_back(std::shared_ptr<PdxWrapper>(
         new PdxWrapper(std::make_shared<NonPdxAddress>(4, "street3", "city3"),
-                       "PdxTests.Address", pdxSerializer)));
+                       "PdxTests.Address")));
     m_objectArray->push_back(std::shared_ptr<PdxWrapper>(
         new PdxWrapper(std::make_shared<NonPdxAddress>(5, "street4", "city4"),
-                       "PdxTests.Address", pdxSerializer)));
+                       "PdxTests.Address")));
     m_objectArray->push_back(std::shared_ptr<PdxWrapper>(
         new PdxWrapper(std::make_shared<NonPdxAddress>(6, "street5", "city5"),
-                       "PdxTests.Address", pdxSerializer)));
+                       "PdxTests.Address")));
     m_objectArray->push_back(std::shared_ptr<PdxWrapper>(
         new PdxWrapper(std::make_shared<NonPdxAddress>(7, "street6", "city6"),
-                       "PdxTests.Address", pdxSerializer)));
+                       "PdxTests.Address")));
     m_objectArray->push_back(std::shared_ptr<PdxWrapper>(
         new PdxWrapper(std::make_shared<NonPdxAddress>(8, "street7", "city7"),
-                       "PdxTests.Address", pdxSerializer)));
+                       "PdxTests.Address")));
     m_objectArray->push_back(std::shared_ptr<PdxWrapper>(
         new PdxWrapper(std::make_shared<NonPdxAddress>(9, "street8", "city8"),
-                       "PdxTests.Address", pdxSerializer)));
+                       "PdxTests.Address")));
     m_objectArray->push_back(std::shared_ptr<PdxWrapper>(
         new PdxWrapper(std::make_shared<NonPdxAddress>(10, "street9", "city9"),
-                       "PdxTests.Address", pdxSerializer)));
+                       "PdxTests.Address")));
 
     m_byte252 = std::vector<int8_t>(252);
     for (int i = 0; i < 252; i++) {
@@ -355,9 +352,7 @@ class TESTOBJECT_EXPORT NonPdxType {
     lengthArr[1] = 2;
   }
 
-  NonPdxType(std::shared_ptr<PdxSerializer> pdxSerializer) {
-    init(pdxSerializer);
-  }
+  NonPdxType() { init(); }
 
   inline bool compareBool(bool b, bool b2) {
     if (b == b2) return b;

-- 
To stop receiving notification emails like this one, please contact
echobravo@apache.org.

Mime
View raw message