ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [09/18] ignite git commit: IGNITE-1846: CPP: "portable" -> "binary", "metadata" -> "type".
Date Mon, 09 Nov 2015 11:48:41 GMT
http://git-wip-us.apache.org/repos/asf/ignite/blob/303d79eb/modules/platforms/cpp/core/include/ignite/impl/binary/binary_utils.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/impl/binary/binary_utils.h b/modules/platforms/cpp/core/include/ignite/impl/binary/binary_utils.h
new file mode 100644
index 0000000..c1a1ceb
--- /dev/null
+++ b/modules/platforms/cpp/core/include/ignite/impl/binary/binary_utils.h
@@ -0,0 +1,344 @@
+/*
+ * 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_UTILS
+#define _IGNITE_IMPL_BINARY_UTILS
+
+#include <stdint.h>
+
+#include "ignite/guid.h"
+
+namespace ignite
+{
+    namespace impl
+    {
+        namespace interop
+        {
+            class InteropInputStream;
+            class InteropOutputStream;
+        }
+
+        namespace binary
+        {
+            /**
+             * Binary uilts.
+             */
+            class IGNITE_IMPORT_EXPORT BinaryUtils
+            {
+            public:
+                /**
+                 * Utility method to read signed 8-bit integer from stream.
+                 *
+                 * @param stream Stream.
+                 * @return Value.
+                 */
+                static int8_t ReadInt8(interop::InteropInputStream* stream);
+
+                /**
+                 * Utility method to write signed 8-bit integer to stream.
+                 *
+                 * @param stream Stream.
+                 * @param val Value.
+                 */
+                static void WriteInt8(interop::InteropOutputStream* stream, int8_t val);
+
+                /**
+                 * Utility method to read signed 8-bit integer array from stream.
+                 *
+                 * @param stream Stream.
+                 * @param res Target array.
+                 * @param len Array length.                 
+                 */
+                static void ReadInt8Array(interop::InteropInputStream* stream, int8_t* res, const int32_t len);
+
+                /**
+                 * Utility method to write signed 8-bit integer array to stream.
+                 *
+                 * @param stream Stream.
+                 * @param val Value.
+                 * @param len Array length.
+                 */
+                static void WriteInt8Array(interop::InteropOutputStream* stream, const int8_t* val, const int32_t len);
+
+                /**
+                 * Utility method to read boolean from stream.
+                 *
+                 * @param stream Stream.
+                 * @return Value.
+                 */
+                static bool ReadBool(interop::InteropInputStream* stream);
+
+                /**
+                 * Utility method to write bool to stream.
+                 *
+                 * @param stream Stream.
+                 * @param val Value.
+                 */
+                static void WriteBool(interop::InteropOutputStream* stream, bool val);
+
+                /**
+                 * Utility method to read bool array from stream.
+                 *
+                 * @param stream Stream.
+                 * @param res Target array.
+                 * @param len Array length.
+                 */
+                static void ReadBoolArray(interop::InteropInputStream* stream, bool* res, const int32_t len);
+
+                /**
+                 * Utility method to write bool array to stream.
+                 *
+                 * @param stream Stream.
+                 * @param val Value.
+                 * @param len Array length.
+                 */
+                static void WriteBoolArray(interop::InteropOutputStream* stream, const bool* val, const int32_t len);
+
+                /**
+                 * Utility method to read signed 16-bit integer from stream.
+                 *
+                 * @param stream Stream.
+                 * @return Value.
+                 */
+                static int16_t ReadInt16(interop::InteropInputStream* stream);
+
+                /**
+                 * Utility method to write signed 16-bit integer to stream.
+                 *
+                 * @param stream Stream.
+                 * @param val Value.
+                 */
+                static void WriteInt16(interop::InteropOutputStream* stream, int16_t val);
+
+                /**
+                 * Utility method to read signed 16-bit integer array from stream.
+                 *
+                 * @param stream Stream.
+                 * @param res Target array.
+                 * @param len Array length.                 
+                 */
+                static void ReadInt16Array(interop::InteropInputStream* stream, int16_t* res, const int32_t len);
+
+                /**
+                 * Utility method to write signed 16-bit integer array to stream.
+                 *
+                 * @param stream Stream.
+                 * @param val Value.
+                 * @param len Array length.
+                 */
+                static void WriteInt16Array(interop::InteropOutputStream* stream, const int16_t* val, const int32_t len);
+
+                /**
+                 * Utility method to read unsigned 16-bit integer from stream.
+                 *
+                 * @param stream Stream.
+                 * @return Value.
+                 */
+                static uint16_t ReadUInt16(interop::InteropInputStream* stream);
+
+                /**
+                 * Utility method to write unsigned 16-bit integer to stream.
+                 *
+                 * @param stream Stream.
+                 * @param val Value.
+                 */
+                static void WriteUInt16(interop::InteropOutputStream* stream, uint16_t val);
+
+                /**
+                 * Utility method to read unsigned 16-bit integer array from stream.
+                 *
+                 * @param stream Stream.
+                 * @param res Target array.
+                 * @param len Array length.
+                 */
+                static void ReadUInt16Array(interop::InteropInputStream* stream, uint16_t* res, const int32_t len);
+
+                /**
+                 * Utility method to write unsigned 16-bit integer array to stream.
+                 *
+                 * @param stream Stream.
+                 * @param val Value.
+                 * @param len Array length.
+                 */
+                static void WriteUInt16Array(interop::InteropOutputStream* stream, const uint16_t* val, const int32_t len);
+
+                /**
+                 * Utility method to read signed 32-bit integer from stream.
+                 *
+                 * @param stream Stream.
+                 * @return Value.
+                 */
+                static int32_t ReadInt32(interop::InteropInputStream* stream);
+
+                /**
+                 * Utility method to write signed 32-bit integer to stream.
+                 *
+                 * @param stream Stream.
+                 * @param val Value.
+                 */
+                static void WriteInt32(interop::InteropOutputStream* stream, int32_t val);
+
+                /**
+                 * Utility method to read signed 32-bit integer array from stream.
+                 *
+                 * @param stream Stream.
+                 * @param res Target array.
+                 * @param len Array length.
+                 */
+                static void ReadInt32Array(interop::InteropInputStream* stream, int32_t* res, const int32_t len);
+
+                /**
+                 * Utility method to write signed 32-bit integer array to stream.
+                 *
+                 * @param stream Stream.
+                 * @param val Value.
+                 * @param len Array length.
+                 */
+                static void WriteInt32Array(interop::InteropOutputStream* stream, const int32_t* val, const int32_t len);
+
+                /**
+                 * Utility method to read signed 64-bit integer from stream.
+                 *
+                 * @param stream Stream.
+                 * @return Value.
+                 */
+                static int64_t ReadInt64(interop::InteropInputStream* stream);
+
+                /**
+                 * Utility method to write signed 64-bit integer to stream.
+                 *
+                 * @param stream Stream.
+                 * @param val Value.
+                 */
+                static void WriteInt64(interop::InteropOutputStream* stream, int64_t val);
+
+                /**
+                 * Utility method to read signed 64-bit integer array from stream.
+                 *
+                 * @param stream Stream.
+                 * @param res Target array.
+                 * @param len Array length.
+                 */
+                static void ReadInt64Array(interop::InteropInputStream* stream, int64_t* res, const int32_t len);
+
+                /**
+                 * Utility method to write signed 64-bit integer array to stream.
+                 *
+                 * @param stream Stream.
+                 * @param val Value.
+                 * @param len Array length.
+                 */
+                static void WriteInt64Array(interop::InteropOutputStream* stream, const int64_t* val, const int32_t len);
+
+                /**
+                 * Utility method to read float from stream.
+                 *
+                 * @param stream Stream.
+                 * @return Value.
+                 */
+                static float ReadFloat(interop::InteropInputStream* stream);
+
+                /**
+                 * Utility method to write float to stream.
+                 *
+                 * @param stream Stream.
+                 * @param val Value.
+                 */
+                static void WriteFloat(interop::InteropOutputStream* stream, float val);
+
+                /**
+                 * Utility method to read float array from stream.
+                 *
+                 * @param stream Stream.
+                 * @param res Target array.
+                 * @param len Array length.
+                 */
+                static void ReadFloatArray(interop::InteropInputStream* stream, float* res, const int32_t len);
+
+                /**
+                 * Utility method to write float array to stream.
+                 *
+                 * @param stream Stream.
+                 * @param val Value.
+                 * @param len Array length.
+                 */
+                static void WriteFloatArray(interop::InteropOutputStream* stream, const float* val, const int32_t len);
+
+                /**
+                 * Utility method to read double from stream.
+                 *
+                 * @param stream Stream.
+                 * @return Value.
+                 */
+                static double ReadDouble(interop::InteropInputStream* stream);
+
+                /**
+                 * Utility method to write double to stream.
+                 *
+                 * @param stream Stream.
+                 * @param val Value.
+                 */
+                static void WriteDouble(interop::InteropOutputStream* stream, double val);
+
+                /**
+                 * Utility method to read double array from stream.
+                 *
+                 * @param stream Stream.
+                 * @param res Target array.
+                 * @param len Array length.
+                 */
+                static void ReadDoubleArray(interop::InteropInputStream* stream, double* res, const int32_t len);
+
+                /**
+                 * Utility method to write double array to stream.
+                 *
+                 * @param stream Stream.
+                 * @param val Value.
+                 * @param len Array length.
+                 */
+                static void WriteDoubleArray(interop::InteropOutputStream* stream, const double* val, const int32_t len);
+
+                /**
+                 * Utility method to read Guid from stream.
+                 *
+                 * @param stream Stream.
+                 * @param res Value.
+                 */
+                static Guid ReadGuid(interop::InteropInputStream* stream);
+
+                /**
+                 * Utility method to write Guid to stream.
+                 *
+                 * @param stream Stream.
+                 * @param val Value.
+                 */
+                static void WriteGuid(interop::InteropOutputStream* stream, const Guid val);
+
+                /**
+                 * Utility method to write string to stream.
+                 *
+                 * @param stream Stream.
+                 * @param val Value.
+                 * @param len Length.
+                 */
+                static void WriteString(interop::InteropOutputStream* stream, const char* val, const int32_t len);
+            };
+        }
+    }
+}
+
+#endif
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/303d79eb/modules/platforms/cpp/core/include/ignite/impl/binary/binary_writer_impl.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/impl/binary/binary_writer_impl.h b/modules/platforms/cpp/core/include/ignite/impl/binary/binary_writer_impl.h
new file mode 100644
index 0000000..fe31ece
--- /dev/null
+++ b/modules/platforms/cpp/core/include/ignite/impl/binary/binary_writer_impl.h
@@ -0,0 +1,913 @@
+/*
+ * 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_WRITER
+#define _IGNITE_IMPL_BINARY_WRITER
+
+#include <cstring>
+#include <string>
+#include <stdint.h>
+
+#include <ignite/common/common.h>
+#include <ignite/common/concurrent.h>
+
+#include "ignite/impl/interop/interop_output_stream.h"
+#include "ignite/impl/binary/binary_common.h"
+#include "ignite/impl/binary/binary_id_resolver.h"
+#include "ignite/impl/binary/binary_type_manager.h"
+#include "ignite/impl/binary/binary_utils.h"
+#include "ignite/impl/binary/binary_schema.h"
+#include "ignite/binary/binary_consts.h"
+#include "ignite/binary/binary_type.h"
+#include "ignite/guid.h"
+#include "binary_type_manager.h"
+
+namespace ignite
+{
+    namespace impl
+    {
+        namespace binary
+        {
+            /**
+             * Internal implementation of binary reader.
+             */
+            class IGNITE_IMPORT_EXPORT BinaryWriterImpl
+            {
+            public:
+                /**
+                 * Constructor.
+                 *
+                 * @param stream Interop stream.
+                 * @param idRslvr Binary ID resolver.
+                 * @param metaMgr Type manager.
+                 * @param metaHnd Type handler.
+                 */
+                BinaryWriterImpl(ignite::impl::interop::InteropOutputStream* stream, BinaryIdResolver* idRslvr, 
+                    BinaryTypeManager* metaMgr, BinaryTypeHandler* metaHnd, int32_t start);
+                
+                /**
+                 * Constructor used to construct light-weight writer allowing only raw operations 
+                 * and primitive objects.
+                 *
+                 * @param stream Interop stream.
+                 * @param metaMgr Type manager.
+                 */
+                BinaryWriterImpl(ignite::impl::interop::InteropOutputStream* stream, BinaryTypeManager* metaMgr);
+
+                /**
+                 * Write 8-byte signed integer. Maps to "byte" type in Java.
+                 *
+                 * @param val Value.
+                 */
+                void WriteInt8(const int8_t val);
+
+                /**
+                 * Write array of 8-byte signed integers. Maps to "byte[]" type in Java.
+                 *
+                 * @param val Array.
+                 * @param len Array length.
+                 */
+                void WriteInt8Array(const int8_t* val, const int32_t len);
+
+                /**
+                 * Write 8-byte signed integer. Maps to "byte" type in Java.
+                 *
+                 * @param fieldName Field name.
+                 * @param val Value.
+                 */
+                void WriteInt8(const char* fieldName, const int8_t val);
+
+                /**
+                 * Write array of 8-byte signed integers. Maps to "byte[]" type in Java.
+                 *
+                 * @param fieldName Field name.
+                 * @param val Array.
+                 * @param len Array length.
+                 */
+                void WriteInt8Array(const char* fieldName, const int8_t* val, const int32_t len);
+
+                /**
+                 * Write bool. Maps to "short" type in Java.
+                 *
+                 * @param val Value.
+                 */
+                void WriteBool(const bool val);
+
+                /**
+                 * Write array of bools. Maps to "bool[]" type in Java.
+                 *
+                 * @param val Array.
+                 * @param len Array length.
+                 */
+                void WriteBoolArray(const bool* val, const int32_t len);
+
+                /**
+                 * Write bool. Maps to "short" type in Java.
+                 *
+                 * @param fieldName Field name.
+                 * @param val Value.
+                 */
+                void WriteBool(const char* fieldName, const bool val);
+
+                /**
+                 * Write array of bools. Maps to "bool[]" type in Java.
+                 *
+                 * @param fieldName Field name.
+                 * @param val Array.
+                 * @param len Array length.
+                 */
+                void WriteBoolArray(const char* fieldName, const bool* val, const int32_t len);
+
+                /**
+                 * Write 16-byte signed integer. Maps to "short" type in Java.
+                 *
+                 * @param val Value.
+                 */
+                void WriteInt16(const int16_t val);
+
+                /**
+                 * Write array of 16-byte signed integers. Maps to "short[]" type in Java.
+                 *
+                 * @param val Array.
+                 * @param len Array length.
+                 */
+                void WriteInt16Array(const int16_t* val, const int32_t len);
+
+                /**
+                 * Write 16-byte signed integer. Maps to "short" type in Java.
+                 *
+                 * @param fieldName Field name.
+                 * @param val Value.
+                 */
+                void WriteInt16(const char* fieldName, const int16_t val);
+
+                /**
+                 * Write array of 16-byte signed integers. Maps to "short[]" type in Java.
+                 *
+                 * @param fieldName Field name.
+                 * @param val Array.
+                 * @param len Array length.
+                 */
+                void WriteInt16Array(const char* fieldName, const int16_t* val, const int32_t len);
+
+                /**
+                 * Write 16-byte unsigned integer. Maps to "char" type in Java.
+                 *
+                 * @param val Value.
+                 */
+                void WriteUInt16(const uint16_t val);
+
+                /**
+                 * Write array of 16-byte unsigned integers. Maps to "char[]" type in Java.
+                 *
+                 * @param val Array.
+                 * @param len Array length.
+                 */
+                void WriteUInt16Array(const uint16_t* val, const int32_t len);
+
+                /**
+                 * Write 16-byte unsigned integer. Maps to "char" type in Java.
+                 *
+                 * @param fieldName Field name.
+                 * @param val Value.
+                 */
+                void WriteUInt16(const char* fieldName, const uint16_t val);
+
+                /**
+                 * Write array of 16-byte unsigned integers. Maps to "char[]" type in Java.
+                 *
+                 * @param fieldName Field name.
+                 * @param val Array.
+                 * @param len Array length.
+                 */
+                void WriteUInt16Array(const char* fieldName, const uint16_t* val, const int32_t len);
+
+                /**
+                 * Write 32-byte signed integer. Maps to "int" type in Java.
+                 *
+                 * @param val Value.
+                 */
+                void WriteInt32(const int32_t val);
+
+                /**
+                 * Write array of 32-byte signed integers. Maps to "int[]" type in Java.
+                 *
+                 * @param val Array.
+                 * @param len Array length.
+                 */
+                void WriteInt32Array(const int32_t* val, const int32_t len);
+
+                /**
+                 * Write 32-byte signed integer. Maps to "int" type in Java.
+                 *
+                 * @param fieldName Field name.
+                 * @param val Value.
+                 */
+                void WriteInt32(const char* fieldName, const int32_t val);
+
+                /**
+                 * Write array of 32-byte signed integers. Maps to "int[]" type in Java.
+                 *
+                 * @param fieldName Field name.
+                 * @param val Array.
+                 * @param len Array length.
+                 */
+                void WriteInt32Array(const char* fieldName, const int32_t* val, const int32_t len);
+
+                /**
+                 * Write 64-byte signed integer. Maps to "long" type in Java.
+                 *
+                 * @param val Value.
+                 */
+                void WriteInt64(const int64_t val);
+
+                /**
+                 * Write array of 64-byte signed integers. Maps to "long[]" type in Java.
+                 *
+                 * @param val Array.
+                 * @param len Array length.
+                 */
+                void WriteInt64Array(const int64_t* val, const int32_t len);
+
+                /**
+                 * Write 64-byte signed integer. Maps to "long" type in Java.
+                 *
+                 * @param fieldName Field name.
+                 * @param val Value.
+                 */
+                void WriteInt64(const char* fieldName, const int64_t val);
+
+                /**
+                 * Write array of 64-byte signed integers. Maps to "long[]" type in Java.
+                 *
+                 * @param fieldName Field name.
+                 * @param val Array.
+                 * @param len Array length.
+                 */
+                void WriteInt64Array(const char* fieldName, const int64_t* val, const int32_t len);
+
+                /**
+                 * Write float. Maps to "float" type in Java.
+                 *
+                 * @param val Value.
+                 */
+                void WriteFloat(const float val);
+
+                /**
+                 * Write array of floats. Maps to "float[]" type in Java.
+                 *
+                 * @param val Array.
+                 * @param len Array length.
+                 */
+                void WriteFloatArray(const float* val, const int32_t len);
+
+                /**
+                 * Write float. Maps to "float" type in Java.
+                 *
+                 * @param fieldName Field name.
+                 * @param val Value.
+                 */
+                void WriteFloat(const char* fieldName, const float val);
+
+                /**
+                 * Write array of floats. Maps to "float[]" type in Java.
+                 *
+                 * @param fieldName Field name.
+                 * @param val Array.
+                 * @param len Array length.
+                 */
+                void WriteFloatArray(const char* fieldName, const float* val, const int32_t len);
+
+                /**
+                 * Write double. Maps to "double" type in Java.
+                 *
+                 * @param val Value.
+                 */
+                void WriteDouble(const double val);
+
+                /**
+                 * Write array of doubles. Maps to "double[]" type in Java.
+                 *
+                 * @param val Array.
+                 * @param len Array length.
+                 */
+                void WriteDoubleArray(const double* val, const int32_t len);
+
+                /**
+                 * Write double. Maps to "double" type in Java.
+                 *
+                 * @param fieldName Field name.
+                 * @param val Value.
+                 */
+                void WriteDouble(const char* fieldName, const double val);
+
+                /**
+                 * Write array of doubles. Maps to "double[]" type in Java.
+                 *
+                 * @param fieldName Field name.
+                 * @param val Array.
+                 * @param len Array length.
+                 */
+                void WriteDoubleArray(const char* fieldName, const double* val, const int32_t len);
+
+                /**
+                 * Write Guid. Maps to "UUID" type in Java.
+                 *
+                 * @param val Value.
+                 */
+                void WriteGuid(const Guid val);
+
+                /**
+                 * Write array of Guids. Maps to "UUID[]" type in Java.
+                 *
+                 * @param val Array.
+                 * @param len Array length.
+                 */
+                void WriteGuidArray(const Guid* val, const int32_t len);
+
+                /**
+                 * Write Guid. Maps to "UUID" type in Java.
+                 *
+                 * @param fieldName Field name.
+                 * @param val Value.
+                 */
+                void WriteGuid(const char* fieldName, const Guid val);
+
+                /**
+                 * Write array of Guids. Maps to "UUID[]" type in Java.
+                 *
+                 * @param fieldName Field name.
+                 * @param val Array.
+                 * @param len Array length.
+                 */
+                void WriteGuidArray(const char* fieldName, const Guid* val, const int32_t len);
+
+                /**
+                 * Write string.
+                 *
+                 * @param val String.
+                 * @param len String length (characters).
+                 */
+                void WriteString(const char* val, const int32_t len);
+
+                /**
+                 * Write string.
+                 *
+                 * @param fieldName Field name.
+                 * @param val String.
+                 * @param len String length (characters).
+                 */
+                void WriteString(const char* fieldName, const char* val, const int32_t len);
+
+                /**
+                 * Start string array write.
+                 *
+                 * @param typ Collection type.
+                 * @return Session ID.
+                 */
+                int32_t WriteStringArray();
+
+                /**
+                 * Start string array write.
+                 *
+                 * @param fieldName Field name.
+                 * @return Session ID.
+                 */
+                int32_t WriteStringArray(const char* fieldName);
+
+                /**
+                 * Write string element.
+                 *
+                 * @param id Session ID.
+                 * @param val Value.
+                 * @param len Length.
+                 */
+                void WriteStringElement(int32_t id, const char* val, int32_t len);
+
+                /**
+                 * Write NULL value.
+                 */
+                void WriteNull();
+
+                /**
+                 * Write NULL value.
+                 *
+                 * @param fieldName Field name.
+                 */
+                void WriteNull(const char* fieldName);
+
+                /**
+                 * Start array write.
+                 *
+                 * @param typ Collection type.
+                 * @return Session ID.
+                 */
+                int32_t WriteArray();
+
+                /**
+                 * Start array write.
+                 *
+                 * @param fieldName Field name.
+                 * @return Session ID.
+                 */
+                int32_t WriteArray(const char* fieldName);
+                                
+                /**
+                 * Start collection write.
+                 *
+                 * @param typ Collection type.
+                 * @return Session ID.
+                 */
+                int32_t WriteCollection(ignite::binary::CollectionType typ);
+
+                /**
+                 * Start collection write.
+                 *
+                 * @param fieldName Field name.
+                 * @param typ Collection type.
+                 * @return Session ID.
+                 */
+                int32_t WriteCollection(const char* fieldName, ignite::binary::CollectionType typ);
+
+                /**
+                 * Write values in interval [first, last).
+                 *
+                 * @param first Iterator pointing to the beginning of the interval.
+                 * @param last Iterator pointing to the end of the interval.
+                 * @param typ Collection type.
+                 */
+                template<typename InputIterator>
+                void WriteCollection(InputIterator first, InputIterator last, ignite::binary::CollectionType typ)
+                {
+                    StartContainerSession(true);
+
+                    WriteCollectionWithinSession(first, last, typ);
+                }
+
+                /**
+                 * Write values in interval [first, last).
+                 *
+                 * @param fieldName Field name.
+                 * @param first Iterator pointing to the beginning of the interval.
+                 * @param last Iterator pointing to the end of the interval.
+                 * @param typ Collection type.
+                 */
+                template<typename InputIterator>
+                void WriteCollection(const char* fieldName, InputIterator first, InputIterator last,
+                    ignite::binary::CollectionType typ)
+                {
+                    StartContainerSession(false);
+
+                    WriteFieldId(fieldName, IGNITE_TYPE_COLLECTION);
+
+                    WriteCollectionWithinSession(first, last, typ);
+                }
+                
+                /**
+                 * Start map write.
+                 *
+                 * @param typ Map type.
+                 * @return Session ID.
+                 */
+                int32_t WriteMap(ignite::binary::MapType typ);
+
+                /**
+                 * Start map write.
+                 *
+                 * @param fieldName Field name.
+                 * @param typ Map type.
+                 * @return Session ID.
+                 */
+                int32_t WriteMap(const char* fieldName, ignite::binary::MapType typ);
+
+                /**
+                 * Write collection element.
+                 *
+                 * @param id Session ID.
+                 * @param val Value.
+                 */
+                template<typename T>
+                void WriteElement(int32_t id, T val)
+                {
+                    CheckSession(id);
+                                        
+                    WriteTopObject<T>(val);
+
+                    elemCnt++;
+                }
+
+                /**
+                 * Write map element.
+                 *
+                 * @param id Session ID.
+                 * @param key Key.
+                 * @param val Value.
+                 */
+                template<typename K, typename V>
+                void WriteElement(int32_t id, K key, V val)
+                {
+                    CheckSession(id);
+
+                    WriteTopObject<K>(key);
+                    WriteTopObject<V>(val);
+
+                    elemCnt++;
+                }
+
+                /**
+                 * Commit container write session.
+                 *
+                 * @param id Session ID.
+                 */
+                void CommitContainer(int32_t id);                
+
+                /**
+                 * Write object.
+                 *
+                 * @param val Object.
+                 */
+                template<typename T>
+                void WriteObject(T val)
+                {
+                    CheckRawMode(true);
+
+                    WriteTopObject(val);
+                }
+
+                /**
+                 * Write object.
+                 *
+                 * @param fieldName Field name.
+                 * @param val Object.
+                 */
+                template<typename T>
+                void WriteObject(const char* fieldName, T val)
+                {
+                    CheckRawMode(false);
+
+                    WriteFieldId(fieldName, IGNITE_TYPE_OBJECT);
+
+                    WriteTopObject(val);
+                }
+
+                /**
+                 * Set raw mode.
+                 */
+                void SetRawMode();
+
+                /**
+                 * Get raw position.
+                 */
+                int32_t GetRawPosition() const;
+
+                /**
+                 * Write object.
+                 *
+                 * @param obj Object to write.
+                 */
+                template<typename T>
+                void WriteTopObject(const T& obj)
+                {
+                    ignite::binary::BinaryType<T> type;
+
+                    if (type.IsNull(obj))
+                        stream->WriteInt8(IGNITE_HDR_NULL);
+                    else
+                    {
+                        TemplatedBinaryIdResolver<T> idRslvr(type);
+                        ignite::common::concurrent::SharedPointer<BinaryTypeHandler> metaHnd;
+
+                        if (metaMgr)
+                            metaHnd = metaMgr->GetHandler(idRslvr.GetTypeId());
+
+                        int32_t pos = stream->Position();
+
+                        BinaryWriterImpl writerImpl(stream, &idRslvr, metaMgr, metaHnd.Get(), pos);
+                        ignite::binary::BinaryWriter writer(&writerImpl);
+
+                        stream->WriteInt8(IGNITE_HDR_FULL);
+                        stream->WriteInt8(IGNITE_PROTO_VER);
+                        stream->WriteInt16(IGNITE_BINARY_FLAG_USER_OBJECT);
+                        stream->WriteInt32(idRslvr.GetTypeId());
+                        stream->WriteInt32(type.GetHashCode(obj));
+
+                        // Reserve space for the Object Lenght, Schema ID and Schema or Raw Offsett.
+                        stream->Reserve(12);
+
+                        type.Write(writer, obj);
+
+                        writerImpl.PostWrite();
+
+                        if (metaMgr)
+                            metaMgr->SubmitHandler(type.GetTypeName(), idRslvr.GetTypeId(), metaHnd.Get());
+                    }
+                }
+
+                /**
+                 * Perform all nessasary post-write operations.
+                 * Includes:
+                 * - writing object length;
+                 * - writing schema offset;
+                 * - writing schema id;
+                 * - writing schema to the tail.
+                 */
+                void PostWrite();
+
+                /**
+                 * Check if the writer has object schema.
+                 *
+                 * @return True if has schema.
+                 */
+                bool HasSchema() const;
+                
+                /**
+                 * Writes contating schema and clears current schema.
+                 */
+                void WriteAndClearSchema();
+
+                /**
+                 * Get underlying stream.
+                 *
+                 * @return Stream.
+                 */
+                impl::interop::InteropOutputStream* GetStream();
+            private:
+                /** Underlying stream. */
+                ignite::impl::interop::InteropOutputStream* stream; 
+                
+                /** ID resolver. */
+                BinaryIdResolver* idRslvr;
+                
+                /** Type manager. */
+                BinaryTypeManager* metaMgr;
+                
+                /** Type handler. */
+                BinaryTypeHandler* metaHnd;
+
+                /** Type ID. */
+                int32_t typeId;
+
+                /** Elements write session ID generator. */
+                int32_t elemIdGen;
+                
+                /** Elements write session ID. */
+                int32_t elemId;
+                
+                /** Elements count. */
+                int32_t elemCnt;
+                
+                /** Elements start position. */
+                int32_t elemPos;
+
+                /** Raw data offset. */
+                int32_t rawPos;
+
+                /** Schema of the current object. */
+                BinarySchema schema;
+
+                /** Writing start position. */
+                int32_t start;
+
+                IGNITE_NO_COPY_ASSIGNMENT(BinaryWriterImpl)
+
+                /**
+                 * Write a primitive value to stream in raw mode.
+                 *
+                 * @param val Value.
+                 * @param func Stream function.
+                 */
+                template<typename T>
+                void WritePrimitiveRaw(
+                    const T val, 
+                    void(*func)(interop::InteropOutputStream*, T)
+                )
+                {
+                    CheckRawMode(true);
+                    CheckSingleMode(true);
+
+                    func(stream, val);
+                }
+
+                /**
+                 * Write a primitive array to stream in raw mode.
+                 *
+                 * @param val Value.
+                 * @param len Array length.
+                 * @param func Stream function.
+                 * @param hdr Header.
+                 */
+                template<typename T>
+                void WritePrimitiveArrayRaw(
+                    const T* val,
+                    const int32_t len,
+                    void(*func)(interop::InteropOutputStream*, const T*, const int32_t),
+                    const int8_t hdr
+                )
+                {
+                    CheckRawMode(true);
+                    CheckSingleMode(true);
+
+                    if (val)
+                    {
+                        stream->WriteInt8(hdr);
+                        stream->WriteInt32(len);
+                        func(stream, val, len);
+                    }
+                    else
+                        stream->WriteInt8(IGNITE_HDR_NULL);
+                }
+
+                /**
+                 * Write a primitive value to stream.
+                 *
+                 * @param fieldName Field name.
+                 * @param val Value.
+                 * @param func Stream function.
+                 * @param typ Field type ID.
+                 * @param len Field length.
+                 */
+                template<typename T>
+                void WritePrimitive(
+                    const char* fieldName, 
+                    const T val, 
+                    void(*func)(interop::InteropOutputStream*, T), 
+                    const int8_t typ, 
+                    const int32_t len
+                )
+                {
+                    CheckRawMode(false);
+                    CheckSingleMode(true);
+
+                    WriteFieldId(fieldName, typ);
+
+                    stream->WriteInt8(typ);
+
+                    func(stream, val);
+                }
+
+                /**
+                 * Write a primitive array to stream.
+                 *
+                 * @param fieldName Field name.
+                 * @param val Value.
+                 * @param len Array length.
+                 * @param func Stream function.
+                 * @param hdr Header.
+                 * @param lenShift Length shift.
+                 */
+                template<typename T>
+                void WritePrimitiveArray(
+                    const char* fieldName, 
+                    const T* val, 
+                    const int32_t len, 
+                    void(*func)(interop::InteropOutputStream*, const T*, const int32_t), 
+                    const int8_t hdr, 
+                    const int32_t lenShift
+                )
+                {
+                    CheckRawMode(false);
+                    CheckSingleMode(true);
+
+                    WriteFieldId(fieldName, hdr);
+
+                    if (val)
+                    {
+                        stream->WriteInt8(hdr);
+                        stream->WriteInt32(len);
+                        func(stream, val, len);
+                    }
+                    else
+                    {
+                        stream->WriteInt8(IGNITE_HDR_NULL);
+                    }
+                }
+
+                /**
+                 * Write values in interval [first, last).
+                 * New session should be started prior to call to this method.
+                 * @param first Iterator pointing to the beginning of the interval.
+                 * @param last Iterator pointing to the end of the interval.
+                 * @param typ Collection type.
+                 */
+                template<typename InputIterator>
+                void WriteCollectionWithinSession(InputIterator first, InputIterator last,
+                    ignite::binary::CollectionType typ)
+                {
+                    stream->WriteInt8(IGNITE_TYPE_COLLECTION);
+                    stream->Position(stream->Position() + 4);
+                    stream->WriteInt8(typ);
+
+                    for (InputIterator i = first; i != last; ++i)
+                        WriteElement(elemId, *i);
+
+                    CommitContainer(elemId);
+                }
+
+                /**
+                 * Check raw mode.
+                 *
+                 * @param expected Expected raw mode of the reader.
+                 */
+                void CheckRawMode(bool expected) const;
+
+                /**
+                 * Check whether writer is currently operating in single mode.
+                 *
+                 * @param expected Expected value.
+                 */
+                void CheckSingleMode(bool expected) const;
+
+                /**
+                 * Start new container writer session.
+                 *
+                 * @param expRawMode Expected raw mode.
+                 */
+                void StartContainerSession(bool expRawMode);
+
+                /**
+                 * Check whether session ID matches.
+                 *
+                 * @param ses Expected session ID.
+                 */
+                void CheckSession(int32_t expSes) const;
+
+                /**
+                 * Write field ID.
+                 *
+                 * @param fieldName Field name.
+                 * @param fieldTypeId Field type ID.
+                 */
+                void WriteFieldId(const char* fieldName, int32_t fieldTypeId);
+
+                /**
+                 * Write primitive value.
+                 *
+                 * @param obj Value.
+                 * @param func Stream function.
+                 * @param hdr Header.
+                 */
+                template<typename T>
+                void WriteTopObject0(const T obj, void(*func)(impl::interop::InteropOutputStream*, T), const int8_t hdr)
+                {
+                    stream->WriteInt8(hdr);
+                    func(stream, obj);
+                }
+            };
+
+            template<>
+            void IGNITE_IMPORT_EXPORT BinaryWriterImpl::WriteTopObject(const int8_t& obj);
+
+            template<>
+            void IGNITE_IMPORT_EXPORT BinaryWriterImpl::WriteTopObject(const bool& obj);
+
+            template<>
+            void IGNITE_IMPORT_EXPORT BinaryWriterImpl::WriteTopObject(const int16_t& obj);
+
+            template<>
+            void IGNITE_IMPORT_EXPORT BinaryWriterImpl::WriteTopObject(const uint16_t& obj);
+
+            template<>
+            void IGNITE_IMPORT_EXPORT BinaryWriterImpl::WriteTopObject(const int32_t& obj);
+
+            template<>
+            void IGNITE_IMPORT_EXPORT BinaryWriterImpl::WriteTopObject(const int64_t& obj);
+
+            template<>
+            void IGNITE_IMPORT_EXPORT BinaryWriterImpl::WriteTopObject(const float& obj);
+
+            template<>
+            void IGNITE_IMPORT_EXPORT BinaryWriterImpl::WriteTopObject(const double& obj);
+
+            template<>
+            void IGNITE_IMPORT_EXPORT BinaryWriterImpl::WriteTopObject(const Guid& obj);
+
+            template<>
+            inline void IGNITE_IMPORT_EXPORT BinaryWriterImpl::WriteTopObject(const std::string& obj)
+            {
+                const char* obj0 = obj.c_str();
+
+                int32_t len = static_cast<int32_t>(strlen(obj0));
+
+                stream->WriteInt8(IGNITE_TYPE_STRING);
+
+                BinaryUtils::WriteString(stream, obj0, len);
+            }
+        }
+    }
+}
+
+#endif
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/303d79eb/modules/platforms/cpp/core/include/ignite/impl/cache/cache_impl.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/impl/cache/cache_impl.h b/modules/platforms/cpp/core/include/ignite/impl/cache/cache_impl.h
index 803ef04..31ebca1 100644
--- a/modules/platforms/cpp/core/include/ignite/impl/cache/cache_impl.h
+++ b/modules/platforms/cpp/core/include/ignite/impl/cache/cache_impl.h
@@ -403,8 +403,8 @@ namespace ignite
                     ignite::common::concurrent::SharedPointer<interop::InteropMemory> mem = env.Get()->AllocateMemory();
                     interop::InteropMemory* mem0 = mem.Get();
                     interop::InteropOutputStream out(mem0);
