You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2015/09/03 12:49:03 UTC

[09/16] ignite git commit: IGNITE-1364: Moved headers to correct folders.

http://git-wip-us.apache.org/repos/asf/ignite/blob/0d70d547/modules/platform/src/main/cpp/core/include/ignite/cache/query/query_sql.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/cache/query/query_sql.h b/modules/platform/src/main/cpp/core/include/ignite/cache/query/query_sql.h
new file mode 100644
index 0000000..a2e0f33
--- /dev/null
+++ b/modules/platform/src/main/cpp/core/include/ignite/cache/query/query_sql.h
@@ -0,0 +1,253 @@
+/*
+ * 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_CACHE_QUERY_SQL
+#define _IGNITE_CACHE_QUERY_SQL
+
+#include <stdint.h>
+#include <string>
+#include <vector>
+
+#include "ignite/cache/query/query_argument.h"
+#include "ignite/portable/portable_raw_writer.h"
+
+namespace ignite
+{    
+    namespace cache
+    {
+        namespace query
+        {         
+            /**
+             * Sql query.
+             */
+            class SqlQuery
+            {
+            public:
+                /**
+                 * Constructor.
+                 *
+                 * @param type Type name.
+                 * @param sql SQL string.
+                 */
+                SqlQuery(std::string type, std::string sql) : type(type), sql(sql), pageSize(1024), 
+                    loc(false), args(NULL)
+                {
+                    // No-op.
+                }
+
+                /**
+                 * Copy constructor.
+                 *
+                 * @param other Other instance.
+                 */
+                SqlQuery(const SqlQuery& other)
+                {
+                    type = other.type;
+                    sql = other.sql;
+                    pageSize = other.pageSize;
+                    loc = other.loc;
+
+                    if (other.args)
+                    {
+                        args = new std::vector<QueryArgumentBase*>();
+
+                        for (std::vector<QueryArgumentBase*>::iterator it = other.args->begin();
+                            it != other.args->end(); ++it)
+                            args->push_back((*it)->Copy());
+                    }
+                    else
+                        args = NULL;
+                }
+
+                /**
+                 * Assignment operator.
+                 *
+                 * @param other Other instance.
+                 */
+                SqlQuery& operator=(const SqlQuery& other) 
+                {
+                    if (this != &other)
+                    {
+                        type = other.type;
+                        sql = other.sql;
+                        pageSize = other.pageSize;
+                        loc = other.loc;
+
+                        SqlQuery tmp(other);
+
+                        std::vector<QueryArgumentBase*>* args0 = args;
+
+                        args = tmp.args;
+
+                        tmp.args = args0; 
+                    }
+
+                    return *this;
+                }
+
+                /**
+                 * Destructor.
+                 */
+                ~SqlQuery()
+                {
+                    if (args) 
+                    {
+                        for (std::vector<QueryArgumentBase*>::iterator it = args->begin(); it != args->end(); ++it)
+                            delete (*it);
+
+                        delete args;
+                    }
+                }
+
+                /**
+                 * Get type name.
+                 *
+                 * @return Type name.
+                 */
+                std::string GetType()
+                {
+                    return type;
+                }
+
+                /**
+                 * Set type name.
+                 *
+                 * @param sql Type name.
+                 */
+                void SetType(std::string type)
+                {
+                    this->type = type;
+                }
+
+                /**
+                 * Get SQL string.
+                 *
+                 * @return SQL string.
+                 */
+                std::string GetSql()
+                {
+                    return sql;
+                }
+
+                /**
+                 * Set SQL string.
+                 *
+                 * @param sql SQL string.
+                 */
+                void SetSql(std::string sql)
+                {
+                    this->sql = sql;
+                }
+
+                /**
+                 * Get page size.
+                 *
+                 * @return Page size.
+                 */
+                int32_t GetPageSize()
+                {
+                    return pageSize;
+                }
+
+                /**
+                 * Set page size.
+                 *
+                 * @param pageSize Page size.
+                 */
+                void SetPageSize(int32_t pageSize)
+                {
+                    this->pageSize = pageSize;
+                }
+
+                /**
+                 * Get local flag.
+                 *
+                 * @return Local flag.
+                 */
+                bool IsLocal()
+                {
+                    return loc;
+                }
+
+                /**
+                 * Set local flag.
+                 *
+                 * @param loc Local flag.
+                 */
+                void SetLocal(bool loc)
+                {
+                    this->loc = loc;
+                }
+
+                /**
+                 * Add argument.
+                 *
+                 * @param arg Argument.
+                 */
+                template<typename T>
+                void AddArgument(const T& arg)
+                {
+                    if (!args)
+                        args = new std::vector<QueryArgumentBase*>();
+
+                    args->push_back(new QueryArgument<T>(arg));
+                }
+
+                /**
+                 * Write query info to the stream.
+                 *
+                 * @param writer Writer.
+                 */
+                void Write(portable::PortableRawWriter& writer) const
+                {
+                    writer.WriteBool(loc);
+                    writer.WriteString(sql);
+                    writer.WriteString(type);
+                    writer.WriteInt32(pageSize);
+
+                    if (args)
+                    {
+                        writer.WriteInt32(static_cast<int32_t>(args->size()));
+
+                        for (std::vector<QueryArgumentBase*>::iterator it = args->begin(); it != args->end(); ++it)
+                            (*it)->Write(writer);
+                    }
+                    else
+                        writer.WriteInt32(0);
+                }
+
+            private:
+                /** Type name. */
+                std::string type;
+
+                /** SQL string. */
+                std::string sql;
+
+                /** Page size. */
+                int32_t pageSize;
+
+                /** Local flag. */
+                bool loc;
+
+                /** Arguments. */
+                std::vector<QueryArgumentBase*>* args;
+            };
+        }
+    }    
+}
+
+#endif
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/0d70d547/modules/platform/src/main/cpp/core/include/ignite/cache/query/query_text.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/cache/query/query_text.h b/modules/platform/src/main/cpp/core/include/ignite/cache/query/query_text.h
new file mode 100644
index 0000000..67d3ecc
--- /dev/null
+++ b/modules/platform/src/main/cpp/core/include/ignite/cache/query/query_text.h
@@ -0,0 +1,159 @@
+/*
+ * 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_CACHE_QUERY_TEXT
+#define _IGNITE_CACHE_QUERY_TEXT
+
+#include <stdint.h>
+#include <string>
+
+#include "ignite/portable/portable_raw_writer.h"
+
+namespace ignite
+{    
+    namespace cache
+    {
+        namespace query
+        {         
+            /*
+             * Text query.
+             */
+            class TextQuery
+            {
+            public:
+                /*
+                 * Constructor.
+                 *
+                 * @param type Type name.
+                 * @param text Text string.
+                 */
+                TextQuery(std::string type, std::string text) : type(type), text(text), pageSize(1024), loc(false)
+                {
+                    // No-op.
+                }
+                
+                /*
+                 * Get type name.
+                 *
+                 * @return Type name.
+                 */
+                std::string GetType()
+                {
+                    return type;
+                }
+
+                /*
+                 * Set type name.
+                 *
+                 * @param sql Type name.
+                 */
+                void SetType(std::string type)
+                {
+                    this->type = type;
+                }
+
+                /*
+                 * Get text string.
+                 *
+                 * @return text string.
+                 */
+                std::string GetText()
+                {
+                    return text;
+                }
+
+                /*
+                 * Set text string.
+                 *
+                 * @param text Text string.
+                 */
+                void SetText(std::string text)
+                {
+                    this->text = text;
+                }
+
+                /*
+                 * Get page size.
+                 *
+                 * @return Page size.
+                 */
+                int32_t GetPageSize()
+                {
+                    return pageSize;
+                }
+
+                /*
+                 * Set page size.
+                 *
+                 * @param pageSize Page size.
+                 */
+                void SetPageSize(int32_t pageSize)
+                {
+                    this->pageSize = pageSize;
+                }
+
+                /*
+                 * Get local flag.
+                 *
+                 * @return Local flag.
+                 */
+                bool IsLocal()
+                {
+                    return loc;
+                }
+
+                /*
+                    * Set local flag.
+                    *
+                    * @param loc Local flag.
+                    */
+                void SetLocal(bool loc)
+                {
+                    this->loc = loc;
+                }
+                
+                /*
+                 * Write query info to the stream.
+                 *
+                 * @param writer Writer.
+                 */
+                void Write(portable::PortableRawWriter& writer) const
+                {
+                    writer.WriteBool(loc);
+                    writer.WriteString(text);
+                    writer.WriteString(type);
+                    writer.WriteInt32(pageSize);
+                }
+
+            private:
+                /* Type name. */
+                std::string type;
+
+                /* Text string. */
+                std::string text;
+
+                /* Page size. */
+                int32_t pageSize;
+
+                /* Local flag. */
+                bool loc;
+            };
+        }
+    }    
+}
+
+#endif
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/0d70d547/modules/platform/src/main/cpp/core/include/ignite/grid.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/grid.h b/modules/platform/src/main/cpp/core/include/ignite/grid.h
new file mode 100644
index 0000000..e388467
--- /dev/null
+++ b/modules/platform/src/main/cpp/core/include/ignite/grid.h
@@ -0,0 +1,154 @@
+/*
+ * 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_GRID
+#define _IGNITE_GRID
+
+#include "ignite/cache/cache.h"
+#include "ignite/impl/grid_impl.h"
+#include "ignite/grid_configuration.h"
+
+namespace ignite
+{
+    /**
+     * Main interface to operate with Ignite.
+     */
+    class IGNITE_IMPORT_EXPORT Grid
+    {
+    public:
+        /**
+         * Default constructor.
+         */
+        Grid();
+
+        /**
+         * Constructor.
+         */
+        Grid(impl::GridImpl* impl);
+        
+        /**
+         * Get name of the grid.
+         *
+         * @return Name.
+         */
+        char* GetName();
+
+        /**
+         * Get cache.
+         *
+         * @param name Cache name.
+         * @return Cache.
+         */
+        template<typename K, typename V>
+        cache::Cache<K, V> GetCache(const char* name)
+        {
+            GridError err;
+
+            cache::Cache<K, V> res = GetCache<K, V>(name, &err);
+
+            GridError::ThrowIfNeeded(err);
+
+            return res;
+        }
+
+        /**
+         * Get cache.
+         *
+         * @param name Cache name.
+         * @param err Error;
+         * @return Cache.
+         */
+        template<typename K, typename V>
+        cache::Cache<K, V> GetCache(const char* name, GridError* err)
+        {
+            impl::cache::CacheImpl* cacheImpl = impl.Get()->GetCache<K, V>(name, err);
+
+            return cache::Cache<K, V>(cacheImpl);
+        }
+
+        /**
+         * Get or create cache.
+         *
+         * @param name Cache name.
+         * @return Cache.
+         */
+        template<typename K, typename V>
+        cache::Cache<K, V> GetOrCreateCache(const char* name)
+        {
+            GridError err;
+
+            cache::Cache<K, V> res = GetOrCreateCache<K, V>(name, &err);
+
+            GridError::ThrowIfNeeded(err);
+
+            return res;
+        }
+
+        /**
+         * Get or create cache.
+         *
+         * @param name Cache name.
+         * @param err Error;
+         * @return Cache.
+         */
+        template<typename K, typename V>
+        cache::Cache<K, V> GetOrCreateCache(const char* name, GridError* err)
+        {
+            impl::cache::CacheImpl* cacheImpl = impl.Get()->GetOrCreateCache<K, V>(name, err);
+
+            return cache::Cache<K, V>(cacheImpl);
+        }
+
+        /**
+         * Create cache.
+         *
+         * @param name Cache name.
+         * @return Cache.
+         */
+        template<typename K, typename V>
+        cache::Cache<K, V> CreateCache(const char* name)
+        {
+            GridError err;
+
+            cache::Cache<K, V> res = CreateCache<K, V>(name, &err);
+
+            GridError::ThrowIfNeeded(err);
+
+            return res;
+        }
+
+        /**
+         * Create cache.
+         *
+         * @param name Cache name.
+         * @param err Error;
+         * @return Cache.
+         */
+        template<typename K, typename V>
+        cache::Cache<K, V> CreateCache(const char* name, GridError* err)
+        {
+            impl::cache::CacheImpl* cacheImpl = impl.Get()->CreateCache<K, V>(name, err);
+
+            return cache::Cache<K, V>(cacheImpl);
+        }
+    private:
+        /** Implementation delegate. */
+        ignite::common::concurrent::SharedPointer<impl::GridImpl> impl;
+    };
+}
+
+#endif

