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 2016/05/05 14:02:48 UTC
[15/34] ignite git commit: IGNITE-1786: Implemented ODBC driver.
http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/core/src/impl/binary/binary_writer_impl.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/src/impl/binary/binary_writer_impl.cpp b/modules/platforms/cpp/core/src/impl/binary/binary_writer_impl.cpp
deleted file mode 100644
index d03d6ba..0000000
--- a/modules/platforms/cpp/core/src/impl/binary/binary_writer_impl.cpp
+++ /dev/null
@@ -1,623 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "ignite/impl/binary/binary_writer_impl.h"
-#include "ignite/impl/interop/interop_stream_position_guard.h"
-#include "ignite/ignite_error.h"
-
-using namespace ignite::impl::interop;
-using namespace ignite::impl::binary;
-using namespace ignite::binary;
-
-namespace ignite
-{
- namespace impl
- {
- namespace binary
- {
- BinaryWriterImpl::BinaryWriterImpl(InteropOutputStream* stream, BinaryIdResolver* idRslvr,
- BinaryTypeManager* metaMgr, BinaryTypeHandler* metaHnd, int32_t start) :
- stream(stream), idRslvr(idRslvr), metaMgr(metaMgr), metaHnd(metaHnd), typeId(idRslvr->GetTypeId()),
- elemIdGen(0), elemId(0), elemCnt(0), elemPos(-1), rawPos(-1), start(start)
- {
- // No-op.
- }
-
- BinaryWriterImpl::BinaryWriterImpl(InteropOutputStream* stream, BinaryTypeManager* metaMgr) :
- stream(stream), idRslvr(NULL), metaMgr(metaMgr), metaHnd(NULL), typeId(0),
- elemIdGen(0), elemId(0), elemCnt(0), elemPos(-1), rawPos(0), start(stream->Position())
- {
- // No-op.
- }
-
- void BinaryWriterImpl::WriteInt8(const int8_t val)
- {
- WritePrimitiveRaw<int8_t>(val, BinaryUtils::WriteInt8);
- }
-
- void BinaryWriterImpl::WriteInt8Array(const int8_t* val, const int32_t len)
- {
- WritePrimitiveArrayRaw<int8_t>(val, len, BinaryUtils::WriteInt8Array, IGNITE_TYPE_ARRAY_BYTE);
- }
-
- void BinaryWriterImpl::WriteInt8(const char* fieldName, const int8_t val)
- {
- WritePrimitive<int8_t>(fieldName, val, BinaryUtils::WriteInt8, IGNITE_TYPE_BYTE, 1);
- }
-
- void BinaryWriterImpl::WriteInt8Array(const char* fieldName, const int8_t* val, const int32_t len)
- {
- WritePrimitiveArray<int8_t>(fieldName, val, len, BinaryUtils::WriteInt8Array, IGNITE_TYPE_ARRAY_BYTE, 0);
- }
-
- void BinaryWriterImpl::WriteBool(const bool val)
- {
- WritePrimitiveRaw<bool>(val, BinaryUtils::WriteBool);
- }
-
- void BinaryWriterImpl::WriteBoolArray(const bool* val, const int32_t len)
- {
- WritePrimitiveArrayRaw<bool>(val, len, BinaryUtils::WriteBoolArray, IGNITE_TYPE_ARRAY_BOOL);
- }
-
- void BinaryWriterImpl::WriteBool(const char* fieldName, const bool val)
- {
- WritePrimitive<bool>(fieldName, val, BinaryUtils::WriteBool, IGNITE_TYPE_BOOL, 1);
- }
-
- void BinaryWriterImpl::WriteBoolArray(const char* fieldName, const bool* val, const int32_t len)
- {
- WritePrimitiveArray<bool>(fieldName, val, len, BinaryUtils::WriteBoolArray, IGNITE_TYPE_ARRAY_BOOL, 0);
- }
-
- void BinaryWriterImpl::WriteInt16(const int16_t val)
- {
- WritePrimitiveRaw<int16_t>(val, BinaryUtils::WriteInt16);
- }
-
- void BinaryWriterImpl::WriteInt16Array(const int16_t* val, const int32_t len)
- {
- WritePrimitiveArrayRaw<int16_t>(val, len, BinaryUtils::WriteInt16Array, IGNITE_TYPE_ARRAY_SHORT);
- }
-
- void BinaryWriterImpl::WriteInt16(const char* fieldName, const int16_t val)
- {
- WritePrimitive<int16_t>(fieldName, val, BinaryUtils::WriteInt16, IGNITE_TYPE_SHORT, 2);
- }
-
- void BinaryWriterImpl::WriteInt16Array(const char* fieldName, const int16_t* val, const int32_t len)
- {
- WritePrimitiveArray<int16_t>(fieldName, val, len, BinaryUtils::WriteInt16Array, IGNITE_TYPE_ARRAY_SHORT, 1);
- }
-
- void BinaryWriterImpl::WriteUInt16(const uint16_t val)
- {
- WritePrimitiveRaw<uint16_t>(val, BinaryUtils::WriteUInt16);
- }
-
- void BinaryWriterImpl::WriteUInt16Array(const uint16_t* val, const int32_t len)
- {
- WritePrimitiveArrayRaw<uint16_t>(val, len, BinaryUtils::WriteUInt16Array, IGNITE_TYPE_ARRAY_CHAR);
- }
-
- void BinaryWriterImpl::WriteUInt16(const char* fieldName, const uint16_t val)
- {
- WritePrimitive<uint16_t>(fieldName, val, BinaryUtils::WriteUInt16, IGNITE_TYPE_CHAR, 2);
- }
-
- void BinaryWriterImpl::WriteUInt16Array(const char* fieldName, const uint16_t* val, const int32_t len)
- {
- WritePrimitiveArray<uint16_t>(fieldName, val, len, BinaryUtils::WriteUInt16Array, IGNITE_TYPE_ARRAY_CHAR, 1);
- }
-
- void BinaryWriterImpl::WriteInt32(const int32_t val)
- {
- WritePrimitiveRaw<int32_t>(val, BinaryUtils::WriteInt32);
- }
-
- void BinaryWriterImpl::WriteInt32Array(const int32_t* val, const int32_t len)
- {
- WritePrimitiveArrayRaw<int32_t>(val, len, BinaryUtils::WriteInt32Array, IGNITE_TYPE_ARRAY_INT);
- }
-
- void BinaryWriterImpl::WriteInt32(const char* fieldName, const int32_t val)
- {
- WritePrimitive<int32_t>(fieldName, val, BinaryUtils::WriteInt32, IGNITE_TYPE_INT, 4);
- }
-
- void BinaryWriterImpl::WriteInt32Array(const char* fieldName, const int32_t* val, const int32_t len)
- {
- WritePrimitiveArray<int32_t>(fieldName, val, len, BinaryUtils::WriteInt32Array, IGNITE_TYPE_ARRAY_INT, 2);
- }
-
- void BinaryWriterImpl::WriteInt64(const int64_t val)
- {
- WritePrimitiveRaw<int64_t>(val, BinaryUtils::WriteInt64);
- }
-
- void BinaryWriterImpl::WriteInt64Array(const int64_t* val, const int32_t len)
- {
- WritePrimitiveArrayRaw<int64_t>(val, len, BinaryUtils::WriteInt64Array, IGNITE_TYPE_ARRAY_LONG);
- }
-
- void BinaryWriterImpl::WriteInt64(const char* fieldName, const int64_t val)
- {
- WritePrimitive<int64_t>(fieldName, val, BinaryUtils::WriteInt64, IGNITE_TYPE_LONG, 8);
- }
-
- void BinaryWriterImpl::WriteInt64Array(const char* fieldName, const int64_t* val, const int32_t len)
- {
- WritePrimitiveArray<int64_t>(fieldName, val, len, BinaryUtils::WriteInt64Array, IGNITE_TYPE_ARRAY_LONG, 3);
- }
-
- void BinaryWriterImpl::WriteFloat(const float val)
- {
- WritePrimitiveRaw<float>(val, BinaryUtils::WriteFloat);
- }
-
- void BinaryWriterImpl::WriteFloatArray(const float* val, const int32_t len)
- {
- WritePrimitiveArrayRaw<float>(val, len, BinaryUtils::WriteFloatArray, IGNITE_TYPE_ARRAY_FLOAT);
- }
-
- void BinaryWriterImpl::WriteFloat(const char* fieldName, const float val)
- {
- WritePrimitive<float>(fieldName, val, BinaryUtils::WriteFloat, IGNITE_TYPE_FLOAT, 4);
- }
-
- void BinaryWriterImpl::WriteFloatArray(const char* fieldName, const float* val, const int32_t len)
- {
- WritePrimitiveArray<float>(fieldName, val, len, BinaryUtils::WriteFloatArray, IGNITE_TYPE_ARRAY_FLOAT, 2);
- }
-
- void BinaryWriterImpl::WriteDouble(const double val)
- {
- WritePrimitiveRaw<double>(val, BinaryUtils::WriteDouble);
- }
-
- void BinaryWriterImpl::WriteDoubleArray(const double* val, const int32_t len)
- {
- WritePrimitiveArrayRaw<double>(val, len, BinaryUtils::WriteDoubleArray, IGNITE_TYPE_ARRAY_DOUBLE);
- }
-
- void BinaryWriterImpl::WriteDouble(const char* fieldName, const double val)
- {
- WritePrimitive<double>(fieldName, val, BinaryUtils::WriteDouble, IGNITE_TYPE_DOUBLE, 8);
- }
-
- void BinaryWriterImpl::WriteDoubleArray(const char* fieldName, const double* val, const int32_t len)
- {
- WritePrimitiveArray<double>(fieldName, val, len, BinaryUtils::WriteDoubleArray, IGNITE_TYPE_ARRAY_DOUBLE, 3);
- }
-
- void BinaryWriterImpl::WriteGuid(const Guid val)
- {
- CheckRawMode(true);
- CheckSingleMode(true);
-
- stream->WriteInt8(IGNITE_TYPE_UUID);
-
- BinaryUtils::WriteGuid(stream, val);
- }
-
- void BinaryWriterImpl::WriteGuidArray(const Guid* val, const int32_t len)
- {
- CheckRawMode(true);
- CheckSingleMode(true);
-
- if (val)
- {
- stream->WriteInt8(IGNITE_TYPE_ARRAY_UUID);
- stream->WriteInt32(len);
-
- for (int i = 0; i < len; i++)
- {
- Guid elem = *(val + i);
-
- stream->WriteInt8(IGNITE_TYPE_UUID);
- BinaryUtils::WriteGuid(stream, elem);
- }
- }
- else
- stream->WriteInt8(IGNITE_HDR_NULL);
- }
-
- void BinaryWriterImpl::WriteGuid(const char* fieldName, const Guid val)
- {
- CheckRawMode(false);
- CheckSingleMode(true);
-
- WriteFieldId(fieldName, IGNITE_TYPE_UUID);
-
- stream->WriteInt8(IGNITE_TYPE_UUID);
-
- BinaryUtils::WriteGuid(stream, val);
- }
-
- void BinaryWriterImpl::WriteGuidArray(const char* fieldName, const Guid* val, const int32_t len)
- {
- CheckRawMode(false);
- CheckSingleMode(true);
-
- WriteFieldId(fieldName, IGNITE_TYPE_ARRAY_UUID);
-
- if (val)
- {
- stream->WriteInt8(IGNITE_TYPE_ARRAY_UUID);
- stream->WriteInt32(len);
-
- for (int i = 0; i < len; i++)
- {
- Guid elem = *(val + i);
-
- WriteTopObject(elem);
- }
- }
- else
- {
- stream->WriteInt8(IGNITE_HDR_NULL);
- }
- }
-
- void BinaryWriterImpl::WriteString(const char* val, const int32_t len)
- {
- CheckRawMode(true);
- CheckSingleMode(true);
-
- if (val)
- {
- stream->WriteInt8(IGNITE_TYPE_STRING);
-
- BinaryUtils::WriteString(stream, val, len);
- }
- else
- stream->WriteInt8(IGNITE_HDR_NULL);
- }
-
- void BinaryWriterImpl::WriteString(const char* fieldName, const char* val, const int32_t len)
- {
- CheckRawMode(false);
- CheckSingleMode(true);
-
- WriteFieldId(fieldName, IGNITE_TYPE_STRING);
-
- if (val)
- {
- stream->WriteInt8(IGNITE_TYPE_STRING);
-
- BinaryUtils::WriteString(stream, val, len);
- }
- else
- stream->WriteInt8(IGNITE_HDR_NULL);
- }
-
- int32_t BinaryWriterImpl::WriteStringArray()
- {
- StartContainerSession(true);
-
- stream->WriteInt8(IGNITE_TYPE_ARRAY_STRING);
- stream->Position(stream->Position() + 4);
-
- return elemId;
- }
-
- int32_t BinaryWriterImpl::WriteStringArray(const char* fieldName)
- {
- StartContainerSession(false);
-
- WriteFieldId(fieldName, IGNITE_TYPE_ARRAY_STRING);
-
- stream->WriteInt8(IGNITE_TYPE_ARRAY_STRING);
- stream->Position(stream->Position() + 4);
-
- return elemId;
- }
-
- void BinaryWriterImpl::WriteStringElement(int32_t id, const char* val, int32_t len)
- {
- CheckSession(id);
-
- if (val)
- {
- stream->WriteInt8(IGNITE_TYPE_STRING);
-
- BinaryUtils::WriteString(stream, val, len);
- }
- else
- stream->WriteInt8(IGNITE_HDR_NULL);
-
- elemCnt++;
- }
-
- void BinaryWriterImpl::WriteNull()
- {
- CheckRawMode(true);
- CheckSingleMode(true);
-
- stream->WriteInt8(IGNITE_HDR_NULL);
- }
-
- void BinaryWriterImpl::WriteNull(const char* fieldName)
- {
- CheckRawMode(false);
- CheckSingleMode(true);
-
- WriteFieldId(fieldName, IGNITE_TYPE_OBJECT);
- stream->WriteInt8(IGNITE_HDR_NULL);
- }
-
- int32_t BinaryWriterImpl::WriteArray()
- {
- StartContainerSession(true);
-
- stream->WriteInt8(IGNITE_TYPE_ARRAY);
- stream->Position(stream->Position() + 4);
-
- return elemId;
- }
-
- int32_t BinaryWriterImpl::WriteArray(const char* fieldName)
- {
- StartContainerSession(false);
-
- WriteFieldId(fieldName, IGNITE_TYPE_ARRAY);
-
- stream->WriteInt8(IGNITE_TYPE_ARRAY);
- stream->Position(stream->Position() + 4);
-
- return elemId;
- }
-
- int32_t BinaryWriterImpl::WriteCollection(CollectionType typ)
- {
- StartContainerSession(true);
-
- stream->WriteInt8(IGNITE_TYPE_COLLECTION);
- stream->Position(stream->Position() + 4);
- stream->WriteInt8(typ);
-
- return elemId;
- }
-
- int32_t BinaryWriterImpl::WriteCollection(const char* fieldName, CollectionType typ)
- {
- StartContainerSession(false);
-
- WriteFieldId(fieldName, IGNITE_TYPE_COLLECTION);
-
- stream->WriteInt8(IGNITE_TYPE_COLLECTION);
- stream->Position(stream->Position() + 4);
- stream->WriteInt8(typ);
-
- return elemId;
- }
-
- int32_t BinaryWriterImpl::WriteMap(ignite::binary::MapType typ)
- {
- StartContainerSession(true);
-
- stream->WriteInt8(IGNITE_TYPE_MAP);
- stream->Position(stream->Position() + 4);
- stream->WriteInt8(typ);
-
- return elemId;
- }
-
- int32_t BinaryWriterImpl::WriteMap(const char* fieldName, ignite::binary::MapType typ)
- {
- StartContainerSession(false);
-
- WriteFieldId(fieldName, IGNITE_TYPE_MAP);
-
- stream->WriteInt8(IGNITE_TYPE_MAP);
- stream->Position(stream->Position() + 4);
- stream->WriteInt8(typ);
-
- return elemId;
- }
-
- void BinaryWriterImpl::CommitContainer(int32_t id)
- {
- CheckSession(id);
-
- stream->WriteInt32(elemPos + 1, elemCnt);
-
- elemId = 0;
- elemCnt = 0;
- elemPos = -1;
- }
-
- void BinaryWriterImpl::SetRawMode()
- {
- CheckRawMode(false);
- CheckSingleMode(true);
-
- rawPos = stream->Position();
- }
-
- int32_t BinaryWriterImpl::GetRawPosition() const
- {
- return rawPos == -1 ? stream->Position() : rawPos;
- }
-
- void BinaryWriterImpl::CheckRawMode(bool expected) const
- {
- bool rawMode = rawPos != -1;
-
- if (expected && !rawMode) {
- IGNITE_ERROR_1(IgniteError::IGNITE_ERR_BINARY, "Operation can be performed only in raw mode.");
- }
- else if (!expected && rawMode) {
- IGNITE_ERROR_1(IgniteError::IGNITE_ERR_BINARY, "Operation cannot be performed in raw mode.");
- }
- }
-
- void BinaryWriterImpl::CheckSingleMode(bool expected) const
- {
- if (expected && elemId != 0) {
- IGNITE_ERROR_1(IgniteError::IGNITE_ERR_BINARY, "Operation cannot be performed when container is being written.");
- }
- else if (!expected && elemId == 0) {
- IGNITE_ERROR_1(IgniteError::IGNITE_ERR_BINARY, "Operation can be performed only when container is being written.");
- }
- }
-
- void BinaryWriterImpl::StartContainerSession(bool expRawMode)
- {
- CheckRawMode(expRawMode);
- CheckSingleMode(true);
-
- elemId = ++elemIdGen;
- elemPos = stream->Position();
- }
-
- void BinaryWriterImpl::CheckSession(int32_t expSes) const
- {
- if (elemId != expSes)
- {
- IGNITE_ERROR_1(IgniteError::IGNITE_ERR_BINARY, "Containter write session has been finished or is not started yet.");
- }
- }
-
- void BinaryWriterImpl::WriteFieldId(const char* fieldName, int32_t fieldTypeId)
- {
- int32_t fieldId = idRslvr->GetFieldId(typeId, fieldName);
- int32_t fieldOff = stream->Position() - start;
-
- schema.AddField(fieldId, fieldOff);
-
- if (metaHnd)
- metaHnd->OnFieldWritten(fieldId, fieldName, fieldTypeId);
- }
-
- template <>
- void BinaryWriterImpl::WriteTopObject<int8_t>(const int8_t& obj)
- {
- WriteTopObject0<int8_t>(obj, BinaryUtils::WriteInt8, IGNITE_TYPE_BYTE);
- }
-
- template <>
- void BinaryWriterImpl::WriteTopObject<bool>(const bool& obj)
- {
- WriteTopObject0<bool>(obj, BinaryUtils::WriteBool, IGNITE_TYPE_BOOL);
- }
-
- template <>
- void BinaryWriterImpl::WriteTopObject<int16_t>(const int16_t& obj)
- {
- WriteTopObject0<int16_t>(obj, BinaryUtils::WriteInt16, IGNITE_TYPE_SHORT);
- }
-
- template <>
- void BinaryWriterImpl::WriteTopObject<uint16_t>(const uint16_t& obj)
- {
- WriteTopObject0<uint16_t>(obj, BinaryUtils::WriteUInt16, IGNITE_TYPE_CHAR);
- }
-
- template <>
- void BinaryWriterImpl::WriteTopObject<int32_t>(const int32_t& obj)
- {
- WriteTopObject0<int32_t>(obj, BinaryUtils::WriteInt32, IGNITE_TYPE_INT);
- }
-
- template <>
- void BinaryWriterImpl::WriteTopObject<int64_t>(const int64_t& obj)
- {
- WriteTopObject0<int64_t>(obj, BinaryUtils::WriteInt64, IGNITE_TYPE_LONG);
- }
-
- template <>
- void BinaryWriterImpl::WriteTopObject<float>(const float& obj)
- {
- WriteTopObject0<float>(obj, BinaryUtils::WriteFloat, IGNITE_TYPE_FLOAT);
- }
-
- template <>
- void BinaryWriterImpl::WriteTopObject<double>(const double& obj)
- {
- WriteTopObject0<double>(obj, BinaryUtils::WriteDouble, IGNITE_TYPE_DOUBLE);
- }
-
- template <>
- void BinaryWriterImpl::WriteTopObject<Guid>(const Guid& obj)
- {
- WriteTopObject0<Guid>(obj, BinaryUtils::WriteGuid, IGNITE_TYPE_UUID);
- }
-
- void BinaryWriterImpl::PostWrite()
- {
- int32_t lenWithoutSchema = stream->Position() - start;
-
- int32_t nonRawLen = rawPos == -1 ? lenWithoutSchema : rawPos - start;
-
- uint16_t flags = IGNITE_BINARY_FLAG_USER_TYPE;
-
- if (rawPos > 0)
- flags |= IGNITE_BINARY_FLAG_HAS_RAW;
-
- if (!HasSchema())
- {
- stream->WriteInt16(start + IGNITE_OFFSET_FLAGS, flags);
- stream->WriteInt32(start + IGNITE_OFFSET_LEN, lenWithoutSchema);
- stream->WriteInt32(start + IGNITE_OFFSET_SCHEMA_ID, 0);
- stream->WriteInt32(start + IGNITE_OFFSET_SCHEMA_OR_RAW_OFF, GetRawPosition() - start);
- }
- else
- {
- int32_t schemaId = schema.GetId();
- BinaryOffsetType schemaType = schema.GetType();
-
- WriteAndClearSchema();
-
- if (rawPos > 0)
- stream->WriteInt32(rawPos - start);
-
- int32_t length = stream->Position() - start;
-
- flags |= IGNITE_BINARY_FLAG_HAS_SCHEMA;
-
- if (schemaType == OFFSET_TYPE_ONE_BYTE)
- flags |= IGNITE_BINARY_FLAG_OFFSET_ONE_BYTE;
- else if (schemaType == OFFSET_TYPE_TWO_BYTES)
- flags |= IGNITE_BINARY_FLAG_OFFSET_TWO_BYTES;
-
- stream->WriteInt16(start + IGNITE_OFFSET_FLAGS, flags);
- stream->WriteInt32(start + IGNITE_OFFSET_LEN, length);
- stream->WriteInt32(start + IGNITE_OFFSET_SCHEMA_ID, schemaId);
- stream->WriteInt32(start + IGNITE_OFFSET_SCHEMA_OR_RAW_OFF, lenWithoutSchema);
- }
- }
-
- bool BinaryWriterImpl::HasSchema() const
- {
- return !schema.Empty();
- }
-
- void BinaryWriterImpl::WriteAndClearSchema()
- {
- schema.Write(*stream);
-
- schema.Clear();
- }
-
- InteropOutputStream* BinaryWriterImpl::GetStream()
- {
- return stream;
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/core/src/impl/cache/cache_impl.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/src/impl/cache/cache_impl.cpp b/modules/platforms/cpp/core/src/impl/cache/cache_impl.cpp
index f66a228..fec41e7 100644
--- a/modules/platforms/cpp/core/src/impl/cache/cache_impl.cpp
+++ b/modules/platforms/cpp/core/src/impl/cache/cache_impl.cpp
@@ -15,23 +15,25 @@
* limitations under the License.
*/
+#include <ignite/common/utils.h>
+
#include "ignite/cache/cache_peek_mode.h"
#include "ignite/impl/cache/cache_impl.h"
#include "ignite/impl/interop/interop.h"
#include "ignite/impl/binary/binary_reader_impl.h"
-#include "ignite/impl/utils.h"
#include "ignite/impl/binary/binary_type_updater_impl.h"
#include "ignite/binary/binary.h"
using namespace ignite::common::concurrent;
-using namespace ignite::common::java;
+using namespace ignite::jni::java;
+using namespace ignite::java;
+using namespace ignite::common;
using namespace ignite::cache;
using namespace ignite::cache::query;
using namespace ignite::impl;
+using namespace ignite::impl::binary;
using namespace ignite::impl::cache::query;
using namespace ignite::impl::interop;
-using namespace ignite::impl::binary;
-using namespace ignite::impl::utils;
using namespace ignite::binary;
namespace ignite
http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/core/src/impl/cache/query/query_impl.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/src/impl/cache/query/query_impl.cpp b/modules/platforms/cpp/core/src/impl/cache/query/query_impl.cpp
index a5fc494..880e8b1 100644
--- a/modules/platforms/cpp/core/src/impl/cache/query/query_impl.cpp
+++ b/modules/platforms/cpp/core/src/impl/cache/query/query_impl.cpp
@@ -19,7 +19,8 @@
#include "ignite/impl/cache/query/query_fields_row_impl.h"
using namespace ignite::common::concurrent;
-using namespace ignite::common::java;
+using namespace ignite::jni::java;
+using namespace ignite::java;
using namespace ignite::impl::interop;
using namespace ignite::impl::binary;
http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/core/src/impl/ignite_environment.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/src/impl/ignite_environment.cpp b/modules/platforms/cpp/core/src/impl/ignite_environment.cpp
index c9c57a0..ab50866 100644
--- a/modules/platforms/cpp/core/src/impl/ignite_environment.cpp
+++ b/modules/platforms/cpp/core/src/impl/ignite_environment.cpp
@@ -15,12 +15,13 @@
* limitations under the License.
*/
+#include "ignite/impl/interop/interop_external_memory.h"
#include "ignite/impl/binary/binary_reader_impl.h"
#include "ignite/impl/ignite_environment.h"
#include "ignite/binary/binary.h"
using namespace ignite::common::concurrent;
-using namespace ignite::common::java;
+using namespace ignite::jni::java;
using namespace ignite::impl::interop;
using namespace ignite::impl::binary;
using namespace ignite::binary;
http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/core/src/impl/ignite_impl.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/src/impl/ignite_impl.cpp b/modules/platforms/cpp/core/src/impl/ignite_impl.cpp
index 28909eb..72e06cf 100644
--- a/modules/platforms/cpp/core/src/impl/ignite_impl.cpp
+++ b/modules/platforms/cpp/core/src/impl/ignite_impl.cpp
@@ -18,7 +18,7 @@
#include "ignite/impl/ignite_impl.h"
using namespace ignite::common::concurrent;
-using namespace ignite::common::java;
+using namespace ignite::jni::java;
namespace ignite
{
http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/core/src/impl/interop/interop_external_memory.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/src/impl/interop/interop_external_memory.cpp b/modules/platforms/cpp/core/src/impl/interop/interop_external_memory.cpp
new file mode 100644
index 0000000..f81cd5f
--- /dev/null
+++ b/modules/platforms/cpp/core/src/impl/interop/interop_external_memory.cpp
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <ignite/ignite_error.h>
+#include <ignite/jni/java.h>
+
+#include "ignite/impl/interop/interop_external_memory.h"
+
+using namespace ignite::jni::java;
+
+namespace ignite
+{
+ namespace impl
+ {
+ namespace interop
+ {
+ InteropExternalMemory::InteropExternalMemory(int8_t* memPtr)
+ {
+ this->memPtr = memPtr;
+ }
+
+ void InteropExternalMemory::Reallocate(int32_t cap)
+ {
+ if (JniContext::Reallocate(reinterpret_cast<int64_t>(memPtr), cap) == -1) {
+ IGNITE_ERROR_FORMATTED_2(IgniteError::IGNITE_ERR_MEMORY, "Failed to reallocate external memory",
+ "memPtr", PointerLong(), "requestedCapacity", cap)
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/core/src/impl/interop/interop_input_stream.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/src/impl/interop/interop_input_stream.cpp b/modules/platforms/cpp/core/src/impl/interop/interop_input_stream.cpp
deleted file mode 100644
index 7bdda0b..0000000
--- a/modules/platforms/cpp/core/src/impl/interop/interop_input_stream.cpp
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <cstring>
-
-#include "ignite/impl/interop/interop_input_stream.h"
-#include "ignite/ignite_error.h"
-
-/**
- * Common macro to read a single value.
- */
-#define IGNITE_INTEROP_IN_READ(type, len) { \
- EnsureEnoughData(len); \
- type res = *reinterpret_cast<type*>(data + pos); \
- Shift(len); \
- return res; \
-}
-
-/**
- * Common macro to read an array.
- */
-#define IGNITE_INTEROP_IN_READ_ARRAY(len, shift) { \
- CopyAndShift(reinterpret_cast<int8_t*>(res), 0, len << shift); \
-}
-
-namespace ignite
-{
- namespace impl
- {
- namespace interop
- {
- union BinaryInt32Float
- {
- int32_t i;
- float f;
- };
-
- union BinaryInt64Double
- {
- int64_t i;
- double d;
- };
-
- InteropInputStream::InteropInputStream(InteropMemory* mem)
- {
- this->mem = mem;
-
- data = mem->Data();
- len = mem->Length();
- pos = 0;
- }
-
- int8_t InteropInputStream::ReadInt8()
- {
- IGNITE_INTEROP_IN_READ(int8_t, 1);
- }
-
- int32_t InteropInputStream::ReadInt8(int32_t pos)
- {
- int delta = pos + 1 - this->pos;
-
- if (delta > 0)
- EnsureEnoughData(delta);
-
- return *reinterpret_cast<int8_t*>(data + pos);
- }
-
- void InteropInputStream::ReadInt8Array(int8_t* const res, const int32_t len)
- {
- IGNITE_INTEROP_IN_READ_ARRAY(len, 0);
- }
-
- bool InteropInputStream::ReadBool()
- {
- return ReadInt8() == 1;
- }
-
- void InteropInputStream::ReadBoolArray(bool* const res, const int32_t len)
- {
- for (int i = 0; i < len; i++)
- *(res + i) = ReadBool();
- }
-
- int16_t InteropInputStream::ReadInt16()
- {
- IGNITE_INTEROP_IN_READ(int16_t, 2);
- }
-
- int32_t InteropInputStream::ReadInt16(int32_t pos)
- {
- int delta = pos + 2 - this->pos;
-
- if (delta > 0)
- EnsureEnoughData(delta);
-
- return *reinterpret_cast<int16_t*>(data + pos);
- }
-
- void InteropInputStream::ReadInt16Array(int16_t* const res, const int32_t len)
- {
- IGNITE_INTEROP_IN_READ_ARRAY(len, 1);
- }
-
- uint16_t InteropInputStream::ReadUInt16()
- {
- IGNITE_INTEROP_IN_READ(uint16_t, 2);
- }
-
- void InteropInputStream::ReadUInt16Array(uint16_t* const res, const int32_t len)
- {
- IGNITE_INTEROP_IN_READ_ARRAY(len, 1);
- }
-
- int32_t InteropInputStream::ReadInt32()
- {
- IGNITE_INTEROP_IN_READ(int32_t, 4);
- }
-
- int32_t InteropInputStream::ReadInt32(int32_t pos)
- {
- int delta = pos + 4 - this->pos;
-
- if (delta > 0)
- EnsureEnoughData(delta);
-
- return *reinterpret_cast<int32_t*>(data + pos);
- }
-
- void InteropInputStream::ReadInt32Array(int32_t* const res, const int32_t len)
- {
- IGNITE_INTEROP_IN_READ_ARRAY(len, 2);
- }
-
- int64_t InteropInputStream::ReadInt64()
- {
- IGNITE_INTEROP_IN_READ(int64_t, 8);
- }
-
- void InteropInputStream::ReadInt64Array(int64_t* const res, const int32_t len)
- {
- IGNITE_INTEROP_IN_READ_ARRAY(len, 3);
- }
-
- float InteropInputStream::ReadFloat()
- {
- BinaryInt32Float u;
-
- u.i = ReadInt32();
-
- return u.f;
- }
-
- void InteropInputStream::ReadFloatArray(float* const res, const int32_t len)
- {
- IGNITE_INTEROP_IN_READ_ARRAY(len, 2);
- }
-
- double InteropInputStream::ReadDouble()
- {
- BinaryInt64Double u;
-
- u.i = ReadInt64();
-
- return u.d;
- }
-
- void InteropInputStream::ReadDoubleArray(double* const res, const int32_t len)
- {
- IGNITE_INTEROP_IN_READ_ARRAY(len, 3);
- }
-
- int32_t InteropInputStream::Remaining() const
- {
- return len - pos;
- }
-
- int32_t InteropInputStream::Position() const
- {
- return pos;
- }
-
- void InteropInputStream::Position(int32_t pos)
- {
- if (pos > len) {
- IGNITE_ERROR_FORMATTED_3(IgniteError::IGNITE_ERR_MEMORY, "Requested input stream position is out of bounds",
- "memPtr", mem->PointerLong(), "len", len, "pos", pos);
- }
-
- this->pos = pos;
- }
-
- void InteropInputStream::Synchronize()
- {
- data = mem->Data();
- len = mem->Length();
- }
-
- void InteropInputStream::EnsureEnoughData(int32_t cnt) const
- {
- if (len - pos < cnt) {
- IGNITE_ERROR_FORMATTED_4(IgniteError::IGNITE_ERR_MEMORY, "Not enough data in the stream",
- "memPtr", mem->PointerLong(), "len", len, "pos", pos, "requested", cnt);
- }
- }
-
- void InteropInputStream::CopyAndShift(int8_t* dest, int32_t off, int32_t cnt)
- {
- EnsureEnoughData(cnt);
-
- memcpy(dest + off, data + pos, cnt);
-
- Shift(cnt);
- }
-
- void InteropInputStream::Shift(int32_t cnt)
- {
- pos += cnt;
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/core/src/impl/interop/interop_memory.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/src/impl/interop/interop_memory.cpp b/modules/platforms/cpp/core/src/impl/interop/interop_memory.cpp
deleted file mode 100644
index 8ee49c5..0000000
--- a/modules/platforms/cpp/core/src/impl/interop/interop_memory.cpp
+++ /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.
- */
-
-#include <ignite/common/java.h>
-
-#include "ignite/impl/interop/interop_memory.h"
-#include "ignite/ignite_error.h"
-
-using namespace ignite::common::java;
-
-namespace ignite
-{
- namespace impl
- {
- namespace interop
- {
- int8_t* InteropMemory::Data(const int8_t* memPtr)
- {
- return reinterpret_cast<int8_t*>(*reinterpret_cast<const int64_t*>(memPtr));
- }
-
- void InteropMemory::Data(int8_t* memPtr, void* ptr)
- {
- *reinterpret_cast<int64_t*>(memPtr) = reinterpret_cast<int64_t>(ptr);
- }
-
- int32_t InteropMemory::Capacity(const int8_t* memPtr)
- {
- return *reinterpret_cast<const int32_t*>(memPtr + IGNITE_MEM_HDR_OFF_CAP);
- }
-
- void InteropMemory::Capacity(int8_t* memPtr, int32_t val)
- {
- *reinterpret_cast<int32_t*>(memPtr + IGNITE_MEM_HDR_OFF_CAP) = val;
- }
-
- int32_t InteropMemory::Length(const int8_t* memPtr)
- {
- return *reinterpret_cast<const int32_t*>(memPtr + IGNITE_MEM_HDR_OFF_LEN);
- }
-
- void InteropMemory::Length(int8_t* memPtr, int32_t val)
- {
- *reinterpret_cast<int32_t*>(memPtr + IGNITE_MEM_HDR_OFF_LEN) = val;
- }
-
- int32_t InteropMemory::Flags(const int8_t* memPtr)
- {
- return *reinterpret_cast<const int32_t*>(memPtr + IGNITE_MEM_HDR_OFF_FLAGS);
- }
-
- void InteropMemory::Flags(int8_t* memPtr, int32_t val)
- {
- *reinterpret_cast<int32_t*>(memPtr + IGNITE_MEM_HDR_OFF_FLAGS) = val;
- }
-
- bool InteropMemory::IsExternal(const int8_t* memPtr)
- {
- return IsExternal(Flags(memPtr));
- }
-
- bool InteropMemory::IsExternal(int32_t flags)
- {
- return (flags & IGNITE_MEM_FLAG_EXT) != IGNITE_MEM_FLAG_EXT;
- }
-
- bool InteropMemory::IsPooled(const int8_t* memPtr)
- {
- return IsPooled(Flags(memPtr));
- }
-
- bool InteropMemory::IsPooled(int32_t flags)
- {
- return (flags & IGNITE_MEM_FLAG_POOLED) != 0;
- }
-
- bool InteropMemory::IsAcquired(const int8_t* memPtr)
- {
- return IsAcquired(Flags(memPtr));
- }
-
- bool InteropMemory::IsAcquired(int32_t flags)
- {
- return (flags & IGNITE_MEM_FLAG_ACQUIRED) != 0;
- }
-
- int8_t* InteropMemory::Pointer()
- {
- return memPtr;
- }
-
- int64_t InteropMemory::PointerLong()
- {
- return reinterpret_cast<int64_t>(memPtr);
- }
-
- int8_t* InteropMemory::Data()
- {
- return Data(memPtr);
- }
-
- int32_t InteropMemory::Capacity() const
- {
- return Capacity(memPtr);
- }
-
- int32_t InteropMemory::Length() const
- {
- return Length(memPtr);
- }
-
- void InteropMemory::Length(int32_t val)
- {
- Length(memPtr, val);
- }
-
- InteropUnpooledMemory::InteropUnpooledMemory(int32_t cap)
- {
- memPtr = static_cast<int8_t*>(malloc(IGNITE_MEM_HDR_LEN));
-
- Data(memPtr, malloc(cap));
- Capacity(memPtr, cap);
- Length(memPtr, 0);
- Flags(memPtr, IGNITE_MEM_FLAG_EXT);
-
- owning = true;
- }
-
- InteropUnpooledMemory::InteropUnpooledMemory(int8_t* memPtr)
- {
- this->memPtr = memPtr;
- this->owning = false;
- }
-
- InteropUnpooledMemory::~InteropUnpooledMemory()
- {
- if (owning) {
- free(Data());
- free(memPtr);
- }
- }
-
- void InteropUnpooledMemory::Reallocate(int32_t cap)
- {
- int doubledCap = Capacity() << 1;
-
- if (doubledCap > cap)
- cap = doubledCap;
-
- Data(memPtr, realloc(Data(memPtr), cap));
- Capacity(memPtr, cap);
- }
-
- InteropExternalMemory::InteropExternalMemory(int8_t* memPtr)
- {
- this->memPtr = memPtr;
- }
-
- void InteropExternalMemory::Reallocate(int32_t cap)
- {
- if (JniContext::Reallocate(reinterpret_cast<int64_t>(memPtr), cap) == -1) {
- IGNITE_ERROR_FORMATTED_2(IgniteError::IGNITE_ERR_MEMORY, "Failed to reallocate external memory",
- "memPtr", PointerLong(), "requestedCapacity", cap)
- }
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/core/src/impl/interop/interop_output_stream.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/src/impl/interop/interop_output_stream.cpp b/modules/platforms/cpp/core/src/impl/interop/interop_output_stream.cpp
deleted file mode 100644
index a69a624..0000000
--- a/modules/platforms/cpp/core/src/impl/interop/interop_output_stream.cpp
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <cstring>
-
-#include "ignite/impl/interop/interop_output_stream.h"
-#include "ignite/ignite_error.h"
-
-/**
- * Common macro to write a single value.
- */
-#define IGNITE_INTEROP_OUT_WRITE(val, type, len) { \
- EnsureCapacity(pos + len); \
- *reinterpret_cast<type*>(data + pos) = val; \
- Shift(len); \
-}
-
-/**
- * Common macro to write an array.
- */
-#define IGNITE_INTEROP_OUT_WRITE_ARRAY(val, len) { \
- CopyAndShift(reinterpret_cast<const int8_t*>(val), 0, len); \
-}
-
-namespace ignite
-{
- namespace impl
- {
- namespace interop
- {
- union BinaryFloatInt32
- {
- float f;
- int32_t i;
- };
-
- union BinaryDoubleInt64
- {
- double d;
- int64_t i;
- };
-
- InteropOutputStream::InteropOutputStream(InteropMemory* mem)
- {
- this->mem = mem;
-
- data = mem->Data();
- cap = mem->Capacity();
- pos = 0;
- }
-
- void InteropOutputStream::WriteInt8(const int8_t val)
- {
- IGNITE_INTEROP_OUT_WRITE(val, int8_t, 1);
- }
-
- void InteropOutputStream::WriteInt8(const int8_t val, const int32_t pos)
- {
- EnsureCapacity(pos + 1);
-
- *(data + pos) = val;
- }
-
- void InteropOutputStream::WriteInt8Array(const int8_t* val, const int32_t len)
- {
- IGNITE_INTEROP_OUT_WRITE_ARRAY(val, len);
- }
-
- void InteropOutputStream::WriteBool(const bool val)
- {
- WriteInt8(val ? 1 : 0);
- }
-
- void InteropOutputStream::WriteBoolArray(const bool* val, const int32_t len)
- {
- for (int i = 0; i < len; i++)
- WriteBool(*(val + i));
- }
-
- void InteropOutputStream::WriteInt16(const int16_t val)
- {
- IGNITE_INTEROP_OUT_WRITE(val, int16_t, 2);
- }
-
- void InteropOutputStream::WriteInt16(const int32_t pos, const int16_t val)
- {
- EnsureCapacity(pos + 2);
-
- *reinterpret_cast<int16_t*>(data + pos) = val;
- }
-
- void InteropOutputStream::WriteInt16Array(const int16_t* val, const int32_t len)
- {
- IGNITE_INTEROP_OUT_WRITE_ARRAY(val, len << 1);
- }
-
- void InteropOutputStream::WriteUInt16(const uint16_t val)
- {
- IGNITE_INTEROP_OUT_WRITE(val, uint16_t, 2);
- }
-
- void InteropOutputStream::WriteUInt16Array(const uint16_t* val, const int32_t len)
- {
- IGNITE_INTEROP_OUT_WRITE_ARRAY(val, len << 1);
- }
-
- void InteropOutputStream::WriteInt32(const int32_t val)
- {
- IGNITE_INTEROP_OUT_WRITE(val, int32_t, 4);
- }
-
- void InteropOutputStream::WriteInt32(const int32_t pos, const int32_t val)
- {
- EnsureCapacity(pos + 4);
-
- *reinterpret_cast<int32_t*>(data + pos) = val;
- }
-
- void InteropOutputStream::WriteInt32Array(const int32_t* val, const int32_t len)
- {
- IGNITE_INTEROP_OUT_WRITE_ARRAY(val, len << 2);
- }
-
- void InteropOutputStream::WriteInt64(const int64_t val)
- {
- IGNITE_INTEROP_OUT_WRITE(val, int64_t, 8);
- }
-
- void InteropOutputStream::WriteInt64Array(const int64_t* val, const int32_t len)
- {
- IGNITE_INTEROP_OUT_WRITE_ARRAY(val, len << 3);
- }
-
- void InteropOutputStream::WriteFloat(const float val)
- {
- BinaryFloatInt32 u;
-
- u.f = val;
-
- WriteInt32(u.i);
- }
-
- void InteropOutputStream::WriteFloatArray(const float* val, const int32_t len)
- {
- for (int i = 0; i < len; i++)
- WriteFloat(*(val + i));
- }
-
- void InteropOutputStream::WriteDouble(const double val)
- {
- BinaryDoubleInt64 u;
-
- u.d = val;
-
- WriteInt64(u.i);
- }
-
- void InteropOutputStream::WriteDoubleArray(const double* val, const int32_t len)
- {
- for (int i = 0; i < len; i++)
- WriteDouble(*(val + i));
- }
-
- int32_t InteropOutputStream::Position() const
- {
- return pos;
- }
-
- void InteropOutputStream::Position(const int32_t val)
- {
- EnsureCapacity(val);
-
- pos = val;
- }
-
- int32_t InteropOutputStream::Reserve(int32_t num)
- {
- EnsureCapacity(pos + num);
-
- int32_t res = pos;
-
- Shift(num);
-
- return res;
- }
-
- void InteropOutputStream::Synchronize()
- {
- mem->Length(pos);
- }
-
- void InteropOutputStream::EnsureCapacity(int32_t reqCap) {
- if (reqCap > cap) {
- int newCap = cap << 1;
-
- if (newCap < reqCap)
- newCap = reqCap;
-
- mem->Reallocate(newCap);
- data = mem->Data();
- cap = newCap;
- }
- }
-
- void InteropOutputStream::Shift(int32_t cnt) {
- pos += cnt;
- }
-
- void InteropOutputStream::CopyAndShift(const int8_t* src, int32_t off, int32_t len) {
- EnsureCapacity(pos + len);
-
- memcpy(data + pos, src + off, len);
-
- Shift(len);
- }
- }
- }
-}
-
http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/cpp.dxg
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/cpp.dxg b/modules/platforms/cpp/cpp.dxg
index 42b0a36..605a613 100644
--- a/modules/platforms/cpp/cpp.dxg
+++ b/modules/platforms/cpp/cpp.dxg
@@ -1715,8 +1715,8 @@ GENERATE_LEGEND = YES
DOT_CLEANUP = YES
-;INPUT=core
-;EXCLUDE=core/include/ignite/impl core/os/linux/include/ignite/impl core/os/linux/src/impl core/os/win/include/ignite/impl core/os/win/src/impl core/src/impl
-;STRIP_FROM_PATH=core/include/ignite core/src
+;INPUT=core binary
+;EXCLUDE=core/include/ignite/impl core/os/linux/include/ignite/impl core/os/linux/src/impl core/os/win/include/ignite/impl core/os/win/src/impl core/src/impl binary/include/ignite/impl binary/src/impl
+;STRIP_FROM_PATH=core/include/ignite core/src binary/include/ignite binary/src
;OUTPUT_DIRECTORY=../../clients/target/cppdoc
;PROJECT_LOGO=../../../assembly/docfiles/ignite_logo.png
http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/examples/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/examples/Makefile.am b/modules/platforms/cpp/examples/Makefile.am
index d99cd82..4d49233 100644
--- a/modules/platforms/cpp/examples/Makefile.am
+++ b/modules/platforms/cpp/examples/Makefile.am
@@ -15,25 +15,10 @@
## limitations under the License.
##
-ACLOCAL_AMFLAGS = "-Im4"
+ACLOCAL_AMFLAGS =-I m4
-SUBDIRS = .
-DIST_SUBDIRS = . include
+SUBDIRS = \
+ putget-example \
+ odbc-example \
+ include
-AM_CPPFLAGS = -I$(srcdir)/include -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux -DIGNITE_IMPL
-AM_CXXFLAGS = -Wall -std=c++0x
-
-noinst_PROGRAMS = ignite-putgetexample
-
-ignite_putgetexample_SOURCES = src/putgetexample.cpp
-
-ignite_putgetexample_LDFLAGS = -static-libtool-libs -L/usr/local/lib -lignite
-
-run-check: check
- ./ignite-putgetexample -p
-
-clean-local: clean-check
- $(RM) *.gcno *.gcda
-
-clean-check:
- $(RM) $(ignite_putgetexample_OBJECTS)
http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/examples/README.txt
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/examples/README.txt b/modules/platforms/cpp/examples/README.txt
index dafe670..b985f07 100644
--- a/modules/platforms/cpp/examples/README.txt
+++ b/modules/platforms/cpp/examples/README.txt
@@ -15,21 +15,17 @@ Running examples on Linux
Prerequisites:
* GCC, g++, autotools, automake, and libtool must be installed.
-To build examples execute the following commands one by one from $IGNITE_HOME/platforms/cpp/examples directory:
- * libtoolize
- * aclocal
- * autoheader
- * automake --add-missing
- * autoreconf
+To build examples execute the following commands one by one from examples root directory:
* ./configure
* make
-As a result several executables will appear in example's directory.
+As a result executables will appear in every example's directory.
Before running examples ensure that:
* LD_LIBRARY_PATH environment variable is set and pointing to a directory with "libjvm.so" library. Typically this
library is located in $JAVA_HOME/jre/lib/amd64/server directory.
-
+ * For odbc-example additionaly ODBC Driver Manager must be present and installed on your platform and
+ Apache Ignite ODBC driver must be built and installed according to instructions for your platform.
Running examples on Windows
----------------------------------
@@ -39,4 +35,4 @@ Prerequisites:
* Windows SDK 7.1 must be installed.
Open Visual Studio solution %IGNITE_HOME%\platforms\cpp\examples\project\vs\ignite-examples.sln and select proper
-platform (x64 or x86). Run the solution.
\ No newline at end of file
+platform (x64 or x86). Run the solution.
http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/examples/config/example-cache.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/examples/config/example-cache.xml b/modules/platforms/cpp/examples/config/example-cache.xml
deleted file mode 100644
index a34f672..0000000
--- a/modules/platforms/cpp/examples/config/example-cache.xml
+++ /dev/null
@@ -1,77 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:util="http://www.springframework.org/schema/util"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/util
- http://www.springframework.org/schema/util/spring-util.xsd">
- <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
- <!-- Set to true to enable distributed class loading for examples, default is false. -->
- <property name="peerClassLoadingEnabled" value="true"/>
-
- <property name="cacheConfiguration">
- <list>
- <!--
- Partitioned cache example configuration with binary objects enabled.
- Used in .NET example that is available only in enterprise edition.
- -->
- <bean class="org.apache.ignite.configuration.CacheConfiguration">
- <property name="atomicityMode" value="ATOMIC"/>
- <property name="backups" value="1"/>
- </bean>
-
- <!--
- Partitioned cache example configuration.
- Used in .NET cache store example that is available only in enterprise edition.
- -->
- <bean class="org.apache.ignite.configuration.CacheConfiguration">
- <property name="name" value="tx"/>
- <property name="atomicityMode" value="TRANSACTIONAL"/>
- <property name="backups" value="1"/>
- </bean>
- </list>
- </property>
-
- <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
- <property name="discoverySpi">
- <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
- <property name="ipFinder">
- <!--
- Ignite provides several options for automatic discovery that can be used
- instead os static IP based discovery.
- -->
- <!-- Uncomment static IP finder to enable static-based discovery of initial nodes. -->
- <!--<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">-->
- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
- <property name="addresses">
- <list>
- <!-- In distributed environment, replace with actual host IP address. -->
- <value>127.0.0.1:47500..47501</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
- </property>
- </bean>
-</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/examples/configure.ac
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/examples/configure.ac b/modules/platforms/cpp/examples/configure.ac
index f5cf075..1143e6c 100644
--- a/modules/platforms/cpp/examples/configure.ac
+++ b/modules/platforms/cpp/examples/configure.ac
@@ -1,31 +1,48 @@
+#
+# 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.
+#
+
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
-AC_INIT([Ingnite C++ examples],[1.6.0.8653],[dec@ignite.apache.org],[ignite-examples],[ignite.apache.org])
-AC_CONFIG_SRCDIR(src)
+AC_INIT([Apache Ignite C++ Examples], [1.6.0.8653], [dev@ignite.apache.org], [ignite-examples], [ignite.apache.org])
-AC_CANONICAL_SYSTEM
+AC_CANONICAL_HOST
AC_CONFIG_MACRO_DIR([m4])
AC_LANG([C++])
-# Initialize automake
AM_INIT_AUTOMAKE([-Wall foreign subdir-objects])
-AC_CONFIG_HEADER(config.h)
+AC_CONFIG_HEADERS(config.h)
-AM_PROG_AR
+# Enable silent rules by default
+AM_SILENT_RULES([yes])
# Checks for programs.
-GXX="-g -O2"
-
AC_PROG_CXX
+AM_PROG_AR
# Initialize Libtool
LT_INIT
AC_ARG_ENABLE([debug],
- [AS_HELP_STRING([--enable-debug],[enable debug build [default=no]])],
- [],[enable_debug=no])
+ [AS_HELP_STRING([--enable-debug],[enable debug build [default=no]])],
+ [],
+ [enable_debug=no]
+)
if test "x$enable_debug" = xyes; then
CXXFLAGS="-g -O0"
@@ -33,6 +50,10 @@ else
CXXFLAGS="-g -O3"
fi
-AC_CONFIG_FILES(Makefile)
+AC_CONFIG_FILES([ \
+ Makefile \
+ putget-example/Makefile \
+ odbc-example/Makefile \
+])
AC_OUTPUT
http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/examples/include/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/examples/include/Makefile.am b/modules/platforms/cpp/examples/include/Makefile.am
index 13a8816..a54f87c 100644
--- a/modules/platforms/cpp/examples/include/Makefile.am
+++ b/modules/platforms/cpp/examples/include/Makefile.am
@@ -15,7 +15,10 @@
## limitations under the License.
##
-ACLOCAL_AMFLAGS = "-Im4"
+ACLOCAL_AMFLAGS =-I m4
+
+noinst_HEADERS = \
+ ignite/examples/address.h \
+ ignite/examples/organization.h \
+ ignite/examples/person.h
-nobase_include_HEADERS = ignite/examples/address.h \
- ignite/examples/organization.h
http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/examples/include/ignite/examples/address.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/examples/include/ignite/examples/address.h b/modules/platforms/cpp/examples/include/ignite/examples/address.h
index 4440037..149a98a 100644
--- a/modules/platforms/cpp/examples/include/ignite/examples/address.h
+++ b/modules/platforms/cpp/examples/include/ignite/examples/address.h
@@ -26,17 +26,16 @@ namespace ignite
{
struct Address
{
- Address()
+ Address() : street(), zip(0)
{
- street = "";
- zip = 0;
+ // No-op.
}
Address(std::string street, int zip) : street(street), zip(zip)
{
// No-op.
}
-
+
std::string ToString()
{
std::ostringstream oss;
@@ -45,10 +44,10 @@ namespace ignite
return oss.str();
}
-
+
std::string street;
int zip;
- };
+ };
}
}
@@ -99,11 +98,11 @@ namespace ignite
{
std::string street = reader.ReadString("street");
int zip = reader.ReadInt32("zip");
-
+
return ignite::examples::Address(street, zip);
}
- };
- }
+ };
+ }
}
#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/examples/include/ignite/examples/organization.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/examples/include/ignite/examples/organization.h b/modules/platforms/cpp/examples/include/ignite/examples/organization.h
index 8505214..736e600 100644
--- a/modules/platforms/cpp/examples/include/ignite/examples/organization.h
+++ b/modules/platforms/cpp/examples/include/ignite/examples/organization.h
@@ -28,10 +28,9 @@ namespace ignite
{
struct Organization
{
- Organization()
+ Organization() : name(), addr()
{
- name = "";
- addr = Address();
+ // No-op.
}
Organization(std::string name, Address addr) : name(name), addr(addr)
@@ -47,10 +46,10 @@ namespace ignite
return oss.str();
}
-
+
std::string name;
Address addr;
- };
+ };
}
}
@@ -101,11 +100,11 @@ namespace ignite
{
std::string name = reader.ReadString("name");
ignite::examples::Address addr = reader.ReadObject<ignite::examples::Address>("addr");
-
+
return ignite::examples::Organization(name, addr);
}
- };
- }
+ };
+ }
}
#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/examples/include/ignite/examples/person.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/examples/include/ignite/examples/person.h b/modules/platforms/cpp/examples/include/ignite/examples/person.h
new file mode 100644
index 0000000..2c92660
--- /dev/null
+++ b/modules/platforms/cpp/examples/include/ignite/examples/person.h
@@ -0,0 +1,110 @@
+/*
+ * 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_EXAMPLES_PERSON
+#define _IGNITE_EXAMPLES_PERSON
+
+#include <string>
+#include <sstream>
+
+#include "ignite/ignite.h"
+#include "ignite/ignition.h"
+
+namespace ignite
+{
+ namespace examples
+ {
+ struct Person
+ {
+ Person() : orgId(0), salary(.0)
+ {
+ // No-op.
+ }
+
+ Person(int64_t orgId, const std::string& firstName,
+ const std::string& lastName, const std::string& resume, double salary) :
+ orgId(orgId),
+ firstName(firstName),
+ lastName(lastName),
+ resume(resume),
+ salary(salary)
+ {
+ // No-op.
+ }
+
+ std::string ToString()
+ {
+ std::ostringstream oss;
+
+ oss << "Person [orgId=" << orgId
+ << ", lastName=" << lastName
+ << ", firstName=" << firstName
+ << ", salary=" << salary
+ << ", resume=" << resume << ']';
+
+ return oss.str();
+ }
+
+ int64_t orgId;
+ std::string firstName;
+ std::string lastName;
+ std::string resume;
+ double salary;
+ };
+ }
+}
+
+namespace ignite
+{
+ namespace binary
+ {
+ IGNITE_BINARY_TYPE_START(ignite::examples::Person)
+
+ typedef ignite::examples::Person Person;
+
+ IGNITE_BINARY_GET_TYPE_ID_AS_HASH(Person)
+ IGNITE_BINARY_GET_TYPE_NAME_AS_IS(Person)
+ IGNITE_BINARY_GET_FIELD_ID_AS_HASH
+ IGNITE_BINARY_GET_HASH_CODE_ZERO(Person)
+ IGNITE_BINARY_IS_NULL_FALSE(Person)
+ IGNITE_BINARY_GET_NULL_DEFAULT_CTOR(Person)
+
+ void Write(BinaryWriter& writer, ignite::examples::Person obj)
+ {
+ writer.WriteInt64("orgId", obj.orgId);
+ writer.WriteString("firstName", obj.firstName);
+ writer.WriteString("lastName", obj.lastName);
+ writer.WriteString("resume", obj.resume);
+ writer.WriteDouble("salary", obj.salary);
+ }
+
+ ignite::examples::Person Read(BinaryReader& reader)
+ {
+ int64_t orgId = reader.ReadInt64("orgId");
+ std::string firstName = reader.ReadString("firstName");
+ std::string lastName = reader.ReadString("lastName");
+ std::string resume = reader.ReadString("resume");
+ double salary = reader.ReadDouble("salary");
+
+ return ignite::examples::Person(orgId, firstName, lastName, resume, salary);
+ }
+
+ IGNITE_BINARY_TYPE_END
+ }
+};
+
+#endif // _IGNITE_EXAMPLES_PERSON
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/examples/odbc-example/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/examples/odbc-example/Makefile.am b/modules/platforms/cpp/examples/odbc-example/Makefile.am
new file mode 100644
index 0000000..e584105
--- /dev/null
+++ b/modules/platforms/cpp/examples/odbc-example/Makefile.am
@@ -0,0 +1,57 @@
+##
+## 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.
+##
+
+ACLOCAL_AMFLAGS =-I m4
+
+noinst_PROGRAMS = ignite-odbcexample
+
+AM_CPPFLAGS = \
+ -I@top_srcdir@/include \
+ -I@top_srcdir@/../core/include \
+ -I@top_srcdir@/../core/os/linux/include \
+ -I@top_srcdir@/../common/include \
+ -I@top_srcdir@/../common/os/linux/include \
+ -I@top_srcdir@/../binary/include \
+ -I@top_srcdir@/../jni/include \
+ -I@top_srcdir@/../jni/os/linux/include \
+ -I$(JAVA_HOME)/include \
+ -I$(JAVA_HOME)/include/linux \
+ -DIGNITE_IMPL
+
+AM_CXXFLAGS = \
+ -Wall \
+ -std=c++0x
+
+ignite_odbcexample_LDADD = \
+ @top_srcdir@/../core/libignite.la \
+ -lodbc \
+ -lpthread
+
+ignite_odbcexample_LDFLAGS = \
+ -static-libtool-libs
+
+ignite_odbcexample_SOURCES = \
+ src/odbc_example.cpp
+
+run-check: check
+ ./ignite-odbcexample -p
+
+clean-local: clean-check
+ $(RM) *.gcno *.gcda
+
+clean-check:
+ $(RM) $(ignite_odbcexample_OBJECTS)
http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/examples/odbc-example/config/example-odbc.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/examples/odbc-example/config/example-odbc.xml b/modules/platforms/cpp/examples/odbc-example/config/example-odbc.xml
new file mode 100644
index 0000000..db4c390
--- /dev/null
+++ b/modules/platforms/cpp/examples/odbc-example/config/example-odbc.xml
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:util="http://www.springframework.org/schema/util"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/util
+ http://www.springframework.org/schema/util/spring-util.xsd">
+ <bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
+
+ <!-- Enabling ODBC. -->
+ <property name="odbcConfiguration">
+ <bean class="org.apache.ignite.configuration.OdbcConfiguration"></bean>
+ </property>
+
+ <property name="cacheConfiguration">
+ <list>
+ <bean class="org.apache.ignite.configuration.CacheConfiguration">
+ <property name="name" value="Person"/>
+ <property name="cacheMode" value="PARTITIONED"/>
+ <property name="atomicityMode" value="TRANSACTIONAL"/>
+ <property name="writeSynchronizationMode" value="FULL_SYNC"/>
+
+ <!-- Configure type metadata to enable queries. -->
+ <property name="typeMetadata">
+ <list>
+ <bean class="org.apache.ignite.cache.CacheTypeMetadata">
+ <property name="keyType" value="java.lang.Long"/>
+ <property name="valueType" value="Person"/>
+ <property name="ascendingFields">
+ <map>
+ <entry key="orgId" value="java.lang.Long"/>
+ </map>
+ </property>
+ <property name="queryFields">
+ <map>
+ <entry key="firstName" value="java.lang.String"/>
+ <entry key="lastName" value="java.lang.String"/>
+ <entry key="resume" value="java.lang.String"/>
+ <entry key="salary" value="java.lang.Double"/>
+ </map>
+ </property>
+ </bean>
+ </list>
+ </property>
+ </bean>
+
+ <bean class="org.apache.ignite.configuration.CacheConfiguration">
+ <property name="name" value="Organization"/>
+ <property name="cacheMode" value="PARTITIONED"/>
+ <property name="atomicityMode" value="TRANSACTIONAL"/>
+ <property name="writeSynchronizationMode" value="FULL_SYNC"/>
+
+ <!-- Configure type metadata to enable queries. -->
+ <property name="typeMetadata">
+ <list>
+ <bean class="org.apache.ignite.cache.CacheTypeMetadata">
+ <property name="keyType" value="java.lang.Long"/>
+ <property name="valueType" value="Organization"/>
+ <property name="ascendingFields">
+ <map>
+ <entry key="name" value="java.lang.String"/>
+ </map>
+ </property>
+ </bean>
+ </list>
+ </property>
+ </bean>
+ </list>
+ </property>
+
+ <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
+ <property name="discoverySpi">
+ <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
+ <property name="ipFinder">
+ <!--
+ Ignite provides several options for automatic discovery that can be used
+ instead os static IP based discovery.
+ -->
+ <!-- Uncomment static IP finder to enable static-based discovery of initial nodes. -->
+ <!--<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">-->
+ <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
+ <property name="addresses">
+ <list>
+ <!-- In distributed environment, replace with actual host IP address. -->
+ <value>127.0.0.1:47500..47501</value>
+ </list>
+ </property>
+ </bean>
+ </property>
+ </bean>
+ </property>
+ </bean>
+</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/examples/odbc-example/project/vs/odbc-example.vcxproj
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/examples/odbc-example/project/vs/odbc-example.vcxproj b/modules/platforms/cpp/examples/odbc-example/project/vs/odbc-example.vcxproj
new file mode 100644
index 0000000..e7bdd08
--- /dev/null
+++ b/modules/platforms/cpp/examples/odbc-example/project/vs/odbc-example.vcxproj
@@ -0,0 +1,108 @@
+\ufeff<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{56839DFF-6C03-416B-BC5F-DDC6EBF8512D}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>igniteexamples</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v100</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v100</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;..\..\..\include;..\..\..\..\common\os\win\include;..\..\..\..\common\include;..\..\..\..\jni\os\win\include;..\..\..\..\jni\include;..\..\..\..\binary\include;..\..\..\..\core\os\win\include;..\..\..\..\core\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <AdditionalDependencies>jvm.lib;ignite.common.lib;ignite.jni.lib;ignite.binary.lib;ignite.core.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalLibraryDirectories>..\..\..\..\project\vs\$(Platform)\$(Configuration)\;$(JAVA_HOME)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Link>
+ <PostBuildEvent>
+ <Command>copy "$(ProjectDir)..\..\..\..\project\vs\$(Platform)\$(Configuration)\ignite.jni.dll" "$(OutDir)"
+copy "$(ProjectDir)..\..\..\..\project\vs\$(Platform)\$(Configuration)\ignite.core.dll" "$(OutDir)"</Command>
+ </PostBuildEvent>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;..\..\..\include;..\..\..\..\common\os\win\include;..\..\..\..\common\include;..\..\..\..\jni\os\win\include;..\..\..\..\jni\include;..\..\..\..\binary\include;..\..\..\..\core\os\win\include;..\..\..\..\core\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <AdditionalDependencies>jvm.lib;ignite.common.lib;ignite.jni.lib;ignite.binary.lib;ignite.core.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalLibraryDirectories>..\..\..\..\project\vs\$(Platform)\$(Configuration)\;$(JAVA_HOME)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Link>
+ <PostBuildEvent>
+ <Command>copy "$(ProjectDir)..\..\..\..\project\vs\$(Platform)\$(Configuration)\ignite.jni.dll" "$(OutDir)"
+copy "$(ProjectDir)..\..\..\..\project\vs\$(Platform)\$(Configuration)\ignite.core.dll" "$(OutDir)"</Command>
+ </PostBuildEvent>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\odbc_example.cpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\include\ignite\examples\address.h" />
+ <ClInclude Include="..\..\..\include\ignite\examples\organization.h" />
+ <ClInclude Include="..\..\..\include\ignite\examples\person.h" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/examples/odbc-example/project/vs/odbc-example.vcxproj.filters
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/examples/odbc-example/project/vs/odbc-example.vcxproj.filters b/modules/platforms/cpp/examples/odbc-example/project/vs/odbc-example.vcxproj.filters
new file mode 100644
index 0000000..44fff7c
--- /dev/null
+++ b/modules/platforms/cpp/examples/odbc-example/project/vs/odbc-example.vcxproj.filters
@@ -0,0 +1,28 @@
+\ufeff<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{6400d7ba-6390-4cdb-aa25-9525f8a71444}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\odbc_example.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\include\ignite\examples\address.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\include\ignite\examples\organization.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\include\ignite\examples\person.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+</Project>
\ No newline at end of file