-                    portable::PortableWriterImpl writer(&out, env.Get()->GetMetadataManager());
-                    ignite::portable::PortableRawWriter rawWriter(&writer);
+                    binary::BinaryWriterImpl writer(&out, env.Get()->GetTypeManager());
+                    ignite::binary::BinaryRawWriter rawWriter(&writer);
 
                     qry.Write(rawWriter);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/303d79eb/modules/platforms/cpp/core/include/ignite/impl/cache/query/query_fields_row_impl.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/impl/cache/query/query_fields_row_impl.h b/modules/platforms/cpp/core/include/ignite/impl/cache/query/query_fields_row_impl.h
index ff04c09..213f717 100644
--- a/modules/platforms/cpp/core/include/ignite/impl/cache/query/query_fields_row_impl.h
+++ b/modules/platforms/cpp/core/include/ignite/impl/cache/query/query_fields_row_impl.h
@@ -156,7 +156,7 @@ namespace ignite
                     interop::InteropInputStream stream;
 
                     /** Row data reader. */
-                    portable::PortableReaderImpl reader;
+                    binary::BinaryReaderImpl reader;
 
                     /** Number of elements in a row. */
                     int32_t size;

http://git-wip-us.apache.org/repos/asf/ignite/blob/303d79eb/modules/platforms/cpp/core/include/ignite/impl/ignite_environment.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/impl/ignite_environment.h b/modules/platforms/cpp/core/include/ignite/impl/ignite_environment.h
index 59c0300..2fbdb44 100644
--- a/modules/platforms/cpp/core/include/ignite/impl/ignite_environment.h
+++ b/modules/platforms/cpp/core/include/ignite/impl/ignite_environment.h
@@ -22,7 +22,7 @@
 #include <ignite/common/java.h>
 
 #include "ignite/impl/interop/interop_memory.h"
