ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akuznet...@apache.org
Subject [13/16] ignite git commit: IGNITE-4046: Added DML support to CPP platform. This closes #1432.
Date Thu, 02 Feb 2017 07:54:17 GMT
IGNITE-4046: Added DML support to CPP platform. This closes #1432.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b0bc6f0c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b0bc6f0c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b0bc6f0c

Branch: refs/heads/ignite-4436-2
Commit: b0bc6f0cb1bdcc3038f48ec0eb34f9a01044ded0
Parents: 529a545
Author: isapego <igorsapg@gmail.com>
Authored: Wed Feb 1 18:04:20 2017 +0300
Committer: devozerov <vozerov@gridgain.com>
Committed: Wed Feb 1 18:04:20 2017 +0300

----------------------------------------------------------------------
 modules/platforms/cpp/binary/Makefile.am        |   1 +
 .../platforms/cpp/binary/include/Makefile.am    |   3 +
 .../binary/binary_array_identity_resolver.h     |  64 +++
 .../ignite/binary/binary_identity_resolver.h    |  61 +++
 .../include/ignite/binary/binary_object.h       |   5 +-
 .../binary/include/ignite/binary/binary_type.h  |  16 -
 .../ignite/impl/binary/binary_object_impl.h     |   9 +-
 .../ignite/impl/binary/binary_type_impl.h       | 149 ++++++
 .../ignite/impl/binary/binary_type_snapshot.h   |  18 +-
 .../include/ignite/impl/binary/binary_utils.h   | 175 +------
 .../ignite/impl/binary/binary_writer_impl.h     |  11 +-
 .../ignite/impl/interop/interop_output_stream.h |  10 +-
 .../cpp/binary/project/vs/binary.vcxproj        |   4 +
 .../binary/project/vs/binary.vcxproj.filters    |  12 +
 .../binary/binary_array_identity_resolver.cpp   |  42 ++
 .../cpp/binary/src/binary/binary_type.cpp       |   4 +-
 .../src/impl/binary/binary_object_impl.cpp      |  10 +-
 .../src/impl/binary/binary_type_manager.cpp     |  12 +-
 .../cpp/binary/src/impl/binary/binary_utils.cpp |  80 +--
 .../src/impl/binary/binary_writer_impl.cpp      |   2 -
 .../src/impl/interop/interop_output_stream.cpp  |   5 +
 modules/platforms/cpp/common/Makefile.am        |   5 +-
 .../platforms/cpp/common/include/Makefile.am    |   1 +
 .../include/ignite/common/platform_utils.h      |  79 +++
 .../cpp/common/include/ignite/common/utils.h    | 251 +++++++--
 .../os/linux/src/common/platform_utils.cpp      |  81 +++
 .../cpp/common/os/linux/src/common/utils.cpp    | 148 ------
 .../common/os/win/src/common/platform_utils.cpp |  88 ++++
 .../cpp/common/os/win/src/common/utils.cpp      | 154 ------
 .../cpp/common/project/vs/common.vcxproj        |   4 +-
 .../common/project/vs/common.vcxproj.filters    |  12 +-
 .../platforms/cpp/common/src/common/utils.cpp   | 153 ++++++
 modules/platforms/cpp/core-test/Makefile.am     |   4 +-
 .../cpp/core-test/config/cache-identity.xml     | 121 +++++
 .../cpp/core-test/config/cache-query.xml        |  10 -
 .../cpp/core-test/include/ignite/test_utils.h   |  63 +++
 .../cpp/core-test/project/vs/core-test.vcxproj  |   4 +
 .../project/vs/core-test.vcxproj.filters        |  15 +
 .../src/binary_identity_resolver_test.cpp       | 522 +++++++++++++++++++
 .../cpp/core-test/src/binary_object_test.cpp    |  20 +-
 .../cpp/core-test/src/binary_session_test.cpp   |   4 +-
 .../cpp/core-test/src/cache_query_test.cpp      | 149 +++---
 .../platforms/cpp/core-test/src/cache_test.cpp  |  43 +-
 .../cpp/core-test/src/continuous_query_test.cpp |  31 +-
 .../cpp/core-test/src/ignition_test.cpp         |  19 +-
 .../cpp/core-test/src/interop_test.cpp          |  42 +-
 .../platforms/cpp/core-test/src/test_utils.cpp  |  79 +++
 .../cpp/core-test/src/transactions_test.cpp     |  23 +-
 .../platforms/cpp/core/src/impl/ignite_impl.cpp |   4 +-
 .../cpp/odbc-test/include/test_utils.h          |  51 +-
 .../cpp/odbc-test/src/api_robustness_test.cpp   |  35 +-
 .../src/application_data_buffer_test.cpp        |  24 +-
 .../cpp/odbc-test/src/queries_test.cpp          |  71 +--
 .../src/sql_aggregate_functions_test.cpp        |   1 +
 .../src/sql_date_time_functions_test.cpp        |  26 +-
 .../src/sql_esc_convert_function_test.cpp       |   4 +-
 .../src/sql_numeric_functions_test.cpp          |   1 +
 .../cpp/odbc-test/src/sql_outer_join_test.cpp   |   1 +
 .../odbc-test/src/sql_string_functions_test.cpp |   1 +
 .../odbc-test/src/sql_test_suite_fixture.cpp    |  40 +-
 .../cpp/odbc-test/src/sql_types_test.cpp        |  10 +-
 .../platforms/cpp/odbc-test/src/test_utils.cpp  |  60 ++-
 .../odbc/src/app/application_data_buffer.cpp    |   8 +-
 63 files changed, 2100 insertions(+), 1055 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/binary/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/Makefile.am b/modules/platforms/cpp/binary/Makefile.am
index cee87cd..c13a1bb 100644
--- a/modules/platforms/cpp/binary/Makefile.am
+++ b/modules/platforms/cpp/binary/Makefile.am
@@ -52,6 +52,7 @@ libignite_binary_la_SOURCES = \
     src/binary/binary_reader.cpp \
     src/binary/binary_type.cpp \
     src/binary/binary_raw_reader.cpp \
+    src/binary/binary_array_identity_resolver.cpp \
     src/impl/binary/binary_type_manager.cpp \
     src/impl/binary/binary_utils.cpp \
     src/impl/binary/binary_reader_impl.cpp \

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/binary/include/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/Makefile.am b/modules/platforms/cpp/binary/include/Makefile.am
index 2795cbc..a25a753 100644
--- a/modules/platforms/cpp/binary/include/Makefile.am
+++ b/modules/platforms/cpp/binary/include/Makefile.am
@@ -27,6 +27,8 @@ nobase_include_HEADERS = \
     ignite/binary/binary_consts.h \
     ignite/binary/binary_type.h \
     ignite/binary/binary_object.h \
+    ignite/binary/binary_identity_resolver.h \
+    ignite/binary/binary_array_identity_resolver.h \
     ignite/impl/binary/binary_type_handler.h \
     ignite/impl/binary/binary_id_resolver.h \
     ignite/impl/binary/binary_type_manager.h \
@@ -39,6 +41,7 @@ nobase_include_HEADERS = \
     ignite/impl/binary/binary_utils.h \
     ignite/impl/binary/binary_object_header.h \
     ignite/impl/binary/binary_object_impl.h \