http://git-wip-us.apache.org/repos/asf/ignite/blob/0d70d547/modules/platform/src/main/cpp/core/include/ignite/grid_configuration.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/grid_configuration.h b/modules/platform/src/main/cpp/core/include/ignite/grid_configuration.h
new file mode 100644
index 0000000..65d2c8e
--- /dev/null
+++ b/modules/platform/src/main/cpp/core/include/ignite/grid_configuration.h
@@ -0,0 +1,92 @@
+/*
+ * 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_GRID_CONFIGURATION
+#define _IGNITE_GRID_CONFIGURATION
+
+#include <stdint.h>
+
+namespace ignite
+{    
+    /**
+     * Single JVM option.
+     */
+    struct GridJvmOption
+    {
+        /** Option. */
+        char* opt;
+
+        /**
+         * Default constructor.
+         */
+        GridJvmOption() : opt(NULL)
+        {
+            // No-op.    
+        }
+
+        /**
+         * Constructor.
+         *
+         * @param opt Option.
+         */
+        GridJvmOption(char* opt) : opt(opt)
+        {
+            // No-op.
+        }
+    };
+
+    /**
+     * Grid configuration.
+     */
+    struct GridConfiguration
+    {
+        /** Path to GridGain home. */
+        char* gridGainHome;
+
+        /** Path to Spring configuration file. */
+        char* springCfgPath;
+
+        /** Path ot JVM libbrary. */
+        char* jvmLibPath;
+
+        /** JVM classpath. */
+        char* jvmClassPath;
+
+        /** Initial amount of JVM memory. */
+        int32_t jvmInitMem;
+
+        /** Maximum amount of JVM memory. */
+        int32_t jvmMaxMem;
+
+        /** Additional JVM options. */
+        GridJvmOption* jvmOpts;
+
+        /** Additional JVM options count. */
+        int32_t jvmOptsLen;
+
+        /**
+         * Constructor.
+         */
+        GridConfiguration() : gridGainHome(NULL), springCfgPath(NULL), jvmLibPath(NULL), jvmClassPath(NULL), 
+            jvmInitMem(512), jvmMaxMem(1024), jvmOpts(NULL), jvmOptsLen(0)
+        {
+            // No-op.
+        }
+    };    
+}
+
+#endif
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/0d70d547/modules/platform/src/main/cpp/core/include/ignite/grid_error.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/grid_error.h b/modules/platform/src/main/cpp/core/include/ignite/grid_error.h
new file mode 100644
index 0000000..7b1dd8e
--- /dev/null
+++ b/modules/platform/src/main/cpp/core/include/ignite/grid_error.h
@@ -0,0 +1,260 @@
+/*
+ * 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_GRID_ERROR
+#define _IGNITE_GRID_ERROR
+
+#include <sstream>
+#include <stdint.h>
+
+#include <ignite/common/common.h>
+
+#define IGNITE_ERROR_1(code, part1) { \
+    std::stringstream stream; \
+    stream << (part1); \
+    throw ignite::GridError(code, stream.str().c_str()); \
+}
+
+#define IGNITE_ERROR_2(code, part1, part2) { \
+    std::stringstream stream; \
+    stream << (part1) << (part2); \
+    throw ignite::GridError(code, stream.str().c_str()); \
+}
+
+#define IGNITE_ERROR_3(code, part1, part2, part3) { \
+    std::stringstream stream; \
+    stream << (part1) << (part2) << (part3); \
+    throw ignite::GridError(code, stream.str().c_str()); \
+}
+
+#define IGNITE_ERROR_FORMATTED_1(code, msg, key1, val1) { \
+    std::stringstream stream; \
+    stream << msg << " [" << key1 << "=" << (val1) << "]"; \
+    throw ignite::GridError(code, stream.str().c_str()); \
+}
+
+#define IGNITE_ERROR_FORMATTED_2(code, msg, key1, val1, key2, val2) { \
+    std::stringstream stream; \
+    stream << msg << " [" << key1 << "=" << (val1) << ", " << key2 << "=" << (val2) << "]"; \
+    throw ignite::GridError(code, stream.str().c_str()); \
+}
+
+#define IGNITE_ERROR_FORMATTED_3(code, msg, key1, val1, key2, val2, key3, val3) { \
+    std::stringstream stream; \
+    stream << msg << " [" << key1 << "=" << (val1) << ", " << key2 << "=" << (val2) << ", " << key3 << "=" << (val3) << "]"; \
+    throw ignite::GridError(code, stream.str().c_str()); \
+}
+
+#define IGNITE_ERROR_FORMATTED_4(code, msg, key1, val1, key2, val2, key3, val3, key4, val4) { \
+    std::stringstream stream; \
+    stream << msg << " [" << key1 << "=" << (val1) << ", " << key2 << "=" << (val2) << ", " << key3 << "=" << (val3) << ", " << key4 << "=" << (val4) << "]"; \
+    throw ignite::GridError(code, stream.str().c_str()); \
+}
+
+namespace ignite
+{
+    /**
+     * Grid error information.
+     */
+    class IGNITE_IMPORT_EXPORT GridError
+    {
+    public:
+        /** Success. */
+        static const int IGNITE_SUCCESS = 0;
+
+        /** Failed to initialize JVM. */
+        static const int IGNITE_ERR_JVM_INIT = 1;
+
+        /** Failed to attach to JVM. */
+        static const int IGNITE_ERR_JVM_ATTACH = 2;
+        
+        /** JVM library is not found. */
+        static const int IGNITE_ERR_JVM_LIB_NOT_FOUND = 3;
+
+        /** Failed to load JVM library. */
+        static const int IGNITE_ERR_JVM_LIB_LOAD_FAILED = 4;
+        
+        /** JVM classpath is not provided. */
+        static const int IGNITE_ERR_JVM_NO_CLASSPATH = 5;
+
+        /** JVM error: no class definition found. */
+        static const int IGNITE_ERR_JVM_NO_CLASS_DEF_FOUND = 6;
+
+        /** JVM error: no such method. */
+        static const int IGNITE_ERR_JVM_NO_SUCH_METHOD = 7;
+
+        /** Memory operation error. */
+        static const int IGNITE_ERR_MEMORY = 1001;
+
+        /** Portable error. */
+        static const int IGNITE_ERR_PORTABLE = 1002;
+
+        /** Generic Ignite error. */
+        static const int IGNITE_ERR_GENERIC = 2000;
+
+        /** Illegal argument passed. */
+        static const int IGNITE_ERR_ILLEGAL_ARGUMENT = 2001;
+
+        /** Illegal state. */
+        static const int IGNITE_ERR_ILLEGAL_STATE = 2002;
+
+        /** Unsupported operation. */
+        static const int IGNITE_ERR_UNSUPPORTED_OPERATION = 2003;
+
+        /** Thread has been interrup. */
+        static const int IGNITE_ERR_INTERRUPTED = 2004;
+
+        /** Cluster group is empty. */
+        static const int IGNITE_ERR_CLUSTER_GROUP_EMPTY = 2005;
+
+        /** Cluster topology problem. */
+        static const int IGNITE_ERR_CLUSTER_TOPOLOGY = 2006;
+
+        /** Compute execution rejected. */
+        static const int IGNITE_ERR_COMPUTE_EXECUTION_REJECTED = 2007;
+
+        /** Compute job failover. */
+        static const int IGNITE_ERR_COMPUTE_JOB_FAILOVER = 2008;
+
+        /** Compute task cancelled. */
+        static const int IGNITE_ERR_COMPUTE_TASK_CANCELLED = 2009;
+
+        /** Compute task timeout. */
+        static const int IGNITE_ERR_COMPUTE_TASK_TIMEOUT = 2010;
+
+        /** Compute user undeclared exception. */
+        static const int IGNITE_ERR_COMPUTE_USER_UNDECLARED_EXCEPTION = 2011;
+
+        /** Generic cache error. */
+        static const int IGNITE_ERR_CACHE = 2012;
+
+        /** Generic cache loader error. */
+        static const int IGNITE_ERR_CACHE_LOADER = 2013;
+
+        /** Generic cache writer error. */
+        static const int IGNITE_ERR_CACHE_WRITER = 2014;
+        
+        /** Generic cache entry processor error. */
+        static const int IGNITE_ERR_ENTRY_PROCESSOR = 2015;
+
+        /** Cache atomic update timeout. */
+        static const int IGNITE_ERR_CACHE_ATOMIC_UPDATE_TIMEOUT = 2016;
+
+        /** Cache partial update. */
+        static const int IGNITE_ERR_CACHE_PARTIAL_UPDATE = 2017;
+        
+        /** Transaction optimisitc exception. */
+        static const int IGNITE_ERR_TX_OPTIMISTIC = 2018;
+
+        /** Transaction timeout. */
+        static const int IGNITE_ERR_TX_TIMEOUT = 2019;
+
+        /** Transaction rollback. */
+        static const int IGNITE_ERR_TX_ROLLBACK = 2020;
+
+        /** Transaction heuristic exception. */
+        static const int IGNITE_ERR_TX_HEURISTIC = 2021;
+
+        /** Authentication error. */
+        static const int IGNITE_ERR_AUTHENTICATION = 2022;
+
+        /** Security error. */
+        static const int IGNITE_ERR_SECURITY = 2023;
+        
+        /** Unknown error. */
+        static const int IGNITE_ERR_UNKNOWN = -1;
+
+        /**
+         * Throw an error if code is not IGNITE_SUCCESS.
+         *
+         * @param err Error.
+         */
+        static void ThrowIfNeeded(GridError& err);
+
+        /**
+         * Create empty error.
+         */
+        GridError();
+
+        /**
+         * Create error with specific code.
+         *
+         * @param code Error code.
+         */
+        GridError(const int32_t code);
+
+        /**
+         * Create error with specific code and message.
+         *
+         * @param code Error code.
+         * @param msg Message.
+         */
+        GridError(const int32_t code, const char* msg);
+        
+        /**
+         * Copy constructor.
+         *
+         * @param other Other instance.
+         */
+        GridError(const GridError& other);
+
+        /**
+         * Assignment operator.
+         *
+         * @param other Other instance.
+         * @return Assignment result.
+         */
+        GridError& operator=(const GridError& other);
+
+        /**
+         * Destructor.
+         */
+        ~GridError();
+
+        /**
+         * Get error code.
+         *
+         * @return Error code.
+         */
+        int32_t GetCode();
+
+        /**
+         * Get error message.
+         *
+         * @return Error message.
+         */
+        const char* GetText();
+        
+        /**
+         * Set error.
+         *
+         * @param jniCode Error code.
+         * @param jniCls Error class.
+         * @param jniMsg Error message.
+         * @param err Error.
+         */
+        static void SetError(const int jniCode, const char* jniCls, const char* jniMsg, GridError* err);
+    private:
+        /** Error code. */
+        int32_t code;    
+        
+        /** Error message. */
+        char* msg;       
+    };    
+}
+
+#endif
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/0d70d547/modules/platform/src/main/cpp/core/include/ignite/grid_factory.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/grid_factory.h b/modules/platform/src/main/cpp/core/include/ignite/grid_factory.h
new file mode 100644
index 0000000..5ed9c16
--- /dev/null
+++ b/modules/platform/src/main/cpp/core/include/ignite/grid_factory.h
@@ -0,0 +1,195 @@
+/*
+ * 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.
+ */
+
+/**
+ * \mainpage Apache Ignite C++ Library
+ *
+ * The Apache Ignite is a proven software solution, which delivers unprecedented speed
+ * and unlimited scale to accelerate your business and time to insights. It enables high-performance transactions,
+ * real-time streaming and fast analytics in a single, comprehensive data access and processing layer. The In-Memory
+ * Data Fabric is designed to easily power both existing and new applications in a distributed, massively
+ * parallel architecture on affordable, industry-standard hardware.
+ * <p>
+ * The Apache Ignite provides a unified API that spans all key types of applications
+ * (Java, .NET, C++) and connects them with multiple data stores containing structured, semi-structured and
+ * unstructured data (SQL, NoSQL, Hadoop). It offers a secure, highly available and manageable data environment
+ * that allows companies to process full ACID transactions and generate valuable insights from real-time,
+ * interactive and batch queries.
+ * <p>
+ * The In-Memory Data Fabric offers a strategic approach to in-memory computing that delivers performance,
+ * scale and comprehensive capabilities far above and beyond what traditional in-memory databases,
+ * data grids or other in-memory-based point solutions can offer by themselves.
+ *
+ * \section ultimate_speed_and_scale Ultimate Speed and Scale
+ *
+ * The Apache Ignite accesses and processes data from distributed enterprise and
+ * cloud-based data stores orders of magnitudes faster, and shares them with today's most demanding transactional,
+ * analytical and hybrid applications. The In-Memory Data Fabric delivers unprecedented throughput
+ * and low latency performance in a virtually unlimited, global scale-out architecture for both new and
+ * existing applications.
+ *
+ * \section comprehensive_and_proven Comprehensive and Proven
+ *
+ * The Apache Ignite is the product of seven years of meticulous research and development,
+ * built from the ground up (i.e. no bolt-on's), and run successfully by hundreds of organizations worldwide.
+ * It is a comprehensive in-memory solution that includes a clustering and compute grid, a database-agnostic data grid,
+ * a real-time streaming engine as well as plug-and-play Hadoop acceleration. The In-Memory Data Fabric
+ * connects multiple data sources (relational, NoSQL, Hadoop) with Java, .NET and C++ applications, and offers
+ * a secure and highly available architecture; it also provides a fully-featured, graphical management interface.
+ * <p>
+ * The Apache Ignite is used today by Fortune 500 companies, top government agencies as well as
+ * innovative mobile and web companies in a broad range of business scenarios, such as automated trading systems,
+ * fraud detection, big data analytics, social networks, online gaming, and bioinformatics.
+ */
+
+#ifndef _IGNITE_GRID_FACTORY
+#define _IGNITE_GRID_FACTORY
+
+#include "ignite/grid.h"
+#include "ignite/grid_configuration.h"
+#include "ignite/grid_error.h"
+
+namespace ignite
+{
+    /**
+     * This class defines a factory for the main Ignite API.
+     */
+    class IGNITE_IMPORT_EXPORT GridFactory
+    {
+    public:
+        /**
+         * Start grid instance.
+         *
+         * @param cfg Configuration.
+         * @return Grid instance or null in case of error.
+         */
+        static Grid Start(const GridConfiguration& cfg);
+
+        /*
+         * Start grid instance.
+         *
+         * @param cfg Configuration.
+         * @param err Error.
+         * @return Grid instance or null in case of error.
+         */
+        static Grid Start(const GridConfiguration& cfg, GridError* err);
+
+        /**
+         * Start grid instance with specific name.
+         *
+         * @param cfg Configuration.
+         * @param name Grid name.
+         * @return Grid instance or null in case of error.
+         */
+        static Grid Start(const GridConfiguration& cfg, const char* name);
+
+        /**
+         * Start grid instance with specific name.
+         *
+         * @param cfg Configuration.
+         * @param name Grid name.
+         * @param err Error.
+         * @return Grid instance or null in case of error.
+         */
+        static Grid Start(const GridConfiguration& cfg, const char* name, GridError* err);
+
+        /**
+         * Get default grid instance.
+         *
+         * @return Grid instance.
+         */
+        static Grid Get();
+
+        /**
+         * Get default grid instance.
+         *
+         * @param err Error.
+         * @return Grid instance.
+         */
+        static Grid Get(GridError* err);
+
+        /**
+         * Get grid instance with the given name.
+         *
+         * @param name Grid name.
+         * @return Grid instance.
+         */
+        static Grid Get(const char* name);
+
+        /**
+         * Get grid instance with the given name.
+         *
+         * @param name Grid name.
+         * @param err Error.
+         * @return Grid instance.
+         */
+        static Grid Get(const char* name, GridError* err);
+
+        /**
+         * Stop default grid instance.
+         *
+         * @param cancel Cancel flag.
+         * @return True if grid instance was stopped by this call.
+         */
+        static bool Stop(const bool cancel);
+
+        /**
+         * Stop default grid instance.
+         *
+         * @param cancel Cancel flag.
+         * @param err Error.
+         * @return True if grid instance was stopped by this call.
+         */
+        static bool Stop(const bool cancel, GridError* err);
+
+        /**
+         * Stop grid instance with the given name.
+         *
+         * @param name Grid name.
+         * @param cancel Cancel flag.
+         * @return True if grid instance was stopped by this call.
+         */
+        static bool Stop(const char* name, const bool cancel);
+
+        /**
+         * Stop grid instance with the given name.
+         *
+         * @param name Grid name.
+         * @param cancel Cancel flag.
+         * @param err Error.
+         * @return True if grid instance was stopped by this call.
+         */
+        static bool Stop(const char* name, const bool cancel, GridError* err);
+
+        /**
+         * Stop all running grid instances.
+         *
+         * @param cancel Cancel flag.
+         */
+        static void StopAll(const bool cancel);
+
+        /**
+         * Stop all running grid instances.
+         *
+         * @param cancel Cancel flag.
+         * @param err Error.
+         */
+        static void StopAll(const bool cancel, GridError* err);
+    };    
+}
+
+#endif
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/0d70d547/modules/platform/src/main/cpp/core/include/ignite/guid.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/guid.h b/modules/platform/src/main/cpp/core/include/ignite/guid.h
new file mode 100644
index 0000000..9469769
--- /dev/null
+++ b/modules/platform/src/main/cpp/core/include/ignite/guid.h
@@ -0,0 +1,112 @@
+/*
+ * 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_GUID
+#define _IGNITE_GUID
+
+#include <stdint.h>
+
+#include <ignite/common/common.h>
+
+namespace ignite
+{
+    /**
+     * Global universally unique identifier (GUID).
+     */
+    class IGNITE_IMPORT_EXPORT Guid
+    {
+    public:
+        /**
+         * Default constructor.
+         */
+        Guid();
+
+        /**
+         * Constructor.
+         *
+         * @param most Most significant bits.
+         * @param least Least significant bits.
+         */
+        Guid(int64_t most, int64_t least);
+
+        /**
+         * Returns the most significant 64 bits of this instance.
+         *
+         * @return The most significant 64 bits of this instance.
+         */
+        int64_t GetMostSignificantBits() const;
+
+        /**
+         * Returns the least significant 64 bits of this instance.
+         *  
+         * @return The least significant 64 bits of this instance.
+         */
+        int64_t GetLeastSignificantBits() const;
+
+        /**
+         * The version number associated with this instance.  The version
+         * number describes how this Guid was generated.
+         *
+         * The version number has the following meaning:
+         * 1    Time-based UUID;
+         * 2    DCE security UUID;
+         * 3    Name-based UUID;
+         * 4    Randomly generated UUID.
+         *
+         * @return The version number of this instance.
+         */
+        int32_t GetVersion() const;
+
+        /**
+         * The variant number associated with this instance. The variant
+         * number describes the layout of the Guid.
+         *
+         * The variant number has the following meaning:
+         * 0    Reserved for NCS backward compatibility;
+         * 2    IETF RFC 4122 (Leach-Salz), used by this class;
+         * 6    Reserved, Microsoft Corporation backward compatibility;
+         * 7    Reserved for future definition.
+         *
+         * @return The variant number of this instance.
+         */
+        int32_t GetVariant() const;
+
+        /**
+         * Get hash code of this instance (used in serialization).
+         *
+         * @return Hash code.
+         */
+        int32_t GetHashCode() const;
+
+        /**
+         * Comparison operator override.
+         *
+         * @param val1 First value.
+         * @param val2 Second value.
+         * @return True if equal.
+         */
+        friend bool IGNITE_IMPORT_EXPORT operator== (Guid& val1, Guid& val2);
+    private:
+        /** Most significant bits. */
+        int64_t most;  
+
+        /** Least significant bits. */
+        int64_t least; 
+    };
+}
+
+#endif
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/0d70d547/modules/platform/src/main/cpp/core/include/ignite/impl/cache/cache_impl.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/impl/cache/cache_impl.h b/modules/platform/src/main/cpp/core/include/ignite/impl/cache/cache_impl.h
new file mode 100644
index 0000000..7862957
--- /dev/null
+++ b/modules/platform/src/main/cpp/core/include/ignite/impl/cache/cache_impl.h
@@ -0,0 +1,418 @@
+/*
+ * 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_CACHE_IMPL
+#define _IGNITE_CACHE_IMPL
+
+#include "ignite/cache/query/query_scan.h"
+#include "ignite/cache/query/query_sql.h"
+#include "ignite/cache/query/query_text.h"
+#include "ignite/impl/grid_environment.h"
+#include "ignite/impl/cache/query/query_impl.h"
+#include "ignite/impl/operations.h"
+
+namespace ignite
+{    
+    namespace impl 
+    {
+        namespace cache
+        {
+            /**
+             * Cache implementation.
+             */
+            class IGNITE_IMPORT_EXPORT CacheImpl
+            {
+            public:
+                /**
+                 * Constructor used to create new instance.
+                 *
+                 * @param name Name.
+                 * @param env Environment.
+                 * @param javaRef Reference to java object.
+                 */
+                CacheImpl(char* name, ignite::common::concurrent::SharedPointer<GridEnvironment> env, jobject javaRef);
+                
+                /**
+                 * Destructor.
+                 */
+                ~CacheImpl();
+                
+                /**
+                 * Get name.
+                 *
+                 * @return Cache name.
+                 */
+                char* GetName();
+
+                /**
+                 * Perform IsEmpty.
+                 *
+                 * @param err Error.
+                 * @return Result.
+                 */
+                bool IsEmpty(GridError* err);
+
+                /**
+                 * Perform ContainsKey.
+                 *
+                 * @param inOp Input.
+                 * @param err Error.
+                 * @return Result.
+                 */
+                bool ContainsKey(InputOperation& inOp, GridError* err);
+
+                /**
+                 * Perform ContainsKeys.
+                 *
+                 * @param inOp Input.
+                 * @param err Error.
+                 * @return Result.
+                 */
+                bool ContainsKeys(InputOperation& inOp, GridError* err);
+
+                /**
+                 * Perform LocalPeek.
+                 *
+                 * @param inOp Input.
+                 * @param outOp Output.
+                 * @param peekModes Peek modes.
+                 * @param err Error.
+                 */
+                void LocalPeek(InputOperation& inOp, OutputOperation& outOp, 
+                    int32_t peekModes, GridError* err);
+
+                /**
+                 * Perform Get.
+                 *
+                 * @param inOp Input.
+                 * @param outOp Output.
+                 * @param err Error.
+                 */
+                void Get(InputOperation& inOp, OutputOperation& outOp, GridError* err);
+                
+                /**
+                 * Perform GetAll.
+                 *
+                 * @param inOp Input.
+                 * @param outOp Output.
+                 * @param err Error.
+                 */
+                void GetAll(InputOperation& inOp, OutputOperation& outOp, GridError* err);
+
+                /**
+                 * Perform Put.
+                 *
+                 * @param inOp Input.
+                 * @param err Error.
+                 */
+                void Put(InputOperation& inOp, GridError* err);
+
+                /**
+                 * Perform PutAll.
+                 *
+                 * @param inOp Input.
+                 * @param err Error.
+                 */
+                void PutAll(InputOperation& inOp, GridError* err);
+
+                /**
+                 * Perform GetAndPut.
+                 *
+                 * @param inOp Input.
+                 * @param outOp Output.
+                 * @param err Error.
+                 */
+                void GetAndPut(InputOperation& inOp, OutputOperation& outOp, GridError* err);
+
+                /**
+                 * Perform GetAndReplace.
+                 *
+                 * @param inOp Input.
+                 * @param outOp Output.
+                 * @param err Error.
+                 */
+                void GetAndReplace(InputOperation& inOp, OutputOperation& outOp, GridError* err);
+
+                /**
+                 * Perform GetAndRemove.
+                 *
+                 * @param inOp Input.
+                 * @param outOp Output.
+                 * @param err Error.
+                 */
+                void GetAndRemove(InputOperation& inOp, OutputOperation& outOp, GridError* err);
+
+                /**
+                 * Perform PutIfAbsent.
+                 *
+                 * @param inOp Input.
+                 * @param err Error.
+                 * @return Result
+                 */
+                bool PutIfAbsent(InputOperation& inOp, GridError* err);
+
+                /**
+                 * Perform GetAndPutIfAbsent.
+                 *
+                 * @param inOp Input.
+                 * @param outOp Output.
+                 * @param err Error.
+                 */
+                void GetAndPutIfAbsent(InputOperation& inOp, OutputOperation& outOp, GridError* err);
+
+                /**
+                 * Perform Replace(K, V).
+                 *
+                 * @param inOp Input.
+                 * @param err Error.
+                 * @return Result
+                 */
+                bool Replace(InputOperation& inOp, GridError* err);
+
+                /**
+                 * Perform Replace(K, V, V).
+                 *
+                 * @param inOp Input.
+                 * @param err Error.
+                 * @return Result
+                 */
+                bool ReplaceIfEqual(InputOperation& inOp, GridError* err);
+
+                /**
+                 * Perform LocalEvict.
+                 *
+                 * @param inOp Input.
+                 * @param err Error.
+                 */
+                void LocalEvict(InputOperation& inOp, GridError* err);
+
+                /**
+                 * Perform Clear.
+                 *
+                 * @param err Error.
+                 */
+                void Clear(GridError* err);
+
+                /**
+                 * Perform Clear.
+                 *
+                 * @param inOp Input.
+                 * @param err Error.
+                 */
+                void Clear(InputOperation& inOp, GridError* err);
+
+                /**
+                 * Perform ClearAll.
+                 *
+                 * @param inOp Input.
+                 * @param err Error.
+                 */
+                void ClearAll(InputOperation& inOp, GridError* err);
+
+                /**
+                 * Perform LocalClear.
+                 *
+                 * @param inOp Input.
+                 * @param err Error.
+                 */
+                void LocalClear(InputOperation& inOp, GridError* err);
+
+                /**
+                 * Perform LocalClearAll.
+                 *
+                 * @param inOp Input.
+                 * @param err Error.
+                 */
+                void LocalClearAll(InputOperation& inOp, GridError* err);
+
+                /**
+                 * Perform Remove(K).
+                 *
+                 * @param inOp Input.
+                 * @param err Error.
+                 * @return Result
+                 */
+                bool Remove(InputOperation& inOp, GridError* err);
+
+                /**
+                 * Perform Remove(K, V).
+                 *
+                 * @param inOp Input.
+                 * @param err Error.
+                 * @return Result
+                 */
+                bool RemoveIfEqual(InputOperation& inOp, GridError* err);
+
+                /**
+                 * Perform RemoveAll.
+                 *
+                 * @param inOp Input.
+                 * @param err Error.
+                 */
+                void RemoveAll(InputOperation& inOp, GridError* err);
+
+                /**
+                 * Perform RemoveAll.
+                 *
+                 * @param err Error.
+                 */
+                void RemoveAll(GridError* err);
+
+                /**
+                 * Perform Size.
+                 *
+                 * @param peekModes Peek modes.
+                 * @param err Error.
+                 * @return Result.
+                 */
+                int32_t Size(const int32_t peekModes, GridError* err);
+
+                /**
+                 * Perform LocalSize.
+                 * 
+                 * @param peekModes Peek modes.
+                 * @param err Error.
+                 * @return Result.
+                 */
+                int32_t LocalSize(const int32_t peekModes, GridError* err);
+
+                /**
+                 * Invoke query.
+                 *
+                 * @param qry Query.
+                 * @param err Error.
+                 * @return Query cursor.
+                 */
+                query::QueryCursorImpl* QuerySql(const ignite::cache::query::SqlQuery& qry, GridError* err);
+
+                /*
+                 * Invoke text query.
+                 *
+                 * @param qry Query.
+                 * @param err Error.
+                 * @return Query cursor.
+                 */
+                query::QueryCursorImpl* QueryText(const ignite::cache::query::TextQuery& qry, GridError* err);
+
+                /*
+                 * Invoke scan query.
+                 *
+                 * @param qry Query.
+                 * @param err Error.
+                 * @return Query cursor.
+                 */
+                query::QueryCursorImpl* QueryScan(const ignite::cache::query::ScanQuery& qry, GridError* err);
+                
+            private:
+                /** Name. */
+                char* name; 
+                
+                /** Environment. */
+                ignite::common::concurrent::SharedPointer<GridEnvironment> env;
+                
+                /** Handle to Java object. */
+                jobject javaRef;                     
+
+                IGNITE_NO_COPY_ASSIGNMENT(CacheImpl)
+
+                /**
+                 * Write data to memory.
+                 *
+                 * @param mem Memory.
+                 * @param inOp Input opeartion.
+                 * @param err Error.
+                 * @return Memory pointer.
+                 */
+                int64_t WriteTo(interop::InteropMemory* mem, InputOperation& inOp, GridError* err);
+
+                /**
+                 * Read data from memory.
+                 *
+                 * @param mem Memory.
+                 * @param outOp Output operation.
+                 */
+                void ReadFrom(interop::InteropMemory* mem, OutputOperation& outOp);
+
+                /**
+                 * Internal cache size routine.
+                 *
+                 * @param peekModes Peek modes.
+                 * @param loc Local flag.
+                 * @param err Error.
+                 * @return Size.
+                 */
+                int SizeInternal(const int32_t peekModes, const bool loc, GridError* err);
+
+                /**
+                 * Internal out operation.
+                 *
+                 * @param opType Operation type.
+                 * @param inOp Input.
+                 * @param err Error.
+                 * @return Result.
+                 */
+                bool OutOpInternal(const int32_t opType, InputOperation& inOp, GridError* err);
+
+                /**
+                 * Internal out-in operation.
+                 *
+                 * @param opType Operation type.
+                 * @param inOp Input.
+                 * @param outOp Output.
+                 * @param err Error.
+                 */
+                void OutInOpInternal(const int32_t opType, InputOperation& inOp, OutputOperation& outOp, 
+                    GridError* err);
+
+                /**
+                 * Internal query execution routine.
+                 *
+                 * @param qry Query.
+                 * @param typ Query type.
+                 * @param err Error.
+                 */
+                template<typename T>
+                query::QueryCursorImpl* QueryInternal(const T& qry, int32_t typ, GridError* err)
+                {
+                    ignite::common::java::JniErrorInfo jniErr;
+
+                    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);
+
+                    qry.Write(rawWriter);
+
+                    out.Synchronize();
+
+                    jobject qryJavaRef = env.Get()->Context()->CacheOutOpQueryCursor(javaRef, typ, mem.Get()->PointerLong(), 
+                        &jniErr);
+
+                    GridError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
+
+                    if (jniErr.code == ignite::common::java::IGNITE_JNI_ERR_SUCCESS)
+                        return new query::QueryCursorImpl(env, qryJavaRef);
+                    else
+                        return NULL;
+                }
+            };
+        }
+    }    
+}
+
+#endif
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/0d70d547/modules/platform/src/main/cpp/core/include/ignite/impl/cache/query/query_impl.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/impl/cache/query/query_impl.h b/modules/platform/src/main/cpp/core/include/ignite/impl/cache/query/query_impl.h
new file mode 100644
index 0000000..a394383
--- /dev/null
+++ b/modules/platform/src/main/cpp/core/include/ignite/impl/cache/query/query_impl.h
@@ -0,0 +1,115 @@
+/*
+ * 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_CACHE_QUERY_IMPL
+#define _IGNITE_CACHE_QUERY_IMPL
+
+#include "ignite/grid_error.h"
+#include "ignite/impl/grid_environment.h"
+#include "ignite/impl/operations.h"
+
+namespace ignite
+{
+    namespace impl
+    {
+        namespace cache
+        {
+            namespace query
+            {
+                /**
+                 * Query cursor implementation.
+                 */
+                class IGNITE_IMPORT_EXPORT QueryCursorImpl
+                {
+                public:
+                    /**
+                     * Constructor.
+                     * 
+                     * @param env Environment.
+                     * @param javaRef Java reference.
+                     */
+                    QueryCursorImpl(ignite::common::concurrent::SharedPointer<GridEnvironment> env, jobject javaRef);
+
+                    /**
+                     * Destructor.
+                     */
+                    ~QueryCursorImpl();
+
+                    /**
+                     * Check whether next result exists.
+                     *
+                     * @param err Error.
+                     * @return True if exists.
+                     */
+                    bool HasNext(GridError* err);
+
+                    /**
+                     * Get next object.
+                     * 
+                     * @param op Operation.
+                     * @param err Error.
+                     */
+                    void GetNext(OutputOperation& op, GridError* err);
+
+                    /**
+                     * Get all cursor entries.
+                     *
+                     * @param op Operation.
+                     * @param err Error.
+                     */
+                    void GetAll(OutputOperation& op, GridError* err);
+
+                private:
+                    /** Environment. */
+                    ignite::common::concurrent::SharedPointer<impl::GridEnvironment> env;
+
+                    /** Handle to Java object. */
+                    jobject javaRef;
+
+                    /** Whether iteration methods were called. */
+                    bool iterCalled;
+
+                    /** Whether GetAll() method was called. */
+                    bool getAllCalled;
+
+                    /** Whether next entry is available. */
+                    bool hasNext;
+
+                    IGNITE_NO_COPY_ASSIGNMENT(QueryCursorImpl);
+
+                    /**
+                     * Create Java-side iterator if needed.
+                     *
+                     * @param err Error.
+                     * @return True in case of success, false if an error is thrown.
+                     */
+                    bool CreateIteratorIfNeeded(GridError* err);
+
+                    /**
+                     * Check whether Java-side iterator has next element.
+                     *
+                     * @param err Error.
+                     * @return True if the next element is available.
+                     */
+                    bool IteratorHasNext(GridError* err);
+                };
+            }
+        }
+    }
+}
+
+#endif
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/0d70d547/modules/platform/src/main/cpp/core/include/ignite/impl/grid_environment.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/impl/grid_environment.h b/modules/platform/src/main/cpp/core/include/ignite/impl/grid_environment.h
new file mode 100644
index 0000000..8731d29
--- /dev/null
+++ b/modules/platform/src/main/cpp/core/include/ignite/impl/grid_environment.h
@@ -0,0 +1,130 @@
+/*
+ * 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_GRID_ENVIRONMENT
+#define _IGNITE_GRID_ENVIRONMENT
+
+#include <ignite/common/concurrent.h>
+#include <ignite/common/java.h>
+
+#include "ignite/impl/interop/interop_memory.h"
+#include "portable/portable_metadata_manager.h"
+
+namespace ignite 
+{    
+    namespace impl 
+    {
+        /**
+         * Defines environment in which Ignite operates.
+         */
+        class IGNITE_IMPORT_EXPORT GridEnvironment
+        {                
+        public:
+            /**
+             * Default constructor.
+             */
+            GridEnvironment();
+
+            /**
+             * Destructor.
+             */
+            ~GridEnvironment();
+
+            /**
+             * Populate callback handlers.
+             *
+             * @param Target (current env wrapped into a shared pointer).
+             * @return JNI handlers.
+             */
+            ignite::common::java::JniHandlers GetJniHandlers(ignite::common::concurrent::SharedPointer<GridEnvironment>* target);
+                
+            /**
+             * Perform initialization on successful start.
+             *
+             * @param ctx Context.
+             */
+            void Initialize(ignite::common::concurrent::SharedPointer<ignite::common::java::JniContext> ctx);
+
+            /**
+             * Start callback.
+             *
+             * @param memPtr Memory pointer.
+             */
+            void OnStartCallback(long long memPtr);        
+            
+            /**
+             * Get name of the grid.
+             *
+             * @return Name.
+             */
+            char* GridName();
+
+            /**
+             * Get JNI context.
+             *
+             * @return Context.
+             */
+            ignite::common::java::JniContext* Context();
+
+            /**
+             * Get memory for interop operations.
+             *
+             * @return Memory.
+             */
+            ignite::common::concurrent::SharedPointer<interop::InteropMemory> AllocateMemory();
+
+            /**
+             * Get memory chunk for interop operations with desired capacity.
+             *
+             * @param cap Capacity.
+             * @return Memory.
+             */
+            ignite::common::concurrent::SharedPointer<interop::InteropMemory> AllocateMemory(int32_t cap);
+
+            /**
+             * Get memory chunk located at the given pointer.
+             *
+             * @param memPtr Memory pointer.
+             * @retrun Memory.
+             */
+            ignite::common::concurrent::SharedPointer<interop::InteropMemory> GetMemory(int64_t memPtr);
+
+            /**
+             * Get metadata manager.
+             *
+             * @param Metadata manager.
+             */
+            portable::PortableMetadataManager* GetMetadataManager();
+        private:
+            /** Context to access Java. */
+            ignite::common::concurrent::SharedPointer<ignite::common::java::JniContext> ctx;
+
+            /** Startup latch. */
+            ignite::common::concurrent::SingleLatch* latch;
+
+            /** Grid name. */
+            char* gridName;                                   
+
+            /** Metadata manager. */
+            portable::PortableMetadataManager* metaMgr;       
+
+            IGNITE_NO_COPY_ASSIGNMENT(GridEnvironment);
+        };
+    }    
+}
+
+#endif
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/0d70d547/modules/platform/src/main/cpp/core/include/ignite/impl/grid_impl.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/impl/grid_impl.h b/modules/platform/src/main/cpp/core/include/ignite/impl/grid_impl.h
new file mode 100644
index 0000000..c0ad106
--- /dev/null
+++ b/modules/platform/src/main/cpp/core/include/ignite/impl/grid_impl.h
@@ -0,0 +1,146 @@
+/*
+ * 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_GRID_IMPL
+#define _IGNITE_GRID_IMPL
+
+#include <ignite/common/concurrent.h>
+#include <ignite/common/java.h>
+
+#include "ignite/impl/cache/cache_impl.h"
+#include "ignite/impl/grid_environment.h"
+#include "ignite/impl/utils.h"
+
+namespace ignite 
+{    
+    namespace impl 
+    {            
+        /**
+         * Grid implementation.
+         */
+        class GridImpl
+        {
+            friend class Grid;
+        public:
+            /**
+             * Constructor used to create new instance.
+             *
+             * @param env Environment.
+             * @param javaRef Reference to java object.
+             */
+            GridImpl(ignite::common::concurrent::SharedPointer<GridEnvironment> env, jobject javaRef);
+            
+            /**
+             * Destructor.
+             */
+            ~GridImpl();
+
+            /**
+             * Get name of the grid.
+             *
+             * @param Name.
+             */
+            char* GetName();
+
+            /**
+             * Get cache.
+             *
+             * @param name Cache name.
+             * @param err Error.
+             */
+            template<typename K, typename V> 
+            cache::CacheImpl* GetCache(const char* name, GridError* err)
+            {
+                ignite::common::java::JniErrorInfo jniErr;
+
+                jobject cacheJavaRef = env.Get()->Context()->ProcessorCache(javaRef, name, &jniErr);
+
+                if (!cacheJavaRef)
+                {
+                    GridError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
+
+                    return NULL;
+                }
+
+                char* name0 = utils::CopyChars(name);
+
+                return new cache::CacheImpl(name0, env, cacheJavaRef);
+            }
+
+            /**
+             * Get or create cache.
+             *
+             * @param name Cache name.
+             * @param err Error.
+             */
+            template<typename K, typename V>
+            cache::CacheImpl* GetOrCreateCache(const char* name, GridError* err)
+            {
+                ignite::common::java::JniErrorInfo jniErr;
+
+                jobject cacheJavaRef = env.Get()->Context()->ProcessorGetOrCreateCache(javaRef, name, &jniErr);
+
+                if (!cacheJavaRef)
+                {
+                    GridError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
+
+                    return NULL;
+                }
+
+                char* name0 = utils::CopyChars(name);
+
+                return new cache::CacheImpl(name0, env, cacheJavaRef);
+            }
+
+            /**
+             * Create cache.
+             *
+             * @param name Cache name.
+             * @param err Error.
+             */
+            template<typename K, typename V>
+            cache::CacheImpl* CreateCache(const char* name, GridError* err)
+            {
+                ignite::common::java::JniErrorInfo jniErr;
+
+                jobject cacheJavaRef = env.Get()->Context()->ProcessorCreateCache(javaRef, name, &jniErr);
+
+                if (!cacheJavaRef)
+                {
+                    GridError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
+
+                    return NULL;
+                }
+
+                char* name0 = utils::CopyChars(name);
+
+                return new cache::CacheImpl(name0, env, cacheJavaRef);
+            }
+        private:
+            /** Environment. */
+            ignite::common::concurrent::SharedPointer<GridEnvironment> env;
+            
+            /** Native Java counterpart. */
+            jobject javaRef;   
+            
+            IGNITE_NO_COPY_ASSIGNMENT(GridImpl)
+        };
+    }
+    
+}
+
+#endif
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/0d70d547/modules/platform/src/main/cpp/core/include/ignite/impl/handle_registry.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/impl/handle_registry.h b/modules/platform/src/main/cpp/core/include/ignite/impl/handle_registry.h
new file mode 100644
index 0000000..5e1b60a
--- /dev/null
+++ b/modules/platform/src/main/cpp/core/include/ignite/impl/handle_registry.h
@@ -0,0 +1,202 @@
+/*
+ * 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_HANDLE_REGISTRY
+#define _IGNITE_HANDLE_REGISTRY
+
+#include <map>
+#include <stdint.h>
+
+#include <ignite/common/concurrent.h>
+
+namespace ignite
+{
+    namespace impl
+    {
+        /**
+         * Something what can be registered inside handle registry.
+         */
+        class IGNITE_IMPORT_EXPORT HandleRegistryEntry
+        {
+        public:
+            /**
+             * Destructor.
+             */
+            virtual ~HandleRegistryEntry();
+        };
+
+        /**
+         * Handle registry segment containing thread-specific data for slow-path access.
+         */
+        class IGNITE_IMPORT_EXPORT HandleRegistrySegment
+        {
+        public:
+            /**
+             * Constructor.
+             */
+            HandleRegistrySegment();
+
+            /**
+             * Destructor.
+             */
+            ~HandleRegistrySegment();
+
+            /**
+             * Get entry from segment.
+             *
+             * @param hnd Handle.
+             * @return Associated entry or NULL if it doesn't exists.
+             */
+            ignite::common::concurrent::SharedPointer<HandleRegistryEntry> Get(int64_t hnd);
+
+            /**
+             * Put entry into segment.
+             *
+             * @param hnd Handle.
+             * @param entry Associated entry (cannot be NULL).
+             */
+            void Put(int64_t hnd, const ignite::common::concurrent::SharedPointer<HandleRegistryEntry>& entry);
+
+            /**
+             * Remove entry from the segment.
+             *
+             * @param hnd Handle.
+             */
+            void Remove(int64_t hnd);            
+
+            /**
+             * Clear all entries from the segment.
+             */
+            void Clear();
+        private:
+            /** Map with data. */
+            std::map<int64_t, ignite::common::concurrent::SharedPointer<HandleRegistryEntry>>* map;
+
+            /** Mutex. */
+            ignite::common::concurrent::CriticalSection* mux;
+
+            IGNITE_NO_COPY_ASSIGNMENT(HandleRegistrySegment);
+        };
+
+        /**
+         * Handle registry.
+         */
+        class IGNITE_IMPORT_EXPORT HandleRegistry
+        {
+        public:
+            /**
+             * Constructor.
+             *
+             * @param fastCap Fast-path capacity.
+             * @param segmentCnt Slow-path segments count.
+             */
+            HandleRegistry(int32_t fastCap, int32_t slowSegmentCnt);
+
+            /**
+             * Destructor.
+             */
+            ~HandleRegistry();
+
+            /**
+             * Allocate handle.
+             *
+             * @param target Target.
+             * @return Handle.
+             */
+            int64_t Allocate(const ignite::common::concurrent::SharedPointer<HandleRegistryEntry>& target);
+
+            /**
+             * Allocate handle in critical mode.
+             *
+             * @param target Target.
+             * @return Handle.
+             */
+            int64_t AllocateCritical(const ignite::common::concurrent::SharedPointer<HandleRegistryEntry>& target);
+
+            /**
+             * Allocate handle in safe mode.
+             *
+             * @param target Target.
+             * @return Handle.
+             */
+            int64_t AllocateSafe(const ignite::common::concurrent::SharedPointer<HandleRegistryEntry>& target);
+
+            /**
+             * Allocate handle in critical and safe modes.
+             *
+             * @param target Target.
+             * @return Handle.
+             */
+            int64_t AllocateCriticalSafe(const ignite::common::concurrent::SharedPointer<HandleRegistryEntry>& target);
+
+            /**
+             * Release handle.
+             *
+             * @param hnd Handle.
+             */
+            void Release(int64_t hnd);
+
+            /**
+             * Get target.
+             *
+             * @param hnd Handle.
+             * @param Target.
+             */
+            ignite::common::concurrent::SharedPointer<HandleRegistryEntry> Get(int64_t hnd);
+
+            /**
+             * Close the registry.
+             */
+            void Close();
+        private:
+            /** Fast-path container capacity. */
+            int32_t fastCap;                     
+
+            /** Fast-path counter. */
+            int32_t fastCtr;               
+
+            /** Fast-path container. */
+            ignite::common::concurrent::SharedPointer<HandleRegistryEntry>* fast;
+
+            /** Amount of slow-path segments. */
+            int32_t slowSegmentCnt;            
+
+            /** Slow-path counter. */
+            int64_t slowCtr;                                                         
+            
+            /** Slow-path segments. */
+            HandleRegistrySegment** slow;                                            
+
+            /** Close flag. */
+            int32_t closed;                                                           
+
+            IGNITE_NO_COPY_ASSIGNMENT(HandleRegistry);
+
+            /**
+             * Internal allocation routine.
+             *
+             * @param target Target.
+             * @param Critical mode flag.
+             * @param Safe mode flag.
+             */
+            int64_t Allocate0(const ignite::common::concurrent::SharedPointer<HandleRegistryEntry>& target,
+                bool critical, bool safe);
+        };
+    }
+}
+
+#endif
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/0d70d547/modules/platform/src/main/cpp/core/include/ignite/impl/interop/interop.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/impl/interop/interop.h b/modules/platform/src/main/cpp/core/include/ignite/impl/interop/interop.h
new file mode 100644
index 0000000..da4fdb9
--- /dev/null
+++ b/modules/platform/src/main/cpp/core/include/ignite/impl/interop/interop.h
@@ -0,0 +1,25 @@
+/*
+ * 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_INTEROP
+#define _IGNITE_IMPL_INTEROP
+
+#include "ignite/impl/interop/interop_memory.h"
+#include "ignite/impl/interop/interop_output_stream.h"
+#include "ignite/impl/interop/interop_input_stream.h"
+
+#endif
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/0d70d547/modules/platform/src/main/cpp/core/include/ignite/impl/interop/interop_input_stream.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/impl/interop/interop_input_stream.h b/modules/platform/src/main/cpp/core/include/ignite/impl/interop/interop_input_stream.h
new file mode 100644
index 0000000..d8fcfc3
--- /dev/null
+++ b/modules/platform/src/main/cpp/core/include/ignite/impl/interop/interop_input_stream.h
@@ -0,0 +1,234 @@
+/*
+ * 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_INTEROP_INPUT_STREAM
+#define _IGNITE_IMPL_INTEROP_INPUT_STREAM
+
+#include "ignite/impl/interop/interop_memory.h"
+
+namespace ignite
+{    
+    namespace impl
+    {
+        namespace interop
+        {
+            /**
+             * Interop input stream implementation.
+             */
+            class IGNITE_IMPORT_EXPORT InteropInputStream {
+            public:
+                /**
+                 * Constructor.
+                 *
+                 * @param mem Memory.
+                 */
+                InteropInputStream(InteropMemory* mem);
+
+                /**
+                 * Read signed 8-byte int.
+                 *
+                 * @return Value.
+                 */
+                int8_t ReadInt8();
+                    
+                /**
+                 * Read signed 8-byte int array.
+                 *
+                 * @param res Allocated array.
+                 * @param len Length.                 
+                 */
+                void ReadInt8Array(int8_t* const res, const int32_t len);
+
+                /**
+                 * Read bool.
+                 *
+                 * @return Value.
+                 */
+                bool ReadBool();
+
+                /**
+                 * Read bool array.
+                 *
+                 * @param res Allocated array.
+                 * @param len Length.
+                 */
+                void ReadBoolArray(bool* const res, const int32_t len);
+
+                /**
+                 * Read signed 16-byte int.
+                 *
+                 * @return Value.
+                 */
+                int16_t ReadInt16();
+
+                /**
+                 * Read signed 16-byte int array.
+                 *
+                 * @param res Allocated array.
+                 * @param len Length.
+                 */
+                void ReadInt16Array(int16_t* const res, const int32_t len);
+
+                /**
+                 * Read unsigned 16-byte int.
+                 *
+                 * @return Value.
+                 */
+                uint16_t ReadUInt16();
+
+                /**
+                 * Read unsigned 16-byte int array.
+                 *
+                 * @param res Allocated array.
+                 * @param len Length.
+                 */
+                void ReadUInt16Array(uint16_t* const res, const int32_t len);
+
+                /**
+                 * Read signed 32-byte int.
+                 *
+                 * @return Value.
+                 */
+                int32_t ReadInt32();
+
+                /**
+                 * Read signed 32-byte int at the given position.
+                 *
+                 * @param pos Position.
+                 * @return Value.
+                 */
+                int32_t ReadInt32(int32_t pos);
+                    
+                /**
+                 * Read signed 32-byte int array.
+                 *
+                 * @param res Allocated array.
+                 * @param len Length.
+                 */
+                void ReadInt32Array(int32_t* const res, const int32_t len);
+
+                /**
+                 * Read signed 64-byte int.
+                 *
+                 * @return Value.
+                 */
+                int64_t ReadInt64();
+
+                /**
+                 * Read signed 64-byte int array.
+                 *
+                 * @param res Allocated array.
+                 * @param len Length.
+                 */
+                void ReadInt64Array(int64_t* const res, const int32_t len);
+
+                /**
+                 * Read float.
+                 *
+                 * @return Value.
+                 */
+                float ReadFloat();
+
+                /**
+                 * Read float array.
+                 *
+                 * @param res Allocated array.
+                 * @param len Length.
+                 */
+                void ReadFloatArray(float* const res, const int32_t len);
+
+                /**
+                 * Read double.
+                 *
+                 * @return Value.
+                 */
+                double ReadDouble();
+
+                /**
+                 * Read double array.
+                 *
+                 * @param res Allocated array.
+                 * @param len Length.
+                 */
+                void ReadDoubleArray(double* const res, const int32_t len);
+
+                /**
+                 * Get remaining bytes.
+                 *
+                 * @return Remaining bytes.
+                 */
+                int32_t Remaining();
+
+                /**
+                 * Get position.
+                 *
+                 * @return Position.
+                 */
+                int32_t Position();
+
+                /**
+                 * Set position.
+                 *
+                 * @param Position.
+                 */
+                void Position(int32_t pos);
+
+                /**
+                 * Synchronize data from underlying memory.
+                 */
+                void Synchronize();
+            private:
+                /** Memory. */
+                InteropMemory* mem; 
+                
+                /** Pointer to data. */
+                int8_t* data;       
+                
+                /** Length. */
+                int len;            
+                
+                /** Current position. */
+                int pos;            
+                    
+                /**
+                 * Ensure there is enough data in the stream.
+                 *
+                 * @param cnt Amount of byte expected to be available.
+                 */
+                void EnsureEnoughData(int32_t cnt);
+
+                /**
+                 * Copy data from the stream shifting it along the way.
+                 *
+                 * @param ptr Pointer to data.
+                 * @param off Offset.
+                 * @param cnt Amount of data to copy.
+                 */
+                void CopyAndShift(int8_t* dest, int32_t off, int32_t cnt);
+
+                /**
+                 * Shift stream to the right.
+                 *
+                 * @param cnt Amount of bytes to shift the stream to.
+                 */
+                void Shift(int32_t cnt);
+            };
+        }
+    }    
+}
+
+#endif
\ No newline at end of file