-#include "portable/portable_metadata_manager.h"
+#include "binary/binary_type_manager.h"
 
 namespace ignite 
 {    
@@ -104,11 +104,11 @@ namespace ignite
             ignite::common::concurrent::SharedPointer<interop::InteropMemory> GetMemory(int64_t memPtr);
 
             /**
-             * Get metadata manager.
+             * Get type manager.
              *
-             * @param Metadata manager.
+             * @param Type manager.
              */
-            portable::PortableMetadataManager* GetMetadataManager();
+            binary::BinaryTypeManager* GetTypeManager();
         private:
             /** Context to access Java. */
             ignite::common::concurrent::SharedPointer<ignite::common::java::JniContext> ctx;
@@ -119,8 +119,8 @@ namespace ignite
             /** Ignite name. */
             char* name;
 
-            /** Metadata manager. */
-            portable::PortableMetadataManager* metaMgr;       
+            /** Type manager. */
+            binary::BinaryTypeManager* metaMgr;       
 
             IGNITE_NO_COPY_ASSIGNMENT(IgniteEnvironment);
         };

http://git-wip-us.apache.org/repos/asf/ignite/blob/303d79eb/modules/platforms/cpp/core/include/ignite/impl/operations.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/impl/operations.h b/modules/platforms/cpp/core/include/ignite/impl/operations.h
index 8f32922..5423a56 100644
--- a/modules/platforms/cpp/core/include/ignite/impl/operations.h
+++ b/modules/platforms/cpp/core/include/ignite/impl/operations.h
@@ -25,9 +25,9 @@
 #include <ignite/common/common.h>
 
 #include "ignite/cache/cache_entry.h"
