You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by dm...@apache.org on 2016/05/05 19:38:04 UTC
[30/40] ignite git commit: IGNITE-1786: Implemented ODBC driver.
http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/binary/project/vs/binary.vcxproj
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/project/vs/binary.vcxproj b/modules/platforms/cpp/binary/project/vs/binary.vcxproj
new file mode 100644
index 0000000..212c554
--- /dev/null
+++ b/modules/platforms/cpp/binary/project/vs/binary.vcxproj
@@ -0,0 +1,233 @@
+\ufeff<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{4F15669B-92EB-49F0-B774-8F19BAE0B960}</ProjectGuid>
+ <RootNamespace>binary</RootNamespace>
+ <ProjectName>binary</ProjectName>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v100</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v100</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v100</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</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 Label="Shared">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <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)'=='Debug|x64'">
+ <TargetName>ignite.binary</TargetName>
+ <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+ <IntDir>$(Platform)\$(Configuration)\</IntDir>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <TargetName>ignite.binary</TargetName>
+ <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+ <IntDir>$(Platform)\$(Configuration)\</IntDir>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <TargetName>ignite.binary</TargetName>
+ <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+ <IntDir>$(Platform)\$(Configuration)\</IntDir>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <TargetName>ignite.binary</TargetName>
+ <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+ <IntDir>$(Platform)\$(Configuration)\</IntDir>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <SDLCheck>false</SDLCheck>
+ <AdditionalIncludeDirectories>$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\include</AdditionalIncludeDirectories>
+ <InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
+ <IntrinsicFunctions>false</IntrinsicFunctions>
+ <FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>
+ <OmitFramePointers>false</OmitFramePointers>
+ <StringPooling>true</StringPooling>
+ <MinimalRebuild>false</MinimalRebuild>
+ <BasicRuntimeChecks>Default</BasicRuntimeChecks>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;IGNITE_IMPL;IGNITE_FRIEND;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <WholeProgramOptimization>false</WholeProgramOptimization>
+ </ClCompile>
+ <Link>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <SDLCheck>false</SDLCheck>
+ <AdditionalIncludeDirectories>$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\include</AdditionalIncludeDirectories>
+ <InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
+ <IntrinsicFunctions>false</IntrinsicFunctions>
+ <FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>
+ <OmitFramePointers>false</OmitFramePointers>
+ <StringPooling>true</StringPooling>
+ <MinimalRebuild>false</MinimalRebuild>
+ <BasicRuntimeChecks>Default</BasicRuntimeChecks>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;IGNITE_IMPL;IGNITE_FRIEND;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <WholeProgramOptimization>false</WholeProgramOptimization>
+ </ClCompile>
+ <Link>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Full</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>false</SDLCheck>
+ <AdditionalIncludeDirectories>$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\include</AdditionalIncludeDirectories>
+ <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
+ <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
+ <OmitFramePointers>true</OmitFramePointers>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;IGNITE_IMPL;IGNITE_FRIEND;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <Link>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>false</SDLCheck>
+ <AdditionalIncludeDirectories>$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\include</AdditionalIncludeDirectories>
+ <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
+ <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
+ <OmitFramePointers>true</OmitFramePointers>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;IGNITE_IMPL;IGNITE_FRIEND;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <Link>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\include\ignite\binary\binary.h" />
+ <ClInclude Include="..\..\include\ignite\binary\binary_consts.h" />
+ <ClInclude Include="..\..\include\ignite\binary\binary_containers.h" />
+ <ClInclude Include="..\..\include\ignite\binary\binary_raw_reader.h" />
+ <ClInclude Include="..\..\include\ignite\binary\binary_raw_writer.h" />
+ <ClInclude Include="..\..\include\ignite\binary\binary_reader.h" />
+ <ClInclude Include="..\..\include\ignite\binary\binary_type.h" />
+ <ClInclude Include="..\..\include\ignite\binary\binary_writer.h" />
+ <ClInclude Include="..\..\include\ignite\impl\binary\binary_common.h" />
+ <ClInclude Include="..\..\include\ignite\impl\binary\binary_id_resolver.h" />
+ <ClInclude Include="..\..\include\ignite\impl\binary\binary_reader_impl.h" />
+ <ClInclude Include="..\..\include\ignite\impl\binary\binary_schema.h" />
+ <ClInclude Include="..\..\include\ignite\impl\binary\binary_type_handler.h" />
+ <ClInclude Include="..\..\include\ignite\impl\binary\binary_type_manager.h" />
+ <ClInclude Include="..\..\include\ignite\impl\binary\binary_type_snapshot.h" />
+ <ClInclude Include="..\..\include\ignite\impl\binary\binary_type_updater.h" />
+ <ClInclude Include="..\..\include\ignite\impl\binary\binary_utils.h" />
+ <ClInclude Include="..\..\include\ignite\impl\binary\binary_writer_impl.h" />
+ <ClInclude Include="..\..\include\ignite\impl\interop\interop.h" />
+ <ClInclude Include="..\..\include\ignite\impl\interop\interop_input_stream.h" />
+ <ClInclude Include="..\..\include\ignite\impl\interop\interop_memory.h" />
+ <ClInclude Include="..\..\include\ignite\impl\interop\interop_output_stream.h" />
+ <ClInclude Include="..\..\include\ignite\impl\interop\interop_stream_position_guard.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\binary\binary_containers.cpp" />
+ <ClCompile Include="..\..\src\binary\binary_raw_reader.cpp" />
+ <ClCompile Include="..\..\src\binary\binary_raw_writer.cpp" />
+ <ClCompile Include="..\..\src\binary\binary_reader.cpp" />
+ <ClCompile Include="..\..\src\binary\binary_type.cpp" />
+ <ClCompile Include="..\..\src\binary\binary_writer.cpp" />
+ <ClCompile Include="..\..\src\impl\binary\binary_reader_impl.cpp" />
+ <ClCompile Include="..\..\src\impl\binary\binary_schema.cpp" />
+ <ClCompile Include="..\..\src\impl\binary\binary_type_handler.cpp" />
+ <ClCompile Include="..\..\src\impl\binary\binary_type_manager.cpp" />
+ <ClCompile Include="..\..\src\impl\binary\binary_type_snapshot.cpp" />
+ <ClCompile Include="..\..\src\impl\binary\binary_type_updater.cpp" />
+ <ClCompile Include="..\..\src\impl\binary\binary_utils.cpp" />
+ <ClCompile Include="..\..\src\impl\binary\binary_writer_impl.cpp" />
+ <ClCompile Include="..\..\src\impl\interop\interop_input_stream.cpp" />
+ <ClCompile Include="..\..\src\impl\interop\interop_memory.cpp" />
+ <ClCompile Include="..\..\src\impl\interop\interop_output_stream.cpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\..\common\project\vs\common.vcxproj">
+ <Project>{b63f2e01-5157-4719-8491-0e1c7cd3b701}</Project>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/binary/project/vs/binary.vcxproj.filters
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/project/vs/binary.vcxproj.filters b/modules/platforms/cpp/binary/project/vs/binary.vcxproj.filters
new file mode 100644
index 0000000..09aca58
--- /dev/null
+++ b/modules/platforms/cpp/binary/project/vs/binary.vcxproj.filters
@@ -0,0 +1,145 @@
+\ufeff<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Code">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="Code\binary">
+ <UniqueIdentifier>{1815eb01-65f5-4142-b773-06abf2dcd0af}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Code\impl">
+ <UniqueIdentifier>{7cb1d41b-cf13-4c88-a663-3d74f0bd1b52}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Code\impl\binary">
+ <UniqueIdentifier>{12775752-54bd-4c9c-b890-0252b2f221b5}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Code\impl\interop">
+ <UniqueIdentifier>{d41f0ecd-360a-4a59-a5fb-98db54a3e170}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\include\ignite\binary\binary.h">
+ <Filter>Code\binary</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\binary\binary_consts.h">
+ <Filter>Code\binary</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\binary\binary_containers.h">
+ <Filter>Code\binary</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\binary\binary_raw_reader.h">
+ <Filter>Code\binary</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\binary\binary_raw_writer.h">
+ <Filter>Code\binary</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\binary\binary_reader.h">
+ <Filter>Code\binary</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\binary\binary_type.h">
+ <Filter>Code\binary</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\binary\binary_writer.h">
+ <Filter>Code\binary</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\impl\binary\binary_common.h">
+ <Filter>Code\impl\binary</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\impl\binary\binary_id_resolver.h">
+ <Filter>Code\impl\binary</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\impl\binary\binary_reader_impl.h">
+ <Filter>Code\impl\binary</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\impl\binary\binary_schema.h">
+ <Filter>Code\impl\binary</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\impl\binary\binary_type_handler.h">
+ <Filter>Code\impl\binary</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\impl\binary\binary_type_manager.h">
+ <Filter>Code\impl\binary</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\impl\binary\binary_type_snapshot.h">
+ <Filter>Code\impl\binary</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\impl\binary\binary_type_updater.h">
+ <Filter>Code\impl\binary</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\impl\binary\binary_utils.h">
+ <Filter>Code\impl\binary</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\impl\binary\binary_writer_impl.h">
+ <Filter>Code\impl\binary</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\impl\interop\interop.h">
+ <Filter>Code\impl\interop</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\impl\interop\interop_input_stream.h">
+ <Filter>Code\impl\interop</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\impl\interop\interop_memory.h">
+ <Filter>Code\impl\interop</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\impl\interop\interop_output_stream.h">
+ <Filter>Code\impl\interop</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\impl\interop\interop_stream_position_guard.h">
+ <Filter>Code\impl\interop</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\binary\binary_containers.cpp">
+ <Filter>Code\binary</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\binary\binary_raw_reader.cpp">
+ <Filter>Code\binary</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\binary\binary_raw_writer.cpp">
+ <Filter>Code\binary</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\binary\binary_reader.cpp">
+ <Filter>Code\binary</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\binary\binary_type.cpp">
+ <Filter>Code\binary</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\binary\binary_writer.cpp">
+ <Filter>Code\binary</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\impl\binary\binary_reader_impl.cpp">
+ <Filter>Code\impl\binary</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\impl\binary\binary_schema.cpp">
+ <Filter>Code\impl\binary</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\impl\binary\binary_type_handler.cpp">
+ <Filter>Code\impl\binary</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\impl\binary\binary_type_manager.cpp">
+ <Filter>Code\impl\binary</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\impl\binary\binary_type_snapshot.cpp">
+ <Filter>Code\impl\binary</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\impl\binary\binary_type_updater.cpp">
+ <Filter>Code\impl\binary</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\impl\binary\binary_utils.cpp">
+ <Filter>Code\impl\binary</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\impl\binary\binary_writer_impl.cpp">
+ <Filter>Code\impl\binary</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\impl\interop\interop_input_stream.cpp">
+ <Filter>Code\impl\interop</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\impl\interop\interop_memory.cpp">
+ <Filter>Code\impl\interop</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\impl\interop\interop_output_stream.cpp">
+ <Filter>Code\impl\interop</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/binary/src/binary/binary_containers.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/src/binary/binary_containers.cpp b/modules/platforms/cpp/binary/src/binary/binary_containers.cpp
new file mode 100644
index 0000000..91645cc
--- /dev/null
+++ b/modules/platforms/cpp/binary/src/binary/binary_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/binary/binary_containers.h"
+
+using namespace ignite::impl::binary;
+
+namespace ignite
+{
+ namespace binary
+ {
+ BinaryStringArrayWriter::BinaryStringArrayWriter(BinaryWriterImpl* impl, int32_t id) :
+ impl(impl), id(id)
+ {
+ // No-op.
+ }
+
+ void BinaryStringArrayWriter::Write(const char* val)
+ {
+ if (val)
+ Write(val, static_cast<int32_t>(strlen(val)));
+ else
+ Write(NULL, -1);
+ }
+
+ void BinaryStringArrayWriter::Write(const char* val, int32_t len)
+ {
+ impl->WriteStringElement(id, val, len);
+ }
+
+ void BinaryStringArrayWriter::Close()
+ {
+ impl->CommitContainer(id);
+ }
+
+ BinaryStringArrayReader::BinaryStringArrayReader(impl::binary::BinaryReaderImpl* impl,
+ int32_t id, int32_t size) : impl(impl), id(id), size(size)
+ {
+ // No-op.
+ }
+
+ bool BinaryStringArrayReader::HasNext()
+ {
+ return impl->HasNextElement(id);
+ }
+
+ int32_t BinaryStringArrayReader::GetNext(char* res, int32_t len)
+ {
+ return impl->ReadStringElement(id, res, len);
+ }
+
+ int32_t BinaryStringArrayReader::GetSize() const
+ {
+ return size;
+ }
+
+ bool BinaryStringArrayReader::IsNull() const
+ {
+ return size == -1;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/binary/src/binary/binary_raw_reader.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/src/binary/binary_raw_reader.cpp b/modules/platforms/cpp/binary/src/binary/binary_raw_reader.cpp
new file mode 100644
index 0000000..e472588
--- /dev/null
+++ b/modules/platforms/cpp/binary/src/binary/binary_raw_reader.cpp
@@ -0,0 +1,166 @@
+/*
+ * 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/binary/binary_raw_reader.h"
+#include "ignite/impl/binary/binary_reader_impl.h"
+
+using namespace ignite::impl::binary;
+
+namespace ignite
+{
+ namespace binary
+ {
+ BinaryRawReader::BinaryRawReader(BinaryReaderImpl* impl) : impl(impl)
+ {
+ // No-op.
+ }
+
+ int8_t BinaryRawReader::ReadInt8()
+ {
+ return impl->ReadInt8();
+ }
+
+ int32_t BinaryRawReader::ReadInt8Array(int8_t* res, const int32_t len)
+ {
+ return impl->ReadInt8Array(res, len);
+ }
+
+ bool BinaryRawReader::ReadBool()
+ {
+ return impl->ReadBool();
+ }
+
+ int32_t BinaryRawReader::ReadBoolArray(bool* res, const int32_t len)
+ {
+ return impl->ReadBoolArray(res, len);
+ }
+
+ int16_t BinaryRawReader::ReadInt16()
+ {
+ return impl->ReadInt16();
+ }
+
+ int32_t BinaryRawReader::ReadInt16Array(int16_t* res, const int32_t len)
+ {
+ return impl->ReadInt16Array(res, len);
+ }
+
+ uint16_t BinaryRawReader::ReadUInt16()
+ {
+ return impl->ReadUInt16();
+ }
+
+ int32_t BinaryRawReader::ReadUInt16Array(uint16_t* res, const int32_t len)
+ {
+ return impl->ReadUInt16Array(res, len);
+ }
+
+ int32_t BinaryRawReader::ReadInt32()
+ {
+ return impl->ReadInt32();
+ }
+
+ int32_t BinaryRawReader::ReadInt32Array(int32_t* res, const int32_t len)
+ {
+ return impl->ReadInt32Array(res, len);
+ }
+
+ int64_t BinaryRawReader::ReadInt64()
+ {
+ return impl->ReadInt64();
+ }
+
+ int32_t BinaryRawReader::ReadInt64Array(int64_t* res, const int32_t len)
+ {
+ return impl->ReadInt64Array(res, len);
+ }
+
+ float BinaryRawReader::ReadFloat()
+ {
+ return impl->ReadFloat();
+ }
+
+ int32_t BinaryRawReader::ReadFloatArray(float* res, const int32_t len)
+ {
+ return impl->ReadFloatArray(res, len);
+ }
+
+ double BinaryRawReader::ReadDouble()
+ {
+ return impl->ReadDouble();
+ }
+
+ int32_t BinaryRawReader::ReadDoubleArray(double* res, const int32_t len)
+ {
+ return impl->ReadDoubleArray(res, len);
+ }
+
+ Guid BinaryRawReader::ReadGuid()
+ {
+ return impl->ReadGuid();
+ }
+
+ int32_t BinaryRawReader::ReadGuidArray(Guid* res, const int32_t len)
+ {
+ return impl->ReadGuidArray(res, len);
+ }
+
+ Date BinaryRawReader::ReadDate()
+ {
+ return impl->ReadDate();
+ }
+
+ int32_t BinaryRawReader::ReadDateArray(Date* res, int32_t len)
+ {
+ return impl->ReadDateArray(res, len);
+ }
+
+ Timestamp BinaryRawReader::ReadTimestamp()
+ {
+ return impl->ReadTimestamp();
+ }
+
+ int32_t BinaryRawReader::ReadTimestampArray(Timestamp * res, int32_t len)
+ {
+ return impl->ReadTimestampArray(res, len);
+ }
+
+ int32_t BinaryRawReader::ReadString(char* res, const int32_t len)
+ {
+ return impl->ReadString(res, len);
+ }
+
+ BinaryStringArrayReader BinaryRawReader::ReadStringArray()
+ {
+ int32_t size;
+
+ int32_t id = impl->ReadStringArray(&size);
+
+ return BinaryStringArrayReader(impl, id, size);
+ }
+
+ CollectionType BinaryRawReader::ReadCollectionType()
+ {
+ return impl->ReadCollectionType();
+ }
+
+ int32_t BinaryRawReader::ReadCollectionSize()
+ {
+ return impl->ReadCollectionSize();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/binary/src/binary/binary_raw_writer.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/src/binary/binary_raw_writer.cpp b/modules/platforms/cpp/binary/src/binary/binary_raw_writer.cpp
new file mode 100644
index 0000000..a83c74b
--- /dev/null
+++ b/modules/platforms/cpp/binary/src/binary/binary_raw_writer.cpp
@@ -0,0 +1,167 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "ignite/impl/binary/binary_writer_impl.h"
+#include "ignite/binary/binary_raw_writer.h"
+
+using namespace ignite::impl::binary;
+
+namespace ignite
+{
+ namespace binary
+ {
+ BinaryRawWriter::BinaryRawWriter(BinaryWriterImpl* impl) : impl(impl)
+ {
+ // No-op.
+ }
+
+ void BinaryRawWriter::WriteInt8(int8_t val)
+ {
+ impl->WriteInt8(val);
+ }
+
+ void BinaryRawWriter::WriteInt8Array(const int8_t* val, int32_t len)
+ {
+ impl->WriteInt8Array(val, len);
+ }
+
+ void BinaryRawWriter::WriteBool(bool val)
+ {
+ impl->WriteBool(val);
+ }
+
+ void BinaryRawWriter::WriteBoolArray(const bool* val, int32_t len)
+ {
+ impl->WriteBoolArray(val, len);
+ }
+
+ void BinaryRawWriter::WriteInt16(int16_t val)
+ {
+ impl->WriteInt16(val);
+ }
+
+ void BinaryRawWriter::WriteInt16Array(const int16_t* val, int32_t len)
+ {
+ impl->WriteInt16Array(val, len);
+ }
+
+ void BinaryRawWriter::WriteUInt16(uint16_t val)
+ {
+ impl->WriteUInt16(val);
+ }
+
+ void BinaryRawWriter::WriteUInt16Array(const uint16_t* val, int32_t len)
+ {
+ impl->WriteUInt16Array(val, len);
+ }
+
+ void BinaryRawWriter::WriteInt32(int32_t val)
+ {
+ impl->WriteInt32(val);
+ }
+
+ void BinaryRawWriter::WriteInt32Array(const int32_t* val, int32_t len)
+ {
+ impl->WriteInt32Array(val, len);
+ }
+
+ void BinaryRawWriter::WriteInt64(int64_t val)
+ {
+ impl->WriteInt64(val);
+ }
+
+ void BinaryRawWriter::WriteInt64Array(const int64_t* val, int32_t len)
+ {
+ impl->WriteInt64Array(val, len);
+ }
+
+ void BinaryRawWriter::WriteFloat(float val)
+ {
+ impl->WriteFloat(val);
+ }
+
+ void BinaryRawWriter::WriteFloatArray(const float* val, int32_t len)
+ {
+ impl->WriteFloatArray(val, len);
+ }
+
+ void BinaryRawWriter::WriteDouble(double val)
+ {
+ impl->WriteDouble(val);
+ }
+
+ void BinaryRawWriter::WriteDoubleArray(const double* val, int32_t len)
+ {
+ impl->WriteDoubleArray(val, len);
+ }
+
+ void BinaryRawWriter::WriteGuid(const Guid& val)
+ {
+ impl->WriteGuid(val);
+ }
+
+ void BinaryRawWriter::WriteGuidArray(const Guid* val, int32_t len)
+ {
+ impl->WriteGuidArray(val, len);
+ }
+
+ void BinaryRawWriter::WriteDate(const Date& val)
+ {
+ impl->WriteDate(val);
+ }
+
+ void BinaryRawWriter::WriteDateArray(const Date* val, int32_t len)
+ {
+ impl->WriteDateArray(val, len);
+ }
+
+ void BinaryRawWriter::WriteTimestamp(const Timestamp& val)
+ {
+ impl->WriteTimestamp(val);
+ }
+
+ void BinaryRawWriter::WriteTimestampArray(const Timestamp* val, int32_t len)
+ {
+ impl->WriteTimestampArray(val, len);
+ }
+
+ void BinaryRawWriter::WriteString(const char* val)
+ {
+ if (val)
+ WriteString(val, static_cast<int32_t>(strlen(val)));
+ else
+ WriteNull();
+ }
+
+ void BinaryRawWriter::WriteString(const char* val, int32_t len)
+ {
+ impl->WriteString(val, len);
+ }
+
+ BinaryStringArrayWriter BinaryRawWriter::WriteStringArray()
+ {
+ int32_t id = impl->WriteStringArray();
+
+ return BinaryStringArrayWriter(impl, id);
+ }
+
+ void BinaryRawWriter::WriteNull()
+ {
+ impl->WriteNull();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/binary/src/binary/binary_reader.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/src/binary/binary_reader.cpp b/modules/platforms/cpp/binary/src/binary/binary_reader.cpp
new file mode 100644
index 0000000..814db83
--- /dev/null
+++ b/modules/platforms/cpp/binary/src/binary/binary_reader.cpp
@@ -0,0 +1,173 @@
+/*
+ * 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/binary/binary_reader.h"
+#include "ignite/impl/binary/binary_reader_impl.h"
+
+using namespace ignite::impl::binary;
+
+namespace ignite
+{
+ namespace binary
+ {
+ BinaryReader::BinaryReader(BinaryReaderImpl* impl) : impl(impl)
+ {
+ // No-op.
+ }
+
+ int8_t BinaryReader::ReadInt8(const char* fieldName)
+ {
+ return impl->ReadInt8(fieldName);
+ }
+
+ int32_t BinaryReader::ReadInt8Array(const char* fieldName, int8_t* res, int32_t len)
+ {
+ return impl->ReadInt8Array(fieldName, res, len);
+ }
+
+ bool BinaryReader::ReadBool(const char* fieldName)
+ {
+ return impl->ReadBool(fieldName);
+ }
+
+ int32_t BinaryReader::ReadBoolArray(const char* fieldName, bool* res, int32_t len)
+ {
+ return impl->ReadBoolArray(fieldName, res, len);
+ }
+
+ int16_t BinaryReader::ReadInt16(const char* fieldName)
+ {
+ return impl->ReadInt16(fieldName);
+ }
+
+ int32_t BinaryReader::ReadInt16Array(const char* fieldName, int16_t* res, int32_t len)
+ {
+ return impl->ReadInt16Array(fieldName, res, len);
+ }
+
+ uint16_t BinaryReader::ReadUInt16(const char* fieldName)
+ {
+ return impl->ReadUInt16(fieldName);
+ }
+
+ int32_t BinaryReader::ReadUInt16Array(const char* fieldName, uint16_t* res, int32_t len)
+ {
+ return impl->ReadUInt16Array(fieldName, res, len);
+ }
+
+ int32_t BinaryReader::ReadInt32(const char* fieldName)
+ {
+ return impl->ReadInt32(fieldName);
+ }
+
+ int32_t BinaryReader::ReadInt32Array(const char* fieldName, int32_t* res, int32_t len)
+ {
+ return impl->ReadInt32Array(fieldName, res, len);
+ }
+
+ int64_t BinaryReader::ReadInt64(const char* fieldName)
+ {
+ return impl->ReadInt64(fieldName);
+ }
+
+ int32_t BinaryReader::ReadInt64Array(const char* fieldName, int64_t* res, int32_t len)
+ {
+ return impl->ReadInt64Array(fieldName, res, len);
+ }
+
+ float BinaryReader::ReadFloat(const char* fieldName)
+ {
+ return impl->ReadFloat(fieldName);
+ }
+
+ int32_t BinaryReader::ReadFloatArray(const char* fieldName, float* res, int32_t len)
+ {
+ return impl->ReadFloatArray(fieldName, res, len);
+ }
+
+ double BinaryReader::ReadDouble(const char* fieldName)
+ {
+ return impl->ReadDouble(fieldName);
+ }
+
+ int32_t BinaryReader::ReadDoubleArray(const char* fieldName, double* res, int32_t len)
+ {
+ return impl->ReadDoubleArray(fieldName, res, len);
+ }
+
+ Guid BinaryReader::ReadGuid(const char* fieldName)
+ {
+ return impl->ReadGuid(fieldName);
+ }
+
+ int32_t BinaryReader::ReadGuidArray(const char* fieldName, Guid* res, int32_t len)
+ {
+ return impl->ReadGuidArray(fieldName, res, len);
+ }
+
+ Date BinaryReader::ReadDate(const char * fieldName)
+ {
+ return impl->ReadDate(fieldName);
+ }
+
+ int32_t BinaryReader::ReadDateArray(const char * fieldName, Date * res, const int32_t len)
+ {
+ return impl->ReadDateArray(fieldName, res, len);
+ }
+
+ Timestamp BinaryReader::ReadTimestamp(const char * fieldName)
+ {
+ return impl->ReadTimestamp(fieldName);
+ }
+
+ int32_t BinaryReader::ReadTimestampArray(const char * fieldName, Timestamp * res, const int32_t len)
+ {
+ return impl->ReadTimestampArray(fieldName, res, len);
+ }
+
+ int32_t BinaryReader::ReadString(const char* fieldName, char* res, int32_t len)
+ {
+ return impl->ReadString(fieldName, res, len);
+ }
+
+ BinaryStringArrayReader BinaryReader::ReadStringArray(const char* fieldName)
+ {
+ int32_t size;
+
+ int32_t id = impl->ReadStringArray(fieldName, &size);
+
+ return BinaryStringArrayReader(impl, id, size);
+ }
+
+ CollectionType BinaryReader::ReadCollectionType(const char* fieldName)
+ {
+ return impl->ReadCollectionType(fieldName);
+ }
+
+ int32_t BinaryReader::ReadCollectionSize(const char* fieldName)
+ {
+ return impl->ReadCollectionSize(fieldName);
+ }
+
+ BinaryRawReader BinaryReader::RawReader()
+ {
+ impl->SetRawMode();
+
+ return BinaryRawReader(impl);
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/binary/src/binary/binary_type.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/src/binary/binary_type.cpp b/modules/platforms/cpp/binary/src/binary/binary_type.cpp
new file mode 100644
index 0000000..19d906d
--- /dev/null
+++ b/modules/platforms/cpp/binary/src/binary/binary_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/binary/binary_type.h"
+
+namespace ignite
+{
+ namespace binary
+ {
+ int32_t GetBinaryStringHashCode(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/764c97b9/modules/platforms/cpp/binary/src/binary/binary_writer.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/src/binary/binary_writer.cpp b/modules/platforms/cpp/binary/src/binary/binary_writer.cpp
new file mode 100644
index 0000000..efbc0ce
--- /dev/null
+++ b/modules/platforms/cpp/binary/src/binary/binary_writer.cpp
@@ -0,0 +1,174 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "ignite/impl/binary/binary_writer_impl.h"
+#include "ignite/binary/binary_writer.h"
+
+using namespace ignite::impl::binary;
+
+namespace ignite
+{
+ namespace binary
+ {
+ BinaryWriter::BinaryWriter(BinaryWriterImpl* impl) : impl(impl)
+ {
+ // No-op.
+ }
+
+ void BinaryWriter::WriteInt8(const char* fieldName, int8_t val)
+ {
+ impl->WriteInt8(fieldName, val);
+ }
+
+ void BinaryWriter::WriteInt8Array(const char* fieldName, const int8_t* val, int32_t len)
+ {
+ impl->WriteInt8Array(fieldName, val, len);
+ }
+
+ void BinaryWriter::WriteBool(const char* fieldName, bool val)
+ {
+ impl->WriteBool(fieldName, val);
+ }
+
+ void BinaryWriter::WriteBoolArray(const char* fieldName, const bool* val, int32_t len)
+ {
+ impl->WriteBoolArray(fieldName, val, len);
+ }
+
+ void BinaryWriter::WriteInt16(const char* fieldName, int16_t val)
+ {
+ impl->WriteInt16(fieldName, val);
+ }
+
+ void BinaryWriter::WriteInt16Array(const char* fieldName, const int16_t* val, int32_t len)
+ {
+ impl->WriteInt16Array(fieldName, val, len);
+ }
+
+ void BinaryWriter::WriteUInt16(const char* fieldName, uint16_t val)
+ {
+ impl->WriteUInt16(fieldName, val);
+ }
+
+ void BinaryWriter::WriteUInt16Array(const char* fieldName, const uint16_t* val, int32_t len)
+ {
+ impl->WriteUInt16Array(fieldName, val, len);
+ }
+
+ void BinaryWriter::WriteInt32(const char* fieldName, int32_t val)
+ {
+ impl->WriteInt32(fieldName, val);
+ }
+
+ void BinaryWriter::WriteInt32Array(const char* fieldName, const int32_t* val, int32_t len)
+ {
+ impl->WriteInt32Array(fieldName, val, len);
+ }
+
+ void BinaryWriter::WriteInt64(const char* fieldName, const int64_t val)
+ {
+ impl->WriteInt64(fieldName, val);
+ }
+
+ void BinaryWriter::WriteInt64Array(const char* fieldName, const int64_t* val, int32_t len)
+ {
+ impl->WriteInt64Array(fieldName, val, len);
+ }
+
+ void BinaryWriter::WriteFloat(const char* fieldName, float val)
+ {
+ impl->WriteFloat(fieldName, val);
+ }
+
+ void BinaryWriter::WriteFloatArray(const char* fieldName, const float* val, int32_t len)
+ {
+ impl->WriteFloatArray(fieldName, val, len);
+ }
+
+ void BinaryWriter::WriteDouble(const char* fieldName, double val)
+ {
+ impl->WriteDouble(fieldName, val);
+ }
+
+ void BinaryWriter::WriteDoubleArray(const char* fieldName, const double* val, int32_t len)
+ {
+ impl->WriteDoubleArray(fieldName, val, len);
+ }
+
+ void BinaryWriter::WriteGuid(const char* fieldName, const Guid& val)
+ {
+ impl->WriteGuid(fieldName, val);
+ }
+
+ void BinaryWriter::WriteGuidArray(const char* fieldName, const Guid* val, const int32_t len)
+ {
+ impl->WriteGuidArray(fieldName, val, len);
+ }
+
+ void BinaryWriter::WriteDate(const char * fieldName, const Date & val)
+ {
+ impl->WriteDate(fieldName, val);
+ }
+
+ void BinaryWriter::WriteDateArray(const char * fieldName, const Date * val, const int32_t len)
+ {
+ impl->WriteDateArray(fieldName, val, len);
+ }
+
+ void BinaryWriter::WriteTimestamp(const char * fieldName, const Timestamp & val)
+ {
+ impl->WriteTimestamp(fieldName, val);
+ }
+
+ void BinaryWriter::WriteTimestampArray(const char * fieldName, const Timestamp * val, const int32_t len)
+ {
+ impl->WriteTimestampArray(fieldName, val, len);
+ }
+
+ void BinaryWriter::WriteString(const char* fieldName, const char* val)
+ {
+ if (val)
+ WriteString(fieldName, val, static_cast<int32_t>(strlen(val)));
+ else
+ WriteNull(fieldName);
+ }
+
+ void BinaryWriter::WriteString(const char* fieldName, const char* val, int32_t len)
+ {
+ impl->WriteString(fieldName, val, len);
+ }
+
+ BinaryStringArrayWriter BinaryWriter::WriteStringArray(const char* fieldName)
+ {
+ int32_t id = impl->WriteStringArray(fieldName);
+
+ return BinaryStringArrayWriter(impl, id);
+ }
+
+ void BinaryWriter::WriteNull(const char* fieldName)
+ {
+ impl->WriteNull(fieldName);
+ }
+
+ BinaryRawWriter BinaryWriter::RawWriter()
+ {
+ impl->SetRawMode();
+
+ return BinaryRawWriter(impl);
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/binary/src/impl/binary/binary_reader_impl.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/src/impl/binary/binary_reader_impl.cpp b/modules/platforms/cpp/binary/src/impl/binary/binary_reader_impl.cpp
new file mode 100644
index 0000000..1365c47
--- /dev/null
+++ b/modules/platforms/cpp/binary/src/impl/binary/binary_reader_impl.cpp
@@ -0,0 +1,907 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <ignite/ignite_error.h>
+
+#include "ignite/impl/interop/interop.h"
+#include "ignite/impl/interop/interop_stream_position_guard.h"
+#include "ignite/impl/binary/binary_common.h"
+#include "ignite/impl/binary/binary_id_resolver.h"
+#include "ignite/impl/binary/binary_reader_impl.h"
+#include "ignite/impl/binary/binary_utils.h"
+#include "ignite/binary/binary_type.h"
+
+using namespace ignite::impl::interop;
+using namespace ignite::impl::binary;
+using namespace ignite::binary;
+
+namespace ignite
+{
+ namespace impl
+ {
+ namespace binary
+ {
+ BinaryReaderImpl::BinaryReaderImpl(InteropInputStream* stream, BinaryIdResolver* idRslvr,
+ int32_t pos, bool usrType, int32_t typeId, int32_t hashCode, int32_t len, int32_t rawOff,
+ int32_t footerBegin, int32_t footerEnd, BinaryOffsetType schemaType) :
+ stream(stream), idRslvr(idRslvr), pos(pos), usrType(usrType), typeId(typeId),
+ hashCode(hashCode), len(len), rawOff(rawOff), rawMode(false), elemIdGen(0), elemId(0),
+ elemCnt(-1), elemRead(0), footerBegin(footerBegin), footerEnd(footerEnd), schemaType(schemaType)
+ {
+ // No-op.
+ }
+
+ BinaryReaderImpl::BinaryReaderImpl(InteropInputStream* stream) :
+ stream(stream), idRslvr(NULL), pos(0), usrType(false), typeId(0), hashCode(0), len(0),
+ rawOff(0), rawMode(true), elemIdGen(0), elemId(0), elemCnt(-1), elemRead(0), footerBegin(-1),
+ footerEnd(-1), schemaType(OFFSET_TYPE_FOUR_BYTES)
+ {
+ // No-op.
+ }
+
+ int8_t BinaryReaderImpl::ReadInt8()
+ {
+ return ReadRaw<int8_t>(BinaryUtils::ReadInt8);
+ }
+
+ int32_t BinaryReaderImpl::ReadInt8Array(int8_t* res, const int32_t len)
+ {
+ return ReadRawArray<int8_t>(res, len, BinaryUtils::ReadInt8Array, IGNITE_TYPE_ARRAY_BYTE);
+ }
+
+ int8_t BinaryReaderImpl::ReadInt8(const char* fieldName)
+ {
+ return Read(fieldName, BinaryUtils::ReadInt8, IGNITE_TYPE_BYTE, static_cast<int8_t>(0));
+ }
+
+ int32_t BinaryReaderImpl::ReadInt8Array(const char* fieldName, int8_t* res, const int32_t len)
+ {
+ return ReadArray<int8_t>(fieldName, res, len,BinaryUtils::ReadInt8Array, IGNITE_TYPE_ARRAY_BYTE);
+ }
+
+ bool BinaryReaderImpl::ReadBool()
+ {
+ return ReadRaw<bool>(BinaryUtils::ReadBool);
+ }
+
+ int32_t BinaryReaderImpl::ReadBoolArray(bool* res, const int32_t len)
+ {
+ return ReadRawArray<bool>(res, len, BinaryUtils::ReadBoolArray, IGNITE_TYPE_ARRAY_BOOL);
+ }
+
+ bool BinaryReaderImpl::ReadBool(const char* fieldName)
+ {
+ return Read(fieldName, BinaryUtils::ReadBool, IGNITE_TYPE_BOOL, static_cast<bool>(0));
+ }
+
+ int32_t BinaryReaderImpl::ReadBoolArray(const char* fieldName, bool* res, const int32_t len)
+ {
+ return ReadArray<bool>(fieldName, res, len,BinaryUtils::ReadBoolArray, IGNITE_TYPE_ARRAY_BOOL);
+ }
+
+ int16_t BinaryReaderImpl::ReadInt16()
+ {
+ return ReadRaw<int16_t>(BinaryUtils::ReadInt16);
+ }
+
+ int32_t BinaryReaderImpl::ReadInt16Array(int16_t* res, const int32_t len)
+ {
+ return ReadRawArray<int16_t>(res, len, BinaryUtils::ReadInt16Array, IGNITE_TYPE_ARRAY_SHORT);
+ }
+
+ int16_t BinaryReaderImpl::ReadInt16(const char* fieldName)
+ {
+ return Read(fieldName, BinaryUtils::ReadInt16, IGNITE_TYPE_SHORT, static_cast<int16_t>(0));
+ }
+
+ int32_t BinaryReaderImpl::ReadInt16Array(const char* fieldName, int16_t* res, const int32_t len)
+ {
+ return ReadArray<int16_t>(fieldName, res, len, BinaryUtils::ReadInt16Array, IGNITE_TYPE_ARRAY_SHORT);
+ }
+
+ uint16_t BinaryReaderImpl::ReadUInt16()
+ {
+ return ReadRaw<uint16_t>(BinaryUtils::ReadUInt16);
+ }
+
+ int32_t BinaryReaderImpl::ReadUInt16Array(uint16_t* res, const int32_t len)
+ {
+ return ReadRawArray<uint16_t>(res, len, BinaryUtils::ReadUInt16Array, IGNITE_TYPE_ARRAY_CHAR);
+ }
+
+ uint16_t BinaryReaderImpl::ReadUInt16(const char* fieldName)
+ {
+ return Read(fieldName, BinaryUtils::ReadUInt16, IGNITE_TYPE_CHAR, static_cast<uint16_t>(0));
+ }
+
+ int32_t BinaryReaderImpl::ReadUInt16Array(const char* fieldName, uint16_t* res, const int32_t len)
+ {
+ return ReadArray<uint16_t>(fieldName, res, len,BinaryUtils::ReadUInt16Array, IGNITE_TYPE_ARRAY_CHAR);
+ }
+
+ int32_t BinaryReaderImpl::ReadInt32()
+ {
+ return ReadRaw<int32_t>(BinaryUtils::ReadInt32);
+ }
+
+ int32_t BinaryReaderImpl::ReadInt32Array(int32_t* res, const int32_t len)
+ {
+ return ReadRawArray<int32_t>(res, len, BinaryUtils::ReadInt32Array, IGNITE_TYPE_ARRAY_INT);
+ }
+
+ int32_t BinaryReaderImpl::ReadInt32(const char* fieldName)
+ {
+ return Read(fieldName, BinaryUtils::ReadInt32, IGNITE_TYPE_INT, static_cast<int32_t>(0));
+ }
+
+ int32_t BinaryReaderImpl::ReadInt32Array(const char* fieldName, int32_t* res, const int32_t len)
+ {
+ return ReadArray<int32_t>(fieldName, res, len,BinaryUtils::ReadInt32Array, IGNITE_TYPE_ARRAY_INT);
+ }
+
+ int64_t BinaryReaderImpl::ReadInt64()
+ {
+ return ReadRaw<int64_t>(BinaryUtils::ReadInt64);
+ }
+
+ int32_t BinaryReaderImpl::ReadInt64Array(int64_t* res, const int32_t len)
+ {
+ return ReadRawArray<int64_t>(res, len, BinaryUtils::ReadInt64Array, IGNITE_TYPE_ARRAY_LONG);
+ }
+
+ int64_t BinaryReaderImpl::ReadInt64(const char* fieldName)
+ {
+ return Read(fieldName, BinaryUtils::ReadInt64, IGNITE_TYPE_LONG, static_cast<int64_t>(0));
+ }
+
+ int32_t BinaryReaderImpl::ReadInt64Array(const char* fieldName, int64_t* res, const int32_t len)
+ {
+ return ReadArray<int64_t>(fieldName, res, len,BinaryUtils::ReadInt64Array, IGNITE_TYPE_ARRAY_LONG);
+ }
+
+ float BinaryReaderImpl::ReadFloat()
+ {
+ return ReadRaw<float>(BinaryUtils::ReadFloat);
+ }
+
+ int32_t BinaryReaderImpl::ReadFloatArray(float* res, const int32_t len)
+ {
+ return ReadRawArray<float>(res, len, BinaryUtils::ReadFloatArray, IGNITE_TYPE_ARRAY_FLOAT);
+ }
+
+ float BinaryReaderImpl::ReadFloat(const char* fieldName)
+ {
+ return Read(fieldName, BinaryUtils::ReadFloat, IGNITE_TYPE_FLOAT, static_cast<float>(0));
+ }
+
+ int32_t BinaryReaderImpl::ReadFloatArray(const char* fieldName, float* res, const int32_t len)
+ {
+ return ReadArray<float>(fieldName, res, len,BinaryUtils::ReadFloatArray, IGNITE_TYPE_ARRAY_FLOAT);
+ }
+
+ double BinaryReaderImpl::ReadDouble()
+ {
+ return ReadRaw<double>(BinaryUtils::ReadDouble);
+ }
+
+ int32_t BinaryReaderImpl::ReadDoubleArray(double* res, const int32_t len)
+ {
+ return ReadRawArray<double>(res, len, BinaryUtils::ReadDoubleArray, IGNITE_TYPE_ARRAY_DOUBLE);
+ }
+
+ double BinaryReaderImpl::ReadDouble(const char* fieldName)
+ {
+ return Read(fieldName, BinaryUtils::ReadDouble, IGNITE_TYPE_DOUBLE, static_cast<double>(0));
+ }
+
+ int32_t BinaryReaderImpl::ReadDoubleArray(const char* fieldName, double* res, const int32_t len)
+ {
+ return ReadArray<double>(fieldName, res, len,BinaryUtils::ReadDoubleArray, IGNITE_TYPE_ARRAY_DOUBLE);
+ }
+
+ Guid BinaryReaderImpl::ReadGuid()
+ {
+ CheckRawMode(true);
+ CheckSingleMode(true);
+
+ return ReadNullable(stream, BinaryUtils::ReadGuid, IGNITE_TYPE_UUID);
+ }
+
+ int32_t BinaryReaderImpl::ReadGuidArray(Guid* res, const int32_t len)
+ {
+ CheckRawMode(true);
+ CheckSingleMode(true);
+
+ return ReadArrayInternal<Guid>(res, len, stream, ReadGuidArrayInternal, IGNITE_TYPE_ARRAY_UUID);
+ }
+
+ Guid BinaryReaderImpl::ReadGuid(const char* fieldName)
+ {
+ CheckRawMode(false);
+ CheckSingleMode(true);
+
+ int32_t fieldId = idRslvr->GetFieldId(typeId, fieldName);
+ int32_t fieldPos = FindField(fieldId);
+
+ if (fieldPos <= 0)
+ return Guid();
+
+ stream->Position(fieldPos);
+
+ return ReadNullable(stream, BinaryUtils::ReadGuid, IGNITE_TYPE_UUID);
+ }
+
+ int32_t BinaryReaderImpl::ReadGuidArray(const char* fieldName, Guid* res, const int32_t len)
+ {
+ CheckRawMode(false);
+ CheckSingleMode(true);
+
+ int32_t fieldId = idRslvr->GetFieldId(typeId, fieldName);
+ int32_t fieldPos = FindField(fieldId);
+
+ if (fieldPos <= 0)
+ return -1;
+
+ stream->Position(fieldPos);
+
+ int32_t realLen = ReadArrayInternal<Guid>(res, len, stream, ReadGuidArrayInternal, IGNITE_TYPE_ARRAY_UUID);
+
+ return realLen;
+ }
+
+ void BinaryReaderImpl::ReadGuidArrayInternal(InteropInputStream* stream, Guid* res, const int32_t len)
+ {
+ for (int i = 0; i < len; i++)
+ *(res + i) = ReadNullable<Guid>(stream, BinaryUtils::ReadGuid, IGNITE_TYPE_UUID);
+ }
+
+ Date BinaryReaderImpl::ReadDate()
+ {
+ CheckRawMode(true);
+ CheckSingleMode(true);
+
+ return ReadNullable(stream, BinaryUtils::ReadDate, IGNITE_TYPE_DATE);
+ }
+
+ int32_t BinaryReaderImpl::ReadDateArray(Date* res, int32_t len)
+ {
+ CheckRawMode(true);
+ CheckSingleMode(true);
+
+ return ReadArrayInternal<Date>(res, len, stream, ReadDateArrayInternal, IGNITE_TYPE_ARRAY_DATE);
+ }
+
+ Date BinaryReaderImpl::ReadDate(const char* fieldName)
+ {
+ CheckRawMode(false);
+ CheckSingleMode(true);
+
+ int32_t fieldId = idRslvr->GetFieldId(typeId, fieldName);
+ int32_t fieldPos = FindField(fieldId);
+
+ if (fieldPos <= 0)
+ return Date();
+
+ stream->Position(fieldPos);
+
+ return ReadNullable(stream, BinaryUtils::ReadDate, IGNITE_TYPE_DATE);
+ }
+
+ int32_t BinaryReaderImpl::ReadDateArray(const char* fieldName, Date* res, const int32_t len)
+ {
+ CheckRawMode(false);
+ CheckSingleMode(true);
+
+ int32_t fieldId = idRslvr->GetFieldId(typeId, fieldName);
+ int32_t fieldPos = FindField(fieldId);
+
+ if (fieldPos <= 0)
+ return -1;
+
+ stream->Position(fieldPos);
+
+ int32_t realLen = ReadArrayInternal<Date>(res, len, stream, ReadDateArrayInternal, IGNITE_TYPE_ARRAY_DATE);
+
+ return realLen;
+ }
+
+ void BinaryReaderImpl::ReadDateArrayInternal(InteropInputStream* stream, Date* res, const int32_t len)
+ {
+ for (int i = 0; i < len; i++)
+ *(res + i) = ReadNullable<Date>(stream, BinaryUtils::ReadDate, IGNITE_TYPE_DATE);
+ }
+
+ Timestamp BinaryReaderImpl::ReadTimestamp()
+ {
+ CheckRawMode(true);
+ CheckSingleMode(true);
+
+ return ReadNullable(stream, BinaryUtils::ReadTimestamp, IGNITE_TYPE_TIMESTAMP);
+ }
+
+ int32_t BinaryReaderImpl::ReadTimestampArray(Timestamp* res, int32_t len)
+ {
+ CheckRawMode(true);
+ CheckSingleMode(true);
+
+ return ReadArrayInternal<Timestamp>(res, len, stream, ReadTimestampArrayInternal, IGNITE_TYPE_ARRAY_TIMESTAMP);
+ }
+
+ Timestamp BinaryReaderImpl::ReadTimestamp(const char* fieldName)
+ {
+ CheckRawMode(false);
+ CheckSingleMode(true);
+
+ int32_t fieldId = idRslvr->GetFieldId(typeId, fieldName);
+ int32_t fieldPos = FindField(fieldId);
+
+ if (fieldPos <= 0)
+ return Timestamp();
+
+ stream->Position(fieldPos);
+
+ return ReadNullable(stream, BinaryUtils::ReadTimestamp, IGNITE_TYPE_TIMESTAMP);
+ }
+
+ int32_t BinaryReaderImpl::ReadTimestampArray(const char* fieldName, Timestamp* res, const int32_t len)
+ {
+ CheckRawMode(false);
+ CheckSingleMode(true);
+
+ int32_t fieldId = idRslvr->GetFieldId(typeId, fieldName);
+ int32_t fieldPos = FindField(fieldId);
+
+ if (fieldPos <= 0)
+ return -1;
+
+ stream->Position(fieldPos);
+
+ int32_t realLen = ReadArrayInternal<Timestamp>(res, len, stream, ReadTimestampArrayInternal, IGNITE_TYPE_ARRAY_TIMESTAMP);
+
+ return realLen;
+ }
+
+ void BinaryReaderImpl::ReadTimestampArrayInternal(interop::InteropInputStream* stream, Timestamp* res, const int32_t len)
+ {
+ for (int i = 0; i < len; i++)
+ *(res + i) = ReadNullable<Timestamp>(stream, BinaryUtils::ReadTimestamp, IGNITE_TYPE_TIMESTAMP);
+ }
+
+ int32_t BinaryReaderImpl::ReadString(char* res, const int32_t len)
+ {
+ CheckRawMode(true);
+ CheckSingleMode(true);
+
+ return ReadStringInternal(res, len);
+ }
+
+ int32_t BinaryReaderImpl::ReadString(const char* fieldName, char* res, const int32_t len)
+ {
+ CheckRawMode(false);
+ CheckSingleMode(true);
+
+ int32_t fieldId = idRslvr->GetFieldId(typeId, fieldName);
+ int32_t fieldPos = FindField(fieldId);
+
+ if (fieldPos <= 0)
+ return -1;
+
+ stream->Position(fieldPos);
+
+ int32_t realLen = ReadStringInternal(res, len);
+
+ return realLen;
+ }
+
+ int32_t BinaryReaderImpl::ReadStringArray(int32_t* size)
+ {
+ return StartContainerSession(true, IGNITE_TYPE_ARRAY_STRING, size);
+ }
+
+ int32_t BinaryReaderImpl::ReadStringArray(const char* fieldName, int32_t* size)
+ {
+ CheckRawMode(false);
+ CheckSingleMode(true);
+
+ int32_t fieldId = idRslvr->GetFieldId(typeId, fieldName);
+ int32_t fieldPos = FindField(fieldId);
+
+ if (fieldPos <= 0)
+ {
+ *size = -1;
+
+ return ++elemIdGen;
+ }
+
+ stream->Position(fieldPos);
+
+ return StartContainerSession(false, IGNITE_TYPE_ARRAY_STRING, size);
+ }
+
+ int32_t BinaryReaderImpl::ReadStringElement(int32_t id, char* res, const int32_t len)
+ {
+ CheckSession(id);
+
+ int32_t posBefore = stream->Position();
+
+ int32_t realLen = ReadStringInternal(res, len);
+
+ int32_t posAfter = stream->Position();
+
+ if (posAfter > posBefore && ++elemRead == elemCnt) {
+ elemId = 0;
+ elemCnt = -1;
+ elemRead = 0;
+ }
+
+ return realLen;
+ }
+
+ int32_t BinaryReaderImpl::ReadStringInternal(char* res, const int32_t len)
+ {
+ int8_t hdr = stream->ReadInt8();
+
+ if (hdr == IGNITE_TYPE_STRING) {
+ int32_t realLen = stream->ReadInt32();
+
+ if (res && len >= realLen) {
+ for (int i = 0; i < realLen; i++)
+ *(res + i) = static_cast<char>(stream->ReadInt8());
+
+ if (len > realLen)
+ *(res + realLen) = 0; // Set NULL terminator if possible.
+ }
+ else
+ stream->Position(stream->Position() - 4 - 1);
+
+ return realLen;
+ }
+ else if (hdr != IGNITE_HDR_NULL)
+ ThrowOnInvalidHeader(IGNITE_TYPE_ARRAY, hdr);
+
+ return -1;
+ }
+
+ int32_t BinaryReaderImpl::ReadArray(int32_t* size)
+ {
+ return StartContainerSession(true, IGNITE_TYPE_ARRAY, size);
+ }
+
+ int32_t BinaryReaderImpl::ReadArray(const char* fieldName, int32_t* size)
+ {
+ CheckRawMode(false);
+ CheckSingleMode(true);
+
+ int32_t fieldId = idRslvr->GetFieldId(typeId, fieldName);
+ int32_t fieldPos = FindField(fieldId);
+
+ if (fieldPos <= 0)
+ {
+ *size = -1;
+
+ return ++elemIdGen;
+ }
+
+ stream->Position(fieldPos);
+
+ return StartContainerSession(false, IGNITE_TYPE_ARRAY, size);
+ }
+
+ int32_t BinaryReaderImpl::ReadCollection(CollectionType* typ, int32_t* size)
+ {
+ int32_t id = StartContainerSession(true, IGNITE_TYPE_COLLECTION, size);
+
+ if (*size == -1)
+ *typ = IGNITE_COLLECTION_UNDEFINED;
+ else
+ *typ = static_cast<CollectionType>(stream->ReadInt8());
+
+ return id;
+ }
+
+ int32_t BinaryReaderImpl::ReadCollection(const char* fieldName, CollectionType* typ, int32_t* size)
+ {
+ CheckRawMode(false);
+ CheckSingleMode(true);
+
+ int32_t fieldId = idRslvr->GetFieldId(typeId, fieldName);
+ int32_t fieldPos = FindField(fieldId);
+
+ if (fieldPos <= 0)
+ {
+ *typ = IGNITE_COLLECTION_UNDEFINED;
+ *size = -1;
+
+ return ++elemIdGen;
+ }
+
+ stream->Position(fieldPos);
+
+ int32_t id = StartContainerSession(false, IGNITE_TYPE_COLLECTION, size);
+
+ if (*size == -1)
+ *typ = IGNITE_COLLECTION_UNDEFINED;
+ else
+ *typ = static_cast<CollectionType>(stream->ReadInt8());
+
+ return id;
+ }
+
+ int32_t BinaryReaderImpl::ReadMap(MapType* typ, int32_t* size)
+ {
+ int32_t id = StartContainerSession(true, IGNITE_TYPE_MAP, size);
+
+ if (*size == -1)
+ *typ = IGNITE_MAP_UNDEFINED;
+ else
+ *typ = static_cast<MapType>(stream->ReadInt8());
+
+ return id;
+ }
+
+ int32_t BinaryReaderImpl::ReadMap(const char* fieldName, MapType* typ, int32_t* size)
+ {
+ CheckRawMode(false);
+ CheckSingleMode(true);
+
+ int32_t fieldId = idRslvr->GetFieldId(typeId, fieldName);
+ int32_t fieldPos = FindField(fieldId);
+
+ if (fieldPos <= 0)
+ {
+ *typ = IGNITE_MAP_UNDEFINED;
+ *size = -1;
+
+ return ++elemIdGen;
+ }
+
+ stream->Position(fieldPos);
+
+ int32_t id = StartContainerSession(false, IGNITE_TYPE_MAP, size);
+
+ if (*size == -1)
+ *typ = IGNITE_MAP_UNDEFINED;
+ else
+ *typ = static_cast<MapType>(stream->ReadInt8());
+
+ return id;
+ }
+
+ CollectionType BinaryReaderImpl::ReadCollectionTypeUnprotected()
+ {
+ int32_t size = ReadCollectionSizeUnprotected();
+ if (size == -1)
+ return IGNITE_COLLECTION_UNDEFINED;
+
+ CollectionType typ = static_cast<CollectionType>(stream->ReadInt8());
+
+ return typ;
+ }
+
+ CollectionType BinaryReaderImpl::ReadCollectionType()
+ {
+ InteropStreamPositionGuard<InteropInputStream> positionGuard(*stream);
+
+ return ReadCollectionTypeUnprotected();
+ }
+
+ CollectionType BinaryReaderImpl::ReadCollectionType(const char* fieldName)
+ {
+ CheckRawMode(false);
+ CheckSingleMode(true);
+
+ InteropStreamPositionGuard<InteropInputStream> positionGuard(*stream);
+
+ int32_t fieldId = idRslvr->GetFieldId(typeId, fieldName);
+ int32_t fieldPos = FindField(fieldId);
+
+ if (fieldPos <= 0)
+ return IGNITE_COLLECTION_UNDEFINED;
+
+ stream->Position(fieldPos);
+
+ return ReadCollectionTypeUnprotected();
+ }
+
+ int32_t BinaryReaderImpl::ReadCollectionSizeUnprotected()
+ {
+ int8_t hdr = stream->ReadInt8();
+
+ if (hdr != IGNITE_TYPE_COLLECTION)
+ {
+ if (hdr != IGNITE_HDR_NULL)
+ ThrowOnInvalidHeader(IGNITE_TYPE_COLLECTION, hdr);
+
+ return -1;
+ }
+
+ int32_t size = stream->ReadInt32();
+
+ return size;
+ }
+
+ int32_t BinaryReaderImpl::ReadCollectionSize()
+ {
+ InteropStreamPositionGuard<InteropInputStream> positionGuard(*stream);
+
+ return ReadCollectionSizeUnprotected();
+ }
+
+ int32_t BinaryReaderImpl::ReadCollectionSize(const char* fieldName)
+ {
+ CheckRawMode(false);
+ CheckSingleMode(true);
+
+ InteropStreamPositionGuard<InteropInputStream> positionGuard(*stream);
+
+ int32_t fieldId = idRslvr->GetFieldId(typeId, fieldName);
+ int32_t fieldPos = FindField(fieldId);
+
+ if (fieldPos <= 0)
+ return -1;
+
+ stream->Position(fieldPos);
+
+ return ReadCollectionSizeUnprotected();
+ }
+
+ bool BinaryReaderImpl::HasNextElement(int32_t id) const
+ {
+ return elemId == id && elemRead < elemCnt;
+ }
+
+ void BinaryReaderImpl::SetRawMode()
+ {
+ CheckRawMode(false);
+ CheckSingleMode(true);
+
+ stream->Position(pos + rawOff);
+ rawMode = true;
+ }
+
+ template <>
+ int8_t BinaryReaderImpl::ReadTopObject<int8_t>()
+ {
+ return ReadTopObject0(IGNITE_TYPE_BYTE, BinaryUtils::ReadInt8, static_cast<int8_t>(0));
+ }
+
+ template <>
+ bool BinaryReaderImpl::ReadTopObject<bool>()
+ {
+ return ReadTopObject0(IGNITE_TYPE_BOOL, BinaryUtils::ReadBool, static_cast<bool>(0));
+ }
+
+ template <>
+ int16_t BinaryReaderImpl::ReadTopObject<int16_t>()
+ {
+ return ReadTopObject0(IGNITE_TYPE_SHORT, BinaryUtils::ReadInt16, static_cast<int16_t>(0));
+ }
+
+ template <>
+ uint16_t BinaryReaderImpl::ReadTopObject<uint16_t>()
+ {
+ return ReadTopObject0(IGNITE_TYPE_CHAR, BinaryUtils::ReadUInt16, static_cast<uint16_t>(0));
+ }
+
+ template <>
+ int32_t BinaryReaderImpl::ReadTopObject<int32_t>()
+ {
+ return ReadTopObject0(IGNITE_TYPE_INT, BinaryUtils::ReadInt32, static_cast<int32_t>(0));
+ }
+
+ template <>
+ int64_t BinaryReaderImpl::ReadTopObject<int64_t>()
+ {
+ return ReadTopObject0(IGNITE_TYPE_LONG, BinaryUtils::ReadInt64, static_cast<int64_t>(0));
+ }
+
+ template <>
+ float BinaryReaderImpl::ReadTopObject<float>()
+ {
+ return ReadTopObject0(IGNITE_TYPE_FLOAT, BinaryUtils::ReadFloat, static_cast<float>(0));
+ }
+
+ template <>
+ double BinaryReaderImpl::ReadTopObject<double>()
+ {
+ return ReadTopObject0(IGNITE_TYPE_DOUBLE, BinaryUtils::ReadDouble, static_cast<double>(0));
+ }
+
+ template <>
+ Guid BinaryReaderImpl::ReadTopObject<Guid>()
+ {
+ int8_t typeId = stream->ReadInt8();
+
+ if (typeId == IGNITE_TYPE_UUID)
+ return BinaryUtils::ReadGuid(stream);
+ else if (typeId == IGNITE_HDR_NULL)
+ return Guid();
+ else {
+ int32_t pos = stream->Position() - 1;
+
+ IGNITE_ERROR_FORMATTED_3(IgniteError::IGNITE_ERR_BINARY, "Invalid header", "position", pos, "expected", IGNITE_TYPE_UUID, "actual", typeId)
+ }
+ }
+
+ template <>
+ Date BinaryReaderImpl::ReadTopObject<Date>()
+ {
+ int8_t typeId = stream->ReadInt8();
+
+ if (typeId == IGNITE_TYPE_DATE)
+ return BinaryUtils::ReadDate(stream);
+ else if (typeId == IGNITE_TYPE_TIMESTAMP)
+ return Date(BinaryUtils::ReadTimestamp(stream).GetMilliseconds());
+ else if (typeId == IGNITE_HDR_NULL)
+ return Date();
+ else {
+ int32_t pos = stream->Position() - 1;
+
+ IGNITE_ERROR_FORMATTED_3(IgniteError::IGNITE_ERR_BINARY, "Invalid header", "position", pos, "expected", (int)IGNITE_TYPE_DATE, "actual", (int)typeId)
+ }
+ }
+
+ template <>
+ Timestamp BinaryReaderImpl::ReadTopObject<Timestamp>()
+ {
+ int8_t typeId = stream->ReadInt8();
+
+ if (typeId == IGNITE_TYPE_TIMESTAMP)
+ return BinaryUtils::ReadTimestamp(stream);
+ else if (typeId == IGNITE_HDR_NULL)
+ return Timestamp();
+ else {
+ int32_t pos = stream->Position() - 1;
+
+ IGNITE_ERROR_FORMATTED_3(IgniteError::IGNITE_ERR_BINARY, "Invalid header", "position", pos, "expected", (int)IGNITE_TYPE_TIMESTAMP, "actual", (int)typeId)
+ }
+ }
+
+ InteropInputStream* BinaryReaderImpl::GetStream()
+ {
+ return stream;
+ }
+
+ int32_t BinaryReaderImpl::FindField(const int32_t fieldId)
+ {
+ InteropStreamPositionGuard<InteropInputStream> streamGuard(*stream);
+
+ stream->Position(footerBegin);
+
+ switch (schemaType)
+ {
+ case OFFSET_TYPE_ONE_BYTE:
+ {
+ for (int32_t schemaPos = footerBegin; schemaPos < footerEnd; schemaPos += 5)
+ {
+ int32_t currentFieldId = stream->ReadInt32(schemaPos);
+
+ if (fieldId == currentFieldId)
+ return static_cast<uint8_t>(stream->ReadInt8(schemaPos + 4)) + pos;
+ }
+ break;
+ }
+
+ case OFFSET_TYPE_TWO_BYTES:
+ {
+ for (int32_t schemaPos = footerBegin; schemaPos < footerEnd; schemaPos += 6)
+ {
+ int32_t currentFieldId = stream->ReadInt32(schemaPos);
+
+ if (fieldId == currentFieldId)
+ return static_cast<uint16_t>(stream->ReadInt16(schemaPos + 4)) + pos;
+ }
+ break;
+ }
+
+ case OFFSET_TYPE_FOUR_BYTES:
+ {
+ for (int32_t schemaPos = footerBegin; schemaPos < footerEnd; schemaPos += 8)
+ {
+ int32_t currentFieldId = stream->ReadInt32(schemaPos);
+
+ if (fieldId == currentFieldId)
+ return stream->ReadInt32(schemaPos + 4) + pos;
+ }
+ break;
+ }
+ }
+
+ return -1;
+ }
+
+ void BinaryReaderImpl::CheckRawMode(bool expected) const
+ {
+ if (expected && !rawMode) {
+ IGNITE_ERROR_1(IgniteError::IGNITE_ERR_BINARY, "Operation can be performed only in raw mode.")
+ }
+ else if (!expected && rawMode) {
+ IGNITE_ERROR_1(IgniteError::IGNITE_ERR_BINARY, "Operation cannot be performed in raw mode.")
+ }
+ }
+
+ void BinaryReaderImpl::CheckSingleMode(bool expected) const
+ {
+ if (expected && elemId != 0) {
+ IGNITE_ERROR_1(IgniteError::IGNITE_ERR_BINARY, "Operation cannot be performed when container is being read.");
+ }
+ else if (!expected && elemId == 0) {
+ IGNITE_ERROR_1(IgniteError::IGNITE_ERR_BINARY, "Operation can be performed only when container is being read.");
+ }
+ }
+
+ int32_t BinaryReaderImpl::StartContainerSession(bool expRawMode, int8_t expHdr, int32_t* size)
+ {
+ CheckRawMode(expRawMode);
+ CheckSingleMode(true);
+
+ int8_t hdr = stream->ReadInt8();
+
+ if (hdr == expHdr)
+ {
+ int32_t cnt = stream->ReadInt32();
+
+ if (cnt != 0)
+ {
+ elemId = ++elemIdGen;
+ elemCnt = cnt;
+ elemRead = 0;
+
+ *size = cnt;
+
+ return elemId;
+ }
+ else
+ {
+ *size = 0;
+
+ return ++elemIdGen;
+ }
+ }
+ else if (hdr == IGNITE_HDR_NULL) {
+ *size = -1;
+
+ return ++elemIdGen;
+ }
+ else {
+ ThrowOnInvalidHeader(expHdr, hdr);
+
+ return 0;
+ }
+ }
+
+ void BinaryReaderImpl::CheckSession(int32_t expSes) const
+ {
+ if (elemId != expSes) {
+ IGNITE_ERROR_1(IgniteError::IGNITE_ERR_BINARY, "Containter read session has been finished or is not started yet.");
+ }
+ }
+
+ void BinaryReaderImpl::ThrowOnInvalidHeader(int32_t pos, int8_t expHdr, int8_t hdr)
+ {
+ IGNITE_ERROR_FORMATTED_3(IgniteError::IGNITE_ERR_BINARY, "Invalid header", "position", pos, "expected", expHdr, "actual", hdr)
+ }
+
+ void BinaryReaderImpl::ThrowOnInvalidHeader(int8_t expHdr, int8_t hdr) const
+ {
+ int32_t pos = stream->Position() - 1;
+
+ ThrowOnInvalidHeader(pos, expHdr, hdr);
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/binary/src/impl/binary/binary_schema.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/src/impl/binary/binary_schema.cpp b/modules/platforms/cpp/binary/src/impl/binary/binary_schema.cpp
new file mode 100644
index 0000000..0b8025a
--- /dev/null
+++ b/modules/platforms/cpp/binary/src/impl/binary/binary_schema.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 <cassert>
+
+#include "ignite/impl/binary/binary_schema.h"
+#include "ignite/impl/binary/binary_writer_impl.h"
+
+/** FNV1 hash offset basis. */
+enum { FNV1_OFFSET_BASIS = 0x811C9DC5 };
+
+/** FNV1 hash prime. */
+enum { FNV1_PRIME = 0x01000193 };
+
+namespace ignite
+{
+ namespace impl
+ {
+ namespace binary
+ {
+ BinarySchema::BinarySchema(): id(0), fieldsInfo(new FieldContainer())
+ {
+ // No-op.
+ }
+
+ BinarySchema::~BinarySchema()
+ {
+ delete fieldsInfo;
+ }
+
+ void BinarySchema::AddField(int32_t fieldId, int32_t offset)
+ {
+ if (!id)
+ {
+ // Initialize offset when the first field is written.
+ id = FNV1_OFFSET_BASIS;
+ }
+
+ // Advance schema hash.
+ int32_t idAccumulator = id ^ (fieldId & 0xFF);
+ idAccumulator *= FNV1_PRIME;
+ idAccumulator ^= (fieldId >> 8) & 0xFF;
+ idAccumulator *= FNV1_PRIME;
+ idAccumulator ^= (fieldId >> 16) & 0xFF;
+ idAccumulator *= FNV1_PRIME;
+ idAccumulator ^= (fieldId >> 24) & 0xFF;
+ idAccumulator *= FNV1_PRIME;
+
+ id = idAccumulator;
+
+ BinarySchemaFieldInfo info = { fieldId, offset };
+ fieldsInfo->push_back(info);
+ }
+
+ void BinarySchema::Write(interop::InteropOutputStream& out) const
+ {
+ switch (GetType())
+ {
+ case OFFSET_TYPE_ONE_BYTE:
+ {
+ for (FieldContainer::const_iterator i = fieldsInfo->begin(); i != fieldsInfo->end(); ++i)
+ {
+ out.WriteInt32(i->id);
+ out.WriteInt8(static_cast<int8_t>(i->offset));
+ }
+ break;
+ }
+
+ case OFFSET_TYPE_TWO_BYTES:
+ {
+ for (FieldContainer::const_iterator i = fieldsInfo->begin(); i != fieldsInfo->end(); ++i)
+ {
+ out.WriteInt32(i->id);
+ out.WriteInt16(static_cast<int16_t>(i->offset));
+ }
+ break;
+ }
+
+ case OFFSET_TYPE_FOUR_BYTES:
+ {
+ for (FieldContainer::const_iterator i = fieldsInfo->begin(); i != fieldsInfo->end(); ++i)
+ {
+ out.WriteInt32(i->id);
+ out.WriteInt32(i->offset);
+ }
+ break;
+ }
+
+ default:
+ {
+ assert(false);
+ break;
+ }
+ }
+ }
+
+ bool BinarySchema::Empty() const
+ {
+ return fieldsInfo->empty();
+ }
+
+ void BinarySchema::Clear()
+ {
+ id = 0;
+ fieldsInfo->clear();
+ }
+
+ BinaryOffsetType BinarySchema::GetType() const
+ {
+ int32_t maxOffset = fieldsInfo->back().offset;
+
+ if (maxOffset < 0x100)
+ return OFFSET_TYPE_ONE_BYTE;
+ else if (maxOffset < 0x10000)
+ return OFFSET_TYPE_TWO_BYTES;
+
+ return OFFSET_TYPE_FOUR_BYTES;
+ }
+ }
+ }
+}
\ No newline at end of file