isapego commented on a change in pull request #9370:
URL: https://github.com/apache/ignite/pull/9370#discussion_r704628227



##########
File path: 
modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_impl.h
##########
@@ -56,85 +81,161 @@ namespace ignite
 
             static void Read(BinaryReader& reader, IgniteError& dst);
         };
+    } // namespace binary
 
-        /**
-         * Write helper. Takes care of proper writing of pointers.
-         */
-        template<typename T>
-        struct WriteHelper
+    namespace impl
+    {
+        namespace binary
         {
-            template<typename W>
-            static void Write(W& writer, const T& val)
+            /**
+             * Write helper. Takes care of proper writing of pointers.
+             */
+            template<typename T>
+            struct WriteHelper
             {
-                writer.template WriteTopObject0<BinaryWriter>(val);
-            }
-        };
-
-        /**
-         * Specialization for the pointer case.
-         */
-        template<typename T>
-        struct WriteHelper<T*>
-        {
-            template<typename W>
-            static void Write(W& writer, const T* val)
+                template<typename W>
+                static void Write(W& writer, const T& val)
+                {
+                    writer.template 
WriteTopObject0<ignite::binary::BinaryWriter>(val);
+                }
+            };
+
+            /**
+             * Specialization for the pointer case.
+             */
+            template<typename T>
+            struct WriteHelper<T*>
             {
-                if (!val)
-                    writer.WriteNull0();
-                else
-                    writer.template WriteTopObject0<BinaryWriter>(*val);
-            }
-        };
-
-        /**
-         * Read helper. Takes care of proper reading of pointers.
-         */
-        template<typename T>
-        struct ReadHelper
-        {
-            template<typename R>
-            static T Read(R& reader)
+                template<typename W>
+                static void Write(W& writer, const T* val)
+                {
+                    if (!val)
+                        writer.WriteNull0();
+                    else
+                        writer.template 
WriteTopObject0<ignite::binary::BinaryWriter>(*val);
+                }
+            };
+
+            /**
+             * Read helper. Takes care of proper reading of pointers.
+             */
+            template<typename T>
+            struct ReadHelper
             {
-                T res;
-
-                Read<R>(reader, res);
-
-                return res;
-            }
-
-            template<typename R>
-            static void Read(R& reader, T& val)
+                template<typename R>
+                static T Read(R& reader)
+                {
+                    T res;
+
+                    Read<R>(reader, res);
+
+                    return res;
+                }
+
+                template<typename R>
+                static void Read(R& reader, T& val)
+                {
+                    reader.template 
ReadTopObject0<ignite::binary::BinaryReader, T>(val);
+                }
+            };
+
+            /**
+             * Specialization for the pointer case.
+             */
+            template<typename T>
+            struct ReadHelper<T*>
             {
-                reader.template ReadTopObject0<BinaryReader, T>(val);
-            }
-        };
-
-        /**
-         * Specialization for the pointer case.
-         */
-        template<typename T>
-        struct ReadHelper<T*>
-        {
-            template<typename R>
-            static T* Read(R& reader)
+                template<typename R>
+                static T* Read(R& reader)
+                {
+                    if (reader.SkipIfNull())
+                        return 0;
+
+                    std::auto_ptr<T> res(new T());
+
+                    reader.template 
ReadTopObject0<ignite::binary::BinaryReader, T>(*res);
+
+                    return res.release();
+                }
+
+                template<typename R>
+                static void Read(R& reader, T*& ptr)
+                {
+                    ptr = Read<R>(reader);
+                }
+            };
+
+            IGNITE_DECLARE_BINARY_TYPE_METHOD_CHECKER(GetAffinityFieldName, 
void(*)(std::string&));

Review comment:
       Well, it seems like there is no good solution for this - we ignore it if 
method is not present or breaking backward compatibility for our current users. 
I prefer the first approach.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to