ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [2/2] ignite git commit: IGNITE-2222: CPP: Added date/timestamp support.
Date Fri, 12 Feb 2016 13:22:37 GMT
IGNITE-2222: CPP: Added date/timestamp support.


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

Branch: refs/heads/ignite-1786
Commit: 64cfa62ae139d5c7b779090c7b7294774214d284
Parents: 1eacb97
Author: isapego <isapego@gridgain.com>
Authored: Fri Feb 12 16:22:31 2016 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Fri Feb 12 16:22:31 2016 +0300

----------------------------------------------------------------------
 modules/platforms/cpp/binary/Makefile.am        |   4 +-
 .../platforms/cpp/binary/include/Makefile.am    |   4 +-
 .../include/ignite/binary/binary_raw_reader.h   |  42 ++-
 .../include/ignite/binary/binary_raw_writer.h   |  32 +++
 .../include/ignite/binary/binary_reader.h       |  44 +++
 .../include/ignite/binary/binary_writer.h       |  34 +++
 .../platforms/cpp/binary/include/ignite/date.h  | 138 ++++++++++
 .../include/ignite/impl/binary/binary_common.h  |   6 +
 .../ignite/impl/binary/binary_reader_impl.h     | 121 ++++++++-
 .../include/ignite/impl/binary/binary_utils.h   |  34 +++
 .../ignite/impl/binary/binary_writer_impl.h     |  72 +++++
 .../cpp/binary/include/ignite/timestamp.h       | 166 ++++++++++++
 .../cpp/binary/project/vs/binary.vcxproj        |   4 +
 .../binary/project/vs/binary.vcxproj.filters    |  12 +
 .../cpp/binary/src/binary/binary_raw_reader.cpp |  22 +-
 .../cpp/binary/src/binary/binary_raw_writer.cpp |  20 ++
 .../cpp/binary/src/binary/binary_reader.cpp     |  20 ++
 .../cpp/binary/src/binary/binary_writer.cpp     |  20 ++
 modules/platforms/cpp/binary/src/date.cpp       |  83 ++++++
 .../src/impl/binary/binary_reader_impl.cpp      | 144 ++++++++++
 .../cpp/binary/src/impl/binary/binary_utils.cpp |  26 ++
 .../src/impl/binary/binary_writer_impl.cpp      | 148 +++++++++-
 modules/platforms/cpp/binary/src/timestamp.cpp  | 117 ++++++++
 .../cpp/core-test/config/cache-query.xml        |   2 +
 .../include/ignite/binary_test_utils.h          |  96 +++++++
 .../src/binary_reader_writer_raw_test.cpp       | 124 +++++++++
 .../core-test/src/binary_reader_writer_test.cpp | 192 +++++++++++++
 .../cpp/core-test/src/binary_session_test.cpp   |  36 +++
 .../cpp/core-test/src/cache_query_test.cpp      | 269 +++++++++++++++++--
 .../platforms/cpp/core-test/src/cache_test.cpp  |  24 ++
 30 files changed, 2018 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/64cfa62a/modules/platforms/cpp/binary/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/Makefile.am b/modules/platforms/cpp/binary/Makefile.am
index 6f0ce16..f285bb5 100644
--- a/modules/platforms/cpp/binary/Makefile.am
+++ b/modules/platforms/cpp/binary/Makefile.am
@@ -43,7 +43,9 @@ COMMON_SRC = src/binary/binary_containers.cpp \
              src/impl/interop/interop_memory.cpp \
              src/impl/interop/interop_output_stream.cpp \
              src/impl/interop/interop_input_stream.cpp \
-             src/guid.cpp
+             src/guid.cpp \
+             src/date.cpp \
+             src/timestamp.cpp
 
 lib_LTLIBRARIES = libignite-binary.la
 libignite_binary_la_SOURCES = $(COMMON_SRC)

http://git-wip-us.apache.org/repos/asf/ignite/blob/64cfa62a/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 5f39503..8415331 100644
--- a/modules/platforms/cpp/binary/include/Makefile.am
+++ b/modules/platforms/cpp/binary/include/Makefile.am
@@ -42,7 +42,9 @@ nobase_include_HEADERS = ignite/binary/binary_raw_reader.h \
                          ignite/impl/interop/interop_stream_position_guard.h \
                          ignite/impl/interop/interop_output_stream.h \
                          ignite/impl/interop/interop_input_stream.h \
-                         ignite/guid.h
+                         ignite/guid.h \
+                         ignite/date.h \
+                         ignite/timestamp.h
 
 uninstall-hook:
 	find ${includedir}/ignite -type d -empty -delete

http://git-wip-us.apache.org/repos/asf/ignite/blob/64cfa62a/modules/platforms/cpp/binary/include/ignite/binary/binary_raw_reader.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/binary/binary_raw_reader.h b/modules/platforms/cpp/binary/include/ignite/binary/binary_raw_reader.h
index 5bb4b29..65271c5 100644
--- a/modules/platforms/cpp/binary/include/ignite/binary/binary_raw_reader.h
+++ b/modules/platforms/cpp/binary/include/ignite/binary/binary_raw_reader.h
@@ -32,6 +32,8 @@
 #include "ignite/binary/binary_consts.h"
 #include "ignite/binary/binary_containers.h"
 #include "ignite/guid.h"