+    ignite/impl/binary/binary_type_impl.h \
     ignite/impl/interop/interop_memory.h \
     ignite/impl/interop/interop.h \
     ignite/impl/interop/interop_stream_position_guard.h \

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/binary/include/ignite/binary/binary_array_identity_resolver.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/binary/binary_array_identity_resolver.h b/modules/platforms/cpp/binary/include/ignite/binary/binary_array_identity_resolver.h
new file mode 100644
index 0000000..70c5ed4
--- /dev/null
+++ b/modules/platforms/cpp/binary/include/ignite/binary/binary_array_identity_resolver.h
@@ -0,0 +1,64 @@
+/*
+ * 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.
+ */
+
+/**
+ * @file
+ * Declares ignite::binary::BinaryArrayIdentityResolver class template.
+ */
+
+#ifndef _IGNITE_BINARY_BINARY_ARRAY_IDENTITY_RESOLVER
+#define _IGNITE_BINARY_BINARY_ARRAY_IDENTITY_RESOLVER
+
+#include <stdint.h>
+
+#include <ignite/common/common.h>
+#include <ignite/binary/binary_identity_resolver.h>
+
+namespace ignite
+{
+    namespace binary
+    {
+        class BinaryObject;
+
+        /**
+         * Binary array identity resolver.
+         */
+        class IGNITE_IMPORT_EXPORT BinaryArrayIdentityResolver : public BinaryIdentityResolver
+        {
+        public:
+            /**
+             * Default constructor.
+             */
+            BinaryArrayIdentityResolver();
+
+            /**
+             * Destructor.
+             */
+            virtual ~BinaryArrayIdentityResolver();
+
+            /**
+             * Get binary object hash code.
+             *
+             * @param obj Binary object.
+             * @return Hash code.
+             */
+            virtual int32_t GetHashCode(const BinaryObject& obj);
+        };
+    }
+}
+
+#endif //_IGNITE_BINARY_BINARY_ARRAY_IDENTITY_RESOLVER

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/binary/include/ignite/binary/binary_identity_resolver.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/binary/binary_identity_resolver.h b/modules/platforms/cpp/binary/include/ignite/binary/binary_identity_resolver.h
new file mode 100644
index 0000000..ce10012
--- /dev/null
+++ b/modules/platforms/cpp/binary/include/ignite/binary/binary_identity_resolver.h
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ */
+
+/**
+ * @file
+ * Declares ignite::binary::BinaryIdentityResolver class.
+ */
+
+#ifndef _IGNITE_BINARY_BINARY_IDENTITY_RESOLVER
+#define _IGNITE_BINARY_BINARY_IDENTITY_RESOLVER
+
+#include <stdint.h>
+
+#include <ignite/common/common.h>
+
+#include <ignite/binary/binary_object.h>
+
+namespace ignite
+{
+    namespace binary
+    {
+        /**
+         * Binary identity resolver.
+         */
+        class IGNITE_IMPORT_EXPORT BinaryIdentityResolver
+        {
+        public:
+            /**
+             * Destructor.
+             */
+            virtual ~BinaryIdentityResolver()
+            {
+                // No-op.
+            }
+
+            /**
+             * Get binary object hash code.
+             *
+             * @param obj Binary object.
+             * @return Hash code.
+             */
+            virtual int32_t GetHashCode(const BinaryObject& obj) = 0;
+        };
+    }
+}
+
+#endif //_IGNITE_BINARY_BINARY_IDENTITY_RESOLVER

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/binary/include/ignite/binary/binary_object.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/binary/binary_object.h b/modules/platforms/cpp/binary/include/ignite/binary/binary_object.h
index 41907d0..08b503e 100644
--- a/modules/platforms/cpp/binary/include/ignite/binary/binary_object.h
+++ b/modules/platforms/cpp/binary/include/ignite/binary/binary_object.h
@@ -25,14 +25,14 @@
 
 #include <stdint.h>
 
-#include <ignite/impl/interop/interop.h>
-#include <ignite/impl/binary/binary_reader_impl.h>
 #include <ignite/impl/binary/binary_object_impl.h>
 
 namespace ignite
 {
     namespace binary
     {
+        class BinaryArrayIdentityResolver;
+
         /**
          * Binary object.
          *
@@ -41,6 +41,7 @@ namespace ignite
          */
         class IGNITE_IMPORT_EXPORT BinaryObject : private impl::binary::BinaryObjectImpl
         {
+            friend class BinaryArrayIdentityResolver;
         public:
             /// @cond INTERNAL
             /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/binary/include/ignite/binary/binary_type.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/binary/binary_type.h b/modules/platforms/cpp/binary/include/ignite/binary/binary_type.h
index 978a928..1c37f6d 100644
--- a/modules/platforms/cpp/binary/include/ignite/binary/binary_type.h
+++ b/modules/platforms/cpp/binary/include/ignite/binary/binary_type.h
@@ -189,17 +189,6 @@ namespace ignite
             }
 
             /**
-             * Get binary object hash code.
-             *
-             * @param obj Binary object.
-             * @return Hash code.
-             */
-            int32_t GetHashCode(const T& obj)
-            {
-                return 0;
-            }
-
-            /**
              * Write binary object.
              *
              * @param writer Writer.
@@ -275,11 +264,6 @@ namespace ignite
                 return typ.GetFieldId(name);
             }
 
-            int32_t GetHashCode(T* const& obj)
-            {
-                return typ.GetHashCode(*obj);
-            }
-
             void Write(BinaryWriter& writer, T* const& obj)
             {
                 typ.Write(writer, *obj);

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_object_impl.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_object_impl.h b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_object_impl.h
index 288ba26..efe1f49 100644
--- a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_object_impl.h
+++ b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_object_impl.h
@@ -72,7 +72,6 @@ namespace ignite
 
                 /**
                  * Get object data.
-                 * @throw IgniteError if the object is not in a valid state.
                  *
                  * @return Pointer to object data.
                  */
@@ -86,6 +85,14 @@ namespace ignite
                  */
                 int32_t GetLength() const;
 
+                /**
+                 * Get object hash code.
+                 * @throw IgniteError if the object is not in a valid state.
+                 *
+                 * @return Object hash code.
+                 */
+                int32_t GetHashCode() const;
+
             private:
                 IGNITE_NO_COPY_ASSIGNMENT(BinaryObjectImpl)
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_impl.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_impl.h b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_impl.h
new file mode 100644
index 0000000..d0cbb86
--- /dev/null
+++ b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_impl.h
@@ -0,0 +1,149 @@
+/*
+ * 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.
+ */
+
+#ifndef _IGNITE_IMPL_BINARY_BINARY_TYPE_IMP
+#define _IGNITE_IMPL_BINARY_BINARY_TYPE_IMP
+
+#include <stdint.h>
+
+#include <ignite/common/utils.h>
+
+#include <ignite/binary/binary_type.h>
+#include <ignite/binary/binary_object.h>
+#include <ignite/binary/binary_array_identity_resolver.h>
+
+#include <ignite/reference.h>
+
+/**
+ * Some SFINAE magic to check existence of the specified method with the
+ * specified signature in the BinaryType<T> class.
+ *
+ * This macro declares checker for the method.
+ */
+#define IGNITE_DECLARE_BINARY_TYPE_METHOD_CHECKER(method, sign)                         \
+    template<typename T>                                                                \
+    class IsDeclaredBinaryType##method                                                  \
+    {                                                                                   \
+        typedef char one;                                                               \
+        typedef char two[2];                                                            \
+                                                                                        \
+        template<class U, U> struct test;                                               \
+                                                                                        \
+        template<typename C> static one& helper(test<sign, &C::method>*);               \
+        template<typename C> static two& helper(...);                                   \
+                                                                                        \
+    public:                                                                             \
+        const static bool value =                                                       \
+            (sizeof(helper< ignite::binary::BinaryType<T> >(0)) == sizeof(one));        \
+    }
+
+namespace ignite
+{
+    namespace impl
+    {
+        namespace binary
+        {
+            IGNITE_DECLARE_BINARY_TYPE_METHOD_CHECKER(GetHashCode, int32_t(ignite::binary::BinaryType<T>::*)(const T&));
+            IGNITE_DECLARE_BINARY_TYPE_METHOD_CHECKER(GetIdentityResolver,
+                ignite::Reference<ignite::binary::BinaryIdentityResolver>(ignite::binary::BinaryType<T>::*)());
+
+            /**
+             * This type is used to get hash code for binary types which have not
+             * GetHashCode nor GetIdentityResolver methods defined.
+             */
+            template<typename T>
+            struct HashCodeGetterDefault
+            {
+                static int32_t Get(const T&, const ignite::binary::BinaryObject& obj)
+                {
+                    ignite::binary::BinaryArrayIdentityResolver arrayResolver;
+
+                    return arrayResolver.GetHashCode(obj);
+                }
+            };
+
+            /**
+             * This type is used to get hash code for binary types which have not
+             * GetIdentityResolver method defined but have GetHashCode.
+             */
+            template<typename T>
+            struct HashCodeGetterHashCode
+            {
+                static int32_t Get(const T& obj, const ignite::binary::BinaryObject&)
+                {
+                    ignite::binary::BinaryType<T> bt;
+
+                    return bt.GetHashCode(obj);
+                }
+            };
+
+            /**
+             * This type is used to get hash code for binary types which have
+             * GetIdentityResolver method defined.
+             */
+            template<typename T>
+            struct HashCodeGetterResolver
+            {
+                static int32_t Get(const T&, const ignite::binary::BinaryObject& obj)
+                {
+                    ignite::binary::BinaryType<T> bt;
+                    ignite::Reference<ignite::binary::BinaryIdentityResolver> resolver = bt.GetIdentityResolver();
+
+                    return resolver.Get().GetHashCode(obj);
+                }
+            };
+
+            /**
+             * Get hash code for the specified object.
+             * Determines the best method to use based on user-defined methods.
+             *
+             * @param obj Object reference.
+             * @param binObj Binary representation reference.
+             * @return Hash code for the object.
+             */
+            template<typename T>
+            int32_t GetHashCode(const T& obj, const ignite::binary::BinaryObject& binObj)
+            {
+                using namespace common;
+
+                typedef typename Conditional<
+                    // Checking if the BinaryType<T>::GetIdentityResolver declared
+                    IsDeclaredBinaryTypeGetIdentityResolver<T>::value,
+
+                    // True case. Using user-provided resolver.
+                    HashCodeGetterResolver<T>,
+
+                    // False case. Adding condition.
+                    typename Conditional<
+                        // Checking if the BinaryType<T>::GetHashCode declared
+                        IsDeclaredBinaryTypeGetHashCode<T>::value,
+
+                        // True case - using BinaryType<T>::GetHashCode().
+                        HashCodeGetterHashCode<T>,
+
+                        // False case. Using default getter.
+                        HashCodeGetterDefault<T> 
+                    >::type
+                >::type HashCodeGetter;
+
+                return HashCodeGetter::Get(obj, binObj);
+            }
+        }
+    }
+}
+
+#endif //_IGNITE_IMPL_BINARY_BINARY_TYPE_IMP

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_snapshot.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_snapshot.h b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_snapshot.h
index 4a8b41f..f1959fc 100644
--- a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_snapshot.h
+++ b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_snapshot.h
@@ -27,13 +27,13 @@
 #include <ignite/common/concurrent.h>
 
 namespace ignite
-{    
+{
     namespace impl
     {
         namespace binary
         {
             /**
-             * Type snapshot. 
+             * Type snapshot.
              */
             class BinaryTypeSnapshot
             {
@@ -48,7 +48,7 @@ namespace ignite
                  */
                 BinaryTypeSnapshot(std::string typeName, int32_t typeId, std::set<int32_t>* fieldIds, 
                     std::map<std::string, int32_t>* fields);
-                
+
                 /**
                  * Destructor.
                  */
@@ -65,7 +65,7 @@ namespace ignite
                 /**
                  * Get type name.
                  *
-                 * @param Type name.
+                 * @return Type name.
                  */
                 std::string GetTypeName();
 
@@ -79,14 +79,14 @@ namespace ignite
                 /**
                  * Whether snapshot contains any fields.
                  *
-                 * @param True if fields exist.
+                 * @return True if fields exist.
                  */
                 bool HasFields();
 
                 /** 
                  * Get field IDs.
                  *
-                 * @param Field IDs.
+                 * @return Field IDs.
                  */
                 std::set<int32_t>* GetFieldIds();
 
@@ -99,8 +99,8 @@ namespace ignite
 
             private:
                 /** Type name. */
-                std::string typeName;                   
-                
+                std::string typeName;
+
                 /** Type ID. */
                 int32_t typeId;
 
@@ -116,7 +116,7 @@ namespace ignite
             typedef BinaryTypeSnapshot Snap;
             typedef ignite::common::concurrent::SharedPointer<Snap> SPSnap;
         }
-    }    
+    }
 }
 
 #endif //_IGNITE_IMPL_BINARY_BINARY_TYPE_SNAPSHOT
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_utils.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_utils.h b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_utils.h
index 9599fce..b541483 100644
--- a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_utils.h
+++ b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_utils.h
@@ -48,6 +48,15 @@ namespace ignite
             {
             public:
                 /**
+                 * Get data hash code.
+                 *
+                 * @param data Data pointer.
+                 * @param size Data size in bytes.
+                 * @return Hash code.
+                 */
+                static int32_t GetDataHashCode(const void* data, size_t size);
+
+                /**
                  * Utility method to read signed 8-bit integer from stream.
                  *
                  * @param stream Stream.
@@ -437,172 +446,6 @@ namespace ignite
                 static void WriteString(interop::InteropOutputStream* stream, const char* val, const int32_t len);
 
                 /**
-                 * Convert Date type to standard C type time_t.
-                 *
-                 * @param date Date type value.
-                 * @return Corresponding value of time_t.
-                 */
-                static inline time_t DateToCTime(const Date& date)
-                {
-                    return static_cast<time_t>(date.GetSeconds());
-                }
-
-                /**
-                 * Convert Timestamp type to standard C type time_t.
-                 *
-                 * @param ts Timestamp type value.
-                 * @return Corresponding value of time_t.
-                 */
-                static inline time_t TimestampToCTime(const Timestamp& ts)
-                {
-                    return static_cast<time_t>(ts.GetSeconds());
-                }
-
-                /**
-                 * Convert Date type to standard C type time_t.
-                 *
-                 * @param date Date type value.
-                 * @param ctime Corresponding value of struct tm.
-                 * @return True on success.
-                 */
-                static inline bool DateToCTm(const Date& date, tm& ctime)
-                {
-                    time_t tmt = DateToCTime(date);
-
-                    return common::IgniteGmTime(tmt, ctime);
-                }
-
-                /**
-                 * Convert Timestamp type to standard C type struct tm.
-                 *
-                 * @param ts Timestamp type value.
-                 * @param ctime Corresponding value of struct tm.
-                 * @return True on success.
-                 */
-                static inline bool TimestampToCTm(const Timestamp& ts, tm& ctime)
-                {
-                    time_t tmt = TimestampToCTime(ts);
-
-                    return common::IgniteGmTime(tmt, ctime);
-                }
-
-                /**
-                 * Convert standard C type time_t to Date struct tm.
-                 *
-                 * @param ctime Standard C type time_t.
-                 * @return Corresponding value of Date.
-                 */
-                static inline Date CTimeToDate(time_t ctime)
-                {
-                    return Date(ctime * 1000);
-                }
-
-                /**
-                 * Convert standard C type time_t to Timestamp type.
-                 *
-                 * @param ctime Standard C type time_t.
-                 * @param ns Nanoseconds second fraction.
-                 * @return Corresponding value of Timestamp.
-                 */
-                static inline Timestamp CTimeToTimestamp(time_t ctime, int32_t ns)
-                {
-                    return Timestamp(ctime, ns);
-                }
-
-                /**
-                 * Convert standard C type struct tm to Date type.
-                 *
-                 * @param ctime Standard C type struct tm.
-                 * @return Corresponding value of Date.
-                 */
-                static inline Date CTmToDate(const tm& ctime)
-                {
-                    time_t time = common::IgniteTimeGm(ctime);
-
-                    return CTimeToDate(time);
-                }
-
-                /**
-                 * Convert standard C type struct tm to Timestamp type.
-                 *
-                 * @param ctime Standard C type struct tm.
-                 * @param ns Nanoseconds second fraction.
-                 * @return Corresponding value of Timestamp.
-                 */
-                static inline Timestamp CTmToTimestamp(const tm& ctime, int32_t ns)
-                {
-                    time_t time = common::IgniteTimeGm(ctime);
-
-                    return CTimeToTimestamp(time, ns);
-                }
-
-                /**
-                 * Make Date in human understandable way.
-                 *
-                 * Created Date uses GMT timezone.
-                 *
-                 * @param year Year.
-                 * @param month Month.
-                 * @param day Day.
-                 * @param hour Hour.
-                 * @param min Min.
-                 * @param sec Sec.
-                 * @return Date.
-                 */
-                static Date MakeDateGmt(int year = 1900, int month = 1,
-                    int day = 1, int hour = 0, int min = 0, int sec = 0);
-
-                /**
-                 * Make Date in human understandable way.
-                 *
-                 * Created Date uses local timezone.
-                 *
-                 * @param year Year.
-                 * @param month Month.
-                 * @param day Day.
-                 * @param hour Hour.
-                 * @param min Min.
-                 * @param sec Sec.
-                 * @return Date.
-                 */
-                static Date MakeDateLocal(int year = 1900, int month = 1,
-                    int day = 1, int hour = 0, int min = 0, int sec = 0);
-
-                /**
-                 * Make Date in human understandable way.
-                 *
-                 * Created Timestamp uses GMT timezone.
-                 *
-                 * @param year Year.
-                 * @param month Month.
-                 * @param day Day.
-                 * @param hour Hour.
-                 * @param min Minute.
-                 * @param sec Second.
-                 * @param ns Nanosecond.
-                 * @return Timestamp.
-                 */
-                static Timestamp MakeTimestampGmt(int year = 1900, int month = 1,
-                    int day = 1, int hour = 0, int min = 0, int sec = 0, long ns = 0);
-
-                /**
-                 * Make Date in human understandable way.
-                 *
-                 * Created Timestamp uses Local timezone.
-                 *
-                 * @param year Year.
-                 * @param month Month.
-                 * @param day Day.
-                 * @param hour Hour.
-                 * @param min Minute.
-                 * @param sec Second.
-                 * @param ns Nanosecond.
-                 * @return Timestamp.
-                 */
-                static Timestamp MakeTimestampLocal(int year = 1900, int month = 1,
-                    int day = 1, int hour = 0, int min = 0, int sec = 0, long ns = 0);
-
-                /**
                  * Get default value for the type.
                  *
                  * @return Null value for non primitive types and zeroes for primitives.

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_writer_impl.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_writer_impl.h b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_writer_impl.h
index 6ee088d..fc38837 100644
--- a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_writer_impl.h
+++ b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_writer_impl.h
@@ -31,6 +31,7 @@
 #include "ignite/impl/binary/binary_type_manager.h"
 #include "ignite/impl/binary/binary_utils.h"
 #include "ignite/impl/binary/binary_schema.h"
+#include "ignite/impl/binary/binary_type_impl.h"
 #include "ignite/binary/binary_consts.h"
 #include "ignite/binary/binary_type.h"
 #include "ignite/guid.h"
@@ -669,15 +670,21 @@ namespace ignite
                         stream->WriteInt8(IGNITE_PROTO_VER);
                         stream->WriteInt16(IGNITE_BINARY_FLAG_USER_TYPE);
                         stream->WriteInt32(idRslvr.GetTypeId());
-                        stream->WriteInt32(type.GetHashCode(obj));
 
-                        // Reserve space for the Object Lenght, Schema ID and Schema or Raw Offsett.
+                        int32_t hashPos = stream->Reserve(4);
+
+                        // Reserve space for the Object Lenght, Schema ID and Schema or Raw Offset.
                         stream->Reserve(12);
 
                         type.Write(writer, obj);
 
                         writerImpl.PostWrite();
 
+                        stream->Synchronize();
+
+                        ignite::binary::BinaryObject binObj(*stream->GetMemory(), pos);
+                        stream->WriteInt32(hashPos, impl::binary::GetHashCode<T>(obj, binObj));
+
                         if (metaMgr)
                             metaMgr->SubmitHandler(type.GetTypeName(), idRslvr.GetTypeId(), metaHnd.Get());
                     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/binary/include/ignite/impl/interop/interop_output_stream.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/impl/interop/interop_output_stream.h b/modules/platforms/cpp/binary/include/ignite/impl/interop/interop_output_stream.h
index c5bb884..9df3b1f 100644
--- a/modules/platforms/cpp/binary/include/ignite/impl/interop/interop_output_stream.h
+++ b/modules/platforms/cpp/binary/include/ignite/impl/interop/interop_output_stream.h
@@ -205,6 +205,14 @@ namespace ignite
                  * Synchronize data with underlying memory.
                  */
                 void Synchronize();
+
+                /**
+                 * Get underlying memory.
+                 *
+                 * @return Underlying memory.
+                 */
+                InteropMemory* GetMemory();
+
             private:
                 /** Memory. */
                 InteropMemory* mem; 
@@ -237,7 +245,7 @@ namespace ignite
                 /**
                  * Copy data to the stream shifting it along the way.
                  *
-                 * @param ptr Pointer to data.
+                 * @param src Pointer to data.
                  * @param off Offset.
                  * @param len Length.
                  */

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/binary/project/vs/binary.vcxproj
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/project/vs/binary.vcxproj b/modules/platforms/cpp/binary/project/vs/binary.vcxproj
index 887eb96..6c1c433 100644
--- a/modules/platforms/cpp/binary/project/vs/binary.vcxproj
+++ b/modules/platforms/cpp/binary/project/vs/binary.vcxproj
@@ -181,6 +181,8 @@
     <ClInclude Include="..\..\include\ignite\binary\binary_consts.h" />
     <ClInclude Include="..\..\include\ignite\binary\binary_containers.h" />
     <ClInclude Include="..\..\include\ignite\binary\binary_object.h" />
+    <ClInclude Include="..\..\include\ignite\binary\binary_identity_resolver.h" />
+    <ClInclude Include="..\..\include\ignite\binary\binary_array_identity_resolver.h" />
     <ClInclude Include="..\..\include\ignite\binary\binary_raw_reader.h" />
     <ClInclude Include="..\..\include\ignite\binary\binary_raw_writer.h" />
     <ClInclude Include="..\..\include\ignite\binary\binary_reader.h" />
@@ -193,6 +195,7 @@
     <ClInclude Include="..\..\include\ignite\impl\binary\binary_reader_impl.h" />
     <ClInclude Include="..\..\include\ignite\impl\binary\binary_schema.h" />
     <ClInclude Include="..\..\include\ignite\impl\binary\binary_type_handler.h" />
+    <ClInclude Include="..\..\include\ignite\impl\binary\binary_type_impl.h" />
     <ClInclude Include="..\..\include\ignite\impl\binary\binary_type_manager.h" />
     <ClInclude Include="..\..\include\ignite\impl\binary\binary_type_snapshot.h" />
     <ClInclude Include="..\..\include\ignite\impl\binary\binary_type_updater.h" />
@@ -205,6 +208,7 @@
     <ClInclude Include="..\..\include\ignite\impl\interop\interop_stream_position_guard.h" />
   </ItemGroup>
   <ItemGroup>
+    <ClCompile Include="..\..\src\binary\binary_array_identity_resolver.cpp" />
     <ClCompile Include="..\..\src\binary\binary_containers.cpp" />
     <ClCompile Include="..\..\src\binary\binary_raw_reader.cpp" />
     <ClCompile Include="..\..\src\binary\binary_raw_writer.cpp" />

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/binary/project/vs/binary.vcxproj.filters
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/project/vs/binary.vcxproj.filters b/modules/platforms/cpp/binary/project/vs/binary.vcxproj.filters
index a1a83ef..c649c4d 100644
--- a/modules/platforms/cpp/binary/project/vs/binary.vcxproj.filters
+++ b/modules/platforms/cpp/binary/project/vs/binary.vcxproj.filters
@@ -97,6 +97,15 @@
     <ClInclude Include="..\..\include\ignite\impl\binary\binary_object_impl.h">
       <Filter>Code\impl\binary</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\include\ignite\binary\binary_array_identity_resolver.h">
+      <Filter>Code\binary</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\ignite\binary\binary_identity_resolver.h">
+      <Filter>Code\binary</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\ignite\impl\binary\binary_type_impl.h">
+      <Filter>Code\impl\binary</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="..\..\src\binary\binary_containers.cpp">
@@ -156,5 +165,8 @@
     <ClCompile Include="..\..\src\impl\binary\binary_object_impl.cpp">
       <Filter>Code\impl\binary</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\binary\binary_array_identity_resolver.cpp">
+      <Filter>Code\binary</Filter>
+    </ClCompile>
   </ItemGroup>
 </Project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/binary/src/binary/binary_array_identity_resolver.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/src/binary/binary_array_identity_resolver.cpp b/modules/platforms/cpp/binary/src/binary/binary_array_identity_resolver.cpp
new file mode 100644
index 0000000..1d4e384
--- /dev/null
+++ b/modules/platforms/cpp/binary/src/binary/binary_array_identity_resolver.cpp
@@ -0,0 +1,42 @@
+/*
+ * 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 <ignite/binary/binary_object.h>
+#include <ignite/impl/binary/binary_utils.h>
+
+#include <ignite/binary/binary_array_identity_resolver.h>
+
+namespace ignite
+{
+    namespace binary
+    {
+        BinaryArrayIdentityResolver::BinaryArrayIdentityResolver()
+        {
+            // No-op.
+        }
+
+        BinaryArrayIdentityResolver::~BinaryArrayIdentityResolver()
+        {
+            // No-op.
+        }
+
+        int32_t BinaryArrayIdentityResolver::GetHashCode(const BinaryObject& obj)
+        {
+            return impl::binary::BinaryUtils::GetDataHashCode(obj.GetData(), obj.GetLength());
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/binary/src/binary/binary_type.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/src/binary/binary_type.cpp b/modules/platforms/cpp/binary/src/binary/binary_type.cpp
index 19d906d..0ea5a92 100644
--- a/modules/platforms/cpp/binary/src/binary/binary_type.cpp
+++ b/modules/platforms/cpp/binary/src/binary/binary_type.cpp
@@ -44,8 +44,8 @@ namespace ignite
 
                 return hash;
             }
-            else
-                return 0;
+
+            return 0;
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/binary/src/impl/binary/binary_object_impl.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/src/impl/binary/binary_object_impl.cpp b/modules/platforms/cpp/binary/src/impl/binary/binary_object_impl.cpp
index 652d54d..8167f8b 100644
--- a/modules/platforms/cpp/binary/src/impl/binary/binary_object_impl.cpp
+++ b/modules/platforms/cpp/binary/src/impl/binary/binary_object_impl.cpp
@@ -35,9 +35,6 @@ namespace ignite
 
             const int8_t* BinaryObjectImpl::GetData() const
             {
-                // Creating header here to validate object header layout.
-                BinaryObjectHeader header = BinaryObjectHeader::FromMemory(mem, start);
-
                 return mem.Data() + start + BinaryObjectHeader::SIZE;
             }
 
@@ -47,6 +44,13 @@ namespace ignite
 
                 return header.GetDataLength();
             }
+
+            int32_t BinaryObjectImpl::GetHashCode() const
+            {
+                BinaryObjectHeader header = BinaryObjectHeader::FromMemory(mem, start);
+
+                return header.GetHashCode();
+            }
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/binary/src/impl/binary/binary_type_manager.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/src/impl/binary/binary_type_manager.cpp b/modules/platforms/cpp/binary/src/impl/binary/binary_type_manager.cpp
index 8b5dfc1..a6692d1 100644
--- a/modules/platforms/cpp/binary/src/impl/binary/binary_type_manager.cpp
+++ b/modules/platforms/cpp/binary/src/impl/binary/binary_type_manager.cpp
@@ -46,9 +46,7 @@ namespace ignite
 
             SharedPointer<BinaryTypeHandler> BinaryTypeManager::GetHandler(int32_t typeId)
             {
-                SharedPointer<std::map<int32_t, SPSnap> > snapshots0 = snapshots;
-
-                SPSnap snapshot = (*snapshots0.Get())[typeId];
+                SPSnap snapshot = (*snapshots.Get())[typeId];
 
                 return SharedPointer<BinaryTypeHandler>(new BinaryTypeHandler(snapshot));
             }
@@ -108,12 +106,12 @@ namespace ignite
             bool BinaryTypeManager::ProcessPendingUpdates(BinaryTypeUpdater* updater, IgniteError* err)
             {
                 bool success = true; // Optimistically assume that all will be fine.
-                
-                cs->Enter();
+
+                CsLockGuard guard(*cs);
 
                 for (std::vector<SPSnap>::iterator it = pending->begin(); it != pending->end(); ++it)
                 {
-                    Snap* pendingSnap = (*it).Get();
+                    Snap* pendingSnap = it->Get();
 
                     if (updater->Update(pendingSnap, err))
                     {
@@ -174,8 +172,6 @@ namespace ignite
                     ver = pendingVer;
                 }
 
-                cs->Leave();
-
                 return success;
             }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/binary/src/impl/binary/binary_utils.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/src/impl/binary/binary_utils.cpp b/modules/platforms/cpp/binary/src/impl/binary/binary_utils.cpp
index bffd038..5fe8d83 100644
--- a/modules/platforms/cpp/binary/src/impl/binary/binary_utils.cpp
+++ b/modules/platforms/cpp/binary/src/impl/binary/binary_utils.cpp
@@ -82,6 +82,22 @@ namespace ignite
     {
         namespace binary
         {
+            int32_t BinaryUtils::GetDataHashCode(const void * data, size_t size)
+            {
+                if (data)
+                {
+                    int32_t hash = 1;
+                    const int8_t* bytes = static_cast<const int8_t*>(data);
+
+                    for (int i = 0; i < size; ++i)
+                        hash = 31 * hash + bytes[i];
+
+                    return hash;
+                }
+
+                return 0;
+            }
+
             int8_t BinaryUtils::ReadInt8(InteropInputStream* stream)
             {
                 return stream->ReadInt8();
@@ -317,70 +333,6 @@ namespace ignite
                 stream->WriteInt32(len);
                 stream->WriteInt8Array(reinterpret_cast<const int8_t*>(val), len);
             }
-
-            Date BinaryUtils::MakeDateGmt(int year, int month, int day, int hour,
-                int min, int sec)
-            {
-                tm date = { 0 };
-
-                date.tm_year = year - 1900;
-                date.tm_mon = month - 1;
-                date.tm_mday = day;
-                date.tm_hour = hour;
-                date.tm_min = min;
-                date.tm_sec = sec;
-
-                return CTmToDate(date);
-            }
-
-            Date BinaryUtils::MakeDateLocal(int year, int month, int day, int hour,
-                int min, int sec)
-            {
-                tm date = { 0 };
-
-                date.tm_year = year - 1900;
-                date.tm_mon = month - 1;
-                date.tm_mday = day;
-                date.tm_hour = hour;
-                date.tm_min = min;
-                date.tm_sec = sec;
-
-                time_t localTime = common::IgniteTimeLocal(date);
-
-                return CTimeToDate(localTime);
-            }
-
-            Timestamp BinaryUtils::MakeTimestampGmt(int year, int month, int day,
-                int hour, int min, int sec, long ns)
-            {
-                tm date = { 0 };
-
-                date.tm_year = year - 1900;
-                date.tm_mon = month - 1;
-                date.tm_mday = day;
-                date.tm_hour = hour;
-                date.tm_min = min;
-                date.tm_sec = sec;
-
-                return CTmToTimestamp(date, ns);
-            }
-
-            Timestamp BinaryUtils::MakeTimestampLocal(int year, int month, int day,
-                int hour, int min, int sec, long ns)
-            {
-                tm date = { 0 };
-
-                date.tm_year = year - 1900;
-                date.tm_mon = month - 1;
-                date.tm_mday = day;
-                date.tm_hour = hour;
-                date.tm_min = min;
-                date.tm_sec = sec;
-
-                time_t localTime = common::IgniteTimeLocal(date);
-
-                return CTimeToTimestamp(localTime, ns);
-            }
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/binary/src/impl/binary/binary_writer_impl.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/src/impl/binary/binary_writer_impl.cpp b/modules/platforms/cpp/binary/src/impl/binary/binary_writer_impl.cpp
index 20fb74d..b8f95b3 100644
--- a/modules/platforms/cpp/binary/src/impl/binary/binary_writer_impl.cpp
+++ b/modules/platforms/cpp/binary/src/impl/binary/binary_writer_impl.cpp
@@ -709,8 +709,6 @@ namespace ignite
             {
                 int32_t lenWithoutSchema = stream->Position() - start;
 
-                int32_t nonRawLen = rawPos == -1 ? lenWithoutSchema : rawPos - start;
-
                 uint16_t flags = IGNITE_BINARY_FLAG_USER_TYPE;
 
                 if (rawPos > 0)

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/binary/src/impl/interop/interop_output_stream.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/src/impl/interop/interop_output_stream.cpp b/modules/platforms/cpp/binary/src/impl/interop/interop_output_stream.cpp
index 374f634..ab58f1e 100644
--- a/modules/platforms/cpp/binary/src/impl/interop/interop_output_stream.cpp
+++ b/modules/platforms/cpp/binary/src/impl/interop/interop_output_stream.cpp
@@ -204,6 +204,11 @@ namespace ignite
                 mem->Length(pos);
             }
 
+            InteropMemory* InteropOutputStream::GetMemory()
+            {
+                return mem;
+            }
+
             void InteropOutputStream::EnsureCapacity(int32_t reqCap) {
                 if (reqCap > cap) {
                     int newCap = cap << 1;

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/common/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/Makefile.am b/modules/platforms/cpp/common/Makefile.am
index 9c27a57..8c79c3e 100644
--- a/modules/platforms/cpp/common/Makefile.am
+++ b/modules/platforms/cpp/common/Makefile.am
@@ -43,16 +43,17 @@ libignite_common_la_LDFLAGS = \
 
 libignite_common_la_SOURCES = \
     os/linux/src/common/concurrent_os.cpp \
-    os/linux/src/common/utils.cpp \
+    os/linux/src/common/platform_utils.cpp \
     src/common/big_integer.cpp \
     src/common/concurrent.cpp \
     src/common/decimal.cpp \
     src/common/bits.cpp \
+    src/common/utils.cpp \
     src/date.cpp \
     src/ignite_error.cpp \
     src/guid.cpp \
     src/timestamp.cpp
-	
+
 clean-local:
 	$(RM) *.gcno *.gcda
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/common/include/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/include/Makefile.am b/modules/platforms/cpp/common/include/Makefile.am
index a5073f6..7f7ab83 100644
--- a/modules/platforms/cpp/common/include/Makefile.am
+++ b/modules/platforms/cpp/common/include/Makefile.am
@@ -27,6 +27,7 @@ nobase_include_HEADERS = \
 	ignite/common/dynamic_size_array.h \
 	ignite/common/fixed_size_array.h \
 	ignite/common/utils.h \
+	ignite/common/platform_utils.h \
 	ignite/date.h \
 	ignite/guid.h \
 	ignite/ignite_error.h \

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/common/include/ignite/common/platform_utils.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/include/ignite/common/platform_utils.h b/modules/platforms/cpp/common/include/ignite/common/platform_utils.h
new file mode 100644
index 0000000..273a5e0
--- /dev/null
+++ b/modules/platforms/cpp/common/include/ignite/common/platform_utils.h
@@ -0,0 +1,79 @@
+/*
+ * 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.
+ */
+#ifndef _IGNITE_COMMON_PLATFORM_UTILS
+#define _IGNITE_COMMON_PLATFORM_UTILS
+
+#include <ignite/common/common.h>
+
+namespace ignite
+{
+    namespace common
+    {
+        /**
+         * Convert struct tm to time_t (UTC).
+         *
+         * @param time Standard C type struct tm value.
+         * @return Standard C type time_t value.
+         */
+        IGNITE_IMPORT_EXPORT time_t IgniteTimeGm(const tm& time);
+
+        /**
+         * Convert struct tm to time_t (Local time).
+         *
+         * @param time Standard C type struct tm value.
+         * @return Standard C type time_t value.
+         */
+        IGNITE_IMPORT_EXPORT time_t IgniteTimeLocal(const tm& time);
+
+        /**
+         * Convert time_t to struct tm (UTC).
+         *
+         * @param in Standard C type time_t value.
+         * @param out Standard C type struct tm value.
+         * @return True on success.
+         */
+        IGNITE_IMPORT_EXPORT bool IgniteGmTime(time_t in, tm& out);
+
+        /**
+         * Convert time_t to struct tm (Local time).
+         *
+         * @param in Standard C type time_t value.
+         * @param out Standard C type struct tm value.
+         * @return True on success.
+         */
+        IGNITE_IMPORT_EXPORT bool IgniteLocalTime(time_t in, tm& out);
+
+        /**
+         * Read system environment variable taking thread-safety in count.
+         *
+         * @param name Environment variable name.
+         * @param found Whether environment variable with such name was found.
+         * @return Environment variable value.
+         */
+        IGNITE_IMPORT_EXPORT std::string GetEnv(const std::string& name, bool& found);
+
+        /**
+         * Ensure that file on the given path exists in the system.
+         *
+         * @param path Path.
+         * @return True if file exists, false otherwise.
+         */
+        IGNITE_IMPORT_EXPORT bool FileExists(const std::string& path);
+    }
+}
+
+#endif //_IGNITE_COMMON_PLATFORM_UTILS
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/common/include/ignite/common/utils.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/include/ignite/common/utils.h b/modules/platforms/cpp/common/include/ignite/common/utils.h
index 6ac3c17..bf1f39b 100644
--- a/modules/platforms/cpp/common/include/ignite/common/utils.h
+++ b/modules/platforms/cpp/common/include/ignite/common/utils.h
@@ -25,6 +25,10 @@
 #include <algorithm>
 
 #include <ignite/common/common.h>
+#include <ignite/common/platform_utils.h>
+
+#include <ignite/date.h>
+#include <ignite/timestamp.h>
 
 #ifdef IGNITE_FRIEND
 #   define IGNITE_FRIEND_EXPORT IGNITE_EXPORT
@@ -91,40 +95,6 @@ namespace ignite
         }
 
         /**
-         * Convert struct tm to time_t (UTC).
-         *
-         * @param time Standard C type struct tm value.
-         * @return Standard C type time_t value.
-         */
-        IGNITE_IMPORT_EXPORT time_t IgniteTimeGm(const tm& time);
-
-        /**
-         * Convert struct tm to time_t (Local time).
-         *
-         * @param time Standard C type struct tm value.
-         * @return Standard C type time_t value.
-         */
-        IGNITE_IMPORT_EXPORT time_t IgniteTimeLocal(const tm& time);
-
-        /**
-         * Convert time_t to struct tm (UTC).
-         *
-         * @param in Standard C type time_t value.
-         * @param out Standard C type struct tm value.
-         * @return True on success.
-         */
-        IGNITE_IMPORT_EXPORT bool IgniteGmTime(time_t in, tm& out);
-
-        /**
-         * Convert time_t to struct tm (Local time).
-         *
-         * @param in Standard C type time_t value.
-         * @param out Standard C type struct tm value.
-         * @return True on success.
-         */
-        IGNITE_IMPORT_EXPORT bool IgniteLocalTime(time_t in, tm& out);
-
-        /**
          * Copy characters.
          *
          * @param val Value.
@@ -140,23 +110,6 @@ namespace ignite
         IGNITE_IMPORT_EXPORT void ReleaseChars(char* val);
 
         /**
-         * Read system environment variable taking thread-safety in count.
-         *
-         * @param name Environment variable name.
-         * @param found Whether environment variable with such name was found.
-         * @return Environment variable value.
-         */
-        IGNITE_IMPORT_EXPORT std::string GetEnv(const std::string& name, bool& found);
-
-        /**
-         * Ensure that file on the given path exists in the system.
-         *
-         * @param path Path.
-         * @return True if file exists, false otherwise.
-         */
-        IGNITE_IMPORT_EXPORT bool FileExists(const std::string& path);
-
-        /**
          * Casts value of one type to another type, using stringstream.
          *
          * @param val Input value.
@@ -206,12 +159,198 @@ namespace ignite
         }
 
         /**
-        * Converts 32-bit integer to big endian format
-        *
-        * @param value Input value
-        * @return Resulting value
-        */
+         * Converts 32-bit integer to big endian format
+         *
+         * @param value Input value
+         * @return Resulting value
+         */
         IGNITE_IMPORT_EXPORT uint32_t ToBigEndian(uint32_t value);
+
+        /**
+         * Convert Date type to standard C type time_t.
+         *
+         * @param date Date type value.
+         * @return Corresponding value of time_t.
+         */
+        inline time_t DateToCTime(const Date& date)
+        {
+            return static_cast<time_t>(date.GetSeconds());
+        }
+
+        /**
+         * Convert Timestamp type to standard C type time_t.
+         *
+         * @param ts Timestamp type value.
+         * @return Corresponding value of time_t.
+         */
+        inline time_t TimestampToCTime(const Timestamp& ts)
+        {
+            return static_cast<time_t>(ts.GetSeconds());
+        }
+
+        /**
+         * Convert Date type to standard C type time_t.
+         *
+         * @param date Date type value.
+         * @param ctime Corresponding value of struct tm.
+         * @return True on success.
+         */
+        inline bool DateToCTm(const Date& date, tm& ctime)
+        {
+            time_t tmt = DateToCTime(date);
+
+            return common::IgniteGmTime(tmt, ctime);
+        }
+
+        /**
+         * Convert Timestamp type to standard C type struct tm.
+         *
+         * @param ts Timestamp type value.
+         * @param ctime Corresponding value of struct tm.
+         * @return True on success.
+         */
+        inline bool TimestampToCTm(const Timestamp& ts, tm& ctime)
+        {
+            time_t tmt = TimestampToCTime(ts);
+
+            return common::IgniteGmTime(tmt, ctime);
+        }
+
+        /**
+         * Convert standard C type time_t to Date struct tm.
+         *
+         * @param ctime Standard C type time_t.
+         * @return Corresponding value of Date.
+         */
+        inline Date CTimeToDate(time_t ctime)
+        {
+            return Date(ctime * 1000);
+        }
+
+        /**
+         * Convert standard C type time_t to Timestamp type.
+         *
+         * @param ctime Standard C type time_t.
+         * @param ns Nanoseconds second fraction.
+         * @return Corresponding value of Timestamp.
+         */
+        inline Timestamp CTimeToTimestamp(time_t ctime, int32_t ns)
+        {
+            return Timestamp(ctime, ns);
+        }
+
+        /**
+         * Convert standard C type struct tm to Date type.
+         *
+         * @param ctime Standard C type struct tm.
+         * @return Corresponding value of Date.
+         */
+        inline Date CTmToDate(const tm& ctime)
+        {
+            time_t time = common::IgniteTimeGm(ctime);
+
+            return CTimeToDate(time);
+        }
+
+        /**
+         * Convert standard C type struct tm to Timestamp type.
+         *
+         * @param ctime Standard C type struct tm.
+         * @param ns Nanoseconds second fraction.
+         * @return Corresponding value of Timestamp.
+         */
+        inline Timestamp CTmToTimestamp(const tm& ctime, int32_t ns)
+        {
+            time_t time = common::IgniteTimeGm(ctime);
+
+            return CTimeToTimestamp(time, ns);
+        }
+
+        /**
+         * Make Date in human understandable way.
+         *
+         * Created Date uses GMT timezone.
+         *
+         * @param year Year.
+         * @param month Month.
+         * @param day Day.
+         * @param hour Hour.
+         * @param min Min.
+         * @param sec Sec.
+         * @return Date.
+         */
+        Date MakeDateGmt(int year = 1900, int month = 1,
+            int day = 1, int hour = 0, int min = 0, int sec = 0);
+
+        /**
+         * Make Date in human understandable way.
+         *
+         * Created Date uses local timezone.
+         *
+         * @param year Year.
+         * @param month Month.
+         * @param day Day.
+         * @param hour Hour.
+         * @param min Min.
+         * @param sec Sec.
+         * @return Date.
+         */
+        Date MakeDateLocal(int year = 1900, int month = 1,
+            int day = 1, int hour = 0, int min = 0, int sec = 0);
+
+        /**
+         * Make Date in human understandable way.
+         *
+         * Created Timestamp uses GMT timezone.
+         *
+         * @param year Year.
+         * @param month Month.
+         * @param day Day.
+         * @param hour Hour.
+         * @param min Minute.
+         * @param sec Second.
+         * @param ns Nanosecond.
+         * @return Timestamp.
+         */
+        Timestamp MakeTimestampGmt(int year = 1900, int month = 1,
+            int day = 1, int hour = 0, int min = 0, int sec = 0, long ns = 0);
+
+        /**
+         * Make Date in human understandable way.
+         *
+         * Created Timestamp uses Local timezone.
+         *
+         * @param year Year.
+         * @param month Month.
+         * @param day Day.
+         * @param hour Hour.
+         * @param min Minute.
+         * @param sec Second.
+         * @param ns Nanosecond.
+         * @return Timestamp.
+         */
+        Timestamp MakeTimestampLocal(int year = 1900, int month = 1,
+            int day = 1, int hour = 0, int min = 0, int sec = 0, long ns = 0);
+
+        /**
+         * Meta-programming class.
+         * Defines T1 as ::type if the condition is true, otherwise
+         * defines T2 as ::type.
+         */
+        template<bool, typename T1, typename T2>
+        struct Conditional
+        {
+            typedef T1 type;
+        };
+
+        /**
+         * Specialization for the false case.
+         */
+        template<typename T1, typename T2>
+        struct Conditional<false, T1, T2>
+        {
+            typedef T2 type;
+        };
     }
 }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/common/os/linux/src/common/platform_utils.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/os/linux/src/common/platform_utils.cpp b/modules/platforms/cpp/common/os/linux/src/common/platform_utils.cpp
new file mode 100644
index 0000000..a3e1d17
--- /dev/null
+++ b/modules/platforms/cpp/common/os/linux/src/common/platform_utils.cpp
@@ -0,0 +1,81 @@
+/*
+ * 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 <time.h>
+
+#include <sys/stat.h>
+#include <dirent.h>
+#include <dlfcn.h>
+
+#include <ignite/common/utils.h>
+
+namespace ignite
+{
+    namespace common
+    {
+        time_t IgniteTimeGm(const tm& time)
+        {
+            tm tmc = time;
+
+            return timegm(&tmc);
+        }
+
+        time_t IgniteTimeLocal(const tm& time)
+        {
+            tm tmc = time;
+
+            return mktime(&tmc);
+        }
+
+        bool IgniteGmTime(time_t in, tm& out)
+        {
+            return gmtime_r(&in, &out) != NULL;
+        }
+
+        bool IgniteLocalTime(time_t in, tm& out)
+        {
+            return localtime_r(&in, &out) == 0;
+        }
+
+        std::string GetEnv(const std::string& name, bool& found)
+        {
+            char* val = std::getenv(name.c_str());
+
+            if (val)
+            {
+                found = true;
+
+                return std::string(val);
+            }
+            else
+            {
+                found = false;
+
+                return std::string();
+            }
+        }
+
+        bool FileExists(const std::string& path)
+        {
+            struct stat s;
+
+            int res = stat(path.c_str(), &s);
+
+            return res != -1;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/common/os/linux/src/common/utils.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/os/linux/src/common/utils.cpp b/modules/platforms/cpp/common/os/linux/src/common/utils.cpp
deleted file mode 100644
index 0fa9231..0000000
--- a/modules/platforms/cpp/common/os/linux/src/common/utils.cpp
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * 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 <time.h>
-
-#include <sys/stat.h>
-#include <dirent.h>
-#include <dlfcn.h>
-
-#include <ignite/common/utils.h>
-
-namespace ignite
-{
-    namespace common
-    {
-        /**
-         * Check if string ends with the given ending.
-         *
-         * @param str String to check.
-         * @param ending Ending.
-         * @return Result.
-         */
-        inline bool StringEndsWith(const std::string& str, const std::string& ending)
-        {
-            if (str.length() > ending.length())
-                return str.compare(str.length() - ending.length(), ending.length(), ending) == 0;
-
-            return false;
-        }
-
-        time_t IgniteTimeGm(const tm& time)
-        {
-            tm tmc = time;
-
-            return timegm(&tmc);
-        }
-
-        time_t IgniteTimeLocal(const tm& time)
-        {
-            tm tmc = time;
-
-            return mktime(&tmc);
-        }
-
-        bool IgniteGmTime(time_t in, tm& out)
-        {
-            return gmtime_r(&in, &out) != NULL;
-        }
-
-        bool IgniteLocalTime(time_t in, tm& out)
-        {
-            return localtime_r(&in, &out) == 0;
-        }
-
-        int LeadingZeroesForOctet(int8_t octet) {
-            if (octet == 0)
-                return 8;
-
-            int zeroes = 1;
-
-            if (octet >> 4 == 0) {
-                zeroes += 4;
-                octet <<= 4;
-            }
-
-            if (octet >> 6 == 0) {
-                zeroes += 2;
-                octet <<= 2;
-            }
-
-            zeroes -= octet >> 7;
-
-            return zeroes;
-        }
-
-        char* CopyChars(const char* val)
-        {
-            if (val) {
-                size_t len = strlen(val);
-                char* dest = new char[len + 1];
-                strcpy(dest, val);
-                *(dest + len) = 0;
-                return dest;
-            }
-            else
-                return NULL;
-        }
-
-        void ReleaseChars(char* val)
-        {
-            if (val)
-                delete[] val;
-        }
-
-        std::string GetEnv(const std::string& name, bool& found)
-        {
-            char* val = std::getenv(name.c_str());
-
-            if (val)
-            {
-                found = true;
-
-                return std::string(val);
-            }
-            else
-            {
-                found = false;
-
-                return std::string();
-            }
-        }
-
-        bool FileExists(const std::string& path)
-        {
-            struct stat s;
-
-            int res = stat(path.c_str(), &s);
-
-            return res != -1;
-        }
-
-        uint32_t ToBigEndian(uint32_t value)
-        {
-            // The answer is 42
-            static const int num = 42;
-            static const bool isLittleEndian = (*reinterpret_cast<const char*>(&num) == num);
-
-            if (isLittleEndian)
-                return ((value & 0xFF) << 24) | (((value >> 8) & 0xFF) << 16) | (((value >> 16) & 0xFF) << 8) | ((value >> 24) & 0xFF);
-
-            return value;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/common/os/win/src/common/platform_utils.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/os/win/src/common/platform_utils.cpp b/modules/platforms/cpp/common/os/win/src/common/platform_utils.cpp
new file mode 100644
index 0000000..16fd6ec
--- /dev/null
+++ b/modules/platforms/cpp/common/os/win/src/common/platform_utils.cpp
@@ -0,0 +1,88 @@
+/*
+ * 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 <time.h>
+
+#include <windows.h>
+
+#include <ignite/common/platform_utils.h>
+
+namespace ignite
+{
+    namespace common
+    {
+        time_t IgniteTimeGm(const tm& time)
+        {
+            tm tmc = time;
+
+            return _mkgmtime(&tmc);
+        }
+
+        time_t IgniteTimeLocal(const tm& time)
+        {
+            tm tmc = time;
+
+            return mktime(&tmc);
+        }
+
+        bool IgniteGmTime(time_t in, tm& out)
+        {
+            return gmtime_s(&out, &in) == 0;
+        }
+
+        bool IgniteLocalTime(time_t in, tm& out)
+        {
+            return localtime_s(&out, &in) == 0;
+        }
+
+        std::string GetEnv(const std::string& name, bool& found)
+        {
+            char res0[32767];
+
+            DWORD envRes = GetEnvironmentVariableA(name.c_str(), res0, 32767);
+
+            if (envRes != 0)
+            {
+                found = true;
+
+                return std::string(res0);
+            }
+            else
+            {
+                found = false;
+
+                return std::string();
+            }
+        }
+
+        bool FileExists(const std::string& path)
+        {
+            WIN32_FIND_DATAA findres;
+
+            HANDLE hnd = FindFirstFileA(path.c_str(), &findres);
+
+            if (hnd == INVALID_HANDLE_VALUE)
+                return false;
+            else
+            {
+                FindClose(hnd);
+
+                return true;
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/common/os/win/src/common/utils.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/os/win/src/common/utils.cpp b/modules/platforms/cpp/common/os/win/src/common/utils.cpp
deleted file mode 100644
index c6afce2..0000000
--- a/modules/platforms/cpp/common/os/win/src/common/utils.cpp
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * 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 <time.h>
-
-#include <windows.h>
-
-#include <ignite/common/utils.h>
-
-namespace ignite
-{
-    namespace common
-    {
-        /**
-         * Check if string ends with the given ending.
-         *
-         * @param str String to check.
-         * @param ending Ending.
-         * @return Result.
-         */
-        inline bool StringEndsWith(const std::string& str, const std::string& ending)
-        {
-            if (str.length() > ending.length())
-                return str.compare(str.length() - ending.length(), ending.length(), ending) == 0;
-
-            return false;
-        }
-
-        void StripSurroundingWhitespaces(std::string& str)
-        {
-            std::string::size_type newBegin = 0;
-            while (newBegin < str.size() && ::isspace(str[newBegin]))
-                ++newBegin;
-
-            if (newBegin == str.size())
-            {
-                str.clear();
-
-                return;
-            }
-
-            std::string::size_type newEnd = str.size() - 1;
-            while (::isspace(str[newEnd]))
-                --newEnd;
-
-            str.assign(str, newBegin, (newEnd - newBegin) + 1);
-        }
-
-        time_t IgniteTimeGm(const tm& time)
-        {
-            tm tmc = time;
-
-            return _mkgmtime(&tmc);
-        }
-
-        time_t IgniteTimeLocal(const tm& time)
-        {
-            tm tmc = time;
-
-            return mktime(&tmc);
-        }
-
-        bool IgniteGmTime(time_t in, tm& out)
-        {
-            return gmtime_s(&out, &in) == 0;
-        }
-
-        bool IgniteLocalTime(time_t in, tm& out)
-        {
-            return localtime_s(&out, &in) == 0;
-        }
-
-        char* CopyChars(const char* val)
-        {
-            if (val) {
-                size_t len = strlen(val);
-                char* dest = new char[len + 1];
-                strcpy(dest, val);
-                *(dest + len) = 0;
-                return dest;
-            }
-            else
-                return NULL;
-        }
-
-        void ReleaseChars(char* val)
-        {
-            if (val)
-                delete[] val;
-        }
-
-        std::string GetEnv(const std::string& name, bool& found)
-        {
-            char res0[32767];
-
-            DWORD envRes = GetEnvironmentVariableA(name.c_str(), res0, 32767);
-
-            if (envRes != 0)
-            {
-                found = true;
-
-                return std::string(res0);
-            }
-            else
-            {
-                found = false;
-
-                return std::string();
-            }
-        }
-
-        bool FileExists(const std::string& path)
-        {
-            WIN32_FIND_DATAA findres;
-
-            HANDLE hnd = FindFirstFileA(path.c_str(), &findres);
-
-            if (hnd == INVALID_HANDLE_VALUE)
-                return false;
-            else
-            {
-                FindClose(hnd);
-
-                return true;
-            }
-        }
-
-        uint32_t ToBigEndian(uint32_t value)
-        {
-            // The answer is 42
-            static const int num = 42;
-            static const bool isLittleEndian = (*reinterpret_cast<const char*>(&num) == num);
-
-            if (isLittleEndian)
-                return ((value & 0xFF) << 24) | (((value >> 8) & 0xFF) << 16) | (((value >> 16) & 0xFF) << 8) | ((value >> 24) & 0xFF);
-
-            return value;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/common/project/vs/common.vcxproj
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/project/vs/common.vcxproj b/modules/platforms/cpp/common/project/vs/common.vcxproj
index b4431f8..7a57ac0 100644
--- a/modules/platforms/cpp/common/project/vs/common.vcxproj
+++ b/modules/platforms/cpp/common/project/vs/common.vcxproj
@@ -172,6 +172,7 @@
     <ClInclude Include="..\..\include\ignite\common\dynamic_size_array.h" />
     <ClInclude Include="..\..\include\ignite\common\fixed_size_array.h" />
     <ClInclude Include="..\..\include\ignite\common\bits.h" />
+    <ClInclude Include="..\..\include\ignite\common\platform_utils.h" />
     <ClInclude Include="..\..\include\ignite\common\reference_impl.h" />
     <ClInclude Include="..\..\include\ignite\common\utils.h" />
     <ClInclude Include="..\..\include\ignite\date.h" />
@@ -185,11 +186,12 @@
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="..\..\os\win\src\common\concurrent_os.cpp" />
-    <ClCompile Include="..\..\os\win\src\common\utils.cpp" />
+    <ClCompile Include="..\..\os\win\src\common\platform_utils.cpp" />
     <ClCompile Include="..\..\src\common\big_integer.cpp" />
     <ClCompile Include="..\..\src\common\bits.cpp" />
     <ClCompile Include="..\..\src\common\concurrent.cpp" />
     <ClCompile Include="..\..\src\common\decimal.cpp" />
+    <ClCompile Include="..\..\src\common\utils.cpp" />
     <ClCompile Include="..\..\src\date.cpp" />
     <ClCompile Include="..\..\src\guid.cpp" />
     <ClCompile Include="..\..\src\ignite_error.cpp" />

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/common/project/vs/common.vcxproj.filters
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/project/vs/common.vcxproj.filters b/modules/platforms/cpp/common/project/vs/common.vcxproj.filters
index d99722b..f08471e 100644
--- a/modules/platforms/cpp/common/project/vs/common.vcxproj.filters
+++ b/modules/platforms/cpp/common/project/vs/common.vcxproj.filters
@@ -64,6 +64,9 @@
     <ClInclude Include="..\..\include\ignite\reference.h">
       <Filter>Code</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\include\ignite\common\platform_utils.h">
+      <Filter>Code\common</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="..\..\src\date.cpp">
@@ -78,9 +81,6 @@
     <ClCompile Include="..\..\os\win\src\common\concurrent_os.cpp">
       <Filter>Code\common</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\os\win\src\common\utils.cpp">
-      <Filter>Code\common</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\src\common\concurrent.cpp">
       <Filter>Code\common</Filter>
     </ClCompile>
@@ -96,5 +96,11 @@
     <ClCompile Include="..\..\src\common\bits.cpp">
       <Filter>Code\common</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\os\win\src\common\platform_utils.cpp">
+      <Filter>Code\common</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\common\utils.cpp">
+      <Filter>Code\common</Filter>
+    </ClCompile>
   </ItemGroup>
 </Project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/common/src/common/utils.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/src/common/utils.cpp b/modules/platforms/cpp/common/src/common/utils.cpp
new file mode 100644
index 0000000..27d2473
--- /dev/null
+++ b/modules/platforms/cpp/common/src/common/utils.cpp
@@ -0,0 +1,153 @@
+/*
+ * 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 <ignite/common/utils.h>
+
+namespace ignite
+{
+    namespace common
+    {
+        /**
+         * Check if string ends with the given ending.
+         *
+         * @param str String to check.
+         * @param ending Ending.
+         * @return Result.
+         */
+        inline bool StringEndsWith(const std::string& str, const std::string& ending)
+        {
+            if (str.length() > ending.length())
+                return str.compare(str.length() - ending.length(), ending.length(), ending) == 0;
+
+            return false;
+        }
+
+        void StripSurroundingWhitespaces(std::string& str)
+        {
+            std::string::size_type newBegin = 0;
+            while (newBegin < str.size() && ::isspace(str[newBegin]))
+                ++newBegin;
+
+            if (newBegin == str.size())
+            {
+                str.clear();
+
+                return;
+            }
+
+            std::string::size_type newEnd = str.size() - 1;
+            while (::isspace(str[newEnd]))
+                --newEnd;
+
+            str.assign(str, newBegin, (newEnd - newBegin) + 1);
+        }
+
+        char* CopyChars(const char* val)
+        {
+            if (val) {
+                size_t len = strlen(val);
+                char* dest = new char[len + 1];
+                strcpy(dest, val);
+                *(dest + len) = 0;
+                return dest;
+            }
+
+            return NULL;
+        }
+
+        void ReleaseChars(char* val)
+        {
+            delete[] val;
+        }
+
+        uint32_t ToBigEndian(uint32_t value)
+        {
+            // The answer is 42
+            static const int num = 42;
+            static const bool isLittleEndian = (*reinterpret_cast<const char*>(&num) == num);
+
+            if (isLittleEndian)
+                return ((value & 0xFF) << 24) | (((value >> 8) & 0xFF) << 16) | (((value >> 16) & 0xFF) << 8) | ((value >> 24) & 0xFF);
+
+            return value;
+        }
+
+        Date MakeDateGmt(int year, int month, int day, int hour,
+            int min, int sec)
+        {
+            tm date = { 0 };
+
+            date.tm_year = year - 1900;
+            date.tm_mon = month - 1;
+            date.tm_mday = day;
+            date.tm_hour = hour;
+            date.tm_min = min;
+            date.tm_sec = sec;
+
+            return CTmToDate(date);
+        }
+
+        Date MakeDateLocal(int year, int month, int day, int hour,
+            int min, int sec)
+        {
+            tm date = { 0 };
+
+            date.tm_year = year - 1900;
+            date.tm_mon = month - 1;
+            date.tm_mday = day;
+            date.tm_hour = hour;
+            date.tm_min = min;
+            date.tm_sec = sec;
+
+            time_t localTime = common::IgniteTimeLocal(date);
+
+            return CTimeToDate(localTime);
+        }
+
+        Timestamp MakeTimestampGmt(int year, int month, int day,
+            int hour, int min, int sec, long ns)
+        {
+            tm date = { 0 };
+
+            date.tm_year = year - 1900;
+            date.tm_mon = month - 1;
+            date.tm_mday = day;
+            date.tm_hour = hour;
+            date.tm_min = min;
+            date.tm_sec = sec;
+
+            return CTmToTimestamp(date, ns);
+        }
+
+        Timestamp MakeTimestampLocal(int year, int month, int day,
+            int hour, int min, int sec, long ns)
+        {
+            tm date = { 0 };
+
+            date.tm_year = year - 1900;
+            date.tm_mon = month - 1;
+            date.tm_mday = day;
+            date.tm_hour = hour;
+            date.tm_min = min;
+            date.tm_sec = sec;
+
+            time_t localTime = common::IgniteTimeLocal(date);
+
+            return CTimeToTimestamp(localTime, ns);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/core-test/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/Makefile.am b/modules/platforms/cpp/core-test/Makefile.am
index 4af2850..566a827 100644
--- a/modules/platforms/cpp/core-test/Makefile.am
+++ b/modules/platforms/cpp/core-test/Makefile.am
@@ -54,6 +54,7 @@ ignite_tests_LDFLAGS = \
 ignite_tests_SOURCES = \
     src/reference_test.cpp \
     src/bits_test.cpp \
+	src/binary_identity_resolver_test.cpp \
     src/cache_test.cpp \
     src/cache_query_test.cpp \
     src/continuous_query_test.cpp \
@@ -73,7 +74,8 @@ ignite_tests_SOURCES = \
     src/fixed_size_array_test.cpp \
     src/transactions_test.cpp \
     src/teamcity_messages.cpp \
-    src/teamcity_boost.cpp
+    src/teamcity_boost.cpp \
+	src/test_utils.cpp
 
 run-check: check
 	./ignite-tests -p


Mime
View raw message