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/22 08:40:01 UTC
[15/28] ignite git commit: IGNITE-1513: Moved CPP.
http://git-wip-us.apache.org/repos/asf/ignite/blob/524f5653/modules/platform/cpp/core/src/impl/portable/portable_writer_impl.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/cpp/core/src/impl/portable/portable_writer_impl.cpp b/modules/platform/cpp/core/src/impl/portable/portable_writer_impl.cpp
new file mode 100644
index 0000000..93aacd9
--- /dev/null
+++ b/modules/platform/cpp/core/src/impl/portable/portable_writer_impl.cpp
@@ -0,0 +1,600 @@
+/*
+ * 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/portable/portable_writer_impl.h"
+#include "ignite/ignite_error.h"
+
+using namespace ignite::impl::interop;
+using namespace ignite::impl::portable;
+using namespace ignite::portable;
+
+namespace ignite
+{
+ namespace impl
+ {
+ namespace portable
+ {
+ PortableWriterImpl::PortableWriterImpl(InteropOutputStream* stream, PortableIdResolver* idRslvr,
+ PortableMetadataManager* metaMgr, PortableMetadataHandler* metaHnd) :
+ stream(stream), idRslvr(idRslvr), metaMgr(metaMgr), metaHnd(metaHnd), typeId(idRslvr->GetTypeId()),
+ elemIdGen(0), elemId(0), elemCnt(0), elemPos(-1), rawPos(-1)
+ {
+ // No-op.
+ }
+
+ PortableWriterImpl::PortableWriterImpl(InteropOutputStream* stream, PortableMetadataManager* metaMgr) :
+ stream(stream), idRslvr(NULL), metaMgr(metaMgr), metaHnd(NULL), typeId(0),
+ elemIdGen(0), elemId(0), elemCnt(0), elemPos(-1), rawPos(0)
+ {
+ // No-op.
+ }
+
+ void PortableWriterImpl::WriteInt8(const int8_t val)
+ {
+ WritePrimitiveRaw<int8_t>(val, PortableUtils::WriteInt8);
+ }
+
+ void PortableWriterImpl::WriteInt8Array(const int8_t* val, const int32_t len)
+ {
+ WritePrimitiveArrayRaw<int8_t>(val, len, PortableUtils::WriteInt8Array, IGNITE_TYPE_ARRAY_BYTE);
+ }
+
+ void PortableWriterImpl::WriteInt8(const char* fieldName, const int8_t val)
+ {
+ WritePrimitive<int8_t>(fieldName, val, PortableUtils::WriteInt8, IGNITE_TYPE_BYTE, 1);
+ }
+
+ void PortableWriterImpl::WriteInt8Array(const char* fieldName, const int8_t* val, const int32_t len)
+ {
+ WritePrimitiveArray<int8_t>(fieldName, val, len, PortableUtils::WriteInt8Array, IGNITE_TYPE_ARRAY_BYTE, 0);
+ }
+
+ void PortableWriterImpl::WriteBool(const bool val)
+ {
+ WritePrimitiveRaw<bool>(val, PortableUtils::WriteBool);
+ }
+
+ void PortableWriterImpl::WriteBoolArray(const bool* val, const int32_t len)
+ {
+ WritePrimitiveArrayRaw<bool>(val, len, PortableUtils::WriteBoolArray, IGNITE_TYPE_ARRAY_BOOL);
+ }
+
+ void PortableWriterImpl::WriteBool(const char* fieldName, const bool val)
+ {
+ WritePrimitive<bool>(fieldName, val, PortableUtils::WriteBool, IGNITE_TYPE_BOOL, 1);
+ }
+
+ void PortableWriterImpl::WriteBoolArray(const char* fieldName, const bool* val, const int32_t len)
+ {
+ WritePrimitiveArray<bool>(fieldName, val, len, PortableUtils::WriteBoolArray, IGNITE_TYPE_ARRAY_BOOL, 0);
+ }
+
+ void PortableWriterImpl::WriteInt16(const int16_t val)
+ {
+ WritePrimitiveRaw<int16_t>(val, PortableUtils::WriteInt16);
+ }
+
+ void PortableWriterImpl::WriteInt16Array(const int16_t* val, const int32_t len)
+ {
+ WritePrimitiveArrayRaw<int16_t>(val, len, PortableUtils::WriteInt16Array, IGNITE_TYPE_ARRAY_SHORT);
+ }
+
+ void PortableWriterImpl::WriteInt16(const char* fieldName, const int16_t val)
+ {
+ WritePrimitive<int16_t>(fieldName, val, PortableUtils::WriteInt16, IGNITE_TYPE_SHORT, 2);
+ }
+
+ void PortableWriterImpl::WriteInt16Array(const char* fieldName, const int16_t* val, const int32_t len)
+ {
+ WritePrimitiveArray<int16_t>(fieldName, val, len, PortableUtils::WriteInt16Array, IGNITE_TYPE_ARRAY_SHORT, 1);
+ }
+
+ void PortableWriterImpl::WriteUInt16(const uint16_t val)
+ {
+ WritePrimitiveRaw<uint16_t>(val, PortableUtils::WriteUInt16);
+ }
+
+ void PortableWriterImpl::WriteUInt16Array(const uint16_t* val, const int32_t len)
+ {
+ WritePrimitiveArrayRaw<uint16_t>(val, len, PortableUtils::WriteUInt16Array, IGNITE_TYPE_ARRAY_CHAR);
+ }
+
+ void PortableWriterImpl::WriteUInt16(const char* fieldName, const uint16_t val)
+ {
+ WritePrimitive<uint16_t>(fieldName, val, PortableUtils::WriteUInt16, IGNITE_TYPE_CHAR, 2);
+ }
+
+ void PortableWriterImpl::WriteUInt16Array(const char* fieldName, const uint16_t* val, const int32_t len)
+ {
+ WritePrimitiveArray<uint16_t>(fieldName, val, len, PortableUtils::WriteUInt16Array, IGNITE_TYPE_ARRAY_CHAR, 1);
+ }
+
+ void PortableWriterImpl::WriteInt32(const int32_t val)
+ {
+ WritePrimitiveRaw<int32_t>(val, PortableUtils::WriteInt32);
+ }
+
+ void PortableWriterImpl::WriteInt32Array(const int32_t* val, const int32_t len)
+ {
+ WritePrimitiveArrayRaw<int32_t>(val, len, PortableUtils::WriteInt32Array, IGNITE_TYPE_ARRAY_INT);
+ }
+
+ void PortableWriterImpl::WriteInt32(const char* fieldName, const int32_t val)
+ {
+ WritePrimitive<int32_t>(fieldName, val, PortableUtils::WriteInt32, IGNITE_TYPE_INT, 4);
+ }
+
+ void PortableWriterImpl::WriteInt32Array(const char* fieldName, const int32_t* val, const int32_t len)
+ {
+ WritePrimitiveArray<int32_t>(fieldName, val, len, PortableUtils::WriteInt32Array, IGNITE_TYPE_ARRAY_INT, 2);
+ }
+
+ void PortableWriterImpl::WriteInt64(const int64_t val)
+ {
+ WritePrimitiveRaw<int64_t>(val, PortableUtils::WriteInt64);
+ }
+
+ void PortableWriterImpl::WriteInt64Array(const int64_t* val, const int32_t len)
+ {
+ WritePrimitiveArrayRaw<int64_t>(val, len, PortableUtils::WriteInt64Array, IGNITE_TYPE_ARRAY_LONG);
+ }
+
+ void PortableWriterImpl::WriteInt64(const char* fieldName, const int64_t val)
+ {
+ WritePrimitive<int64_t>(fieldName, val, PortableUtils::WriteInt64, IGNITE_TYPE_LONG, 8);
+ }
+
+ void PortableWriterImpl::WriteInt64Array(const char* fieldName, const int64_t* val, const int32_t len)
+ {
+ WritePrimitiveArray<int64_t>(fieldName, val, len, PortableUtils::WriteInt64Array, IGNITE_TYPE_ARRAY_LONG, 3);
+ }
+
+ void PortableWriterImpl::WriteFloat(const float val)
+ {
+ WritePrimitiveRaw<float>(val, PortableUtils::WriteFloat);
+ }
+
+ void PortableWriterImpl::WriteFloatArray(const float* val, const int32_t len)
+ {
+ WritePrimitiveArrayRaw<float>(val, len, PortableUtils::WriteFloatArray, IGNITE_TYPE_ARRAY_FLOAT);
+ }
+
+ void PortableWriterImpl::WriteFloat(const char* fieldName, const float val)
+ {
+ WritePrimitive<float>(fieldName, val, PortableUtils::WriteFloat, IGNITE_TYPE_FLOAT, 4);
+ }
+
+ void PortableWriterImpl::WriteFloatArray(const char* fieldName, const float* val, const int32_t len)
+ {
+ WritePrimitiveArray<float>(fieldName, val, len, PortableUtils::WriteFloatArray, IGNITE_TYPE_ARRAY_FLOAT, 2);
+ }
+
+ void PortableWriterImpl::WriteDouble(const double val)
+ {
+ WritePrimitiveRaw<double>(val, PortableUtils::WriteDouble);
+ }
+
+ void PortableWriterImpl::WriteDoubleArray(const double* val, const int32_t len)
+ {
+ WritePrimitiveArrayRaw<double>(val, len, PortableUtils::WriteDoubleArray, IGNITE_TYPE_ARRAY_DOUBLE);
+ }
+
+ void PortableWriterImpl::WriteDouble(const char* fieldName, const double val)
+ {
+ WritePrimitive<double>(fieldName, val, PortableUtils::WriteDouble, IGNITE_TYPE_DOUBLE, 8);
+ }
+
+ void PortableWriterImpl::WriteDoubleArray(const char* fieldName, const double* val, const int32_t len)
+ {
+ WritePrimitiveArray<double>(fieldName, val, len, PortableUtils::WriteDoubleArray, IGNITE_TYPE_ARRAY_DOUBLE, 3);
+ }
+
+ void PortableWriterImpl::WriteGuid(const Guid val)
+ {
+ CheckRawMode(true);
+ CheckSingleMode(true);
+
+ stream->WriteInt8(IGNITE_TYPE_UUID);
+
+ PortableUtils::WriteGuid(stream, val);
+ }
+
+ void PortableWriterImpl::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);
+ PortableUtils::WriteGuid(stream, elem);
+ }
+ }
+ else
+ stream->WriteInt8(IGNITE_HDR_NULL);
+ }
+
+ void PortableWriterImpl::WriteGuid(const char* fieldName, const Guid val)
+ {
+ CheckRawMode(false);
+ CheckSingleMode(true);
+
+ WriteFieldIdAndLength(fieldName, IGNITE_TYPE_UUID, 1 + 16);
+
+ stream->WriteInt8(IGNITE_TYPE_UUID);
+
+ PortableUtils::WriteGuid(stream, val);
+ }
+
+ void PortableWriterImpl::WriteGuidArray(const char* fieldName, const Guid* val, const int32_t len)
+ {
+ CheckRawMode(false);
+ CheckSingleMode(true);
+
+ WriteFieldId(fieldName, IGNITE_TYPE_ARRAY_UUID);
+
+ if (val)
+ {
+ stream->WriteInt32(5 + len * 17);
+ stream->WriteInt8(IGNITE_TYPE_ARRAY_UUID);
+ stream->WriteInt32(len);
+
+ for (int i = 0; i < len; i++)
+ {
+ Guid elem = *(val + i);
+
+ WriteTopObject(elem);
+ }
+ }
+ else
+ {
+ stream->WriteInt32(1);
+ stream->WriteInt8(IGNITE_HDR_NULL);
+ }
+ }
+
+ void PortableWriterImpl::WriteString(const char* val, const int32_t len)
+ {
+ CheckRawMode(true);
+ CheckSingleMode(true);
+
+ if (val)
+ {
+ stream->WriteInt8(IGNITE_TYPE_STRING);
+
+ PortableUtils::WriteString(stream, val, len);
+ }
+ else
+ stream->WriteInt8(IGNITE_HDR_NULL);
+ }
+
+ void PortableWriterImpl::WriteString(const char* fieldName, const char* val, const int32_t len)
+ {
+ CheckRawMode(false);
+ CheckSingleMode(true);
+
+ WriteFieldId(fieldName, IGNITE_TYPE_STRING);
+
+ if (val)
+ {
+ int32_t lenPos = stream->Position();
+ stream->Position(lenPos + 4);
+
+ stream->WriteInt8(IGNITE_TYPE_STRING);
+ stream->WriteBool(false);
+ stream->WriteInt32(len);
+
+ for (int i = 0; i < len; i++)
+ stream->WriteUInt16(*(val + i));
+
+ stream->WriteInt32(lenPos, stream->Position() - lenPos - 4);
+ }
+ else
+ {
+ stream->WriteInt32(1);
+ stream->WriteInt8(IGNITE_HDR_NULL);
+ }
+ }
+
+ int32_t PortableWriterImpl::WriteStringArray()
+ {
+ StartContainerSession(true);
+
+ stream->WriteInt8(IGNITE_TYPE_ARRAY_STRING);
+ stream->Position(stream->Position() + 4);
+
+ return elemId;
+ }
+
+ int32_t PortableWriterImpl::WriteStringArray(const char* fieldName)
+ {
+ StartContainerSession(false);
+
+ WriteFieldIdSkipLength(fieldName, IGNITE_TYPE_ARRAY_STRING);
+
+ stream->WriteInt8(IGNITE_TYPE_ARRAY_STRING);
+ stream->Position(stream->Position() + 4);
+
+ return elemId;
+ }
+
+ void PortableWriterImpl::WriteStringElement(int32_t id, const char* val, int32_t len)
+ {
+ CheckSession(id);
+
+ if (val)
+ {
+ stream->WriteInt8(IGNITE_TYPE_STRING);
+
+ PortableUtils::WriteString(stream, val, len);
+ }
+ else
+ stream->WriteInt8(IGNITE_HDR_NULL);
+
+ elemCnt++;
+ }
+
+ void PortableWriterImpl::WriteNull()
+ {
+ CheckRawMode(true);
+ CheckSingleMode(true);
+
+ stream->WriteInt8(IGNITE_HDR_NULL);
+ }
+
+ void PortableWriterImpl::WriteNull(const char* fieldName)
+ {
+ CheckRawMode(false);
+ CheckSingleMode(true);
+
+ WriteFieldIdAndLength(fieldName, IGNITE_TYPE_OBJECT, 1);
+ stream->WriteInt8(IGNITE_HDR_NULL);
+ }
+
+ int32_t PortableWriterImpl::WriteArray()
+ {
+ StartContainerSession(true);
+
+ stream->WriteInt8(IGNITE_TYPE_ARRAY);
+ stream->Position(stream->Position() + 4);
+
+ return elemId;
+ }
+
+ int32_t PortableWriterImpl::WriteArray(const char* fieldName)
+ {
+ StartContainerSession(false);
+
+ WriteFieldIdSkipLength(fieldName, IGNITE_TYPE_ARRAY);
+
+ stream->WriteInt8(IGNITE_TYPE_ARRAY);
+ stream->Position(stream->Position() + 4);
+
+ return elemId;
+ }
+
+ int32_t PortableWriterImpl::WriteCollection(CollectionType typ)
+ {
+ StartContainerSession(true);
+
+ stream->WriteInt8(IGNITE_TYPE_COLLECTION);
+ stream->Position(stream->Position() + 4);
+ stream->WriteInt8(typ);
+
+ return elemId;
+ }
+
+ int32_t PortableWriterImpl::WriteCollection(const char* fieldName, CollectionType typ)
+ {
+ StartContainerSession(false);
+
+ WriteFieldIdSkipLength(fieldName, IGNITE_TYPE_COLLECTION);
+
+ stream->WriteInt8(IGNITE_TYPE_COLLECTION);
+ stream->Position(stream->Position() + 4);
+ stream->WriteInt8(typ);
+
+ return elemId;
+ }
+
+ int32_t PortableWriterImpl::WriteMap(ignite::portable::MapType typ)
+ {
+ StartContainerSession(true);
+
+ stream->WriteInt8(IGNITE_TYPE_MAP);
+ stream->Position(stream->Position() + 4);
+ stream->WriteInt8(typ);
+
+ return elemId;
+ }
+
+ int32_t PortableWriterImpl::WriteMap(const char* fieldName, ignite::portable::MapType typ)
+ {
+ StartContainerSession(false);
+
+ WriteFieldIdSkipLength(fieldName, IGNITE_TYPE_MAP);
+
+ stream->WriteInt8(IGNITE_TYPE_MAP);
+ stream->Position(stream->Position() + 4);
+ stream->WriteInt8(typ);
+
+ return elemId;
+ }
+
+ void PortableWriterImpl::CommitContainer(int32_t id)
+ {
+ CheckSession(id);
+
+ if (rawPos == -1)
+ {
+ int32_t len = stream->Position() - elemPos - 4;
+
+ stream->WriteInt32(elemPos + 4, len);
+ stream->WriteInt32(elemPos + 9, elemCnt);
+ }
+ else
+ stream->WriteInt32(elemPos + 1, elemCnt);
+
+ elemId = 0;
+ elemCnt = 0;
+ elemPos = -1;
+ }
+
+ void PortableWriterImpl::SetRawMode()
+ {
+ CheckRawMode(false);
+ CheckSingleMode(true);
+
+ rawPos = stream->Position();
+ }
+
+ int32_t PortableWriterImpl::GetRawPosition()
+ {
+ return rawPos == -1 ? stream->Position() : rawPos;
+ }
+
+ void PortableWriterImpl::CheckRawMode(bool expected)
+ {
+ bool rawMode = rawPos != -1;
+
+ if (expected && !rawMode) {
+ IGNITE_ERROR_1(IgniteError::IGNITE_ERR_PORTABLE, "Operation can be performed only in raw mode.");
+ }
+ else if (!expected && rawMode) {
+ IGNITE_ERROR_1(IgniteError::IGNITE_ERR_PORTABLE, "Operation cannot be performed in raw mode.");
+ }
+ }
+
+ void PortableWriterImpl::CheckSingleMode(bool expected)
+ {
+ if (expected && elemId != 0) {
+ IGNITE_ERROR_1(IgniteError::IGNITE_ERR_PORTABLE, "Operation cannot be performed when container is being written.");
+ }
+ else if (!expected && elemId == 0) {
+ IGNITE_ERROR_1(IgniteError::IGNITE_ERR_PORTABLE, "Operation can be performed only when container is being written.");
+ }
+ }
+
+ void PortableWriterImpl::StartContainerSession(bool expRawMode)
+ {
+ CheckRawMode(expRawMode);
+ CheckSingleMode(true);
+
+ elemId = ++elemIdGen;
+ elemPos = stream->Position();
+ }
+
+ void PortableWriterImpl::CheckSession(int32_t expSes)
+ {
+ if (elemId != expSes)
+ {
+ IGNITE_ERROR_1(IgniteError::IGNITE_ERR_PORTABLE, "Containter write session has been finished or is not started yet.");
+ }
+ }
+
+ void PortableWriterImpl::WriteFieldId(const char* fieldName, int32_t fieldTypeId)
+ {
+ int32_t fieldId = idRslvr->GetFieldId(typeId, fieldName);
+
+ stream->WriteInt32(fieldId);
+
+ if (metaHnd)
+ metaHnd->OnFieldWritten(fieldId, fieldName, fieldTypeId);
+ }
+
+ void PortableWriterImpl::WriteFieldIdSkipLength(const char* fieldName, int32_t fieldTypeId)
+ {
+ WriteFieldId(fieldName, fieldTypeId);
+
+ stream->Position(stream->Position() + 4);
+ }
+
+ void PortableWriterImpl::WriteFieldIdAndLength(const char* fieldName, int32_t fieldTypeId, int32_t len)
+ {
+ WriteFieldId(fieldName, fieldTypeId);
+
+ stream->WriteInt32(len);
+ }
+
+ template <>
+ void PortableWriterImpl::WriteTopObject<int8_t>(const int8_t& obj)
+ {
+ WriteTopObject0<int8_t>(obj, PortableUtils::WriteInt8, IGNITE_TYPE_BYTE);
+ }
+
+ template <>
+ void PortableWriterImpl::WriteTopObject<bool>(const bool& obj)
+ {
+ WriteTopObject0<bool>(obj, PortableUtils::WriteBool, IGNITE_TYPE_BOOL);
+ }
+
+ template <>
+ void PortableWriterImpl::WriteTopObject<int16_t>(const int16_t& obj)
+ {
+ WriteTopObject0<int16_t>(obj, PortableUtils::WriteInt16, IGNITE_TYPE_SHORT);
+ }
+
+ template <>
+ void PortableWriterImpl::WriteTopObject<uint16_t>(const uint16_t& obj)
+ {
+ WriteTopObject0<uint16_t>(obj, PortableUtils::WriteUInt16, IGNITE_TYPE_CHAR);
+ }
+
+ template <>
+ void PortableWriterImpl::WriteTopObject<int32_t>(const int32_t& obj)
+ {
+ WriteTopObject0<int32_t>(obj, PortableUtils::WriteInt32, IGNITE_TYPE_INT);
+ }
+
+ template <>
+ void PortableWriterImpl::WriteTopObject<int64_t>(const int64_t& obj)
+ {
+ WriteTopObject0<int64_t>(obj, PortableUtils::WriteInt64, IGNITE_TYPE_LONG);
+ }
+
+ template <>
+ void PortableWriterImpl::WriteTopObject<float>(const float& obj)
+ {
+ WriteTopObject0<float>(obj, PortableUtils::WriteFloat, IGNITE_TYPE_FLOAT);
+ }
+
+ template <>
+ void PortableWriterImpl::WriteTopObject<double>(const double& obj)
+ {
+ WriteTopObject0<double>(obj, PortableUtils::WriteDouble, IGNITE_TYPE_DOUBLE);
+ }
+
+ template <>
+ void PortableWriterImpl::WriteTopObject<Guid>(const Guid& obj)
+ {
+ WriteTopObject0<Guid>(obj, PortableUtils::WriteGuid, IGNITE_TYPE_UUID);
+ }
+
+ InteropOutputStream* PortableWriterImpl::GetStream()
+ {
+ return stream;
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/524f5653/modules/platform/cpp/core/src/portable/portable_containers.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/cpp/core/src/portable/portable_containers.cpp b/modules/platform/cpp/core/src/portable/portable_containers.cpp
new file mode 100644
index 0000000..8270a13
--- /dev/null
+++ b/modules/platform/cpp/core/src/portable/portable_containers.cpp
@@ -0,0 +1,76 @@
+/*
+ * 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/portable/portable_containers.h"
+
+using namespace ignite::impl::portable;
+
+namespace ignite
+{
+ namespace portable
+ {
+ PortableStringArrayWriter::PortableStringArrayWriter(PortableWriterImpl* impl, const int32_t id) :
+ impl(impl), id(id)
+ {
+ // No-op.
+ }
+
+ void PortableStringArrayWriter::Write(const char* val)
+ {
+ if (val)
+ Write(val, static_cast<int32_t>(strlen(val)));
+ else
+ Write(NULL, -1);
+ }
+
+ void PortableStringArrayWriter::Write(const char* val, const int32_t len)
+ {
+ impl->WriteStringElement(id, val, len);
+ }
+
+ void PortableStringArrayWriter::Close()
+ {
+ impl->CommitContainer(id);
+ }
+
+ PortableStringArrayReader::PortableStringArrayReader(impl::portable::PortableReaderImpl* impl,
+ int32_t id, int32_t size) : impl(impl), id(id), size(size)
+ {
+ // No-op.
+ }
+
+ bool PortableStringArrayReader::HasNext()
+ {
+ return impl->HasNextElement(id);
+ }
+
+ int32_t PortableStringArrayReader::GetNext(char* res, const int32_t len)
+ {
+ return impl->ReadStringElement(id, res, len);
+ }
+
+ int32_t PortableStringArrayReader::GetSize()
+ {
+ return size;
+ }
+
+ bool PortableStringArrayReader::IsNull()
+ {
+ return size == -1;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/524f5653/modules/platform/cpp/core/src/portable/portable_raw_reader.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/cpp/core/src/portable/portable_raw_reader.cpp b/modules/platform/cpp/core/src/portable/portable_raw_reader.cpp
new file mode 100644
index 0000000..f659913
--- /dev/null
+++ b/modules/platform/cpp/core/src/portable/portable_raw_reader.cpp
@@ -0,0 +1,135 @@
+/*
+ * 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/portable/portable_reader_impl.h"
+#include "ignite/portable/portable_raw_reader.h"
+
+using namespace ignite::impl::portable;
+
+namespace ignite
+{
+ namespace portable
+ {
+ PortableRawReader::PortableRawReader(PortableReaderImpl* impl) : impl(impl)
+ {
+ // No-op.
+ }
+
+ int8_t PortableRawReader::ReadInt8()
+ {
+ return impl->ReadInt8();
+ }
+
+ int32_t PortableRawReader::ReadInt8Array(int8_t* res, const int32_t len)
+ {
+ return impl->ReadInt8Array(res, len);
+ }
+
+ bool PortableRawReader::ReadBool()
+ {
+ return impl->ReadBool();
+ }
+
+ int32_t PortableRawReader::ReadBoolArray(bool* res, const int32_t len)
+ {
+ return impl->ReadBoolArray(res, len);
+ }
+
+ int16_t PortableRawReader::ReadInt16()
+ {
+ return impl->ReadInt16();
+ }
+
+ int32_t PortableRawReader::ReadInt16Array(int16_t* res, const int32_t len)
+ {
+ return impl->ReadInt16Array(res, len);
+ }
+
+ uint16_t PortableRawReader::ReadUInt16()
+ {
+ return impl->ReadUInt16();
+ }
+
+ int32_t PortableRawReader::ReadUInt16Array(uint16_t* res, const int32_t len)
+ {
+ return impl->ReadUInt16Array(res, len);
+ }
+
+ int32_t PortableRawReader::ReadInt32()
+ {
+ return impl->ReadInt32();
+ }
+
+ int32_t PortableRawReader::ReadInt32Array(int32_t* res, const int32_t len)
+ {
+ return impl->ReadInt32Array(res, len);
+ }
+
+ int64_t PortableRawReader::ReadInt64()
+ {
+ return impl->ReadInt64();
+ }
+
+ int32_t PortableRawReader::ReadInt64Array(int64_t* res, const int32_t len)
+ {
+ return impl->ReadInt64Array(res, len);
+ }
+
+ float PortableRawReader::ReadFloat()
+ {
+ return impl->ReadFloat();
+ }
+
+ int32_t PortableRawReader::ReadFloatArray(float* res, const int32_t len)
+ {
+ return impl->ReadFloatArray(res, len);
+ }
+
+ double PortableRawReader::ReadDouble()
+ {
+ return impl->ReadDouble();
+ }
+
+ int32_t PortableRawReader::ReadDoubleArray(double* res, const int32_t len)
+ {
+ return impl->ReadDoubleArray(res, len);
+ }
+
+ Guid PortableRawReader::ReadGuid()
+ {
+ return impl->ReadGuid();
+ }
+
+ int32_t PortableRawReader::ReadGuidArray(Guid* res, const int32_t len)
+ {
+ return impl->ReadGuidArray(res, len);
+ }
+
+ int32_t PortableRawReader::ReadString(char* res, const int32_t len)
+ {
+ return impl->ReadString(res, len);
+ }
+
+ PortableStringArrayReader PortableRawReader::ReadStringArray()
+ {
+ int32_t size;
+
+ int32_t id = impl->ReadStringArray(&size);
+
+ return PortableStringArrayReader(impl, id, size);
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/524f5653/modules/platform/cpp/core/src/portable/portable_raw_writer.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/cpp/core/src/portable/portable_raw_writer.cpp b/modules/platform/cpp/core/src/portable/portable_raw_writer.cpp
new file mode 100644
index 0000000..c682abe
--- /dev/null
+++ b/modules/platform/cpp/core/src/portable/portable_raw_writer.cpp
@@ -0,0 +1,147 @@
+/*
+ * 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/portable/portable_writer_impl.h"
+#include "ignite/portable/portable_raw_writer.h"
+
+using namespace ignite::impl::portable;
+
+namespace ignite
+{
+ namespace portable
+ {
+ PortableRawWriter::PortableRawWriter(PortableWriterImpl* impl) : impl(impl)
+ {
+ // No-op.
+ }
+
+ void PortableRawWriter::WriteInt8(const int8_t val)
+ {
+ impl->WriteInt8(val);
+ }
+
+ void PortableRawWriter::WriteInt8Array(const int8_t* val, const int32_t len)
+ {
+ impl->WriteInt8Array(val, len);
+ }
+
+ void PortableRawWriter::WriteBool(const bool val)
+ {
+ impl->WriteBool(val);
+ }
+
+ void PortableRawWriter::WriteBoolArray(const bool* val, const int32_t len)
+ {
+ impl->WriteBoolArray(val, len);
+ }
+
+ void PortableRawWriter::WriteInt16(const int16_t val)
+ {
+ impl->WriteInt16(val);
+ }
+
+ void PortableRawWriter::WriteInt16Array(const int16_t* val, const int32_t len)
+ {
+ impl->WriteInt16Array(val, len);
+ }
+
+ void PortableRawWriter::WriteUInt16(const uint16_t val)
+ {
+ impl->WriteUInt16(val);
+ }
+
+ void PortableRawWriter::WriteUInt16Array(const uint16_t* val, const int32_t len)
+ {
+ impl->WriteUInt16Array(val, len);
+ }
+
+ void PortableRawWriter::WriteInt32(const int32_t val)
+ {
+ impl->WriteInt32(val);
+ }
+
+ void PortableRawWriter::WriteInt32Array(const int32_t* val, const int32_t len)
+ {
+ impl->WriteInt32Array(val, len);
+ }
+
+ void PortableRawWriter::WriteInt64(const int64_t val)
+ {
+ impl->WriteInt64(val);
+ }
+
+ void PortableRawWriter::WriteInt64Array(const int64_t* val, const int32_t len)
+ {
+ impl->WriteInt64Array(val, len);
+ }
+
+ void PortableRawWriter::WriteFloat(const float val)
+ {
+ impl->WriteFloat(val);
+ }
+
+ void PortableRawWriter::WriteFloatArray(const float* val, const int32_t len)
+ {
+ impl->WriteFloatArray(val, len);
+ }
+
+ void PortableRawWriter::WriteDouble(const double val)
+ {
+ impl->WriteDouble(val);
+ }
+
+ void PortableRawWriter::WriteDoubleArray(const double* val, const int32_t len)
+ {
+ impl->WriteDoubleArray(val, len);
+ }
+
+ void PortableRawWriter::WriteGuid(const Guid val)
+ {
+ impl->WriteGuid(val);
+ }
+
+ void PortableRawWriter::WriteGuidArray(const Guid* val, const int32_t len)
+ {
+ impl->WriteGuidArray(val, len);
+ }
+
+ void PortableRawWriter::WriteString(const char* val)
+ {
+ if (val)
+ WriteString(val, static_cast<int32_t>(strlen(val)));
+ else
+ WriteNull();
+ }
+
+ void PortableRawWriter::WriteString(const char* val, const int32_t len)
+ {
+ impl->WriteString(val, len);
+ }
+
+ PortableStringArrayWriter PortableRawWriter::WriteStringArray()
+ {
+ int32_t id = impl->WriteStringArray();
+
+ return PortableStringArrayWriter(impl, id);
+ }
+
+ void PortableRawWriter::WriteNull()
+ {
+ impl->WriteNull();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/524f5653/modules/platform/cpp/core/src/portable/portable_reader.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/cpp/core/src/portable/portable_reader.cpp b/modules/platform/cpp/core/src/portable/portable_reader.cpp
new file mode 100644
index 0000000..515216d
--- /dev/null
+++ b/modules/platform/cpp/core/src/portable/portable_reader.cpp
@@ -0,0 +1,142 @@
+/*
+ * 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/portable/portable_reader_impl.h"
+#include "ignite/portable/portable_reader.h"
+
+using namespace ignite::impl::portable;
+
+namespace ignite
+{
+ namespace portable
+ {
+ PortableReader::PortableReader(PortableReaderImpl* impl) : impl(impl)
+ {
+ // No-op.
+ }
+
+ int8_t PortableReader::ReadInt8(const char* fieldName)
+ {
+ return impl->ReadInt8(fieldName);
+ }
+
+ int32_t PortableReader::ReadInt8Array(const char* fieldName, int8_t* res, const int32_t len)
+ {
+ return impl->ReadInt8Array(fieldName, res, len);
+ }
+
+ bool PortableReader::ReadBool(const char* fieldName)
+ {
+ return impl->ReadBool(fieldName);
+ }
+
+ int32_t PortableReader::ReadBoolArray(const char* fieldName, bool* res, const int32_t len)
+ {
+ return impl->ReadBoolArray(fieldName, res, len);
+ }
+
+ int16_t PortableReader::ReadInt16(const char* fieldName)
+ {
+ return impl->ReadInt16(fieldName);
+ }
+
+ int32_t PortableReader::ReadInt16Array(const char* fieldName, int16_t* res, const int32_t len)
+ {
+ return impl->ReadInt16Array(fieldName, res, len);
+ }
+
+ uint16_t PortableReader::ReadUInt16(const char* fieldName)
+ {
+ return impl->ReadUInt16(fieldName);
+ }
+
+ int32_t PortableReader::ReadUInt16Array(const char* fieldName, uint16_t* res, const int32_t len)
+ {
+ return impl->ReadUInt16Array(fieldName, res, len);
+ }
+
+ int32_t PortableReader::ReadInt32(const char* fieldName)
+ {
+ return impl->ReadInt32(fieldName);
+ }
+
+ int32_t PortableReader::ReadInt32Array(const char* fieldName, int32_t* res, const int32_t len)
+ {
+ return impl->ReadInt32Array(fieldName, res, len);
+ }
+
+ int64_t PortableReader::ReadInt64(const char* fieldName)
+ {
+ return impl->ReadInt64(fieldName);
+ }
+
+ int32_t PortableReader::ReadInt64Array(const char* fieldName, int64_t* res, const int32_t len)
+ {
+ return impl->ReadInt64Array(fieldName, res, len);
+ }
+
+ float PortableReader::ReadFloat(const char* fieldName)
+ {
+ return impl->ReadFloat(fieldName);
+ }
+
+ int32_t PortableReader::ReadFloatArray(const char* fieldName, float* res, const int32_t len)
+ {
+ return impl->ReadFloatArray(fieldName, res, len);
+ }
+
+ double PortableReader::ReadDouble(const char* fieldName)
+ {
+ return impl->ReadDouble(fieldName);
+ }
+
+ int32_t PortableReader::ReadDoubleArray(const char* fieldName, double* res, const int32_t len)
+ {
+ return impl->ReadDoubleArray(fieldName, res, len);
+ }
+
+ Guid PortableReader::ReadGuid(const char* fieldName)
+ {
+ return impl->ReadGuid(fieldName);
+ }
+
+ int32_t PortableReader::ReadGuidArray(const char* fieldName, Guid* res, const int32_t len)
+ {
+ return impl->ReadGuidArray(fieldName, res, len);
+ }
+
+ int32_t PortableReader::ReadString(const char* fieldName, char* res, const int32_t len)
+ {
+ return impl->ReadString(fieldName, res, len);
+ }
+
+ PortableStringArrayReader PortableReader::ReadStringArray(const char* fieldName)
+ {
+ int32_t size;
+
+ int32_t id = impl->ReadStringArray(fieldName, &size);
+
+ return PortableStringArrayReader(impl, id, size);
+ }
+
+ PortableRawReader PortableReader::RawReader()
+ {
+ impl->SetRawMode();
+
+ return PortableRawReader(impl);
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/524f5653/modules/platform/cpp/core/src/portable/portable_type.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/cpp/core/src/portable/portable_type.cpp b/modules/platform/cpp/core/src/portable/portable_type.cpp
new file mode 100644
index 0000000..e22f869
--- /dev/null
+++ b/modules/platform/cpp/core/src/portable/portable_type.cpp
@@ -0,0 +1,51 @@
+/*
+ * 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/portable/portable_type.h"
+
+namespace ignite
+{
+ namespace portable
+ {
+ int32_t GetPortableStringHashCode(const char* val)
+ {
+ if (val)
+ {
+ int32_t hash = 0;
+
+ int i = 0;
+
+ while (true)
+ {
+ char c = *(val + i++);
+
+ if (c == '\0')
+ break;
+
+ if ('A' <= c && c <= 'Z')
+ c = c | 0x20;
+
+ hash = 31 * hash + c;
+ }
+
+ return hash;
+ }
+ else
+ return 0;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/524f5653/modules/platform/cpp/core/src/portable/portable_writer.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/cpp/core/src/portable/portable_writer.cpp b/modules/platform/cpp/core/src/portable/portable_writer.cpp
new file mode 100644
index 0000000..f31b9dd
--- /dev/null
+++ b/modules/platform/cpp/core/src/portable/portable_writer.cpp
@@ -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.
+ */
+
+#include "ignite/impl/portable/portable_writer_impl.h"
+#include "ignite/portable/portable_writer.h"
+
+using namespace ignite::impl::portable;
+
+namespace ignite
+{
+ namespace portable
+ {
+ PortableWriter::PortableWriter(PortableWriterImpl* impl) : impl(impl)
+ {
+ // No-op.
+ }
+
+ void PortableWriter::WriteInt8(const char* fieldName, const int8_t val)
+ {
+ impl->WriteInt8(fieldName, val);
+ }
+
+ void PortableWriter::WriteInt8Array(const char* fieldName, const int8_t* val, const int32_t len)
+ {
+ impl->WriteInt8Array(fieldName, val, len);
+ }
+
+ void PortableWriter::WriteBool(const char* fieldName, const bool val)
+ {
+ impl->WriteBool(fieldName, val);
+ }
+
+ void PortableWriter::WriteBoolArray(const char* fieldName, const bool* val, const int32_t len)
+ {
+ impl->WriteBoolArray(fieldName, val, len);
+ }
+
+ void PortableWriter::WriteInt16(const char* fieldName, const int16_t val)
+ {
+ impl->WriteInt16(fieldName, val);
+ }
+
+ void PortableWriter::WriteInt16Array(const char* fieldName, const int16_t* val, const int32_t len)
+ {
+ impl->WriteInt16Array(fieldName, val, len);
+ }
+
+ void PortableWriter::WriteUInt16(const char* fieldName, const uint16_t val)
+ {
+ impl->WriteUInt16(fieldName, val);
+ }
+
+ void PortableWriter::WriteUInt16Array(const char* fieldName, const uint16_t* val, const int32_t len)
+ {
+ impl->WriteUInt16Array(fieldName, val, len);
+ }
+
+ void PortableWriter::WriteInt32(const char* fieldName, const int32_t val)
+ {
+ impl->WriteInt32(fieldName, val);
+ }
+
+ void PortableWriter::WriteInt32Array(const char* fieldName, const int32_t* val, const int32_t len)
+ {
+ impl->WriteInt32Array(fieldName, val, len);
+ }
+
+ void PortableWriter::WriteInt64(const char* fieldName, const int64_t val)
+ {
+ impl->WriteInt64(fieldName, val);
+ }
+
+ void PortableWriter::WriteInt64Array(const char* fieldName, const int64_t* val, const int32_t len)
+ {
+ impl->WriteInt64Array(fieldName, val, len);
+ }
+
+ void PortableWriter::WriteFloat(const char* fieldName, const float val)
+ {
+ impl->WriteFloat(fieldName, val);
+ }
+
+ void PortableWriter::WriteFloatArray(const char* fieldName, const float* val, const int32_t len)
+ {
+ impl->WriteFloatArray(fieldName, val, len);
+ }
+
+ void PortableWriter::WriteDouble(const char* fieldName, const double val)
+ {
+ impl->WriteDouble(fieldName, val);
+ }
+
+ void PortableWriter::WriteDoubleArray(const char* fieldName, const double* val, const int32_t len)
+ {
+ impl->WriteDoubleArray(fieldName, val, len);
+ }
+
+ void PortableWriter::WriteGuid(const char* fieldName, const Guid val)
+ {
+ impl->WriteGuid(fieldName, val);
+ }
+
+ void PortableWriter::WriteGuidArray(const char* fieldName, const Guid* val, const int32_t len)
+ {
+ impl->WriteGuidArray(fieldName, val, len);
+ }
+
+ void PortableWriter::WriteString(const char* fieldName, const char* val)
+ {
+ if (val)
+ WriteString(fieldName, val, static_cast<int32_t>(strlen(val)));
+ else
+ WriteNull(fieldName);
+ }
+
+ void PortableWriter::WriteString(const char* fieldName, const char* val, const int32_t len)
+ {
+ impl->WriteString(fieldName, val, len);
+ }
+
+ PortableStringArrayWriter PortableWriter::WriteStringArray(const char* fieldName)
+ {
+ int32_t id = impl->WriteStringArray(fieldName);
+
+ return PortableStringArrayWriter(impl, id);
+ }
+
+ void PortableWriter::WriteNull(const char* fieldName)
+ {
+ impl->WriteNull(fieldName);
+ }
+
+ PortableRawWriter PortableWriter::RawWriter()
+ {
+ impl->SetRawMode();
+
+ return PortableRawWriter(impl);
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/524f5653/modules/platform/cpp/examples/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platform/cpp/examples/Makefile.am b/modules/platform/cpp/examples/Makefile.am
new file mode 100644
index 0000000..d99cd82
--- /dev/null
+++ b/modules/platform/cpp/examples/Makefile.am
@@ -0,0 +1,39 @@
+##
+## 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 = "-Im4"
+
+SUBDIRS = .
+DIST_SUBDIRS = . 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/524f5653/modules/platform/cpp/examples/README.txt
----------------------------------------------------------------------
diff --git a/modules/platform/cpp/examples/README.txt b/modules/platform/cpp/examples/README.txt
new file mode 100644
index 0000000..a00cb3b
--- /dev/null
+++ b/modules/platform/cpp/examples/README.txt
@@ -0,0 +1,42 @@
+Ignite C++ Examples
+==================================
+
+Common requirements
+----------------------------------
+ * Java Development Kit (JDK) must be installed: https://java.com/en/download/index.jsp
+ * JAVA_HOME environment variable must be set pointing to Java installation directory.
+ * IGNITE_HOME environment variable must be set to Ignite installation directory.
+ * Ignite must be build and packaged using Maven. You can use the followin Maven command: mvn clean package -DskipTests
+ * Ignite C++ must be built according to instructions for your platform.
+
+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
+ * ./configure
+ * make
+
+As a result several executables will appear in 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.
+
+
+Running examples on Windows
+----------------------------------
+
+Prerequisites:
+ * Microsoft Visual Studio (tm) 2010 or higher must be installed.
+ * 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
http://git-wip-us.apache.org/repos/asf/ignite/blob/524f5653/modules/platform/cpp/examples/config/example-cache.xml
----------------------------------------------------------------------
diff --git a/modules/platform/cpp/examples/config/example-cache.xml b/modules/platform/cpp/examples/config/example-cache.xml
new file mode 100644
index 0000000..beed238
--- /dev/null
+++ b/modules/platform/cpp/examples/config/example-cache.xml
@@ -0,0 +1,77 @@
+<?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 portable 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/524f5653/modules/platform/cpp/examples/configure.ac
----------------------------------------------------------------------
diff --git a/modules/platform/cpp/examples/configure.ac b/modules/platform/cpp/examples/configure.ac
new file mode 100644
index 0000000..a5e902d
--- /dev/null
+++ b/modules/platform/cpp/examples/configure.ac
@@ -0,0 +1,38 @@
+# -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ([2.69])
+AC_INIT([Ingnite C++ examples],[1.4.0],[dec@ignite.apache.org],[ignite-examples],[ignite.apache.org])
+AC_CONFIG_SRCDIR(src)
+
+AC_CANONICAL_SYSTEM
+AC_CONFIG_MACRO_DIR([m4])
+AC_LANG([C++])
+
+# Initialize automake
+AM_INIT_AUTOMAKE([-Wall foreign subdir-objects])
+AC_CONFIG_HEADER(config.h)
+
+AM_PROG_AR
+
+# Checks for programs.
+GXX="-g -O2"
+
+AC_PROG_CXX
+
+# Initialize Libtool
+LT_INIT
+
+AC_ARG_ENABLE([debug],
+ [AS_HELP_STRING([--enable-debug],[enable debug build [default=no]])],
+ [],[enable_debug=no])
+
+if test "x$enable_debug" = xyes; then
+ CXXFLAGS="-g -O0"
+else
+ CXXFLAGS="-g -O3"
+fi
+
+AC_CONFIG_FILES(Makefile)
+
+AC_OUTPUT
http://git-wip-us.apache.org/repos/asf/ignite/blob/524f5653/modules/platform/cpp/examples/include/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platform/cpp/examples/include/Makefile.am b/modules/platform/cpp/examples/include/Makefile.am
new file mode 100644
index 0000000..13a8816
--- /dev/null
+++ b/modules/platform/cpp/examples/include/Makefile.am
@@ -0,0 +1,21 @@
+##
+## 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 = "-Im4"
+
+nobase_include_HEADERS = ignite/examples/address.h \
+ ignite/examples/organization.h
http://git-wip-us.apache.org/repos/asf/ignite/blob/524f5653/modules/platform/cpp/examples/include/ignite/examples/address.h
----------------------------------------------------------------------
diff --git a/modules/platform/cpp/examples/include/ignite/examples/address.h b/modules/platform/cpp/examples/include/ignite/examples/address.h
new file mode 100644
index 0000000..29dbb0c
--- /dev/null
+++ b/modules/platform/cpp/examples/include/ignite/examples/address.h
@@ -0,0 +1,109 @@
+/*
+ * 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_ADDRESS
+#define _IGNITE_EXAMPLES_ADDRESS
+
+#include "ignite/portable/portable.h"
+
+namespace ignite
+{
+ namespace examples
+ {
+ struct Address
+ {
+ Address()
+ {
+ street = "";
+ zip = 0;
+ }
+
+ Address(std::string street, int zip) : street(street), zip(zip)
+ {
+ // No-op.
+ }
+
+ std::string ToString()
+ {
+ std::ostringstream oss;
+
+ oss << "Address [street=" << street << ", zip=" << zip << "]";
+
+ return oss.str();
+ }
+
+ std::string street;
+ int zip;
+ };
+ }
+}
+
+namespace ignite
+{
+ namespace portable
+ {
+ template<>
+ struct PortableType<ignite::examples::Address>
+ {
+ int32_t GetTypeId()
+ {
+ return GetPortableStringHashCode("Address");
+ }
+
+ std::string GetTypeName()
+ {
+ return "Address";
+ }
+
+ int32_t GetFieldId(const char* name)
+ {
+ return GetPortableStringHashCode(name);
+ }
+
+ int32_t GetHashCode(ignite::examples::Address obj)
+ {
+ return 0;
+ }
+
+ bool IsNull(ignite::examples::Address obj)
+ {
+ return false;
+ }
+
+ ignite::examples::Address GetNull()
+ {
+ return ignite::examples::Address("", 0);
+ }
+
+ void Write(PortableWriter& writer, ignite::examples::Address obj)
+ {
+ writer.WriteString("street", obj.street);
+ writer.WriteInt32("zip", obj.zip);
+ }
+
+ ignite::examples::Address Read(PortableReader& reader)
+ {
+ 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/524f5653/modules/platform/cpp/examples/include/ignite/examples/organization.h
----------------------------------------------------------------------
diff --git a/modules/platform/cpp/examples/include/ignite/examples/organization.h b/modules/platform/cpp/examples/include/ignite/examples/organization.h
new file mode 100644
index 0000000..c9137c9
--- /dev/null
+++ b/modules/platform/cpp/examples/include/ignite/examples/organization.h
@@ -0,0 +1,111 @@
+/*
+ * 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_ORGANIZATION
+#define _IGNITE_EXAMPLES_ORGANIZATION
+
+#include "ignite/portable/portable.h"
+
+#include "ignite/examples/address.h"
+
+namespace ignite
+{
+ namespace examples
+ {
+ struct Organization
+ {
+ Organization()
+ {
+ name = "";
+ addr = Address();
+ }
+
+ Organization(std::string name, Address addr) : name(name), addr(addr)
+ {
+ // No-op.
+ }
+
+ std::string ToString()
+ {
+ std::ostringstream oss;
+
+ oss << "Organization [name=" << name << ", Address=" << addr.ToString() << "]";
+
+ return oss.str();
+ }
+
+ std::string name;
+ Address addr;
+ };
+ }
+}
+
+namespace ignite
+{
+ namespace portable
+ {
+ template<>
+ struct PortableType<ignite::examples::Organization>
+ {
+ int32_t GetTypeId()
+ {
+ return GetPortableStringHashCode("Organization");
+ }
+
+ std::string GetTypeName()
+ {
+ return "Organization";
+ }
+
+ int32_t GetFieldId(const char* name)
+ {
+ return GetPortableStringHashCode(name);
+ }
+
+ int32_t GetHashCode(ignite::examples::Organization obj)
+ {
+ return 0;
+ }
+
+ bool IsNull(ignite::examples::Organization obj)
+ {
+ return false;
+ }
+
+ ignite::examples::Organization GetNull()
+ {
+ return ignite::examples::Organization("", ignite::examples::Address());
+ }
+
+ void Write(PortableWriter& writer, ignite::examples::Organization obj)
+ {
+ writer.WriteString("name", obj.name);
+ writer.WriteObject<ignite::examples::Address>("addr", obj.addr);
+ }
+
+ ignite::examples::Organization Read(PortableReader& reader)
+ {
+ 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/524f5653/modules/platform/cpp/examples/project/vs/ignite-examples.sln
----------------------------------------------------------------------
diff --git a/modules/platform/cpp/examples/project/vs/ignite-examples.sln b/modules/platform/cpp/examples/project/vs/ignite-examples.sln
new file mode 100644
index 0000000..4970654
--- /dev/null
+++ b/modules/platform/cpp/examples/project/vs/ignite-examples.sln
@@ -0,0 +1,19 @@
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ignite-examples", "ignite-examples.vcxproj", "{34935DEC-80FC-4168-AA52-3DBFF4F79B6B}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {34935DEC-80FC-4168-AA52-3DBFF4F79B6B}.Release|x64.ActiveCfg = Release|x64
+ {34935DEC-80FC-4168-AA52-3DBFF4F79B6B}.Release|x64.Build.0 = Release|x64
+ {34935DEC-80FC-4168-AA52-3DBFF4F79B6B}.Release|x86.ActiveCfg = Release|Win32
+ {34935DEC-80FC-4168-AA52-3DBFF4F79B6B}.Release|x86.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
http://git-wip-us.apache.org/repos/asf/ignite/blob/524f5653/modules/platform/cpp/examples/project/vs/ignite-examples.vcxproj
----------------------------------------------------------------------
diff --git a/modules/platform/cpp/examples/project/vs/ignite-examples.vcxproj b/modules/platform/cpp/examples/project/vs/ignite-examples.vcxproj
new file mode 100644
index 0000000..13ec564
--- /dev/null
+++ b/modules/platform/cpp/examples/project/vs/ignite-examples.vcxproj
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.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>{34935DEC-80FC-4168-AA52-3DBFF4F79B6B}</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>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</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;..\..\..\src\common\os\win\include;..\..\..\src\common\include;..\..\..\src\core\os\win\include;..\..\..\src\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.core.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalLibraryDirectories>..\..\..\src\project\vs\$(Platform)\$(Configuration)\;$(JAVA_HOME)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Link>
+ <PostBuildEvent>
+ <Command>copy "$(ProjectDir)..\..\..\src\project\vs\$(Platform)\$(Configuration)\ignite.common.dll" "$(OutDir)"
+copy "$(ProjectDir)..\..\..\src\\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;..\..\..\src\common\os\win\include;..\..\..\src\common\include;..\..\..\src\core\os\win\include;..\..\..\src\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.core.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalLibraryDirectories>..\..\..\src\project\vs\$(Platform)\$(Configuration)\;$(JAVA_HOME)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Link>
+ <PostBuildEvent>
+ <Command>copy "$(ProjectDir)..\..\..\src\project\vs\$(Platform)\$(Configuration)\ignite.common.dll" "$(OutDir)"
+copy "$(ProjectDir)..\..\..\src\project\vs\$(Platform)\$(Configuration)\ignite.core.dll" "$(OutDir)"</Command>
+ </PostBuildEvent>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\putgetexample.cpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\include\ignite\examples\address.h" />
+ <ClInclude Include="..\..\include\ignite\examples\organization.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/524f5653/modules/platform/cpp/examples/project/vs/ignite-examples.vcxproj.filters
----------------------------------------------------------------------
diff --git a/modules/platform/cpp/examples/project/vs/ignite-examples.vcxproj.filters b/modules/platform/cpp/examples/project/vs/ignite-examples.vcxproj.filters
new file mode 100644
index 0000000..ca62db7
--- /dev/null
+++ b/modules/platform/cpp/examples/project/vs/ignite-examples.vcxproj.filters
@@ -0,0 +1,30 @@
+<?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>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\putgetexample.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>
+ </ItemGroup>
+</Project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/524f5653/modules/platform/cpp/examples/src/putgetexample.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/cpp/examples/src/putgetexample.cpp b/modules/platform/cpp/examples/src/putgetexample.cpp
new file mode 100644
index 0000000..206a2f4
--- /dev/null
+++ b/modules/platform/cpp/examples/src/putgetexample.cpp
@@ -0,0 +1,126 @@
+/*
+ * 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 <iostream>
+
+#include "ignite/ignite.h"
+#include "ignite/ignition.h"
+
+#include "ignite/examples/organization.h"
+
+using namespace ignite;
+using namespace cache;
+
+using namespace examples;
+
+/*
+ * Execute individual Put and Get operations.
+ *
+ * @param cache Cache instance.
+ */
+void PutGet(Cache<int, Organization>& cache)
+{
+ // Create new Organization to store in cache.
+ Organization org("Microsoft", Address("1096 Eddy Street, San Francisco, CA", 94109));
+
+ // Put organization to cache.
+ cache.Put(1, org);
+
+ // Get recently created employee as a strongly-typed fully de-serialized instance.
+ Organization orgFromCache = cache.Get(1);
+
+ std::cout << ">>> Retrieved organization instance from cache: " << std::endl;
+ std::cout << orgFromCache.ToString() << std::endl;
+ std::cout << std::endl;
+}
+
+/*
+ * Execute bulk Put and Get operations.
+ */
+void PutGetAll(Cache<int, Organization>& cache)
+{
+ // Create new Organizations to store in cache.
+ Organization org1("Microsoft", Address("1096 Eddy Street, San Francisco, CA", 94109));
+ Organization org2("Red Cross", Address("184 Fidler Drive, San Antonio, TX", 78205));
+
+ // Put created data entries to cache.
+ std::map<int, Organization> vals;
+
+ vals[1] = org1;
+ vals[2] = org2;
+
+ cache.PutAll(vals);
+
+ // Get recently created organizations as a strongly-typed fully de-serialized instances.
+ std::set<int> keys;
+
+ keys.insert(1);
+ keys.insert(2);
+
+ std::map<int, Organization> valsFromCache = cache.GetAll(keys);
+
+ std::cout << ">>> Retrieved organization instances from cache: " << std::endl;
+
+ for (std::map<int, Organization>::iterator it = valsFromCache.begin(); it != valsFromCache.end(); ++it)
+ std::cout << it->second.ToString() << std::endl;
+
+ std::cout << std::endl;
+}
+
+int main()
+{
+ IgniteConfiguration cfg;
+
+ cfg.jvmInitMem = 512;
+ cfg.jvmMaxMem = 512;
+
+ cfg.springCfgPath = "platforms/cpp/examples/config/example-cache.xml";
+
+ try
+ {
+ // Start a node.
+ Ignite grid = Ignition::Start(cfg);
+
+ std::cout << std::endl;
+ std::cout << ">>> Cache put-get example started." << std::endl;
+ std::cout << std::endl;
+
+ // Get cache instance.
+ Cache<int, Organization> cache = grid.GetCache<int, Organization>(NULL);
+
+ // Clear cache.
+ cache.Clear();
+
+ PutGet(cache);
+ PutGetAll(cache);
+
+ // Stop node.
+ Ignition::StopAll(false);
+ }
+ catch (IgniteError& err)
+ {
+ std::cout << "An error occurred: " << err.GetText() << std::endl;
+ }
+
+ std::cout << std::endl;
+ std::cout << ">>> Example finished, press any key to exit ..." << std::endl;
+ std::cout << std::endl;
+
+ std::cin.get();
+
+ return 0;
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/524f5653/modules/platform/cpp/project/vs/ignite.sln
----------------------------------------------------------------------
diff --git a/modules/platform/cpp/project/vs/ignite.sln b/modules/platform/cpp/project/vs/ignite.sln
new file mode 100644
index 0000000..f34d8e5
--- /dev/null
+++ b/modules/platform/cpp/project/vs/ignite.sln
@@ -0,0 +1,46 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "common", "..\..\common\project\vs\common.vcxproj", "{4F7E4917-4612-4B96-9838-025711ADE391}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "core", "..\..\core\project\vs\core.vcxproj", "{E2DEA693-F2EA-43C2-A813-053378F6E4DB}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "core-test", "..\..\core-test\project\vs\core-test.vcxproj", "{133A22DB-FD60-44B9-B5E3-6CBB3EA5ABF0}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Debug|x64 = Debug|x64
+ Release|Win32 = Release|Win32
+ Release|x64 = Release|x64
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {4F7E4917-4612-4B96-9838-025711ADE391}.Debug|Win32.ActiveCfg = Debug|Win32
+ {4F7E4917-4612-4B96-9838-025711ADE391}.Debug|Win32.Build.0 = Debug|Win32
+ {4F7E4917-4612-4B96-9838-025711ADE391}.Debug|x64.ActiveCfg = Debug|x64
+ {4F7E4917-4612-4B96-9838-025711ADE391}.Debug|x64.Build.0 = Debug|x64
+ {4F7E4917-4612-4B96-9838-025711ADE391}.Release|Win32.ActiveCfg = Release|Win32
+ {4F7E4917-4612-4B96-9838-025711ADE391}.Release|Win32.Build.0 = Release|Win32
+ {4F7E4917-4612-4B96-9838-025711ADE391}.Release|x64.ActiveCfg = Release|x64
+ {4F7E4917-4612-4B96-9838-025711ADE391}.Release|x64.Build.0 = Release|x64
+ {E2DEA693-F2EA-43C2-A813-053378F6E4DB}.Debug|Win32.ActiveCfg = Debug|Win32
+ {E2DEA693-F2EA-43C2-A813-053378F6E4DB}.Debug|Win32.Build.0 = Debug|Win32
+ {E2DEA693-F2EA-43C2-A813-053378F6E4DB}.Debug|x64.ActiveCfg = Debug|x64
+ {E2DEA693-F2EA-43C2-A813-053378F6E4DB}.Debug|x64.Build.0 = Debug|x64
+ {E2DEA693-F2EA-43C2-A813-053378F6E4DB}.Release|Win32.ActiveCfg = Release|Win32
+ {E2DEA693-F2EA-43C2-A813-053378F6E4DB}.Release|Win32.Build.0 = Release|Win32
+ {E2DEA693-F2EA-43C2-A813-053378F6E4DB}.Release|x64.ActiveCfg = Release|x64
+ {E2DEA693-F2EA-43C2-A813-053378F6E4DB}.Release|x64.Build.0 = Release|x64
+ {133A22DB-FD60-44B9-B5E3-6CBB3EA5ABF0}.Debug|Win32.ActiveCfg = Debug|Win32
+ {133A22DB-FD60-44B9-B5E3-6CBB3EA5ABF0}.Debug|Win32.Build.0 = Debug|Win32
+ {133A22DB-FD60-44B9-B5E3-6CBB3EA5ABF0}.Debug|x64.ActiveCfg = Debug|x64
+ {133A22DB-FD60-44B9-B5E3-6CBB3EA5ABF0}.Debug|x64.Build.0 = Debug|x64
+ {133A22DB-FD60-44B9-B5E3-6CBB3EA5ABF0}.Release|Win32.ActiveCfg = Release|Win32
+ {133A22DB-FD60-44B9-B5E3-6CBB3EA5ABF0}.Release|Win32.Build.0 = Release|Win32
+ {133A22DB-FD60-44B9-B5E3-6CBB3EA5ABF0}.Release|x64.ActiveCfg = Release|x64
+ {133A22DB-FD60-44B9-B5E3-6CBB3EA5ABF0}.Release|x64.Build.0 = Release|x64
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
http://git-wip-us.apache.org/repos/asf/ignite/blob/524f5653/modules/platform/cpp/project/vs/ignite.slnrel
----------------------------------------------------------------------
diff --git a/modules/platform/cpp/project/vs/ignite.slnrel b/modules/platform/cpp/project/vs/ignite.slnrel
new file mode 100644
index 0000000..7456097
--- /dev/null
+++ b/modules/platform/cpp/project/vs/ignite.slnrel
@@ -0,0 +1,33 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "common", "..\..\common\project\vs\common.vcxproj", "{4F7E4917-4612-4B96-9838-025711ADE391}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "core", "..\..\core\project\vs\core.vcxproj", "{E2DEA693-F2EA-43C2-A813-053378F6E4DB}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Release|x64 = Release|x64
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {4F7E4917-4612-4B96-9838-025711ADE391}.Debug|Win32.ActiveCfg = Debug|Win32
+ {4F7E4917-4612-4B96-9838-025711ADE391}.Debug|Win32.Build.0 = Debug|Win32
+ {4F7E4917-4612-4B96-9838-025711ADE391}.Debug|x64.ActiveCfg = Debug|x64
+ {4F7E4917-4612-4B96-9838-025711ADE391}.Debug|x64.Build.0 = Debug|x64
+ {4F7E4917-4612-4B96-9838-025711ADE391}.Release|Win32.ActiveCfg = Release|Win32
+ {4F7E4917-4612-4B96-9838-025711ADE391}.Release|Win32.Build.0 = Release|Win32
+ {4F7E4917-4612-4B96-9838-025711ADE391}.Release|x64.ActiveCfg = Release|x64
+ {4F7E4917-4612-4B96-9838-025711ADE391}.Release|x64.Build.0 = Release|x64
+ {E2DEA693-F2EA-43C2-A813-053378F6E4DB}.Debug|Win32.ActiveCfg = Debug|Win32
+ {E2DEA693-F2EA-43C2-A813-053378F6E4DB}.Debug|Win32.Build.0 = Debug|Win32
+ {E2DEA693-F2EA-43C2-A813-053378F6E4DB}.Debug|x64.ActiveCfg = Debug|x64
+ {E2DEA693-F2EA-43C2-A813-053378F6E4DB}.Debug|x64.Build.0 = Debug|x64
+ {E2DEA693-F2EA-43C2-A813-053378F6E4DB}.Release|Win32.ActiveCfg = Release|Win32
+ {E2DEA693-F2EA-43C2-A813-053378F6E4DB}.Release|Win32.Build.0 = Release|Win32
+ {E2DEA693-F2EA-43C2-A813-053378F6E4DB}.Release|x64.ActiveCfg = Release|x64
+ {E2DEA693-F2EA-43C2-A813-053378F6E4DB}.Release|x64.Build.0 = Release|x64
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
http://git-wip-us.apache.org/repos/asf/ignite/blob/524f5653/modules/platform/cpp/project/vs/ignite_x86.slnrel
----------------------------------------------------------------------
diff --git a/modules/platform/cpp/project/vs/ignite_x86.slnrel b/modules/platform/cpp/project/vs/ignite_x86.slnrel
new file mode 100644
index 0000000..b716b49
--- /dev/null
+++ b/modules/platform/cpp/project/vs/ignite_x86.slnrel
@@ -0,0 +1,33 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "common", "..\..\common\project\vs\common.vcxproj", "{4F7E4917-4612-4B96-9838-025711ADE391}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "core", "..\..\core\project\vs\core.vcxproj", "{E2DEA693-F2EA-43C2-A813-053378F6E4DB}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {4F7E4917-4612-4B96-9838-025711ADE391}.Debug|Win32.ActiveCfg = Debug|Win32
+ {4F7E4917-4612-4B96-9838-025711ADE391}.Debug|Win32.Build.0 = Debug|Win32
+ {4F7E4917-4612-4B96-9838-025711ADE391}.Debug|x64.ActiveCfg = Debug|x64
+ {4F7E4917-4612-4B96-9838-025711ADE391}.Debug|x64.Build.0 = Debug|x64
+ {4F7E4917-4612-4B96-9838-025711ADE391}.Release|Win32.ActiveCfg = Release|Win32
+ {4F7E4917-4612-4B96-9838-025711ADE391}.Release|Win32.Build.0 = Release|Win32
+ {4F7E4917-4612-4B96-9838-025711ADE391}.Release|x64.ActiveCfg = Release|x64
+ {4F7E4917-4612-4B96-9838-025711ADE391}.Release|x64.Build.0 = Release|x64
+ {E2DEA693-F2EA-43C2-A813-053378F6E4DB}.Debug|Win32.ActiveCfg = Debug|Win32
+ {E2DEA693-F2EA-43C2-A813-053378F6E4DB}.Debug|Win32.Build.0 = Debug|Win32
+ {E2DEA693-F2EA-43C2-A813-053378F6E4DB}.Debug|x64.ActiveCfg = Debug|x64
+ {E2DEA693-F2EA-43C2-A813-053378F6E4DB}.Debug|x64.Build.0 = Debug|x64
+ {E2DEA693-F2EA-43C2-A813-053378F6E4DB}.Release|Win32.ActiveCfg = Release|Win32
+ {E2DEA693-F2EA-43C2-A813-053378F6E4DB}.Release|Win32.Build.0 = Release|Win32
+ {E2DEA693-F2EA-43C2-A813-053378F6E4DB}.Release|x64.ActiveCfg = Release|x64
+ {E2DEA693-F2EA-43C2-A813-053378F6E4DB}.Release|x64.Build.0 = Release|x64
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal