http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/common/src/timestamp.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/common/src/timestamp.cpp b/modules/platforms/cpp/common/src/timestamp.cpp new file mode 100644 index 0000000..e554950 --- /dev/null +++ b/modules/platforms/cpp/common/src/timestamp.cpp @@ -0,0 +1,117 @@ +/* + * 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/timestamp.h" + +namespace ignite +{ + Timestamp::Timestamp() : + seconds(0), + fractionNs(0) + { + // No-op. + } + + Timestamp::Timestamp(const Timestamp& another) : + seconds(another.seconds), + fractionNs(another.fractionNs) + { + // No-op. + } + + Timestamp::Timestamp(int64_t ms) : + seconds(ms / 1000), + fractionNs((ms % 1000) * 1000000) + { + // No-op. + } + + Timestamp::Timestamp(int64_t seconds, int32_t fractionNs) : + seconds(seconds), + fractionNs(fractionNs) + { + // No-op. + } + + Timestamp& Timestamp::operator=(const Timestamp& another) + { + seconds = another.seconds; + fractionNs = another.fractionNs; + + return *this; + } + + int64_t Timestamp::GetMilliseconds() const + { + return seconds * 1000 + fractionNs / 1000000; + } + + int64_t Timestamp::GetSeconds() const + { + return seconds; + } + + int32_t Timestamp::GetSecondFraction() const + { + return fractionNs; + } + + Date Timestamp::GetDate() const + { + return Date(GetMilliseconds()); + } + + bool operator==(const Timestamp& val1, const Timestamp& val2) + { + return val1.seconds == val2.seconds && + val1.fractionNs == val2.fractionNs; + } + + bool operator!=(const Timestamp& val1, const Timestamp& val2) + { + return val1.seconds != val2.seconds || + val1.fractionNs != val2.fractionNs; + } + + bool operator<(const Timestamp& val1, const Timestamp& val2) + { + return val1.seconds < val2.seconds || + (val1.seconds == val2.seconds && + val1.fractionNs < val2.fractionNs); + } + + bool operator<=(const Timestamp& val1, const Timestamp& val2) + { + return val1.seconds < val2.seconds || + (val1.seconds == val2.seconds && + val1.fractionNs <= val2.fractionNs); + } + + bool operator>(const Timestamp& val1, const Timestamp& val2) + { + return val1.seconds > val2.seconds || + (val1.seconds == val2.seconds && + val1.fractionNs > val2.fractionNs); + } + + bool operator>=(const Timestamp& val1, const Timestamp& val2) + { + return val1.seconds > val2.seconds || + (val1.seconds == val2.seconds && + val1.fractionNs >= val2.fractionNs); + } +}
http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/configure.ac ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/configure.ac b/modules/platforms/cpp/configure.ac new file mode 100644 index 0000000..bc5e24f --- /dev/null +++ b/modules/platforms/cpp/configure.ac @@ -0,0 +1,108 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +AC_PREREQ([2.69]) +AC_INIT([Apache Ignite C++], [1.6.0.8653], [[email protected]], [ignite], [ignite.apache.org]) + +AC_CANONICAL_HOST +AC_CONFIG_MACRO_DIR([m4]) +AC_LANG([C++]) + +AM_INIT_AUTOMAKE([-Wall foreign subdir-objects]) +AC_CONFIG_HEADERS(config.h) + +# Enable silent rules by default +AM_SILENT_RULES([yes]) + +# Checks for programs. +AC_PROG_CPP +AM_PROG_AR + +# Initialize Libtool +LT_INIT + +AC_ARG_ENABLE([odbc], + [AS_HELP_STRING([--enable-odbc],[build included ODBC driver [default=yes]])], + [ case "${enableval}" in + yes) odbc=true ;; + no) odbc=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-odbc) ;; + esac + ], + [odbc=true] +) + +AC_ARG_ENABLE([core], + [AS_HELP_STRING([--enable-core],[build Ignite core library [default=yes]])], + [ case "${enableval}" in + yes) core=true ;; + no) core=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-core) ;; + esac], + [core=true] +) + +AC_ARG_ENABLE([node], + [AS_HELP_STRING([--enable-node],[build stand-alone node binary [default=yes]])], + [ case "${enableval}" in + yes) node=true ;; + no) node=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-node) ;; + esac], + [node=true] +) + +AC_ARG_ENABLE([tests], + [AS_HELP_STRING([--enable-tests],[build tests for enabled components [default=yes]])], + [ case "${enableval}" in + yes) tests=true ;; + no) tests=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-tests) ;; + esac], + [tests=true] +) + +AM_CONDITIONAL([COND_ODBC], [test "x$odbc" = "xtrue"]) +AM_CONDITIONAL([COND_CORE], [test "x$core" = "xtrue"]) +AM_CONDITIONAL([COND_NODE], [test "x$node" = "xtrue"]) +AM_CONDITIONAL([COND_TESTS], [test "x$tests" = "xtrue"]) + +AC_CONFIG_FILES([ \ + Makefile \ + core-test/include/Makefile \ + core-test/Makefile \ + common/os/linux/include/Makefile \ + common/include/Makefile \ + common/Makefile \ + binary/include/Makefile \ + binary/Makefile \ + odbc/include/Makefile \ + odbc/Makefile \ + odbc-test/include/Makefile \ + odbc-test/Makefile \ + core/include/Makefile \ + core/Makefile \ + core/ignite.pc \ + jni/include/Makefile \ + jni/Makefile \ + ignite/Makefile \ +]) + +AC_OUTPUT http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/configure.acrel ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/configure.acrel b/modules/platforms/cpp/configure.acrel new file mode 100644 index 0000000..036f124 --- /dev/null +++ b/modules/platforms/cpp/configure.acrel @@ -0,0 +1,93 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +AC_PREREQ([2.69]) +AC_INIT([Apache Ignite C++], [1.6.0.8653], [[email protected]], [ignite], [ignite.apache.org]) + +AC_CANONICAL_HOST +AC_CONFIG_MACRO_DIR([m4]) +AC_LANG([C++]) + +AM_INIT_AUTOMAKE([-Wall foreign subdir-objects]) +AC_CONFIG_HEADERS(config.h) + +# Enable silent rules by default +AM_SILENT_RULES([yes]) + +# Checks for programs. +AC_PROG_CPP +AM_PROG_AR + +# Initialize Libtool +LT_INIT + +AC_ARG_ENABLE([odbc], + [AS_HELP_STRING([--enable-odbc],[build included ODBC driver [default=no]])], + [ case "${enableval}" in + yes) odbc=true ;; + no) odbc=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-odbc) ;; + esac + ], + [odbc=false] +) + +AC_ARG_ENABLE([core], + [AS_HELP_STRING([--enable-core],[build Ignite core library [default=yes]])], + [ case "${enableval}" in + yes) core=true ;; + no) core=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-core) ;; + esac], + [core=true] +) + +AC_ARG_ENABLE([node], + [AS_HELP_STRING([--enable-node],[build stand-alone node binary [default=yes]])], + [ case "${enableval}" in + yes) node=true ;; + no) node=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-node) ;; + esac], + [node=true] +) + +AM_CONDITIONAL([COND_ODBC], [test "x$odbc" = "xtrue"]) +AM_CONDITIONAL([COND_CORE], [test "x$core" = "xtrue"]) +AM_CONDITIONAL([COND_NODE], [test "x$node" = "xtrue"]) + +AC_CONFIG_FILES([ \ + Makefile \ + common/os/linux/include/Makefile \ + common/include/Makefile \ + common/Makefile \ + binary/include/Makefile \ + binary/Makefile \ + odbc/include/Makefile \ + odbc/Makefile \ + core/include/Makefile \ + core/Makefile \ + core/ignite.pc \ + jni/include/Makefile \ + jni/Makefile \ + ignite/Makefile \ +]) + +AC_OUTPUT http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/core-test/Makefile.am ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core-test/Makefile.am b/modules/platforms/cpp/core-test/Makefile.am index 55b3b98..d5634c9 100644 --- a/modules/platforms/cpp/core-test/Makefile.am +++ b/modules/platforms/cpp/core-test/Makefile.am @@ -15,31 +15,51 @@ ## limitations under the License. ## -ACLOCAL_AMFLAGS = "-Im4" +ACLOCAL_AMFLAGS =-I m4 -SUBDIRS = . include -DIST_SUBDIRS = . include +noinst_PROGRAMS = ignite-tests -AM_CPPFLAGS = -I$(srcdir)/include -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux -DIGNITE_IMPL -AM_CXXFLAGS = -Wall -std=c++0x +SUBDIRS = \ + include -noinst_PROGRAMS = ignite-tests +AM_CPPFLAGS = \ + -I$(srcdir)/include \ + -I@top_srcdir@/core/include \ + -I@top_srcdir@/core/os/linux/include \ + -I@top_srcdir@/common/include \ + -I@top_srcdir@/common/os/linux/include \ + -I@top_srcdir@/binary/include \ + -I@top_srcdir@/jni/include \ + -I@top_srcdir@/jni/os/linux/include \ + -I$(JAVA_HOME)/include \ + -I$(JAVA_HOME)/include/linux \ + -DIGNITE_IMPL + +AM_CXXFLAGS = \ + -Wall \ + -std=c++0x + +ignite_tests_LDADD = \ + @top_srcdir@/core/libignite.la \ + -lpthread + +ignite_tests_LDFLAGS = \ + -static-libtool-libs -ignite_tests_SOURCES = src/cache_test.cpp \ - src/cache_query_test.cpp \ - src/concurrent_test.cpp \ - src/ignition_test.cpp \ - src/interop_memory_test.cpp \ - src/handle_registry_test.cpp \ - src/ignite_error_test.cpp \ - src/binary_test_defs.cpp \ - src/binary_reader_writer_raw_test.cpp \ - src/binary_reader_writer_test.cpp \ - src/binary_session_test.cpp \ - src/teamcity_messages.cpp \ - src/teamcity_boost.cpp - -ignite_tests_LDFLAGS = -static-libtool-libs -L/usr/local/lib -lignite +ignite_tests_SOURCES = \ + src/cache_test.cpp \ + src/cache_query_test.cpp \ + src/concurrent_test.cpp \ + src/ignition_test.cpp \ + src/interop_memory_test.cpp \ + src/handle_registry_test.cpp \ + src/ignite_error_test.cpp \ + src/binary_test_defs.cpp \ + src/binary_reader_writer_raw_test.cpp \ + src/binary_reader_writer_test.cpp \ + src/binary_session_test.cpp \ + src/teamcity_messages.cpp \ + src/teamcity_boost.cpp run-check: check ./ignite-tests -p http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/core-test/config/cache-query.xml ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core-test/config/cache-query.xml b/modules/platforms/cpp/core-test/config/cache-query.xml index 160fe49..232b6da 100644 --- a/modules/platforms/cpp/core-test/config/cache-query.xml +++ b/modules/platforms/cpp/core-test/config/cache-query.xml @@ -59,6 +59,8 @@ <map> <entry key="name" value="java.lang.String"/> <entry key="age" value="java.lang.Integer"/> + <entry key="birthday" value="java.util.Date"/> + <entry key="recordCreated" value="java.sql.Timestamp"/> </map> </property> <property name="textFields"> http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/core-test/configure.ac ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core-test/configure.ac b/modules/platforms/cpp/core-test/configure.ac deleted file mode 100644 index c83bc62..0000000 --- a/modules/platforms/cpp/core-test/configure.ac +++ /dev/null @@ -1,62 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# -*- Autoconf -*- -# Process this file with autoconf to produce a configure script. - -AC_PREREQ([2.69]) -AC_INIT([Apache Ignite C++ Test], [1.6.0.8653], [[email protected]], [ignite], [ignite.apache.org]) -AC_CONFIG_SRCDIR(src) - -AC_CANONICAL_SYSTEM -AC_CONFIG_MACRO_DIR([m4]) -AC_LANG([C++]) - -# Initialize automake -AM_INIT_AUTOMAKE([-Wall foreign subdir-objects]) -AC_CONFIG_HEADER(config.h) - -AM_PROG_AR - -# Checks for programs. -GXX="-g -O2" - -AC_PROG_CXX - -# Initialize Libtool -LT_INIT - -# Checks for libraries. -AC_CHECK_LIB([pthread], [pthread_mutex_lock]) - -# Checks for header files. - -# Checks for typedefs, structures, and compiler characteristics. -AC_C_INLINE -AC_TYPE_INT16_T -AC_TYPE_INT32_T -AC_TYPE_INT64_T -AC_TYPE_INT8_T -AC_TYPE_PID_T -AC_TYPE_SIZE_T - -# Checks for library functions. -AC_FUNC_ERROR_AT_LINE - -AC_CONFIG_FILES(Makefile include/Makefile) - -AC_OUTPUT http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/core-test/include/Makefile.am ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core-test/include/Makefile.am b/modules/platforms/cpp/core-test/include/Makefile.am index cc0ab5e..06d1a2f 100644 --- a/modules/platforms/cpp/core-test/include/Makefile.am +++ b/modules/platforms/cpp/core-test/include/Makefile.am @@ -15,8 +15,10 @@ ## limitations under the License. ## -ACLOCAL_AMFLAGS = "-Im4" +ACLOCAL_AMFLAGS =-I m4 + +noinst_HEADERS = \ + ignite/binary_test_defs.h \ + ignite/binary_test_utils.h \ + teamcity_messages.h -nobase_include_HEADERS = teamcity_messages.h \ - ignite/binary_test_defs.h \ - ignite/binary_test_utils.h http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/core-test/include/ignite/binary_test_utils.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core-test/include/ignite/binary_test_utils.h b/modules/platforms/cpp/core-test/include/ignite/binary_test_utils.h index 19965a0..bcec9fe 100644 --- a/modules/platforms/cpp/core-test/include/ignite/binary_test_utils.h +++ b/modules/platforms/cpp/core-test/include/ignite/binary_test_utils.h @@ -150,6 +150,30 @@ namespace ignite_test return reader.ReadGuid(); } + template<> + inline void Write(BinaryRawWriter& writer, Date val) + { + writer.WriteDate(val); + } + + template<> + inline Date Read(BinaryRawReader& reader) + { + return reader.ReadDate(); + } + + template<> + inline void Write(BinaryRawWriter& writer, Timestamp val) + { + writer.WriteTimestamp(val); + } + + template<> + inline Timestamp Read(BinaryRawReader& reader) + { + return reader.ReadTimestamp(); + } + template<typename T> inline void WriteArray(BinaryRawWriter& writer, T* val, int32_t len) { @@ -270,6 +294,30 @@ namespace ignite_test return reader.ReadGuidArray(val, len); } + template<> + inline void WriteArray(BinaryRawWriter& writer, Date* val, int32_t len) + { + writer.WriteDateArray(val, len); + } + + template<> + inline int32_t ReadArray(BinaryRawReader& reader, Date* val, int32_t len) + { + return reader.ReadDateArray(val, len); + } + + template<> + inline void WriteArray(BinaryRawWriter& writer, Timestamp* val, int32_t len) + { + writer.WriteTimestampArray(val, len); + } + + template<> + inline int32_t ReadArray(BinaryRawReader& reader, Timestamp* val, int32_t len) + { + return reader.ReadTimestampArray(val, len); + } + template<typename T> inline void Write(BinaryWriter& writer, const char* fieldName, T val) { @@ -390,6 +438,30 @@ namespace ignite_test return reader.ReadGuid(fieldName); } + template<> + inline void Write(BinaryWriter& writer, const char* fieldName, Date val) + { + writer.WriteDate(fieldName, val); + } + + template<> + inline Date Read(BinaryReader& reader, const char* fieldName) + { + return reader.ReadDate(fieldName); + } + + template<> + inline void Write(BinaryWriter& writer, const char* fieldName, Timestamp val) + { + writer.WriteTimestamp(fieldName, val); + } + + template<> + inline Timestamp Read(BinaryReader& reader, const char* fieldName) + { + return reader.ReadTimestamp(fieldName); + } + template<typename T> inline void WriteArray(BinaryWriter& writer, const char* fieldName, T* val, int32_t len) { @@ -509,6 +581,30 @@ namespace ignite_test { return reader.ReadGuidArray(fieldName, val, len); } + + template<> + inline void WriteArray(BinaryWriter& writer, const char* fieldName, Date* val, int32_t len) + { + writer.WriteDateArray(fieldName, val, len); + } + + template<> + inline int32_t ReadArray(BinaryReader& reader, const char* fieldName, Date* val, int32_t len) + { + return reader.ReadDateArray(fieldName, val, len); + } + + template<> + inline void WriteArray(BinaryWriter& writer, const char* fieldName, Timestamp* val, int32_t len) + { + writer.WriteTimestampArray(fieldName, val, len); + } + + template<> + inline int32_t ReadArray(BinaryReader& reader, const char* fieldName, Timestamp* val, int32_t len) + { + return reader.ReadTimestampArray(fieldName, val, len); + } } } } http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/core-test/project/vs/core-test.vcxproj ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core-test/project/vs/core-test.vcxproj b/modules/platforms/cpp/core-test/project/vs/core-test.vcxproj index 9e3d816..1bf27f2 100644 --- a/modules/platforms/cpp/core-test/project/vs/core-test.vcxproj +++ b/modules/platforms/cpp/core-test/project/vs/core-test.vcxproj @@ -19,12 +19,15 @@ </ProjectConfiguration> </ItemGroup> <ItemGroup> - <ProjectReference Include="..\..\..\common\project\vs\common.vcxproj"> - <Project>{4f7e4917-4612-4b96-9838-025711ade391}</Project> + <ProjectReference Include="..\..\..\binary\project\vs\binary.vcxproj"> + <Project>{4f15669b-92eb-49f0-b774-8f19bae0b960}</Project> </ProjectReference> <ProjectReference Include="..\..\..\core\project\vs\core.vcxproj"> <Project>{e2dea693-f2ea-43c2-a813-053378f6e4db}</Project> </ProjectReference> + <ProjectReference Include="..\..\..\jni\project\vs\jni.vcxproj"> + <Project>{4f7e4917-4612-4b96-9838-025711ade391}</Project> + </ProjectReference> </ItemGroup> <ItemGroup> <None Include="..\..\config\cache-query.xml" /> @@ -110,7 +113,7 @@ <WarningLevel>Level3</WarningLevel> <Optimization>Disabled</Optimization> <SDLCheck>true</SDLCheck> - <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\..\core\include;$(ProjectDir)\..\..\..\core\os\win\include;$(ProjectDir)\..\..\include;$(BOOST_HOME)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\..\jni\include;$(ProjectDir)\..\..\..\jni\os\win\include;$(ProjectDir)\..\..\..\binary\include;$(ProjectDir)\..\..\..\binary\os\win\include;$(ProjectDir)\..\..\..\core\include;$(ProjectDir)\..\..\..\core\os\win\include;$(ProjectDir)\..\..\include;$(BOOST_HOME)</AdditionalIncludeDirectories> <PreprocessorDefinitions>_DEBUG;IGNITE_IMPL;BOOST_DATE_TIME_NO_LIB;BOOST_REGEX_NO_LIB;_CRT_SECURE_NO_WARNINGS;IGNITE_FRIEND;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions)</PreprocessorDefinitions> <ExceptionHandling>Async</ExceptionHandling> </ClCompile> @@ -125,7 +128,7 @@ <WarningLevel>Level3</WarningLevel> <Optimization>Disabled</Optimization> <SDLCheck>true</SDLCheck> - <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\..\core\include;$(ProjectDir)\..\..\..\core\os\win\include;$(ProjectDir)\..\..\include;$(BOOST_HOME)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\..\jni\include;$(ProjectDir)\..\..\..\jni\os\win\include;$(ProjectDir)\..\..\..\binary\include;$(ProjectDir)\..\..\..\binary\os\win\include;$(ProjectDir)\..\..\..\core\include;$(ProjectDir)\..\..\..\core\os\win\include;$(ProjectDir)\..\..\include;$(BOOST_HOME)</AdditionalIncludeDirectories> <PreprocessorDefinitions>_DEBUG;IGNITE_IMPL;BOOST_DATE_TIME_NO_LIB;BOOST_REGEX_NO_LIB;_CRT_SECURE_NO_WARNINGS;IGNITE_FRIEND;IGNITE_TESTS_32;%(PreprocessorDefinitions)</PreprocessorDefinitions> <ExceptionHandling>Async</ExceptionHandling> </ClCompile> @@ -141,7 +144,7 @@ <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> <SDLCheck>true</SDLCheck> - <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\..\core\include;$(ProjectDir)\..\..\..\core\os\win\include;$(ProjectDir)\..\..\include;$(BOOST_HOME)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\..\jni\include;$(ProjectDir)\..\..\..\jni\os\win\include;$(ProjectDir)\..\..\..\binary\include;$(ProjectDir)\..\..\..\binary\os\win\include;$(ProjectDir)\..\..\..\core\include;$(ProjectDir)\..\..\..\core\os\win\include;$(ProjectDir)\..\..\include;$(BOOST_HOME)</AdditionalIncludeDirectories> <PreprocessorDefinitions>NDEBUG;IGNITE_IMPL;BOOST_DATE_TIME_NO_LIB;BOOST_REGEX_NO_LIB;_CRT_SECURE_NO_WARNINGS;IGNITE_FRIEND;%(PreprocessorDefinitions)</PreprocessorDefinitions> <ExceptionHandling>Async</ExceptionHandling> </ClCompile> @@ -159,7 +162,7 @@ <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> <SDLCheck>true</SDLCheck> - <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\..\core\include;$(ProjectDir)\..\..\..\core\os\win\include;$(ProjectDir)\..\..\include;$(BOOST_HOME)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\..\jni\include;$(ProjectDir)\..\..\..\jni\os\win\include;$(ProjectDir)\..\..\..\binary\include;$(ProjectDir)\..\..\..\binary\os\win\include;$(ProjectDir)\..\..\..\core\include;$(ProjectDir)\..\..\..\core\os\win\include;$(ProjectDir)\..\..\include;$(BOOST_HOME)</AdditionalIncludeDirectories> <PreprocessorDefinitions>NDEBUG;IGNITE_IMPL;BOOST_DATE_TIME_NO_LIB;BOOST_REGEX_NO_LIB;_CRT_SECURE_NO_WARNINGS;IGNITE_FRIEND;IGNITE_TESTS_32;%(PreprocessorDefinitions)</PreprocessorDefinitions> <ExceptionHandling>Async</ExceptionHandling> </ClCompile> http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/core-test/src/binary_reader_writer_raw_test.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core-test/src/binary_reader_writer_raw_test.cpp b/modules/platforms/cpp/core-test/src/binary_reader_writer_raw_test.cpp index 4e7e2df..b6d9eab 100644 --- a/modules/platforms/cpp/core-test/src/binary_reader_writer_raw_test.cpp +++ b/modules/platforms/cpp/core-test/src/binary_reader_writer_raw_test.cpp @@ -210,6 +210,32 @@ void CheckRawWritesRestricted(BinaryRawWriter& writer) try { + Date val(1); + + writer.WriteDate(val); + + BOOST_FAIL("Not restricted."); + } + catch (IgniteError& err) + { + BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY); + } + + try + { + Timestamp val(1); + + writer.WriteTimestamp(val); + + BOOST_FAIL("Not restricted."); + } + catch (IgniteError& err) + { + BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY); + } + + try + { writer.WriteString("test"); BOOST_FAIL("Not restricted."); @@ -292,6 +318,28 @@ void CheckRawReadsRestricted(BinaryRawReader& reader) try { + reader.ReadDate(); + + BOOST_FAIL("Not restricted."); + } + catch (IgniteError& err) + { + BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY); + } + + try + { + reader.ReadTimestamp(); + + BOOST_FAIL("Not restricted."); + } + catch (IgniteError& err) + { + BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY); + } + + try + { reader.ReadString(); BOOST_FAIL("Not restricted."); @@ -764,6 +812,20 @@ BOOST_AUTO_TEST_CASE(TestPrimitiveGuid) CheckRawPrimitive<Guid>(val); } +BOOST_AUTO_TEST_CASE(TestPrimitiveDate) +{ + Date val(time(NULL) * 1000); + + CheckRawPrimitive<Date>(val); +} + +BOOST_AUTO_TEST_CASE(TestPrimitiveTimestamp) +{ + Timestamp val(time(NULL), 0); + + CheckRawPrimitive<Timestamp>(val); +} + BOOST_AUTO_TEST_CASE(TestPrimitiveArrayInt8) { CheckRawPrimitiveArray<int8_t>(1, 2, 3); @@ -813,6 +875,24 @@ BOOST_AUTO_TEST_CASE(TestPrimitiveArrayGuid) CheckRawPrimitiveArray<Guid>(dflt, val1, val2); } +BOOST_AUTO_TEST_CASE(TestPrimitiveArrayDate) +{ + Date dflt(1); + Date val1(2); + Date val2(3); + + CheckRawPrimitiveArray<Date>(dflt, val1, val2); +} + +BOOST_AUTO_TEST_CASE(TestPrimitiveArrayTimestamp) +{ + Timestamp dflt(1); + Timestamp val1(2); + Timestamp val2(3); + + CheckRawPrimitiveArray<Timestamp>(dflt, val1, val2); +} + BOOST_AUTO_TEST_CASE(TestGuidNull) { InteropUnpooledMemory mem(1024); @@ -835,6 +915,50 @@ BOOST_AUTO_TEST_CASE(TestGuidNull) BOOST_REQUIRE(actualVal == expVal); } +BOOST_AUTO_TEST_CASE(TestDateNull) +{ + InteropUnpooledMemory mem(1024); + + InteropOutputStream out(&mem); + BinaryWriterImpl writer(&out, NULL); + BinaryRawWriter rawWriter(&writer); + + rawWriter.WriteNull(); + + out.Synchronize(); + + InteropInputStream in(&mem); + BinaryReaderImpl reader(&in); + BinaryRawReader rawReader(&reader); + + Date expVal; + Date actualVal = rawReader.ReadDate(); + + BOOST_REQUIRE(actualVal == expVal); +} + +BOOST_AUTO_TEST_CASE(TestTimestampNull) +{ + InteropUnpooledMemory mem(1024); + + InteropOutputStream out(&mem); + BinaryWriterImpl writer(&out, NULL); + BinaryRawWriter rawWriter(&writer); + + rawWriter.WriteNull(); + + out.Synchronize(); + + InteropInputStream in(&mem); + BinaryReaderImpl reader(&in); + BinaryRawReader rawReader(&reader); + + Timestamp expVal; + Timestamp actualVal = rawReader.ReadTimestamp(); + + BOOST_REQUIRE(actualVal == expVal); +} + BOOST_AUTO_TEST_CASE(TestString) { InteropUnpooledMemory mem(1024); http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/core-test/src/binary_reader_writer_test.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core-test/src/binary_reader_writer_test.cpp b/modules/platforms/cpp/core-test/src/binary_reader_writer_test.cpp index 71177b8..fa36dac 100644 --- a/modules/platforms/cpp/core-test/src/binary_reader_writer_test.cpp +++ b/modules/platforms/cpp/core-test/src/binary_reader_writer_test.cpp @@ -335,6 +335,32 @@ void CheckWritesRestricted(BinaryWriter& writer) try { + Date val(1); + + writer.WriteDate("field", val); + + BOOST_FAIL("Not restricted."); + } + catch (IgniteError& err) + { + BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY); + } + + try + { + Timestamp val(1); + + writer.WriteTimestamp("field", val); + + BOOST_FAIL("Not restricted."); + } + catch (IgniteError& err) + { + BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY); + } + + try + { writer.WriteString("field", "test"); BOOST_FAIL("Not restricted."); @@ -417,6 +443,28 @@ void CheckReadsRestricted(BinaryReader& reader) try { + reader.ReadDate("field"); + + BOOST_FAIL("Not restricted."); + } + catch (IgniteError& err) + { + BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY); + } + + try + { + reader.ReadTimestamp("field"); + + BOOST_FAIL("Not restricted."); + } + catch (IgniteError& err) + { + BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY); + } + + try + { reader.ReadString("field"); BOOST_FAIL("Not restricted."); @@ -947,6 +995,20 @@ BOOST_AUTO_TEST_CASE(TestPrimitiveGuid) CheckPrimitive<Guid>(val); } +BOOST_AUTO_TEST_CASE(TestPrimitiveDate) +{ + Date val(time(NULL) * 1000); + + CheckPrimitive<Date>(val); +} + +BOOST_AUTO_TEST_CASE(TestPrimitiveTimestamp) +{ + Timestamp val(time(NULL), 0); + + CheckPrimitive<Timestamp>(val); +} + BOOST_AUTO_TEST_CASE(TestPrimitiveArrayInt8) { CheckPrimitiveArray<int8_t>(1, 2, 3); @@ -996,6 +1058,24 @@ BOOST_AUTO_TEST_CASE(TestPrimitiveArrayGuid) CheckPrimitiveArray<Guid>(dflt, val1, val2); } +BOOST_AUTO_TEST_CASE(TestPrimitiveArrayDate) +{ + Date dflt(1); + Date val1(2); + Date val2(3); + + CheckPrimitiveArray<Date>(dflt, val1, val2); +} + +BOOST_AUTO_TEST_CASE(TestPrimitiveArrayTimestamp) +{ + Timestamp dflt(1); + Timestamp val1(2); + Timestamp val2(3); + + CheckPrimitiveArray<Timestamp>(dflt, val1, val2); +} + BOOST_AUTO_TEST_CASE(TestGuidNull) { TemplatedBinaryIdResolver<BinaryDummy> idRslvr; @@ -1052,6 +1132,118 @@ BOOST_AUTO_TEST_CASE(TestGuidNull) BOOST_REQUIRE(actualVal == expVal); } +BOOST_AUTO_TEST_CASE(TestDateNull) +{ + TemplatedBinaryIdResolver<BinaryDummy> idRslvr; + + InteropUnpooledMemory mem(1024); + + InteropOutputStream out(&mem); + BinaryWriterImpl writerImpl(&out, &idRslvr, NULL, NULL, 0); + BinaryWriter writer(&writerImpl); + + out.Position(IGNITE_DFLT_HDR_LEN); + + try + { + writer.WriteNull(NULL); + + BOOST_FAIL("Not restricted."); + } + catch (IgniteError& err) + { + BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY); + } + + writer.WriteNull("test"); + + writerImpl.PostWrite(); + + out.Synchronize(); + + InteropInputStream in(&mem); + + int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF); + int32_t footerEnd = footerBegin + 5; + + BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE); + BinaryReader reader(&readerImpl); + + in.Position(IGNITE_DFLT_HDR_LEN); + + try + { + reader.ReadDate(NULL); + + BOOST_FAIL("Not restricted."); + } + catch (IgniteError& err) + { + BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY); + } + + Date expVal; + Date actualVal = reader.ReadDate("test"); + + BOOST_REQUIRE(actualVal == expVal); +} + +BOOST_AUTO_TEST_CASE(TestTimestampNull) +{ + TemplatedBinaryIdResolver<BinaryDummy> idRslvr; + + InteropUnpooledMemory mem(1024); + + InteropOutputStream out(&mem); + BinaryWriterImpl writerImpl(&out, &idRslvr, NULL, NULL, 0); + BinaryWriter writer(&writerImpl); + + out.Position(IGNITE_DFLT_HDR_LEN); + + try + { + writer.WriteNull(NULL); + + BOOST_FAIL("Not restricted."); + } + catch (IgniteError& err) + { + BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY); + } + + writer.WriteNull("test"); + + writerImpl.PostWrite(); + + out.Synchronize(); + + InteropInputStream in(&mem); + + int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF); + int32_t footerEnd = footerBegin + 5; + + BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE); + BinaryReader reader(&readerImpl); + + in.Position(IGNITE_DFLT_HDR_LEN); + + try + { + reader.ReadTimestamp(NULL); + + BOOST_FAIL("Not restricted."); + } + catch (IgniteError& err) + { + BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY); + } + + Timestamp expVal; + Timestamp actualVal = reader.ReadTimestamp("test"); + + BOOST_REQUIRE(actualVal == expVal); +} + BOOST_AUTO_TEST_CASE(TestString) { TemplatedBinaryIdResolver<BinaryDummy> idRslvr; http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/core-test/src/binary_session_test.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core-test/src/binary_session_test.cpp b/modules/platforms/cpp/core-test/src/binary_session_test.cpp index c5c4191..19bfaac 100644 --- a/modules/platforms/cpp/core-test/src/binary_session_test.cpp +++ b/modules/platforms/cpp/core-test/src/binary_session_test.cpp @@ -137,6 +137,42 @@ BOOST_AUTO_TEST_CASE(TestGuid) BOOST_REQUIRE(readVal.GetLeastSignificantBits() == writeVal.GetLeastSignificantBits()); } +BOOST_AUTO_TEST_CASE(TestDate) +{ + Date writeVal = Date(42); + + InteropUnpooledMemory mem(1024); + + InteropOutputStream out(&mem); + BinaryWriterImpl writeSes(&out, NULL); + writeSes.WriteTopObject<Date>(writeVal); + out.Synchronize(); + + InteropInputStream in(&mem); + BinaryReaderImpl reader(&in); + Date readVal = reader.ReadTopObject<Date>(); + + BOOST_REQUIRE(readVal == writeVal); +} + +BOOST_AUTO_TEST_CASE(TestTimestamp) +{ + Timestamp writeVal = Timestamp(77); + + InteropUnpooledMemory mem(1024); + + InteropOutputStream out(&mem); + BinaryWriterImpl writeSes(&out, NULL); + writeSes.WriteTopObject<Timestamp>(writeVal); + out.Synchronize(); + + InteropInputStream in(&mem); + BinaryReaderImpl reader(&in); + Timestamp readVal = reader.ReadTopObject<Timestamp>(); + + BOOST_REQUIRE(readVal == writeVal); +} + BOOST_AUTO_TEST_CASE(TestString) { std::string writeVal = "MyString"; http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/core-test/src/cache_query_test.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core-test/src/cache_query_test.cpp b/modules/platforms/cpp/core-test/src/cache_query_test.cpp index 05e6477..168f3f9 100644 --- a/modules/platforms/cpp/core-test/src/cache_query_test.cpp +++ b/modules/platforms/cpp/core-test/src/cache_query_test.cpp @@ -23,7 +23,8 @@ #include <boost/test/unit_test.hpp> -#include "ignite/impl/utils.h" +#include <ignite/common/utils.h> + #include "ignite/cache/cache.h" #include "ignite/cache/query/query_cursor.h" #include "ignite/cache/query/query_sql.h" @@ -37,7 +38,9 @@ using namespace boost::unit_test; using namespace ignite; using namespace ignite::cache; using namespace ignite::cache::query; -using namespace ignite::impl::utils; +using namespace ignite::common; + +using ignite::impl::binary::BinaryUtils; /** * Person class for query tests. @@ -48,7 +51,11 @@ public: /** * Constructor. */ - QueryPerson() : name(NULL), age(0) + QueryPerson() : + name(NULL), + age(0), + birthday(), + recordCreated() { // No-op. } @@ -59,7 +66,12 @@ public: * @param name Name. * @param age Age. */ - QueryPerson(const std::string& name, int age) : name(CopyChars(name.c_str())), age(age) + QueryPerson(const std::string& name, int age, + const Date& birthday, const Timestamp& recordCreated) : + name(CopyChars(name.c_str())), + age(age), + birthday(birthday), + recordCreated(recordCreated) { // No-op. } @@ -69,10 +81,13 @@ public: * * @param other Other instance. */ - QueryPerson(const QueryPerson& other) + QueryPerson(const QueryPerson& other) : + name(CopyChars(other.name)), + age(other.age), + birthday(other.birthday), + recordCreated(other.recordCreated) { - name = CopyChars(other.name); - age = other.age; + // No-op. } /** @@ -83,18 +98,16 @@ public: */ QueryPerson& operator=(const QueryPerson& other) { + using std::swap; + if (&other != this) { QueryPerson tmp(other); - char* name0 = name; - int age0 = age; - - name = tmp.name; - age = tmp.age; - - tmp.name = name0; - tmp.age = age0; + swap(name, tmp.name); + swap(age, tmp.age); + swap(birthday, tmp.birthday); + swap(recordCreated, tmp.recordCreated); } return *this; @@ -113,7 +126,7 @@ public: * * @return Name. */ - std::string GetName() + std::string GetName() const { return name ? std::string(name) : std::string(); } @@ -123,17 +136,43 @@ public: * * @return Age. */ - int32_t GetAge() + int32_t GetAge() const { return age; } + /** + * Get birthday. + * + * @return Birthday date. + */ + const Date& GetBirthday() const + { + return birthday; + } + + /** + * Get creation time. + * + * @return Creation time. + */ + const Timestamp& GetCreationTime() const + { + return recordCreated; + } + private: /** Name. */ char* name; /** Age. */ int age; + + /** Birthday. */ + Date birthday; + + /** Record creation timestamp. */ + Timestamp recordCreated; }; namespace ignite @@ -155,14 +194,18 @@ namespace ignite { writer.WriteString("name", obj.GetName()); writer.WriteInt32("age", obj.GetAge()); + writer.WriteDate("birthday", obj.GetBirthday()); + writer.WriteTimestamp("recordCreated", obj.GetCreationTime()); } QueryPerson Read(BinaryReader& reader) { std::string name = reader.ReadString("name"); int age = reader.ReadInt32("age"); + Date birthday = reader.ReadDate("birthday"); + Timestamp recordCreated = reader.ReadTimestamp("recordCreated"); - return QueryPerson(name, age); + return QueryPerson(name, age, birthday, recordCreated); } IGNITE_BINARY_TYPE_END @@ -498,8 +541,8 @@ BOOST_AUTO_TEST_CASE(TestSqlQuery) CheckEmptyGetAll(cursor); // Test simple query. - cache.Put(1, QueryPerson("A1", 10)); - cache.Put(2, QueryPerson("A2", 20)); + cache.Put(1, QueryPerson("A1", 10, BinaryUtils::MakeDateLocal(1990, 03, 18), BinaryUtils::MakeTimestampLocal(2016, 02, 10, 17, 39, 34, 579304685))); + cache.Put(2, QueryPerson("A2", 20, BinaryUtils::MakeDateLocal(1989, 10, 26), BinaryUtils::MakeTimestampLocal(2016, 02, 10, 17, 39, 35, 678403201))); cursor = cache.Query(qry); CheckSingle(cursor, 1, "A1", 10); @@ -554,8 +597,8 @@ BOOST_AUTO_TEST_CASE(TestTextQuery) CheckEmptyGetAll(cursor); // Test simple query. - cache.Put(1, QueryPerson("A1", 10)); - cache.Put(2, QueryPerson("A2", 20)); + cache.Put(1, QueryPerson("A1", 10, BinaryUtils::MakeDateLocal(1990, 03, 18), BinaryUtils::MakeTimestampLocal(2016, 02, 10, 17, 39, 34, 579304685))); + cache.Put(2, QueryPerson("A2", 20, BinaryUtils::MakeDateLocal(1989, 10, 26), BinaryUtils::MakeTimestampLocal(2016, 02, 10, 17, 39, 35, 678403201))); cursor = cache.Query(qry); CheckSingle(cursor, 1, "A1", 10); @@ -600,7 +643,7 @@ BOOST_AUTO_TEST_CASE(TestScanQuery) CheckEmptyGetAll(cursor); // Test simple query. - cache.Put(1, QueryPerson("A1", 10)); + cache.Put(1, QueryPerson("A1", 10, BinaryUtils::MakeDateLocal(1990, 03, 18), BinaryUtils::MakeTimestampLocal(2016, 02, 10, 17, 39, 34, 579304685))); cursor = cache.Query(qry); CheckSingle(cursor, 1, "A1", 10); @@ -609,7 +652,7 @@ BOOST_AUTO_TEST_CASE(TestScanQuery) CheckSingleGetAll(cursor, 1, "A1", 10); // Test query returning multiple entries. - cache.Put(2, QueryPerson("A2", 20)); + cache.Put(2, QueryPerson("A2", 20, BinaryUtils::MakeDateLocal(1989, 10, 26), BinaryUtils::MakeTimestampLocal(2016, 02, 10, 17, 39, 35, 678403201))); cursor = cache.Query(qry); CheckMultiple(cursor, 1, "A1", 10, 2, "A2", 20); @@ -632,10 +675,10 @@ BOOST_AUTO_TEST_CASE(TestScanQueryPartitioned) for (int i = 0; i < entryCnt; i++) { std::stringstream stream; - + stream << "A" << i; - - cache.Put(i, QueryPerson(stream.str(), i * 10)); + + cache.Put(i, QueryPerson(stream.str(), i * 10, BinaryUtils::MakeDateLocal(1970 + i), BinaryUtils::MakeTimestampLocal(2016, 1, 1, i / 60, i % 60))); } // Iterate over all partitions and collect data. @@ -682,7 +725,7 @@ BOOST_AUTO_TEST_CASE(TestFieldsQuerySingle) CheckEmpty(cursor); // Test simple query. - cache.Put(1, QueryPerson("A1", 10)); + cache.Put(1, QueryPerson("A1", 10, BinaryUtils::MakeDateLocal(1990, 03, 18), BinaryUtils::MakeTimestampLocal(2016, 02, 10, 17, 39, 34, 579304685))); cursor = cache.Query(qry); @@ -727,7 +770,7 @@ BOOST_AUTO_TEST_CASE(TestFieldsQueryExceptions) CheckEmpty(cursor); // Test simple query. - cache.Put(1, QueryPerson("A1", 10)); + cache.Put(1, QueryPerson("A1", 10, BinaryUtils::MakeDateLocal(1990, 03, 18), BinaryUtils::MakeTimestampLocal(2016, 02, 10, 17, 39, 34, 579304685))); cursor = cache.Query(qry); @@ -772,8 +815,8 @@ BOOST_AUTO_TEST_CASE(TestFieldsQueryTwo) CheckEmpty(cursor); // Test simple query. - cache.Put(1, QueryPerson("A1", 10)); - cache.Put(2, QueryPerson("A2", 20)); + cache.Put(1, QueryPerson("A1", 10, BinaryUtils::MakeDateLocal(1990, 03, 18), BinaryUtils::MakeTimestampLocal(2016, 02, 10, 17, 39, 34, 579304685))); + cache.Put(2, QueryPerson("A2", 20, BinaryUtils::MakeDateLocal(1989, 10, 26), BinaryUtils::MakeTimestampLocal(2016, 02, 10, 17, 39, 35, 678403201))); cursor = cache.Query(qry); @@ -842,7 +885,10 @@ BOOST_AUTO_TEST_CASE(TestFieldsQuerySeveral) stream << "A" << i; - cache.Put(i, QueryPerson(stream.str(), i * 10)); + QueryPerson val(stream.str(), i * 10, BinaryUtils::MakeDateLocal(1980 + i, 1, 1), + BinaryUtils::MakeTimestampLocal(2016, 1, 1, i / 60, i % 60)); + + cache.Put(i, val); } cursor = cache.Query(qry); @@ -883,4 +929,354 @@ BOOST_AUTO_TEST_CASE(TestFieldsQuerySeveral) CheckEmpty(cursor); } -BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file +/** + * Test query for Date type. + */ +BOOST_AUTO_TEST_CASE(TestFieldsQueryDateLess) +{ + // Test simple query. + Cache<int, QueryPerson> cache = GetCache(); + + // Test query with field of type 'Date'. + SqlFieldsQuery qry("select birthday from QueryPerson where birthday<'1990-01-01'"); + + QueryFieldsCursor cursor = cache.Query(qry); + CheckEmpty(cursor); + + int32_t entryCnt = 100; // Number of entries. + + for (int i = 0; i < entryCnt; i++) + { + std::stringstream stream; + + stream << "A" << i; + + QueryPerson val(stream.str(), i * 10, BinaryUtils::MakeDateLocal(1980 + i, 1, 1), + BinaryUtils::MakeTimestampLocal(2016, 1, 1, i / 60, i % 60)); + + cache.Put(i, val); + } + + cursor = cache.Query(qry); + + IgniteError error; + + int32_t resultSetSize = 0; // Number of entries in query result set. + + while (cursor.HasNext(error)) + { + BOOST_REQUIRE(error.GetCode() == IgniteError::IGNITE_SUCCESS); + + QueryFieldsRow row = cursor.GetNext(error); + BOOST_REQUIRE(error.GetCode() == IgniteError::IGNITE_SUCCESS); + + BOOST_REQUIRE(row.HasNext(error)); + BOOST_REQUIRE(error.GetCode() == IgniteError::IGNITE_SUCCESS); + + Date birthday = row.GetNext<Date>(error); + BOOST_REQUIRE(error.GetCode() == IgniteError::IGNITE_SUCCESS); + + BOOST_CHECK(birthday == BinaryUtils::MakeDateLocal(1980 + resultSetSize, 1, 1)); + + BOOST_CHECK(birthday < BinaryUtils::MakeDateLocal(1990, 1, 1)); + + BOOST_REQUIRE(!row.HasNext()); + + ++resultSetSize; + } + + BOOST_CHECK_EQUAL(resultSetSize, 10); + + CheckEmpty(cursor); +} + +/** + * Test query for Date type. + */ +BOOST_AUTO_TEST_CASE(TestFieldsQueryDateMore) +{ + // Test simple query. + Cache<int, QueryPerson> cache = GetCache(); + + // Test query with field of type 'Date'. + SqlFieldsQuery qry("select birthday from QueryPerson where birthday>'2070-01-01'"); + + QueryFieldsCursor cursor = cache.Query(qry); + CheckEmpty(cursor); + + int32_t entryCnt = 100; // Number of entries. + + for (int i = 0; i < entryCnt; i++) + { + std::stringstream stream; + + stream << "A" << i; + + QueryPerson val(stream.str(), i * 10, BinaryUtils::MakeDateLocal(1980 + i, 1, 1), + BinaryUtils::MakeTimestampLocal(2016, 1, 1, i / 60, i % 60)); + + cache.Put(i, val); + } + + cursor = cache.Query(qry); + + IgniteError error; + + int32_t resultSetSize = 0; // Number of entries in query result set. + + while (cursor.HasNext(error)) + { + BOOST_REQUIRE(error.GetCode() == IgniteError::IGNITE_SUCCESS); + + QueryFieldsRow row = cursor.GetNext(error); + BOOST_REQUIRE(error.GetCode() == IgniteError::IGNITE_SUCCESS); + + BOOST_REQUIRE(row.HasNext(error)); + BOOST_REQUIRE(error.GetCode() == IgniteError::IGNITE_SUCCESS); + + Date birthday = row.GetNext<Date>(error); + BOOST_REQUIRE(error.GetCode() == IgniteError::IGNITE_SUCCESS); + + BOOST_CHECK(birthday == BinaryUtils::MakeDateLocal(2071 + resultSetSize, 1, 1)); + + BOOST_CHECK(birthday > BinaryUtils::MakeDateLocal(2070, 1, 1)); + + BOOST_REQUIRE(!row.HasNext()); + + ++resultSetSize; + } + + BOOST_CHECK_EQUAL(resultSetSize, 9); + + CheckEmpty(cursor); +} + +/** + * Test query for Date type. + */ +BOOST_AUTO_TEST_CASE(TestFieldsQueryDateEqual) +{ + // Test simple query. + Cache<int, QueryPerson> cache = GetCache(); + + // Test query with field of type 'Date'. + SqlFieldsQuery qry("select birthday from QueryPerson where birthday='2032-01-01'"); + + QueryFieldsCursor cursor = cache.Query(qry); + CheckEmpty(cursor); + + int32_t entryCnt = 100; // Number of entries. + + for (int i = 0; i < entryCnt; i++) + { + std::stringstream stream; + + stream << "A" << i; + + QueryPerson val(stream.str(), i * 10, BinaryUtils::MakeDateLocal(1980 + i, 1, 1), + BinaryUtils::MakeTimestampLocal(2016, 1, 1, i / 60, i % 60)); + + cache.Put(i, val); + } + + cursor = cache.Query(qry); + + IgniteError error; + + BOOST_REQUIRE(cursor.HasNext(error)); + + BOOST_REQUIRE(error.GetCode() == IgniteError::IGNITE_SUCCESS); + + QueryFieldsRow row = cursor.GetNext(error); + BOOST_REQUIRE(error.GetCode() == IgniteError::IGNITE_SUCCESS); + + BOOST_REQUIRE(row.HasNext(error)); + BOOST_REQUIRE(error.GetCode() == IgniteError::IGNITE_SUCCESS); + + Date birthday = row.GetNext<Date>(error); + BOOST_REQUIRE(error.GetCode() == IgniteError::IGNITE_SUCCESS); + + BOOST_CHECK(birthday == BinaryUtils::MakeDateLocal(2032, 1, 1)); + + BOOST_REQUIRE(!row.HasNext()); + + CheckEmpty(cursor); +} + +/** + * Test query for Timestamp type. + */ +BOOST_AUTO_TEST_CASE(TestFieldsQueryTimestampLess) +{ + // Test simple query. + Cache<int, QueryPerson> cache = GetCache(); + + // Test query with field of type 'Timestamp'. + SqlFieldsQuery qry("select recordCreated from QueryPerson where recordCreated<'2016-01-01 01:00:00'"); + + QueryFieldsCursor cursor = cache.Query(qry); + CheckEmpty(cursor); + + int32_t entryCnt = 1000; // Number of entries. + + for (int i = 0; i < entryCnt; i++) + { + std::stringstream stream; + + stream << "A" << i; + + QueryPerson val(stream.str(), i * 10, BinaryUtils::MakeDateLocal(1980 + i, 1, 1), + BinaryUtils::MakeTimestampLocal(2016, 1, 1, i / 60, i % 60)); + + cache.Put(i, val); + } + + cursor = cache.Query(qry); + + IgniteError error; + + int32_t resultSetSize = 0; // Number of entries in query result set. + + while (cursor.HasNext(error)) + { + BOOST_REQUIRE(error.GetCode() == IgniteError::IGNITE_SUCCESS); + + QueryFieldsRow row = cursor.GetNext(error); + BOOST_REQUIRE(error.GetCode() == IgniteError::IGNITE_SUCCESS); + + BOOST_REQUIRE(row.HasNext(error)); + BOOST_REQUIRE(error.GetCode() == IgniteError::IGNITE_SUCCESS); + + Timestamp recordCreated = row.GetNext<Timestamp>(error); + BOOST_REQUIRE(error.GetCode() == IgniteError::IGNITE_SUCCESS); + + BOOST_CHECK(recordCreated == BinaryUtils::MakeTimestampLocal(2016, 1, 1, 0, resultSetSize % 60, 0)); + + BOOST_CHECK(recordCreated < BinaryUtils::MakeTimestampLocal(2016, 1, 1, 1, 0, 0)); + + BOOST_REQUIRE(!row.HasNext()); + + ++resultSetSize; + } + + BOOST_CHECK_EQUAL(resultSetSize, 60); + + CheckEmpty(cursor); +} + +/** + * Test query for Timestamp type. + */ +BOOST_AUTO_TEST_CASE(TestFieldsQueryTimestampMore) +{ + // Test simple query. + Cache<int, QueryPerson> cache = GetCache(); + + // Test query with field of type 'Timestamp'. + SqlFieldsQuery qry("select recordCreated from QueryPerson where recordCreated>'2016-01-01 15:30:00'"); + + QueryFieldsCursor cursor = cache.Query(qry); + CheckEmpty(cursor); + + int32_t entryCnt = 1000; // Number of entries. + + for (int i = 0; i < entryCnt; i++) + { + std::stringstream stream; + + stream << "A" << i; + + QueryPerson val(stream.str(), i * 10, BinaryUtils::MakeDateLocal(1980 + i, 1, 1), + BinaryUtils::MakeTimestampLocal(2016, 1, 1, i / 60, i % 60)); + + cache.Put(i, val); + } + + cursor = cache.Query(qry); + + IgniteError error; + + int32_t resultSetSize = 0; // Number of entries in query result set. + + while (cursor.HasNext(error)) + { + BOOST_REQUIRE(error.GetCode() == IgniteError::IGNITE_SUCCESS); + + QueryFieldsRow row = cursor.GetNext(error); + BOOST_REQUIRE(error.GetCode() == IgniteError::IGNITE_SUCCESS); + + BOOST_REQUIRE(row.HasNext(error)); + BOOST_REQUIRE(error.GetCode() == IgniteError::IGNITE_SUCCESS); + + Timestamp recordCreated = row.GetNext<Timestamp>(error); + BOOST_REQUIRE(error.GetCode() == IgniteError::IGNITE_SUCCESS); + + int32_t minutes = resultSetSize + 31; + + BOOST_CHECK(recordCreated == BinaryUtils::MakeTimestampLocal(2016, 1, 1, 15 + minutes / 60, minutes % 60, 0)); + + BOOST_CHECK(recordCreated > BinaryUtils::MakeTimestampLocal(2016, 1, 1, 15, 30, 0)); + + BOOST_REQUIRE(!row.HasNext()); + + ++resultSetSize; + } + + BOOST_CHECK_EQUAL(resultSetSize, 69); + + CheckEmpty(cursor); +} + +/** + * Test query for Timestamp type. + */ +BOOST_AUTO_TEST_CASE(TestFieldsQueryTimestampEqual) +{ + // Test simple query. + Cache<int, QueryPerson> cache = GetCache(); + + // Test query with field of type 'Timestamp'. + SqlFieldsQuery qry("select recordCreated from QueryPerson where recordCreated='2016-01-01 09:18:00'"); + + QueryFieldsCursor cursor = cache.Query(qry); + CheckEmpty(cursor); + + int32_t entryCnt = 1000; // Number of entries. + + for (int i = 0; i < entryCnt; i++) + { + std::stringstream stream; + + stream << "A" << i; + + QueryPerson val(stream.str(), i * 10, BinaryUtils::MakeDateLocal(1980 + i, 1, 1), + BinaryUtils::MakeTimestampLocal(2016, 1, 1, i / 60, i % 60)); + + cache.Put(i, val); + } + + cursor = cache.Query(qry); + + IgniteError error; + + BOOST_REQUIRE(cursor.HasNext(error)); + + BOOST_REQUIRE(error.GetCode() == IgniteError::IGNITE_SUCCESS); + + QueryFieldsRow row = cursor.GetNext(error); + BOOST_REQUIRE(error.GetCode() == IgniteError::IGNITE_SUCCESS); + + BOOST_REQUIRE(row.HasNext(error)); + BOOST_REQUIRE(error.GetCode() == IgniteError::IGNITE_SUCCESS); + + Timestamp recordCreated = row.GetNext<Timestamp>(error); + BOOST_REQUIRE(error.GetCode() == IgniteError::IGNITE_SUCCESS); + + BOOST_CHECK(recordCreated == BinaryUtils::MakeTimestampLocal(2016, 1, 1, 9, 18, 0)); + + BOOST_REQUIRE(!row.HasNext()); + + CheckEmpty(cursor); +} + +BOOST_AUTO_TEST_SUITE_END() http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/core-test/src/cache_test.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core-test/src/cache_test.cpp b/modules/platforms/cpp/core-test/src/cache_test.cpp index a11865d..1df70df 100644 --- a/modules/platforms/cpp/core-test/src/cache_test.cpp +++ b/modules/platforms/cpp/core-test/src/cache_test.cpp @@ -476,6 +476,30 @@ BOOST_AUTO_TEST_CASE(TestGetOrCreateCache) BOOST_REQUIRE(7 == cache2.Get(5)); } +BOOST_AUTO_TEST_CASE(TestPutGetDate) +{ + // Get existing cache + cache::Cache<int, Date> cache = grid0.GetOrCreateCache<int, Date>("partitioned"); + + Date now = Date(time(NULL) * 1000); + + cache.Put(5, now); + + BOOST_REQUIRE(now == cache.Get(5)); +} + +BOOST_AUTO_TEST_CASE(TestPutGetTimestamp) +{ + // Get existing cache + cache::Cache<int, Timestamp> cache = grid0.GetOrCreateCache<int, Timestamp>("partitioned"); + + Timestamp now = Timestamp(time(NULL), 0); + + cache.Put(42, now); + + BOOST_REQUIRE(now == cache.Get(42)); +} + BOOST_AUTO_TEST_CASE(TestGetBigString) { // Get existing cache http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/core/Makefile.am ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core/Makefile.am b/modules/platforms/cpp/core/Makefile.am index 8b6b98d..50d20b2 100644 --- a/modules/platforms/cpp/core/Makefile.am +++ b/modules/platforms/cpp/core/Makefile.am @@ -15,50 +15,55 @@ ## limitations under the License. ## -ACLOCAL_AMFLAGS = "-Im4" +ACLOCAL_AMFLAGS =-I m4 -SUBDIRS = . include os/linux/include -DIST_SUBDIRS = . include os/linux/include +lib_LTLIBRARIES = libignite.la -AM_CPPFLAGS = -I$(srcdir)/include -I$(srcdir)/os/linux/include -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux -DIGNITE_IMPL -AM_CXXFLAGS = -Wall -std=c++0x -LIB_LDFLAGS = -no-undefined -version-info 1 +SUBDIRS = \ + include -COMMON_SRC = os/linux/src/impl/utils.cpp \ - src/ignite_error.cpp \ - src/guid.cpp \ - src/impl/handle_registry.cpp \ - src/impl/interop/interop_memory.cpp \ - src/impl/interop/interop_input_stream.cpp \ - src/impl/interop/interop_output_stream.cpp \ - src/binary/binary_type.cpp \ - src/impl/binary/binary_type_snapshot.cpp \ - src/impl/binary/binary_type_handler.cpp \ - src/impl/binary/binary_type_updater.cpp \ - src/impl/binary/binary_type_manager.cpp \ - src/impl/binary/binary_utils.cpp \ - src/impl/binary/binary_reader_impl.cpp \ - src/impl/binary/binary_writer_impl.cpp \ - src/impl/binary/binary_schema.cpp \ - src/binary/binary_containers.cpp \ - src/binary/binary_raw_reader.cpp \ - src/binary/binary_raw_writer.cpp \ - src/binary/binary_reader.cpp \ - src/binary/binary_writer.cpp \ - src/impl/binary/binary_type_updater_impl.cpp \ - src/impl/ignite_environment.cpp \ - src/impl/cache/query/query_impl.cpp \ - src/impl/cache/cache_impl.cpp \ - src/impl/ignite_impl.cpp \ - src/ignite.cpp \ - src/ignition.cpp +AM_CPPFLAGS = \ + -I$(srcdir)/include \ + -I@top_srcdir@/common/include \ + -I@top_srcdir@/common/os/linux/include \ + -I@top_srcdir@/binary/include \ + -I@top_srcdir@/jni/include \ + -I@top_srcdir@/jni/os/linux/include \ + -I$(JAVA_HOME)/include \ + -I$(JAVA_HOME)/include/linux \ + -DIGNITE_IMPL -lib_LTLIBRARIES = libignite.la -libignite_la_SOURCES = $(COMMON_SRC) -libignite_la_LDFLAGS = $(LIB_LDFLAGS) -L/usr/local/lib -lignite-common -ldl -version-info 0:0:0 -release $(PACKAGE_VERSION) +AM_CXXFLAGS = \ + -Wall \ + -std=c++0x + +libignite_la_LIBADD = \ + @top_srcdir@/jni/libignite-jni.la \ + @top_srcdir@/binary/libignite-binary.la + +libignite_la_LDFLAGS = \ + -no-undefined \ + -ldl \ + -version-info 0:0:0 \ + -release $(PACKAGE_VERSION) + +libignite_la_DEPENDENCIES = \ + @top_srcdir@/jni/libignite-jni.la \ + @top_srcdir@/binary/libignite-binary.la + +libignite_la_SOURCES = \ + src/ignite.cpp \ + src/ignition.cpp \ + src/impl/ignite_environment.cpp \ + src/impl/binary/binary_type_updater_impl.cpp \ + src/impl/handle_registry.cpp \ + src/impl/cache/query/query_impl.cpp \ + src/impl/cache/cache_impl.cpp \ + src/impl/interop/interop_external_memory.cpp \ + src/impl/ignite_impl.cpp pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = ignite.pc +pkgconfig_DATA = $(srcdir)/ignite.pc clean-local: $(RM) *.gcno *.gcda http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/core/configure.ac ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core/configure.ac b/modules/platforms/cpp/core/configure.ac deleted file mode 100644 index 344aeb5..0000000 --- a/modules/platforms/cpp/core/configure.ac +++ /dev/null @@ -1,62 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# -*- Autoconf -*- -# Process this file with autoconf to produce a configure script. - -AC_PREREQ([2.69]) -AC_INIT([Apache Ignite C++], [1.6.0.8653], [[email protected]], [ignite], [ignite.apache.org]) -AC_CONFIG_SRCDIR(src) - -AC_CANONICAL_SYSTEM -AC_CONFIG_MACRO_DIR([m4]) -AC_LANG([C++]) - -# Initialize automake -AM_INIT_AUTOMAKE([-Wall foreign subdir-objects]) -AC_CONFIG_HEADER(config.h) - -AM_PROG_AR - -# Checks for programs. -GXX="-g -O2" - -AC_PROG_CXX - -# Initialize Libtool -LT_INIT - -# Checks for libraries. -AC_CHECK_LIB([pthread], [pthread_mutex_lock]) - -# Checks for header files. - -# Checks for typedefs, structures, and compiler characteristics. -AC_C_INLINE -AC_TYPE_INT16_T -AC_TYPE_INT32_T -AC_TYPE_INT64_T -AC_TYPE_INT8_T -AC_TYPE_PID_T -AC_TYPE_SIZE_T - -# Checks for library functions. -AC_FUNC_ERROR_AT_LINE - -AC_CONFIG_FILES(Makefile include/Makefile os/linux/include/Makefile ignite.pc) - -AC_OUTPUT http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/core/include/Makefile.am ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core/include/Makefile.am b/modules/platforms/cpp/core/include/Makefile.am index b28caed..7368b9f 100644 --- a/modules/platforms/cpp/core/include/Makefile.am +++ b/modules/platforms/cpp/core/include/Makefile.am @@ -15,55 +15,33 @@ ## limitations under the License. ## -ACLOCAL_AMFLAGS = "-Im4" +ACLOCAL_AMFLAGS =-I m4 -nobase_include_HEADERS = ignite/cache/cache.h \ - ignite/cache/cache_entry.h \ - ignite/cache/cache_peek_mode.h \ - ignite/cache/query/query_argument.h \ - ignite/cache/query/query_cursor.h \ - ignite/cache/query/query_fields_cursor.h \ - ignite/cache/query/query_fields_row.h \ - ignite/cache/query/query_scan.h \ - ignite/cache/query/query_sql.h \ - ignite/cache/query/query_sql_fields.h \ - ignite/cache/query/query_text.h \ - ignite/cache/query/query.h \ - ignite/impl/cache/cache_impl.h \ - ignite/impl/cache/query/query_impl.h \ - ignite/impl/cache/query/query_fields_row_impl.h \ - ignite/impl/interop/interop.h \ - ignite/impl/interop/interop_input_stream.h \ - ignite/impl/interop/interop_memory.h \ - ignite/impl/interop/interop_output_stream.h \ - ignite/impl/binary/binary_type_handler.h \ - ignite/impl/binary/binary_type_manager.h \ - ignite/impl/binary/binary_type_snapshot.h \ - ignite/impl/binary/binary_type_updater.h \ - ignite/impl/binary/binary_type_updater_impl.h \ - ignite/impl/binary/binary_common.h \ - ignite/impl/binary/binary_id_resolver.h \ - ignite/impl/binary/binary_reader_impl.h \ - ignite/impl/binary/binary_utils.h \ - ignite/impl/binary/binary_writer_impl.h \ - ignite/impl/binary/binary_schema.h \ - ignite/impl/ignite_environment.h \ - ignite/impl/ignite_impl.h \ - ignite/impl/handle_registry.h \ - ignite/impl/operations.h \ - ignite/binary/binary.h \ - ignite/binary/binary_consts.h \ - ignite/binary/binary_containers.h \ - ignite/binary/binary_type.h \ - ignite/binary/binary_raw_reader.h \ - ignite/binary/binary_raw_writer.h \ - ignite/binary/binary_reader.h \ - ignite/binary/binary_writer.h \ - ignite/ignite.h \ - ignite/ignite_configuration.h \ - ignite/ignite_error.h \ - ignite/ignition.h \ - ignite/guid.h +nobase_include_HEADERS = \ + ignite/ignite_configuration.h \ + ignite/ignite.h \ + ignite/impl/binary/binary_type_updater_impl.h \ + ignite/impl/operations.h \ + ignite/impl/ignite_environment.h \ + ignite/impl/ignite_impl.h \ + ignite/impl/cache/query/query_fields_row_impl.h \ + ignite/impl/cache/query/query_impl.h \ + ignite/impl/cache/cache_impl.h \ + ignite/impl/interop/interop_external_memory.h \ + ignite/impl/handle_registry.h \ + ignite/cache/query/query_fields_row.h \ + ignite/cache/query/query_fields_cursor.h \ + ignite/cache/query/query_scan.h \ + ignite/cache/query/query_cursor.h \ + ignite/cache/query/query_sql.h \ + ignite/cache/query/query.h \ + ignite/cache/query/query_argument.h \ + ignite/cache/query/query_sql_fields.h \ + ignite/cache/query/query_text.h \ + ignite/cache/cache.h \ + ignite/cache/cache_entry.h \ + ignite/cache/cache_peek_mode.h \ + ignite/ignition.h uninstall-hook: - find ${includedir}/ignite -type d -empty -delete + if [ -d ${includedir}/ignite ]; then find ${includedir}/ignite -type d -empty -delete; fi http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/core/include/ignite/binary/binary.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core/include/ignite/binary/binary.h b/modules/platforms/cpp/core/include/ignite/binary/binary.h deleted file mode 100644 index 1ffa3e5..0000000 --- a/modules/platforms/cpp/core/include/ignite/binary/binary.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @file - * Includes all binary API headers. - */ - -#ifndef _IGNITE_BINARY -#define _IGNITE_BINARY - -#include "ignite/binary/binary_consts.h" -#include "ignite/binary/binary_containers.h" -#include "ignite/binary/binary_type.h" -#include "ignite/binary/binary_raw_reader.h" -#include "ignite/binary/binary_raw_writer.h" -#include "ignite/binary/binary_reader.h" -#include "ignite/binary/binary_writer.h" - -#endif \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/core/include/ignite/binary/binary_consts.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core/include/ignite/binary/binary_consts.h b/modules/platforms/cpp/core/include/ignite/binary/binary_consts.h deleted file mode 100644 index db7cc38..0000000 --- a/modules/platforms/cpp/core/include/ignite/binary/binary_consts.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @file - * Declares specific binary constatants - */ - -#ifndef _IGNITE_BINARY_CONSTS -#define _IGNITE_BINARY_CONSTS - -#include <ignite/common/common.h> - -namespace ignite -{ - namespace binary - { - /** - * Binary collection types. - */ - enum CollectionType - { - /** - * Undefined. Maps to ArrayList in Java. - */ - IGNITE_COLLECTION_UNDEFINED = 0, - - /** - * Array list. Maps to ArrayList in Java. - */ - IGNITE_COLLECTION_ARRAY_LIST = 1, - - /** - * Linked list. Maps to LinkedList in Java. - */ - IGNITE_COLLECTION_LINKED_LIST = 2, - - /** - * Hash set. Maps to HashSet in Java. - */ - IGNITE_COLLECTION_HASH_SET = 3, - - /** - * Linked hash set. Maps to LinkedHashSet in Java. - */ - IGNITE_COLLECTION_LINKED_HASH_SET = 4 - }; - - /** - * Binary map types. - */ - enum MapType - { - /** - * Undefined. Maps to HashMap in Java. - */ - IGNITE_MAP_UNDEFINED = 0, - - /** - * Hash map. Maps to HashMap in Java. - */ - IGNITE_MAP_HASH_MAP = 1, - - /** - * Linked hash map. Maps to LinkedHashMap in Java. - */ - IGNITE_MAP_LINKED_HASH_MAP = 2 - }; - } -} - -#endif \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/764c97b9/modules/platforms/cpp/core/include/ignite/binary/binary_containers.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core/include/ignite/binary/binary_containers.h b/modules/platforms/cpp/core/include/ignite/binary/binary_containers.h deleted file mode 100644 index 94b2c81..0000000 --- a/modules/platforms/cpp/core/include/ignite/binary/binary_containers.h +++ /dev/null @@ -1,530 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @file - * Declares binary reader and writer types for the collections. - */ - -#ifndef _IGNITE_BINARY_CONTAINERS -#define _IGNITE_BINARY_CONTAINERS - -#include <stdint.h> - -#include "ignite/impl/binary/binary_writer_impl.h" -#include "ignite/impl/binary/binary_reader_impl.h" -#include "ignite/impl/utils.h" -#include "ignite/binary/binary_consts.h" - -namespace ignite -{ - namespace binary - { - /** - * Binary string array writer. - */ - class IGNITE_IMPORT_EXPORT BinaryStringArrayWriter - { - public: - /** - * Constructor. - * - * @param id Identifier. - * @param impl Writer. - */ - BinaryStringArrayWriter(impl::binary::BinaryWriterImpl* impl, int32_t id); - - /** - * Write string. - * - * @param val Null-terminated character sequence. - */ - void Write(const char* val); - - /** - * Write string. - * - * @param val String. - * @param len String length (characters). - */ - void Write(const char* val, int32_t len); - - /** - * Write string. - * - * @param val String. - */ - void Write(const std::string& val) - { - Write(val.c_str()); - } - - /** - * Close the writer. - */ - void Close(); - private: - /** Implementation delegate. */ - impl::binary::BinaryWriterImpl* impl; - - /** Idnetifier. */ - const int32_t id; - }; - - /** - * Binary collection writer. - */ - template<typename T> - class IGNITE_IMPORT_EXPORT BinaryArrayWriter - { - public: - /** - * Constructor. - * - * @param impl Writer. - * @param id Identifier. - */ - BinaryArrayWriter(impl::binary::BinaryWriterImpl* impl, int32_t id) : impl(impl), id(id) - { - // No-op. - } - - /** - * Write a value. - * - * @param val Value. - */ - void Write(const T& val) - { - impl->WriteElement<T>(id, val); - } - - /** - * Close the writer. - */ - void Close() - { - impl->CommitContainer(id); - } - private: - /** Implementation delegate. */ - impl::binary::BinaryWriterImpl* impl; - - /** Idnetifier. */ - const int32_t id; - }; - - /** - * Binary collection writer. - */ - template<typename T> - class IGNITE_IMPORT_EXPORT BinaryCollectionWriter - { - public: - /** - * Constructor. - * - * @param impl Writer. - * @param id Identifier. - */ - BinaryCollectionWriter(impl::binary::BinaryWriterImpl* impl, int32_t id) : impl(impl), id(id) - { - // No-op. - } - - /** - * Write a value. - * - * @param val Value. - */ - void Write(const T& val) - { - impl->WriteElement<T>(id, val); - } - - /** - * Close the writer. - */ - void Close() - { - impl->CommitContainer(id); - } - private: - /** Implementation delegate. */ - impl::binary::BinaryWriterImpl* impl; - - /** Identifier. */ - const int32_t id; - }; - - /** - * Binary map writer. - */ - template<typename K, typename V> - class IGNITE_IMPORT_EXPORT BinaryMapWriter - { - public: - /** - * Constructor. - * - * @param impl Writer. - */ - BinaryMapWriter(impl::binary::BinaryWriterImpl* impl, int32_t id) : impl(impl), id(id) - { - // No-op. - } - - /** - * Write a value. - * - * @param key Key. - * @param val Value. - */ - void Write(const K& key, const V& val) - { - impl->WriteElement<K, V>(id, key, val); - } - - /** - * Close the writer. - */ - void Close() - { - impl->CommitContainer(id); - } - private: - /** Implementation delegate. */ - impl::binary::BinaryWriterImpl* impl; - - /** Identifier. */ - const int32_t id; - }; - - /** - * Binary string array reader. - */ - class IGNITE_IMPORT_EXPORT BinaryStringArrayReader - { - public: - /** - * Constructor. - * - * @param impl Reader. - * @param id Identifier. - * @param size Array size. - */ - BinaryStringArrayReader(impl::binary::BinaryReaderImpl* impl, int32_t id, int32_t size); - - /** - * Check whether next element is available for read. - * - * @return True if available. - */ - bool HasNext(); - - /** - * Get next element. - * - * @param res Array to store data to. - * @param len Expected length of string. NULL terminator will be set in case len is - * greater than real string length. - * @return Actual amount of elements read. If "len" argument is less than actual - * array size or resulting array is set to null, nothing will be written - * to resulting array and returned value will contain required array length. - * -1 will be returned in case array in stream was null. - */ - int32_t GetNext(char* res, int32_t len); - - /** - * Get next element. - * - * @return String. - */ - std::string GetNext() - { - int32_t len = GetNext(NULL, 0); - - if (len != -1) - { - impl::utils::SafeArray<char> arr(len + 1); - - GetNext(arr.target, len + 1); - - return std::string(arr.target); - } - else - return std::string(); - } - - /** - * Get array size. - * - * @return Size or -1 if array is NULL. - */ - int32_t GetSize() const; - - /** - * Whether array is NULL. - */ - bool IsNull() const; - private: - /** Implementation delegate. */ - impl::binary::BinaryReaderImpl* impl; - - /** Identifier. */ - const int32_t id; - - /** Size. */ - const int32_t size; - }; - - /** - * Binary array reader. - */ - template<typename T> - class BinaryArrayReader - { - public: - /** - * Constructor. - * - * @param impl Reader. - * @param id Identifier. - * @param size Array size. - */ - BinaryArrayReader(impl::binary::BinaryReaderImpl* impl, int32_t id, int32_t size) : - impl(impl), id(id), size(size) - { - // No-op. - } - - /** - * Check whether next element is available for read. - * - * @return True if available. - */ - bool HasNext() - { - return impl->HasNextElement(id); - } - - /** - * Read next element. - * - * @return Next element. - */ - T GetNext() - { - return impl->ReadElement<T>(id); - } - - /** - * Get array size. - * - * @return Size or -1 if array is NULL. - */ - int32_t GetSize() - { - return size; - } - - /** - * Whether array is NULL. - */ - bool IsNull() - { - return size == -1; - } - private: - /** Implementation delegate. */ - impl::binary::BinaryReaderImpl* impl; - - /** Identifier. */ - const int32_t id; - - /** Size. */ - const int32_t size; - }; - - /** - * Binary collection reader. - */ - template<typename T> - class BinaryCollectionReader - { - public: - /** - * Constructor. - * - * @param impl Reader. - * @param id Identifier. - * @param type Collection type. - * @param size Collection size. - */ - BinaryCollectionReader(impl::binary::BinaryReaderImpl* impl, int32_t id, - const CollectionType type, int32_t size) : impl(impl), id(id), type(type), size(size) - { - // No-op. - } - - /** - * Check whether next element is available for read. - * - * @return True if available. - */ - bool HasNext() - { - return impl->HasNextElement(id); - } - - /** - * Read next element. - * - * @return Next element. - */ - T GetNext() - { - return impl->ReadElement<T>(id); - } - - /** - * Get collection type. - * - * @return Type. - */ - CollectionType GetType() - { - return type; - } - - /** - * Get collection size. - * - * @return Size or -1 if collection is NULL. - */ - int32_t GetSize() - { - return size; - } - - /** - * Whether collection is NULL. - */ - bool IsNull() - { - return size == -1; - } - private: - /** Implementation delegate. */ - impl::binary::BinaryReaderImpl* impl; - - /** Identifier. */ - const int32_t id; - - /** Collection type. */ - const CollectionType type; - - /** Size. */ - const int32_t size; - }; - - /** - * Binary map reader. - */ - template<typename K, typename V> - class BinaryMapReader - { - public: - /** - * Constructor. - * - * @param impl Reader. - * @param id Identifier. - * @param type Map type. - * @param size Map size. - */ - BinaryMapReader(impl::binary::BinaryReaderImpl* impl, int32_t id, MapType type, - int32_t size) : impl(impl), id(id), type(type), size(size) - { - // No-op. - } - - /** - * Check whether next element is available for read. - * - * @return True if available. - */ - bool HasNext() - { - return impl->HasNextElement(id); - } - - /** - * Read next element. - * - * @param key Key. - * @param val Value. - */ - void GetNext(K* key, V* val) - { - return impl->ReadElement<K, V>(id, key, val); - } - - /** - * Get map type. - * - * @return Type. - */ - MapType GetType() - { - return type; - } - - /** - * Get map size. - * - * @return Size or -1 if map is NULL. - */ - int32_t GetSize() - { - return size; - } - - /** - * Whether map is NULL. - */ - bool IsNull() - { - return size == -1; - } - private: - /** Implementation delegate. */ - impl::binary::BinaryReaderImpl* impl; - - /** Identifier. */ - const int32_t id; - - /** Map type. */ - const MapType type; - - /** Size. */ - const int32_t size; - }; - } -} - -#endif \ No newline at end of file