-#include "ignite/impl/portable/portable_reader_impl.h"
-#include "ignite/impl/portable/portable_writer_impl.h"
-#include "ignite/portable/portable.h"
+#include "ignite/impl/binary/binary_reader_impl.h"
+#include "ignite/impl/binary/binary_writer_impl.h"
+#include "ignite/binary/binary.h"
 
 namespace ignite
 {
@@ -52,7 +52,7 @@ namespace ignite
              *
              * @param writer Writer.
              */
-            virtual void ProcessInput(ignite::impl::portable::PortableWriterImpl& writer) = 0;
+            virtual void ProcessInput(ignite::impl::binary::BinaryWriterImpl& writer) = 0;
         };
 
         /**
@@ -72,7 +72,7 @@ namespace ignite
                 // No-op.
             }
 
-            virtual void ProcessInput(ignite::impl::portable::PortableWriterImpl& writer)
+            virtual void ProcessInput(ignite::impl::binary::BinaryWriterImpl& writer)
             {
                 writer.WriteTopObject<T>(*val);
             }
@@ -101,7 +101,7 @@ namespace ignite
                 // No-op.
             }
 
-            virtual void ProcessInput(ignite::impl::portable::PortableWriterImpl& writer)
+            virtual void ProcessInput(ignite::impl::binary::BinaryWriterImpl& writer)
             {
                 writer.WriteTopObject<T1>(*val1);
                 writer.WriteTopObject<T2>(*val2);
@@ -135,7 +135,7 @@ namespace ignite
                 // No-op.
             }
 
-            virtual void ProcessInput(ignite::impl::portable::PortableWriterImpl& writer)
+            virtual void ProcessInput(ignite::impl::binary::BinaryWriterImpl& writer)
             {
                 writer.WriteTopObject<T1>(*val1);
                 writer.WriteTopObject<T2>(*val2);
@@ -171,7 +171,7 @@ namespace ignite
                 // No-op.
             }
 
-            virtual void ProcessInput(ignite::impl::portable::PortableWriterImpl& writer)
+            virtual void ProcessInput(ignite::impl::binary::BinaryWriterImpl& writer)
             {
                 writer.GetStream()->WriteInt32(static_cast<int32_t>(val->size()));
 
@@ -202,7 +202,7 @@ namespace ignite
                 // No-op.
             }
 
-            virtual void ProcessInput(ignite::impl::portable::PortableWriterImpl& writer)
+            virtual void ProcessInput(ignite::impl::binary::BinaryWriterImpl& writer)
             {
                 writer.GetStream()->WriteInt32(static_cast<int32_t>(val->size()));
 
@@ -236,7 +236,7 @@ namespace ignite
                 // No-op.
             }
 
-            virtual void ProcessInput(ignite::impl::portable::PortableWriterImpl& writer)
+            virtual void ProcessInput(ignite::impl::binary::BinaryWriterImpl& writer)
             {
                 writer.WriteTopObject<T>(*key);
                 writer.GetStream()->WriteInt32(peekModes);
@@ -270,7 +270,7 @@ namespace ignite
              *
              * @param reader Reader.
              */
-            virtual void ProcessOutput(ignite::impl::portable::PortableReaderImpl& reader) = 0;
+            virtual void ProcessOutput(ignite::impl::binary::BinaryReaderImpl& reader) = 0;
         };
 
         /**
@@ -288,7 +288,7 @@ namespace ignite
                 // No-op.
             }
 
-            virtual void ProcessOutput(ignite::impl::portable::PortableReaderImpl& reader)
+            virtual void ProcessOutput(ignite::impl::binary::BinaryReaderImpl& reader)
             {
                 val = reader.ReadTopObject<T>();
             }
@@ -324,7 +324,7 @@ namespace ignite
                 // No-op.
             }
 
-            virtual void ProcessOutput(ignite::impl::portable::PortableReaderImpl& reader)
+            virtual void ProcessOutput(ignite::impl::binary::BinaryReaderImpl& reader)
             {
                 val1 = reader.ReadTopObject<T1>();
                 val2 = reader.ReadTopObject<T2>();
@@ -375,7 +375,7 @@ namespace ignite
                 // No-op.
             }
 
-            virtual void ProcessOutput(ignite::impl::portable::PortableReaderImpl& reader)
+            virtual void ProcessOutput(ignite::impl::binary::BinaryReaderImpl& reader)
             {
                 bool exists = reader.GetStream()->ReadBool();
 
@@ -427,7 +427,7 @@ namespace ignite
                 // No-op.
             }
 
-            virtual void ProcessOutput(ignite::impl::portable::PortableReaderImpl& reader)
+            virtual void ProcessOutput(ignite::impl::binary::BinaryReaderImpl& reader)
             {
                 int32_t cnt = reader.ReadInt32();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/303d79eb/modules/platforms/cpp/core/include/ignite/impl/portable/portable_common.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/impl/portable/portable_common.h b/modules/platforms/cpp/core/include/ignite/impl/portable/portable_common.h
deleted file mode 100644
index f08c49b..0000000
--- a/modules/platforms/cpp/core/include/ignite/impl/portable/portable_common.h
+++ /dev/null
@@ -1,182 +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.
- */
-
-#ifndef _IGNITE_IMPL_PORTABLE_COMMON
-#define _IGNITE_IMPL_PORTABLE_COMMON
-
-#include <stdint.h>
-
-namespace ignite
-{    
-    namespace impl
-    {
-        namespace portable
-        {
-            /** Header: null. */
-            const int8_t IGNITE_HDR_NULL = 101;
-
-            /** Header: handle. */
-            const int8_t IGNITE_HDR_HND = 102;
-
-            /** Header: fulle form. */
-            const int8_t IGNITE_HDR_FULL = 103;
-
-            /** Portable protocol version.  */
-            const int8_t IGNITE_PROTO_VER = 1;
-
-            /** Protocol version position. */
-            const int32_t PROTO_VER_POS = 1;
-
-            /** Header offset: Flags. */
-            const int32_t IGNITE_OFFSET_FLAGS = 2;
-
-            /** Header offset: Type ID. */
-            const int32_t IGNITE_OFFSET_TYPE_ID = 4;
-
-            /** Header offset: Hash Code. */
-            const int32_t IGNITE_OFFSET_HASH_CODE = 8;
-
-            /** Header offset: Object Length. */
-            const int32_t IGNITE_OFFSET_LEN = 12;
-
-            /** Header offset: Schema ID. */
-            const int32_t IGNITE_OFFSET_SCHEMA_ID = 16;
-
-            /** Header offset: Schema or Raw Offset. */
-            const int32_t IGNITE_OFFSET_SCHEMA_OR_RAW_OFF = 20;
-
-            /** Full header length. */
-            const int32_t IGNITE_DFLT_HDR_LEN = 24;
-
-            /** Type: object. */
-            const int8_t IGNITE_TYPE_OBJECT = IGNITE_HDR_FULL;
-
-            /** Type: unsigned byte. */
-            const int8_t IGNITE_TYPE_BYTE = 1;
-
-            /** Type: short. */
-            const int8_t IGNITE_TYPE_SHORT = 2;
-
-            /** Type: int. */
-            const int8_t IGNITE_TYPE_INT = 3;
-
-            /** Type: long. */
-            const int8_t IGNITE_TYPE_LONG = 4;
-
-            /** Type: float. */
-            const int8_t IGNITE_TYPE_FLOAT = 5;
-
-            /** Type: double. */
-            const int8_t IGNITE_TYPE_DOUBLE = 6;
-
-            /** Type: char. */
-            const int8_t IGNITE_TYPE_CHAR = 7;
-
-            /** Type: boolean. */
-            const int8_t IGNITE_TYPE_BOOL = 8;
-
-            /** Type: decimal. */
-            const int8_t IGNITE_TYPE_DECIMAL = 30;
-
-            /** Type: string. */
-            const int8_t IGNITE_TYPE_STRING = 9;
-
-            /** Type: UUID. */
-            const int8_t IGNITE_TYPE_UUID = 10;
-
-            /** Type: date. */
-            const int8_t IGNITE_TYPE_DATE = 11;
-
-            /** Type: unsigned byte array. */
-            const int8_t IGNITE_TYPE_ARRAY_BYTE = 12;
-
-            /** Type: short array. */
-            const int8_t IGNITE_TYPE_ARRAY_SHORT = 13;
-
-            /** Type: int array. */
-            const int8_t IGNITE_TYPE_ARRAY_INT = 14;
-
-            /** Type: long array. */
-            const int8_t IGNITE_TYPE_ARRAY_LONG = 15;
-
-            /** Type: float array. */
-            const int8_t IGNITE_TYPE_ARRAY_FLOAT = 16;
-
-            /** Type: double array. */
-            const int8_t IGNITE_TYPE_ARRAY_DOUBLE = 17;
-
-            /** Type: char array. */
-            const int8_t IGNITE_TYPE_ARRAY_CHAR = 18;
-
-            /** Type: boolean array. */
-            const int8_t IGNITE_TYPE_ARRAY_BOOL = 19;
-
-            /** Type: decimal array. */
-            const int8_t IGNITE_TYPE_ARRAY_DECIMAL = 31;
-
-            /** Type: string array. */
-            const int8_t IGNITE_TYPE_ARRAY_STRING = 20;
-
-            /** Type: UUID array. */
-            const int8_t IGNITE_TYPE_ARRAY_UUID = 21;
-
-            /** Type: date array. */
-            const int8_t IGNITE_TYPE_ARRAY_DATE = 22;
-
-            /** Type: object array. */
-            const int8_t IGNITE_TYPE_ARRAY = 23;
-
-            /** Type: collection. */
-            const int8_t IGNITE_TYPE_COLLECTION = 24;
-
-            /** Type: map. */
-            const int8_t IGNITE_TYPE_MAP = 25;
-
-            /** Type: map entry. */
-            const int8_t IGNITE_TYPE_MAP_ENTRY = 26;
-
-            /** Type: portable object. */
-            const int8_t IGNITE_TYPE_PORTABLE = 27;
-
-            /** Read/write single object. */
-            const int32_t IGNITE_PORTABLE_MODE_SINGLE = 0;
-
-            /** Read/write array. */
-            const int32_t IGNITE_PORTABLE_MODE_ARRAY = 1;
-
-            /** Read/write collection. */
-            const int32_t IGNITE_PORTABLE_MODE_COL = 2;
-
-            /** Read/write map. */
-            const int32_t IGNITE_PORTABLE_MODE_MAP = 3;
-
-            /** User object flag. */
-            const int16_t IGNITE_PORTABLE_FLAG_USER_OBJECT = 0x0001;
-
-            /** Raw only flag. */
-            const int16_t IGNITE_PORTABLE_FLAG_RAW_ONLY = 0x0002;
-
-            /** Flag indicating that schema field offset is one byte long. */
-            const int16_t IGNITE_PORTABLE_FLAG_OFFSET_1_BYTE = 0x0004;
-
-            /** Flag indicating that schema field offset is two byte long. */
-            const int16_t IGNITE_PORTABLE_FLAG_OFFSET_2_BYTE = 0x0008;
-        }
-    }    
-}
-
-#endif
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/303d79eb/modules/platforms/cpp/core/include/ignite/impl/portable/portable_id_resolver.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/impl/portable/portable_id_resolver.h b/modules/platforms/cpp/core/include/ignite/impl/portable/portable_id_resolver.h
deleted file mode 100644
index d8f7883..0000000
--- a/modules/platforms/cpp/core/include/ignite/impl/portable/portable_id_resolver.h
+++ /dev/null
@@ -1,106 +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.
- */
-
-#ifndef _IGNITE_IMPL_PORTABLE_ID_RESOLVER
-#define _IGNITE_IMPL_PORTABLE_ID_RESOLVER
-
-#include "ignite/portable/portable_type.h"
-
-namespace ignite
-{
-    namespace impl
-    {
-        namespace portable
-        {
-            /**
-             * Portable type id resolver.
-             */
-            class PortableIdResolver
-            {
-            public:
-                /**
-                 * Destructor.
-                 */
-                virtual ~PortableIdResolver()
-                {
-                    // No-op.
-                }
-
-                /**
-                 * Get portable object type ID.
-                 *
-                 * @return Type ID.
-                 */
-                virtual int32_t GetTypeId() = 0;
-
-                /**
-                 * Get portable object field ID.
-                 *
-                 * @param typeId Type ID.
-                 * @param name Field name.
-                 * @return Field ID.
-                 */
-                virtual int32_t GetFieldId(const int32_t typeId, const char* name) = 0;
-            };
-
-            /**
-             * Templated portable type descriptor.
-             */
-            template<typename T>
-            class TemplatedPortableIdResolver : public PortableIdResolver
-            {
-            public:
-                /**
-                 * Constructor.
-                 */
-                TemplatedPortableIdResolver()
-                {
-                    type = ignite::portable::PortableType<T>();
-                }
-
-                /**
-                 * Constructor.
-                 *
-                 * @param type Portable type.
-                 */
-                TemplatedPortableIdResolver(ignite::portable::PortableType<T> type) : type(type)
-                {
-                    // No-op.
-                }
-
-                virtual int32_t GetTypeId()
-                {
-                    return type.GetTypeId();
-                }
-
-                virtual int32_t GetFieldId(const int32_t typeId, const char* name) {
-                    if (!name)
-                    {
-                        IGNITE_ERROR_1(IgniteError::IGNITE_ERR_PORTABLE, "Field name cannot be NULL.");
-                    }
-
-                    return type.GetFieldId(name);
-                }
-            private:
-                /** Actual type.  */
-                ignite::portable::PortableType<T> type; 
-            };
-        }
-    }
-}
-
-#endif
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/303d79eb/modules/platforms/cpp/core/include/ignite/impl/portable/portable_metadata_handler.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/impl/portable/portable_metadata_handler.h b/modules/platforms/cpp/core/include/ignite/impl/portable/portable_metadata_handler.h
deleted file mode 100644
index a557129..0000000
--- a/modules/platforms/cpp/core/include/ignite/impl/portable/portable_metadata_handler.h
+++ /dev/null
@@ -1,102 +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.
- */
-
-#ifndef _IGNITE_IMPL_PORTABLE_METADATA_HANDLER
-#define _IGNITE_IMPL_PORTABLE_METADATA_HANDLER
-
-#include <ignite/common/concurrent.h>
-
-#include "ignite/impl/portable/portable_metadata_snapshot.h"
-
-namespace ignite
-{    
-    namespace impl
-    {
-        namespace portable
-        {
-            /**
-             * Metadata handler. Tracks all metadata updates during write session.
-             */
-            class PortableMetadataHandler 
-            {
-            public:
-                /**
-                 * Constructor.
-                 *
-                 * @param snap Snapshot.
-                 */
-                PortableMetadataHandler(SPSnap snap);
-                
-                /**
-                 * Destructor.
-                 */
-                ~PortableMetadataHandler();
-
-                /**
-                 * Callback invoked when field is being written.
-                 *
-                 * @param fieldId Field ID.
-                 * @param fieldName Field name.
-                 * @param fieldTypeId Field type ID.
-                 */
-                void OnFieldWritten(int32_t fieldId, std::string fieldName, int32_t fieldTypeId);
-
-                /**
-                 * Get initial snapshot.
-                 *
-                 * @param Snapshot.
-                 */
-                SPSnap GetSnapshot();
-
-                /**
-                 * Whether any difference exists.
-                 *
-                 * @param True if difference exists.
-                 */
-                bool HasDifference();
-
-                /**
-                 * Get recorded field IDs difference.
-                 *
-                 * @param Recorded field IDs difference.
-                 */
-                std::set<int32_t>* GetFieldIds();
-
-                /**
-                 * Get recorded fields difference.
-                 *
-                 * @param Recorded fields difference.
-                 */
-                std::map<std::string, int32_t>* GetFields();
-
-            private:
-                /** Snapshot. */
-                SPSnap snap;                          
-
-                /** Recorded field IDs difference. */
-                std::set<int32_t>* fieldIds;           
-                
-                /** Recorded fields difference. */
-                std::map<std::string, int32_t>* fields; 
-
-                IGNITE_NO_COPY_ASSIGNMENT(PortableMetadataHandler)
-            };
-        }
-    }    
-}
-
-#endif
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/303d79eb/modules/platforms/cpp/core/include/ignite/impl/portable/portable_metadata_manager.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/impl/portable/portable_metadata_manager.h b/modules/platforms/cpp/core/include/ignite/impl/portable/portable_metadata_manager.h
deleted file mode 100644
index 3e2b770..0000000
--- a/modules/platforms/cpp/core/include/ignite/impl/portable/portable_metadata_manager.h
+++ /dev/null
@@ -1,120 +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.
- */
-
-#ifndef _IGNITE_IMPL_PORTABLE_METADATA_MANAGER
-#define _IGNITE_IMPL_PORTABLE_METADATA_MANAGER
-
-#include <vector>
-
-#include "ignite/ignite_error.h"
-#include "ignite/impl/portable/portable_metadata_handler.h"
-#include "ignite/impl/portable/portable_metadata_updater.h"
-
-namespace ignite
-{    
-    namespace impl
-    {
-        namespace portable
-        {
-            /**
-             * Metadata manager.
-             */
-            class IGNITE_IMPORT_EXPORT PortableMetadataManager
-            {
-            public:
-                /**
-                 * Constructor.
-                 */
-                PortableMetadataManager();
-
-                /**
-                 * Destructor.
-                 */
-                ~PortableMetadataManager();
-
-                /**
-                 * Get handler.
-                 *
-                 * @param typeId Type ID.
-                 */
-                ignite::common::concurrent::SharedPointer<PortableMetadataHandler> GetHandler(int32_t typeId);
-
-                /**
-                 * Submit handler for processing.
-                 * 
-                 * @param typeName Type name.
-                 * @param typeId Type ID.
-                 * @param hnd Handler.
-                 */
-                void SubmitHandler(std::string typeName, int32_t typeId, PortableMetadataHandler* hnd);
-
-                /**
-                 * Get current metadata manager version.
-                 *
-                 * @param Version.
-                 */
-                int32_t GetVersion();
-
-                /**
-                 * Check whether something is updated since the given version.
-                 *
-                 * @param oldVer Old version.
-                 * @return True if updated and it is very likely that pending metadata exists.
-                 */
-                bool IsUpdatedSince(int32_t oldVer);
-
-                /**
-                 * Process pending updates.
-                 *
-                 * @param updated Updater.
-                 * @param err Error.
-                 * @return In case of success.
-                 */
-                bool ProcessPendingUpdates(PortableMetadataUpdater* updater, IgniteError* err);
-
-            private:
-                /** Current snapshots. */
-                ignite::common::concurrent::SharedPointer<std::map<int32_t, SPSnap>> snapshots;
-                
-                /** Pending snapshots. */
-                std::vector<SPSnap>* pending;                                          
-
-                /** Critical section. */
-                ignite::common::concurrent::CriticalSection* cs;
-
-                /** Version of pending changes. */
-                int32_t pendingVer;                                                    
-                
-                /** Latest version. */
-                int32_t ver;          
-
-                IGNITE_NO_COPY_ASSIGNMENT(PortableMetadataManager);
-
-                /**
-                 * Copy fields from a snapshot into relevant collections.
-                 *
-                 * @param snap Target snapshot.
-                 * @param fieldIds Field IDs.
-                 * @param fields Fields.
-                 */
-                void CopyFields(Snap* snap, std::set<int32_t>* fieldIds, std::map<std::string, int32_t>* fields);
-            };
-        }
-    }    
-}
-
-#endif
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/303d79eb/modules/platforms/cpp/core/include/ignite/impl/portable/portable_metadata_snapshot.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/impl/portable/portable_metadata_snapshot.h b/modules/platforms/cpp/core/include/ignite/impl/portable/portable_metadata_snapshot.h
deleted file mode 100644
index 1e000fc..0000000
--- a/modules/platforms/cpp/core/include/ignite/impl/portable/portable_metadata_snapshot.h
+++ /dev/null
@@ -1,122 +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.
- */
-
-#ifndef _IGNITE_IMPL_PORTABLE_METADATA_SNAPSHOT
-#define _IGNITE_IMPL_PORTABLE_METADATA_SNAPSHOT
-
-#include <map>
-#include <set>
-#include <stdint.h>
-#include <string>
-
-#include <ignite/common/common.h>
-#include <ignite/common/concurrent.h>
-
-namespace ignite
-{    
-    namespace impl
-    {
-        namespace portable
-        {
-            /**
-             * Metadata snapshot. 
-             */
-            class PortableMetadataSnapshot
-            {
-            public:
-                /**
-                 * Constructor.
-                 *
-                 * @param typeName Type name.
-                 * @param typeId Type ID.
-                 * @param fieldIds Field IDs.
-                 * @param fields Fields.
-                 */
-                PortableMetadataSnapshot(std::string typeName, int32_t typeId, std::set<int32_t>* fieldIds, 
-                    std::map<std::string, int32_t>* fields);
-                
-                /**
-                 * Destructor.
-                 */
-                ~PortableMetadataSnapshot();
-
-                /**
-                 * Check whether snapshot contains a field with the given ID.
-                 *
-                 * @param fieldId Field ID.
-                 * @return True if contains, false otherwise.
-                 */
-                bool ContainsFieldId(int32_t fieldId);
-
-                /**
-                 * Get type name.
-                 *
-                 * @param Type name.
-                 */
-                std::string GetTypeName();
-
-                /**
-                 * Get type ID.
-                 *
-                 * @return Type ID.
-                 */
-                int32_t GetTypeId();
-
-                /**
-                 * Whether snapshot contains any fields.
-                 *
-                 * @param True if fields exist.
-                 */
-                bool HasFields();
-
-                /** 
-                 * Get field IDs.
-                 *
-                 * @param Field IDs.
-                 */
-                std::set<int32_t>* GetFieldIds();
-
-                /**
-                 * Get fields.
-                 *
-                 * @return Fields.
-                 */
-                std::map<std::string, int32_t>* GetFields();
-
-            private:
-                /** Type name. */
-                std::string typeName;                   
-                
-                /** Type ID. */
-                int32_t typeId;
-
-                /** Known field IDs. */
-                std::set<int32_t>* fieldIds;
-
-                /** Field name-type mappings. */
-                std::map<std::string, int32_t>* fields; 
-
-                IGNITE_NO_COPY_ASSIGNMENT(PortableMetadataSnapshot)
-            };
-
-            typedef PortableMetadataSnapshot Snap;
-            typedef ignite::common::concurrent::SharedPointer<Snap> SPSnap;
-        }
-    }    
-}
-
-#endif
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/303d79eb/modules/platforms/cpp/core/include/ignite/impl/portable/portable_metadata_updater.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/impl/portable/portable_metadata_updater.h b/modules/platforms/cpp/core/include/ignite/impl/portable/portable_metadata_updater.h
deleted file mode 100644
index a734db7..0000000
--- a/modules/platforms/cpp/core/include/ignite/impl/portable/portable_metadata_updater.h
+++ /dev/null
@@ -1,53 +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.
- */
-
-#ifndef _IGNITE_IMPL_PORTABLE_METADATA_UPDATER
-#define _IGNITE_IMPL_PORTABLE_METADATA_UPDATER
-
-#include "ignite/ignite_error.h"
-#include "ignite/impl/portable/portable_metadata_snapshot.h"
-
-namespace ignite
-{    
-    namespace impl
-    {
-        namespace portable
-        {
-            /**
-             * Metadata updater interface.
-             */
-            class IGNITE_IMPORT_EXPORT PortableMetadataUpdater
-            {
-            public:
-                /**
-                 * Destructor.
-                 */
-                virtual ~PortableMetadataUpdater();
-
-                /**
-                 * Update metadata using provided snapshot.
-                 *
-                 * @param snapshot Snapshot.
-                 * @param err Error.
-                 */
-                virtual bool Update(Snap* snapshot, IgniteError* err) = 0;
-            };
-        }
-    }    
-}
-
-#endif
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/303d79eb/modules/platforms/cpp/core/include/ignite/impl/portable/portable_metadata_updater_impl.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/impl/portable/portable_metadata_updater_impl.h b/modules/platforms/cpp/core/include/ignite/impl/portable/portable_metadata_updater_impl.h
deleted file mode 100644
index 832c2a3..0000000
--- a/modules/platforms/cpp/core/include/ignite/impl/portable/portable_metadata_updater_impl.h
+++ /dev/null
@@ -1,65 +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.
- */
-
-#ifndef _IGNITE_IMPL_PORTABLE_METADATA_UPDATER_IMPL
-#define _IGNITE_IMPL_PORTABLE_METADATA_UPDATER_IMPL
-
-#include <ignite/common/exports.h>
-
-#include "ignite/impl/ignite_environment.h"
-#include "ignite/impl/portable/portable_metadata_updater.h"
-
-namespace ignite
-{    
-    namespace impl
-    {
-        namespace portable
-        {
-            /**
-             * Metadata updater implementation.
-             */
-            class IGNITE_IMPORT_EXPORT PortableMetadataUpdaterImpl : public PortableMetadataUpdater
-            {
-            public:
-                /**
-                 * Constructor.
-                 *
-                 * @param env Environment.
-                 * @param javaRef Reference to Java object which is able to process metadata request.
-                 */
-                PortableMetadataUpdaterImpl(ignite::common::concurrent::SharedPointer<IgniteEnvironment> env, jobject javaRef);
-
-                /**
-                 * Destructor.
-                 */
-                ~PortableMetadataUpdaterImpl();
-
-                bool Update(Snap* snapshot, IgniteError* err);
-            private:
-                /** Environment. */
-                ignite::common::concurrent::SharedPointer<IgniteEnvironment> env;
-                
-                /** Handle to Java object. */
-                jobject javaRef;                 
-
-                IGNITE_NO_COPY_ASSIGNMENT(PortableMetadataUpdaterImpl)
-            };
-        }
-    }    
-}
-
-#endif
\ No newline at end of file


Mime
View raw message