+#include "ignite/date.h"
+#include "ignite/timestamp.h"
 
 namespace ignite
 {    
@@ -201,7 +203,7 @@ namespace ignite
              *     -1 will be returned in case array in stream was null.
              */
             int32_t ReadDoubleArray(double* res, int32_t len);
-            
+
             /**
              * Read Guid. Maps to "UUID" type in Java.
              *
@@ -222,6 +224,44 @@ namespace ignite
             int32_t ReadGuidArray(Guid* res, int32_t len);
 
             /**
+             * Read Date. Maps to "Date" type in Java.
+             *
+             * @return Result.
+             */
+            Date ReadDate();
+
+            /**
+             * Read array of Dates. Maps to "Date[]" type in Java.
+             *
+             * @param res Array to store data to.
+             * @param len Expected length of array.             
+             * @return Actual amount of elements read. If "len" argument is less than actual
+             *     array size or resulting array is set to null, nothing will be written
+             *     to resulting array and returned value will contain required array length.
+             *     -1 will be returned in case array in stream was null.
+             */
+            int32_t ReadDateArray(Date* res, int32_t len);
+
+            /**
+             * Read Timestamp. Maps to "Timestamp" type in Java.
+             *
+             * @return Result.
+             */
+            Timestamp ReadTimestamp();
+
+            /**
+             * Read array of Timestamps. Maps to "Timestamp[]" type in Java.
+             *
+             * @param res Array to store data to.
+             * @param len Expected length of array.             
+             * @return Actual amount of elements read. If "len" argument is less than actual
+             *     array size or resulting array is set to null, nothing will be written
+             *     to resulting array and returned value will contain required array length.
+             *     -1 will be returned in case array in stream was null.
+             */
+            int32_t ReadTimestampArray(Timestamp* res, int32_t len);
+
+            /**
              * Read string.
              *
              * @param res Array to store data to. 

http://git-wip-us.apache.org/repos/asf/ignite/blob/64cfa62a/modules/platforms/cpp/binary/include/ignite/binary/binary_raw_writer.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/binary/binary_raw_writer.h b/modules/platforms/cpp/binary/include/ignite/binary/binary_raw_writer.h
index 9bbf4ed..b1267c9 100644
--- a/modules/platforms/cpp/binary/include/ignite/binary/binary_raw_writer.h
+++ b/modules/platforms/cpp/binary/include/ignite/binary/binary_raw_writer.h
@@ -31,6 +31,8 @@
 #include "ignite/binary/binary_consts.h"
 #include "ignite/binary/binary_containers.h"
 #include "ignite/guid.h"
+#include "ignite/date.h"
+#include "ignite/timestamp.h"
 
 namespace ignite
 {
@@ -185,6 +187,36 @@ namespace ignite
             void WriteGuidArray(const Guid* val, int32_t len);
 
             /**
+             * Write Date. Maps to "Date" type in Java.
+             *
+             * @param val Value.
+             */
+            void WriteDate(const Date& val);
+
+            /**
+             * Write array of Dates. Maps to "Date[]" type in Java.
+             *
+             * @param val Array.
+             * @param len Array length.
+             */
+            void WriteDateArray(const Date* val, int32_t len);
+
+            /**
+             * Write Timestamp. Maps to "Timestamp" type in Java.
+             *
+             * @param val Value.
+             */
+            void WriteTimestamp(const Timestamp& val);
+
+            /**
+             * Write array of Timestamps. Maps to "Timestamp[]" type in Java.
+             *
+             * @param val Array.
+             * @param len Array length.
+             */
+            void WriteTimestampArray(const Timestamp* val, int32_t len);
+
+            /**
              * Write string.
              *
              * @param val Null-terminated character array.

http://git-wip-us.apache.org/repos/asf/ignite/blob/64cfa62a/modules/platforms/cpp/binary/include/ignite/binary/binary_reader.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/binary/binary_reader.h b/modules/platforms/cpp/binary/include/ignite/binary/binary_reader.h
index f3d5c40..fb15526 100644
--- a/modules/platforms/cpp/binary/include/ignite/binary/binary_reader.h
+++ b/modules/platforms/cpp/binary/include/ignite/binary/binary_reader.h
@@ -30,6 +30,8 @@
 
 #include "ignite/binary/binary_raw_reader.h"
 #include "ignite/guid.h"
+#include "ignite/date.h"
+#include "ignite/timestamp.h"
 
 namespace ignite
 {    
@@ -239,6 +241,48 @@ namespace ignite
             int32_t ReadGuidArray(const char* fieldName, Guid* res, int32_t len);
 
             /**
+             * Read Date. Maps to "Date" type in Java.
+             *
+             * @param fieldName Field name.
+             * @return Result.
+             */
+            Date ReadDate(const char* fieldName);
+
+            /**
+             * Read array of Dates. Maps to "Date[]" type in Java.
+             *
+             * @param fieldName Field name.
+             * @param res Array to store data to.
+             * @param len Expected length of array.
+             * @return Actual amount of elements read. If "len" argument is less than actual
+             *     array size or resulting array is set to null, nothing will be written
+             *     to resulting array and returned value will contain required array length.
+             *     -1 will be returned in case array in stream was null.
+             */
+            int32_t ReadDateArray(const char* fieldName, Date* res, const int32_t len);
+
+            /**
+             * Read Timestamp. Maps to "Timestamp" type in Java.
+             *
+             * @param fieldName Field name.
+             * @return Result.
+             */
+            Timestamp ReadTimestamp(const char* fieldName);
+
+            /**
+             * Read array of Timestamps. Maps to "Timestamp[]" type in Java.
+             *
+             * @param fieldName Field name.
+             * @param res Array to store data to.
+             * @param len Expected length of array.
+             * @return Actual amount of elements read. If "len" argument is less than actual
+             *     array size or resulting array is set to null, nothing will be written
+             *     to resulting array and returned value will contain required array length.
+             *     -1 will be returned in case array in stream was null.
+             */
+            int32_t ReadTimestampArray(const char* fieldName, Timestamp* res, const int32_t len);
+
+            /**
              * Read string.
              *
              * @param fieldName Field name.

http://git-wip-us.apache.org/repos/asf/ignite/blob/64cfa62a/modules/platforms/cpp/binary/include/ignite/binary/binary_writer.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/binary/binary_writer.h b/modules/platforms/cpp/binary/include/ignite/binary/binary_writer.h
index 475f454..ed76c5b 100644
--- a/modules/platforms/cpp/binary/include/ignite/binary/binary_writer.h
+++ b/modules/platforms/cpp/binary/include/ignite/binary/binary_writer.h
@@ -201,6 +201,40 @@ namespace ignite
             void WriteGuidArray(const char* fieldName, const Guid* val, int32_t len);
 
             /**
+             * Write Date. Maps to "Date" type in Java.
+             *
+             * @param fieldName Field name.
+             * @param val Value.
+             */
+            void WriteDate(const char* fieldName, const Date& val);
+
+            /**
+             * Write array of Dates. Maps to "Date[]" type in Java.
+             *
+             * @param fieldName Field name.
+             * @param val Array.
+             * @param len Array length.
+             */
+            void WriteDateArray(const char* fieldName, const Date* val, const int32_t len);
+
+            /**
+             * Write Timestamp. Maps to "Timestamp" type in Java.
+             *
+             * @param fieldName Field name.
+             * @param val Value.
+             */
+            void WriteTimestamp(const char* fieldName, const Timestamp& val);
+
+            /**
+             * Write array of Timestamps. Maps to "Timestamp[]" type in Java.
+             *
+             * @param fieldName Field name.
+             * @param val Array.
+             * @param len Array length.
+             */
+            void WriteTimestampArray(const char* fieldName, const Timestamp* val, const int32_t len);
+
+            /**
              * Write string.
              *
              * @param fieldName Field name.

http://git-wip-us.apache.org/repos/asf/ignite/blob/64cfa62a/modules/platforms/cpp/binary/include/ignite/date.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/date.h b/modules/platforms/cpp/binary/include/ignite/date.h
new file mode 100644
index 0000000..def073f
--- /dev/null
+++ b/modules/platforms/cpp/binary/include/ignite/date.h
@@ -0,0 +1,138 @@
+/*
+ * 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::Date class.
+ */
+
+#ifndef _IGNITE_DATE
+#define _IGNITE_DATE
+
+#include <stdint.h>
+
+#include <ignite/common/common.h>
+
+namespace ignite
+{
+    /**
+     * Date type.
+     */
+    class IGNITE_IMPORT_EXPORT Date
+    {
+    public:
+        /**
+         * Default constructor.
+         */
+        Date();
+
+        /**
+         * Copy constructor.
+         *
+         * @param another Another instance.
+         */
+        Date(const Date& another);
+
+        /**
+         * Constructor.
+         *
+         * @param ms Number of milliseconds since 00:00 hours, Jan 1, 1970 UTC.
+         */
+        Date(int64_t ms);
+
+        /**
+         * Copy operator.
+         *
+         * @param another Another instance.
+         * @return This.
+         */
+        Date& operator=(const Date& another);
+
+        /**
+         * Returns number of milliseconds since 00:00 hours, Jan 1, 1970 UTC.
+         *
+         * @return Number of milliseconds since 00:00 hours, Jan 1, 1970 UTC.
+         */
+        int64_t GetMilliseconds() const;
+
+        /**
+         * Returns number of seconds since 00:00 hours, Jan 1, 1970 UTC.
+         *
+         * @return Number of seconds since 00:00 hours, Jan 1, 1970 UTC.
+         */
+        int64_t GetSeconds() const;
+
+        /**
+         * Comparison operator override.
+         *
+         * @param val1 First value.
+         * @param val2 Second value.
+         * @return True if equal.
+         */
+        friend bool IGNITE_IMPORT_EXPORT operator==(Date& val1, Date& val2);
+
+        /**
+         * Comparison operator override.
+         *
+         * @param val1 First value.
+         * @param val2 Second value.
+         * @return True if not equal.
+         */
+        friend bool IGNITE_IMPORT_EXPORT operator!=(Date& val1, Date& val2);
+
+        /**
+         * Comparison operator override.
+         *
+         * @param val1 First value.
+         * @param val2 Second value.
+         * @return True if less.
+         */
+        friend bool IGNITE_IMPORT_EXPORT operator<(Date& val1, Date& val2);
+
+        /**
+         * Comparison operator override.
+         *
+         * @param val1 First value.
+         * @param val2 Second value.
+         * @return True if less or equal.
+         */
+        friend bool IGNITE_IMPORT_EXPORT operator<=(Date& val1, Date& val2);
+
+        /**
+         * Comparison operator override.
+         *
+         * @param val1 First value.
+         * @param val2 Second value.
+         * @return True if gretter.
+         */
+        friend bool IGNITE_IMPORT_EXPORT operator>(Date& val1, Date& val2);
+
+        /**
+         * Comparison operator override.
+         *
+         * @param val1 First value.
+         * @param val2 Second value.
+         * @return True if gretter or equal.
+         */
+        friend bool IGNITE_IMPORT_EXPORT operator>=(Date& val1, Date& val2);
+    private:
+        /** Number of milliseconds since 00:00 hours, Jan 1, 1970 UTC. */
+        int64_t milliseconds;  
+    };
+}
+
+#endif //_IGNITE_DATE
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/64cfa62a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_common.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_common.h b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_common.h
index 979d2ed..fe0d878 100644
--- a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_common.h
+++ b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_common.h
@@ -152,6 +152,12 @@ namespace ignite
             /** Type: binary object. */
             const int8_t IGNITE_TYPE_BINARY = 27;
 
+            /** Type: timestamp. */
+            const int8_t IGNITE_TYPE_TIMESTAMP = 33;
+
+            /** Type: timestamp array. */
+            const int8_t IGNITE_TYPE_ARRAY_TIMESTAMP = 34;
+
             /** Read/write single object. */
             const int32_t IGNITE_BINARY_MODE_SINGLE = 0;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/64cfa62a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_reader_impl.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_reader_impl.h b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_reader_impl.h
index f00b071..cf36204 100644
--- a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_reader_impl.h
+++ b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_reader_impl.h
@@ -30,6 +30,8 @@
 #include "ignite/binary/binary_consts.h"
 #include "ignite/binary/binary_type.h"
 #include "ignite/guid.h"
+#include "ignite/date.h"
+#include "ignite/timestamp.h"
 
 namespace ignite
 {
@@ -430,6 +432,86 @@ namespace ignite
                 int32_t ReadGuidArray(const char* fieldName, Guid* res, const int32_t len);
 
                 /**
+                 * Read Date. Maps to "Date" type in Java.
+                 *
+                 * @return Result.
+                 */
+                Date ReadDate();
+
+                /**
+                 * Read array of Dates. Maps to "Date[]" type in Java.
+                 *
+                 * @param res Array to store data to.
+                 * @param len Expected length of array.             
+                 * @return Actual amount of elements read. If "len" argument is less than actual
+                 *     array size or resulting array is set to null, nothing will be written
+                 *     to resulting array and returned value will contain required array length.
+                 *     -1 will be returned in case array in stream was null.
+                 */
+                int32_t ReadDateArray(Date* res, int32_t len);
+
+                /**
+                 * Read Date. Maps to "Date" type in Java.
+                 *
+                 * @param fieldName Field name.
+                 * @return Result.
+                 */
+                Date ReadDate(const char* fieldName);
+
+                /**
+                 * Read array of Dates. Maps to "Date[]" type in Java.
+                 *
+                 * @param fieldName Field name.
+                 * @param res Array to store data to.
+                 * @param len Expected length of array.
+                 * @return Actual amount of elements read. If "len" argument is less than actual
+                 *     array size or resulting array is set to null, nothing will be written
+                 *     to resulting array and returned value will contain required array length.
+                 *     -1 will be returned in case array in stream was null.
+                 */
+                int32_t ReadDateArray(const char* fieldName, Date* res, const int32_t len);
+
+                /**
+                 * Read Timestamp. Maps to "Timestamp" type in Java.
+                 *
+                 * @return Result.
+                 */
+                Timestamp ReadTimestamp();
+
+                /**
+                 * Read array of Timestamps. Maps to "Timestamp[]" type in Java.
+                 *
+                 * @param res Array to store data to.
+                 * @param len Expected length of array.             
+                 * @return Actual amount of elements read. If "len" argument is less than actual
+                 *     array size or resulting array is set to null, nothing will be written
+                 *     to resulting array and returned value will contain required array length.
+                 *     -1 will be returned in case array in stream was null.
+                 */
+                int32_t ReadTimestampArray(Timestamp* res, int32_t len);
+
+                /**
+                 * Read Timestamp. Maps to "Timestamp" type in Java.
+                 *
+                 * @param fieldName Field name.
+                 * @return Result.
+                 */
+                Timestamp ReadTimestamp(const char* fieldName);
+
+                /**
+                 * Read array of Timestamps. Maps to "Timestamp[]" type in Java.
+                 *
+                 * @param fieldName Field name.
+                 * @param res Array to store data to.
+                 * @param len Expected length of array.
+                 * @return Actual amount of elements read. If "len" argument is less than actual
+                 *     array size or resulting array is set to null, nothing will be written
+                 *     to resulting array and returned value will contain required array length.
+                 *     -1 will be returned in case array in stream was null.
+                 */
+                int32_t ReadTimestampArray(const char* fieldName, Timestamp* res, const int32_t len);
+
+                /**
                  * Read string.
                  *
                  * @param len Expected length of string.
@@ -839,7 +921,7 @@ namespace ignite
                         default:
                         {
                             IGNITE_ERROR_2(ignite::IgniteError::IGNITE_ERR_BINARY, 
-                                           "Unexpected header during deserialization: ", hdr);
+                                           "Unexpected header during deserialization: ", static_cast<int>(hdr));
                         }
                     }
                 }
@@ -926,6 +1008,32 @@ namespace ignite
                 );
 
                 /**
+                 * Internal routine to read Date array.
+                 *
+                 * @param stream Stream.
+                 * @param res Resulting array.
+                 * @param len Length.
+                 */
+                static void ReadDateArrayInternal(
+                    interop::InteropInputStream* stream, 
+                    Date* res,
+                    const int32_t len
+                );
+
+                /**
+                 * Internal routine to read Timestamp array.
+                 *
+                 * @param stream Stream.
+                 * @param res Resulting array.
+                 * @param len Length.
+                 */
+                static void ReadTimestampArrayInternal(
+                    interop::InteropInputStream* stream, 
+                    Timestamp* res,
+                    const int32_t len
+                );
+
+                /**
                  * Read single value in raw mode.
                  * 
                  * @param stream Stream.
@@ -1113,11 +1221,11 @@ namespace ignite
                         if (hdr == expHdr)
                             return func(stream);
                         else if (hdr == IGNITE_HDR_NULL)
-                            return Guid();
+                            return T();
                         else {
                             ThrowOnInvalidHeader(stream->Position() - 1, expHdr, hdr);
 
-                            return Guid();
+                            return T();
                         }
                     }
                 }
@@ -1271,11 +1379,16 @@ namespace ignite
             template<>
             double IGNITE_IMPORT_EXPORT BinaryReaderImpl::ReadTopObject<double>();
 
-            
             template<>
             Guid IGNITE_IMPORT_EXPORT BinaryReaderImpl::ReadTopObject<Guid>();
 
             template<>
+            Date IGNITE_IMPORT_EXPORT BinaryReaderImpl::ReadTopObject<Date>();
+
+            template<>
+            Timestamp IGNITE_IMPORT_EXPORT BinaryReaderImpl::ReadTopObject<Timestamp>();
+
+            template<>
             inline std::string IGNITE_IMPORT_EXPORT BinaryReaderImpl::ReadTopObject<std::string>()
             {
                 int8_t typeId = stream->ReadInt8();

http://git-wip-us.apache.org/repos/asf/ignite/blob/64cfa62a/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 c1a1ceb..fde3353 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
@@ -21,6 +21,8 @@
 #include <stdint.h>
 
 #include "ignite/guid.h"
+#include "ignite/date.h"
+#include "ignite/timestamp.h"
 
 namespace ignite
 {
@@ -329,6 +331,38 @@ namespace ignite
                 static void WriteGuid(interop::InteropOutputStream* stream, const Guid val);
 
                 /**
+                 * Utility method to read Date from stream.
+                 *
+                 * @param stream Stream.
+                 * @param res Value.
+                 */
+                static Date ReadDate(interop::InteropInputStream* stream);
+
+                /**
+                 * Utility method to write Date to stream.
+                 *
+                 * @param stream Stream.
+                 * @param val Value.
+                 */
+                static void WriteDate(interop::InteropOutputStream* stream, const Date val);
+
+                /**
+                 * Utility method to read Timestamp from stream.
+                 *
+                 * @param stream Stream.
+                 * @param res Value.
+                 */
+                static Timestamp ReadTimestamp(interop::InteropInputStream* stream);
+
+                /**
+                 * Utility method to write Timestamp to stream.
+                 *
+                 * @param stream Stream.
+                 * @param val Value.
+                 */
+                static void WriteTimestamp(interop::InteropOutputStream* stream, const Timestamp val);
+
+                /**
                  * Utility method to write string to stream.
                  *
                  * @param stream Stream.

http://git-wip-us.apache.org/repos/asf/ignite/blob/64cfa62a/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 1b47d9e..a490374 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
@@ -34,6 +34,8 @@
 #include "ignite/binary/binary_consts.h"
 #include "ignite/binary/binary_type.h"
 #include "ignite/guid.h"
+#include "ignite/date.h"
+#include "ignite/timestamp.h"
 #include "binary_type_manager.h"
 
 namespace ignite
@@ -357,6 +359,70 @@ namespace ignite
                 void WriteGuidArray(const char* fieldName, const Guid* val, const int32_t len);
 
                 /**
+                 * Write Date. Maps to "Date" type in Java.
+                 *
+                 * @param val Value.
+                 */
+                void WriteDate(const Date& val);
+
+                /**
+                 * Write array of Dates. Maps to "Date[]" type in Java.
+                 *
+                 * @param val Array.
+                 * @param len Array length.
+                 */
+                void WriteDateArray(const Date* val, const int32_t len);
+
+                /**
+                 * Write Date. Maps to "Date" type in Java.
+                 *
+                 * @param fieldName Field name.
+                 * @param val Value.
+                 */
+                void WriteDate(const char* fieldName, const Date& val);
+
+                /**
+                 * Write array of Dates. Maps to "Date[]" type in Java.
+                 *
+                 * @param fieldName Field name.
+                 * @param val Array.
+                 * @param len Array length.
+                 */
+                void WriteDateArray(const char* fieldName, const Date* val, const int32_t len);
+
+                /**
+                 * Write Timestamp. Maps to "Timestamp" type in Java.
+                 *
+                 * @param val Value.
+                 */
+                void WriteTimestamp(const Timestamp& val);
+
+                /**
+                 * Write array of Timestamps. Maps to "Timestamp[]" type in Java.
+                 *
+                 * @param val Array.
+                 * @param len Array length.
+                 */
+                void WriteTimestampArray(const Timestamp* val, const int32_t len);
+
+                /**
+                 * Write Timestamp. Maps to "Timestamp" type in Java.
+                 *
+                 * @param fieldName Field name.
+                 * @param val Value.
+                 */
+                void WriteTimestamp(const char* fieldName, const Timestamp& val);
+
+                /**
+                 * Write array of Timestamps. Maps to "Timestamp[]" type in Java.
+                 *
+                 * @param fieldName Field name.
+                 * @param val Array.
+                 * @param len Array length.
+                 */
+                void WriteTimestampArray(const char* fieldName, const Timestamp* val, const int32_t len);
+
+                /**
                  * Write string.
                  *
                  * @param val String.
@@ -896,6 +962,12 @@ namespace ignite
             void IGNITE_IMPORT_EXPORT BinaryWriterImpl::WriteTopObject(const Guid& obj);
 
             template<>
+            void IGNITE_IMPORT_EXPORT BinaryWriterImpl::WriteTopObject(const Date& obj);
+
+            template<>
+            void IGNITE_IMPORT_EXPORT BinaryWriterImpl::WriteTopObject(const Timestamp& obj);
+
+            template<>
             inline void IGNITE_IMPORT_EXPORT BinaryWriterImpl::WriteTopObject(const std::string& obj)
             {
                 const char* obj0 = obj.c_str();

http://git-wip-us.apache.org/repos/asf/ignite/blob/64cfa62a/modules/platforms/cpp/binary/include/ignite/timestamp.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/timestamp.h b/modules/platforms/cpp/binary/include/ignite/timestamp.h
new file mode 100644
index 0000000..3f14aec
--- /dev/null
+++ b/modules/platforms/cpp/binary/include/ignite/timestamp.h
@@ -0,0 +1,166 @@
+/*
+ * 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::Timestamp class.
+ */
+
+#ifndef _IGNITE_TIMESTAMP
+#define _IGNITE_TIMESTAMP
+
+#include <stdint.h>
+
+#include <ignite/common/common.h>
+
+#include <ignite/date.h>
+
+namespace ignite
+{
+    /**
+     * Timestamp type.
+     */
+    class IGNITE_IMPORT_EXPORT Timestamp
+    {
+    public:
+        /**
+         * Default constructor.
+         */
+        Timestamp();
+
+        /**
+         * Copy constructor.
+         *
+         * @param another Another instance.
+         */
+        Timestamp(const Timestamp& another);
+
+        /**
+         * Constructor.
+         *
+         * @param ms Number of milliseconds since 00:00 hours, Jan 1, 1970 UTC.
+         */
+        Timestamp(int64_t ms);
+
+        /**
+         * Constructor.
+         *
+         * @param seconds Number of seconds since 00:00 hours, Jan 1, 1970 UTC.
+         * @param fractionNs Fractional second component in nanoseconds.
+         *     Must be in range [0..999999999].
+         */
+        Timestamp(int64_t seconds, int32_t fractionNs);
+
+        /**
+         * Copy operator.
+         *
+         * @param another Another instance.
+         * @return This.
+         */
+        Timestamp& operator=(const Timestamp& another);
+
+        /**
+         * Returns number of milliseconds since 00:00 hours, Jan 1, 1970 UTC.
+         *
+         * @return Number of milliseconds since 00:00 hours, Jan 1, 1970 UTC.
+         */
+        int64_t GetMilliseconds() const;
+
+        /**
+         * Returns number of seconds since 00:00 hours, Jan 1, 1970 UTC.
+         *
+         * @return Number of seconds since 00:00 hours, Jan 1, 1970 UTC.
+         */
+        int64_t GetSeconds() const;
+
+        /**
+         * Returns number of nanoseconds - fractional seconds component.
+         *
+         * @return Fractional second component expressed in nanoseconds.
+         */
+        int32_t GetSecondFraction() const;
+
+        /**
+         * Returns corresponding date.
+         *
+         * @return Corresponding date.
+         */
+        Date GetDate() const;
+
+        /**
+         * Comparison operator override.
+         *
+         * @param val1 First value.
+         * @param val2 Second value.
+         * @return True if equal.
+         */
+        friend bool IGNITE_IMPORT_EXPORT operator==(Timestamp& val1, Timestamp& val2);
+
+        /**
+         * Comparison operator override.
+         *
+         * @param val1 First value.
+         * @param val2 Second value.
+         * @return True if not equal.
+         */
+        friend bool IGNITE_IMPORT_EXPORT operator!=(Timestamp& val1, Timestamp& val2);
+
+        /**
+         * Comparison operator override.
+         *
+         * @param val1 First value.
+         * @param val2 Second value.
+         * @return True if less.
+         */
+        friend bool IGNITE_IMPORT_EXPORT operator<(Timestamp& val1, Timestamp& val2);
+
+        /**
+         * Comparison operator override.
+         *
+         * @param val1 First value.
+         * @param val2 Second value.
+         * @return True if less or equal.
+         */
+        friend bool IGNITE_IMPORT_EXPORT operator<=(Timestamp& val1, Timestamp& val2);
+
+        /**
+         * Comparison operator override.
+         *
+         * @param val1 First value.
+         * @param val2 Second value.
+         * @return True if gretter.
+         */
+        friend bool IGNITE_IMPORT_EXPORT operator>(Timestamp& val1, Timestamp& val2);
+
+        /**
+         * Comparison operator override.
+         *
+         * @param val1 First value.
+         * @param val2 Second value.
+         * @return True if gretter or equal.
+         */
+        friend bool IGNITE_IMPORT_EXPORT operator>=(Timestamp& val1, Timestamp& val2);
+    private:
+        /** Number of seconds since 00:00 hours, Jan 1, 1970 UTC. */
+        int64_t seconds;
+
+        /** Fractional second component in nanoseconds. */
+        int32_t fractionNs;
+    };
+}
+
+#endif //_IGNITE_TIMESTAMP
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/64cfa62a/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 ae463e8..a59a92f 100644
--- a/modules/platforms/cpp/binary/project/vs/binary.vcxproj
+++ b/modules/platforms/cpp/binary/project/vs/binary.vcxproj
@@ -192,6 +192,7 @@
     <ClInclude Include="..\..\include\ignite\binary\binary_reader.h" />
     <ClInclude Include="..\..\include\ignite\binary\binary_type.h" />
     <ClInclude Include="..\..\include\ignite\binary\binary_writer.h" />
+    <ClInclude Include="..\..\include\ignite\date.h" />
     <ClInclude Include="..\..\include\ignite\guid.h" />
     <ClInclude Include="..\..\include\ignite\impl\binary\binary_common.h" />
     <ClInclude Include="..\..\include\ignite\impl\binary\binary_id_resolver.h" />
@@ -210,6 +211,7 @@
     <ClInclude Include="..\..\include\ignite\impl\interop\interop_memory.h" />
     <ClInclude Include="..\..\include\ignite\impl\interop\interop_output_stream.h" />
     <ClInclude Include="..\..\include\ignite\impl\interop\interop_stream_position_guard.h" />
+    <ClInclude Include="..\..\include\ignite\timestamp.h" />
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="..\..\src\binary\binary_containers.cpp" />
@@ -218,6 +220,7 @@
     <ClCompile Include="..\..\src\binary\binary_reader.cpp" />
     <ClCompile Include="..\..\src\binary\binary_type.cpp" />
     <ClCompile Include="..\..\src\binary\binary_writer.cpp" />
+    <ClCompile Include="..\..\src\date.cpp" />
     <ClCompile Include="..\..\src\guid.cpp" />
     <ClCompile Include="..\..\src\impl\binary\binary_reader_impl.cpp" />
     <ClCompile Include="..\..\src\impl\binary\binary_schema.cpp" />
@@ -232,6 +235,7 @@
     <ClCompile Include="..\..\src\impl\interop\interop_input_stream.cpp" />
     <ClCompile Include="..\..\src\impl\interop\interop_memory.cpp" />
     <ClCompile Include="..\..\src\impl\interop\interop_output_stream.cpp" />
+    <ClCompile Include="..\..\src\timestamp.cpp" />
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">

http://git-wip-us.apache.org/repos/asf/ignite/blob/64cfa62a/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 5d2e91f..a505057 100644
--- a/modules/platforms/cpp/binary/project/vs/binary.vcxproj.filters
+++ b/modules/platforms/cpp/binary/project/vs/binary.vcxproj.filters
@@ -97,6 +97,12 @@
     <ClInclude Include="..\..\include\ignite\impl\ignite_environment.h">
       <Filter>Code\impl</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\include\ignite\date.h">
+      <Filter>Code</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\ignite\timestamp.h">
+      <Filter>Code</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="..\..\src\binary\binary_containers.cpp">
@@ -159,5 +165,11 @@
     <ClCompile Include="..\..\src\impl\ignite_environment.cpp">
       <Filter>Code\impl</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\date.cpp">
+      <Filter>Code</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\timestamp.cpp">
+      <Filter>Code</Filter>
+    </ClCompile>
   </ItemGroup>
 </Project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/64cfa62a/modules/platforms/cpp/binary/src/binary/binary_raw_reader.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/src/binary/binary_raw_reader.cpp b/modules/platforms/cpp/binary/src/binary/binary_raw_reader.cpp
index 093c13f..e472588 100644
--- a/modules/platforms/cpp/binary/src/binary/binary_raw_reader.cpp
+++ b/modules/platforms/cpp/binary/src/binary/binary_raw_reader.cpp
@@ -117,7 +117,27 @@ namespace ignite
         int32_t BinaryRawReader::ReadGuidArray(Guid* res, const int32_t len)
         {
             return impl->ReadGuidArray(res, len);
-        }        
+        }
+
+        Date BinaryRawReader::ReadDate()
+        {
+            return impl->ReadDate();
+        }
+
+        int32_t BinaryRawReader::ReadDateArray(Date* res, int32_t len)
+        {
+            return impl->ReadDateArray(res, len);
+        }
+
+        Timestamp BinaryRawReader::ReadTimestamp()
+        {
+            return impl->ReadTimestamp();
+        }
+
+        int32_t BinaryRawReader::ReadTimestampArray(Timestamp * res, int32_t len)
+        {
+            return impl->ReadTimestampArray(res, len);
+        }
 
         int32_t BinaryRawReader::ReadString(char* res, const int32_t len)
         {

http://git-wip-us.apache.org/repos/asf/ignite/blob/64cfa62a/modules/platforms/cpp/binary/src/binary/binary_raw_writer.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/src/binary/binary_raw_writer.cpp b/modules/platforms/cpp/binary/src/binary/binary_raw_writer.cpp
index 31f29a9..a83c74b 100644
--- a/modules/platforms/cpp/binary/src/binary/binary_raw_writer.cpp
+++ b/modules/platforms/cpp/binary/src/binary/binary_raw_writer.cpp
@@ -119,6 +119,26 @@ namespace ignite
             impl->WriteGuidArray(val, len);
         }
 
+        void BinaryRawWriter::WriteDate(const Date& val)
+        {
+            impl->WriteDate(val);
+        }
+
+        void BinaryRawWriter::WriteDateArray(const Date* val, int32_t len)
+        {
+            impl->WriteDateArray(val, len);
+        }
+
+        void BinaryRawWriter::WriteTimestamp(const Timestamp& val)
+        {
+            impl->WriteTimestamp(val);
+        }
+
+        void BinaryRawWriter::WriteTimestampArray(const Timestamp* val, int32_t len)
+        {
+            impl->WriteTimestampArray(val, len);
+        }
+
         void BinaryRawWriter::WriteString(const char* val)
         {
             if (val)

http://git-wip-us.apache.org/repos/asf/ignite/blob/64cfa62a/modules/platforms/cpp/binary/src/binary/binary_reader.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/src/binary/binary_reader.cpp b/modules/platforms/cpp/binary/src/binary/binary_reader.cpp
index 005ec13..814db83 100644
--- a/modules/platforms/cpp/binary/src/binary/binary_reader.cpp
+++ b/modules/platforms/cpp/binary/src/binary/binary_reader.cpp
@@ -118,6 +118,26 @@ namespace ignite
         {
             return impl->ReadGuidArray(fieldName, res, len);
         }
+
+        Date BinaryReader::ReadDate(const char * fieldName)
+        {
+            return impl->ReadDate(fieldName);
+        }
+
+        int32_t BinaryReader::ReadDateArray(const char * fieldName, Date * res, const int32_t len)
+        {
+            return impl->ReadDateArray(fieldName, res, len);
+        }
+
+        Timestamp BinaryReader::ReadTimestamp(const char * fieldName)
+        {
+            return impl->ReadTimestamp(fieldName);
+        }
+
+        int32_t BinaryReader::ReadTimestampArray(const char * fieldName, Timestamp * res, const int32_t len)
+        {
+            return impl->ReadTimestampArray(fieldName, res, len);
+        }
         
         int32_t BinaryReader::ReadString(const char* fieldName, char* res, int32_t len)
         {

http://git-wip-us.apache.org/repos/asf/ignite/blob/64cfa62a/modules/platforms/cpp/binary/src/binary/binary_writer.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/src/binary/binary_writer.cpp b/modules/platforms/cpp/binary/src/binary/binary_writer.cpp
index 3247e66..efbc0ce 100644
--- a/modules/platforms/cpp/binary/src/binary/binary_writer.cpp
+++ b/modules/platforms/cpp/binary/src/binary/binary_writer.cpp
@@ -119,6 +119,26 @@ namespace ignite
             impl->WriteGuidArray(fieldName, val, len);
         }
 
+        void BinaryWriter::WriteDate(const char * fieldName, const Date & val)
+        {
+            impl->WriteDate(fieldName, val);
+        }
+
+        void BinaryWriter::WriteDateArray(const char * fieldName, const Date * val, const int32_t len)
+        {
+            impl->WriteDateArray(fieldName, val, len);
+        }
+
+        void BinaryWriter::WriteTimestamp(const char * fieldName, const Timestamp & val)
+        {
+            impl->WriteTimestamp(fieldName, val);
+        }
+
+        void BinaryWriter::WriteTimestampArray(const char * fieldName, const Timestamp * val, const int32_t len)
+        {
+            impl->WriteTimestampArray(fieldName, val, len);
+        }
+
         void BinaryWriter::WriteString(const char* fieldName, const char* val)
         {
             if (val)

http://git-wip-us.apache.org/repos/asf/ignite/blob/64cfa62a/modules/platforms/cpp/binary/src/date.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/src/date.cpp b/modules/platforms/cpp/binary/src/date.cpp
new file mode 100644
index 0000000..56cca6d
--- /dev/null
+++ b/modules/platforms/cpp/binary/src/date.cpp
@@ -0,0 +1,83 @@
+/*
+ * 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/date.h"
+
+namespace ignite
+{
+    Date::Date() : milliseconds(0)
+    {
+        // No-op.
+    }
+
+    Date::Date(const Date& another) : milliseconds(another.milliseconds)
+    {
+        // No-op.
+    }
+
+    Date::Date(int64_t ms) : milliseconds(ms)
+    {
+        // No-op.
+    }
+
+    Date& Date::operator=(const Date& another)
+    {
+        milliseconds = another.milliseconds;
+
+        return *this;
+    }
+
+    int64_t Date::GetMilliseconds() const
+    {
+        return milliseconds;
+    }
+
+    int64_t Date::GetSeconds() const
+    {
+        return milliseconds / 1000;
+    }
+
+    bool operator==(Date& val1, Date& val2)
+    {
+        return val1.milliseconds == val2.milliseconds;
+    }
+
+    bool operator!=(Date& val1, Date& val2)
+    {
+        return val1.milliseconds != val2.milliseconds;
+    }
+
+    bool operator<(Date& val1, Date& val2)
+    {
+        return val1.milliseconds < val2.milliseconds;
+    }
+
+    bool operator<=(Date& val1, Date& val2)
+    {
+        return val1.milliseconds <= val2.milliseconds;
+    }
+
+    bool operator>(Date& val1, Date& val2)
+    {
+        return val1.milliseconds > val2.milliseconds;
+    }
+
+    bool operator>=(Date& val1, Date& val2)
+    {
+        return val1.milliseconds >= val2.milliseconds;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/64cfa62a/modules/platforms/cpp/binary/src/impl/binary/binary_reader_impl.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/src/impl/binary/binary_reader_impl.cpp b/modules/platforms/cpp/binary/src/impl/binary/binary_reader_impl.cpp
index b33be8e..a91f36e 100644
--- a/modules/platforms/cpp/binary/src/impl/binary/binary_reader_impl.cpp
+++ b/modules/platforms/cpp/binary/src/impl/binary/binary_reader_impl.cpp
@@ -269,6 +269,118 @@ namespace ignite
                     *(res + i) = ReadNullable<Guid>(stream, BinaryUtils::ReadGuid, IGNITE_TYPE_UUID);
             }
 
+            Date BinaryReaderImpl::ReadDate()
+            {
+                CheckRawMode(true);
+                CheckSingleMode(true);
+
+                return ReadNullable(stream, BinaryUtils::ReadDate, IGNITE_TYPE_DATE);
+            }
+
+            int32_t BinaryReaderImpl::ReadDateArray(Date* res, int32_t len)
+            {
+                CheckRawMode(true);
+                CheckSingleMode(true);
+
+                return ReadArrayInternal<Date>(res, len, stream, ReadDateArrayInternal, IGNITE_TYPE_ARRAY_DATE);
+            }
+
+            Date BinaryReaderImpl::ReadDate(const char* fieldName)
+            {
+                CheckRawMode(false);
+                CheckSingleMode(true);
+
+                int32_t fieldId = idRslvr->GetFieldId(typeId, fieldName);
+                int32_t fieldPos = FindField(fieldId);
+
+                if (fieldPos <= 0)
+                    return Date();
+
+                stream->Position(fieldPos);
+
+                return ReadNullable(stream, BinaryUtils::ReadDate, IGNITE_TYPE_DATE);
+            }
+
+            int32_t BinaryReaderImpl::ReadDateArray(const char* fieldName, Date* res, const int32_t len)
+            {
+                CheckRawMode(false);
+                CheckSingleMode(true);
+
+                int32_t fieldId = idRslvr->GetFieldId(typeId, fieldName);
+                int32_t fieldPos = FindField(fieldId);
+
+                if (fieldPos <= 0)
+                    return -1;
+
+                stream->Position(fieldPos);
+
+                int32_t realLen = ReadArrayInternal<Date>(res, len, stream, ReadDateArrayInternal, IGNITE_TYPE_ARRAY_DATE);
+
+                return realLen;
+            }
+
+            void BinaryReaderImpl::ReadDateArrayInternal(InteropInputStream* stream, Date* res, const int32_t len)
+            {
+                for (int i = 0; i < len; i++)
+                    *(res + i) = ReadNullable<Date>(stream, BinaryUtils::ReadDate, IGNITE_TYPE_DATE);
+            }
+
+            Timestamp BinaryReaderImpl::ReadTimestamp()
+            {
+                CheckRawMode(true);
+                CheckSingleMode(true);
+
+                return ReadNullable(stream, BinaryUtils::ReadTimestamp, IGNITE_TYPE_TIMESTAMP);
+            }
+
+            int32_t BinaryReaderImpl::ReadTimestampArray(Timestamp* res, int32_t len)
+            {
+                CheckRawMode(true);
+                CheckSingleMode(true);
+
+                return ReadArrayInternal<Timestamp>(res, len, stream, ReadTimestampArrayInternal, IGNITE_TYPE_ARRAY_TIMESTAMP);
+            }
+
+            Timestamp BinaryReaderImpl::ReadTimestamp(const char* fieldName)
+            {
+                CheckRawMode(false);
+                CheckSingleMode(true);
+
+                int32_t fieldId = idRslvr->GetFieldId(typeId, fieldName);
+                int32_t fieldPos = FindField(fieldId);
+
+                if (fieldPos <= 0)
+                    return Timestamp();
+
+                stream->Position(fieldPos);
+
+                return ReadNullable(stream, BinaryUtils::ReadTimestamp, IGNITE_TYPE_TIMESTAMP);
+            }
+
+            int32_t BinaryReaderImpl::ReadTimestampArray(const char* fieldName, Timestamp* res, const int32_t len)
+            {
+                CheckRawMode(false);
+                CheckSingleMode(true);
+
+                int32_t fieldId = idRslvr->GetFieldId(typeId, fieldName);
+                int32_t fieldPos = FindField(fieldId);
+
+                if (fieldPos <= 0)
+                    return -1;
+
+                stream->Position(fieldPos);
+
+                int32_t realLen = ReadArrayInternal<Timestamp>(res, len, stream, ReadTimestampArrayInternal, IGNITE_TYPE_ARRAY_TIMESTAMP);
+
+                return realLen;
+            }
+
+            void BinaryReaderImpl::ReadTimestampArrayInternal(interop::InteropInputStream* stream, Timestamp* res, const int32_t len)
+            {
+                for (int i = 0; i < len; i++)
+                    *(res + i) = ReadNullable<Timestamp>(stream, BinaryUtils::ReadTimestamp, IGNITE_TYPE_TIMESTAMP);
+            }
+
             int32_t BinaryReaderImpl::ReadString(char* res, const int32_t len)
             {
                 CheckRawMode(true);
@@ -625,6 +737,38 @@ namespace ignite
                 }
             }
 
+            template <>
+            Date BinaryReaderImpl::ReadTopObject<Date>()
+            {
+                int8_t typeId = stream->ReadInt8();
+
+                if (typeId == IGNITE_TYPE_DATE)
+                    return BinaryUtils::ReadDate(stream);
+                else if (typeId == IGNITE_HDR_NULL)
+                    return Date();
+                else {
+                    int32_t pos = stream->Position() - 1;
+
+                    IGNITE_ERROR_FORMATTED_3(IgniteError::IGNITE_ERR_BINARY, "Invalid header", "position", pos, "expected", (int)IGNITE_TYPE_DATE, "actual", (int)typeId)
+                }
+            }
+
+            template <>
+            Timestamp BinaryReaderImpl::ReadTopObject<Timestamp>()
+            {
+                int8_t typeId = stream->ReadInt8();
+
+                if (typeId == IGNITE_TYPE_TIMESTAMP)
+                    return BinaryUtils::ReadTimestamp(stream);
+                else if (typeId == IGNITE_HDR_NULL)
+                    return Timestamp();
+                else {
+                    int32_t pos = stream->Position() - 1;
+
+                    IGNITE_ERROR_FORMATTED_3(IgniteError::IGNITE_ERR_BINARY, "Invalid header", "position", pos, "expected", (int)IGNITE_TYPE_TIMESTAMP, "actual", (int)typeId)
+                }
+            }
+
             InteropInputStream* BinaryReaderImpl::GetStream()
             {
                 return stream;

http://git-wip-us.apache.org/repos/asf/ignite/blob/64cfa62a/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 8e26ea9..bfb9726 100644
--- a/modules/platforms/cpp/binary/src/impl/binary/binary_utils.cpp
+++ b/modules/platforms/cpp/binary/src/impl/binary/binary_utils.cpp
@@ -201,6 +201,32 @@ namespace ignite
                 stream->WriteInt64(val.GetLeastSignificantBits());
             }
 
+            Date BinaryUtils::ReadDate(interop::InteropInputStream * stream)
+            {
+                int64_t milliseconds = stream->ReadInt64();
+
+                return Date(milliseconds);
+            }
+
+            void BinaryUtils::WriteDate(interop::InteropOutputStream* stream, const Date val)
+            {
+                stream->WriteInt64(val.GetMilliseconds());
+            }
+
+            Timestamp BinaryUtils::ReadTimestamp(interop::InteropInputStream* stream)
+            {
+                int64_t milliseconds = stream->ReadInt64();
+                int32_t nanoseconds = stream->ReadInt32();
+
+                return Timestamp(milliseconds / 1000, nanoseconds);
+            }
+
+            void BinaryUtils::WriteTimestamp(interop::InteropOutputStream* stream, const Timestamp val)
+            {
+                stream->WriteInt64(val.GetSeconds() * 1000);
+                stream->WriteInt32(val.GetSecondFraction());
+            }
+
             void BinaryUtils::WriteString(interop::InteropOutputStream* stream, const char* val, const int32_t len)
             {
                 stream->WriteInt32(len);

http://git-wip-us.apache.org/repos/asf/ignite/blob/64cfa62a/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 97aff17..f57cd16 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
@@ -206,7 +206,7 @@ namespace ignite
             }
 
             void BinaryWriterImpl::WriteGuid(const Guid val)
-            {                
+            {
                 CheckRawMode(true);
                 CheckSingleMode(true);
 
@@ -274,6 +274,140 @@ namespace ignite
                 }
             }
 
+            void BinaryWriterImpl::WriteDate(const Date& val)
+            {
+                CheckRawMode(true);
+                CheckSingleMode(true);
+
+                stream->WriteInt8(IGNITE_TYPE_DATE);
+
+                BinaryUtils::WriteDate(stream, val);
+            }
+
+            void BinaryWriterImpl::WriteDateArray(const Date* val, const int32_t len)
+            {
+                CheckRawMode(true);
+                CheckSingleMode(true);
+
+                if (val)
+                {
+                    stream->WriteInt8(IGNITE_TYPE_ARRAY_DATE);
+                    stream->WriteInt32(len);
+
+                    for (int i = 0; i < len; i++)
+                    {
+                        const Date& elem = *(val + i);
+
+                        stream->WriteInt8(IGNITE_TYPE_DATE);
+                        BinaryUtils::WriteDate(stream, elem);
+                    }
+                }
+                else
+                    stream->WriteInt8(IGNITE_HDR_NULL);
+            }
+
+            void BinaryWriterImpl::WriteDate(const char* fieldName, const Date& val)
+            {
+                CheckRawMode(false);
+                CheckSingleMode(true);
+
+                WriteFieldId(fieldName, IGNITE_TYPE_DATE);
+
+                stream->WriteInt8(IGNITE_TYPE_DATE);
+
+                BinaryUtils::WriteDate(stream, val);
+            }
+
+            void BinaryWriterImpl::WriteDateArray(const char* fieldName, const Date* val, const int32_t len)
+            {
+                CheckRawMode(false);
+                CheckSingleMode(true);
+
+                WriteFieldId(fieldName, IGNITE_TYPE_ARRAY_DATE);
+
+                if (val)
+                {
+                    stream->WriteInt8(IGNITE_TYPE_ARRAY_DATE);
+                    stream->WriteInt32(len);
+
+                    for (int i = 0; i < len; i++)
+                    {
+                        const Date& elem = *(val + i);
+
+                        WriteTopObject(elem);
+                    }
+                }
+                else
+                    stream->WriteInt8(IGNITE_HDR_NULL);
+            }
+
+            void BinaryWriterImpl::WriteTimestamp(const Timestamp& val)
+            {
+                CheckRawMode(true);
+                CheckSingleMode(true);
+
+                stream->WriteInt8(IGNITE_TYPE_TIMESTAMP);
+
+                BinaryUtils::WriteTimestamp(stream, val);
+            }
+
+            void BinaryWriterImpl::WriteTimestampArray(const Timestamp* val, const int32_t len)
+            {
+                CheckRawMode(true);
+                CheckSingleMode(true);
+
+                if (val)
+                {
+                    stream->WriteInt8(IGNITE_TYPE_ARRAY_TIMESTAMP);
+                    stream->WriteInt32(len);
+
+                    for (int i = 0; i < len; i++)
+                    {
+                        const Timestamp& elem = *(val + i);
+
+                        stream->WriteInt8(IGNITE_TYPE_TIMESTAMP);
+                        BinaryUtils::WriteTimestamp(stream, elem);
+                    }
+                }
+                else
+                    stream->WriteInt8(IGNITE_HDR_NULL);
+            }
+
+            void BinaryWriterImpl::WriteTimestamp(const char* fieldName, const Timestamp& val)
+            {
+                CheckRawMode(false);
+                CheckSingleMode(true);
+
+                WriteFieldId(fieldName, IGNITE_TYPE_TIMESTAMP);
+
+                stream->WriteInt8(IGNITE_TYPE_TIMESTAMP);
+
+                BinaryUtils::WriteTimestamp(stream, val);
+            }
+
+            void BinaryWriterImpl::WriteTimestampArray(const char* fieldName, const Timestamp* val, const int32_t len)
+            {
+                CheckRawMode(false);
+                CheckSingleMode(true);
+
+                WriteFieldId(fieldName, IGNITE_TYPE_ARRAY_TIMESTAMP);
+
+                if (val)
+                {
+                    stream->WriteInt8(IGNITE_TYPE_ARRAY_TIMESTAMP);
+                    stream->WriteInt32(len);
+
+                    for (int i = 0; i < len; i++)
+                    {
+                        const Timestamp& elem = *(val + i);
+
+                        WriteTopObject(elem);
+                    }
+                }
+                else
+                    stream->WriteInt8(IGNITE_HDR_NULL);
+            }
+
             void BinaryWriterImpl::WriteString(const char* val, const int32_t len)
             {
                 CheckRawMode(true);
@@ -559,6 +693,18 @@ namespace ignite
                 WriteTopObject0<Guid>(obj, BinaryUtils::WriteGuid, IGNITE_TYPE_UUID);
             }
 
+            template <>
+            void BinaryWriterImpl::WriteTopObject<Date>(const Date& obj)
+            {
+                WriteTopObject0<Date>(obj, BinaryUtils::WriteDate, IGNITE_TYPE_DATE);
+            }
+
+            template <>
+            void BinaryWriterImpl::WriteTopObject<Timestamp>(const Timestamp& obj)
+            {
+                WriteTopObject0<Timestamp>(obj, BinaryUtils::WriteTimestamp, IGNITE_TYPE_TIMESTAMP);
+            }
+
             void BinaryWriterImpl::PostWrite()
             {
                 int32_t lenWithoutSchema = stream->Position() - start;

http://git-wip-us.apache.org/repos/asf/ignite/blob/64cfa62a/modules/platforms/cpp/binary/src/timestamp.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/src/timestamp.cpp b/modules/platforms/cpp/binary/src/timestamp.cpp
new file mode 100644
index 0000000..a56587e
--- /dev/null
+++ b/modules/platforms/cpp/binary/src/timestamp.cpp
@@ -0,0 +1,117 @@
+/*
+ * 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/timestamp.h"
+
+namespace ignite
+{
+    Timestamp::Timestamp() :
+        seconds(0),
+        fractionNs(0)
+    {
+        // No-op.
+    }
+
+    Timestamp::Timestamp(const Timestamp& another) : 
+        seconds(another.seconds),
+        fractionNs(another.fractionNs)
+    {
+        // No-op.
+    }
+
+    Timestamp::Timestamp(int64_t ms) :
+        seconds(ms / 1000),
+        fractionNs((ms % 1000) * 1000000)
+    {
+        // No-op.
+    }
+
+    Timestamp::Timestamp(int64_t seconds, int32_t fractionNs) :
+        seconds(seconds),
+        fractionNs(fractionNs)
+    {
+        // No-op.
+    }
+
+    Timestamp& Timestamp::operator=(const Timestamp& another)
+    {
+        seconds = another.seconds;
+        fractionNs = another.fractionNs;
+
+        return *this;
+    }
+
+    int64_t Timestamp::GetMilliseconds() const
+    {
+        return seconds * 1000 + fractionNs / 1000000;
+    }
+
+    int64_t Timestamp::GetSeconds() const
+    {
+        return seconds;
+    }
+
+    int32_t Timestamp::GetSecondFraction() const
+    {
+        return fractionNs;
+    }
+
+    Date Timestamp::GetDate() const
+    {
+        return Date(GetMilliseconds());
+    }
+
+    bool operator==(Timestamp& val1, Timestamp& val2)
+    {
+        return val1.seconds == val2.seconds &&
+            val1.fractionNs == val2.fractionNs;
+    }
+
+    bool operator!=(Timestamp& val1, Timestamp& val2)
+    {
+        return val1.seconds != val2.seconds ||
+            val1.fractionNs != val2.fractionNs;
+    }
+
+    bool operator<(Timestamp& val1, Timestamp& val2)
+    {
+        return val1.seconds < val2.seconds ||
+            (val1.seconds == val2.seconds &&
+                val1.fractionNs < val2.fractionNs);
+    }
+
+    bool operator<=(Timestamp& val1, Timestamp& val2)
+    {
+        return val1.seconds < val2.seconds ||
+            (val1.seconds == val2.seconds &&
+                val1.fractionNs <= val2.fractionNs);
+    }
+
+    bool operator>(Timestamp& val1, Timestamp& val2)
+    {
+        return val1.seconds > val2.seconds ||
+            (val1.seconds == val2.seconds &&
+                val1.fractionNs > val2.fractionNs);
+    }
+
+    bool operator>=(Timestamp& val1, Timestamp& val2)
+    {
+        return val1.seconds > val2.seconds ||
+            (val1.seconds == val2.seconds &&
+                val1.fractionNs >= val2.fractionNs);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/64cfa62a/modules/platforms/cpp/core-test/config/cache-query.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/config/cache-query.xml b/modules/platforms/cpp/core-test/config/cache-query.xml
index 160fe49..232b6da 100644
--- a/modules/platforms/cpp/core-test/config/cache-query.xml
+++ b/modules/platforms/cpp/core-test/config/cache-query.xml
@@ -59,6 +59,8 @@
                                     <map>
                                         <entry key="name" value="java.lang.String"/>
                                         <entry key="age" value="java.lang.Integer"/>
+                                        <entry key="birthday" value="java.util.Date"/>
+                                        <entry key="recordCreated" value="java.sql.Timestamp"/>
                                     </map>
                                 </property>
                                 <property name="textFields">

http://git-wip-us.apache.org/repos/asf/ignite/blob/64cfa62a/modules/platforms/cpp/core-test/include/ignite/binary_test_utils.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/include/ignite/binary_test_utils.h b/modules/platforms/cpp/core-test/include/ignite/binary_test_utils.h
index 19965a0..bcec9fe 100644
--- a/modules/platforms/cpp/core-test/include/ignite/binary_test_utils.h
+++ b/modules/platforms/cpp/core-test/include/ignite/binary_test_utils.h
@@ -150,6 +150,30 @@ namespace ignite_test
                 return reader.ReadGuid();
             }
 
+            template<>
+            inline void Write(BinaryRawWriter& writer, Date val)
+            {
+                writer.WriteDate(val);
+            }
+
+            template<>
+            inline Date Read(BinaryRawReader& reader)
+            {
+                return reader.ReadDate();
+            }
+
+            template<>
+            inline void Write(BinaryRawWriter& writer, Timestamp val)
+            {
+                writer.WriteTimestamp(val);
+            }
+
+            template<>
+            inline Timestamp Read(BinaryRawReader& reader)
+            {
+                return reader.ReadTimestamp();
+            }
+
             template<typename T>
             inline void WriteArray(BinaryRawWriter& writer, T* val, int32_t len)
             {
@@ -270,6 +294,30 @@ namespace ignite_test
                 return reader.ReadGuidArray(val, len);
             }
 
+            template<>
+            inline void WriteArray(BinaryRawWriter& writer, Date* val, int32_t len)
+            {
+                writer.WriteDateArray(val, len);
+            }
+
+            template<>
+            inline int32_t ReadArray(BinaryRawReader& reader, Date* val, int32_t len)
+            {
+                return reader.ReadDateArray(val, len);
+            }
+
+            template<>
+            inline void WriteArray(BinaryRawWriter& writer, Timestamp* val, int32_t len)
+            {
+                writer.WriteTimestampArray(val, len);
+            }
+
+            template<>
+            inline int32_t ReadArray(BinaryRawReader& reader, Timestamp* val, int32_t len)
+            {
+                return reader.ReadTimestampArray(val, len);
+            }
+
             template<typename T>
             inline void Write(BinaryWriter& writer, const char* fieldName, T val)
             {
@@ -390,6 +438,30 @@ namespace ignite_test
                 return reader.ReadGuid(fieldName);
             }
 
+            template<>
+            inline void Write(BinaryWriter& writer, const char* fieldName, Date val)
+            {
+                writer.WriteDate(fieldName, val);
+            }
+
+            template<>
+            inline Date Read(BinaryReader& reader, const char* fieldName)
+            {
+                return reader.ReadDate(fieldName);
+            }
+
+            template<>
+            inline void Write(BinaryWriter& writer, const char* fieldName, Timestamp val)
+            {
+                writer.WriteTimestamp(fieldName, val);
+            }
+
+            template<>
+            inline Timestamp Read(BinaryReader& reader, const char* fieldName)
+            {
+                return reader.ReadTimestamp(fieldName);
+            }
+
             template<typename T>
             inline void WriteArray(BinaryWriter& writer, const char* fieldName, T* val, int32_t len)
             {
@@ -509,6 +581,30 @@ namespace ignite_test
             {
                 return reader.ReadGuidArray(fieldName, val, len);
             }
+
+            template<>
+            inline void WriteArray(BinaryWriter& writer, const char* fieldName, Date* val, int32_t len)
+            {
+                writer.WriteDateArray(fieldName, val, len);
+            }
+
+            template<>
+            inline int32_t ReadArray(BinaryReader& reader, const char* fieldName, Date* val, int32_t len)
+            {
+                return reader.ReadDateArray(fieldName, val, len);
+            }
+
+            template<>
+            inline void WriteArray(BinaryWriter& writer, const char* fieldName, Timestamp* val, int32_t len)
+            {
+                writer.WriteTimestampArray(fieldName, val, len);
+            }
+
+            template<>
+            inline int32_t ReadArray(BinaryReader& reader, const char* fieldName, Timestamp* val, int32_t len)
+            {
+                return reader.ReadTimestampArray(fieldName, val, len);
+            }
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/64cfa62a/modules/platforms/cpp/core-test/src/binary_reader_writer_raw_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/binary_reader_writer_raw_test.cpp b/modules/platforms/cpp/core-test/src/binary_reader_writer_raw_test.cpp
index 4e7e2df..b6d9eab 100644
--- a/modules/platforms/cpp/core-test/src/binary_reader_writer_raw_test.cpp
+++ b/modules/platforms/cpp/core-test/src/binary_reader_writer_raw_test.cpp
@@ -210,6 +210,32 @@ void CheckRawWritesRestricted(BinaryRawWriter& writer)
 
     try
     {
+        Date val(1);
+
+        writer.WriteDate(val);
+
+        BOOST_FAIL("Not restricted.");
+    }
+    catch (IgniteError& err)
+    {
+        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
+    }
+
+    try
+    {
+        Timestamp val(1);
+
+        writer.WriteTimestamp(val);
+
+        BOOST_FAIL("Not restricted.");
+    }
+    catch (IgniteError& err)
+    {
+        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
+    }
+
+    try
+    {
         writer.WriteString("test");
 
         BOOST_FAIL("Not restricted.");
@@ -292,6 +318,28 @@ void CheckRawReadsRestricted(BinaryRawReader& reader)
 
     try
     {
+        reader.ReadDate();
+
+        BOOST_FAIL("Not restricted.");
+    }
+    catch (IgniteError& err)
+    {
+        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
+    }
+
+    try
+    {
+        reader.ReadTimestamp();
+
+        BOOST_FAIL("Not restricted.");
+    }
+    catch (IgniteError& err)
+    {
+        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
+    }
+
+    try
+    {
         reader.ReadString();
 
         BOOST_FAIL("Not restricted.");
@@ -764,6 +812,20 @@ BOOST_AUTO_TEST_CASE(TestPrimitiveGuid)
     CheckRawPrimitive<Guid>(val);
 }
 
+BOOST_AUTO_TEST_CASE(TestPrimitiveDate)
+{
+    Date val(time(NULL) * 1000);
+
+    CheckRawPrimitive<Date>(val);
+}
+
+BOOST_AUTO_TEST_CASE(TestPrimitiveTimestamp)
+{
+    Timestamp val(time(NULL), 0);
+
+    CheckRawPrimitive<Timestamp>(val);
+}
+
 BOOST_AUTO_TEST_CASE(TestPrimitiveArrayInt8)
 {
     CheckRawPrimitiveArray<int8_t>(1, 2, 3);
@@ -813,6 +875,24 @@ BOOST_AUTO_TEST_CASE(TestPrimitiveArrayGuid)
     CheckRawPrimitiveArray<Guid>(dflt, val1, val2);
 }
 
+BOOST_AUTO_TEST_CASE(TestPrimitiveArrayDate)
+{
+    Date dflt(1);
+    Date val1(2);
+    Date val2(3);
+
+    CheckRawPrimitiveArray<Date>(dflt, val1, val2);
+}
+
+BOOST_AUTO_TEST_CASE(TestPrimitiveArrayTimestamp)
+{
+    Timestamp dflt(1);
+    Timestamp val1(2);
+    Timestamp val2(3);
+
+    CheckRawPrimitiveArray<Timestamp>(dflt, val1, val2);
+}
+
 BOOST_AUTO_TEST_CASE(TestGuidNull)
 {
     InteropUnpooledMemory mem(1024);
@@ -835,6 +915,50 @@ BOOST_AUTO_TEST_CASE(TestGuidNull)
     BOOST_REQUIRE(actualVal == expVal);
 }
 
+BOOST_AUTO_TEST_CASE(TestDateNull)
+{
+    InteropUnpooledMemory mem(1024);
+
+    InteropOutputStream out(&mem);
+    BinaryWriterImpl writer(&out, NULL);
+    BinaryRawWriter rawWriter(&writer);
+
+    rawWriter.WriteNull();
+
+    out.Synchronize();
+
+    InteropInputStream in(&mem);
+    BinaryReaderImpl reader(&in);
+    BinaryRawReader rawReader(&reader);
+
+    Date expVal;
+    Date actualVal = rawReader.ReadDate();
+
+    BOOST_REQUIRE(actualVal == expVal);
+}
+
+BOOST_AUTO_TEST_CASE(TestTimestampNull)
+{
+    InteropUnpooledMemory mem(1024);
+
+    InteropOutputStream out(&mem);
+    BinaryWriterImpl writer(&out, NULL);
+    BinaryRawWriter rawWriter(&writer);
+
+    rawWriter.WriteNull();
+
+    out.Synchronize();
+
+    InteropInputStream in(&mem);
+    BinaryReaderImpl reader(&in);
+    BinaryRawReader rawReader(&reader);
+
+    Timestamp expVal;
+    Timestamp actualVal = rawReader.ReadTimestamp();
+
+    BOOST_REQUIRE(actualVal == expVal);
+}
+
 BOOST_AUTO_TEST_CASE(TestString) {
     InteropUnpooledMemory mem(1024);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/64cfa62a/modules/platforms/cpp/core-test/src/binary_reader_writer_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/binary_reader_writer_test.cpp b/modules/platforms/cpp/core-test/src/binary_reader_writer_test.cpp
index 71177b8..fa36dac 100644
--- a/modules/platforms/cpp/core-test/src/binary_reader_writer_test.cpp
+++ b/modules/platforms/cpp/core-test/src/binary_reader_writer_test.cpp
@@ -335,6 +335,32 @@ void CheckWritesRestricted(BinaryWriter& writer)
 
     try
     {
+        Date val(1);
+
+        writer.WriteDate("field", val);
+
+        BOOST_FAIL("Not restricted.");
+    }
+    catch (IgniteError& err)
+    {
+        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
+    }
+
+    try
+    {
+        Timestamp val(1);
+
+        writer.WriteTimestamp("field", val);
+
+        BOOST_FAIL("Not restricted.");
+    }
+    catch (IgniteError& err)
+    {
+        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
+    }
+
+    try
+    {
         writer.WriteString("field", "test");
 
         BOOST_FAIL("Not restricted.");
@@ -417,6 +443,28 @@ void CheckReadsRestricted(BinaryReader& reader)
 
     try
     {
+        reader.ReadDate("field");
+
+        BOOST_FAIL("Not restricted.");
+    }
+    catch (IgniteError& err)
+    {
+        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
+    }
+
+    try
+    {
+        reader.ReadTimestamp("field");
+
+        BOOST_FAIL("Not restricted.");
+    }
+    catch (IgniteError& err)
+    {
+        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
+    }
+
+    try
+    {
         reader.ReadString("field");
 
         BOOST_FAIL("Not restricted.");
@@ -947,6 +995,20 @@ BOOST_AUTO_TEST_CASE(TestPrimitiveGuid)
     CheckPrimitive<Guid>(val);
 }
 
+BOOST_AUTO_TEST_CASE(TestPrimitiveDate)
+{
+    Date val(time(NULL) * 1000);
+
+    CheckPrimitive<Date>(val);
+}
+
+BOOST_AUTO_TEST_CASE(TestPrimitiveTimestamp)
+{
+    Timestamp val(time(NULL), 0);
+
+    CheckPrimitive<Timestamp>(val);
+}
+
 BOOST_AUTO_TEST_CASE(TestPrimitiveArrayInt8)
 {
     CheckPrimitiveArray<int8_t>(1, 2, 3);
@@ -996,6 +1058,24 @@ BOOST_AUTO_TEST_CASE(TestPrimitiveArrayGuid)
     CheckPrimitiveArray<Guid>(dflt, val1, val2);
 }
 
+BOOST_AUTO_TEST_CASE(TestPrimitiveArrayDate)
+{
+    Date dflt(1);
+    Date val1(2);
+    Date val2(3);
+
+    CheckPrimitiveArray<Date>(dflt, val1, val2);
+}
+
+BOOST_AUTO_TEST_CASE(TestPrimitiveArrayTimestamp)
+{
+    Timestamp dflt(1);
+    Timestamp val1(2);
+    Timestamp val2(3);
+
+    CheckPrimitiveArray<Timestamp>(dflt, val1, val2);
+}
+
 BOOST_AUTO_TEST_CASE(TestGuidNull)
 {
     TemplatedBinaryIdResolver<BinaryDummy> idRslvr;
@@ -1052,6 +1132,118 @@ BOOST_AUTO_TEST_CASE(TestGuidNull)
     BOOST_REQUIRE(actualVal == expVal);
 }
 
+BOOST_AUTO_TEST_CASE(TestDateNull)
+{
+    TemplatedBinaryIdResolver<BinaryDummy> idRslvr;
+
+    InteropUnpooledMemory mem(1024);
+
+    InteropOutputStream out(&mem);
+    BinaryWriterImpl writerImpl(&out, &idRslvr, NULL, NULL, 0);
+    BinaryWriter writer(&writerImpl);
+
+    out.Position(IGNITE_DFLT_HDR_LEN);
+
+    try
+    {
+        writer.WriteNull(NULL);
+
+        BOOST_FAIL("Not restricted.");
+    }
+    catch (IgniteError& err)
+    {
+        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
+    }
+
+    writer.WriteNull("test");
+
+    writerImpl.PostWrite();
+
+    out.Synchronize();
+
+    InteropInputStream in(&mem);
+
+    int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF);
+    int32_t footerEnd = footerBegin + 5;
+
+    BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE);
+    BinaryReader reader(&readerImpl);
+    
+    in.Position(IGNITE_DFLT_HDR_LEN);
+
+    try
+    {
+        reader.ReadDate(NULL);
+
+        BOOST_FAIL("Not restricted.");
+    }
+    catch (IgniteError& err)
+    {
+        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
+    }
+
+    Date expVal;
+    Date actualVal = reader.ReadDate("test");
+
+    BOOST_REQUIRE(actualVal == expVal);
+}
+
+BOOST_AUTO_TEST_CASE(TestTimestampNull)
+{
+    TemplatedBinaryIdResolver<BinaryDummy> idRslvr;
+
+    InteropUnpooledMemory mem(1024);
+
+    InteropOutputStream out(&mem);
+    BinaryWriterImpl writerImpl(&out, &idRslvr, NULL, NULL, 0);
+    BinaryWriter writer(&writerImpl);
+
+    out.Position(IGNITE_DFLT_HDR_LEN);
+
+    try
+    {
+        writer.WriteNull(NULL);
+
+        BOOST_FAIL("Not restricted.");
+    }
+    catch (IgniteError& err)
+    {
+        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
+    }
+
+    writer.WriteNull("test");
+
+    writerImpl.PostWrite();
+
+    out.Synchronize();
+
+    InteropInputStream in(&mem);
+
+    int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF);
+    int32_t footerEnd = footerBegin + 5;
+
+    BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE);
+    BinaryReader reader(&readerImpl);
+
+    in.Position(IGNITE_DFLT_HDR_LEN);
+
+    try
+    {
+        reader.ReadTimestamp(NULL);
+
+        BOOST_FAIL("Not restricted.");
+    }
+    catch (IgniteError& err)
+    {
+        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
+    }
+
+    Timestamp expVal;
+    Timestamp actualVal = reader.ReadTimestamp("test");
+
+    BOOST_REQUIRE(actualVal == expVal);
+}
+
 BOOST_AUTO_TEST_CASE(TestString) {
     TemplatedBinaryIdResolver<BinaryDummy> idRslvr;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/64cfa62a/modules/platforms/cpp/core-test/src/binary_session_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/binary_session_test.cpp b/modules/platforms/cpp/core-test/src/binary_session_test.cpp
index c5c4191..19bfaac 100644
--- a/modules/platforms/cpp/core-test/src/binary_session_test.cpp
+++ b/modules/platforms/cpp/core-test/src/binary_session_test.cpp
@@ -137,6 +137,42 @@ BOOST_AUTO_TEST_CASE(TestGuid)
     BOOST_REQUIRE(readVal.GetLeastSignificantBits() == writeVal.GetLeastSignificantBits());    
 }
 
+BOOST_AUTO_TEST_CASE(TestDate)
+{
+    Date writeVal = Date(42);
+
+    InteropUnpooledMemory mem(1024);
+
+    InteropOutputStream out(&mem);
+    BinaryWriterImpl writeSes(&out, NULL);
+    writeSes.WriteTopObject<Date>(writeVal);
+    out.Synchronize();
+
+    InteropInputStream in(&mem);
+    BinaryReaderImpl reader(&in);
+    Date readVal = reader.ReadTopObject<Date>();
+
+    BOOST_REQUIRE(readVal == writeVal);
+}
+
+BOOST_AUTO_TEST_CASE(TestTimestamp)
+{
+    Timestamp writeVal = Timestamp(77);
+
+    InteropUnpooledMemory mem(1024);
+
+    InteropOutputStream out(&mem);
+    BinaryWriterImpl writeSes(&out, NULL);
+    writeSes.WriteTopObject<Timestamp>(writeVal);
+    out.Synchronize();
+
+    InteropInputStream in(&mem);
+    BinaryReaderImpl reader(&in);
+    Timestamp readVal = reader.ReadTopObject<Timestamp>();
+
+    BOOST_REQUIRE(readVal == writeVal);
+}
+
 BOOST_AUTO_TEST_CASE(TestString)
 {
     std::string writeVal = "MyString";


Mime
View raw message