You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ak...@apache.org on 2015/09/09 14:37:53 UTC
[41/50] ignite git commit: Added CPP example.
Added CPP example.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b287ef24
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b287ef24
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b287ef24
Branch: refs/heads/ignite-843
Commit: b287ef240995311fb86bb03b26e4c3ee18b4d73d
Parents: fba01d6
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Sep 9 12:40:19 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Sep 9 12:40:19 2015 +0300
----------------------------------------------------------------------
examples/src/main/cpp/Makefile.am | 39 ++++++
examples/src/main/cpp/README.txt | 41 ++++++
examples/src/main/cpp/configure.ac | 30 +++++
examples/src/main/cpp/include/Makefile.am | 21 ++++
.../main/cpp/include/ignite/examples/address.h | 109 ++++++++++++++++
.../cpp/include/ignite/examples/organization.h | 111 ++++++++++++++++
.../src/main/cpp/project/vs/ignite-examples.sln | 19 +++
.../main/cpp/project/vs/ignite-examples.vcxproj | 107 ++++++++++++++++
.../project/vs/ignite-examples.vcxproj.filters | 30 +++++
examples/src/main/cpp/src/putgetexample.cpp | 126 +++++++++++++++++++
10 files changed, 633 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/b287ef24/examples/src/main/cpp/Makefile.am
----------------------------------------------------------------------
diff --git a/examples/src/main/cpp/Makefile.am b/examples/src/main/cpp/Makefile.am
new file mode 100644
index 0000000..84fe957
--- /dev/null
+++ b/examples/src/main/cpp/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 = . include
+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/b287ef24/examples/src/main/cpp/README.txt
----------------------------------------------------------------------
diff --git a/examples/src/main/cpp/README.txt b/examples/src/main/cpp/README.txt
new file mode 100644
index 0000000..68f35a3
--- /dev/null
+++ b/examples/src/main/cpp/README.txt
@@ -0,0 +1,41 @@
+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.
+ * Ingnite 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/examples/platforms/cpp 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%\examples\platforms\cpp\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/b287ef24/examples/src/main/cpp/configure.ac
----------------------------------------------------------------------
diff --git a/examples/src/main/cpp/configure.ac b/examples/src/main/cpp/configure.ac
new file mode 100644
index 0000000..a5ffb98
--- /dev/null
+++ b/examples/src/main/cpp/configure.ac
@@ -0,0 +1,30 @@
+dnl Process this file with autoconf to produce a configure script.
+
+AC_PREREQ(2.68)
+AC_INIT([Ingnite C++ examples],[1.5.0],[dec@ignite.apache.org],[ignite-examples],[ignite.apache.org])
+AC_CONFIG_SRCDIR([src])
+AC_CONFIG_MACRO_DIR([m4])
+AC_LANG([C++])
+
+AC_CANONICAL_SYSTEM
+
+dnl Initialize automake
+AM_INIT_AUTOMAKE([-Wall foreign])
+AC_CONFIG_HEADER([config.h])
+
+GXX="-g -O2"
+
+AC_PROG_CXX
+
+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/b287ef24/examples/src/main/cpp/include/Makefile.am
----------------------------------------------------------------------
diff --git a/examples/src/main/cpp/include/Makefile.am b/examples/src/main/cpp/include/Makefile.am
new file mode 100644
index 0000000..13a8816
--- /dev/null
+++ b/examples/src/main/cpp/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/b287ef24/examples/src/main/cpp/include/ignite/examples/address.h
----------------------------------------------------------------------
diff --git a/examples/src/main/cpp/include/ignite/examples/address.h b/examples/src/main/cpp/include/ignite/examples/address.h
new file mode 100644
index 0000000..29dbb0c
--- /dev/null
+++ b/examples/src/main/cpp/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/b287ef24/examples/src/main/cpp/include/ignite/examples/organization.h
----------------------------------------------------------------------
diff --git a/examples/src/main/cpp/include/ignite/examples/organization.h b/examples/src/main/cpp/include/ignite/examples/organization.h
new file mode 100644
index 0000000..c9137c9
--- /dev/null
+++ b/examples/src/main/cpp/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/b287ef24/examples/src/main/cpp/project/vs/ignite-examples.sln
----------------------------------------------------------------------
diff --git a/examples/src/main/cpp/project/vs/ignite-examples.sln b/examples/src/main/cpp/project/vs/ignite-examples.sln
new file mode 100644
index 0000000..4970654
--- /dev/null
+++ b/examples/src/main/cpp/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/b287ef24/examples/src/main/cpp/project/vs/ignite-examples.vcxproj
----------------------------------------------------------------------
diff --git a/examples/src/main/cpp/project/vs/ignite-examples.vcxproj b/examples/src/main/cpp/project/vs/ignite-examples.vcxproj
new file mode 100644
index 0000000..845aa53
--- /dev/null
+++ b/examples/src/main/cpp/project/vs/ignite-examples.vcxproj
@@ -0,0 +1,107 @@
+<?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>{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>v100</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v100</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;..\..\..\..\platforms\cpp\common\os\win\include;..\..\..\..\platforms\cpp\common\include;..\..\..\..\platforms\cpp\core\os\win\include;..\..\..\..\platforms\cpp\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>..\..\..\..\platforms\cpp\project\vs\$(Platform)\$(Configuration)\;$(JAVA_HOME)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Link>
+ <PostBuildEvent>
+ <Command>copy "$(ProjectDir)..\..\..\..\platforms\cpp\project\vs\$(Platform)\$(Configuration)\ignite.common.dll" "$(OutDir)"
+copy "$(ProjectDir)..\..\..\..\platforms\cpp\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;..\..\..\..\platforms\cpp\common\os\win\include;..\..\..\..\platforms\cpp\common\include;..\..\..\..\platforms\cpp\core\os\win\include;..\..\..\..\platforms\cpp\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>..\..\..\..\platforms\cpp\project\vs\$(Platform)\$(Configuration)\;$(JAVA_HOME)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Link>
+ <PostBuildEvent>
+ <Command>copy "$(ProjectDir)..\..\..\..\platforms\cpp\project\vs\$(Platform)\$(Configuration)\ignite.common.dll" "$(OutDir)"
+copy "$(ProjectDir)..\..\..\..\platforms\cpp\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/b287ef24/examples/src/main/cpp/project/vs/ignite-examples.vcxproj.filters
----------------------------------------------------------------------
diff --git a/examples/src/main/cpp/project/vs/ignite-examples.vcxproj.filters b/examples/src/main/cpp/project/vs/ignite-examples.vcxproj.filters
new file mode 100644
index 0000000..78a7847
--- /dev/null
+++ b/examples/src/main/cpp/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/b287ef24/examples/src/main/cpp/src/putgetexample.cpp
----------------------------------------------------------------------
diff --git a/examples/src/main/cpp/src/putgetexample.cpp b/examples/src/main/cpp/src/putgetexample.cpp
new file mode 100644
index 0000000..9ba1258
--- /dev/null
+++ b/examples/src/main/cpp/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 = "examples/config/cpp/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