Merge branch 'release/1.8' of github.com:apache/geode-native into release/1.8
diff --git a/.cpackignore b/.cpackignore
index 7881528..dfa89f11 100644
--- a/.cpackignore
+++ b/.cpackignore
@@ -1,16 +1,17 @@
-/\.git/
-/\.DS_Store
+/\\.git/
+/\\.DS_Store
/build-.*/
/build/
-/\.settings/
-/\.cproject
-/\.project
-/\.idea/
-\.vs/
-\.vscode/
+/\\.settings/
+/\\.cproject
+/\\.project
+/\\.idea/
+\\.vs/
+\\.vscode/
/examples/dotnet/.*/bin/
/examples/dotnet/.*/obj/
-\.ruby-version
+\\.ruby-version
+
diff --git a/.gitignore b/.gitignore
index 3486d30..9e0f0cd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
/build-*/
+/cmake-build-*/
/build/
/.settings/
/.cproject
@@ -11,3 +12,5 @@
/examples/dotnet/*/bin/
/examples/dotnet/*/obj/
.ruby-version
+
+.DS_Store
diff --git a/.lgtm.yml b/.lgtm.yml
new file mode 100644
index 0000000..c941789
--- /dev/null
+++ b/.lgtm.yml
@@ -0,0 +1,16 @@
+extraction:
+ cpp:
+ configure:
+ command:
+ - mkdir _lgtm_build_dir
+ - cd _lgtm_build_dir
+ - wget -O apache-geode.zip http://mirror.transip.net/apache/geode/1.7.0/apache-geode-1.7.0.zip
+ - unzip apache-geode.zip
+ - cmake -DGEODE_ROOT="`pwd`/apache-geode-1.7.0" ..
+ - cd dependencies && cmake --build . -- -j2
+ index:
+ build_command:
+ - cd _lgtm_build_dir && cmake --build . --target apache-geode -- -j 2
+ csharp:
+ index:
+ buildless: true
diff --git a/.ratignore b/.ratignore
index 108dbb7..dbf556f 100644
--- a/.ratignore
+++ b/.ratignore
@@ -1,36 +1,39 @@
-# text files
-.*\.clang-format$
-.*\.clang-tidy$
-.*\.gitignore$
-.*\.ratignore$
+# rat -E only matches filename components
+# All matches are anchored automatically to who string
-.*md$
-.*json$
-.*deprecated_xml_instructions.txt$
+# /
+\.clang-format
+\.clang-tidy
+\.gitignore
+\.ratignore
+\.lgtm.yml
+\.lcovrc
+\.cpackignore
-# generated files
-.*Resources.Designer.cs$
-.*Settings.Designer.cs$
+# dependencies/*/
+patches
-# public domain
-.*CPPDictionary.hpp$
-.*CPPSymbol.hpp$
-.*CPP_parser.g$
-.*DictEntry.hpp$
-.*Dictionary.cpp$
-.*Dictionary.hpp$
-.*STDCTokenTypes.txt$
-.*Support.cpp$
+# packer/*/
+.*\.cloud-init
+.*\.json
-# expect script
-.*changepasswd$
-.*winrm.cloud-init$
+# docs/
+Gemfile.lock
+package-list
+.*\.md
+.*\.md.erb
-# doxygen
-.*package-list$
-.*testframeworkdox.txt$
-docs
+# contrib/pdxautoserializer
+# public domain sources
+CPPDictionary.hpp
+CPPSymbol.hpp
+CPP_parser.g
+DictEntry.hpp
+Dictionary.cpp
+Dictionary.hpp
+STDCTokenTypes.txt
+Support.cpp
-# patches
-.*patches$
-.*ACE.config.h.in$
+# well known build directories
+build
+cmake-build-.*
diff --git a/.travis.yml b/.travis.yml
index d61ddab..304d967 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -29,8 +29,8 @@
- SOURCE_DIR="/geode-native"
matrix:
- - DOCKER_COMMAND="java -jar /apache-rat-0.12/apache-rat-0.12.jar -E ${SOURCE_DIR}/.ratignore -d ${SOURCE_DIR}"
- - DOCKER_COMMAND="mkdir build && cd build && cmake ${SOURCE_DIR} -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DCMAKE_CXX_CLANG_TIDY=clang-tidy && cmake --build . -- -j2 && ./cppcache/test/apache-geode_unittests && git -C ${SOURCE_DIR} diff --exit-code"
+ - DOCKER_COMMAND="echo rat && mkdir build && cd build && cmake ${SOURCE_DIR} -DUSE_RAT=ON && cmake --build . --target rat-check"
+ - DOCKER_COMMAND="echo test && mkdir build && cd build && cmake ${SOURCE_DIR} -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DCMAKE_CXX_CLANG_TIDY=clang-tidy && cmake --build . -- -j2 && ./cppcache/test/apache-geode_unittests && git -C ${SOURCE_DIR} diff --exit-code"
install:
- docker pull "${DOCKER_IMAGE}"
diff --git a/BUILDING.md b/BUILDING.md
index 79f2eae..4ddd014 100644
--- a/BUILDING.md
+++ b/BUILDING.md
@@ -1,7 +1,7 @@
# Building
## Prerequisites (All Platforms)
-* [CMake 3.10](https://cmake.org/) or newer
+* [CMake 3.12](https://cmake.org/) or newer
* C++11 compiler *(see platform specific requirements)*
* [Doxygen 8.11](http://www.stack.nl/~dimitri/doxygen/download.html) *(for building source documentation)*
* [Apache Geode](http://geode.apache.org/releases/) binaries installed or available to link against
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4b34ca6..93fd5a1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -13,11 +13,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.12)
project(nativeclient LANGUAGES C CXX)
option(USE_PCH "Use precompiled headers (PCH)." OFF)
-option(USE_CPP_COVERAGE "Enable profiling and coverage report analysis for apache-geode cpp library" OFF)
+option(USE_CPP_COVERAGE "Enable profiling and coverage report analysis for apache-geode cpp library." OFF)
+option(USE_RAT "Enable Apache Rat checking." OFF)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
@@ -37,9 +38,16 @@
endif()
endif()
+get_property(GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
+if(NOT CMAKE_BUILD_TYPE AND NOT GENERATOR_IS_MULTI_CONFIG)
+ message(STATUS "Using default build type 'Debug'.")
+ set(CMAKE_BUILD_TYPE Debug CACHE STRING "Specifies the build type on single-configuration generators." FORCE)
+endif()
+
set(CMAKE_DOTNET_TARGET_FRAMEWORK_VERSION "4.5.2")
set(DOTNET_TARGET_FRAMEWORK_VERSION "4.5.2")
set(BUILD_BITS 64 CACHE STRING "Build for 64 (Geode default) or 32 bit.")
+option(BUILD_BENCHMARKS "Build benchmarks" ON)
set(PRODUCT_VENDOR "Apache" CACHE STRING "Product vendor")
set(PRODUCT_VENDOR_NAME "The Apache Software Foundation" CACHE STRING "Product vendor full legal name")
@@ -88,11 +96,6 @@
# $ cmake -G Xcode -DCMAKE_INSTALL_PREFIX=/my/favorite/location ..
set(CMAKE_INSTALL_PREFIX "nativeclient" CACHE STRING "Install prefix")
-set(CMAKE_CONFIGURATION_TYPES Debug Release)
-if (NOT CMAKE_BUILD_TYPE)
- set(CMAKE_BUILD_TYPE Debug)
-endif()
-
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# TODO this doesn't seem to have effect
@@ -170,6 +173,13 @@
add_library(_WarningsAsError INTERFACE)
add_library(_CppCodeCoverage INTERFACE)
+include(CheckIPOSupported)
+check_ipo_supported(RESULT ipo_supported)
+if(ipo_supported)
+ set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE)
+ set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO TRUE)
+endif()
+
if(CMAKE_CXX_COMPILER_ID MATCHES "SunPro")
# Force linker to error on undefined symbols in shared libraries
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -z defs")
@@ -272,11 +282,6 @@
# Enables multiprocess compiles
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
- # Enables whole program optimizaion and link time code generation for release.
- set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /GL")
- set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG:incremental")
- set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /LTCG:incremental")
-
# Enables strong name signing
set(STRONG_NAME_KEY "" CACHE FILEPATH "Strong Name Key File")
if(EXISTS "${STRONG_NAME_KEY}")
@@ -294,14 +299,6 @@
message(FATAL_ERROR "Utility ar not found.")
endif()
-if (WIN32 OR ${CMAKE_GENERATOR} STREQUAL "Xcode")
- set(CMAKE_USES_BUILDTYPE TRUE)
- set ( _DEBUG_OR_RELEASE $<$<CONFIG:Debug>:Debug>$<$<NOT:$<CONFIG:Debug>>:Release>)
-else()
- set(CMAKE_USES_BUILDTYPE FALSE)
- set ( _DEBUG_OR_RELEASE .)
-endif()
-
# Default to only showing output on failure for unit tests but allow
# overriding with the CTEST_UNITTEST_VERBOSITY environment variable.
set(CTEST_UNITTEST_VERBOSITY --output-on-failure)
@@ -363,3 +360,14 @@
PATTERN "templates/security/CMakeLists.txt" EXCLUDE
PATTERN "templates/security/CMakeLists.txt.forInstall" EXCLUDE)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/templates/security/CMakeLists.txt.forInstall RENAME CMakeLists.txt DESTINATION templates/security)
+
+if (USE_RAT)
+ add_custom_target( rat-check
+ COMMAND ${CMAKE_COMMAND}
+ -DJava_JAVA_EXECUTABLE=${Java_JAVA_EXECUTABLE}
+ -DRat_JAR=${Rat_JAR}
+ -P cmake/RatCheck.cmake
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ COMMENT "Checking source with Apache Rat."
+ )
+endif()
diff --git a/LICENSE b/LICENSE
index 4d8ae26..d02768b 100644
--- a/LICENSE
+++ b/LICENSE
@@ -209,3 +209,29 @@
components are subject to the terms and conditions of the following
licenses.
+---------------------------------------------------------------------------
+The MIT License (http://opensource.org/licenses/mit-license.html)
+---------------------------------------------------------------------------
+
+Apache Geode bundles the following files under the MIT license:
+
+ - cotire (https://github.com/sakra/cotire), Copyright (c) 2012-
+ 2018 Sascha Kratky
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/NOTICE b/NOTICE
index 68b6289..d8e80ac 100644
--- a/NOTICE
+++ b/NOTICE
@@ -1,5 +1,5 @@
Apache Geode Native Client
-Copyright 2017 The Apache Software Foundation.
+Copyright 2017-2018 The Apache Software Foundation.
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
diff --git a/bin/vcvarsall.bat b/bin/vcvarsall.bat
index 71221cb..df53c10 100644
--- a/bin/vcvarsall.bat
+++ b/bin/vcvarsall.bat
@@ -15,8 +15,6 @@
rem See the License for the specific language governing permissions and
rem limitations under the License.
-set vs=Microsoft Visual Studio 14.0
-
-call "c:\Program Files (x86)\%vs%\VC\vcvarsall.bat" %1
-
+call "c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" %1
+C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build
echo Environment setup for %vs% %1.
diff --git a/clicache/integration-test/CMakeLists.txt b/clicache/integration-test/CMakeLists.txt
index c849d06..1e16d35 100644
--- a/clicache/integration-test/CMakeLists.txt
+++ b/clicache/integration-test/CMakeLists.txt
@@ -56,7 +56,7 @@
)
endmacro()
-foreach( lib ssl sqlite )
+foreach( lib OpenSSL::SSL SQLite::sqlite3 )
get_target_property(runtime_path ${lib} INTERFACE_RUNTIME_DIR)
set(PATH ${PATH} ${runtime_path})
endforeach()
@@ -94,6 +94,7 @@
# Label any flaky tests here
set_property(TEST ThinClientCqStatusTestTwoServers PROPERTY LABELS FLAKY)
+set_property(TEST ThinClientPoolTestsN PROPERTY LABELS FLAKY)
set_property(TEST ThinClientQueryTestsN PROPERTY LABELS FLAKY)
# Label any tests that always fail here
diff --git a/clicache/integration-test/DataOutputTests.cs b/clicache/integration-test/DataOutputTests.cs
index 5c253ee..093c779 100755
--- a/clicache/integration-test/DataOutputTests.cs
+++ b/clicache/integration-test/DataOutputTests.cs
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-using System;
+using System;
using System.Collections.Generic;
using System.Reflection;
diff --git a/clicache/integration-test/Settings.xml b/clicache/integration-test/Settings.xml
index 50cb7f5..e683565 100644
--- a/clicache/integration-test/Settings.xml
+++ b/clicache/integration-test/Settings.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
diff --git a/clicache/integration-test/ThinClientAppDomainQueryTests.cs b/clicache/integration-test/ThinClientAppDomainQueryTests.cs
index ed58d28..714968a 100644
--- a/clicache/integration-test/ThinClientAppDomainQueryTests.cs
+++ b/clicache/integration-test/ThinClientAppDomainQueryTests.cs
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-using System;
+using System;
namespace Apache.Geode.Client.UnitTests
{
diff --git a/clicache/integration-test/ThinClientSecurityAuthSetAuthInitializeTests.cs b/clicache/integration-test/ThinClientSecurityAuthSetAuthInitializeTests.cs
index ebabd89..c184383 100644
--- a/clicache/integration-test/ThinClientSecurityAuthSetAuthInitializeTests.cs
+++ b/clicache/integration-test/ThinClientSecurityAuthSetAuthInitializeTests.cs
@@ -1,4 +1,4 @@
-/*
+/*
* 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.
diff --git a/clicache/integration-test/Timeouts.xml b/clicache/integration-test/Timeouts.xml
index 458a175..20b432a 100644
--- a/clicache/integration-test/Timeouts.xml
+++ b/clicache/integration-test/Timeouts.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
diff --git a/clicache/integration-test/UnitTests.csproj.in b/clicache/integration-test/UnitTests.csproj.in
index 8fc93ff..47ead0b 100644
--- a/clicache/integration-test/UnitTests.csproj.in
+++ b/clicache/integration-test/UnitTests.csproj.in
@@ -615,7 +615,7 @@
<Content Include="authz-ldap.xml" />
</ItemGroup>
<ItemGroup>
- <ProjectReference Include="$(CMAKE_BINARY_DIR)\plugins\SQLiteCLI\SQLiteCLI.csproj">
+ <ProjectReference Include="$(CMAKE_BINARY_DIR)\plugins\SQLiteCLI\Apache.Geode.Plugins.SQLite.csproj">
<Project>{FF9597E3-A4DD-4FDE-871D-B0C66088762F}</Project>
<Name>SQLiteCLI</Name>
</ProjectReference>
diff --git a/clicache/integration-test/client_server_persistent_transactions.xml b/clicache/integration-test/client_server_persistent_transactions.xml
index a287c04..0a406f3 100644
--- a/clicache/integration-test/client_server_persistent_transactions.xml
+++ b/clicache/integration-test/client_server_persistent_transactions.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0"?>
+<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
diff --git a/clicache/integration-test/client_server_transactions.xml b/clicache/integration-test/client_server_transactions.xml
index b104b83..b562c48 100644
--- a/clicache/integration-test/client_server_transactions.xml
+++ b/clicache/integration-test/client_server_transactions.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0"?>
+<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
diff --git a/clicache/integration-test2/CMakeLists.txt b/clicache/integration-test2/CMakeLists.txt
index f555ef1..b8a3e78 100644
--- a/clicache/integration-test2/CMakeLists.txt
+++ b/clicache/integration-test2/CMakeLists.txt
@@ -20,42 +20,51 @@
get_target_property(JAVAOBJECT_JAR_PATH javaobject JAR_FILE)
-set(CRYPTO_IMPL_PATH "/../../../cryptoimpl/${CMAKE_BUILD_TYPE}")
-set(OPENSSL_PATH "/../../../dependencies/openssl/openssl-extern-prefix/${CMAKE_BUILD_TYPE}/bin")
-
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/packages.config ${CMAKE_CURRENT_BINARY_DIR}/packages.config COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cs.in ${CMAKE_CURRENT_BINARY_DIR}/Config.cs)
add_library( ${PROJECT_NAME} SHARED
- Cluster.cs
- ClusterTest.cs
- Config.cs.in
- ${CMAKE_CURRENT_BINARY_DIR}/Config.cs
- GfshTest.cs
- GfshExecuteTest.cs
- Gfsh.cs
- GfshExecute.cs
- CacheXml.cs
- CacheXmlTests.cs
- CqOperationTest.cs
- RegionTest.cs
- RegionSSLTest.cs
- Position.cs
- TestBase.cs
- cache.xml
- geode.properties
- xunit.runner.json
- packages.config
- SerializationTests.cs
- ClientSslKeys/client_keystore.password.pem
- ClientSslKeys/client_truststore.pem
- ServerSslKeys/server_keystore.jks
- ServerSslKeys/server_truststore.jks
+ Framework.cs
+ Cluster.cs
+ ClusterTest.cs
+ Config.cs.in
+ ${CMAKE_CURRENT_BINARY_DIR}/Config.cs
+ GfshTest.cs
+ GfshExecuteTest.cs
+ Gfsh.cs
+ GfshExecute.cs
+ CacheXml.cs
+ CacheXmlTests.cs
+ CqOperationTest.cs
+ FunctionExecutionTest.cs
+ QueryTest.cs
+ RegionTest.cs
+ RegionSSLTest.cs
+ Position.cs
+ TestBase.cs
+ cache.xml
+ geode.properties
+ xunit.runner.json
+ packages.config
+ SerializationTests.cs
+ ClientSslKeys/client_keystore.password.pem
+ ClientSslKeys/client_truststore.pem
+ ServerSslKeys/server_keystore.jks
+ ServerSslKeys/server_truststore.jks
)
-set_source_files_properties(cache.xml server.xml xunit.runner.json geode.properties ClientSslKeys/client_keystore.password.pem ClientSslKeys/client_truststore.pem ServerSslKeys/server_keystore.jks ServerSslKeys/server_truststore.jks PROPERTIES
- VS_COPY_TO_OUT_DIR Always
- VS_TOOL_OVERRIDE "None"
+set_source_files_properties(
+ cache.xml
+ server.xml
+ xunit.runner.json
+ geode.properties
+ ClientSslKeys/client_keystore.password.pem
+ ClientSslKeys/client_truststore.pem
+ ServerSslKeys/server_keystore.jks
+ ServerSslKeys/server_truststore.jks
+ PROPERTIES
+ VS_COPY_TO_OUT_DIR Always
+ VS_TOOL_OVERRIDE None
)
target_link_libraries(${PROJECT_NAME}
@@ -89,3 +98,13 @@
endif()
add_dependencies(${PROJECT_NAME} nuget-restore)
+
+add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy_directory
+ $<SHELL_PATH:$<TARGET_GENEX_EVAL:OpenSSL::SSL,$<TARGET_PROPERTY:OpenSSL::SSL,INTERFACE_RUNTIME_DIR>>>
+ $<SHELL_PATH:$<TARGET_FILE_DIR:${PROJECT_NAME}>>
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
+ $<SHELL_PATH:$<TARGET_FILE:cryptoImpl>>
+ $<$<CONFIG:Debug>:$<SHELL_PATH:$<TARGET_PDB_FILE:cryptoImpl>>>
+ $<SHELL_PATH:$<TARGET_FILE_DIR:${PROJECT_NAME}>>
+)
diff --git a/clicache/integration-test2/CacheXmlTests.cs b/clicache/integration-test2/CacheXmlTests.cs
index 4315d69..b9fa2b4 100644
--- a/clicache/integration-test2/CacheXmlTests.cs
+++ b/clicache/integration-test2/CacheXmlTests.cs
@@ -18,6 +18,7 @@
using System.IO;
using System.Threading;
using Xunit;
+using Xunit.Abstractions;
namespace Apache.Geode.Client.IntegrationTests
{
@@ -25,80 +26,50 @@
[Trait("Category", "Integration")]
public class CacheXmlTests : TestBase
{
+ public CacheXmlTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper)
+ {
+ }
+
[Fact]
public void ConstructAndGenerate()
{
- using (var gfsh = new GfshExecute())
+ string testDir = CreateTestCaseDirectoryName();
+ CleanTestCaseDirectory(testDir);
+
+ var template = new FileInfo("cache.xml");
+ var cacheXml = new CacheXml(template, 1234);
+ Assert.NotNull(cacheXml.File);
+ Assert.True(cacheXml.File.Exists);
+
+ using (var input = cacheXml.File.OpenText())
{
- try
- {
- string testDir = CreateTestCaseDirectoryName();
- CleanTestCaseDirectory(testDir);
-
- Assert.Equal(gfsh.start()
- .locator()
- .withDir(testDir)
- .withHttpServicePort(0)
- .execute(), 0);
- var template = new FileInfo("cache.xml");
- var cacheXml = new CacheXml(template, gfsh.LocatorPort);
- Assert.NotNull(cacheXml.File);
- Assert.True(cacheXml.File.Exists);
-
- using (var input = cacheXml.File.OpenText())
- {
- var content = input.ReadToEnd();
- Assert.True(content.Contains(gfsh.LocatorPort.ToString()));
- }
- }
- finally
- {
- Assert.Equal(gfsh.shutdown()
- .withIncludeLocators(true)
- .execute(), 0);
- }
+ var content = input.ReadToEnd();
+ Assert.True(content.Contains(1234.ToString()));
}
}
[Fact]
public void DisposeAndCleanup()
{
- using (var gfsh = new GfshExecute())
+ var testDir = CreateTestCaseDirectoryName();
+ CleanTestCaseDirectory(testDir);
+
+ FileInfo file;
+
+ var template = new FileInfo("cache.xml");
+ using (var cacheXml = new CacheXml(template, 1234))
{
- try
- {
- var testDir = CreateTestCaseDirectoryName();
- CleanTestCaseDirectory(testDir);
-
- Assert.Equal(gfsh.start()
- .locator()
- .withDir(testDir)
- .withHttpServicePort(0)
- .execute(), 0);
- FileInfo file;
-
- var template = new FileInfo("cache.xml");
- using (var cacheXml = new CacheXml(template, gfsh.LocatorPort))
- {
- Assert.NotNull(cacheXml.File);
- file = cacheXml.File;
- Assert.True(file.Exists);
- }
-
- file.Refresh();
-
- // File deletion via File.Delete (inside the file.Refresh() call)
- // is not synchronous so we need to potentially wait until the file
- // has been deleted here
- Assert.True(SpinWait.SpinUntil(() => !file.Exists, 10000));
- }
- finally
- {
- Assert.Equal(gfsh.shutdown()
- .withIncludeLocators(true)
- .execute(), 0);
- }
+ Assert.NotNull(cacheXml.File);
+ file = cacheXml.File;
+ Assert.True(file.Exists);
}
+
+ file.Refresh();
+
+ // File deletion via File.Delete (inside the file.Refresh() call)
+ // is not synchronous so we need to potentially wait until the file
+ // has been deleted here
+ Assert.True(SpinWait.SpinUntil(() => !file.Exists, 10000));
}
}
}
diff --git a/clicache/integration-test2/Cluster.cs b/clicache/integration-test2/Cluster.cs
index 5b5a442..4d59740 100644
--- a/clicache/integration-test2/Cluster.cs
+++ b/clicache/integration-test2/Cluster.cs
@@ -1,4 +1,4 @@
-/*
+/*
* 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.
@@ -22,6 +22,7 @@
using System.IO;
using System.Net.Sockets;
using Xunit;
+using Xunit.Abstractions;
namespace Apache.Geode.Client.IntegrationTests
{
@@ -33,37 +34,30 @@
private List<Locator> locators_;
private List<Server> servers_;
private string name_;
- private bool usessl_;
+ internal int jmxManagerPort = Framework.FreeTcpPort();
+ internal string keyStore_ = Environment.CurrentDirectory + "/ServerSslKeys/server_keystore.jks";
+ internal string keyStorePassword_ = "gemstone";
+ internal string trustStore_ = Environment.CurrentDirectory + "/ServerSslKeys/server_truststore.jks";
+ internal string trustStorePassword_ = "gemstone";
public Gfsh Gfsh { get; private set; }
- private const string sslPassword_ = "gemstone";
+ public bool UseSSL { get; set; }
- public bool UseSSL
+ internal PoolFactory ApplyLocators(PoolFactory poolFactory)
{
- get
+ foreach (var locator in locators_)
{
- return usessl_;
+ poolFactory.AddLocator(locator.Address.address, locator.Address.port);
}
- set
- {
- usessl_ = value;
- Gfsh.UseSSL = value;
- if (value)
- {
- var currentDir = Environment.CurrentDirectory;
- Gfsh.Keystore = currentDir + "/ServerSslKeys/server_keystore.jks";
- Gfsh.KeystorePassword = sslPassword_;
- Gfsh.Truststore = currentDir + "/ServerSslKeys/server_truststore.jks";
- Gfsh.TruststorePassword = sslPassword_;
- }
- }
+
+ return poolFactory;
}
- public Cluster(string name, int locatorCount, int serverCount)
+ public Cluster(ITestOutputHelper output, string name, int locatorCount, int serverCount)
{
started_ = false;
- Gfsh = new GfshExecute();
+ Gfsh = new GfshExecute(output);
UseSSL = false;
name_ = name;
locatorCount_ = locatorCount;
@@ -134,6 +128,32 @@
.execute();
}
}
+
+ public Cache CreateCache(IDictionary<string, string> properties)
+ {
+ var cacheFactory = new CacheFactory();
+
+ cacheFactory
+ .Set("log-level", "none")
+ .Set("statistic-sampling-enabled", "false");
+
+ foreach (var pair in properties)
+ {
+ cacheFactory.Set(pair.Key, pair.Value);
+ }
+
+ var cache = cacheFactory.Create();
+
+ ApplyLocators(cache.GetPoolFactory()).Create("default");
+
+ return cache;
+ }
+
+ public Cache CreateCache()
+ {
+ return CreateCache(new Dictionary<string, string>());
+ }
+
}
public struct Address
@@ -156,7 +176,7 @@
name_ = name;
var address = new Address();
address.address = "localhost";
- address.port = cluster.Gfsh.LocatorPort;
+ address.port = Framework.FreeTcpPort();
Address = address;
}
@@ -175,15 +195,35 @@
.withBindAddress(Address.address)
.withPort(Address.port)
.withMaxHeap("256m")
- .withJmxManagerPort(cluster_.Gfsh.JmxManagerPort)
+ .withJmxManagerPort(cluster_.jmxManagerPort)
+ .withJmxManagerStart(true)
.withHttpServicePort(0);
if (cluster_.UseSSL)
{
- locator.withUseSsl()
- .withConnect(false);
+ locator
+ .withConnect(false)
+ .withSslEnableComponents("locator,jmx")
+ .withSslKeyStore(cluster_.keyStore_)
+ .withSslKeyStorePassword(cluster_.keyStorePassword_)
+ .withSslTrustStore(cluster_.trustStore_)
+ .withSslTrustStorePassword(cluster_.trustStorePassword_);
}
result = locator.execute();
+
+ if (cluster_.UseSSL)
+ {
+ cluster_.Gfsh.connect()
+ .withJmxManager(Address.address, cluster_.jmxManagerPort)
+ .withUseSsl(true)
+ .withKeyStore(cluster_.keyStore_)
+ .withKeyStorePassword(cluster_.keyStorePassword_)
+ .withTrustStore(cluster_.trustStore_)
+ .withTrustStorePassword(cluster_.trustStorePassword_)
+ .execute();
+ }
+
started_ = true;
+
}
return result;
}
@@ -235,7 +275,13 @@
.withMaxHeap("1g");
if (cluster_.UseSSL)
{
- server.withUseSsl();
+ server
+ .withSslEnableComponents("server,locator,jmx")
+ .withSslKeyStore(cluster_.keyStore_)
+ .withSslKeyStorePassword(cluster_.keyStorePassword_)
+ .withSslTrustStore(cluster_.trustStore_)
+ .withSslTrustStorePassword(cluster_.trustStorePassword_);
+
}
result = server.execute();
started_ = true;
diff --git a/clicache/integration-test2/ClusterTest.cs b/clicache/integration-test2/ClusterTest.cs
index 1b91ebf..358966d 100644
--- a/clicache/integration-test2/ClusterTest.cs
+++ b/clicache/integration-test2/ClusterTest.cs
@@ -1,4 +1,4 @@
-/*
+/*
* 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.
@@ -19,12 +19,17 @@
using System.Diagnostics;
using System.Reflection;
using Xunit;
+using Xunit.Abstractions;
namespace Apache.Geode.Client.IntegrationTests
{
[Trait("Category", "Integration")]
public class ClusterTest : TestBase, IDisposable
{
+ public ClusterTest(ITestOutputHelper testOutputHelper) : base(testOutputHelper)
+ {
+ }
+
public void Dispose()
{
@@ -33,7 +38,7 @@
[Fact]
public void ClusterStartTest()
{
- using (var cluster = new Cluster(CreateTestCaseDirectoryName(), 1, 1))
+ using (var cluster = new Cluster(output, CreateTestCaseDirectoryName(), 1, 1))
{
Assert.True(cluster.Start());
}
@@ -42,7 +47,7 @@
[Fact]
public void ClusterStartWithTwoServersTest()
{
- using (var cluster = new Cluster(CreateTestCaseDirectoryName(), 1, 2))
+ using (var cluster = new Cluster(output, CreateTestCaseDirectoryName(), 1, 2))
{
Assert.True(cluster.Start());
}
@@ -51,7 +56,7 @@
[Fact]
public void ClusterStartWithSslTest()
{
- using (var cluster = new Cluster(CreateTestCaseDirectoryName(), 1, 1))
+ using (var cluster = new Cluster(output, CreateTestCaseDirectoryName(), 1, 1))
{
cluster.UseSSL = true;
diff --git a/clicache/integration-test2/Command.cs b/clicache/integration-test2/Command.cs
index a6250a9..0cb960c 100644
--- a/clicache/integration-test2/Command.cs
+++ b/clicache/integration-test2/Command.cs
@@ -1,4 +1,21 @@
-using System;
+/*
+ * 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.
+ */
+
+using System;
using System.Diagnostics;
using System.Net;
using System.IO;
diff --git a/clicache/integration-test2/Config.cs.in b/clicache/integration-test2/Config.cs.in
index 5c50e97..abfb0dd 100644
--- a/clicache/integration-test2/Config.cs.in
+++ b/clicache/integration-test2/Config.cs.in
@@ -28,14 +28,4 @@
{
get { return @"@JAVAOBJECT_JAR_PATH@"; }
}
-
- public static string CryptoImplPath
- {
- get { return @"@CRYPTO_IMPL_PATH@"; }
- }
-
- public static string OpenSSLPath
- {
- get { return @"@OPENSSL_PATH@"; }
- }
}
diff --git a/clicache/integration-test2/CqOperationTest.cs b/clicache/integration-test2/CqOperationTest.cs
index 2824df9..10a44df 100644
--- a/clicache/integration-test2/CqOperationTest.cs
+++ b/clicache/integration-test2/CqOperationTest.cs
@@ -20,6 +20,7 @@
using Xunit;
using System.Diagnostics;
using System.Threading;
+using Xunit.Abstractions;
namespace Apache.Geode.Client.IntegrationTests
{
@@ -175,42 +176,35 @@
}
[Trait("Category", "Integration")]
- public class CqOperationTest : TestBase, IDisposable
+ public class CqOperationTest : TestBase
{
- private readonly Cache cache_;
private static int waitInterval_ = 1000;
- public CqOperationTest()
+ public CqOperationTest(ITestOutputHelper testOutputHelper) : base(testOutputHelper)
{
- var cacheFactory = new CacheFactory()
- .Set("log-level", "error");
- cache_ = cacheFactory.Create();
}
-
- public void Dispose()
- {
- cache_.Close();
- }
-
+
[Fact]
public void PdxSerializableNotificationsHaveCorrectValues()
{
- using (var cluster_ = new Cluster(CreateTestCaseDirectoryName(), 1, 1))
+ using (var cluster = new Cluster(output, CreateTestCaseDirectoryName(), 1, 1))
{
- Assert.Equal(cluster_.Start(), true);
- Assert.Equal(cluster_.Gfsh.create()
+ Assert.True(cluster.Start());
+ Assert.Equal(0, cluster.Gfsh.create()
.region()
.withName("cqTestRegion")
.withType("REPLICATE")
- .execute(), 0);
- cache_.TypeRegistry.RegisterPdxType(MyOrder.CreateDeserializable);
- var poolFactory = cache_.GetPoolFactory()
- .AddLocator("localhost", cluster_.Gfsh.LocatorPort);
- var pool = poolFactory
+ .execute());
+
+ var cache = cluster.CreateCache();
+
+ cache.TypeRegistry.RegisterPdxType(MyOrder.CreateDeserializable);
+
+ var pool = cluster.ApplyLocators(cache.GetPoolFactory())
.SetSubscriptionEnabled(true)
.Create("pool");
- var regionFactory = cache_.CreateRegionFactory(RegionShortcut.PROXY)
+ var regionFactory = cache.CreateRegionFactory(RegionShortcut.PROXY)
.SetPoolName("pool");
var region = regionFactory.Create<string, MyOrder>("cqTestRegion");
@@ -257,38 +251,39 @@
Assert.True(cqListener.RegionClearEvent.WaitOne(waitInterval_), "Didn't receive expected CLEAR event");
Assert.False(cqListener.ReceivedUnknownEventType, "An unknown event was received by CQ listener");
+
+ cache.Close();
}
}
[Fact]
public void DataSerializableNotificationsHaveCorrectValues()
{
- using (var cluster_ = new Cluster(CreateTestCaseDirectoryName(), 1, 1))
+ using (var cluster = new Cluster(output, CreateTestCaseDirectoryName(), 1, 1))
{
- Assert.Equal(cluster_.Start(), true);
- Assert.Equal(cluster_.Gfsh.deploy()
+ Assert.True(cluster.Start());
+ Assert.Equal(0, cluster.Gfsh.deploy()
.withJar(Config.JavaobjectJarPath)
- .execute(), 0);
- Assert.Equal(cluster_.Gfsh.create()
+ .execute());
+ Assert.Equal(0, cluster.Gfsh.create()
.region()
.withName("cqTestRegion")
.withType("REPLICATE")
- .execute(), 0);
-
- cluster_.Gfsh.executeFunction()
+ .execute());
+ Assert.Equal(0, cluster.Gfsh.executeFunction()
.withId("InstantiateDataSerializable")
- .withMember("DataSerializableNotificationsH_server_0")
- .execute();
+ .withMember("DataSerializableNotificationsHaveCorrectValues_server_0")
+ .execute());
- cache_.TypeRegistry.RegisterType(Position.CreateDeserializable, 22);
+ var cache = cluster.CreateCache();
- var poolFactory = cache_.GetPoolFactory()
- .AddLocator("localhost", cluster_.Gfsh.LocatorPort);
- var pool = poolFactory
+ cache.TypeRegistry.RegisterType(Position.CreateDeserializable, 22);
+
+ var pool = cluster.ApplyLocators(cache.GetPoolFactory())
.SetSubscriptionEnabled(true)
.Create("pool");
- var regionFactory = cache_.CreateRegionFactory(RegionShortcut.PROXY)
+ var regionFactory = cache.CreateRegionFactory(RegionShortcut.PROXY)
.SetPoolName("pool");
var region = regionFactory.Create<string, Position>("cqTestRegion");
@@ -336,6 +331,8 @@
Assert.True(cqListener.RegionClearEvent.WaitOne(waitInterval_), "Didn't receive expected CLEAR event");
Assert.False(cqListener.ReceivedUnknownEventType, "An unknown event was received by CQ listener");
+
+ cache.Close();
}
}
}
diff --git a/contrib/pdxautoserializer/src/ASCPPInclude.hpp b/clicache/integration-test2/Framework.cs
similarity index 63%
rename from contrib/pdxautoserializer/src/ASCPPInclude.hpp
rename to clicache/integration-test2/Framework.cs
index 3127313..027fd32 100644
--- a/contrib/pdxautoserializer/src/ASCPPInclude.hpp
+++ b/clicache/integration-test2/Framework.cs
@@ -1,8 +1,3 @@
-#pragma once
-
-#ifndef GEODE_PDXAUTOSERIALIZER_ASCPPINCLUDE_H_
-#define GEODE_PDXAUTOSERIALIZER_ASCPPINCLUDE_H_
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -20,19 +15,21 @@
* limitations under the License.
*/
-#define GFINCLUDE
-#define GFEXCLUDE
-#define GFARRAYSIZE(x)
+ using System.Net;
+using System.IO;
+using System.Net.Sockets;
-// Helper defines to ignore some GNU g++ constructs
-/*
- #define __const const
- #define __volatile__ volatile
- #define __asm__ asm
- #define __restrict
- #define __attribute__(x)
- #define __extension__
- #define __builtin_va_list int
- */
-
-#endif // GEODE_PDXAUTOSERIALIZER_ASCPPINCLUDE_H_
+namespace Apache.Geode.Client.IntegrationTests
+{
+ public abstract class Framework
+ {
+ public static int FreeTcpPort()
+ {
+ var tcpListner = new TcpListener(IPAddress.Loopback, 0);
+ tcpListner.Start();
+ var port = ((IPEndPoint)tcpListner.LocalEndpoint).Port;
+ tcpListner.Stop();
+ return port;
+ }
+ }
+}
\ No newline at end of file
diff --git a/clicache/integration-test2/FunctionExecutionTest.cs b/clicache/integration-test2/FunctionExecutionTest.cs
new file mode 100644
index 0000000..6688d31
--- /dev/null
+++ b/clicache/integration-test2/FunctionExecutionTest.cs
@@ -0,0 +1,136 @@
+/*
+ * 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.
+ */
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.IO;
+using Xunit;
+using Xunit.Abstractions;
+
+namespace Apache.Geode.Client.IntegrationTests
+{
+ [Trait("Category", "Integration")]
+ public class FunctionExecutionTest : TestBase
+ {
+ public FunctionExecutionTest(ITestOutputHelper testOutputHelper) : base(testOutputHelper)
+ {
+ }
+
+ [Fact]
+ public void MultiGetFunctionExecutionWithFilter()
+ {
+ int expectedFilteredCount = 34;
+ using (var cluster = new Cluster(output, CreateTestCaseDirectoryName(), 1, 1))
+ {
+ Assert.True(cluster.Start());
+ Assert.Equal(0, cluster.Gfsh.deploy()
+ .withJar(Config.JavaobjectJarPath)
+ .execute());
+ Assert.Equal(0, cluster.Gfsh.create().region()
+ .withName("testRegion1")
+ .withType("PARTITION")
+ .execute());
+
+ var cache = cluster.CreateCache();
+ var region = cache.CreateRegionFactory(RegionShortcut.PROXY)
+ .SetPoolName("default")
+ .Create<object, object>("testRegion1");
+
+ for (var i = 0; i < 230; i++)
+ {
+ region["KEY--" + i] = "VALUE--" + i;
+ }
+
+ var args = true;
+
+ var oddKeyFilter = new Object[17];
+ var j = 0;
+ for (var i = 0; i < 34; i++)
+ {
+ if (i % 2 == 0) continue;
+ oddKeyFilter[j] = "KEY--" + i;
+ j++;
+ }
+
+ var exc = Client.FunctionService<List<object>>.OnRegion<object, object>(region);
+ var rc = exc.WithArgs<bool>(args).WithFilter<object>(oddKeyFilter).Execute("MultiGetFunction");
+ var executeFunctionResult = rc.GetResult();
+ var resultList = new List<object>();
+
+ foreach (var item in executeFunctionResult)
+ {
+ foreach (object item2 in item)
+ {
+ resultList.Add(item2);
+ }
+ }
+ Assert.Equal(expectedFilteredCount, resultList.Count);
+
+ }
+ }
+
+ [Fact]
+ public void MultiGetIFunctionExecutionWithArgs()
+ {
+ int expectedResultCount = 17;
+ using (var cluster = new Cluster(output, CreateTestCaseDirectoryName(), 1, 1))
+ {
+ Assert.True(cluster.Start());
+ Assert.Equal(0, cluster.Gfsh.deploy()
+ .withJar(Config.JavaobjectJarPath)
+ .execute());
+ Assert.Equal(0, cluster.Gfsh.create().region()
+ .withName("partition_region")
+ .withType("PARTITION")
+ .execute());
+
+ var cache = cluster.CreateCache();
+
+ var region = cache.CreateRegionFactory(RegionShortcut.PROXY)
+ .SetPoolName("default")
+ .Create<object, object>("partition_region");
+
+ for (var i = 0; i < 230; i++)
+ {
+ region["KEY--" + i] = "VALUE--" + i;
+ }
+
+ var oddKeyArgs = new ArrayList();
+ for (var i = 0; i < 34; i++)
+ {
+ if (i % 2 == 0) continue;
+ oddKeyArgs.Add("KEY--" + i);
+ }
+
+ var exc = Client.FunctionService<List<object>>.OnRegion<object, object>(region);
+ var rc = exc.WithArgs<ArrayList>(oddKeyArgs).Execute("MultiGetFunctionI");
+ var executeFunctionResult = rc.GetResult();
+ var resultList = new List<object>();
+
+ foreach (var item in executeFunctionResult)
+ {
+ foreach (var item2 in item)
+ {
+ resultList.Add(item2);
+ }
+ }
+ Assert.Equal(expectedResultCount, resultList.Count);
+ }
+ }
+ }
+}
diff --git a/clicache/integration-test2/Gfsh.cs b/clicache/integration-test2/Gfsh.cs
index 7984fd6..826c1fd 100644
--- a/clicache/integration-test2/Gfsh.cs
+++ b/clicache/integration-test2/Gfsh.cs
@@ -1,4 +1,4 @@
-/*
+/*
* 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.
@@ -26,21 +26,8 @@
namespace Apache.Geode.Client.IntegrationTests
{
- public abstract class Gfsh : IDisposable
+ public abstract class Gfsh
{
- public string Name { get; private set; }
- public string LocatorBindAddress { get; set; }
- public int LocatorPort { get; private set; }
- public int JmxManagerPort { get; private set; }
- public int HttpServicePort { get; private set; }
- public string ServerBindAddress { get; private set; }
- public bool UseSSL { get; set; }
- public string Keystore { get; set; }
- public string KeystorePassword { get; set; }
- public string Truststore { get; set; }
- public string TruststorePassword { get; set; }
-
- public abstract void Dispose();
//TODO: Understand what C++ Command class is doing. Why is it a template,
//when the only <T> class we're passing is void? How can you call a ctor
@@ -52,6 +39,7 @@
gfsh_ = gfsh;
command_ = command;
}
+
public int execute()
{
return gfsh_.execute(command_);
@@ -79,6 +67,7 @@
{
gfsh_ = gfsh;
}
+
public Server withName(string name)
{
command_ += " --name=" + name;
@@ -93,7 +82,7 @@
public Server withBindAddress(string bindAddress)
{
- gfsh_.ServerBindAddress = bindAddress;
+ command_ += " --bind-address=" + bindAddress;
return this;
}
@@ -121,13 +110,33 @@
return this;
}
- public Server withUseSsl()
+ public Server withSslKeyStore(string keyStore)
{
- command_ += " --J=-Dgemfire.ssl-enabled-components=server,locator,jmx" +
- " --J=-Dgemfire.ssl-keystore=" + gfsh_.Keystore +
- " --J=-Dgemfire.ssl-keystore-password=" + gfsh_.KeystorePassword +
- " --J=-Dgemfire.ssl-truststore=" + gfsh_.Truststore +
- " --J=-Dgemfire.ssl-truststore-password=" + gfsh_.TruststorePassword;
+ command_ += " --J=-Dgemfire.ssl-keystore=" + keyStore;
+ return this;
+ }
+
+ public Server withSslKeyStorePassword(string keyStorePassword)
+ {
+ command_ += " --J=-Dgemfire.ssl-keystore-password=" + keyStorePassword;
+ return this;
+ }
+
+ public Server withSslTrustStore(string trustStore)
+ {
+ command_ += " --J=-Dgemfire.ssl-truststore=" + trustStore;
+ return this;
+ }
+
+ public Server withSslTrustStorePassword(string trustStorePassword)
+ {
+ command_ += " --J=-Dgemfire.ssl-truststore-password=" + trustStorePassword;
+ return this;
+ }
+
+ public Server withSslEnableComponents(string components)
+ {
+ command_ += " --J=-Dgemfire.ssl-enabled-components=" + components;
return this;
}
}
@@ -157,24 +166,31 @@
public Locator withBindAddress(string bindAddress)
{
- gfsh_.LocatorBindAddress = bindAddress;
+ command_ += " --bind-address=" + bindAddress;
return this;
}
public Locator withPort(int port)
{
- gfsh_.LocatorPort = port;
- return this;
- }
- public Locator withJmxManagerPort(int jmxManagerPort)
- {
- gfsh_.JmxManagerPort = jmxManagerPort;
+ command_ += " --port=" + port;
return this;
}
- public Locator withHttpServicePort(short httpServicePort)
+ public Locator withJmxManagerPort(int jmxManagerPort)
{
- command_ += " --http-service-port=" + Convert.ToString(httpServicePort);
+ command_ += " --J=-Dgemfire.jmx-manager-port=" + jmxManagerPort;
+ return this;
+ }
+
+ public Locator withJmxManagerStart(bool start)
+ {
+ command_ += " --J=-Dgemfire.jmx-manager-start=" + (start ? "true" : "false");
+ return this;
+ }
+
+ public Locator withHttpServicePort(int httpServicePort)
+ {
+ command_ += " --http-service-port=" + httpServicePort;
return this;
}
@@ -197,13 +213,33 @@
return this;
}
- public Locator withUseSsl()
+ public Locator withSslKeyStore(string keyStore)
{
- command_ += " --J=-Dgemfire.ssl-enabled-components=locator,jmx" +
- " --J=-Dgemfire.ssl-keystore=" + gfsh_.Keystore +
- " --J=-Dgemfire.ssl-keystore-password=" + gfsh_.KeystorePassword +
- " --J=-Dgemfire.ssl-truststore=" + gfsh_.Truststore +
- " --J=-Dgemfire.ssl-truststore-password=" + gfsh_.TruststorePassword;
+ command_ += " --J=-Dgemfire.ssl-keystore=" + keyStore;
+ return this;
+ }
+
+ public Locator withSslKeyStorePassword(string keyStorePassword)
+ {
+ command_ += " --J=-Dgemfire.ssl-keystore-password=" + keyStorePassword;
+ return this;
+ }
+
+ public Locator withSslTrustStore(string trustStore)
+ {
+ command_ += " --J=-Dgemfire.ssl-truststore=" + trustStore;
+ return this;
+ }
+
+ public Locator withSslTrustStorePassword(string trustStorePassword)
+ {
+ command_ += " --J=-Dgemfire.ssl-truststore-password=" + trustStorePassword;
+ return this;
+ }
+
+ public Locator withSslEnableComponents(string components)
+ {
+ command_ += " --J=-Dgemfire.ssl-enabled-components=" + components;
return this;
}
}
@@ -227,6 +263,7 @@
{
gfsh_ = gfsh;
}
+
public class Locator : Command
{
public Locator(Gfsh gfsh) : base(gfsh, "stop locator")
@@ -250,6 +287,7 @@
{
return new Locator(gfsh_);
}
+
public class Server : Command
{
public Server(Gfsh gfsh) : base(gfsh, "stop server")
@@ -344,12 +382,33 @@
return this;
}
- public Connect withUseSsl()
+ public Connect withUseSsl(bool enable)
{
- command_ += " --use-ssl --key-store=" + gfsh_.Keystore +
- " --key-store-password=" + gfsh_.KeystorePassword +
- " --trust-store=" + gfsh_.Truststore +
- " --trust-store-password=" + gfsh_.TruststorePassword;
+ command_ += " --use-ssl=" + (enable ? "true" : "false");
+ return this;
+ }
+
+ public Connect withKeyStore(string keyStore)
+ {
+ command_ += " --key-store=" + keyStore;
+ return this;
+ }
+
+ public Connect withKeyStorePassword(string keyStorePassword)
+ {
+ command_ += " --key-store-password=" + keyStorePassword;
+ return this;
+ }
+
+ public Connect withTrustStore(string trustStore)
+ {
+ command_ += " --trust-store=" + trustStore;
+ return this;
+ }
+
+ public Connect withTrustStorePassword(string trustStorePassword)
+ {
+ command_ += " --trust-store-password=" + trustStorePassword;
return this;
}
}
@@ -426,17 +485,6 @@
return new ExecuteFunction(this);
}
- private static string defaultBindAddress = "localhost";
- private static int defaultHttpServicePort = 0;
- public Gfsh()
- {
- LocatorBindAddress = defaultBindAddress;
- HttpServicePort = defaultHttpServicePort;
- ServerBindAddress = defaultBindAddress;
- LocatorPort = FreeTcpPort();
- JmxManagerPort = FreeTcpPort();
- }
-
private static int FreeTcpPort()
{
var tcpListner = new TcpListener(IPAddress.Loopback, 0);
diff --git a/clicache/integration-test2/GfshExecute.cs b/clicache/integration-test2/GfshExecute.cs
index 29098f5..54117df 100644
--- a/clicache/integration-test2/GfshExecute.cs
+++ b/clicache/integration-test2/GfshExecute.cs
@@ -1,4 +1,4 @@
-/*
+/*
* 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.
@@ -21,82 +21,75 @@
using System.IO;
using System.Net.Sockets;
using Xunit;
+using System.Collections;
+using System.Text.RegularExpressions;
+using System.Collections.Generic;
+using Xunit.Abstractions;
namespace Apache.Geode.Client.IntegrationTests
{
public class GfshExecute : Gfsh
{
- public GfshExecute()
+ private String connectionCommand_ = null;
+ private ITestOutputHelper output;
+
+ public GfshExecute(ITestOutputHelper output)
{
- }
- public override void Dispose()
- {
+ this.output = output;
}
- private static string startLocator = "start locator";
- private static string startServer = "start server";
-
- private string buildStartLocatorCommand(string options)
+ private void ExtractConnectionCommand(String command)
{
- var locatorCmd = startLocator;
- locatorCmd += " --port=" + LocatorPort;
- locatorCmd += " --bind-address=" + LocatorBindAddress;
- locatorCmd += " --J=-Dgemfire.jmx-manager-port=" + JmxManagerPort + " ";
- locatorCmd += " --J=-Dgemfire.jmx-manager-start=true";
- locatorCmd += options;
- return locatorCmd;
- }
-
- private string buildStartServerCommand(string options)
- {
- var connectObject = connect()
- .withJmxManager(LocatorBindAddress, JmxManagerPort);
- if (UseSSL)
+ if (command.StartsWith("connect"))
{
- connectObject
- .withUseSsl();
+ connectionCommand_ = command;
}
- var serverCmd = "-e \"" + connectObject.ToString() + "\" -e \"" + startServer;
- serverCmd += " --bind-address=" + ServerBindAddress;
- serverCmd += options + "\"";
- return serverCmd;
- }
+ else if (command.StartsWith("start locator"))
+ {
+ if (command.Contains("--connect=false"))
+ {
+ return;
+ }
- private string buildConnectAndExecuteString(string options)
- {
- var connectObject = connect()
- .withJmxManager(LocatorBindAddress, JmxManagerPort);
- if (UseSSL)
- {
- connectObject
- .withUseSsl();
- }
- return "-e \"" + connectObject.ToString() + "\" -e \"" + options + "\"";
- }
+ var jmxManagerHost = "localhost";
+ var jmxManagerPort = "1099";
- private string BuildFullCommandString(string baseCmd)
- {
- string fullCmd;
+ var jmxManagerHostRegex = new Regex(@"\bbind-address=([^\s])\b");
+ var jmxManagerHostMatch = jmxManagerHostRegex.Match(command);
- if (baseCmd.IndexOf(startLocator) == 0)
- {
- fullCmd = buildStartLocatorCommand(baseCmd.Substring(startLocator.Length));
- }
- else if (baseCmd.IndexOf(startServer) == 0)
- {
- fullCmd = buildStartServerCommand(baseCmd.Substring(startServer.Length));
- }
- else
- {
- fullCmd = buildConnectAndExecuteString(baseCmd);
+ if (jmxManagerHostMatch.Success)
+ {
+ jmxManagerHost = jmxManagerHostMatch.Groups[1].Value;
+ }
+
+ var jmxManagerPortRegex = new Regex(@"\bjmx-manager-port=(\d+)\b");
+ var jmxManagerPortMatch = jmxManagerPortRegex.Match(command);
+ if (jmxManagerPortMatch.Success)
+ {
+ jmxManagerPort = jmxManagerPortMatch.Groups[1].Value;
+ }
+
+ connectionCommand_ = new Connect(this).withJmxManager(jmxManagerHost, int.Parse(jmxManagerPort)).ToString();
}
- return fullCmd;
}
public override int execute(string cmd)
{
- var fullCmd = BuildFullCommandString(cmd);
+
+ var commands = new List<string>();
+
+ if (null != connectionCommand_)
+ {
+ commands.Add("-e");
+ commands.Add(connectionCommand_);
+ }
+
+ commands.Add("-e");
+ commands.Add(cmd);
+
+ // TODO escape commands
+ var fullCmd = "\"" + string.Join("\" \"", commands) + "\"";
var gfsh = new Process
{
@@ -116,7 +109,7 @@
{
if (args.Data != null)
{
- Debug.WriteLine("GfshExecute: " + args.Data);
+ WriteLine("GfshExecute: " + args.Data);
}
};
@@ -124,7 +117,7 @@
{
if (args.Data != null)
{
- Debug.WriteLine("GfshExecute: ERROR: " + args.Data);
+ WriteLine("GfshExecute: ERROR: " + args.Data);
}
};
@@ -133,24 +126,81 @@
gfsh.BeginErrorReadLine();
if (gfsh.WaitForExit(60000))
{
- Debug.WriteLine("GeodeServer Start: gfsh.HasExited = {0}, gfsh.ExitCode = {1}",
+ WriteLine("GeodeServer Start: gfsh.HasExited = {0}, gfsh.ExitCode = {1}",
gfsh.HasExited,
gfsh.ExitCode);
}
else
{
- Debug.WriteLine("GeodeServer Start: gfsh failed to exit, force killing.");
- try
- {
- gfsh.Kill();
- }
- catch
- {
- // ignored
- }
+ WriteLine("GeodeServer Start: gfsh failed to exit, force killing.");
+ KillAndIgnore(gfsh);
}
+ CancelErrorReadAndIgnore(gfsh);
+ CancelOutputReadAndIgnore(gfsh);
+
+ ExtractConnectionCommand(cmd);
return gfsh.ExitCode;
}
+
+ private static void CancelOutputReadAndIgnore(Process gfsh)
+ {
+ try
+ {
+ gfsh.CancelOutputRead();
+ }
+ catch
+ {
+ // ignored
+ }
+ }
+
+ private static void CancelErrorReadAndIgnore(Process gfsh)
+ {
+ try
+ {
+ gfsh.CancelErrorRead();
+ }
+ catch
+ {
+ // ignored
+ }
+ }
+
+ private static void KillAndIgnore(Process gfsh)
+ {
+ try
+ {
+ gfsh.Kill();
+ }
+ catch
+ {
+ // ignored
+ }
+ }
+
+ private void WriteLine(string format, params object[] args)
+ {
+ if (null == output)
+ {
+ Debug.WriteLine(format, args);
+ }
+ else
+ {
+ output.WriteLine(format, args);
+ }
+ }
+
+ private void WriteLine(string message)
+ {
+ if (null == output)
+ {
+ Debug.WriteLine(message);
+ }
+ else
+ {
+ output.WriteLine(message);
+ }
+ }
}
}
diff --git a/clicache/integration-test2/GfshExecuteTest.cs b/clicache/integration-test2/GfshExecuteTest.cs
index 16a0f83..399b58f 100644
--- a/clicache/integration-test2/GfshExecuteTest.cs
+++ b/clicache/integration-test2/GfshExecuteTest.cs
@@ -1,4 +1,4 @@
-/*
+/*
* 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.
@@ -17,259 +17,270 @@
using System;
using Xunit;
+using Xunit.Abstractions;
namespace Apache.Geode.Client.IntegrationTests
{
[Trait("Category", "Integration")]
public class GfshExecuteTest : TestBase, IDisposable
{
+ public GfshExecuteTest(ITestOutputHelper testOutputHelper) : base(testOutputHelper)
+ {
+ }
+
public void Dispose()
{
}
[Fact]
- public void GfshExecuteStartLocatorTest()
+ public void Start1Locator()
{
- using (var gfsh = new GfshExecute())
+ var gfsh = new GfshExecute(output);
+ var testDir = CreateTestCaseDirectoryName();
+ CleanTestCaseDirectory(testDir);
+
+ try
{
- var testDir = CreateTestCaseDirectoryName();
- CleanTestCaseDirectory(testDir);
-
- try
- {
- Assert.Equal(gfsh.start()
- .locator()
- .withDir(testDir)
- .withHttpServicePort(0)
- .withPort(gfsh.LocatorPort)
- .execute(), 0);
- }
- finally
- {
- Assert.Equal(gfsh
- .shutdown()
- .withIncludeLocators(true)
- .execute(), 0);
- }
- }
- }
-
- [Fact]
- public void GfshExecuteStartServerTest()
- {
- using (var gfsh = new GfshExecute())
- {
- var testDir = CreateTestCaseDirectoryName();
- CleanTestCaseDirectory(testDir);
-
- try
- {
- Assert.Equal(gfsh.start()
- .locator()
- .withDir(testDir)
- .withHttpServicePort(0)
- .withPort(gfsh.LocatorPort)
- .execute(), 0);
-
- Assert.Equal(gfsh.start()
- .server()
- .withDir(testDir + "/server/0")
- .withPort(0)
- .execute(), 0);
- }
- finally
- {
- Assert.Equal(gfsh
- .shutdown()
- .withIncludeLocators(true)
- .execute(), 0);
- }
- }
- }
-
- [Fact]
- public void GfshExecuteStartTwoServersTest()
- {
- using (var gfsh1 = new GfshExecute())
- {
- var testDir = CreateTestCaseDirectoryName();
- CleanTestCaseDirectory(testDir);
-
- try
- {
- Assert.Equal(gfsh1.start()
- .locator()
- .withDir(testDir)
- .withHttpServicePort(0)
- .execute(), 0);
-
- Assert.Equal(gfsh1.start()
- .server()
- .withDir(testDir + "/server/0")
- .withPort(0)
- .execute(), 0);
-
- Assert.Equal(gfsh1.start()
- .server()
- .withDir(testDir + "/server/1")
- .withPort(0)
- .execute(), 0);
- }
- finally
- {
- Assert.Equal(gfsh1.shutdown()
- .withIncludeLocators(true)
- .execute(), 0);
- }
- }
- }
-
- [Fact]
- public void GfshExecuteStartLocatorWithUseSslTest()
- {
- using (var gfsh = new GfshExecute())
- {
- var testDir = CreateTestCaseDirectoryName();
- CleanTestCaseDirectory(testDir);
-
- var sslPassword = "gemstone";
- var currentDir = Environment.CurrentDirectory;
- gfsh.Keystore = currentDir + "/ServerSslKeys/server_keystore.jks";
- gfsh.KeystorePassword = sslPassword;
- gfsh.Truststore = currentDir + "/ServerSslKeys/server_truststore.jks";
- gfsh.TruststorePassword = sslPassword;
- gfsh.UseSSL = true;
-
- try
- {
- var locator = gfsh
- .start()
- .locator()
- .withDir(testDir)
- .withHttpServicePort(0)
- .withUseSsl()
- .withConnect(false);
-
- Assert.Equal(locator.execute(), 0);
- }
- finally
- {
- Assert.Equal(gfsh
- .shutdown()
- .withIncludeLocators(true)
- .execute(), 0);
- }
- }
- }
-
- [Fact]
- public void GfshExecuteStartLocatorAndServerWithUseSslTest()
- {
- using (var gfsh = new GfshExecute())
- {
- var testDir = CreateTestCaseDirectoryName();
- CleanTestCaseDirectory(testDir);
-
- var sslPassword = "gemstone";
- var currentDir = Environment.CurrentDirectory;
- gfsh.Keystore = currentDir + "/ServerSslKeys/server_keystore.jks";
- gfsh.KeystorePassword = sslPassword;
- gfsh.Truststore = currentDir + "/ServerSslKeys/server_truststore.jks";
- gfsh.TruststorePassword = sslPassword;
- gfsh.UseSSL = true;
-
- try
- {
- Assert.Equal(gfsh
- .start()
- .locator()
- .withDir(testDir)
- .withHttpServicePort(0)
- .withUseSsl()
- .withConnect(false)
- .execute(), 0);
-
- Assert.Equal(gfsh
- .start()
- .server()
- .withDir(testDir + "/server/0")
- .withPort(0)
- .withUseSsl()
- .execute(), 0);
- }
- finally
- {
- Assert.Equal(gfsh
- .shutdown()
- .withIncludeLocators(true)
- .execute(), 0);
- }
- }
- }
-
- [Fact]
- public void GfshExecuteStartLocatorAndVerifyPortTest()
- {
- using (var gfsh = new GfshExecute())
- {
- var testDir = CreateTestCaseDirectoryName();
- CleanTestCaseDirectory(testDir);
-
- Assert.Equal(gfsh.start()
+ Assert.Equal(0, gfsh.start()
.locator()
.withDir(testDir)
.withHttpServicePort(0)
- .execute(), 0);
-
- Assert.NotEqual(0, gfsh.LocatorPort);
-
- Assert.Equal(gfsh.shutdown()
+ .withPort(Framework.FreeTcpPort())
+ .withJmxManagerPort(Framework.FreeTcpPort())
+ .execute());
+ }
+ finally
+ {
+ Assert.Equal(0, gfsh
+ .shutdown()
.withIncludeLocators(true)
- .execute(), 0);
+ .execute());
}
}
[Fact]
- public void GfshExecuteStartTwoLocatorsTest()
+ public void Start1Locator1Server()
{
- using (var gfsh1 = new GfshExecute())
- {
- var testDir = CreateTestCaseDirectoryName();
- CleanTestCaseDirectory(testDir);
+ var gfsh = new GfshExecute(output);
+ var testDir = CreateTestCaseDirectoryName();
+ CleanTestCaseDirectory(testDir);
+ try
+ {
+ Assert.Equal(0, gfsh.start()
+ .locator()
+ .withDir(testDir)
+ .withHttpServicePort(0)
+ .withPort(Framework.FreeTcpPort())
+ .withJmxManagerPort(Framework.FreeTcpPort())
+ .execute());
+
+ Assert.Equal(0, gfsh.start()
+ .server()
+ .withDir(testDir + "/server/0")
+ .withPort(0)
+ .execute());
+ }
+ finally
+ {
+ Assert.Equal(0, gfsh
+ .shutdown()
+ .withIncludeLocators(true)
+ .execute());
+ }
+ }
+
+ [Fact]
+ public void Start1Locator2Servers()
+ {
+ var gfsh = new GfshExecute(output);
+ var testDir = CreateTestCaseDirectoryName();
+ CleanTestCaseDirectory(testDir);
+
+ try
+ {
+ Assert.Equal(0, gfsh.start()
+ .locator()
+ .withDir(testDir)
+ .withHttpServicePort(0)
+ .withPort(Framework.FreeTcpPort())
+ .withJmxManagerPort(Framework.FreeTcpPort())
+ .execute());
+
+ Assert.Equal(0, gfsh.start()
+ .server()
+ .withDir(testDir + "/server/0")
+ .withPort(0)
+ .execute());
+
+ Assert.Equal(0, gfsh.start()
+ .server()
+ .withDir(testDir + "/server/1")
+ .withPort(0)
+ .execute());
+ }
+ finally
+ {
+ Assert.Equal(0, gfsh.shutdown()
+ .withIncludeLocators(true)
+ .execute());
+ }
+ }
+
+ [Fact]
+ public void Start1LocatorWithSSL()
+ {
+ var gfsh = new GfshExecute(output);
+ var testDir = CreateTestCaseDirectoryName();
+ CleanTestCaseDirectory(testDir);
+
+ var sslPassword = "gemstone";
+ var currentDir = Environment.CurrentDirectory;
+ var keystore = currentDir + @"\ServerSslKeys\server_keystore.jks";
+ var truststore = currentDir + @"\ServerSslKeys\server_truststore.jks";
+ var jmxManagerPort = Framework.FreeTcpPort();
+
+ try
+ {
+ Assert.Equal(0, gfsh
+ .start()
+ .locator()
+ .withDir(testDir)
+ .withHttpServicePort(0)
+ .withPort(Framework.FreeTcpPort())
+ .withJmxManagerPort(jmxManagerPort)
+ .withJmxManagerStart(true)
+ .withSslEnableComponents("locator,jmx")
+ .withSslKeyStore(keystore)
+ .withSslKeyStorePassword(sslPassword)
+ .withSslTrustStore(truststore)
+ .withSslTrustStorePassword(sslPassword)
+ .withConnect(false)
+ .execute());
+
+ Assert.Equal(0, gfsh
+ .connect()
+ .withJmxManager("localhost", jmxManagerPort)
+ .withUseSsl(true)
+ .withKeyStore(keystore)
+ .withKeyStorePassword(sslPassword)
+ .withTrustStore(truststore)
+ .withTrustStorePassword(sslPassword)
+ .execute());
+ }
+ finally
+ {
+ Assert.Equal(0, gfsh
+ .shutdown()
+ .withIncludeLocators(true)
+ .execute());
+ }
+ }
+
+ [Fact]
+ public void Start1Locator1ServerWithSSL()
+ {
+ var gfsh = new GfshExecute(output);
+ var testDir = CreateTestCaseDirectoryName();
+ CleanTestCaseDirectory(testDir);
+
+ var sslPassword = "gemstone";
+ var currentDir = Environment.CurrentDirectory;
+ var keystore = currentDir + @"\ServerSslKeys\server_keystore.jks";
+ var truststore = currentDir + @"\ServerSslKeys\server_truststore.jks";
+ var jmxManagerPort = Framework.FreeTcpPort();
+
+ try
+ {
+ Assert.Equal(0, gfsh
+ .start()
+ .locator()
+ .withDir(testDir)
+ .withHttpServicePort(0)
+ .withPort(Framework.FreeTcpPort())
+ .withJmxManagerPort(jmxManagerPort)
+ .withJmxManagerStart(true)
+ .withSslEnableComponents("locator,jmx")
+ .withSslKeyStore(keystore)
+ .withSslKeyStorePassword(sslPassword)
+ .withSslTrustStore(truststore)
+ .withSslTrustStorePassword(sslPassword)
+ .withConnect(false)
+ .execute());
+
+ Assert.Equal(0, gfsh
+ .connect()
+ .withJmxManager("localhost", jmxManagerPort)
+ .withUseSsl(true)
+ .withKeyStore(keystore)
+ .withKeyStorePassword(sslPassword)
+ .withTrustStore(truststore)
+ .withTrustStorePassword(sslPassword)
+ .execute());
+
+ Assert.Equal(0, gfsh
+ .start()
+ .server()
+ .withDir(testDir + "/server/0")
+ .withPort(0)
+ .withSslEnableComponents("server,locator,jmx")
+ .withSslKeyStore(keystore)
+ .withSslKeyStorePassword(sslPassword)
+ .withSslTrustStore(truststore)
+ .withSslTrustStorePassword(sslPassword)
+ .execute());
+ }
+ finally
+ {
+ Assert.Equal(0, gfsh
+ .shutdown()
+ .withIncludeLocators(true)
+ .execute());
+ }
+ }
+
+ [Fact]
+ public void Start2ClustersWith1Locator1ServerEach()
+ {
+ var gfsh1 = new GfshExecute(output);
+ var testDir = CreateTestCaseDirectoryName();
+ CleanTestCaseDirectory(testDir);
+
+ try
+ {
+ Assert.Equal(0, gfsh1.start()
+ .locator()
+ .withDir(testDir + "/locator/0")
+ .withHttpServicePort(0)
+ .withPort(Framework.FreeTcpPort())
+ .withJmxManagerPort(Framework.FreeTcpPort())
+ .execute());
+
+ var gfsh2 = new GfshExecute(output);
try
{
- Assert.Equal(gfsh1.start()
+ Assert.Equal(0, gfsh2.start()
.locator()
- .withDir(testDir + "/locator/0")
+ .withDir(testDir + "/locator/1")
.withHttpServicePort(0)
- .execute(), 0);
-
- using (var gfsh2 = new GfshExecute())
- {
- try
- {
- Assert.Equal(gfsh2.start()
- .locator()
- .withDir(testDir + "/locator/1")
- .withHttpServicePort(0)
- .execute(), 0);
- }
- finally
- {
- Assert.Equal(gfsh2.shutdown()
- .withIncludeLocators(true)
- .execute(), 0);
- }
- }
+ .withPort(Framework.FreeTcpPort())
+ .withJmxManagerPort(Framework.FreeTcpPort())
+ .execute());
}
finally
{
- Assert.Equal(gfsh1.shutdown()
+ Assert.Equal(0, gfsh2.shutdown()
.withIncludeLocators(true)
- .execute(), 0);
+ .execute());
}
+
+ }
+ finally
+ {
+ Assert.Equal(0, gfsh1.shutdown()
+ .withIncludeLocators(true)
+ .execute());
}
}
}
diff --git a/clicache/integration-test2/GfshTest.cs b/clicache/integration-test2/GfshTest.cs
index 452bb3d..819bf08 100644
--- a/clicache/integration-test2/GfshTest.cs
+++ b/clicache/integration-test2/GfshTest.cs
@@ -1,4 +1,4 @@
-/*
+/*
* 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.
@@ -18,22 +18,22 @@
using System;
using System.Collections.Generic;
using Xunit;
+using Xunit.Abstractions;
namespace Apache.Geode.Client.IntegrationTests
{
[Trait("Category", "Integration")]
- public class GfshTest : IDisposable
+ public class GfshTest : TestBase
{
- public void Dispose()
+ public GfshTest(ITestOutputHelper testOutputHelper) : base(testOutputHelper)
{
-
}
[Fact]
public void InstantiateGfshClassesTest()
{
- var gfsh = new GfshExecute();
+ var gfsh = new GfshExecute(output);
var start = gfsh.start();
Assert.NotNull(start);
@@ -53,19 +53,13 @@
[Fact]
public void StartLocatorStringsTest()
{
- var Gfsh = new GfshExecute();
-
- var currentDir = Environment.CurrentDirectory;
- Gfsh.Keystore = "some/path/keystore.jks";
- Gfsh.KeystorePassword = "password";
- Gfsh.Truststore = "some/path/truststore.jks";
- Gfsh.TruststorePassword = "password";
+ var Gfsh = new GfshExecute(output);
var locator = Gfsh
.start()
.locator();
var s = locator.ToString();
- Assert.True(s.Equals("start locator"));
+ Assert.Equal("start locator", s);
locator = Gfsh
.start()
@@ -79,31 +73,31 @@
.withLogLevel("fine")
.withMaxHeap("someHugeAmount")
.withConnect(false)
- .withUseSsl();
+ .withSslEnableComponents("locator,jmx")
+ .withSslKeyStore("some/path/keystore.jks")
+ .withSslKeyStorePassword("password1")
+ .withSslTrustStore("some/path/truststore.jks")
+ .withSslTrustStorePassword("password2");
s = locator.ToString();
- Assert.Equal(s, "start locator --name=name --dir=dir " +
- "--http-service-port=2222 --log-level=fine --max-heap=someHugeAmount " +
+ Assert.Equal("start locator --name=name --dir=dir --bind-address=address --port=420 " +
+ "--J=-Dgemfire.jmx-manager-port=1111 --http-service-port=2222 --log-level=fine --max-heap=someHugeAmount " +
"--connect=false --J=-Dgemfire.ssl-enabled-components=locator,jmx " +
- "--J=-Dgemfire.ssl-keystore=some/path/keystore.jks --J=-Dgemfire.ssl-keystore-password=password " +
- "--J=-Dgemfire.ssl-truststore=some/path/truststore.jks --J=-Dgemfire.ssl-truststore-password=password");
+ "--J=-Dgemfire.ssl-keystore=some/path/keystore.jks --J=-Dgemfire.ssl-keystore-password=password1 " +
+ "--J=-Dgemfire.ssl-truststore=some/path/truststore.jks --J=-Dgemfire.ssl-truststore-password=password2", s);
}
[Fact]
public void StartServerStringsTest()
{
- var Gfsh = new GfshExecute();
+ var Gfsh = new GfshExecute(output);
var currentDir = Environment.CurrentDirectory;
- Gfsh.Keystore = "some/path/keystore.jks";
- Gfsh.KeystorePassword = "password";
- Gfsh.Truststore = "some/path/truststore.jks";
- Gfsh.TruststorePassword = "password";
var server = Gfsh
.start()
.server();
var s = server.ToString();
- Assert.True(s.Equals("start server"));
+ Assert.Equal("start server", s);
server = Gfsh
.start()
@@ -115,119 +109,117 @@
.withLocators("someLocator")
.withLogLevel("debug")
.withMaxHeap("1.21gigabytes")
- .withUseSsl();
+ .withSslEnableComponents("server,locator,jmx")
+ .withSslKeyStore("some/path/keystore.jks")
+ .withSslKeyStorePassword("password1")
+ .withSslTrustStore("some/path/truststore.jks")
+ .withSslTrustStorePassword("password2");
s = server.ToString();
- Assert.Equal(s, "start server --name=server " +
- "--dir=someDir --server-port=1234 --locators=someLocator --log-level=debug " +
+ Assert.Equal("start server --name=server " +
+ "--dir=someDir --bind-address=someAddress --server-port=1234 --locators=someLocator --log-level=debug " +
"--max-heap=1.21gigabytes --J=-Dgemfire.ssl-enabled-components=server,locator,jmx " +
- "--J=-Dgemfire.ssl-keystore=some/path/keystore.jks --J=-Dgemfire.ssl-keystore-password=password " +
- "--J=-Dgemfire.ssl-truststore=some/path/truststore.jks --J=-Dgemfire.ssl-truststore-password=password");
+ "--J=-Dgemfire.ssl-keystore=some/path/keystore.jks --J=-Dgemfire.ssl-keystore-password=password1 " +
+ "--J=-Dgemfire.ssl-truststore=some/path/truststore.jks --J=-Dgemfire.ssl-truststore-password=password2", s);
}
[Fact]
public void StopLocatorStringsTest()
{
- var locator = new GfshExecute()
+ var locator = new GfshExecute(output)
.stop()
.locator();
var s = locator.ToString();
- Assert.True(s.Equals("stop locator"));
+ Assert.Equal("stop locator", s);
- locator = new GfshExecute().stop().locator()
+ locator = new GfshExecute(output).stop().locator()
.withName("name")
.withDir("dir");
s = locator.ToString();
- Assert.True(s.Equals("stop locator --name=name --dir=dir"));
+ Assert.Equal("stop locator --name=name --dir=dir", s);
}
[Fact]
public void StopServerStringsTest()
{
- var server = new GfshExecute()
+ var server = new GfshExecute(output)
.stop()
.server();
var s = server.ToString();
- Assert.True(s.Equals("stop server"));
+ Assert.Equal("stop server", s);
- server = new GfshExecute()
+ server = new GfshExecute(output)
.stop()
.server()
.withName("server")
.withDir("someDir");
s = server.ToString();
- Assert.True(s.Equals("stop server --name=server --dir=someDir"));
+ Assert.Equal("stop server --name=server --dir=someDir", s);
}
[Fact]
public void CreateRegionStringsTest()
{
- var region = new GfshExecute()
+ var region = new GfshExecute(output)
.create()
.region();
var s = region.ToString();
- Assert.True(s.Equals("create region"));
+ Assert.Equal("create region", s);
- region = new GfshExecute()
+ region = new GfshExecute(output)
.create()
.region()
.withName("region")
.withType("PARTITION");
s = region.ToString();
- Assert.True(s.Equals("create region --name=region --type=PARTITION"));
+ Assert.Equal("create region --name=region --type=PARTITION", s);
}
[Fact]
public void ShutdownStringsTest()
{
- var shutdown = new GfshExecute()
+ var shutdown = new GfshExecute(output)
.shutdown();
var s = shutdown.ToString();
- Assert.True(s.Equals("shutdown"));
+ Assert.Equal("shutdown", s);
- shutdown = new GfshExecute()
+ shutdown = new GfshExecute(output)
.shutdown()
.withIncludeLocators(true);
s = shutdown.ToString();
- Assert.True(s.Equals("shutdown --include-locators=true"));
+ Assert.Equal("shutdown --include-locators=true", s);
- shutdown = new GfshExecute()
+ shutdown = new GfshExecute(output)
.shutdown()
.withIncludeLocators(false);
s = shutdown.ToString();
- Assert.True(s.Equals("shutdown --include-locators=false"));
+ Assert.Equal("shutdown --include-locators=false", s);
}
[Fact]
public void ConfigurePdxStringsTest()
{
- var configurePdx = new GfshExecute()
+ var configurePdx = new GfshExecute(output)
.configurePdx();
var s = configurePdx.ToString();
- Assert.Equal(s, "configure pdx");
+ Assert.Equal("configure pdx", s);
- configurePdx = new GfshExecute()
+ configurePdx = new GfshExecute(output)
.configurePdx()
.withReadSerialized(true);
s = configurePdx.ToString();
- Assert.Equal(s, "configure pdx --read-serialized=true");
+ Assert.Equal( "configure pdx --read-serialized=true", s);
- configurePdx = new GfshExecute()
+ configurePdx = new GfshExecute(output)
.configurePdx()
.withReadSerialized(false);
s = configurePdx.ToString();
- Assert.Equal(s, "configure pdx --read-serialized=false");
+ Assert.Equal("configure pdx --read-serialized=false", s);
}
[Fact]
public void ConnectStringsTest()
{
- var Gfsh = new GfshExecute();
-
- var currentDir = Environment.CurrentDirectory;
- Gfsh.Keystore = "some/path/keystore.jks";
- Gfsh.KeystorePassword = "password";
- Gfsh.Truststore = "some/path/truststore.jks";
- Gfsh.TruststorePassword = "password";
+ var Gfsh = new GfshExecute(output);
var connect = Gfsh
.connect();
@@ -237,11 +229,15 @@
connect = Gfsh
.connect()
.withJmxManager("localhost", 1234)
- .withUseSsl();
+ .withUseSsl(true)
+ .withKeyStore("some/path/keystore.jks")
+ .withKeyStorePassword("password1")
+ .withTrustStore("some/path/truststore.jks")
+ .withTrustStorePassword("password2");
s = connect.ToString();
- Assert.Equal(s, "connect --jmx-manager=localhost[1234] --use-ssl " +
- "--key-store=some/path/keystore.jks --key-store-password=password " +
- "--trust-store=some/path/truststore.jks --trust-store-password=password");
+ Assert.Equal("connect --jmx-manager=localhost[1234] --use-ssl=true " +
+ "--key-store=some/path/keystore.jks --key-store-password=password1 " +
+ "--trust-store=some/path/truststore.jks --trust-store-password=password2", s);
}
}
}
diff --git a/clicache/integration-test2/QueryTest.cs b/clicache/integration-test2/QueryTest.cs
new file mode 100644
index 0000000..ccb37b9
--- /dev/null
+++ b/clicache/integration-test2/QueryTest.cs
@@ -0,0 +1,197 @@
+/*
+ * 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.
+ */
+
+using System;
+using System.IO;
+using Xunit;
+using System.Diagnostics;
+using System.Threading;
+using Xunit.Abstractions;
+
+namespace Apache.Geode.Client.IntegrationTests
+{
+ public class QueryOrder : IPdxSerializable
+ {
+ private const string ORDER_ID_KEY_ = "order_id";
+ private const string NAME_KEY_ = "name";
+ private const string QUANTITY_KEY_ = "quantity";
+ public long OrderId { get; set; }
+ public string Name { get; set; }
+ public short Quantity { get; set; }
+ // A default constructor is required for deserialization
+ public QueryOrder() { }
+ public QueryOrder(int orderId, string name, short quantity)
+ {
+ OrderId = orderId;
+ Name = name;
+ Quantity = quantity;
+ }
+ public override string ToString()
+ {
+ return string.Format("Order: [{0}, {1}, {2}]", OrderId, Name, Quantity);
+ }
+ public void ToData(IPdxWriter output)
+ {
+ output.WriteLong(ORDER_ID_KEY_, OrderId);
+ output.MarkIdentityField(ORDER_ID_KEY_);
+ output.WriteString(NAME_KEY_, Name);
+ output.MarkIdentityField(NAME_KEY_);
+ output.WriteInt(QUANTITY_KEY_, Quantity);
+ output.MarkIdentityField(QUANTITY_KEY_);
+ }
+ public void FromData(IPdxReader input)
+ {
+ OrderId = input.ReadLong(ORDER_ID_KEY_);
+ Name = input.ReadString(NAME_KEY_);
+ Quantity = (short)input.ReadInt(QUANTITY_KEY_);
+ }
+ public static IPdxSerializable CreateDeserializable()
+ {
+ return new QueryOrder();
+ }
+ }
+
+
+ [Trait("Category", "Integration")]
+ public class QueryTest : TestBase
+ {
+ public QueryTest(ITestOutputHelper testOutputHelper) : base(testOutputHelper)
+ {
+ }
+
+ [Fact]
+ public void PdxSerializableQueryHaveCorrectValues()
+ {
+ using (var cluster = new Cluster(output, CreateTestCaseDirectoryName(), 1, 1))
+ {
+ Assert.True(cluster.Start());
+ Assert.Equal(0, cluster.Gfsh.create()
+ .region()
+ .withName("cqTestRegion")
+ .withType("REPLICATE")
+ .execute());
+
+ var cache = cluster.CreateCache();
+ try
+ {
+
+ cache.TypeRegistry.RegisterPdxType(QueryOrder.CreateDeserializable);
+
+ var regionFactory = cache.CreateRegionFactory(RegionShortcut.PROXY)
+ .SetPoolName("default");
+
+ var region = regionFactory.Create<string, QueryOrder>("cqTestRegion");
+
+ Debug.WriteLine("Putting and changing Position objects in the region");
+ var order1 = new QueryOrder(1, "product x", 23);
+ var order2 = new QueryOrder(2, "product y", 37);
+ var order3 = new QueryOrder(3, "product z", 101);
+
+ region.Put("order1", order1);
+
+ region.Put("order2", order2);
+
+ region.Put("order3", order3);
+
+ order1.Quantity = 20;
+ region.Put("order1", order1);
+
+ order2.Quantity = 45;
+ region.Put("order2", order2);
+
+ order3.Quantity = 11;
+ region.Put("order3", order3);
+
+ var results = region.Query<QueryOrder>("SELECT * FROM /cqTestRegion WHERE quantity > 30");
+ Assert.Equal(results.Size, 1UL);
+ Assert.Equal(results[0].Name, "product y");
+
+ region.Clear();
+ }
+ finally
+ {
+ cache.Close();
+ }
+ }
+ }
+
+ [Fact]
+ public void DataSerializableQueryHaveCorrectValues()
+ {
+ using (var cluster = new Cluster(output, CreateTestCaseDirectoryName(), 1, 1))
+ {
+ Assert.Equal(cluster.Start(), true);
+ Assert.Equal(0, cluster.Gfsh.deploy()
+ .withJar(Config.JavaobjectJarPath)
+ .execute());
+ Assert.Equal(0, cluster.Gfsh.create()
+ .region()
+ .withName("cqTestRegion")
+ .withType("REPLICATE")
+ .execute());
+
+ Assert.Equal(0, cluster.Gfsh.executeFunction()
+ .withId("InstantiateDataSerializable")
+ .withMember("DataSerializableQueryHaveCorrectValues_server_0")
+ .execute());
+
+ var cache = cluster.CreateCache();
+ try {
+ cache.TypeRegistry.RegisterType(Position.CreateDeserializable, 22);
+
+ var regionFactory = cache.CreateRegionFactory(RegionShortcut.PROXY)
+ .SetPoolName("default");
+
+ var region = regionFactory.Create<string, Position>("cqTestRegion");
+
+ Debug.WriteLine("Putting and changing Position objects in the region");
+ var order1 = new Position("GOOG", 23);
+ var order2 = new Position("IBM", 37);
+ var order3 = new Position("PVTL", 101);
+
+ region.Put("order1", order1);
+ var Value = region["order1"];
+
+ region.Put("order2", order2);
+
+ order1.SharesOutstanding = 55;
+ region.Put("order1", order1);
+
+ order2.SharesOutstanding = 77;
+ region.Put("order2", order2);
+
+ order2.SharesOutstanding = 11;
+ region.Put("order2", order2);
+
+ region.Remove("order1");
+
+ region.Put("order3", order3);
+
+ var results = region.Query<Position>("SELECT * FROM /cqTestRegion WHERE sharesOutstanding > 50");
+ Assert.Equal(results.Size, 1UL);
+ Assert.Equal(results[0].SecId, "PVTL");
+
+ region.Clear();
+ }
+ finally
+ {
+ cache.Close();
+ }
+ }
+ }
+ }
+}
diff --git a/clicache/integration-test2/RegionSSLTest.cs b/clicache/integration-test2/RegionSSLTest.cs
index 5446c4c..da4052f 100644
--- a/clicache/integration-test2/RegionSSLTest.cs
+++ b/clicache/integration-test2/RegionSSLTest.cs
@@ -18,71 +18,49 @@
using System;
using System.IO;
using Xunit;
+using Xunit.Abstractions;
namespace Apache.Geode.Client.IntegrationTests
{
[Trait("Category", "Integration")]
public class RegionSSLTest : TestBase, IDisposable
{
- private readonly Cache cacheOne_;
+ private readonly Cache cache_;
- public RegionSSLTest()
+ public RegionSSLTest(ITestOutputHelper testOutputHelper) : base(testOutputHelper)
{
- var pathvar = Environment.GetEnvironmentVariable("PATH");
-
- var openSslPath = Environment.CurrentDirectory + Config.OpenSSLPath;
-
- if (!Directory.Exists(openSslPath))
- {
- throw new DirectoryNotFoundException("OpenSSL is a prerequisite for integration tests and the directory was not found.");
- }
-
- pathvar += ";" + openSslPath;
-
- var cryptoImplPath = Environment.CurrentDirectory + Config.CryptoImplPath;
-
- if (!File.Exists(cryptoImplPath + "\\cryptoImpl.dll"))
- {
- throw new System.IO.FileNotFoundException("cryptoImpl.dll was not found at " + cryptoImplPath);
- }
-
- pathvar += ";" + cryptoImplPath;
-
- Environment.SetEnvironmentVariable("PATH", pathvar);
-
var cacheFactory = new CacheFactory();
+ cacheFactory.Set("log-level", "none");
cacheFactory.Set("ssl-enabled", "true");
- cacheFactory.Set("ssl-keystore", Environment.CurrentDirectory + "\\ClientSslKeys\\client_keystore.password.pem");
+ cacheFactory.Set("ssl-keystore", Environment.CurrentDirectory + @"\ClientSslKeys\client_keystore.password.pem");
cacheFactory.Set("ssl-keystore-password", "gemstone");
- cacheFactory.Set("ssl-truststore", Environment.CurrentDirectory + "\\ClientSslKeys\\client_truststore.pem");
+ cacheFactory.Set("ssl-truststore", Environment.CurrentDirectory + @"\ClientSslKeys\client_truststore.pem");
- cacheOne_ = cacheFactory.Create();
+ cache_ = cacheFactory.Create();
}
public void Dispose()
{
- cacheOne_.Close();
+ cache_.Close();
}
[Fact]
public void SslPutGetTest()
{
- using (var cluster = new Cluster(CreateTestCaseDirectoryName(), 1, 1))
+ using (var cluster = new Cluster(output, CreateTestCaseDirectoryName(), 1, 1))
{
cluster.UseSSL = true;
Assert.True(cluster.Start());
- Assert.Equal(cluster.Gfsh
+ Assert.Equal(0, cluster.Gfsh
.create()
.region()
.withName("testRegion1")
.withType("PARTITION")
- .execute(), 0);
+ .execute());
- cacheOne_.GetPoolFactory()
- .AddLocator(cluster.Gfsh.LocatorBindAddress, cluster.Gfsh.LocatorPort)
- .Create("default");
+ cluster.ApplyLocators(cache_.GetPoolFactory()).Create("default");
- var regionFactory = cacheOne_.CreateRegionFactory(RegionShortcut.PROXY)
+ var regionFactory = cache_.CreateRegionFactory(RegionShortcut.PROXY)
.SetPoolName("default");
var region = regionFactory.Create<string, string>("testRegion1");
diff --git a/clicache/integration-test2/RegionTest.cs b/clicache/integration-test2/RegionTest.cs
index 104bb72..0b67ca3 100644
--- a/clicache/integration-test2/RegionTest.cs
+++ b/clicache/integration-test2/RegionTest.cs
@@ -18,39 +18,42 @@
using System;
using System.IO;
using Xunit;
+using Xunit.Abstractions;
namespace Apache.Geode.Client.IntegrationTests
{
[Trait("Category", "Integration")]
public class RegionTest : TestBase
{
+ public RegionTest(ITestOutputHelper testOutputHelper) : base(testOutputHelper)
+ {
+ }
+
[Fact]
public void PutOnOneCacheGetOnAnotherCache()
{
- using (var cluster = new Cluster(CreateTestCaseDirectoryName(), 1, 1))
+ using (var cluster = new Cluster(output, CreateTestCaseDirectoryName(), 1, 1))
{
Assert.True(cluster.Start());
- Assert.Equal(cluster.Gfsh
+ Assert.Equal(0, cluster.Gfsh
.create()
.region()
.withName("testRegion1")
.withType("PARTITION")
- .execute(), 0);
+ .execute());
- var cacheFactory = new CacheFactory();
+ var cacheFactory = new CacheFactory()
+ .Set("log-level", "none");
+
var cacheOne = cacheFactory.Create();
- cacheOne.GetPoolFactory()
- .AddLocator(cluster.Gfsh.LocatorBindAddress, cluster.Gfsh.LocatorPort)
- .Create("default");
-
try
{
+ cluster.ApplyLocators(cacheOne.GetPoolFactory()).Create("default");
+
var cacheTwo = cacheFactory.Create();
try
{
- cacheTwo.GetPoolFactory()
- .AddLocator(cluster.Gfsh.LocatorBindAddress, cluster.Gfsh.LocatorPort)
- .Create("default");
+ cluster.ApplyLocators(cacheTwo.GetPoolFactory()).Create("default");
var regionFactory1 = cacheOne.CreateRegionFactory(RegionShortcut.PROXY)
.SetPoolName("default");
diff --git a/clicache/integration-test2/SerializationTests.cs b/clicache/integration-test2/SerializationTests.cs
index 6b5afc5..47dd405 100644
--- a/clicache/integration-test2/SerializationTests.cs
+++ b/clicache/integration-test2/SerializationTests.cs
@@ -21,6 +21,7 @@
using PdxTests;
using System.Collections;
using System.Collections.Generic;
+using Xunit.Abstractions;
namespace Apache.Geode.Client.IntegrationTests
{
@@ -399,6 +400,10 @@
[Trait("Category", "Integration")]
public class SerializationTests : TestBase
{
+ public SerializationTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper)
+ {
+ }
+
private void putAndCheck(IRegion<object, object> region, object key, object value)
{
region[key] = value;
@@ -410,25 +415,20 @@
[Fact]
public void BuiltInSerializableTypes()
{
- using (var cluster = new Cluster(CreateTestCaseDirectoryName(), 1, 1))
+ using (var cluster = new Cluster(output, CreateTestCaseDirectoryName(), 1, 1))
{
Assert.True(cluster.Start());
- Assert.Equal(cluster.Gfsh.create()
+ Assert.Equal(0, cluster.Gfsh.create()
.region()
.withName("testRegion")
.withType("REPLICATE")
- .execute(), 0);
- var cacheFactory = new CacheFactory()
- .Set("log-level", "none");
- var cache = cacheFactory.Create();
+ .execute());
- var poolFactory = cache.GetPoolFactory()
- .AddLocator("localhost", cluster.Gfsh.LocatorPort);
- poolFactory.Create("pool");
+ var cache = cluster.CreateCache();
- var regionFactory = cache.CreateRegionFactory(RegionShortcut.PROXY)
- .SetPoolName("pool");
- var region = regionFactory.Create<object, object>("testRegion");
+ var region = cache.CreateRegionFactory(RegionShortcut.PROXY)
+ .SetPoolName("default")
+ .Create<object, object>("testRegion");
Assert.NotNull(region);
putAndCheck(region, "CacheableString", "foo");
@@ -482,27 +482,22 @@
[Fact]
public void PutGetCustomSerializableTypes()
{
- using (var cluster = new Cluster(CreateTestCaseDirectoryName(), 1, 1))
+ using (var cluster = new Cluster(output, CreateTestCaseDirectoryName(), 1, 1))
{
Assert.True(cluster.Start());
- Assert.Equal(cluster.Gfsh.create()
+ Assert.Equal(0, cluster.Gfsh.create()
.region()
.withName("testRegion")
.withType("REPLICATE")
- .execute(), 0);
- var cacheFactory = new CacheFactory()
- .Set("log-level", "none");
- var cache = cacheFactory.Create();
+ .execute());
+
+ var cache = cluster.CreateCache();
cache.TypeRegistry.RegisterType(Order.CreateDeserializable, 0x42);
- var poolFactory = cache.GetPoolFactory()
- .AddLocator("localhost", cluster.Gfsh.LocatorPort);
- poolFactory.Create("pool");
-
- var regionFactory = cache.CreateRegionFactory(RegionShortcut.PROXY)
- .SetPoolName("pool");
- var orderRegion = regionFactory.Create<int, Order>("testRegion");
+ var orderRegion = cache.CreateRegionFactory(RegionShortcut.PROXY)
+ .SetPoolName("default")
+ .Create<int, Order>("testRegion");
Assert.NotNull(orderRegion);
const int orderKey = 65;
diff --git a/clicache/integration-test2/TestBase.cs b/clicache/integration-test2/TestBase.cs
index 34fdbce..fe5b87e 100644
--- a/clicache/integration-test2/TestBase.cs
+++ b/clicache/integration-test2/TestBase.cs
@@ -1,4 +1,4 @@
-/*
+/*
* 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.
@@ -20,13 +20,27 @@
using System.IO;
using System.Reflection;
using Xunit;
+using Xunit.Abstractions;
+using Xunit.Sdk;
namespace Apache.Geode.Client.IntegrationTests
{
[Trait("Category", "Integration")]
public class TestBase
{
- private const int MaxAllowedDirectoryCharacters = 30;
+ protected ITest currentTest;
+ protected ITestOutputHelper output;
+
+ public TestBase(ITestOutputHelper testOutputHelper)
+ {
+ var helper = (TestOutputHelper)testOutputHelper;
+
+ ITest test = (ITest)helper.GetType().GetField("test", BindingFlags.NonPublic | BindingFlags.Instance)
+ .GetValue(helper);
+
+ currentTest = test;
+ output = testOutputHelper;
+ }
public void CleanTestCaseDirectory(string directory)
{
@@ -38,16 +52,7 @@
public string CreateTestCaseDirectoryName()
{
- var st = new StackTrace();
- var sf = st.GetFrame(1);
- var currentMethod = sf.GetMethod();
- var dirName = currentMethod.Name;
-
- if (dirName.Length > MaxAllowedDirectoryCharacters)
- {
- dirName = dirName.Substring(0, MaxAllowedDirectoryCharacters);
- }
- return dirName;
+ return currentTest.TestCase.TestMethod.Method.Name;
}
}
}
diff --git a/clicache/integration-test2/cache.xml b/clicache/integration-test2/cache.xml
index b6e374c..9840108 100644
--- a/clicache/integration-test2/cache.xml
+++ b/clicache/integration-test2/cache.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8" ?>
+<?xml version="1.0" encoding="utf-8" ?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
diff --git a/clicache/integration-test2/packages.config b/clicache/integration-test2/packages.config
index 7b91adb..e7d725b 100644
--- a/clicache/integration-test2/packages.config
+++ b/clicache/integration-test2/packages.config
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8" ?>
+<?xml version="1.0" encoding="utf-8" ?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
diff --git a/clicache/integration-test2/xunit.runner.json b/clicache/integration-test2/xunit.runner.json
index 20169fe..16ea334 100644
--- a/clicache/integration-test2/xunit.runner.json
+++ b/clicache/integration-test2/xunit.runner.json
@@ -1,4 +1,4 @@
-{
+{
"methodDisplay": "classAndMethod",
"parallelizeAssembly": true,
"parallelizeTestCollections": true
diff --git a/clicache/plugins/SQLiteCLI/CMakeLists.txt b/clicache/plugins/SQLiteCLI/CMakeLists.txt
index f6440eb..8000a84 100644
--- a/clicache/plugins/SQLiteCLI/CMakeLists.txt
+++ b/clicache/plugins/SQLiteCLI/CMakeLists.txt
@@ -27,12 +27,15 @@
PdxClassLibrary
)
+get_target_property(SQLite_netFx_INTERFACE_LINK_LIBRARIES SQLite::netFx INTERFACE_LINK_LIBRARIES)
+
set_target_properties( ${PROJECT_NAME} PROPERTIES
- COMMON_LANGUAGE_RUNTIME ""
VS_GLOBAL_ROOTNAMESPACE ${PROJECT_NAME}
VS_GLOBAL_TreatWarningsAsErrors True
VS_GLOBAL_PROJECT_TYPES "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
- VS_DOTNET_REFERENCE_System.Data.SQLite ${sqlite-netFx_SHARED_LIB}
+ VS_DOTNET_REFERENCE_System.Data.SQLite "${SQLite_netFx_INTERFACE_LINK_LIBRARIES}"
VS_DOTNET_REFERENCES "System;System.Data;System.Xml"
FOLDER cli/plugins
-)
\ No newline at end of file
+)
+
+add_dependencies(${PROJECT_NAME} SQLite::netFx)
diff --git a/clicache/plugins/SQLiteCLI/SqLiteImpl.cs b/clicache/plugins/SQLiteCLI/SqLiteImpl.cs
index b67f888..749d16c 100644
--- a/clicache/plugins/SQLiteCLI/SqLiteImpl.cs
+++ b/clicache/plugins/SQLiteCLI/SqLiteImpl.cs
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-using System;
+using System;
using System.Data;
using System.Data.SQLite;
using Apache.Geode.Client;
diff --git a/clicache/src/Cache.hpp b/clicache/src/Cache.hpp
index d45d10d..8766d62 100644
--- a/clicache/src/Cache.hpp
+++ b/clicache/src/Cache.hpp
@@ -22,6 +22,10 @@
#include "IGeodeCache.hpp"
#include "native_shared_ptr.hpp"
+#include "begin_native.hpp"
+#include <geode/Cache.hpp>
+#include "end_native.hpp"
+
using namespace System;
namespace Apache
diff --git a/clicache/src/CacheableHashMap.hpp b/clicache/src/CacheableHashMap.hpp
index f0c9389..702b69a 100644
--- a/clicache/src/CacheableHashMap.hpp
+++ b/clicache/src/CacheableHashMap.hpp
@@ -22,6 +22,10 @@
#include "ISerializable.hpp"
#include "IDataSerializablePrimitive.hpp"
+#include "begin_native.hpp"
+#include <geode/internal/DSCode.hpp>
+#include "end_native.hpp"
+
using namespace System;
using namespace System::Collections::Generic;
@@ -33,7 +37,7 @@
{
namespace Client
{
- namespace native = apache::geode::client;
+ namespace native = apache::geode::client;
/// <summary>
/// A mutable <c>ICacheableKey</c> to <c>ISerializable</c> hash map
diff --git a/clicache/src/CacheableObject.hpp b/clicache/src/CacheableObject.hpp
index 53edfa1..acfe37b 100644
--- a/clicache/src/CacheableObject.hpp
+++ b/clicache/src/CacheableObject.hpp
@@ -21,6 +21,10 @@
#include "geode_defs.hpp"
#include "IDataSerializablePrimitive.hpp"
+#include "begin_native.hpp"
+#include <geode/internal/InternalId.hpp>
+#include "end_native.hpp"
+
using namespace System;
namespace Apache
diff --git a/clicache/src/CacheableObjectArray.hpp b/clicache/src/CacheableObjectArray.hpp
index 6cce069..e3bcb34 100644
--- a/clicache/src/CacheableObjectArray.hpp
+++ b/clicache/src/CacheableObjectArray.hpp
@@ -20,6 +20,10 @@
#include "geode_defs.hpp"
#include "IDataSerializablePrimitive.hpp"
+#include "begin_native.hpp"
+#include <geode/internal/DSCode.hpp>
+#include "end_native.hpp"
+
using namespace System;
using namespace System::Collections::Generic;
diff --git a/clicache/src/CacheableObjectXml.hpp b/clicache/src/CacheableObjectXml.hpp
index ef7c610..0e4c5e1 100644
--- a/clicache/src/CacheableObjectXml.hpp
+++ b/clicache/src/CacheableObjectXml.hpp
@@ -21,6 +21,10 @@
#include "geode_defs.hpp"
#include "IDataSerializablePrimitive.hpp"
+#include "begin_native.hpp"
+#include <geode/internal/InternalId.hpp>
+#include "end_native.hpp"
+
using namespace System;
namespace Apache
diff --git a/clicache/src/CacheableUndefined.hpp b/clicache/src/CacheableUndefined.hpp
index f4f3a5a..f217911 100644
--- a/clicache/src/CacheableUndefined.hpp
+++ b/clicache/src/CacheableUndefined.hpp
@@ -23,6 +23,10 @@
#include "ISerializable.hpp"
#include "Log.hpp"
+#include "begin_native.hpp"
+#include <geode/internal/DSFixedId.hpp>
+#include "end_native.hpp"
+
using namespace System;
namespace Apache
@@ -92,7 +96,7 @@
{
virtual Int32 get()
{
- return static_cast<Int32>(native::DSFid::CacheableUndefined);
+ return static_cast<Int32>(native::internal::DSFid::CacheableUndefined);
}
}
diff --git a/clicache/src/CacheableVector.hpp b/clicache/src/CacheableVector.hpp
index bb820aa..c944f0d 100644
--- a/clicache/src/CacheableVector.hpp
+++ b/clicache/src/CacheableVector.hpp
@@ -22,6 +22,9 @@
#include "IDataSerializablePrimitive.hpp"
#include "ISerializable.hpp"
+#include "begin_native.hpp"
+#include <geode/internal/DSCode.hpp>
+#include "end_native.hpp"
using namespace System;
using namespace System::Collections::Generic;
diff --git a/clicache/src/Execution.cpp b/clicache/src/Execution.cpp
index beaa0cb..f607384 100644
--- a/clicache/src/Execution.cpp
+++ b/clicache/src/Execution.cpp
@@ -15,9 +15,6 @@
* limitations under the License.
*/
-
-
-
#include "Execution.hpp"
#include "begin_native.hpp"
#include <geode/Execution.hpp>
@@ -49,7 +46,8 @@
for each(TFilter item in routingObj)
{
- rsptr->push_back(Serializable::GetUnmanagedValueGeneric<TFilter>( item ));
+ auto v = Serializable::GetUnmanagedValueGeneric<TFilter>(item);
+ rsptr->push_back(v);
}
try
@@ -104,7 +102,6 @@
}
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
-
generic<class TResult>
IResultCollector<TResult>^ Execution<TResult>::Execute(String^ func, TimeSpan timeout)
{
diff --git a/clicache/src/GeodeClassIds.hpp b/clicache/src/GeodeClassIds.hpp
index f28b031..56a1066 100644
--- a/clicache/src/GeodeClassIds.hpp
+++ b/clicache/src/GeodeClassIds.hpp
@@ -19,6 +19,7 @@
#include "geode_defs.hpp"
#include "begin_native.hpp"
+#include <geode/internal/InternalId.hpp>
#include "end_native.hpp"
namespace Apache
diff --git a/clicache/src/LocalRegion.cpp b/clicache/src/LocalRegion.cpp
index b9f36d0..4d961b9 100644
--- a/clicache/src/LocalRegion.cpp
+++ b/clicache/src/LocalRegion.cpp
@@ -44,7 +44,7 @@
generic<class TKey, class TValue>
TValue LocalRegion<TKey, TValue>::Get(TKey key, Object^ callbackArg)
{
- std::shared_ptr<native::CacheableKey> keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( key );
+ auto keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( key );
auto nativeptr= this->getRegionEntryValue(keyptr);
if (nativeptr == nullptr)
{
@@ -812,7 +812,8 @@
try
{
- return m_nativeptr->get()->containsValueForKey(Serializable::GetUnmanagedValueGeneric<TKey>(key));
+ auto v = Serializable::GetUnmanagedValueGeneric<TKey>(key);
+ return m_nativeptr->get()->containsValueForKey(v);
}
finally
{
diff --git a/clicache/src/Log.cpp b/clicache/src/Log.cpp
index 333f03c..4264fd4 100644
--- a/clicache/src/Log.cpp
+++ b/clicache/src/Log.cpp
@@ -18,9 +18,9 @@
#include "Log.hpp"
+#include "ExceptionTypes.hpp"
#include "impl/ManagedString.hpp"
#include "impl/SafeConvert.hpp"
-#include "ExceptionTypes.hpp"
using namespace System;
@@ -70,15 +70,6 @@
static_cast<apache::geode::client::LogLevel>(level));
}
- String^ Log::LogFileName()
- {
- _GF_MG_EXCEPTION_TRY2
-
- return ManagedString::Get(apache::geode::client::Log::logFileName());
-
- _GF_MG_EXCEPTION_CATCH_ALL2
- }
-
bool Log::Enabled(LogLevel level)
{
return apache::geode::client::Log::enabled(
diff --git a/clicache/src/Log.hpp b/clicache/src/Log.hpp
index 7ac9514..5409646 100644
--- a/clicache/src/Log.hpp
+++ b/clicache/src/Log.hpp
@@ -199,13 +199,6 @@
static void SetLevel(LogLevel level);
/// <summary>
- /// Returns the name of the current log file.
- /// NOTE: This function is for debugging only, as it is not completely
- /// thread-safe!
- /// </summary>
- static String^ LogFileName();
-
- /// <summary>
/// True if log messages at the given level are enabled.
/// </summary>
static bool Enabled(LogLevel level);
diff --git a/clicache/src/Region.cpp b/clicache/src/Region.cpp
index 5e59550..2f4ddef 100644
--- a/clicache/src/Region.cpp
+++ b/clicache/src/Region.cpp
@@ -185,7 +185,7 @@
System::Collections::Generic::IEnumerator<KeyValuePair<TKey, TValue>>^
Region<TKey, TValue>::GetEnumerator()
{
- std::vector<std::shared_ptr<native::RegionEntry>> vc;
+ std::vector<std::shared_ptr<native::RegionEntry>> vc;
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
@@ -216,7 +216,7 @@
System::Collections::IEnumerator^
Region<TKey, TValue>::GetEnumeratorOld()
{
- std::vector<std::shared_ptr<native::RegionEntry>> vc;
+ std::vector<std::shared_ptr<native::RegionEntry>> vc;
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
@@ -299,7 +299,7 @@
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- std::vector<std::shared_ptr<native::CacheableKey>> vc;
+ std::vector<std::shared_ptr<native::CacheableKey>> vc;
try
{
vc = m_nativeptr->get()->serverKeys();
@@ -325,7 +325,7 @@
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- std::vector<std::shared_ptr<native::Cacheable>> vc;
+ std::vector<std::shared_ptr<native::Cacheable>> vc;
try
{
vc = m_nativeptr->get()->values();
@@ -656,8 +656,8 @@
for each(TKey item in keys)
{
- vecKeys.push_back(
- Serializable::GetUnmanagedValueGeneric<TKey>(item));
+ auto v = Serializable::GetUnmanagedValueGeneric<TKey>(item);
+ vecKeys.push_back(v);
}
native::HashMapOfCacheable native_value;
@@ -694,12 +694,12 @@
if (keys != nullptr) {
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- std::vector<std::shared_ptr<native::CacheableKey>> vecKeys;
+ std::vector<std::shared_ptr<native::CacheableKey>> vecKeys;
for each(TKey item in keys)
{
- vecKeys.push_back(
- Serializable::GetUnmanagedValueGeneric<TKey>(item));
+ auto v = Serializable::GetUnmanagedValueGeneric<TKey>(item);
+ vecKeys.push_back(v);
}
std::shared_ptr<native::HashMapOfCacheable> valuesPtr;
@@ -748,9 +748,12 @@
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- std::vector<std::shared_ptr<native::CacheableKey>> vecKeys;
- for each(TKey item in keys)
- vecKeys.push_back(Serializable::GetUnmanagedValueGeneric<TKey>(item));
+ std::vector<std::shared_ptr<native::CacheableKey>> vecKeys;
+ for each(TKey item in keys)
+ {
+ auto v = Serializable::GetUnmanagedValueGeneric<TKey>(item);
+ vecKeys.push_back(v);
+ }
std::shared_ptr<native::Serializable> callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg);
@@ -954,7 +957,7 @@
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- std::vector<std::shared_ptr<native::RegionEntry>> vc;
+ std::vector<std::shared_ptr<native::RegionEntry>> vc;
try
{
vc = m_nativeptr->get()->entries(recursive);
@@ -1054,7 +1057,7 @@
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- std::vector<std::shared_ptr<native::RegionEntry>> vc;
+ std::vector<std::shared_ptr<native::RegionEntry>> vc;
try
{
vc = m_nativeptr->get()->entries(false);
@@ -1120,7 +1123,8 @@
for each(TKey item in keys)
{
- vecKeys.push_back(Serializable::GetUnmanagedValueGeneric<TKey>(item));
+ auto v = Serializable::GetUnmanagedValueGeneric<TKey>(item);
+ vecKeys.push_back(v);
}
try
{
@@ -1146,8 +1150,8 @@
for each(TKey item in keys)
{
- vecKeys.push_back(
- Serializable::GetUnmanagedValueGeneric<TKey>(item));
+ auto v = Serializable::GetUnmanagedValueGeneric<TKey>(item);
+ vecKeys.push_back(v);
}
try
@@ -1206,7 +1210,7 @@
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- std::vector<std::shared_ptr<native::CacheableKey>> vc;
+ std::vector<std::shared_ptr<native::CacheableKey>> vc;
try
{
vc = m_nativeptr->get()->getInterestList();
@@ -1233,7 +1237,7 @@
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- std::vector<std::shared_ptr<native::CacheableString>> vc;
+ std::vector<std::shared_ptr<native::CacheableString>> vc;
try
{
vc = m_nativeptr->get()->getInterestListRegex();
diff --git a/clicache/src/TypeRegistry.cpp b/clicache/src/TypeRegistry.cpp
index f23311a..9809c62 100644
--- a/clicache/src/TypeRegistry.cpp
+++ b/clicache/src/TypeRegistry.cpp
@@ -250,7 +250,7 @@
auto&& serializationRegistry = CacheRegionHelper::getCacheImpl(m_cache->GetNative().get())->getSerializationRegistry();
auto nativeDelegateFunction = static_cast<std::shared_ptr<native::Serializable>(*)()>(
System::Runtime::InteropServices::Marshal::GetFunctionPointerForDelegate(nativeDelegate).ToPointer());
- serializationRegistry->addDataSerializableFixedIdType(fixedId, nativeDelegateFunction);
+ serializationRegistry->addDataSerializableFixedIdType(static_cast<internal::DSFid>(fixedId), nativeDelegateFunction);
_GF_MG_EXCEPTION_CATCH_ALL2
}
diff --git a/clicache/src/begin_native.hpp b/clicache/src/begin_native.hpp
index 36bf715..7d1d331 100644
--- a/clicache/src/begin_native.hpp
+++ b/clicache/src/begin_native.hpp
@@ -28,6 +28,9 @@
#undef nullptr
#define nullptr __nullptr
+#pragma push_macro("_M_CEE")
+#undef _M_CEE
+
#pragma warning(push)
// Disable XML warnings
diff --git a/clicache/src/end_native.hpp b/clicache/src/end_native.hpp
index 996b31d..b2134df 100644
--- a/clicache/src/end_native.hpp
+++ b/clicache/src/end_native.hpp
@@ -21,7 +21,8 @@
#pragma warning(pop)
+#pragma pop_macro("_M_CEE")
#pragma pop_macro("nullptr")
#pragma pop_macro("_ALLOW_KEYWORD_MACROS")
-#undef __begin_native__hpp__
\ No newline at end of file
+#undef __begin_native__hpp__
diff --git a/clicache/src/geode_includes.hpp b/clicache/src/geode_includes.hpp
index 8ddce3f..49277de 100644
--- a/clicache/src/geode_includes.hpp
+++ b/clicache/src/geode_includes.hpp
@@ -32,10 +32,17 @@
#include "begin_native.hpp"
#include <geode/Cache.hpp>
#include <geode/CacheableBuiltins.hpp>
-#include <geode/CacheLoader.hpp>
#include <geode/CacheListener.hpp>
-#include <geode/FixedPartitionResolver.hpp>
+#include <geode/CacheLoader.hpp>
#include <geode/CacheWriter.hpp>
+#include <geode/DataSerializable.hpp>
+#include <geode/PdxSerializable.hpp>
+#include <geode/FixedPartitionResolver.hpp>
+#include <geode/internal/DataSerializableFixedId.hpp>
+#include <geode/internal/DataSerializablePrimitive.hpp>
+#include <geode/internal/DataSerializableInternal.hpp>
+#include <geode/internal/DSCode.hpp>
+#include <geode/internal/DSFixedId.hpp>
#include <geode/internal/InternalId.hpp>
#include "end_native.hpp"
@@ -43,4 +50,5 @@
#include "begin_native.hpp"
#include <CacheImpl.hpp>
#include <DistributedSystemImpl.hpp>
+#include <PdxFieldType.hpp>
#include "end_native.hpp"
diff --git a/clicache/src/impl/AppDomainContext.cpp b/clicache/src/impl/AppDomainContext.cpp
index f04c32e..07b1a96 100644
--- a/clicache/src/impl/AppDomainContext.cpp
+++ b/clicache/src/impl/AppDomainContext.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* 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.
diff --git a/clicache/src/impl/EnumInfo.hpp b/clicache/src/impl/EnumInfo.hpp
index 7cca168..0361543 100755
--- a/clicache/src/impl/EnumInfo.hpp
+++ b/clicache/src/impl/EnumInfo.hpp
@@ -20,6 +20,10 @@
#include "../IDataSerializableFixedId.hpp"
#include "../ISerializable.hpp"
+#include "../begin_native.hpp"
+#include <geode/internal/DSFixedId.hpp>
+#include "../end_native.hpp"
+
using namespace System;
using namespace System::Collections::Generic;
@@ -69,7 +73,7 @@
property Int32 DSFID
{
- virtual Int32 get() { return static_cast<Int32>(apache::geode::client::DSFid::EnumInfo); }
+ virtual Int32 get() { return static_cast<Int32>(apache::geode::client::internal::DSFid::EnumInfo); }
}
virtual String^ ToString() override
diff --git a/clicache/src/impl/ManagedCacheableDelta.hpp b/clicache/src/impl/ManagedCacheableDelta.hpp
index fb7b193..cd35897 100644
--- a/clicache/src/impl/ManagedCacheableDelta.hpp
+++ b/clicache/src/impl/ManagedCacheableDelta.hpp
@@ -22,6 +22,9 @@
#include "../geode_defs.hpp"
#include "../begin_native.hpp"
+#include <geode/CacheableKey.hpp>
+#include <geode/Delta.hpp>
+#include <geode/DataSerializable.hpp>
#include "../end_native.hpp"
#include "../IDelta.hpp"
#include "../IDataSerializable.hpp"
diff --git a/clicache/src/impl/ManagedCacheableKey.hpp b/clicache/src/impl/ManagedCacheableKey.hpp
index 491c22a..03d87ae 100644
--- a/clicache/src/impl/ManagedCacheableKey.hpp
+++ b/clicache/src/impl/ManagedCacheableKey.hpp
@@ -22,6 +22,10 @@
#include <vcclr.h>
#include "../begin_native.hpp"
#include <geode/CacheableKey.hpp>
+#include <geode/DataSerializable.hpp>
+#include <geode/internal/DataSerializableFixedId.hpp>
+#include <geode/internal/DataSerializablePrimitive.hpp>
+#include <geode/internal/DataSerializableInternal.hpp>
#include "../end_native.hpp"
#include "../IDataSerializable.hpp"
@@ -119,7 +123,7 @@
};
class ManagedDataSerializablePrimitive
- : public native::DataSerializablePrimitive , public native::CacheableKey
+ : public native::internal::DataSerializablePrimitive , public native::CacheableKey
{
public:
@@ -139,7 +143,7 @@
void fromData(DataInput& input) override;
- DSCode getDsCode() const override { return static_cast<DSCode>(m_managedptr->DsCode); }
+ native::internal::DSCode getDsCode() const override { return static_cast<native::internal::DSCode>(m_managedptr->DsCode); }
bool operator == (const CacheableKey& other) const override;
@@ -156,7 +160,7 @@
};
class ManagedDataSerializableInternal
- : public native::DataSerializableInternal
+ : public native::internal::DataSerializableInternal
{
public:
@@ -187,7 +191,7 @@
};
class ManagedDataSerializableFixedId
- : public native::DataSerializableFixedId
+ : public native::internal::DataSerializableFixedId
{
public:
@@ -207,7 +211,7 @@
void fromData(DataInput& input) override;
- DSFid getDSFID() const override { return static_cast<DSFid>(m_managedptr->DSFID); }
+ native::internal::DSFid getDSFID() const override { return static_cast<native::internal::DSFid>(m_managedptr->DSFID); }
inline Apache::Geode::Client::IDataSerializableFixedId^ ptr() const
{
diff --git a/clicache/src/impl/PdxFieldType.cpp b/clicache/src/impl/PdxFieldType.cpp
index 04d8f99..543fcd4 100644
--- a/clicache/src/impl/PdxFieldType.cpp
+++ b/clicache/src/impl/PdxFieldType.cpp
@@ -21,6 +21,7 @@
#include "PdxFieldType.hpp"
#include "../begin_native.hpp"
#include <PdxTypes.hpp>
+#include <PdxFieldType.hpp>
#include "../end_native.hpp"
diff --git a/clicache/src/impl/PdxManagedCacheableKey.hpp b/clicache/src/impl/PdxManagedCacheableKey.hpp
index 12ddcba..b3f14d0 100644
--- a/clicache/src/impl/PdxManagedCacheableKey.hpp
+++ b/clicache/src/impl/PdxManagedCacheableKey.hpp
@@ -22,6 +22,7 @@
#include "../begin_native.hpp"
#include <geode/CacheableKey.hpp>
#include <geode/Delta.hpp>
+#include <geode/PdxSerializable.hpp>
#include "../end_native.hpp"
#include "../geode_defs.hpp"
diff --git a/clicache/src/impl/PdxType.hpp b/clicache/src/impl/PdxType.hpp
index 90c6854..86737e0 100644
--- a/clicache/src/impl/PdxType.hpp
+++ b/clicache/src/impl/PdxType.hpp
@@ -19,6 +19,10 @@
#include "PdxFieldType.hpp"
+#include "../begin_native.hpp"
+#include <PdxFieldType.hpp>
+#include "../end_native.hpp"
+
using namespace System;
using namespace System::Collections::Generic;
diff --git a/clicache/test2/packages.config b/clicache/test2/packages.config
index 2236085..02bf7df 100644
--- a/clicache/test2/packages.config
+++ b/clicache/test2/packages.config
@@ -1,4 +1,20 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
<packages>
<package id="Microsoft.VisualStudio.TestPlatform" version="14.0.0.1" targetFramework="net452" />
<package id="xunit" version="2.4.0" targetFramework="net452" />
@@ -10,4 +26,4 @@
<package id="xunit.extensibility.execution" version="2.4.0" targetFramework="net452" />
<package id="xunit.runner.console" version="2.4.0" targetFramework="net452" developmentDependency="true" />
<package id="xunit.runner.visualstudio" version="2.4.0" targetFramework="net452" developmentDependency="true" />
-</packages>
\ No newline at end of file
+</packages>
diff --git a/clicache/test2/xunit.runner.json b/clicache/test2/xunit.runner.json
index 20169fe..16ea334 100644
--- a/clicache/test2/xunit.runner.json
+++ b/clicache/test2/xunit.runner.json
@@ -1,4 +1,4 @@
-{
+{
"methodDisplay": "classAndMethod",
"parallelizeAssembly": true,
"parallelizeTestCollections": true
diff --git a/cmake/ClangFormat.cmake b/cmake/ClangFormat.cmake
index fb93b79..b5c6f23 100644
--- a/cmake/ClangFormat.cmake
+++ b/cmake/ClangFormat.cmake
@@ -32,13 +32,14 @@
set(_clangformat_SOURCES "")
foreach (_source ${_target_SOURCES})
if (NOT TARGET ${_source})
- get_source_file_property(_source_LOCATION "${_source}" LOCATION)
get_source_file_property(_source_GENERATED "${_source}" GENERATED)
-
- if(_source_GENERATED)
+ string(REGEX MATCH "\\.(h(pp|xx)?|c(pp|xx)?)(\\..*)?$" _source_extension_match ${_source})
+ if(_source_GENERATED
+ OR _source_extension_match STREQUAL "")
break()
endif()
+ get_source_file_property(_source_LOCATION "${_source}" LOCATION)
file(RELATIVE_PATH _source_RELATIVE_PATH ${_target_SOURCE_DIR} ${_source_LOCATION})
string(REPLACE ".." "__" _format_file "${_target_BINARY_DIR}/CMakeFiles/${_clangformat}.dir/${_source_RELATIVE_PATH}.format")
get_filename_component(_format_DIRECTORY ${_format_file} DIRECTORY)
diff --git a/cmake/FindGeode.cmake b/cmake/FindGeode.cmake
index 9e58cf7..3663596 100644
--- a/cmake/FindGeode.cmake
+++ b/cmake/FindGeode.cmake
@@ -35,21 +35,21 @@
set(_GEODE_HINTS)
if(_GEODE_ROOT)
set(_GEODE_HINTS ${_GEODE_ROOT}/bin)
+else()
+ set(_GEODE_PATHS
+ /geode/bin
+ /apache-geode/bin
+ /usr/geode/bin
+ /usr/apache-geode/bin
+ /usr/local/geode/bin
+ /usr/local/apache-geode/bin
+ /opt/geode/bin
+ /opt/apache-geode/bin
+ /opt/local/geode/bin
+ /opt/local/apache-geode/bin
+ )
endif()
-set(_GEODE_PATHS
- /geode/bin
- /apache-geode/bin
- /usr/geode/bin
- /usr/apache-geode/bin
- /usr/local/geode/bin
- /usr/local/apache-geode/bin
- /opt/geode/bin
- /opt/apache-geode/bin
- /opt/local/geode/bin
- /opt/local/apache-geode/bin
-)
-
if(WIN32)
set(_GEODE_NAMES gfsh.bat)
else()
diff --git a/contrib/pdxautoserializer/src/CMakeLists.txt b/cmake/RatCheck.cmake
similarity index 61%
copy from contrib/pdxautoserializer/src/CMakeLists.txt
copy to cmake/RatCheck.cmake
index 895cd74..0590409 100644
--- a/contrib/pdxautoserializer/src/CMakeLists.txt
+++ b/cmake/RatCheck.cmake
@@ -4,24 +4,29 @@
# 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.
-cmake_minimum_required(VERSION 3.4)
-project(pdxautoserializer)
+#
-file(GLOB_RECURSE SOURCES "*.cpp")
-
-add_executable(pdxautoserializer ${SOURCES})
-target_link_libraries(pdxautoserializer
- PRIVATE
- antlr
+execute_process(
+ COMMAND ${Java_JAVA_EXECUTABLE} -jar ${Rat_JAR} -d . -E .ratignore >
+ OUTPUT_VARIABLE ratOutput
)
-install(TARGETS pdxautoserializer DESTINATION bin)
-include_directories(${CMAKE_SOURCE_DIR}/../../src/cppcache/include)
+set(pass FALSE)
+if (ratOutput MATCHES "([0-9]+) Unknown Licenses")
+ set(unknownLicenses ${CMAKE_MATCH_1})
+ if (unknownLicenses GREATER 0)
+ message(SEND_ERROR "${ratOutput}")
+ message(FATAL_ERROR "${unknownLicenses} Unknown licenses detected.")
+ endif()
+else()
+ message(SEND_ERROR "${ratOutput}")
+ message(FATAL_ERROR "Unknown failure")
+endif()
diff --git a/contrib/pdxautoserializer/dependencies/CMakeLists.txt b/contrib/pdxautoserializer/dependencies/CMakeLists.txt
deleted file mode 100644
index cc79dad..0000000
--- a/contrib/pdxautoserializer/dependencies/CMakeLists.txt
+++ /dev/null
@@ -1,26 +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.
-cmake_minimum_required( VERSION 3.3 )
-project(geode-native-tools.dependencies)
-
-include(CheckCCompilerFlag)
-include(CheckCXXCompilerFlag)
-
-find_program( PATCH NAMES gpatch patch )
-if ("PATCH-NOTFOUND" STREQUAL "${PATCH}")
- message( FATAL_ERROR "patch not found." )
-endif()
-
-add_subdirectory(antlr)
diff --git a/contrib/pdxautoserializer/dependencies/antlr/CMakeLists.txt b/contrib/pdxautoserializer/dependencies/antlr/CMakeLists.txt
deleted file mode 100644
index 015f50a..0000000
--- a/contrib/pdxautoserializer/dependencies/antlr/CMakeLists.txt
+++ /dev/null
@@ -1,63 +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.
-cmake_minimum_required( VERSION 3.3 )
-project(antlr)
-
-set( ${PROJECT_NAME}_VERSION 2.7.7 )
-set( ${PROJECT_NAME}_SHA265 853aeb021aef7586bda29e74a6b03006bcb565a755c86b66032d8ec31b67dbb9 )
-set( ${PROJECT_NAME}_URL "http://www.antlr2.org/download/antlr-${${PROJECT_NAME}_VERSION}.tar.gz" )
-set( ${PROJECT_NAME}_EXTERN ${PROJECT_NAME}-extern )
-
-include(ExternalProject)
-
-ExternalProject_Add( ${${PROJECT_NAME}_EXTERN}
- URL ${${PROJECT_NAME}_URL}
- URL_HASH SHA256=${${PROJECT_NAME}_SHA265}
- UPDATE_COMMAND ""
- CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
-)
-
-ExternalProject_Get_Property( ${${PROJECT_NAME}_EXTERN} SOURCE_DIR )
-set( ${PROJECT_NAME}_SOURCE_DIR ${SOURCE_DIR} )
-ExternalProject_Get_Property( ${${PROJECT_NAME}_EXTERN} INSTALL_DIR )
-set( ${PROJECT_NAME}_INSTALL_DIR ${INSTALL_DIR} )
-set( DEPENDENCIES_${PROJECT_NAME}_DIR ${${PROJECT_NAME}_INSTALL_DIR} PARENT_SCOPE)
-
-ExternalProject_Add_Step( ${${PROJECT_NAME}_EXTERN} CMakeLists.txt
- DEPENDEES patch
- DEPENDERS configure
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt.in
- BYPRODUCTS ${${PROJECT_NAME}_SOURCE_DIR}/CMakeLists.txt
- COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt.in ${${PROJECT_NAME}_SOURCE_DIR}/CMakeLists.txt
-)
-
-ExternalProject_Add_Step( ${${PROJECT_NAME}_EXTERN} patches
- ALWAYS 0
- DEPENDEES download
- DEPENDERS patch
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/patches
- BYPRODUCTS ${${PROJECT_NAME}_SOURCE_DIR}/lib/cpp/antlr/CharScanner.hpp
- WORKING_DIRECTORY ${${PROJECT_NAME}_SOURCE_DIR}
- COMMAND ${PATCH} -u -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/patches
-)
-
-add_library(${PROJECT_NAME} INTERFACE)
-target_include_directories(${PROJECT_NAME} INTERFACE
- $<BUILD_INTERFACE:${${PROJECT_NAME}_INSTALL_DIR}/include>
-)
-target_link_libraries(${PROJECT_NAME} INTERFACE
- ${${PROJECT_NAME}_INSTALL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}${PROJECT_NAME}$<$<CONFIG:Debug>:d>${CMAKE_STATIC_LIBRARY_SUFFIX}
-)
-add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXTERN})
diff --git a/contrib/pdxautoserializer/dependencies/antlr/CMakeLists.txt.in b/contrib/pdxautoserializer/dependencies/antlr/CMakeLists.txt.in
deleted file mode 100644
index 3a9c194..0000000
--- a/contrib/pdxautoserializer/dependencies/antlr/CMakeLists.txt.in
+++ /dev/null
@@ -1,129 +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.
-cmake_minimum_required(VERSION 2.6)
-set(PROJECT_NAME antlr)
-
-set(CMAKE_CXX_STANDARD 11)
-set(CMAKE_CXX_STANDARD_REQUIRED ON)
-
-include(CheckCXXCompilerFlag)
-include(CheckCCompilerFlag)
-
-set(CMAKE_REQUIRED_LIBRARIES -m64)
-check_c_compiler_flag(-m64 CFLAGS_M64_ALLOWED)
-check_cxx_compiler_flag(-m64 CXXFLAGS_M64_ALLOWED)
-set(CMAKE_REQUIRED_LIBRARIES)
-
-if (CFLAGS_M64_ALLOWED AND CXXFLAGS_M64_ALLOWED)
- set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} -m64)
- add_compile_options(-m64)
-endif()
-
-set(CMAKE_DEBUG_POSTFIX d)
-
-set(ANTLR_SRC
- lib/cpp/src/ANTLRUtil.cpp
- lib/cpp/src/ASTFactory.cpp
- lib/cpp/src/ASTNULLType.cpp
- lib/cpp/src/ASTRefCount.cpp
- lib/cpp/src/BaseAST.cpp
- lib/cpp/src/BitSet.cpp
- lib/cpp/src/CharBuffer.cpp
- lib/cpp/src/CharScanner.cpp
- lib/cpp/src/CommonAST.cpp
- lib/cpp/src/CommonASTWithHiddenTokens.cpp
- lib/cpp/src/CommonHiddenStreamToken.cpp
- lib/cpp/src/CommonToken.cpp
- lib/cpp/src/InputBuffer.cpp
- lib/cpp/src/LLkParser.cpp
- lib/cpp/src/MismatchedCharException.cpp
- lib/cpp/src/MismatchedTokenException.cpp
- lib/cpp/src/NoViableAltException.cpp
- lib/cpp/src/NoViableAltForCharException.cpp
- lib/cpp/src/Parser.cpp
- lib/cpp/src/RecognitionException.cpp
- lib/cpp/src/String.cpp
- lib/cpp/src/Token.cpp
- lib/cpp/src/TokenBuffer.cpp
- lib/cpp/src/TokenRefCount.cpp
- lib/cpp/src/TokenStreamBasicFilter.cpp
- lib/cpp/src/TokenStreamHiddenTokenFilter.cpp
- lib/cpp/src/TokenStreamRewriteEngine.cpp
- lib/cpp/src/TokenStreamSelector.cpp
- lib/cpp/src/TreeParser.cpp
- )
-
-set(ANTLR_HDR
- lib/cpp/antlr/ANTLRException.hpp
- lib/cpp/antlr/ANTLRUtil.hpp
- lib/cpp/antlr/AST.hpp
- lib/cpp/antlr/ASTArray.hpp
- lib/cpp/antlr/ASTFactory.hpp
- lib/cpp/antlr/ASTNULLType.hpp
- lib/cpp/antlr/ASTPair.hpp
- lib/cpp/antlr/ASTRefCount.hpp
- lib/cpp/antlr/BaseAST.hpp
- lib/cpp/antlr/BitSet.hpp
- lib/cpp/antlr/CharBuffer.hpp
- lib/cpp/antlr/CharInputBuffer.hpp
- lib/cpp/antlr/CharScanner.hpp
- lib/cpp/antlr/CharStreamException.hpp
- lib/cpp/antlr/CharStreamIOException.hpp
- lib/cpp/antlr/CircularQueue.hpp
- lib/cpp/antlr/CommonAST.hpp
- lib/cpp/antlr/CommonASTWithHiddenTokens.hpp
- lib/cpp/antlr/CommonHiddenStreamToken.hpp
- lib/cpp/antlr/CommonToken.hpp
- lib/cpp/antlr/IOException.hpp
- lib/cpp/antlr/InputBuffer.hpp
- lib/cpp/antlr/LLkParser.hpp
- lib/cpp/antlr/LexerSharedInputState.hpp
- lib/cpp/antlr/MismatchedCharException.hpp
- lib/cpp/antlr/MismatchedTokenException.hpp
- lib/cpp/antlr/NoViableAltException.hpp
- lib/cpp/antlr/NoViableAltForCharException.hpp
- lib/cpp/antlr/Parser.hpp
- lib/cpp/antlr/ParserSharedInputState.hpp
- lib/cpp/antlr/RecognitionException.hpp
- lib/cpp/antlr/RefCount.hpp
- lib/cpp/antlr/SemanticException.hpp
- lib/cpp/antlr/String.hpp
- lib/cpp/antlr/Token.hpp
- lib/cpp/antlr/TokenBuffer.hpp
- lib/cpp/antlr/TokenRefCount.hpp
- lib/cpp/antlr/TokenStream.hpp
- lib/cpp/antlr/TokenStreamBasicFilter.hpp
- lib/cpp/antlr/TokenStreamException.hpp
- lib/cpp/antlr/TokenStreamHiddenTokenFilter.hpp
- lib/cpp/antlr/TokenStreamIOException.hpp
- lib/cpp/antlr/TokenStreamRecognitionException.hpp
- lib/cpp/antlr/TokenStreamRetryException.hpp
- lib/cpp/antlr/TokenStreamRewriteEngine.hpp
- lib/cpp/antlr/TokenStreamSelector.hpp
- lib/cpp/antlr/TokenWithIndex.hpp
- lib/cpp/antlr/TreeParser.hpp
- lib/cpp/antlr/TreeParserSharedInputState.hpp
- lib/cpp/antlr/config.hpp
- )
-
-include_directories(lib/cpp)
-
-add_library(antlr ${ANTLR_SRC} ${ANTLR_HDR})
-
-install(TARGETS antlr
- RUNTIME DESTINATION bin
- ARCHIVE DESTINATION lib
- LIBRARY DESTINATION lib )
-install(FILES ${ANTLR_HDR} DESTINATION include/antlr)
diff --git a/contrib/pdxautoserializer/dependencies/antlr/patches b/contrib/pdxautoserializer/dependencies/antlr/patches
deleted file mode 100644
index ee7a8fa..0000000
--- a/contrib/pdxautoserializer/dependencies/antlr/patches
+++ /dev/null
@@ -1,14 +0,0 @@
-diff -ru a/lib/cpp/antlr/CharScanner.hpp b/lib/cpp/antlr/CharScanner.hpp
---- a/lib/cpp/antlr/CharScanner.hpp 2006-11-01 13:37:17.000000000 -0800
-+++ b/lib/cpp/antlr/CharScanner.hpp 2015-12-22 16:09:21.979422041 -0800
-@@ -22,6 +22,9 @@
- // VC6 seems to need this
- // note that this is not a standard C++ include file.
- # include <stdio.h>
-+#else
-+#include <cstring>
-+#include <cstdio>
- #endif
-
- #include <antlr/TokenStream.hpp>
-
diff --git a/contrib/pdxautoserializer/src/ASBuiltins.hpp b/contrib/pdxautoserializer/src/ASBuiltins.hpp
deleted file mode 100644
index 3fa34de..0000000
--- a/contrib/pdxautoserializer/src/ASBuiltins.hpp
+++ /dev/null
@@ -1,125 +0,0 @@
-#pragma once
-
-#ifndef GEODE_PDXAUTOSERIALIZER_ASBUILTINS_H_
-#define GEODE_PDXAUTOSERIALIZER_ASBUILTINS_H_
-
-/*
- * 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 "DataOutput.hpp"
-#include "DataInput.hpp"
-#include "Serializer.hpp"
-#include <string>
-#include <vector>
-#include <map>
-
-namespace apache {
-namespace geode {
-namespace client {
-namespace serializer {
-/** write an <code>std::string</code> object to <code>DataOutput</code> */
-inline void writeObject(apache::geode::client::DataOutput& output,
- const std::string& value) {
- output.writeASCIIHuge(value.data(), value.length());
-}
-
-/** read an <code>std::string</code> object from <code>DataInput</code> */
-inline void readObject(apache::geode::client::DataInput& input,
- std::string& value) {
- char* str;
- uint32_t len;
- input.readASCIIHuge(&str, &len);
- value.assign(str, len);
- input.freeUTFMemory(str);
-}
-
-/** write an <code>std::wstring</code> object to <code>DataOutput</code> */
-inline void writeObject(apache::geode::client::DataOutput& output,
- const std::wstring& value) {
- output.writeUTFHuge(value.data(), value.length());
-}
-
-/** read an <code>std::wstring</code> object from <code>DataInput</code> */
-inline void readObject(apache::geode::client::DataInput& input,
- std::wstring& value) {
- wchar_t* str;
- uint32_t len;
- input.readUTFHuge(&str, &len);
- value.assign(str, len);
- input.freeUTFMemory(str);
-}
-
-/** write an <code>std::vector</code> object to <code>DataOutput</code> */
-template <typename TObj>
-inline void writeObject(apache::geode::client::DataOutput& output,
- const std::vector<TObj>& value) {
- output.writeInt(value.size());
- for (std::vector<TObj>::const_iterator valIterator = value.begin();
- valIterator != value.end(); ++valIterator) {
- writeObject(output, *valIterator);
- }
-}
-
-/** read an <code>std::vector</code> object from <code>DataInput</code> */
-template <typename TObj>
-inline void readObject(apache::geode::client::DataInput& input,
- std::vector<TObj>& value) {
- std::vector<TObj>::size_type len;
- input.readInt(&len);
- if (len > 0) {
- TObj obj;
- for (std::vector<TObj>::size_type index = 0; index < len; ++index) {
- readObject(input, obj);
- value.push_back(obj);
- }
- }
-}
-
-/** write an <code>std::map</code> object to <code>DataOutput</code> */
-template <typename TKey, typename TVal>
-inline void writeObject(apache::geode::client::DataOutput& output,
- const std::map<TKey, TVal>& value) {
- output.writeInt(value.size());
- for (std::map<TKey, TVal>::const_iterator valIterator = value.begin();
- valIterator != value.end(); ++valIterator) {
- writeObject(output, valIterator->first);
- writeObject(output, valIterator->second);
- }
-}
-
-/** read an <code>std::map</code> object from <code>DataInput</code> */
-template <typename TKey, typename TVal>
-inline void readObject(apache::geode::client::DataInput& input,
- std::map<TKey, TVal>& value) {
- std::map<TKey, TVal>::size_type len;
- input.readInt(&len);
- if (len > 0) {
- TKey key;
- TVal val;
- for (std::vector<TObj>::size_type index = 0; index < len; ++index) {
- readObject(input, key);
- readObject(input, val);
- value[key] = val;
- }
- }
-}
-}
-}
-}
-}
-
-#endif // GEODE_PDXAUTOSERIALIZER_ASBUILTINS_H_
diff --git a/contrib/pdxautoserializer/src/CodeGenerator.hpp b/contrib/pdxautoserializer/src/CodeGenerator.hpp
deleted file mode 100644
index 6acc499..0000000
--- a/contrib/pdxautoserializer/src/CodeGenerator.hpp
+++ /dev/null
@@ -1,177 +0,0 @@
-#pragma once
-
-#ifndef GEODE_PDXAUTOSERIALIZER_CODEGENERATOR_H_
-#define GEODE_PDXAUTOSERIALIZER_CODEGENERATOR_H_
-
-/*
- * 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 "base_types.hpp"
-
-namespace apache {
-namespace geode {
-namespace client {
-namespace pdx_auto_serializer {
-/**
- * Abstract class that defines the interface of the auto-serializer
- * code generator backends.
- */
-class CodeGenerator {
- public:
- /**
- * Enumerates the various methods that can be generated.
- */
- class Method {
- public:
- enum Type {
- /** Indicates the toData() method. */
- TODATA,
-
- /** Indicates the fromData() method. */
- FROMDATA,
-
- ///** Indicates the objectSize() method. */
- // OBJECTSIZE,
-
- ///** Indicates the equals/==() method. */
- // EQUALS,
-
- ///** Indicates the hashCode() method. */
- // HASHCODE,
-
- /**
- * Indicates generation of the complete class including all
- * of its fields and getters/setters for those.
- */
- CLASS
-
- };
- };
-
- // Pure virtual methods defining the interface.
-
- /**
- * Get a list of options and usage for the code generator.
- *
- * @param options Output parameter for options along-with their usage.
- */
- virtual void getOptions(OptionMap& options) const = 0;
-
- /**
- * Initialize the code generator with the given properties.
- *
- * @param properties The set of property/value pairs provided by the
- * user. Implementations should modify this map so
- * as to remove the properties used by the
- * implementation. This should also match the usage
- * as provided by <code>getOptions</code> method.
- */
- virtual void init(PropertyMap& properties) = 0;
-
- /**
- * Initialize the code generator for the given class.
- *
- * @param classInfo <code>TypeInfo</code> of the class for which
- * <code>toData</code> and <code>fromData</code>
- * methods are to be generated.
- */
- virtual void initClass(const TypeInfo& classInfo) = 0;
-
- /**
- * Add any references to the generated code (e.g headers).
- *
- * @param references A vector of reference names.
- */
- virtual void addReferences(const ReferenceVector& references) = 0;
-
- virtual void addFileHeader(int, char**) = 0;
-
- /**
- * Generate code to mark the start of the class in the given namespaces.
- *
- * @param members Vector containing information of the members of the
- * class that need to be auto-serialized.
- */
- virtual void startClass(const VariableVector& members) = 0;
-
- /**
- * Start of code generation for a method.
- *
- * @param type Type of the method to be generated.
- * @param varName Name of the variable (if any) used by the method
- * e.g. <code>DataOutput</code> variable for toData().
- */
- virtual void startMethod(const Method::Type type, const std::string& varName,
- const std::string& methodPrefix) = 0;
-
- // Ticket #905 Changes starts here
- virtual void addTryBlockStart(const Method::Type type) = 0;
- virtual void finishTryBlock(const Method::Type type) = 0;
- // Ticket #905 Changes ends here
- /**
- * Generate the method fragment for a given member of the class.
- *
- * @param type Type of the method to be generated.
- * @param varName Name of the variable (if any) used by the method
- * e.g. <code>DataOutput</code> variable for toData().
- * @param var Information of the member variable of the class.
- */
- virtual void genMethod(const Method::Type type, const std::string& varName,
- const VariableInfo& var) = 0;
-
- /**
- * End of code generation for a method.
- *
- * @param type Type of the method to be generated.
- * @param varName Name of the variable (if any) used by the method
- * e.g. <code>DataOutput</code> variable for toData().
- */
- virtual void endMethod(const Method::Type type,
- const std::string& outputVarName) = 0;
-
- /**
- * Generate the code for typeId function of geode
- * Serializable/DataSerializable interface.
- */
- virtual void genTypeId(const std::string& methodPrefix) = 0;
-
- virtual void genClassNameMethod(std::map<std::string, std::string>&,
- const std::string& methodPrefix) = 0;
-
- virtual void genCreateDeserializable(const std::string& methodPrefix) = 0;
-
- /**
- * Generate code to mark the end of the class in the given namespaces.
- */
- virtual void endClass() = 0;
-
- /**
- * Any cleanup that may be required in case of abnormal termination.
- */
- virtual void cleanup() = 0;
-
- /** virtual destructor. */
- virtual ~CodeGenerator() {}
-
- // End pure virtual methods
-};
-} // namespace pdx_auto_serializer
-} // namespace client
-} // namespace geode
-} // namespace apache
-
-#endif // GEODE_PDXAUTOSERIALIZER_CODEGENERATOR_H_
diff --git a/contrib/pdxautoserializer/src/CodeGeneratorFactory.cpp b/contrib/pdxautoserializer/src/CodeGeneratorFactory.cpp
deleted file mode 100644
index 36d32bc..0000000
--- a/contrib/pdxautoserializer/src/CodeGeneratorFactory.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "base_types.hpp"
-#include "CodeGeneratorFactory.hpp"
-#include "impl/CPPCodeGenerator.hpp"
-//#include "impl/CPPCLICodeGenerator.hpp"
-//#include "impl/CSharpCodeGenerator.hpp"
-
-namespace apache {
-namespace geode {
-namespace client {
-namespace pdx_auto_serializer {
-CodeGeneratorFactory::CodeGeneratorFactory() {
- // Register the available code generators here.
- m_generatorMap["C++"] = CPPCodeGenerator::create;
- // m_generatorMap["C++/CLI"] = CPPCLICodeGenerator::create;
- // m_generatorMap["C#"] = CSharpCodeGenerator::create;
-}
-
-CodeGenerator* CodeGeneratorFactory::getInstance(
- const std::string& generatorName) const {
- std::map<std::string, ASCodeGeneratorFn>::const_iterator mapIterator =
- m_generatorMap.find(generatorName);
- if (mapIterator != m_generatorMap.end()) {
- return mapIterator->second();
- }
- return NULL;
-}
-
-StringVector CodeGeneratorFactory::getGenerators() const {
- StringVector generatorList;
-
- for (std::map<std::string, ASCodeGeneratorFn>::const_iterator
- generatorIterator = m_generatorMap.begin();
- generatorIterator != m_generatorMap.end(); ++generatorIterator) {
- generatorList.push_back(generatorIterator->first);
- }
- return generatorList;
-}
-
-CodeGeneratorFactory::~CodeGeneratorFactory() { m_generatorMap.clear(); }
-} // namespace pdx_auto_serializer
-} // namespace client
-} // namespace geode
-} // namespace apache
diff --git a/contrib/pdxautoserializer/src/CodeGeneratorFactory.hpp b/contrib/pdxautoserializer/src/CodeGeneratorFactory.hpp
deleted file mode 100644
index f4fc35c..0000000
--- a/contrib/pdxautoserializer/src/CodeGeneratorFactory.hpp
+++ /dev/null
@@ -1,74 +0,0 @@
-#pragma once
-
-#ifndef GEODE_PDXAUTOSERIALIZER_CODEGENERATORFACTORY_H_
-#define GEODE_PDXAUTOSERIALIZER_CODEGENERATORFACTORY_H_
-
-/*
- * 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 "CodeGenerator.hpp"
-
-namespace apache {
-namespace geode {
-namespace client {
-namespace pdx_auto_serializer {
-/**
- * Defines a function with no arguments returning a pointer to
- * <code>CodeGenerator</code> object.
- */
-typedef CodeGenerator* (*ASCodeGeneratorFn)(void);
-
-/**
- * Factory class to obtain instances of <code>CodeGenerator</code>
- * implementations.
- */
-class CodeGeneratorFactory {
- public:
- /**
- * Default constructor that registers all the available
- * <code>CodeGenerator</code> implementations.
- */
- CodeGeneratorFactory();
-
- /**
- * Get an instance of an <code>CodeGenerator</code> using the name
- * of the code generator.
- *
- * @param generatorName The name of the code generator backend.
- * @return An instance of <code>CodeGenerator</code>.
- */
- CodeGenerator* getInstance(const std::string& generatorName) const;
-
- /** Get a list of all registered code generator backends. */
- StringVector getGenerators() const;
-
- /** Virtual destructor. */
- virtual ~CodeGeneratorFactory();
-
- private:
- /**
- * The map containing the mappings from the names of code generators
- * to their factory functions.
- */
- std::map<std::string, ASCodeGeneratorFn> m_generatorMap;
-};
-} // namespace pdx_auto_serializer
-} // namespace client
-} // namespace geode
-} // namespace apache
-
-#endif // GEODE_PDXAUTOSERIALIZER_CODEGENERATORFACTORY_H_
diff --git a/contrib/pdxautoserializer/src/Doxyfile b/contrib/pdxautoserializer/src/Doxyfile
deleted file mode 100755
index d686d6c..0000000
--- a/contrib/pdxautoserializer/src/Doxyfile
+++ /dev/null
@@ -1,1268 +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.
-
-# Doxyfile 1.5.0
-
-# This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project
-#
-# All text after a hash (#) is considered a comment and will be ignored
-# The format is:
-# TAG = value [value, ...]
-# For lists items can also be appended using:
-# TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (" ")
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-
-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
-# by quotes) that should identify the project.
-
-PROJECT_NAME = gfautoserialize
-
-# The PROJECT_NUMBER tag can be used to enter a project or revision number.
-# This could be handy for archiving the generated documentation or
-# if some version control system is used.
-
-PROJECT_NUMBER =
-
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
-# base path where the generated documentation will be put.
-# If a relative path is entered, it will be relative to the location
-# where doxygen was started. If left blank the current directory will be used.
-
-OUTPUT_DIRECTORY = doc
-
-# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
-# 4096 sub-directories (in 2 levels) under the output directory of each output
-# format and will distribute the generated files over these directories.
-# Enabling this option can be useful when feeding doxygen a huge amount of
-# source files, where putting all generated files in the same directory would
-# otherwise cause performance problems for the file system.
-
-CREATE_SUBDIRS = NO
-
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all
-# documentation generated by doxygen is written. Doxygen will use this
-# information to generate all constant output in the proper language.
-# The default language is English, other supported languages are:
-# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
-# Croatian, Czech, Danish, Dutch, Finnish, French, German, Greek, Hungarian,
-# Italian, Japanese, Japanese-en (Japanese with English messages), Korean,
-# Korean-en, Lithuanian, Norwegian, Polish, Portuguese, Romanian, Russian,
-# Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian.
-
-OUTPUT_LANGUAGE = English
-
-# This tag can be used to specify the encoding used in the generated output.
-# The encoding is not always determined by the language that is chosen,
-# but also whether or not the output is meant for Windows or non-Windows users.
-# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES
-# forces the Windows encoding (this is the default for the Windows binary),
-# whereas setting the tag to NO uses a Unix-style encoding (the default for
-# all platforms other than Windows).
-
-USE_WINDOWS_ENCODING = NO
-
-# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
-# include brief member descriptions after the members that are listed in
-# the file and class documentation (similar to JavaDoc).
-# Set to NO to disable this.
-
-BRIEF_MEMBER_DESC = YES
-
-# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
-# the brief description of a member or function before the detailed description.
-# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
-# brief descriptions will be completely suppressed.
-
-REPEAT_BRIEF = YES
-
-# This tag implements a quasi-intelligent brief description abbreviator
-# that is used to form the text in various listings. Each string
-# in this list, if found as the leading text of the brief description, will be
-# stripped from the text and the result after processing the whole list, is
-# used as the annotated text. Otherwise, the brief description is used as-is.
-# If left blank, the following values are used ("$name" is automatically
-# replaced with the name of the entity): "The $name class" "The $name widget"
-# "The $name file" "is" "provides" "specifies" "contains"
-# "represents" "a" "an" "the"
-
-ABBREVIATE_BRIEF =
-
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
-# Doxygen will generate a detailed section even if there is only a brief
-# description.
-
-ALWAYS_DETAILED_SEC = NO
-
-# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
-# inherited members of a class in the documentation of that class as if those
-# members were ordinary class members. Constructors, destructors and assignment
-# operators of the base classes will not be shown.
-
-INLINE_INHERITED_MEMB = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
-# path before files name in the file list and in the header files. If set
-# to NO the shortest path that makes the file name unique will be used.
-
-FULL_PATH_NAMES = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
-# can be used to strip a user-defined part of the path. Stripping is
-# only done if one of the specified strings matches the left-hand part of
-# the path. The tag can be used to show relative paths in the file list.
-# If left blank the directory from which doxygen is run is used as the
-# path to strip.
-
-STRIP_FROM_PATH =
-
-# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
-# the path mentioned in the documentation of a class, which tells
-# the reader which header file to include in order to use a class.
-# If left blank only the name of the header file containing the class
-# definition is used. Otherwise one should specify the include paths that
-# are normally passed to the compiler using the -I flag.
-
-STRIP_FROM_INC_PATH =
-
-# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
-# (but less readable) file names. This can be useful is your file systems
-# doesn't support long names like on DOS, Mac, or CD-ROM.
-
-SHORT_NAMES = NO
-
-# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
-# will interpret the first line (until the first dot) of a JavaDoc-style
-# comment as the brief description. If set to NO, the JavaDoc
-# comments will behave just like the Qt-style comments (thus requiring an
-# explicit @brief command for a brief description.
-
-JAVADOC_AUTOBRIEF = YES
-
-# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
-# treat a multi-line C++ special comment block (i.e. a block of //! or ///
-# comments) as a brief description. This used to be the default behaviour.
-# The new default is to treat a multi-line C++ comment block as a detailed
-# description. Set this tag to YES if you prefer the old behaviour instead.
-
-MULTILINE_CPP_IS_BRIEF = NO
-
-# If the DETAILS_AT_TOP tag is set to YES then Doxygen
-# will output the detailed description near the top, like JavaDoc.
-# If set to NO, the detailed description appears after the member
-# documentation.
-
-DETAILS_AT_TOP = NO
-
-# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
-# member inherits the documentation from any documented member that it
-# re-implements.
-
-INHERIT_DOCS = YES
-
-# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
-# a new page for each member. If set to NO, the documentation of a member will
-# be part of the file/class/namespace that contains it.
-
-SEPARATE_MEMBER_PAGES = NO
-
-# The TAB_SIZE tag can be used to set the number of spaces in a tab.
-# Doxygen uses this value to replace tabs by spaces in code fragments.
-
-TAB_SIZE = 2
-
-# This tag can be used to specify a number of aliases that acts
-# as commands in the documentation. An alias has the form "name=value".
-# For example adding "sideeffect=\par Side Effects:\n" will allow you to
-# put the command \sideeffect (or @sideeffect) in the documentation, which
-# will result in a user-defined paragraph with heading "Side Effects:".
-# You can put \n's in the value part of an alias to insert newlines.
-
-ALIASES =
-
-# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
-# sources only. Doxygen will then generate output that is more tailored for C.
-# For instance, some of the names that are used will be different. The list
-# of all members will be omitted, etc.
-
-OPTIMIZE_OUTPUT_FOR_C = NO
-
-# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
-# sources only. Doxygen will then generate output that is more tailored for Java.
-# For instance, namespaces will be presented as packages, qualified scopes
-# will look different, etc.
-
-OPTIMIZE_OUTPUT_JAVA = NO
-
-# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to
-# include (a tag file for) the STL sources as input, then you should
-# set this tag to YES in order to let doxygen match functions declarations and
-# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
-# func(std::string) {}). This also make the inheritance and collaboration
-# diagrams that involve STL classes more complete and accurate.
-
-BUILTIN_STL_SUPPORT = YES
-
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
-# tag is set to YES, then doxygen will reuse the documentation of the first
-# member in the group (if any) for the other members of the group. By default
-# all members of a group must be documented explicitly.
-
-DISTRIBUTE_GROUP_DOC = NO
-
-# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
-# the same type (for instance a group of public functions) to be put as a
-# subgroup of that type (e.g. under the Public Functions section). Set it to
-# NO to prevent subgrouping. Alternatively, this can be done per class using
-# the \nosubgrouping command.
-
-SUBGROUPING = YES
-
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-
-# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
-# documentation are documented, even if no documentation was available.
-# Private class members and static file members will be hidden unless
-# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
-
-EXTRACT_ALL = NO
-
-# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
-# will be included in the documentation.
-
-EXTRACT_PRIVATE = YES
-
-# If the EXTRACT_STATIC tag is set to YES all static members of a file
-# will be included in the documentation.
-
-EXTRACT_STATIC = YES
-
-# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
-# defined locally in source files will be included in the documentation.
-# If set to NO only classes defined in header files are included.
-
-EXTRACT_LOCAL_CLASSES = YES
-
-# This flag is only useful for Objective-C code. When set to YES local
-# methods, which are defined in the implementation section but not in
-# the interface are included in the documentation.
-# If set to NO (the default) only methods in the interface are included.
-
-EXTRACT_LOCAL_METHODS = NO
-
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
-# undocumented members of documented classes, files or namespaces.
-# If set to NO (the default) these members will be included in the
-# various overviews, but no documentation section is generated.
-# This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_MEMBERS = NO
-
-# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
-# undocumented classes that are normally visible in the class hierarchy.
-# If set to NO (the default) these classes will be included in the various
-# overviews. This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_CLASSES = NO
-
-# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
-# friend (class|struct|union) declarations.
-# If set to NO (the default) these declarations will be included in the
-# documentation.
-
-HIDE_FRIEND_COMPOUNDS = NO
-
-# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
-# documentation blocks found inside the body of a function.
-# If set to NO (the default) these blocks will be appended to the
-# function's detailed documentation block.
-
-HIDE_IN_BODY_DOCS = NO
-
-# The INTERNAL_DOCS tag determines if documentation
-# that is typed after a \internal command is included. If the tag is set
-# to NO (the default) then the documentation will be excluded.
-# Set it to YES to include the internal documentation.
-
-INTERNAL_DOCS = YES
-
-# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
-# file names in lower-case letters. If set to YES upper-case letters are also
-# allowed. This is useful if you have classes or files whose names only differ
-# in case and if your file system supports case sensitive file names. Windows
-# and Mac users are advised to set this option to NO.
-
-CASE_SENSE_NAMES = YES
-
-# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
-# will show members with their full class and namespace scopes in the
-# documentation. If set to YES the scope will be hidden.
-
-HIDE_SCOPE_NAMES = NO
-
-# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
-# will put a list of the files that are included by a file in the documentation
-# of that file.
-
-SHOW_INCLUDE_FILES = YES
-
-# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
-# is inserted in the documentation for inline members.
-
-INLINE_INFO = YES
-
-# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
-# will sort the (detailed) documentation of file and class members
-# alphabetically by member name. If set to NO the members will appear in
-# declaration order.
-
-SORT_MEMBER_DOCS = YES
-
-# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
-# brief documentation of file, namespace and class members alphabetically
-# by member name. If set to NO (the default) the members will appear in
-# declaration order.
-
-SORT_BRIEF_DOCS = NO
-
-# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
-# sorted by fully-qualified names, including namespaces. If set to
-# NO (the default), the class list will be sorted only by class name,
-# not including the namespace part.
-# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
-# Note: This option applies only to the class list, not to the
-# alphabetical list.
-
-SORT_BY_SCOPE_NAME = NO
-
-# The GENERATE_TODOLIST tag can be used to enable (YES) or
-# disable (NO) the todo list. This list is created by putting \todo
-# commands in the documentation.
-
-GENERATE_TODOLIST = YES
-
-# The GENERATE_TESTLIST tag can be used to enable (YES) or
-# disable (NO) the test list. This list is created by putting \test
-# commands in the documentation.
-
-GENERATE_TESTLIST = YES
-
-# The GENERATE_BUGLIST tag can be used to enable (YES) or
-# disable (NO) the bug list. This list is created by putting \bug
-# commands in the documentation.
-
-GENERATE_BUGLIST = YES
-
-# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
-# disable (NO) the deprecated list. This list is created by putting
-# \deprecated commands in the documentation.
-
-GENERATE_DEPRECATEDLIST = YES
-
-# The ENABLED_SECTIONS tag can be used to enable conditional
-# documentation sections, marked by \if sectionname ... \endif.
-
-ENABLED_SECTIONS =
-
-# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
-# the initial value of a variable or define consists of for it to appear in
-# the documentation. If the initializer consists of more lines than specified
-# here it will be hidden. Use a value of 0 to hide initializers completely.
-# The appearance of the initializer of individual variables and defines in the
-# documentation can be controlled using \showinitializer or \hideinitializer
-# command in the documentation regardless of this setting.
-
-MAX_INITIALIZER_LINES = 30
-
-# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
-# at the bottom of the documentation of classes and structs. If set to YES the
-# list will mention the files that were used to generate the documentation.
-
-SHOW_USED_FILES = YES
-
-# If the sources in your project are distributed over multiple directories
-# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
-# in the documentation. The default is NO.
-
-SHOW_DIRECTORIES = NO
-
-# The FILE_VERSION_FILTER tag can be used to specify a program or script that
-# doxygen should invoke to get the current version for each file (typically from the
-# version control system). Doxygen will invoke the program by executing (via
-# popen()) the command <command> <input-file>, where <command> is the value of
-# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
-# provided by doxygen. Whatever the program writes to standard output
-# is used as the file version. See the manual for examples.
-
-FILE_VERSION_FILTER =
-
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-
-# The QUIET tag can be used to turn on/off the messages that are generated
-# by doxygen. Possible values are YES and NO. If left blank NO is used.
-
-QUIET = NO
-
-# The WARNINGS tag can be used to turn on/off the warning messages that are
-# generated by doxygen. Possible values are YES and NO. If left blank
-# NO is used.
-
-WARNINGS = YES
-
-# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
-# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
-# automatically be disabled.
-
-WARN_IF_UNDOCUMENTED = YES
-
-# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
-# potential errors in the documentation, such as not documenting some
-# parameters in a documented function, or documenting parameters that
-# don't exist or using markup commands wrongly.
-
-WARN_IF_DOC_ERROR = YES
-
-# This WARN_NO_PARAMDOC option can be abled to get warnings for
-# functions that are documented, but have no documentation for their parameters
-# or return value. If set to NO (the default) doxygen will only warn about
-# wrong or incomplete parameter documentation, but not about the absence of
-# documentation.
-
-WARN_NO_PARAMDOC = YES
-
-# The WARN_FORMAT tag determines the format of the warning messages that
-# doxygen can produce. The string should contain the $file, $line, and $text
-# tags, which will be replaced by the file and line number from which the
-# warning originated and the warning text. Optionally the format may contain
-# $version, which will be replaced by the version of the file (if it could
-# be obtained via FILE_VERSION_FILTER)
-
-WARN_FORMAT = "$file:$line: $text"
-
-# The WARN_LOGFILE tag can be used to specify a file to which warning
-# and error messages should be written. If left blank the output is written
-# to stderr.
-
-WARN_LOGFILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-
-# The INPUT tag can be used to specify the files and/or directories that contain
-# documented source files. You may enter file names like "myfile.cpp" or
-# directories like "/usr/src/myproject". Separate the files or directories
-# with spaces.
-
-INPUT =
-
-# If the value of the INPUT tag contains directories, you can use the
-# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank the following patterns are tested:
-# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
-# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py
-
-FILE_PATTERNS =
-
-# The RECURSIVE tag can be used to turn specify whether or not subdirectories
-# should be searched for input files as well. Possible values are YES and NO.
-# If left blank NO is used.
-
-RECURSIVE = YES
-
-# The EXCLUDE tag can be used to specify files and/or directories that should
-# excluded from the INPUT source files. This way you can easily exclude a
-# subdirectory from a directory tree whose root is specified with the INPUT tag.
-
-EXCLUDE =
-
-# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
-# directories that are symbolic links (a Unix filesystem feature) are excluded
-# from the input.
-
-EXCLUDE_SYMLINKS = NO
-
-# If the value of the INPUT tag contains directories, you can use the
-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
-# certain files from those directories. Note that the wildcards are matched
-# against the file with absolute path, so to exclude all test directories
-# for example use the pattern */test/*
-
-EXCLUDE_PATTERNS =
-
-# The EXAMPLE_PATH tag can be used to specify one or more files or
-# directories that contain example code fragments that are included (see
-# the \include command).
-
-EXAMPLE_PATH =
-
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank all files are included.
-
-EXAMPLE_PATTERNS =
-
-# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
-# searched for input files to be used with the \include or \dontinclude
-# commands irrespective of the value of the RECURSIVE tag.
-# Possible values are YES and NO. If left blank NO is used.
-
-EXAMPLE_RECURSIVE = NO
-
-# The IMAGE_PATH tag can be used to specify one or more files or
-# directories that contain image that are included in the documentation (see
-# the \image command).
-
-IMAGE_PATH =
-
-# The INPUT_FILTER tag can be used to specify a program that doxygen should
-# invoke to filter for each input file. Doxygen will invoke the filter program
-# by executing (via popen()) the command <filter> <input-file>, where <filter>
-# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
-# input file. Doxygen will then use the output that the filter program writes
-# to standard output. If FILTER_PATTERNS is specified, this tag will be
-# ignored.
-
-INPUT_FILTER =
-
-# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
-# basis. Doxygen will compare the file name with each pattern and apply the
-# filter if there is a match. The filters are a list of the form:
-# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
-# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
-# is applied to all files.
-
-FILTER_PATTERNS =
-
-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
-# INPUT_FILTER) will be used to filter the input files when producing source
-# files to browse (i.e. when SOURCE_BROWSER is set to YES).
-
-FILTER_SOURCE_FILES = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-
-# If the SOURCE_BROWSER tag is set to YES then a list of source files will
-# be generated. Documented entities will be cross-referenced with these sources.
-# Note: To get rid of all source code in the generated output, make sure also
-# VERBATIM_HEADERS is set to NO.
-
-SOURCE_BROWSER = NO
-
-# Setting the INLINE_SOURCES tag to YES will include the body
-# of functions and classes directly in the documentation.
-
-INLINE_SOURCES = NO
-
-# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
-# doxygen to hide any special comment blocks from generated source code
-# fragments. Normal C and C++ comments will always remain visible.
-
-STRIP_CODE_COMMENTS = YES
-
-# If the REFERENCED_BY_RELATION tag is set to YES (the default)
-# then for each documented function all documented
-# functions referencing it will be listed.
-
-REFERENCED_BY_RELATION = YES
-
-# If the REFERENCES_RELATION tag is set to YES (the default)
-# then for each documented function all documented entities
-# called/used by that function will be listed.
-
-REFERENCES_RELATION = YES
-
-# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
-# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
-# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
-# link to the source code. Otherwise they will link to the documentstion.
-
-REFERENCES_LINK_SOURCE = YES
-
-# If the USE_HTAGS tag is set to YES then the references to source code
-# will point to the HTML generated by the htags(1) tool instead of doxygen
-# built-in source browser. The htags tool is part of GNU's global source
-# tagging system (see http://www.gnu.org/software/global/global.html). You
-# will need version 4.8.6 or higher.
-
-USE_HTAGS = NO
-
-# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
-# will generate a verbatim copy of the header file for each class for
-# which an include is specified. Set to NO to disable this.
-
-VERBATIM_HEADERS = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-
-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
-# of all compounds will be generated. Enable this if the project
-# contains a lot of classes, structs, unions or interfaces.
-
-ALPHABETICAL_INDEX = NO
-
-# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
-# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
-# in which this list will be split (can be a number in the range [1..20])
-
-COLS_IN_ALPHA_INDEX = 5
-
-# In case all classes in a project start with a common prefix, all
-# classes will be put under the same header in the alphabetical index.
-# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
-# should be ignored while generating the index headers.
-
-IGNORE_PREFIX =
-
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
-# generate HTML output.
-
-GENERATE_HTML = YES
-
-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `html' will be used as the default path.
-
-HTML_OUTPUT = .
-
-# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
-# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
-# doxygen will generate files with .html extension.
-
-HTML_FILE_EXTENSION = .html
-
-# The HTML_HEADER tag can be used to specify a personal HTML header for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard header.
-
-HTML_HEADER =
-
-# The HTML_FOOTER tag can be used to specify a personal HTML footer for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard footer.
-
-HTML_FOOTER =
-
-# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
-# style sheet that is used by each HTML page. It can be used to
-# fine-tune the look of the HTML output. If the tag is left blank doxygen
-# will generate a default style sheet. Note that doxygen will try to copy
-# the style sheet file to the HTML output directory, so don't put your own
-# stylesheet in the HTML output directory as well, or it will be erased!
-
-HTML_STYLESHEET =
-
-# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
-# files or namespaces will be aligned in HTML using tables. If set to
-# NO a bullet list will be used.
-
-HTML_ALIGN_MEMBERS = YES
-
-# If the GENERATE_HTMLHELP tag is set to YES, additional index files
-# will be generated that can be used as input for tools like the
-# Microsoft HTML help workshop to generate a compressed HTML help file (.chm)
-# of the generated HTML documentation.
-
-GENERATE_HTMLHELP = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
-# be used to specify the file name of the resulting .chm file. You
-# can add a path in front of the file if the result should not be
-# written to the html output directory.
-
-CHM_FILE =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
-# be used to specify the location (absolute path including file name) of
-# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
-# the HTML help compiler on the generated index.hhp.
-
-HHC_LOCATION =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
-# controls if a separate .chi index file is generated (YES) or that
-# it should be included in the master .chm file (NO).
-
-GENERATE_CHI = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
-# controls whether a binary table of contents is generated (YES) or a
-# normal table of contents (NO) in the .chm file.
-
-BINARY_TOC = NO
-
-# The TOC_EXPAND flag can be set to YES to add extra items for group members
-# to the contents of the HTML help documentation and to the tree view.
-
-TOC_EXPAND = NO
-
-# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
-# top of each HTML page. The value NO (the default) enables the index and
-# the value YES disables it.
-
-DISABLE_INDEX = NO
-
-# This tag can be used to set the number of enum values (range [1..20])
-# that doxygen will group on one line in the generated HTML documentation.
-
-ENUM_VALUES_PER_LINE = 4
-
-# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
-# generated containing a tree-like index structure (just like the one that
-# is generated for HTML Help). For this to work a browser that supports
-# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+,
-# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are
-# probably better off using the HTML help feature.
-
-GENERATE_TREEVIEW = NO
-
-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
-# used to set the initial width (in pixels) of the frame in which the tree
-# is shown.
-
-TREEVIEW_WIDTH = 250
-
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
-# generate Latex output.
-
-GENERATE_LATEX = NO
-
-# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `latex' will be used as the default path.
-
-LATEX_OUTPUT = latex
-
-# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
-# invoked. If left blank `latex' will be used as the default command name.
-
-LATEX_CMD_NAME = latex
-
-# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
-# generate index for LaTeX. If left blank `makeindex' will be used as the
-# default command name.
-
-MAKEINDEX_CMD_NAME = makeindex
-
-# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
-# LaTeX documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_LATEX = NO
-
-# The PAPER_TYPE tag can be used to set the paper type that is used
-# by the printer. Possible values are: a4, a4wide, letter, legal and
-# executive. If left blank a4wide will be used.
-
-PAPER_TYPE = a4wide
-
-# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
-# packages that should be included in the LaTeX output.
-
-EXTRA_PACKAGES =
-
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
-# the generated latex document. The header should contain everything until
-# the first chapter. If it is left blank doxygen will generate a
-# standard header. Notice: only use this tag if you know what you are doing!
-
-LATEX_HEADER =
-
-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
-# is prepared for conversion to pdf (using ps2pdf). The pdf file will
-# contain links (just like the HTML output) instead of page references
-# This makes the output suitable for online browsing using a pdf viewer.
-
-PDF_HYPERLINKS = NO
-
-# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
-# plain latex in the generated Makefile. Set this option to YES to get a
-# higher quality PDF documentation.
-
-USE_PDFLATEX = NO
-
-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
-# command to the generated LaTeX files. This will instruct LaTeX to keep
-# running if errors occur, instead of asking the user for help.
-# This option is also used when generating formulas in HTML.
-
-LATEX_BATCHMODE = NO
-
-# If LATEX_HIDE_INDICES is set to YES then doxygen will not
-# include the index chapters (such as File Index, Compound Index, etc.)
-# in the output.
-
-LATEX_HIDE_INDICES = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
-# The RTF output is optimized for Word 97 and may not look very pretty with
-# other RTF readers or editors.
-
-GENERATE_RTF = NO
-
-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `rtf' will be used as the default path.
-
-RTF_OUTPUT = rtf
-
-# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
-# RTF documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_RTF = NO
-
-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
-# will contain hyperlink fields. The RTF file will
-# contain links (just like the HTML output) instead of page references.
-# This makes the output suitable for online browsing using WORD or other
-# programs which support those fields.
-# Note: wordpad (write) and others do not support links.
-
-RTF_HYPERLINKS = NO
-
-# Load stylesheet definitions from file. Syntax is similar to doxygen's
-# config file, i.e. a series of assignments. You only have to provide
-# replacements, missing definitions are set to their default value.
-
-RTF_STYLESHEET_FILE =
-
-# Set optional variables used in the generation of an rtf document.
-# Syntax is similar to doxygen's config file.
-
-RTF_EXTENSIONS_FILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
-# generate man pages
-
-GENERATE_MAN = NO
-
-# The MAN_OUTPUT tag is used to specify where the man pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `man' will be used as the default path.
-
-MAN_OUTPUT = man
-
-# The MAN_EXTENSION tag determines the extension that is added to
-# the generated man pages (default is the subroutine's section .3)
-
-MAN_EXTENSION = .3
-
-# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
-# then it will generate one additional man file for each entity
-# documented in the real man page(s). These additional files
-# only source the real man page, but without them the man command
-# would be unable to find the correct page. The default is NO.
-
-MAN_LINKS = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_XML tag is set to YES Doxygen will
-# generate an XML file that captures the structure of
-# the code including all documentation.
-
-GENERATE_XML = NO
-
-# The XML_OUTPUT tag is used to specify where the XML pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `xml' will be used as the default path.
-
-XML_OUTPUT = xml
-
-# The XML_SCHEMA tag can be used to specify an XML schema,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_SCHEMA =
-
-# The XML_DTD tag can be used to specify an XML DTD,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_DTD =
-
-# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
-# dump the program listings (including syntax highlighting
-# and cross-referencing information) to the XML output. Note that
-# enabling this will significantly increase the size of the XML output.
-
-XML_PROGRAMLISTING = YES
-
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
-# generate an AutoGen Definitions (see autogen.sf.net) file
-# that captures the structure of the code including all
-# documentation. Note that this feature is still experimental
-# and incomplete at the moment.
-
-GENERATE_AUTOGEN_DEF = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_PERLMOD tag is set to YES Doxygen will
-# generate a Perl module file that captures the structure of
-# the code including all documentation. Note that this
-# feature is still experimental and incomplete at the
-# moment.
-
-GENERATE_PERLMOD = NO
-
-# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
-# the necessary Makefile rules, Perl scripts and LaTeX code to be able
-# to generate PDF and DVI output from the Perl module output.
-
-PERLMOD_LATEX = NO
-
-# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
-# nicely formatted so it can be parsed by a human reader. This is useful
-# if you want to understand what is going on. On the other hand, if this
-# tag is set to NO the size of the Perl module output will be much smaller
-# and Perl will parse it just the same.
-
-PERLMOD_PRETTY = YES
-
-# The names of the make variables in the generated doxyrules.make file
-# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
-# This is useful so different doxyrules.make files included by the same
-# Makefile don't overwrite each other's variables.
-
-PERLMOD_MAKEVAR_PREFIX =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-
-# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
-# evaluate all C-preprocessor directives found in the sources and include
-# files.
-
-ENABLE_PREPROCESSING = YES
-
-# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
-# names in the source code. If set to NO (the default) only conditional
-# compilation will be performed. Macro expansion can be done in a controlled
-# way by setting EXPAND_ONLY_PREDEF to YES.
-
-MACRO_EXPANSION = NO
-
-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
-# then the macro expansion is limited to the macros specified with the
-# PREDEFINED and EXPAND_AS_DEFINED tags.
-
-EXPAND_ONLY_PREDEF = NO
-
-# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
-# in the INCLUDE_PATH (see below) will be search if a #include is found.
-
-SEARCH_INCLUDES = YES
-
-# The INCLUDE_PATH tag can be used to specify one or more directories that
-# contain include files that are not input files but should be processed by
-# the preprocessor.
-
-INCLUDE_PATH =
-
-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
-# patterns (like *.h and *.hpp) to filter out the header-files in the
-# directories. If left blank, the patterns specified with FILE_PATTERNS will
-# be used.
-
-INCLUDE_FILE_PATTERNS =
-
-# The PREDEFINED tag can be used to specify one or more macro names that
-# are defined before the preprocessor is started (similar to the -D option of
-# gcc). The argument of the tag is a list of macros of the form: name
-# or name=definition (no spaces). If the definition and the = are
-# omitted =1 is assumed. To prevent a macro definition from being
-# undefined via #undef or recursively expanded use the := operator
-# instead of the = operator.
-
-PREDEFINED =
-
-# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
-# this tag can be used to specify a list of macro names that should be expanded.
-# The macro definition that is found in the sources will be used.
-# Use the PREDEFINED tag if you want to use a different macro definition.
-
-EXPAND_AS_DEFINED =
-
-# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
-# doxygen's preprocessor will remove all function-like macros that are alone
-# on a line, have an all uppercase name, and do not end with a semicolon. Such
-# function macros are typically used for boiler-plate code, and will confuse
-# the parser if not removed.
-
-SKIP_FUNCTION_MACROS = YES
-
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references
-#---------------------------------------------------------------------------
-
-# The TAGFILES option can be used to specify one or more tagfiles.
-# Optionally an initial location of the external documentation
-# can be added for each tagfile. The format of a tag file without
-# this location is as follows:
-# TAGFILES = file1 file2 ...
-# Adding location for the tag files is done as follows:
-# TAGFILES = file1=loc1 "file2 = loc2" ...
-# where "loc1" and "loc2" can be relative or absolute paths or
-# URLs. If a location is present for each tag, the installdox tool
-# does not have to be run to correct the links.
-# Note that each tag file must have a unique name
-# (where the name does NOT include the path)
-# If a tag file is not located in the directory in which doxygen
-# is run, you must also specify the path to the tagfile here.
-
-TAGFILES =
-
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create
-# a tag file that is based on the input files it reads.
-
-GENERATE_TAGFILE =
-
-# If the ALLEXTERNALS tag is set to YES all external classes will be listed
-# in the class index. If set to NO only the inherited external classes
-# will be listed.
-
-ALLEXTERNALS = NO
-
-# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
-# in the modules index. If set to NO, only the current project's groups will
-# be listed.
-
-EXTERNAL_GROUPS = YES
-
-# The PERL_PATH should be the absolute path and name of the perl script
-# interpreter (i.e. the result of `which perl').
-
-PERL_PATH = /usr/bin/perl
-
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-
-# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
-# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
-# or super classes. Setting the tag to NO turns the diagrams off. Note that
-# this option is superseded by the HAVE_DOT option below. This is only a
-# fallback. It is recommended to install and use dot, since it yields more
-# powerful graphs.
-
-CLASS_DIAGRAMS = YES
-
-# If set to YES, the inheritance and collaboration graphs will hide
-# inheritance and usage relations if the target is undocumented
-# or is not a class.
-
-HIDE_UNDOC_RELATIONS = YES
-
-# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
-# available from the path. This tool is part of Graphviz, a graph visualization
-# toolkit from AT&T and Lucent Bell Labs. The other options in this section
-# have no effect if this option is set to NO (the default)
-
-HAVE_DOT = NO
-
-# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect inheritance relations. Setting this tag to YES will force the
-# the CLASS_DIAGRAMS tag to NO.
-
-CLASS_GRAPH = YES
-
-# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect implementation dependencies (inheritance, containment, and
-# class references variables) of the class with other documented classes.
-
-COLLABORATION_GRAPH = YES
-
-# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for groups, showing the direct groups dependencies
-
-GROUP_GRAPHS = YES
-
-# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
-# collaboration diagrams in a style similar to the OMG's Unified Modeling
-# Language.
-
-UML_LOOK = NO
-
-# If set to YES, the inheritance and collaboration graphs will show the
-# relations between templates and their instances.
-
-TEMPLATE_RELATIONS = NO
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
-# tags are set to YES then doxygen will generate a graph for each documented
-# file showing the direct and indirect include dependencies of the file with
-# other documented files.
-
-INCLUDE_GRAPH = YES
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
-# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
-# documented header file showing the documented files that directly or
-# indirectly include this file.
-
-INCLUDED_BY_GRAPH = YES
-
-# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will
-# generate a call dependency graph for every global function or class method.
-# Note that enabling this option will significantly increase the time of a run.
-# So in most cases it will be better to enable call graphs for selected
-# functions only using the \callgraph command.
-
-CALL_GRAPH = NO
-
-# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then doxygen will
-# generate a caller dependency graph for every global function or class method.
-# Note that enabling this option will significantly increase the time of a run.
-# So in most cases it will be better to enable caller graphs for selected
-# functions only using the \callergraph command.
-
-CALLER_GRAPH = NO
-
-# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
-# will graphical hierarchy of all classes instead of a textual one.
-
-GRAPHICAL_HIERARCHY = YES
-
-# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
-# then doxygen will show the dependencies a directory has on other directories
-# in a graphical way. The dependency relations are determined by the #include
-# relations between the files in the directories.
-
-DIRECTORY_GRAPH = YES
-
-# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
-# generated by dot. Possible values are png, jpg, or gif
-# If left blank png will be used.
-
-DOT_IMAGE_FORMAT = png
-
-# The tag DOT_PATH can be used to specify the path where the dot tool can be
-# found. If left blank, it is assumed the dot tool can be found in the path.
-
-DOT_PATH =
-
-# The DOTFILE_DIRS tag can be used to specify one or more directories that
-# contain dot files that are included in the documentation (see the
-# \dotfile command).
-
-DOTFILE_DIRS =
-
-# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width
-# (in pixels) of the graphs generated by dot. If a graph becomes larger than
-# this value, doxygen will try to truncate the graph, so that it fits within
-# the specified constraint. Beware that most browsers cannot cope with very
-# large images.
-
-MAX_DOT_GRAPH_WIDTH = 1024
-
-# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height
-# (in pixels) of the graphs generated by dot. If a graph becomes larger than
-# this value, doxygen will try to truncate the graph, so that it fits within
-# the specified constraint. Beware that most browsers cannot cope with very
-# large images.
-
-MAX_DOT_GRAPH_HEIGHT = 1024
-
-# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
-# graphs generated by dot. A depth value of 3 means that only nodes reachable
-# from the root by following a path via at most 3 edges will be shown. Nodes
-# that lay further from the root node will be omitted. Note that setting this
-# option to 1 or 2 may greatly reduce the computation time needed for large
-# code bases. Also note that a graph may be further truncated if the graph's
-# image dimensions are not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH
-# and MAX_DOT_GRAPH_HEIGHT). If 0 is used for the depth value (the default),
-# the graph is not depth-constrained.
-
-MAX_DOT_GRAPH_DEPTH = 0
-
-# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
-# background. This is disabled by default, which results in a white background.
-# Warning: Depending on the platform used, enabling this option may lead to
-# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
-# read).
-
-DOT_TRANSPARENT = NO
-
-# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
-# files in one run (i.e. multiple -o and -T options on the command line). This
-# makes dot run faster, but since only newer versions of dot (>1.8.10)
-# support this, this feature is disabled by default.
-
-DOT_MULTI_TARGETS = NO
-
-# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
-# generate a legend page explaining the meaning of the various boxes and
-# arrows in the dot generated graphs.
-
-GENERATE_LEGEND = YES
-
-# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
-# remove the intermediate dot files that are used to generate
-# the various graphs.
-
-DOT_CLEANUP = YES
-
-#---------------------------------------------------------------------------
-# Configuration::additions related to the search engine
-#---------------------------------------------------------------------------
-
-# The SEARCHENGINE tag specifies whether or not a search engine should be
-# used. If set to NO the values of all tags below this one will be ignored.
-
-SEARCHENGINE = NO
diff --git a/contrib/pdxautoserializer/src/InputParser.cpp b/contrib/pdxautoserializer/src/InputParser.cpp
deleted file mode 100644
index 67d2e83..0000000
--- a/contrib/pdxautoserializer/src/InputParser.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "base_types.hpp"
-#include "InputParser.hpp"
-
-namespace apache {
-namespace geode {
-namespace client {
-namespace pdx_auto_serializer {
-// ClassInfo method definitions
-
-void ClassInfo::init(InputParser* parser) { m_parser = parser; }
-
-// InputParser method definitions
-
-bool InputParser::select(const std::string& className) {
- ASClassFlagMap::iterator findClass = m_classes.find(className);
- if (findClass != m_classes.end()) {
- findClass->second.second = true;
- return true;
- }
- return false;
-}
-
-void InputParser::getSelectedClasses(ASClassVector& classes) const {
- for (ASClassFlagMap::const_iterator mapIterator = m_classes.begin();
- mapIterator != m_classes.end(); ++mapIterator) {
- if (mapIterator->second.second) {
- classes.push_back(mapIterator->second.first);
- }
- }
-}
-
-bool InputParser::contains(const std::string& className) const {
- ASClassFlagMap::const_iterator findClass = m_classes.find(className);
- return (findClass != m_classes.end());
-}
-} // namespace pdx_auto_serializer
-} // namespace client
-} // namespace geode
-} // namespace apache
diff --git a/contrib/pdxautoserializer/src/InputParser.hpp b/contrib/pdxautoserializer/src/InputParser.hpp
deleted file mode 100644
index bfb36db..0000000
--- a/contrib/pdxautoserializer/src/InputParser.hpp
+++ /dev/null
@@ -1,184 +0,0 @@
-#pragma once
-
-#ifndef GEODE_PDXAUTOSERIALIZER_INPUTPARSER_H_
-#define GEODE_PDXAUTOSERIALIZER_INPUTPARSER_H_
-
-/*
- * 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 "base_types.hpp"
-#include "CodeGenerator.hpp"
-
-namespace apache {
-namespace geode {
-namespace client {
-namespace pdx_auto_serializer {
-// Forward declaration.
-class InputParser;
-
-/**
- * This class describes the interface to be implemented by the
- * front-end parsers to represent each class in the resource.
- */
-class ClassInfo {
- public:
- /**
- * Destruct the class.
- */
- virtual ~ClassInfo() {}
-
- /**
- * Initialize with a handle to <code>InputParser</code>.
- *
- * @param parser Pointer to the <code>InputParser</code> object.
- */
- virtual void init(InputParser* parser);
-
- /**
- * Get the name of the class.
- *
- * @return The name of this class.
- */
- virtual std::string getName() const = 0;
-
- /**
- * Get the set of references required for the class.
- *
- * @param references The vector of references.
- */
- virtual void getReferences(ReferenceVector& references) const = 0;
-
- /**
- * Get the class information (with the namespace information) for this
- * class.
- *
- * @param classType The <code>TypeInfo</code> for the class.
- */
- virtual void getTypeInfo(TypeInfo& classType) const = 0;
-
- /**
- * Get the list of members of this class to be serialized/deserialized.
- *
- * @param members The vector of variables that contains the list
- * of variables that need to be serialized/deserialized.
- */
- virtual void getMembers(VariableVector& members) const = 0;
-
- virtual std::string getMethodPrefix() const = 0;
-
- protected:
- /**
- * The <code>InputParser</code> object for which classes are being
- * extracted.
- */
- InputParser* m_parser;
-};
-
-/** Shorthand for a vector of <code>ClassInfo</code> objects. */
-typedef std::vector<const ClassInfo*> ASClassVector;
-
-/**
- * Shorthand for a map of class names to corresponding
- * <code>ClassInfo</code> objects.
- */
-typedef std::map<std::string, const ClassInfo*> ASClassMap;
-
-/**
- * Shorthand for a map of class names to corresponding
- * <code>ClassInfo</code> objects with a flag for selection.
- */
-typedef std::map<std::string, std::pair<ClassInfo*, bool> > ASClassFlagMap;
-
-/**
- * This class describes the interface to be implemented by front-end
- * parsers.
- */
-class InputParser {
- public:
- /**
- * Destruct the parser.
- */
- virtual ~InputParser() {}
-
- /**
- * Get a list of options and usage for the parser.
- *
- * @param options Output parameter for options along-with their usage.
- */
- virtual void getOptions(OptionMap& options) const = 0;
-
- /**
- * Initialize the parser with the given properties.
- *
- * @param properties The set of properties for the resource as given
- * on the command-line. The function should modify
- * this map so as to remove the properties used by
- * the implementation. This should also match the
- * usage as provided by
- * <code>InputParser::getOptions</code> method.
- */
- virtual void init(PropertyMap& properties) = 0;
-
- /**
- * Select some or all classes in the given resources.
- *
- * @param resources The resources to parse.
- * @param classNames The names of the classes which constitute the
- * initial selection as specified by the user.
- * If this is empty then all the classes are marked
- * as selected.
- */
- virtual void selectClasses(const StringVector& resources,
- const StringVector& classNames) = 0;
-
- /**
- * Add the given class to the current selection of classes.
- *
- * @param className The name of the new class to be added.
- * @return True if the given class name exists in the global list.
- */
- virtual bool select(const std::string& className);
-
- /**
- * Search the given class name in the global list of classes.
- *
- * @param className The name of the class to search.
- * @return True if the given class name exists in the global list.
- */
- virtual bool contains(const std::string& className) const;
-
- /**
- * Get the selected list of classes.
- *
- * @param classes Output parameter containing the vector of
- * selected classes.
- */
- virtual void getSelectedClasses(ASClassVector& classes) const;
-
- protected:
- /**
- * Stores the set of all the classes with the classes selected so far
- * as marked selected.
- */
- ASClassFlagMap m_classes;
-};
-} // namespace pdx_auto_serializer
-} // namespace client
-} // namespace geode
-} // namespace apache
-
-#endif // GEODE_PDXAUTOSERIALIZER_INPUTPARSER_H_
diff --git a/contrib/pdxautoserializer/src/InputParserFactory.cpp b/contrib/pdxautoserializer/src/InputParserFactory.cpp
deleted file mode 100644
index a9dea87..0000000
--- a/contrib/pdxautoserializer/src/InputParserFactory.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "base_types.hpp"
-#include "InputParserFactory.hpp"
-#include <stdio.h>
-#ifndef WIN32
-#include <strings.h>
-#endif
-#include "impl/CPPParser/CPPInputParser.hpp"
-#ifdef GEMFIRE_CLR
-#include "impl/DotNetParser.hpp"
-#endif
-
-namespace apache {
-namespace geode {
-namespace client {
-namespace pdx_auto_serializer {
-InputParserFactory::InputParserFactory() {
- // Register the available parsers here.
- m_parserMap["C++"] = CPPInputParser::create;
-#ifdef GEMFIRE_CLR
- m_parserMap[".NET"] = DotNetParser::create;
-#endif // GEMFIRE_CLR
-}
-
-InputParser* InputParserFactory::getInstance(
- const std::string& parserName) const {
- std::map<std::string, InputParserFn>::const_iterator mapIterator =
- m_parserMap.find(parserName);
- if (mapIterator != m_parserMap.end()) {
- return mapIterator->second();
- }
- return NULL;
-}
-
-StringVector InputParserFactory::getParsers() const {
- StringVector parserList;
-
- for (std::map<std::string, InputParserFn>::const_iterator parserIterator =
- m_parserMap.begin();
- parserIterator != m_parserMap.end(); ++parserIterator) {
- parserList.push_back(parserIterator->first);
- }
- return parserList;
-}
-
-InputParserFactory::~InputParserFactory() { m_parserMap.clear(); }
-} // namespace pdx_auto_serializer
-} // namespace client
-} // namespace geode
-} // namespace apache
diff --git a/contrib/pdxautoserializer/src/InputParserFactory.hpp b/contrib/pdxautoserializer/src/InputParserFactory.hpp
deleted file mode 100644
index 75a3c94..0000000
--- a/contrib/pdxautoserializer/src/InputParserFactory.hpp
+++ /dev/null
@@ -1,76 +0,0 @@
-#pragma once
-
-#ifndef GEODE_PDXAUTOSERIALIZER_INPUTPARSERFACTORY_H_
-#define GEODE_PDXAUTOSERIALIZER_INPUTPARSERFACTORY_H_
-
-/*
- * 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 "InputParser.hpp"
-#include <utility>
-
-namespace apache {
-namespace geode {
-namespace client {
-namespace pdx_auto_serializer {
-/**
- * Defines a function returning a pointer to an
- * <code>InputParser</code> object.
- *
- * @return The <code>InputParser</code> object.
- */
-typedef InputParser* (*InputParserFn)(void);
-
-/**
- * Factory class to obtain instances of <code>InputParser</code>
- * implementations.
- */
-class InputParserFactory {
- public:
- /**
- * Default constructor that registers all the available
- * <code>InputParser</code> implementations.
- */
- InputParserFactory();
-
- /**
- * Get an instance of an <code>InputParser</code> using name of a parser.
- *
- * @param parserName The name of the parser frontend.
- * @return An instance of <code>InputParser</code>.
- */
- InputParser* getInstance(const std::string& parserName) const;
-
- /** Get a list of all registered parser frontends. */
- StringVector getParsers() const;
-
- /** Virtual destructor. */
- virtual ~InputParserFactory();
-
- private:
- /**
- * The map containing the mappings from the names of parsers to their
- * factory functions.
- */
- std::map<std::string, InputParserFn> m_parserMap;
-};
-} // namespace pdx_auto_serializer
-} // namespace client
-} // namespace geode
-} // namespace apache
-
-#endif // GEODE_PDXAUTOSERIALIZER_INPUTPARSERFACTORY_H_
diff --git a/contrib/pdxautoserializer/src/OutputFormatter.cpp b/contrib/pdxautoserializer/src/OutputFormatter.cpp
deleted file mode 100644
index a733389..0000000
--- a/contrib/pdxautoserializer/src/OutputFormatter.cpp
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "OutputFormatter.hpp"
-#include <cstring>
-#include <cerrno>
-
-namespace apache {
-namespace geode {
-namespace client {
-namespace pdx_auto_serializer {
-// OutputFormatStreamBuf method definitions
-
-OutputFormatStreamBuf::OutputFormatStreamBuf()
- : m_buf(NULL),
- m_indentSize(0),
- m_indentLevel(0),
- m_newLine(true),
- m_openBrace(false) {
- std::streambuf::setp(NULL, NULL);
- std::streambuf::setg(NULL, NULL, NULL);
-}
-
-void OutputFormatStreamBuf::init(std::streambuf* buf, char indentChar,
- int indentSize) {
- m_buf = buf;
- m_indentChar = indentChar;
- m_indentSize = indentSize;
-}
-
-void OutputFormatStreamBuf::setIndentChar(char indentChar) {
- m_indentChar = indentChar;
-}
-
-void OutputFormatStreamBuf::setIndentSize(int indentSize) {
- m_indentSize = indentSize;
-}
-
-void OutputFormatStreamBuf::increaseIndent() { ++m_indentLevel; }
-
-void OutputFormatStreamBuf::decreaseIndent() { --m_indentLevel; }
-
-int OutputFormatStreamBuf::getIndent() const { return m_indentLevel; }
-
-void OutputFormatStreamBuf::setIndent(int indentLevel) {
- m_indentLevel = indentLevel;
-}
-
-int OutputFormatStreamBuf::overflow(int c) {
- if (c != EOF) {
- if (m_newLine && c != '\n') {
- if (c != '#') {
- if (c == '}') {
- --m_indentLevel;
- }
- for (int i = 0; i < m_indentLevel * m_indentSize; ++i) {
- if (m_buf->sputc(m_indentChar) == EOF) {
- return EOF;
- }
- }
- }
- m_newLine = false;
- }
- if (c == '\n') {
- m_newLine = true;
- if (m_openBrace) {
- ++m_indentLevel;
- }
- }
- if (c == '{') {
- m_openBrace = true;
- } else {
- m_openBrace = false;
- }
- return m_buf->sputc(c);
- }
- return 0;
-}
-
-int OutputFormatStreamBuf::sync() { return m_buf->pubsync(); }
-
-OutputFormatStreamBuf::~OutputFormatStreamBuf() {}
-
-// OutputFormatter method definitions
-
-OutputFormatter::OutputFormatter()
- : std::ostream(NULL), m_ofstream(), m_streamBuf() {
- m_streamBuf.init(m_ofstream.rdbuf(), DefaultIndentChar, DefaultIndentSize);
- std::ostream::init(&m_streamBuf);
-}
-
-void OutputFormatter::open(const std::string& fileName, ios_base::openmode mode,
- char indentChar, int indentSize) {
- m_fileName = fileName;
- m_ofstream.open(fileName.c_str(), mode);
- if (!m_ofstream) {
- throw std::ios_base::failure(std::strerror(errno));
- }
- m_streamBuf.setIndentChar(indentChar);
- m_streamBuf.setIndentSize(indentSize);
-}
-
-void OutputFormatter::setIndentChar(char indentChar) {
- m_streamBuf.setIndentChar(indentChar);
-}
-
-void OutputFormatter::setIndentSize(int indentSize) {
- m_streamBuf.setIndentSize(indentSize);
-}
-
-void OutputFormatter::increaseIndent() { m_streamBuf.increaseIndent(); }
-
-void OutputFormatter::decreaseIndent() { m_streamBuf.decreaseIndent(); }
-
-int OutputFormatter::getIndent() const { return m_streamBuf.getIndent(); }
-
-void OutputFormatter::setIndent(int indentLevel) {
- m_streamBuf.setIndent(indentLevel);
-}
-
-std::string OutputFormatter::getFileName() const { return m_fileName; }
-
-void OutputFormatter::flush() {
- std::ostream::flush();
- m_ofstream.flush();
-}
-
-void OutputFormatter::close() {
- std::ostream::flush();
- m_ofstream.close();
-}
-} // namespace pdx_auto_serializer
-} // namespace client
-} // namespace geode
-} // namespace apache
diff --git a/contrib/pdxautoserializer/src/OutputFormatter.hpp b/contrib/pdxautoserializer/src/OutputFormatter.hpp
deleted file mode 100644
index 244973f..0000000
--- a/contrib/pdxautoserializer/src/OutputFormatter.hpp
+++ /dev/null
@@ -1,230 +0,0 @@
-#pragma once
-
-#ifndef GEODE_PDXAUTOSERIALIZER_OUTPUTFORMATTER_H_
-#define GEODE_PDXAUTOSERIALIZER_OUTPUTFORMATTER_H_
-
-/*
- * 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 <ostream>
-#include <streambuf>
-#include <fstream>
-#include <string>
-
-namespace apache {
-namespace geode {
-namespace client {
-namespace pdx_auto_serializer {
-/** The default character to use for indentation. */
-const char DefaultIndentChar = ' ';
-
-/** The default indentation size. */
-const int DefaultIndentSize = 2;
-
-/**
- * A<code>std::streambuf</code> class that formats the buffer with
- * appropriate indentation.
- *
- * It derives from the standard <code>std::streambuf</code> class and
- * turns off buffering while delegating the actual task to another
- * <code>std::streambuf</code> contained in it. This is required so that
- * the <code>OutputFormatStreamBuf::overflow</code> method is called for
- * every write.
- */
-class OutputFormatStreamBuf : public std::streambuf {
- public:
- /** Default constructor. */
- OutputFormatStreamBuf();
-
- /**
- * Initialize the buffer with the given <code>std::streambuf</code>
- * and given indentation character, indentation size.
- *
- * @param buf The actual <code>std::streambuf</code> to be used for
- * buffering.
- * @param indentChar The character to use for indentation of each line.
- * @param indentSize The size for each level of indentation.
- */
- void init(std::streambuf* buf, char indentChar, int indentSize);
-
- /**
- * Change the indentation character.
- *
- * @param indentChar The new indentation character.
- */
- void setIndentChar(char indentChar);
-
- /**
- * Change the number of characters for each indentation level.
- *
- * @param indentSize The new size for indentation.
- */
- void setIndentSize(int indentSize);
-
- /** Increase the current indentation level by one. */
- void increaseIndent();
-
- /** Decrease the current indentation level by one. */
- void decreaseIndent();
-
- /**
- * Get the current indentation level.
- *
- * @return The current indentation level.
- */
- virtual int getIndent() const;
-
- /**
- * Set the current indentation level.
- *
- * @param indentLevel The indentation level to set.
- */
- virtual void setIndent(int indentLevel);
-
- /** Virtual destructor. */
- virtual ~OutputFormatStreamBuf();
-
- protected:
- /**
- * The overriden <code>std::streambuf::overflow</code> method that
- * inserts the indentation characters when starting a new line.
- *
- * Note that buffering for this <code>streambuf</code> is turned off so
- * that this is called for every write and the contained
- * <code>m_buf</code> is the one actually used.
- *
- * @param c The character to be written.
- */
- virtual int overflow(int c);
-
- /** Overriden <code>std::streambuf::sync</code> method. */
- virtual int sync();
-
- /**
- * The contained <code>streambuf</code> that does the actual work of
- * buffering/writing.
- */
- std::streambuf* m_buf;
-
- /** The indentation character to be used. */
- char m_indentChar;
-
- /** The size of indentation in each level. */
- int m_indentSize;
-
- /** The current indentation level. */
- int m_indentLevel;
-
- /** True when a newline has just been encountered. */
- bool m_newLine;
-
- /** True when an opening brace has just been encountered. */
- bool m_openBrace;
-};
-
-/**
- * A<code>std::ostream</code> class that writes the output to a given file
- * and formats the output with appropriate indentation.
- */
-class OutputFormatter : public std::ostream {
- public:
- /** The default constructor */
- OutputFormatter();
-
- /**
- * Open a given file for writing (just like <code>std::ofstream</code>
- * in the given mode and use the provided indentation character and size.
- *
- * @param fileName Name of the file to open.
- * @param mode The mode to use when opening the file -- default is to
- * truncate the file and open in write mode.
- * @param indentChar The character to use for indentation.
- * @param indentSize The number of characters to use for indentation.
- */
- virtual void open(const std::string& fileName,
- ios_base::openmode mode = ios_base::out | ios_base::trunc,
- char indentChar = DefaultIndentChar,
- int indentSize = DefaultIndentSize);
-
- /**
- * Change the indentation character.
- *
- * @param indentChar The new indentation character.
- */
- virtual void setIndentChar(char indentChar);
-
- /**
- * Change the number of characters for each indentation level.
- *
- * @param indentSize The new size for indentation.
- */
- virtual void setIndentSize(int indentSize);
-
- /** Increase the current indentation level by one. */
- virtual void increaseIndent();
-
- /** Decrease the current indentation level by one. */
- virtual void decreaseIndent();
-
- /**
- * Get the current indentation level.
- *
- * @return The current indentation level.
- */
- virtual int getIndent() const;
-
- /**
- * Set the current indentation level.
- *
- * @param indentLevel The indentation level to set.
- */
- virtual void setIndent(int indentLevel);
-
- /**
- * Get the underlying name of output file.
- *
- * @return The path of the output file.
- */
- std::string getFileName() const;
-
- /** Overrides the <code>std::ostream::flush</code> method to flush the
- * output stream to the file.
- */
- virtual void flush();
-
- /**
- * Overrides the <code>std::ostream::close</code> method to close the
- * underlying stream and file.
- */
- virtual void close();
-
- protected:
- /** The underlying output file stream object. */
- std::ofstream m_ofstream;
-
- /** The name of the output file. */
- std::string m_fileName;
-
- /** The formatter to use for formatting the output. */
- OutputFormatStreamBuf m_streamBuf;
-};
-} // namespace pdx_auto_serializer
-} // namespace client
-} // namespace geode
-} // namespace apache
-
-#endif // GEODE_PDXAUTOSERIALIZER_OUTPUTFORMATTER_H_
diff --git a/contrib/pdxautoserializer/src/base_types.hpp b/contrib/pdxautoserializer/src/base_types.hpp
deleted file mode 100644
index 09f8b54..0000000
--- a/contrib/pdxautoserializer/src/base_types.hpp
+++ /dev/null
@@ -1,256 +0,0 @@
-#pragma once
-
-#ifndef GEODE_PDXAUTOSERIALIZER_BASE_TYPES_H_
-#define GEODE_PDXAUTOSERIALIZER_BASE_TYPES_H_
-
-/*
- * 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 <string>
-#include <vector>
-#include <set>
-#include <map>
-#include <cassert>
-#include <stdexcept>
-
-namespace apache {
-namespace geode {
-namespace client {
-namespace pdx_auto_serializer {
-/** Shorthand for vector of strings. */
-typedef std::vector<std::string> StringVector;
-
-/** Shorthand for set of strings. */
-typedef std::set<std::string> StringSet;
-
-/**
- * Shorthand for the <code>std::map</code> containing property
- * key-value pairs.
- */
-typedef std::map<std::string, StringVector> PropertyMap;
-
-/**
- * Shorthand for the <code>std::map</code> containing string
- * key-value pairs.
- */
-typedef std::map<std::string, std::string> StringMap;
-
-/**
- * Shorthand for the <code>std::map</code> containing string
- * keys mapped to usage string and boolean indicator of option
- * requiring a value.
- */
-typedef std::map<std::string, std::pair<bool, std::string> > OptionMap;
-
-/** Shorthand for iterator of vector of strings. */
-typedef std::vector<std::string>::const_iterator StringVectorIterator;
-
-/** Shorthand for iterator of set of strings. */
-typedef std::set<std::string>::const_iterator StringSetIterator;
-
-/**
- * Encapsulates different kinds of references (headers/dlls etc).
- */
-class Reference {
- public:
- enum Kind {
- /** Indicates a C++ header file. */
- HEADER,
-
- /** Indicates a library (so/dll). */
- LIB,
-
- /** Indicates a jar file (Java). */
- JAR
- };
-};
-
-/**
- * Structure to hold information of a reference (e.g. header/dll).
- */
-struct ReferenceInfo {
- /** Path of the reference. */
- std::string m_path;
-
- /** the <code>Reference::Kind</code> of the reference. */
- Reference::Kind m_kind;
-};
-
-/**
- * Encapsulates different kinds of types like <code>VALUE</code>,
- * <code>ARRAY</code> etc.
- *
- * Also includes the information whether the type is a built-in one or
- * a user-defined type, and whether the type is a .NET managed type.
- */
-class TypeKind {
- public:
- /** An invalid type. */
- static const int INVALID = 0x0;
-
- /** A value type. */
- static const int VALUE = 0x01;
-
- /** A pointer type. */
- static const int POINTER = 0x02;
-
- /** A reference type or pass by reference. */
- static const int REFERENCE = 0x04;
-
- /** An array type with fixed/dynamic size. */
- static const int ARRAY = 0x08;
-
- /**
- * The array is of fixed size -- both this and <code>ARRAY</code>
- * bits should be set for fixed size arrays.
- */
- static const int FIXEDARRAY = 0x10;
-
- /** A C++ template or .NET/Java generic type. */
- static const int TEMPLATE = 0x20;
-
- /** The type is actually a template parameter symbol. */
- static const int TEMPLATEPARAM = 0x40;
-
- /**
- * Indicates that the type is a .NET managed type -- required for
- * generators like C++/CLI that understand both normal objects as
- * well as .NET types.
- */
- static const int MANAGED = 0x100;
-
- /**
- * Indicates that the type is a builtin one. This will be normally
- * OR'd with one of the actual kinds above. If this bit is not set
- * then the type is assumed to be a user-defined type.
- */
- static const int BUILTIN = 0x200;
-};
-
-/**
- * Mask to extract the Type part only from the constants in
- * <code>TypeKind</code> class.
- */
-const int TYPEKIND_TYPEMASK = 0xFF;
-
-/**
- * Constants for the possible kinds of type modifiers.
- */
-class TypeModifier {
- public:
- /** No modifier. */
- static const int NONE = 0x01;
-
- /** The type is defined to be a constant. */
- static const int CONSTANT = 0x02;
-
- /** The type is defined to be volatile. */
- static const int VOLATILE = 0x04;
-
- /** The member is private to the class. */
- static const int PRIVATE = 0x08;
-
- /** The member is declared to be protected. */
- static const int PROTECTED = 0x10;
-
- /** The member is declared to be public. */
- static const int PUBLIC = 0x20;
-
- /** The member is declared to be internal (.NET). */
- static const int INTERNAL = 0x40;
-
- /** The member is a property (.NET). */
- static const int PROPERTY = 0x80;
-
- /** The member is defined to be transient (Java). */
- static const int TRANSIENT = 0x100;
-};
-
-/**
- * Structure to hold information for a type.
- */
-struct TypeInfo {
- /** The {@link apache::geode::client::pdx_auto_serializer::TypeKind} of the
- * type. */
- int m_kind;
-
- /** The {@link apache::geode::client::pdx_auto_serializer::TypeModifier} for
- * the type. */
- int m_modifier;
-
- /**
- * Contains either the name of the variable, or for the case of
- * <code>FIXEDARRAY</code> or <code>ARRAY</code>, the size of the array,
- * name of variable containing the size respectively.
- */
- std::string m_nameOrSize;
-
- std::string m_nameOfArrayElemSize;
-
- /** The namespace for the type expressed as a vector. */
- StringVector m_namespaces;
-
- /**
- * Information of any child sub-types for the case of
- * <code>POINTER</code>, <code>REFERENCE</code> or
- * <code>TEMPLATE</code> types.
- */
- TypeInfo* m_children;
-
- /**
- * The number of child sub-types. Can be greater than one for the case
- * of <code>TEMPLATE</code> types.
- */
- int m_numChildren;
-};
-
-/**
- * Structure to hold information for a variable.
- */
-struct VariableInfo {
- /** The type of the variable. */
- TypeInfo m_type;
-
- bool m_markIdentityField;
- bool m_markPdxUnreadField;
- /** The name of the variable. */
- std::string m_name;
-};
-
-/** Shorthand for a vector of <code>ReferenceInfo</code>. */
-typedef std::vector<ReferenceInfo> ReferenceVector;
-
-/**
- * Shorthand for <code>const_iterator</code> of a vector of
- * <code>ReferenceInfo</code>.
- */
-typedef std::vector<ReferenceInfo>::const_iterator ReferenceVectorIterator;
-
-/** Shorthand for a vector of <code>VariableInfo</code>. */
-typedef std::vector<VariableInfo> VariableVector;
-
-/**
- * Shorthand for <code>const_iterator</code> of a vector of
- * <code>VariableInfo</code>.
- */
-typedef std::vector<VariableInfo>::const_iterator VariableVectorIterator;
-} // namespace pdx_auto_serializer
-} // namespace client
-} // namespace geode
-} // namespace apache
-
-#endif // GEODE_PDXAUTOSERIALIZER_BASE_TYPES_H_
diff --git a/contrib/pdxautoserializer/src/impl/CPPCodeGenerator.cpp b/contrib/pdxautoserializer/src/impl/CPPCodeGenerator.cpp
deleted file mode 100644
index 8705495..0000000
--- a/contrib/pdxautoserializer/src/impl/CPPCodeGenerator.cpp
+++ /dev/null
@@ -1,541 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "../base_types.hpp"
-#include "CPPCodeGenerator.hpp"
-#include "Log.hpp"
-#include "Helper.hpp"
-#include <iostream>
-
-namespace apache {
-namespace geode {
-namespace client {
-namespace pdx_auto_serializer {
-int CPPCodeGenerator::s_classId = -1;
-
-std::string CPPCodeGenerator::s_GFSerializerNamespace =
- "apache::geode::client::PdxAutoSerializable";
-std::string CPPCodeGenerator::s_TempVarPrefix = "var_";
-
-/** The option name for classId. */
-std::string CPPCodeGenerator::s_ClassIdOption = "classId";
-
-/** The option name for the output directory. */
-std::string CPPCodeGenerator::s_OutDirOption = "outDir";
-
-/**
-* The directory to be used in generated files for the included headers.
-* If not provided the path of the header file as provided on
-* command-line is used.
-*/
-std::string CPPCodeGenerator::s_HeaderDirOption = "headerDir";
-
-/**
-* The option name for the suffix to use for generated files and classes.
-*/
-std::string CPPCodeGenerator::s_GenSuffixOption = "suffix";
-
-// CodeGenerator method implementations
-
-void CPPCodeGenerator::getOptions(OptionMap& options) const {
- std::pair<bool, std::string> optionPair;
- // optionPair.first = true;
- // optionPair.second
- // = "\tThe base classId to be used for the serializers [>= 0, < 2^31] "
- // "(SINGLE,OPTIONAL)";
- // options[s_ClassIdOption] = optionPair;
-
- optionPair.second =
- "\tThe output directory of the generated files "
- "(SINGLE,OPTIONAL)";
- options[s_OutDirOption] = optionPair;
-
- optionPair.second =
- "\tThe suffix of the generated filenames "
- "-- default is '" +
- defaultGenSuffix() + "' (SINGLE,OPTIONAL)";
- options[s_GenSuffixOption] = optionPair;
-
- // optionPair.second = "\tThe directory to be used in generated files for "
- // "the included headers.\n\t\t\tIf not provided the "
- // "path of the header file as provided on the "
- // "command-line is used (SINGLE,OPTIONAL)";
- // options[s_HeaderDirOption] = optionPair;
-}
-
-void CPPCodeGenerator::init(PropertyMap& properties) {
- Helper::getSingleProperty(properties, s_OutDirOption, m_outDir);
- m_outDir += '/';
- std::string classIdStr;
- bool classIdFound =
- Helper::getSingleProperty(properties, s_ClassIdOption, classIdStr);
- if (!classIdFound) {
- // Log::warn(m_moduleName, "No classId given or found for the "
- // "class; will not generate the classId method.");
- } else {
- try {
- Helper::lexical_cast(classIdStr, s_classId);
- } catch (const std::invalid_argument&) {
- Log::fatal(m_moduleName, "classId not a valid integer");
- }
- if (s_classId < 0) {
- Log::fatal(m_moduleName, "classId should be >= 0.");
- }
- }
- Helper::getSingleProperty(properties, s_GenSuffixOption, m_genSuffix);
- if (m_genSuffix.length() == 0) {
- m_genSuffix = defaultGenSuffix();
- }
- if (Helper::getSingleProperty(properties, s_HeaderDirOption, m_headerDir) &&
- (m_headerDir.length() > 0)) {
- char lastChar = m_headerDir[m_headerDir.length() - 1];
- if (lastChar != '/' && lastChar != '\\') {
- m_headerDir += '/';
- }
- }
-}
-
-void CPPCodeGenerator::initClass(const TypeInfo& classInfo) {
- std::string namespacePrefixString = "";
- StringVector nameSpaceList = classInfo.m_namespaces;
- for (StringVector::iterator iter = nameSpaceList.begin();
- iter != nameSpaceList.end(); ++iter) {
- namespacePrefixString += *iter;
- }
- std::string outFile = "";
- if (namespacePrefixString == "") {
- outFile = m_outDir + classInfo.m_nameOrSize + m_genSuffix + ".cpp";
- } else {
- outFile = m_outDir + namespacePrefixString + "_" + classInfo.m_nameOrSize +
- m_genSuffix + ".cpp";
- }
- Log::info(m_moduleName, "Writing: " + outFile);
- m_cppFormatter->open(outFile);
- m_classInfo = classInfo;
-}
-
-void CPPCodeGenerator::addFileHeader(int argc, char** argv) {
- *m_cppFormatter
- << "// This is auto generated file using \"pdxautoserializer\""
- << "\n";
- *m_cppFormatter
- << "// Do not edit this file, unless you are sure what you are doing "
- << "\n";
- *m_cppFormatter << "// Options used to generate this files are : "
- << "\n";
- for (int i = 1; i < argc; i++) {
- *m_cppFormatter << "//\t" << argv[i] << "\n";
- }
- *m_cppFormatter << "\n";
-}
-
-void CPPCodeGenerator::addReferences(const ReferenceVector& references) {
- for (ReferenceVectorIterator referenceIterator = references.begin();
- referenceIterator != references.end(); ++referenceIterator) {
- if (referenceIterator->m_kind == Reference::HEADER) {
- std::string headerPath;
- std::string::size_type lastSlash =
- referenceIterator->m_path.find_last_of("/\\");
- if (lastSlash != std::string::npos) {
- headerPath =
- m_headerDir + referenceIterator->m_path.substr(lastSlash + 1);
- } else {
- headerPath = m_headerDir + referenceIterator->m_path;
- }
- *m_cppFormatter << "#include \"" << headerPath << "\"\n\n";
- }
- }
- *m_cppFormatter << "#include <geode/PdxWriter.hpp>"
- << "\n";
- *m_cppFormatter << "#include <geode/PdxReader.hpp>"
- << "\n";
- *m_cppFormatter << "#include <geode/PdxAutoSerializer.hpp>"
- << "\n\n";
-}
-
-void CPPCodeGenerator::startClass(const VariableVector& members) {
- genNamespaceHeader(m_classInfo.m_namespaces, m_cppFormatter);
-}
-// Ticket #905 Changes starts here
-void CPPCodeGenerator::addTryBlockStart(const Method::Type type) {
- switch (type) {
- case Method::TODATA: {
- *m_cppFormatter << "try\n";
- *m_cppFormatter << "{\n";
- break;
- }
- case Method::FROMDATA: {
- *m_cppFormatter << "try\n";
- *m_cppFormatter << "{\n";
- break;
- }
- default: { break; }
- }
- return;
-}
-void CPPCodeGenerator::finishTryBlock(const Method::Type type) {
- switch (type) {
- case Method::TODATA: {
- *m_cppFormatter << "}\n";
- *m_cppFormatter
- << "catch(apache::geode::client::IllegalStateException exception)\n";
- *m_cppFormatter << "{\n";
- *m_cppFormatter << "}\n";
- break;
- }
- case Method::FROMDATA: {
- *m_cppFormatter << "}\n";
- *m_cppFormatter
- << "catch(apache::geode::client::IllegalStateException exception)\n";
- *m_cppFormatter << "{\n";
- *m_cppFormatter << "}\n";
- break;
- }
- default: { break; }
- }
- return;
-}
-// Ticket #905 Changes ends here
-
-void CPPCodeGenerator::startMethod(const Method::Type type,
- const std::string& varName,
- const std::string& methodPrefix) {
- std::string var;
- StringVector varVec;
- std::string className = getTypeString(m_classInfo);
-
- switch (type) {
- case Method::TODATA: {
- varVec.push_back(
- "std::shared_ptr<apache::geode::client::PdxWriter> __var");
-
- genFunctionHeader("toData", className, "void", varVec, true, false,
- m_cppFormatter, methodPrefix);
- break;
- }
- case Method::FROMDATA: {
- varVec.push_back(
- "std::shared_ptr<apache::geode::client::PdxReader> __var ");
-
- genFunctionHeader("fromData", className, "void", varVec, true, false,
- m_cppFormatter, methodPrefix);
- break;
- }
- default: { throw std::invalid_argument("unexpected execution"); }
- }
-}
-
-void CPPCodeGenerator::genMethod(const Method::Type type,
- const std::string& varName,
- const VariableInfo& var) {
- switch (type) {
- case Method::TODATA: {
- if (var.m_markPdxUnreadField == true) {
- *m_cppFormatter << varName << "->writeUnreadFields(" << var.m_name;
- } else {
- *m_cppFormatter << s_GFSerializerNamespace << "::writePdxObject("
- << varName << ", "
- << "\"" << var.m_name << "\""
- << ", " << var.m_name;
- if (var.m_type.m_kind & TypeKind::ARRAY) {
- *m_cppFormatter << ", " << var.m_type.m_nameOrSize;
- if (var.m_type.m_nameOfArrayElemSize.size() > 0) {
- *m_cppFormatter << ", " << var.m_type.m_nameOfArrayElemSize;
- }
- }
- }
- *m_cppFormatter << ");\n";
- if (var.m_markIdentityField == true) {
- *m_cppFormatter << varName << "->markIdentityField("
- << "\"" << var.m_name << "\""
- << ");"
- << "\n"
- << "\n";
- }
- break;
- }
- case Method::FROMDATA: {
- if (var.m_markPdxUnreadField == true) {
- *m_cppFormatter << var.m_name << " = " << varName
- << "->readUnreadFields(";
- } else {
- *m_cppFormatter << s_GFSerializerNamespace << "::readPdxObject("
- << varName << ", "
- << "\"" << var.m_name << "\""
- << ", " << var.m_name;
- if (var.m_type.m_kind & TypeKind::ARRAY) {
- *m_cppFormatter << ", " << var.m_type.m_nameOrSize;
- if (var.m_type.m_nameOfArrayElemSize.size() > 0) {
- *m_cppFormatter << ", " << var.m_type.m_nameOfArrayElemSize;
- }
- }
- }
- *m_cppFormatter << ");\n";
- break;
- }
- default: { throw std::invalid_argument("unexpected execution"); }
- }
-}
-
-void CPPCodeGenerator::endMethod(const Method::Type type,
- const std::string& varName) {
- switch (type) {
- case Method::TODATA: {
- genFunctionFooter(m_cppFormatter);
- break;
- }
- case Method::FROMDATA: {
- //*m_cppFormatter << "return this;\n";
- genFunctionFooter(m_cppFormatter);
- break;
- }
- default: { throw std::invalid_argument("unexpected execution"); }
- }
-}
-
-void CPPCodeGenerator::genTypeId(const std::string& methodPrefix) {
- if (s_classId >= 0) {
- StringVector varVec;
- std::string className = getTypeString(m_classInfo);
-
- genFunctionHeader("classId", className, "int32_t", varVec, true, true,
- m_cppFormatter, methodPrefix);
- *m_cppFormatter << "return " << s_classId << ";\n";
- genFunctionFooter(m_cppFormatter);
- ++s_classId;
- }
-}
-
-void CPPCodeGenerator::genClassNameMethod(
- std::map<std::string, std::string>& classNameStringMap,
- const std::string& methodPrefix) {
- StringVector varVec;
- std::string className = getTypeString(m_classInfo);
- std::map<std::string, std::string>::iterator found =
- classNameStringMap.find(className);
- genFunctionHeader("getClassName", className, "const char*", varVec, true,
- true, m_cppFormatter, methodPrefix);
-
- if (found != classNameStringMap.end()) {
- *m_cppFormatter << "return "
- << "\"" << found->second << "\""
- << ";\n";
- } else {
- *m_cppFormatter << "return "
- << "\"";
- for (StringVector::const_iterator itr = m_classInfo.m_namespaces.begin();
- itr != m_classInfo.m_namespaces.end(); ++itr) {
- *m_cppFormatter << *itr << ".";
- }
- *m_cppFormatter << className << "\""
- << ";\n";
- }
- genFunctionFooter(m_cppFormatter);
-}
-
-void CPPCodeGenerator::genCreateDeserializable(
- const std::string& methodPrefix) {
- StringVector varVec;
- std::string className = getTypeString(m_classInfo);
- genFunctionHeader("createDeserializable", className,
- "apache::geode::client::PdxSerializable*", varVec, true,
- false, m_cppFormatter, methodPrefix);
- *m_cppFormatter << "return new " << className << "()"
- << ";\n";
- genFunctionFooter(m_cppFormatter);
-}
-
-void CPPCodeGenerator::endClass() {
- genNamespaceFooter(m_classInfo.m_namespaces, m_cppFormatter);
- m_cppFormatter->close();
-}
-
-void CPPCodeGenerator::cleanup() {
- std::string fileName;
- if (m_cppFormatter != NULL) {
- fileName = m_cppFormatter->getFileName();
- m_cppFormatter->close();
- if (fileName.length() > 0) {
- remove(fileName.c_str());
- }
- }
-}
-
-// End CodeGenerator methods
-
-std::string CPPCodeGenerator::defaultGenSuffix() const {
- return "Serializable";
-}
-
-std::string CPPCodeGenerator::getNamespacePrefix(
- const StringVector& namespaces) const {
- std::string namespacePrefix;
- for (StringVectorIterator namespaceIterator = namespaces.begin();
- namespaceIterator != namespaces.end(); ++namespaceIterator) {
- namespacePrefix += *namespaceIterator + "::";
- }
- return namespacePrefix;
-}
-
-std::string CPPCodeGenerator::getTypeString(const TypeInfo& type,
- bool prependNS,
- std::string* postVarStr,
- StringSet* templateArgs) const {
- std::string typeString;
- if (type.m_kind & TypeKind::VALUE) {
- if (prependNS) {
- typeString += getNamespacePrefix(type.m_namespaces);
- }
- typeString += type.m_nameOrSize;
- } else if (type.m_kind & TypeKind::TEMPLATEPARAM) {
- typeString += type.m_nameOrSize;
- if (templateArgs != NULL) {
- templateArgs->insert(type.m_nameOrSize);
- }
- } else if (type.m_kind & TypeKind::POINTER) {
- assert(type.m_numChildren == 1);
- assert(type.m_children != NULL);
-
- typeString +=
- getTypeString(*(type.m_children), prependNS, postVarStr, templateArgs);
- if (postVarStr == NULL || postVarStr->length() == 0) {
- typeString += '*';
- } else {
- typeString += "(*";
- postVarStr->insert(0, ")");
- }
- } else if (type.m_kind & TypeKind::REFERENCE) {
- assert(type.m_numChildren == 1);
- assert(type.m_children != NULL);
-
- typeString +=
- getTypeString(*(type.m_children), prependNS, postVarStr, templateArgs);
- if (postVarStr == NULL || postVarStr->length() == 0) {
- typeString += '&';
- } else {
- typeString += "(&";
- postVarStr->insert(0, ")");
- }
- } else if (type.m_kind & TypeKind::TEMPLATE) {
- if (prependNS) {
- typeString += getNamespacePrefix(type.m_namespaces);
- }
- typeString += type.m_nameOrSize + "< ";
- if (type.m_numChildren > 0) {
- typeString +=
- getTypeString(*type.m_children, prependNS, postVarStr, templateArgs);
- for (int childIndex = 1; childIndex < type.m_numChildren; ++childIndex) {
- typeString += ", ";
- typeString += getTypeString(type.m_children[childIndex], prependNS,
- postVarStr, templateArgs);
- }
- }
- typeString += " >";
- } else if (type.m_kind & TypeKind::ARRAY) {
- assert(type.m_numChildren == 1);
- assert(type.m_children != NULL);
-
- typeString +=
- getTypeString(*(type.m_children), prependNS, postVarStr, templateArgs);
- if (postVarStr == NULL) {
- typeString += '*';
- } else {
- postVarStr->append("[]");
- }
- } else if (type.m_kind & TypeKind::FIXEDARRAY) {
- assert(type.m_numChildren == 1);
- assert(type.m_children != NULL);
-
- typeString +=
- getTypeString(*(type.m_children), prependNS, postVarStr, templateArgs);
- if (postVarStr == NULL) {
- typeString += '*';
- } else {
- postVarStr->append("[" + type.m_nameOrSize + "]");
- }
- }
- return typeString;
-}
-
-void CPPCodeGenerator::genNamespaceHeader(const StringVector& namespaces,
- OutputFormatter* formatter) {
- for (StringVectorIterator namespaceIterator = namespaces.begin();
- namespaceIterator != namespaces.end(); ++namespaceIterator) {
- *formatter << "namespace " << *namespaceIterator << "\n{\n";
- }
- *formatter << '\n';
-}
-
-void CPPCodeGenerator::genFunctionHeader(const std::string& functionName,
- const std::string& className,
- const std::string& returnType,
- const StringVector& arguments,
- bool isDefinition, bool isConst,
- OutputFormatter* formatter,
- const std::string& methodPrefix) {
- *formatter << returnType << ' ';
- if (isDefinition) {
- if (methodPrefix != "") {
- *formatter << methodPrefix << className << "::";
- } else {
- *formatter << className << "::";
- }
- }
- *formatter << functionName << "(";
- if (arguments.size() > 0) {
- StringVectorIterator argumentIterator = arguments.begin();
- *formatter << *argumentIterator;
- while (++argumentIterator != arguments.end()) {
- *formatter << ", " << *argumentIterator;
- }
- }
- *formatter << ")";
- if (isConst) {
- *formatter << " const";
- }
- *formatter << "\n{\n";
-}
-
-void CPPCodeGenerator::genFunctionFooter(OutputFormatter* formatter) {
- *formatter << "}\n\n";
-}
-
-void CPPCodeGenerator::genNamespaceFooter(const StringVector& namespaces,
- OutputFormatter* formatter) {
- for (StringVector::size_type i = 0; i < namespaces.size(); ++i) {
- *formatter << "}\n";
- }
-}
-
-CodeGenerator* CPPCodeGenerator::create() { return new CPPCodeGenerator(); }
-
-CPPCodeGenerator::CPPCodeGenerator()
- : m_cppFormatter(new OutputFormatter()),
- m_outDir("."),
- m_moduleName("CPPCodeGenerator") {}
-
-CPPCodeGenerator::~CPPCodeGenerator() {
- if (m_cppFormatter != NULL) {
- m_cppFormatter->close();
- delete m_cppFormatter;
- m_cppFormatter = NULL;
- }
-}
-} // namespace pdx_auto_serializer
-} // namespace client
-} // namespace geode
-} // namespace apache
diff --git a/contrib/pdxautoserializer/src/impl/CPPCodeGenerator.hpp b/contrib/pdxautoserializer/src/impl/CPPCodeGenerator.hpp
deleted file mode 100644
index 7b28b35..0000000
--- a/contrib/pdxautoserializer/src/impl/CPPCodeGenerator.hpp
+++ /dev/null
@@ -1,239 +0,0 @@
-#pragma once
-
-#ifndef GEODE_PDXAUTOSERIALIZER_IMPL_CPPCODEGENERATOR_H_
-#define GEODE_PDXAUTOSERIALIZER_IMPL_CPPCODEGENERATOR_H_
-
-/*
- * 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 "../CodeGenerator.hpp"
-#include "../OutputFormatter.hpp"
-
-namespace apache {
-namespace geode {
-namespace client {
-namespace pdx_auto_serializer {
-/**
- * The C++ code generator backend.
- */
-class CPPCodeGenerator : public CodeGenerator {
- public:
- // CodeGenerator method implementations
-
- virtual void getOptions(OptionMap& options) const;
-
- virtual void init(PropertyMap& properties);
-
- virtual void initClass(const TypeInfo& classInfo);
-
- virtual void addReferences(const ReferenceVector& references);
- virtual void addFileHeader(int, char**);
-
- virtual void startClass(const VariableVector& members);
-
- virtual void startMethod(const Method::Type type, const std::string& varName,
- const std::string& methodPrefix);
-
- // Ticket #905 Changes starts here
- virtual void addTryBlockStart(const Method::Type type);
- virtual void finishTryBlock(const Method::Type type);
- // Ticket #905 Changes ends here
- virtual void genMethod(const Method::Type type, const std::string& varName,
- const VariableInfo& var);
-
- virtual void endMethod(const Method::Type type, const std::string& varName);
-
- virtual void genTypeId(const std::string& methodPrefix);
- virtual void genClassNameMethod(std::map<std::string, std::string>&,
- const std::string& methodPrefix);
- virtual void genCreateDeserializable(const std::string& methodPrefix);
- virtual void endClass();
-
- virtual void cleanup();
-
- // End CodeGenerator implementations
-
- /**
- * Static factory function to create an object of
- * <code>CPPCodeGenerator</code> class. This is registered with the
- * <code>CodeGeneratorFactory</code>.
- *
- * @return An instance of <code>CPPCodeGenerator</code>.
- */
- static CodeGenerator* create();
-
- /** Virtual destructor. */
- virtual ~CPPCodeGenerator();
-
- protected:
- /**
- * Get the default suffix to use for generated files and classes.
- */
- virtual std::string defaultGenSuffix() const;
-
- /**
- * Get the prefix for a namespace nesting.
- *
- * @param namespaces The nested namespace names.
- * @return Prefix for nested namespaces.
- */
- virtual std::string getNamespacePrefix(const StringVector& namespaces) const;
-
- /**
- * Get the string representation for a given type.
- *
- * @param type Reference to the <code>TypeInfo</code> for the type.
- * @param prependNS Whether to prepend the namespace to the type.
- * @param postVarStr Returns a string that may be required after
- * the variable (for C++ arrays). If this is
- * NULL, then it is assumed to be in return type
- * where there is no variable.
- * @return The string representation of the type.
- */
- virtual std::string getTypeString(const TypeInfo& type,
- bool prependNS = false,
- std::string* postVarStr = NULL,
- StringSet* templateArgs = NULL) const;
-
- /**
- * Generate the namespace header for the given list of namespaces.
- *
- * @param namespaces The vector of namespaces.
- * @param formatter The formatter to use for generating the output.
- */
- virtual void genNamespaceHeader(const StringVector& namespaces,
- OutputFormatter* formatter);
-
- /**
- * Generate the function header with the given name, arguments,
- * return type and in the given class.
- *
- * @param functionName The name of the function.
- * @param className The name of the class containing the function.
- * @param returnType The return type of the function.
- * @param arguments The list of arguments to the function.
- * @param isDefinition Whether to generate a definition or declaration.
- * @param isConst Whether the method is a const method.
- * @param formatter The formatter to use for generating the output.
- */
- virtual void genFunctionHeader(const std::string& functionName,
- const std::string& className,
- const std::string& returnType,
- const StringVector& arguments,
- bool isDefinition, bool isConst,
- OutputFormatter* formatter,
- const std::string& methodPrefix);
-
- /**
- * Generate the function footer.
- *
- * @param formatter The formatter to use for generating the footer.
- */
- virtual void genFunctionFooter(OutputFormatter* formatter);
-
- /**
- * Generate the namespace footer for the given list of namespaces.
- *
- * @param namespaces The vector of namespaces.
- * @param formatter The formatter to use for generating the output.
- */
- virtual void genNamespaceFooter(const StringVector& namespaces,
- OutputFormatter* formatter);
-
- /**
- * Default constructor -- this is not exposed to public which should
- * use the {@link CPPCodeGenerator::create} function.
- */
- CPPCodeGenerator();
-
- /**
- * The <code>OutputFormatter</code> to be used for writing the output
- * cpp file.
- */
- OutputFormatter* m_cppFormatter;
-
- /**
- * <code>TypeInfo</code> of the class for which <code>toData</code>
- * and <code>fromData</code> methods are to be generated.
- */
- TypeInfo m_classInfo;
-
- /** The name of the output directory. */
- std::string m_outDir;
-
- /**
- * The suffix to be used for generated files and classes -- default is
- * given by <code>defaultGenSuffix</code>.
- */
- std::string m_genSuffix;
-
- /**
- * The directory of the header file to be used in the '#include' in the
- * generated files.
- */
- std::string m_headerDir;
-
- /**
- * The name of the variable of this class that is passed to static
- * <code>writeObject/readObject</code> methods.
- */
- std::string m_objPrefix;
-
- /** The name of this module to be used for logging. */
- std::string m_moduleName;
-
- /** The current classId being used for this class. */
- static int s_classId;
-
- // Constants
-
- /**
- * The namespace containing the global overloaded <code>writeObject</code>
- * and <code>readObject</code> methods for builtin types.
- */
- static std::string s_GFSerializerNamespace;
-
- /**
- * The prefix to use for declaring temporary and function argument
- * variables.
- */
- static std::string s_TempVarPrefix;
-
- /** The option name for classId. */
- static std::string s_ClassIdOption;
-
- /** The option name for the output directory. */
- static std::string s_OutDirOption;
-
- /**
- * The directory to be used in generated files for the included headers.
- * If not provided the path of the header file as provided on
- * command-line is used.
- */
- static std::string s_HeaderDirOption;
-
- /**
- * The option name for the suffix to use for generated files and classes.
- */
- static std::string s_GenSuffixOption;
-};
-} // namespace pdx_auto_serializer
-} // namespace client
-} // namespace geode
-} // namespace apache
-
-#endif // GEODE_PDXAUTOSERIALIZER_IMPL_CPPCODEGENERATOR_H_
diff --git a/contrib/pdxautoserializer/src/impl/CPPParser/CPPDictionary.hpp b/contrib/pdxautoserializer/src/impl/CPPParser/CPPDictionary.hpp
deleted file mode 100644
index dee184a..0000000
--- a/contrib/pdxautoserializer/src/impl/CPPParser/CPPDictionary.hpp
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * PUBLIC DOMAIN PCCTS-BASED C++ GRAMMAR (cplusplus.g, stat.g, expr.g)
- *
- * Authors: Sumana Srinivasan, NeXT Inc.; sumana_srinivasan@next.com
- * Terence Parr, Parr Research Corporation; parrt@parr-research.com
- * Russell Quong, Purdue University; quong@ecn.purdue.edu
- *
- * SOFTWARE RIGHTS
- *
- * This file is a part of the ANTLR-based C++ grammar and is free
- * software. We do not reserve any LEGAL rights to its use or
- * distribution, but you may NOT claim ownership or authorship of this
- * grammar or support code. An individual or company may otherwise do
- * whatever they wish with the grammar distributed herewith including the
- * incorporation of the grammar or the output generated by ANTLR into
- * commerical software. You may redistribute in source or binary form
- * without payment of royalties to us as long as this header remains
- * in all source distributions.
- *
- * We encourage users to develop parsers/tools using this grammar.
- * In return, we ask that credit is given to us for developing this
- * grammar. By "credit", we mean that if you incorporate our grammar or
- * the generated code into one of your programs (commercial product,
- * research project, or otherwise) that you acknowledge this fact in the
- * documentation, research report, etc.... In addition, you should say nice
- * things about us at every opportunity.
- *
- * As long as these guidelines are kept, we expect to continue enhancing
- * this grammar. Feel free to send us enhancements, fixes, bug reports,
- * suggestions, or general words of encouragement at parrt@parr-research.com.
- *
- * NeXT Computer Inc.
- * 900 Chesapeake Dr.
- * Redwood City, CA 94555
- * 12/02/1994
- *
- * Restructured for public consumption by Terence Parr late February, 1995.
- *
- * Requires PCCTS 1.32b4 or higher to get past ANTLR.
- *
- * DISCLAIMER: we make no guarantees that this grammar works, makes sense,
- * or can be used to do anything useful.
- */
-/* 1999-2005 Version 3.1 November 2005
- * Modified by David Wigg at London South Bank University for CPP_parser.g
- *
- * See MyReadMe.txt for further information
- *
- * This file is best viewed in courier font with tabs set to 4 spaces
- */
-
-#ifndef CPPDictionary_hpp
-#define CPPDictionary_hpp
-
-#include <geode/internal/geode_globals.hpp>
-#include "Dictionary.hpp"
-
-class CPPDictionary : public Dictionary {
- public:
- CPPDictionary(int nb = 43, int ns = 50, int nc = 30000)
- : Dictionary(nb, ns, nc) {}
-
- protected:
- void dumpSymbol(FILE *f, DictEntry *de) {
- CPPSymbol *cs = (CPPSymbol *)de;
-
-#ifdef DIAG_MSGES
- if (!(cs->getType() == CPPSymbol::otTypedef ||
- cs->getType() == CPPSymbol::otClass ||
- cs->getType() == CPPSymbol::otEnum ||
- cs->getType() == CPPSymbol::otUnion ||
- cs->getType() == CPPSymbol::otStruct))
- fprintf(f, "[non-");
- else
- fprintf(f, "[");
- fprintf(f, "type: %s]\n", cs->getKey());
-#endif
- }
-};
-
-#define antlrTrace(x)
-
-#endif
diff --git a/contrib/pdxautoserializer/src/impl/CPPParser/CPPInputParser.cpp b/contrib/pdxautoserializer/src/impl/CPPParser/CPPInputParser.cpp
deleted file mode 100644
index be756df..0000000
--- a/contrib/pdxautoserializer/src/impl/CPPParser/CPPInputParser.cpp
+++ /dev/null
@@ -1,319 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "../../base_types.hpp"
-#include <stdio.h>
-#ifndef WIN32
-#include <strings.h>
-#endif
-#include "CPPInputParser.hpp"
-#include "../../impl/Log.hpp"
-#include <fstream>
-#include <antlr/ANTLRException.hpp>
-
-// Used to control selected tracing at statement level.
-extern int statementTrace;
-
-int deferredLineCount = 0;
-
-void process_line_directive(const char* includedFile,
- const char* includedLineNo) {}
-
-ANTLR_USING_NAMESPACE(antlr);
-
-namespace apache {
-namespace geode {
-namespace client {
-namespace pdx_auto_serializer {
-/** The name of this module to be used for logging. */
-static std::string ModuleName = "CPPInputParser";
-
-// CPPClassInfo definitions
-
-std::string CPPClassInfo::getName() const { return m_className; }
-
-std::string CPPClassInfo::getMethodPrefix() const { return m_method_prefix; }
-
-void CPPClassInfo::getReferences(ReferenceVector& references) const {
- if (m_headerName.length() > 0) {
- ReferenceInfo classHeader = {m_headerName, Reference::HEADER};
-
- references.push_back(classHeader);
- }
-
- /*ReferenceInfo builtinHeader = { "ASBuiltins.hpp",
- Reference::HEADER };*/
-
- // references.push_back(builtinHeader);
-
- /*ReferenceInfo builtinHeaderWriter = { "geode/PdxWriter.hpp",
- Reference::HEADER };
- references.push_back(builtinHeaderWriter);
-
- ReferenceInfo builtinHeaderReader = { "geode/PdxWriter.hpp",
- Reference::HEADER };
- references.push_back(builtinHeaderReader);*/
-}
-
-void CPPClassInfo::getTypeInfo(TypeInfo& classInfo) const {
- classInfo.m_kind = TypeKind::VALUE;
- classInfo.m_nameOrSize = m_className;
- classInfo.m_nameOfArrayElemSize = m_className;
- classInfo.m_children = NULL;
- classInfo.m_numChildren = 0;
- classInfo.m_namespaces = m_NamespacesList;
-}
-
-void CPPClassInfo::getMembers(VariableVector& members) const {
- for (VariableVectorIterator memberIterator = m_members.begin();
- memberIterator != m_members.end(); ++memberIterator) {
- members.push_back(*memberIterator);
- }
-}
-
-void CPPClassInfo::setHeaderName(const std::string headerName) {
- m_headerName = headerName;
-}
-
-void CPPClassInfo::setClassName(const std::string className) {
- m_className = className;
-}
-
-void CPPClassInfo::setMethodPrefix(const std::string className) {
- m_method_prefix = m_method_prefix + className + "::";
-}
-
-void CPPClassInfo::addMember(const VariableInfo& member) {
- m_members.push_back(member);
-}
-
-void CPPClassInfo::addNamespace(std::vector<std::string>& inNamespaceVector) {
- for (std::vector<std::string>::iterator itr = inNamespaceVector.begin();
- itr != inNamespaceVector.end(); ++itr) {
- m_NamespacesList.push_back(*itr);
- }
-}
-
-CPPClassInfo::CPPClassInfo() { m_method_prefix = ""; }
-
-CPPClassInfo::~CPPClassInfo() {}
-
-// CPPHeaderParser definitions
-
-void CPPHeaderParser::beginClassDefinition(TypeSpecifier ts, const char* tag) {
- CPPParser::beginClassDefinition(ts, tag);
- m_currentClassesVector.push_back(new CPPClassInfo());
- m_currentClassesVector.back()->setHeaderName(getFilename());
- m_currentClassesVector.back()->setClassName(tag);
-
- if (m_currentClassesVector.size() > 1) {
- for (std::vector<CPPClassInfo*>::iterator iter =
- m_currentClassesVector.begin();
- iter != m_currentClassesVector.end() - 1; ++iter) {
- m_currentClassesVector.back()->setMethodPrefix((*iter)->getName());
- }
- }
- m_currentClassScope = symbols->getCurrentScopeIndex();
-}
-
-void CPPHeaderParser::exitNamespaceScope() { m_namespaceVector.pop_back(); }
-
-void CPPHeaderParser::endClassDefinition() {
- CPPParser::endClassDefinition();
- if (m_currentClassesVector.size() == 0) return;
- if (m_arraySizeRefMap.size() > 0) {
- for (VariableVector::iterator memberIterator =
- m_currentClassesVector.back()->m_members.begin();
- memberIterator != m_currentClassesVector.back()->m_members.end();
- memberIterator++) {
- StringMap::const_iterator findMember =
- m_arraySizeRefMap.find(memberIterator->m_name);
- if (findMember != m_arraySizeRefMap.end()) {
- memberIterator->m_type.m_kind |= TypeKind::ARRAY;
- memberIterator->m_type.m_nameOrSize = findMember->second;
- Log::info(ModuleName,
- "Using \"" + findMember->second + "\" as size of array \"" +
- memberIterator->m_name + '"');
- }
-
- StringMap::const_iterator findMemberElem =
- m_arrayElemSizeRefMap.find(memberIterator->m_name);
- if (findMemberElem != m_arrayElemSizeRefMap.end()) {
- memberIterator->m_type.m_kind |= TypeKind::ARRAY;
- memberIterator->m_type.m_nameOfArrayElemSize = findMemberElem->second;
- Log::info(ModuleName,
- "Using \"" + findMemberElem->second +
- "\" as size of array \"" + memberIterator->m_name + '"');
- }
- }
- }
- /*
- * add the namespace informaton here
- */
- m_currentClassesVector.back()->addNamespace(m_namespaceVector);
-
- m_classes[m_currentClassesVector.back()->getName()] = std::make_pair(
- static_cast<ClassInfo*>(m_currentClassesVector.back()), m_selectAll);
- m_currentClassesVector.pop_back();
- m_currentClassScope = -1;
-}
-
-void CPPHeaderParser::declaratorID(const char* id, QualifiedItem item) {
- CPPParser::declaratorID(id, item);
- if (item == qiNamespace) {
- m_namespaceVector.push_back(id);
- }
- if (m_currentClassesVector.size() != 0 && m_currentClassScope >= 0 &&
- m_currentClassScope == symbols->getCurrentScopeIndex()) {
- if (item == qiVar) { // check if this is a member field declaration
- if (m_currentInclude && m_currentArraySizeRef.length() == 0 &&
- m_currentArrayElemSizeRef.length() == 0) {
- VariableInfo var;
-
- var.m_type.m_kind = TypeKind::VALUE;
- var.m_type.m_modifier = TypeModifier::NONE;
- var.m_type.m_children = NULL;
- var.m_type.m_numChildren = 0;
- var.m_name = id;
- if (m_markIdentityField == true) {
- var.m_markIdentityField = true;
- } else {
- var.m_markIdentityField = false;
- }
-
- if (m_markPdxUnreadField == true) {
- var.m_markPdxUnreadField = true;
- } else {
- var.m_markPdxUnreadField = false;
- }
-
- m_currentClassesVector.back()->addMember(var);
- }
- /*else if ( item == qiType ) {
- m_currentClass->addNamespace(id);
- }*/
- else if (m_currentArraySizeRef.length() > 0) {
- if (NULL == strchr(m_currentArraySizeRef.c_str(), ',')) {
- m_arraySizeRefMap[m_currentArraySizeRef] = id;
- } else {
- m_currentArraySizeRef.erase(m_currentArraySizeRef.begin());
- m_currentArraySizeRef.erase(m_currentArraySizeRef.end() - 1);
- char* p =
- strtok(const_cast<char*>(m_currentArraySizeRef.c_str()), ",");
- while (p) {
- m_arraySizeRefMap[p] = id;
- p = strtok(NULL, ",");
- }
- }
- } else if (m_currentArrayElemSizeRef.length() > 0) {
- // std::cout << "Map Entries --> " << "m_arrayElemSizeRefMap[" <<
- // m_currentArrayElemSizeRef <<"] = " << id << std::endl;
- m_arrayElemSizeRefMap[m_currentArrayElemSizeRef] = id;
- }
- }
- }
- // m_currentInclude = true;
- m_currentArraySizeRef = "";
- m_currentArrayElemSizeRef = "";
-}
-
-void CPPHeaderParser::declarationSpecifier(bool td, bool fd, StorageClass sc,
- TypeQualifier tq, TypeSpecifier ts,
- FunctionSpecifier fs) {
- CPPParser::declarationSpecifier(td, fd, sc, tq, ts, fs);
- if ((tq & tqCONST) || ((tq & tqGFEXCLUDE) && !(tq & tqGFINCLUDE))) {
- m_currentInclude = false;
- } else {
- m_currentInclude = true;
- }
- if (tq & tqGFID) {
- m_markIdentityField = true;
- } else {
- m_markIdentityField = false;
- }
- if (tq & tqGFUNREAD) {
- m_markPdxUnreadField = true;
- } else {
- m_markPdxUnreadField = false;
- }
-}
-
-void CPPHeaderParser::gfArraySize(const char* id) {
- m_currentArraySizeRef = id;
-}
-
-void CPPHeaderParser::gfArrayElemSize(const char* id) {
- m_currentArrayElemSizeRef = id;
-}
-
-CPPHeaderParser::CPPHeaderParser(CPPLexer& lexer, ASClassFlagMap& classes,
- const bool selectAll)
- : CPPParser(lexer),
- m_classes(classes),
- m_selectAll(selectAll),
- m_currentClassesVector(std::vector<CPPClassInfo*>()),
- m_currentClassScope(-1),
- m_currentInclude(true),
- m_markIdentityField(false),
- m_markPdxUnreadField(false) {}
-
-// CPPInputParser definitions
-
-void CPPInputParser::getOptions(OptionMap& options) const {}
-
-void CPPInputParser::init(PropertyMap& properties) {}
-
-void CPPInputParser::selectClasses(const StringVector& resources,
- const StringVector& classNames) {
-#ifndef _DEBUG
- statementTrace = 0;
-#endif
- statementTrace = 0;
- bool selectAll = (classNames.size() == 0);
- for (StringVectorIterator resourceIterator = resources.begin();
- resourceIterator != resources.end(); ++resourceIterator) {
- try {
- std::ifstream istream(resourceIterator->c_str());
- CPPLexer lexer(istream);
- CPPHeaderParser parser(lexer, m_classes, selectAll);
- parser.init();
- parser.setFilename(*resourceIterator);
- parser.translation_unit();
- } catch (const ANTLRException& ex) {
- throw std::invalid_argument(ex.getMessage());
- }
- }
-
- for (StringVectorIterator classIterator = classNames.begin();
- classIterator != classNames.end(); ++classIterator) {
- if (!select(*classIterator)) {
- std::string warnMsg =
- "Could not load class '" + *classIterator + "'; skipping it.";
- Log::warn(ModuleName, warnMsg);
- }
- }
-}
-
-CPPInputParser::CPPInputParser() {}
-
-InputParser* CPPInputParser::create() { return new CPPInputParser(); }
-
-CPPInputParser::~CPPInputParser() {}
-} // namespace pdx_auto_serializer
-} // namespace client
-} // namespace geode
-} // namespace apache
diff --git a/contrib/pdxautoserializer/src/impl/CPPParser/CPPInputParser.hpp b/contrib/pdxautoserializer/src/impl/CPPParser/CPPInputParser.hpp
deleted file mode 100644
index 030ff07..0000000
--- a/contrib/pdxautoserializer/src/impl/CPPParser/CPPInputParser.hpp
+++ /dev/null
@@ -1,189 +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.
- */
-
-#ifndef _GFAS_CPPINPUTPARSER_HPP_
-#define _GFAS_CPPINPUTPARSER_HPP_
-
-#include "../../InputParser.hpp"
-#include "CPPLexer.hpp"
-#include "CPPParser.hpp"
-
-namespace apache {
-namespace geode {
-namespace client {
-namespace pdx_auto_serializer {
-class CPPHeaderParser;
-
-/**
- * This class implements <code>ClassInfo</code> interface for C++.
- */
-class CPPClassInfo : public ClassInfo {
- public:
- // ClassInfo implementations
-
- virtual std::string getName() const;
-
- virtual void getReferences(ReferenceVector& references) const;
-
- virtual void getTypeInfo(TypeInfo& classType) const;
-
- virtual void getMembers(VariableVector& members) const;
-
- // Setter methods for various fields.
-
- void setHeaderName(const std::string headerName);
-
- void setClassName(const std::string className);
-
- void addMember(const VariableInfo& member);
-
- void addNamespace(std::vector<std::string>& inNamespaceVector);
-
- /** Default constructor. */
- CPPClassInfo();
-
- /** Virtual destructor. */
- virtual ~CPPClassInfo();
-
- void setMethodPrefix(const std::string className);
- virtual std::string getMethodPrefix() const;
-
- private:
- /** The name of the header file containing this class. */
- std::string m_headerName;
-
- /** The name of the class. */
- std::string m_className;
-
- /** Vector of the members of the class. */
- VariableVector m_members;
-
- std::vector<std::string> m_NamespacesList;
-
- std::string m_method_prefix;
-
- friend class CPPHeaderParser;
- friend class CPPInputParser;
-};
-
-/** This class parses the classes from header files. */
-class CPPHeaderParser : public CPPParser {
- public:
- /**
- * Construct the object using the given <code>CPPLexer</code>.
- *
- * @param lexer The <code>CPPLexer</code> used as the tokenizer.
- * @param classes The global classes map to be populated.
- * @param selectAll True to mark all the classes as selected.
- */
- CPPHeaderParser(CPPLexer& lexer, ASClassFlagMap& classes,
- const bool selectAll);
-
- // CPPParser overrides
-
- virtual void beginClassDefinition(TypeSpecifier ts, const char* tag);
-
- virtual void exitNamespaceScope();
-
- virtual void endClassDefinition();
-
- virtual void declaratorID(const char* id, QualifiedItem item);
-
- virtual void declarationSpecifier(bool td, bool fd, StorageClass sc,
- TypeQualifier tq, TypeSpecifier ts,
- FunctionSpecifier fs);
-
- virtual void gfArraySize(const char* id);
-
- virtual void gfArrayElemSize(const char* id);
-
- private:
- /** Accumulates the classes as the classes are parsed. */
- ASClassFlagMap& m_classes;
-
- /** True to mark all the classes as selected. */
- const bool m_selectAll;
-
- /** Stores the current class being parsed. */
- std::vector<CPPClassInfo*> m_currentClassesVector;
-
- /** The scope of the current class. */
- int m_currentClassScope;
-
- /** True when the current field has to be excluded. */
- bool m_currentInclude;
-
- /** True when the current fiels is marked as identify field */
- bool m_markIdentityField;
-
- bool m_markPdxUnreadField;
-
- /**
- * If the current field is an array size specification of field 'x',
- * then this stores the name of 'x'.
- */
- std::string m_currentArraySizeRef;
-
- std::string m_currentArrayElemSizeRef;
-
- /**
- * The map of all fields that are array sizes for other fields.
- */
- StringMap m_arraySizeRefMap;
- StringMap m_arrayElemSizeRefMap;
-
- std::vector<std::string> m_namespaceVector;
-};
-
-/**
- * This class implements <code>InputParser</code> interface for C++.
- */
-class CPPInputParser : public InputParser {
- public:
- // InputParser implementations
-
- virtual void getOptions(OptionMap& options) const;
-
- virtual void init(PropertyMap& properties);
-
- virtual void selectClasses(const StringVector& resources,
- const StringVector& classNames);
-
- /**
- * Defines the static function returning an <code>InputParser</code>
- * object, which is registered with <code>InputParserFactory</code>.
- *
- * @return The <code>InputParser</code> object.
- */
- static InputParser* create();
-
- /** @brief Virtual destructor. */
- virtual ~CPPInputParser();
-
- private:
- /**
- * Default constructor -- this is not exposed to public which should use
- * the {@link CPPInputParser::create} function.
- */
- CPPInputParser();
-};
-} // namespace pdx_auto_serializer
-} // namespace client
-} // namespace geode
-} // namespace apache
-
-#endif // _GFAS_CPPINPUTPARSER_HPP_
diff --git a/contrib/pdxautoserializer/src/impl/CPPParser/CPPLexer.cpp b/contrib/pdxautoserializer/src/impl/CPPParser/CPPLexer.cpp
deleted file mode 100644
index 2094032..0000000
--- a/contrib/pdxautoserializer/src/impl/CPPParser/CPPLexer.cpp
+++ /dev/null
@@ -1,2832 +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.
- */
-/* $ANTLR 2.7.7 (20130409): "CPP_parser.g" -> "CPPLexer.cpp"$ */
-#ifndef _WIN32
-#include <stdio.h>
-#include <strings.h>
-#endif
-#include "CPPLexer.hpp"
-#include <antlr/CharBuffer.hpp>
-#include <antlr/TokenStreamException.hpp>
-#include <antlr/TokenStreamIOException.hpp>
-#include <antlr/TokenStreamRecognitionException.hpp>
-#include <antlr/CharStreamException.hpp>
-#include <antlr/CharStreamIOException.hpp>
-#include <antlr/NoViableAltForCharException.hpp>
-
-#line 1 "CPP_parser.g"
-#line 13 "CPPLexer.cpp"
-CPPLexer::CPPLexer(ANTLR_USE_NAMESPACE(std) istream& in)
- : ANTLR_USE_NAMESPACE(antlr)
- CharScanner(new ANTLR_USE_NAMESPACE(antlr) CharBuffer(in), true) {
- initLiterals();
-}
-
-CPPLexer::CPPLexer(ANTLR_USE_NAMESPACE(antlr) InputBuffer& ib)
- : ANTLR_USE_NAMESPACE(antlr) CharScanner(ib, true) {
- initLiterals();
-}
-
-CPPLexer::CPPLexer(const ANTLR_USE_NAMESPACE(antlr)
- LexerSharedInputState& state)
- : ANTLR_USE_NAMESPACE(antlr) CharScanner(state, true) {
- initLiterals();
-}
-
-void CPPLexer::initLiterals() {
- literals["_cdecl"] = 164;
- literals["__stdcall"] = 26;
- literals["extern"] = 20;
- literals["public"] = 82;
- literals["namespace"] = 14;
- literals["case"] = 98;
- literals["short"] = 48;
- literals["break"] = 108;
- literals["while"] = 103;
- literals["__int8"] = 51;
- literals["delete"] = 174;
- literals["new"] = 163;
- literals["__declspec"] = 75;
- literals["uint32_t"] = 64;
- literals["int16_t"] = 55;
- literals["_int32"] = 56;
- literals["GFID"] = 29;
- literals["GFARRAYSIZE"] = 31;
- literals["__pascal"] = 173;
- literals["template"] = 4;
- literals["GFEXCLUDE"] = 27;
- literals["reinterpret_cast"] = 152;
- literals["inline"] = 12;
- literals["unsigned"] = 70;
- literals["const"] = 76;
- literals["float"] = 71;
- literals["_int8"] = 50;
- literals["__int16"] = 54;
- literals["static_cast"] = 151;
- literals["return"] = 109;
- literals["throw"] = 96;
- literals["int64_t"] = 61;
- literals["typename"] = 44;
- literals["using"] = 97;
- literals["operator"] = 85;
- literals["__far"] = 169;
- literals["sizeof"] = 145;
- literals["protected"] = 83;
- literals["class"] = 24;
- literals["_stdcall"] = 25;
- literals["friend"] = 13;
- literals["do"] = 104;
- literals["__interrupt"] = 170;
- literals["_far"] = 168;
- literals["typeid"] = 154;
- literals["__volatile__"] = 79;
- literals["__alignof__"] = 146;
- literals["__cdecl"] = 165;
- literals["_int64"] = 59;
- literals["__asm"] = 114;
- literals["pascal"] = 171;
- literals["typedef"] = 7;
- literals["__const"] = 77;
- literals["const_cast"] = 153;
- literals["__asm__"] = 115;
- literals["uint16_t"] = 63;
- literals["explicit"] = 43;
- literals["_asm"] = 113;
- literals["if"] = 100;
- literals["__int32"] = 57;
- literals["double"] = 72;
- literals["volatile"] = 78;
- literals["catch"] = 111;
- literals["dynamic_cast"] = 150;
- literals["union"] = 23;
- literals["try"] = 110;
- literals["register"] = 37;
- literals["_inline"] = 40;
- literals["auto"] = 36;
- literals["GFINCLUDE"] = 28;
- literals["goto"] = 106;
- literals["enum"] = 9;
- literals["int"] = 49;
- literals["for"] = 105;
- literals["int32_t"] = 58;
- literals["uint64_t"] = 65;
- literals["char"] = 45;
- literals["__near"] = 167;
- literals["private"] = 84;
- literals["GFARRAYELEMSIZE"] = 35;
- literals["default"] = 99;
- literals["false"] = 88;
- literals["this"] = 86;
- literals["static"] = 38;
- literals["mutable"] = 39;
- literals["int8_t"] = 52;
- literals["GFARRAYSIZES"] = 34;
- literals["uint8_t"] = 62;
- literals["_int16"] = 53;
- literals["continue"] = 107;
- literals["bool"] = 47;
- literals["struct"] = 22;
- literals["GFUNREAD"] = 30;
- literals["_near"] = 166;
- literals["__int64"] = 60;
- literals["signed"] = 69;
- literals["GFIGNORE"] = 80;
- literals["else"] = 101;
- literals["_declspec"] = 74;
- literals["_pascal"] = 172;
- literals["__w64"] = 67;
- literals["antlrTrace_on"] = 15;
- literals["void"] = 73;
- literals["antlrTrace_off"] = 16;
- literals["wchar_t"] = 46;
- literals["switch"] = 102;
- literals["__inline"] = 41;
- literals["true"] = 87;
- literals["long"] = 68;
- literals["asm"] = 112;
- literals["virtual"] = 42;
- literals["_w64"] = 66;
-}
-
-ANTLR_USE_NAMESPACE(antlr) RefToken CPPLexer::nextToken() {
- ANTLR_USE_NAMESPACE(antlr) RefToken theRetToken;
- for (;;) {
- ANTLR_USE_NAMESPACE(antlr) RefToken theRetToken;
- int _ttype = ANTLR_USE_NAMESPACE(antlr) Token::INVALID_TYPE;
- resetText();
- try { // for lexical and char stream error handling
- switch (LA(1)) {
- case 0x2c /* ',' */: {
- mCOMMA(true);
- theRetToken = _returnToken;
- break;
- }
- case 0x3f /* '?' */: {
- mQUESTIONMARK(true);
- theRetToken = _returnToken;
- break;
- }
- case 0x3b /* ';' */: {
- mSEMICOLON(true);
- theRetToken = _returnToken;
- break;
- }
- case 0x28 /* '(' */: {
- mLPAREN(true);
- theRetToken = _returnToken;
- break;
- }
- case 0x29 /* ')' */: {
- mRPAREN(true);
- theRetToken = _returnToken;
- break;
- }
- case 0x5b /* '[' */: {
- mLSQUARE(true);
- theRetToken = _returnToken;
- break;
- }
- case 0x5d /* ']' */: {
- mRSQUARE(true);
- theRetToken = _returnToken;
- break;
- }
- case 0x7b /* '{' */: {
- mLCURLY(true);
- theRetToken = _returnToken;
- break;
- }
- case 0x7d /* '}' */: {
- mRCURLY(true);
- theRetToken = _returnToken;
- break;
- }
- case 0x7e /* '~' */: {
- mTILDE(true);
- theRetToken = _returnToken;
- break;
- }
- case 0x9 /* '\t' */:
- case 0xa /* '\n' */:
- case 0xc /* '\14' */:
- case 0xd /* '\r' */:
- case 0x20 /* ' ' */:
- case 0x5c /* '\\' */: {
- mWhitespace(true);
- theRetToken = _returnToken;
- break;
- }
- case 0x23 /* '#' */: {
- mPREPROC_DIRECTIVE(true);
- theRetToken = _returnToken;
- break;
- }
- case 0x22 /* '\"' */: {
- mStringLiteral(true);
- theRetToken = _returnToken;
- break;
- }
- case 0x27 /* '\'' */: {
- mCharLiteral(true);
- theRetToken = _returnToken;
- break;
- }
- default:
- if ((LA(1) == 0x3e /* '>' */) && (LA(2) == 0x3e /* '>' */) &&
- (LA(3) == 0x3d /* '=' */)) {
- mSHIFTRIGHTEQUAL(true);
- theRetToken = _returnToken;
- } else if ((LA(1) == 0x3c /* '<' */) && (LA(2) == 0x3c /* '<' */) &&
- (LA(3) == 0x3d /* '=' */)) {
- mSHIFTLEFTEQUAL(true);
- theRetToken = _returnToken;
- } else if ((LA(1) == 0x2d /* '-' */) && (LA(2) == 0x3e /* '>' */) &&
- (LA(3) == 0x2a /* '*' */)) {
- mPOINTERTOMBR(true);
- theRetToken = _returnToken;
- } else if ((LA(1) == 0x2d /* '-' */) && (LA(2) == 0x3e /* '>' */) &&
- (true)) {
- mPOINTERTO(true);
- theRetToken = _returnToken;
- } else if ((LA(1) == 0x3d /* '=' */) && (LA(2) == 0x3d /* '=' */)) {
- mEQUAL(true);
- theRetToken = _returnToken;
- } else if ((LA(1) == 0x21 /* '!' */) && (LA(2) == 0x3d /* '=' */)) {
- mNOTEQUAL(true);
- theRetToken = _returnToken;
- } else if ((LA(1) == 0x3c /* '<' */) && (LA(2) == 0x3d /* '=' */)) {
- mLESSTHANOREQUALTO(true);
- theRetToken = _returnToken;
- } else if ((LA(1) == 0x3e /* '>' */) && (LA(2) == 0x3d /* '=' */)) {
- mGREATERTHANOREQUALTO(true);
- theRetToken = _returnToken;
- } else if ((LA(1) == 0x2f /* '/' */) && (LA(2) == 0x3d /* '=' */)) {
- mDIVIDEEQUAL(true);
- theRetToken = _returnToken;
- } else if ((LA(1) == 0x2b /* '+' */) && (LA(2) == 0x3d /* '=' */)) {
- mPLUSEQUAL(true);
- theRetToken = _returnToken;
- } else if ((LA(1) == 0x2b /* '+' */) && (LA(2) == 0x2b /* '+' */)) {
- mPLUSPLUS(true);
- theRetToken = _returnToken;
- } else if ((LA(1) == 0x2d /* '-' */) && (LA(2) == 0x3d /* '=' */)) {
- mMINUSEQUAL(true);
- theRetToken = _returnToken;
- } else if ((LA(1) == 0x2d /* '-' */) && (LA(2) == 0x2d /* '-' */)) {
- mMINUSMINUS(true);
- theRetToken = _returnToken;
- } else if ((LA(1) == 0x2a /* '*' */) && (LA(2) == 0x3d /* '=' */)) {
- mTIMESEQUAL(true);
- theRetToken = _returnToken;
- } else if ((LA(1) == 0x25 /* '%' */) && (LA(2) == 0x3d /* '=' */)) {
- mMODEQUAL(true);
- theRetToken = _returnToken;
- } else if ((LA(1) == 0x3e /* '>' */) && (LA(2) == 0x3e /* '>' */) &&
- (true)) {
- mSHIFTRIGHT(true);
- theRetToken = _returnToken;
- } else if ((LA(1) == 0x3c /* '<' */) && (LA(2) == 0x3c /* '<' */) &&
- (true)) {
- mSHIFTLEFT(true);
- theRetToken = _returnToken;
- } else if ((LA(1) == 0x26 /* '&' */) && (LA(2) == 0x26 /* '&' */)) {
- mAND(true);
- theRetToken = _returnToken;
- } else if ((LA(1) == 0x7c /* '|' */) && (LA(2) == 0x7c /* '|' */)) {
- mOR(true);
- theRetToken = _returnToken;
- } else if ((LA(1) == 0x26 /* '&' */) && (LA(2) == 0x3d /* '=' */)) {
- mBITWISEANDEQUAL(true);
- theRetToken = _returnToken;
- } else if ((LA(1) == 0x7c /* '|' */) && (LA(2) == 0x3d /* '=' */)) {
- mBITWISEOREQUAL(true);
- theRetToken = _returnToken;
- } else if ((LA(1) == 0x5e /* '^' */) && (LA(2) == 0x3d /* '=' */)) {
- mBITWISEXOREQUAL(true);
- theRetToken = _returnToken;
- } else if ((LA(1) == 0x2e /* '.' */) && (LA(2) == 0x2a /* '*' */)) {
- mDOTMBR(true);
- theRetToken = _returnToken;
- } else if ((LA(1) == 0x3a /* ':' */) && (LA(2) == 0x3a /* ':' */)) {
- mSCOPE(true);
- theRetToken = _returnToken;
- } else if ((LA(1) == 0x2f /* '/' */) && (LA(2) == 0x2a /* '*' */)) {
- mComment(true);
- theRetToken = _returnToken;
- } else if ((LA(1) == 0x2f /* '/' */) && (LA(2) == 0x2f /* '/' */)) {
- mCPPComment(true);
- theRetToken = _returnToken;
- } else if ((LA(1) == 0x4c /* 'L' */) && (LA(2) == 0x27 /* '\'' */)) {
- mWCharLiteral(true);
- theRetToken = _returnToken;
- } else if ((LA(1) == 0x4c /* 'L' */) && (LA(2) == 0x22 /* '\"' */)) {
- mWStringLiteral(true);
- theRetToken = _returnToken;
- } else if ((LA(1) == 0x3d /* '=' */) && (true)) {
- mASSIGNEQUAL(true);
- theRetToken = _returnToken;
- } else if ((LA(1) == 0x3a /* ':' */) && (true)) {
- mCOLON(true);
- theRetToken = _returnToken;
- } else if ((LA(1) == 0x3c /* '<' */) && (true)) {
- mLESSTHAN(true);
- theRetToken = _returnToken;
- } else if ((LA(1) == 0x3e /* '>' */) && (true)) {
- mGREATERTHAN(true);
- theRetToken = _returnToken;
- } else if ((LA(1) == 0x2f /* '/' */) && (true)) {
- mDIVIDE(true);
- theRetToken = _returnToken;
- } else if ((LA(1) == 0x2b /* '+' */) && (true)) {
- mPLUS(true);
- theRetToken = _returnToken;
- } else if ((LA(1) == 0x2d /* '-' */) && (true)) {
- mMINUS(true);
- theRetToken = _returnToken;
- } else if ((LA(1) == 0x2a /* '*' */) && (true)) {
- mSTAR(true);
- theRetToken = _returnToken;
- } else if ((LA(1) == 0x25 /* '%' */) && (true)) {
- mMOD(true);
- theRetToken = _returnToken;
- } else if ((LA(1) == 0x21 /* '!' */) && (true)) {
- mNOT(true);
- theRetToken = _returnToken;
- } else if ((LA(1) == 0x26 /* '&' */) && (true)) {
- mAMPERSAND(true);
- theRetToken = _returnToken;
- } else if ((LA(1) == 0x7c /* '|' */) && (true)) {
- mBITWISEOR(true);
- theRetToken = _returnToken;
- } else if ((LA(1) == 0x5e /* '^' */) && (true)) {
- mBITWISEXOR(true);
- theRetToken = _returnToken;
- } else if ((_tokenSet_0.member(LA(1))) && (true)) {
- mNumber(true);
- theRetToken = _returnToken;
- } else if ((_tokenSet_1.member(LA(1))) && (true)) {
- mID(true);
- theRetToken = _returnToken;
- } else {
- if (LA(1) == EOF_CHAR) {
- uponEOF();
- _returnToken =
- makeToken(ANTLR_USE_NAMESPACE(antlr) Token::EOF_TYPE);
- } else {
- throw ANTLR_USE_NAMESPACE(antlr) NoViableAltForCharException(
- LA(1), getFilename(), getLine(), getColumn());
- }
- }
- }
- if (!_returnToken) goto tryAgain; // found SKIP token
-
- _ttype = _returnToken->getType();
- _ttype = testLiteralsTable(_ttype);
- _returnToken->setType(_ttype);
- return _returnToken;
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& e) {
- throw ANTLR_USE_NAMESPACE(antlr) TokenStreamRecognitionException(e);
- } catch (ANTLR_USE_NAMESPACE(antlr) CharStreamIOException& csie) {
- throw ANTLR_USE_NAMESPACE(antlr) TokenStreamIOException(csie.io);
- } catch (ANTLR_USE_NAMESPACE(antlr) CharStreamException& cse) {
- throw ANTLR_USE_NAMESPACE(antlr) TokenStreamException(cse.getMessage());
- }
- tryAgain:;
- }
-}
-
-void CPPLexer::mASSIGNEQUAL(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = ASSIGNEQUAL;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match('=' /* charlit */);
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mCOLON(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = COLON;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match(':' /* charlit */);
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mCOMMA(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = COMMA;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match(',' /* charlit */);
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mQUESTIONMARK(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = QUESTIONMARK;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match('?' /* charlit */);
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mSEMICOLON(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = SEMICOLON;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match(';' /* charlit */);
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mPOINTERTO(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = POINTERTO;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match("->");
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mLPAREN(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = LPAREN;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match('(' /* charlit */);
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mRPAREN(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = RPAREN;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match(')' /* charlit */);
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mLSQUARE(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = LSQUARE;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match('[' /* charlit */);
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mRSQUARE(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = RSQUARE;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match(']' /* charlit */);
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mLCURLY(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = LCURLY;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match('{' /* charlit */);
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mRCURLY(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = RCURLY;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match('}' /* charlit */);
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mEQUAL(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = EQUAL;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match("==");
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mNOTEQUAL(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = NOTEQUAL;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match("!=");
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mLESSTHANOREQUALTO(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = LESSTHANOREQUALTO;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match("<=");
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mLESSTHAN(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = LESSTHAN;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match("<");
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mGREATERTHANOREQUALTO(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = GREATERTHANOREQUALTO;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match(">=");
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mGREATERTHAN(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = GREATERTHAN;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match(">");
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mDIVIDE(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = DIVIDE;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match('/' /* charlit */);
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mDIVIDEEQUAL(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = DIVIDEEQUAL;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match("/=");
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mPLUS(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = PLUS;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match('+' /* charlit */);
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mPLUSEQUAL(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = PLUSEQUAL;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match("+=");
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mPLUSPLUS(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = PLUSPLUS;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match("++");
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mMINUS(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = MINUS;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match('-' /* charlit */);
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mMINUSEQUAL(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = MINUSEQUAL;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match("-=");
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mMINUSMINUS(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = MINUSMINUS;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match("--");
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mSTAR(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = STAR;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match('*' /* charlit */);
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mTIMESEQUAL(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = TIMESEQUAL;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match("*=");
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mMOD(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = MOD;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match('%' /* charlit */);
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mMODEQUAL(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = MODEQUAL;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match("%=");
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mSHIFTRIGHT(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = SHIFTRIGHT;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match(">>");
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mSHIFTRIGHTEQUAL(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = SHIFTRIGHTEQUAL;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match(">>=");
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mSHIFTLEFT(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = SHIFTLEFT;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match("<<");
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mSHIFTLEFTEQUAL(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = SHIFTLEFTEQUAL;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match("<<=");
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mAND(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = AND;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match("&&");
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mNOT(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = NOT;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match('!' /* charlit */);
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mOR(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = OR;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match("||");
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mAMPERSAND(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = AMPERSAND;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match('&' /* charlit */);
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mBITWISEANDEQUAL(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = BITWISEANDEQUAL;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match("&=");
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mTILDE(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = TILDE;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match('~' /* charlit */);
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mBITWISEOR(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = BITWISEOR;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match('|' /* charlit */);
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mBITWISEOREQUAL(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = BITWISEOREQUAL;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match("|=");
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mBITWISEXOR(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = BITWISEXOR;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match('^' /* charlit */);
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mBITWISEXOREQUAL(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = BITWISEXOREQUAL;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match("^=");
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mPOINTERTOMBR(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = POINTERTOMBR;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match("->*");
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mDOTMBR(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = DOTMBR;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match(".*");
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mSCOPE(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = SCOPE;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match("::");
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mWhitespace(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = Whitespace;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- {
- switch (LA(1)) {
- case 0x9 /* '\t' */:
- case 0xc /* '\14' */:
- case 0x20 /* ' ' */: {
- {
- switch (LA(1)) {
- case 0x20 /* ' ' */: {
- match(' ' /* charlit */);
- break;
- }
- case 0x9 /* '\t' */: {
- match('\t' /* charlit */);
- break;
- }
- case 0xc /* '\14' */: {
- match('\14' /* charlit */);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr) NoViableAltForCharException(
- LA(1), getFilename(), getLine(), getColumn());
- }
- }
- }
- break;
- }
- case 0xa /* '\n' */:
- case 0xd /* '\r' */: {
- {
- if ((LA(1) == 0xd /* '\r' */) && (LA(2) == 0xa /* '\n' */)) {
- match('\r' /* charlit */);
- match('\n' /* charlit */);
- } else if ((LA(1) == 0xd /* '\r' */) && (true)) {
- match('\r' /* charlit */);
- } else if ((LA(1) == 0xa /* '\n' */)) {
- match('\n' /* charlit */);
- } else {
- throw ANTLR_USE_NAMESPACE(antlr) NoViableAltForCharException(
- LA(1), getFilename(), getLine(), getColumn());
- }
- }
- if (inputState->guessing == 0) {
-#line 2391 "CPP_parser.g"
- newline();
-#line 1165 "CPPLexer.cpp"
- }
- break;
- }
- case 0x5c /* '\\' */: {
- {
- if ((LA(1) == 0x5c /* '\\' */) && (LA(2) == 0xd /* '\r' */) &&
- (LA(3) == 0xa /* '\n' */)) {
- match('\\' /* charlit */);
- match('\r' /* charlit */);
- match('\n' /* charlit */);
- } else if ((LA(1) == 0x5c /* '\\' */) && (LA(2) == 0xd /* '\r' */) &&
- (true)) {
- match('\\' /* charlit */);
- match('\r' /* charlit */);
- } else if ((LA(1) == 0x5c /* '\\' */) && (LA(2) == 0xa /* '\n' */)) {
- match('\\' /* charlit */);
- match('\n' /* charlit */);
- } else {
- throw ANTLR_USE_NAMESPACE(antlr) NoViableAltForCharException(
- LA(1), getFilename(), getLine(), getColumn());
- }
- }
- if (inputState->guessing == 0) {
-#line 2396 "CPP_parser.g"
- printf("CPP_parser.g continuation line detected\n");
- deferredNewline();
-#line 1194 "CPPLexer.cpp"
- }
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr) NoViableAltForCharException(
- LA(1), getFilename(), getLine(), getColumn());
- }
- }
- }
- if (inputState->guessing == 0) {
-#line 2399 "CPP_parser.g"
- _ttype = ANTLR_USE_NAMESPACE(antlr) Token::SKIP;
-#line 1207 "CPPLexer.cpp"
- }
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mComment(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = Comment;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match("/*");
- { // ( ... )*
- for (;;) {
- if (((LA(1) == 0x2a /* '*' */) &&
- ((LA(2) >= 0x0 /* '\0' */ && LA(2) <= 0xff)) &&
- ((LA(3) >= 0x0 /* '\0' */ && LA(3) <= 0xff))) &&
- (LA(2) != '/')) {
- match('*' /* charlit */);
- } else if ((LA(1) == 0xa /* '\n' */ || LA(1) == 0xd /* '\r' */)) {
- mEndOfLine(false);
- if (inputState->guessing == 0) {
-#line 2406 "CPP_parser.g"
- deferredNewline();
-#line 1233 "CPPLexer.cpp"
- }
- } else if ((_tokenSet_2.member(LA(1)))) {
- { match(_tokenSet_2); }
- } else {
- goto _loop653;
- }
- }
- _loop653:;
- } // ( ... )*
- match("*/");
- if (inputState->guessing == 0) {
-#line 2409 "CPP_parser.g"
- _ttype = ANTLR_USE_NAMESPACE(antlr) Token::SKIP;
-#line 1252 "CPPLexer.cpp"
- }
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mEndOfLine(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = EndOfLine;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- {
- if ((LA(1) == 0xd /* '\r' */) && (LA(2) == 0xa /* '\n' */) && (true)) {
- match("\r\n");
- } else if ((LA(1) == 0xd /* '\r' */) && (true) && (true)) {
- match('\r' /* charlit */);
- } else if ((LA(1) == 0xa /* '\n' */)) {
- match('\n' /* charlit */);
- } else {
- throw ANTLR_USE_NAMESPACE(antlr) NoViableAltForCharException(
- LA(1), getFilename(), getLine(), getColumn());
- }
- }
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mCPPComment(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = CPPComment;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match("//");
- { // ( ... )*
- for (;;) {
- if ((_tokenSet_3.member(LA(1)))) {
- { match(_tokenSet_3); }
- } else {
- goto _loop657;
- }
- }
- _loop657:;
- } // ( ... )*
- mEndOfLine(false);
- if (inputState->guessing == 0) {
-#line 2415 "CPP_parser.g"
- _ttype = ANTLR_USE_NAMESPACE(antlr) Token::SKIP;
- newline();
-#line 1314 "CPPLexer.cpp"
- }
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mPREPROC_DIRECTIVE(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = PREPROC_DIRECTIVE;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- {
- match('#' /* charlit */);
- { // ( ... )*
- for (;;) {
- if ((_tokenSet_3.member(LA(1)))) {
- { match(_tokenSet_3); }
- } else {
- goto _loop662;
- }
- }
- _loop662:;
- } // ( ... )*
- mEndOfLine(false);
- }
- if (inputState->guessing == 0) {
-#line 2422 "CPP_parser.g"
- _ttype = ANTLR_USE_NAMESPACE(antlr) Token::SKIP;
- newline();
-#line 1350 "CPPLexer.cpp"
- }
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mLineDirective(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = LineDirective;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
- ANTLR_USE_NAMESPACE(antlr) RefToken n;
- ANTLR_USE_NAMESPACE(antlr) RefToken sl;
-
- {
- switch (LA(1)) {
- case 0x6c /* 'l' */: {
- match("line");
- break;
- }
- case 0x9 /* '\t' */:
- case 0xc /* '\14' */:
- case 0x20 /* ' ' */: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr) NoViableAltForCharException(
- LA(1), getFilename(), getLine(), getColumn());
- }
- }
- }
- { // ( ... )+
- int _cnt666 = 0;
- for (;;) {
- if ((LA(1) == 0x9 /* '\t' */ || LA(1) == 0xc /* '\14' */ ||
- LA(1) == 0x20 /* ' ' */)) {
- mSpace(false);
- } else {
- if (_cnt666 >= 1) {
- goto _loop666;
- } else {
- throw ANTLR_USE_NAMESPACE(antlr) NoViableAltForCharException(
- LA(1), getFilename(), getLine(), getColumn());
- }
- }
-
- _cnt666++;
- }
- _loop666:;
- } // ( ... )+
- mDecimal(true);
- n = _returnToken;
- { // ( ... )+
- int _cnt668 = 0;
- for (;;) {
- if ((LA(1) == 0x9 /* '\t' */ || LA(1) == 0xc /* '\14' */ ||
- LA(1) == 0x20 /* ' ' */)) {
- mSpace(false);
- } else {
- if (_cnt668 >= 1) {
- goto _loop668;
- } else {
- throw ANTLR_USE_NAMESPACE(antlr) NoViableAltForCharException(
- LA(1), getFilename(), getLine(), getColumn());
- }
- }
-
- _cnt668++;
- }
- _loop668:;
- } // ( ... )+
- {
- mStringLiteral(true);
- sl = _returnToken;
- }
- { // ( ... )*
- for (;;) {
- if ((LA(1) == 0x9 /* '\t' */ || LA(1) == 0xc /* '\14' */ ||
- LA(1) == 0x20 /* ' ' */)) {
- { // ( ... )+
- int _cnt672 = 0;
- for (;;) {
- if ((LA(1) == 0x9 /* '\t' */ || LA(1) == 0xc /* '\14' */ ||
- LA(1) == 0x20 /* ' ' */)) {
- mSpace(false);
- } else {
- if (_cnt672 >= 1) {
- goto _loop672;
- } else {
- throw ANTLR_USE_NAMESPACE(antlr) NoViableAltForCharException(
- LA(1), getFilename(), getLine(), getColumn());
- }
- }
-
- _cnt672++;
- }
- _loop672:;
- } // ( ... )+
- mDecimal(false);
- } else {
- goto _loop673;
- }
- }
- _loop673:;
- } // ( ... )*
- if (inputState->guessing == 0) {
-#line 2434 "CPP_parser.g"
-
- process_line_directive((sl->getText()).data(),
- (n->getText()).data()); // see main()
-
-#line 1451 "CPPLexer.cpp"
- }
- mEndOfLine(false);
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mSpace(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = Space;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- {
- switch (LA(1)) {
- case 0x20 /* ' ' */: {
- match(' ' /* charlit */);
- break;
- }
- case 0x9 /* '\t' */: {
- match('\t' /* charlit */);
- break;
- }
- case 0xc /* '\14' */: {
- match('\14' /* charlit */);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr) NoViableAltForCharException(
- LA(1), getFilename(), getLine(), getColumn());
- }
- }
- }
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mDecimal(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = Decimal;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- { // ( ... )+
- int _cnt710 = 0;
- for (;;) {
- if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */))) {
- matchRange('0', '9');
- } else {
- if (_cnt710 >= 1) {
- goto _loop710;
- } else {
- throw ANTLR_USE_NAMESPACE(antlr) NoViableAltForCharException(
- LA(1), getFilename(), getLine(), getColumn());
- }
- }
-
- _cnt710++;
- }
- _loop710:;
- } // ( ... )+
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mStringLiteral(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = StringLiteral;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match('\"' /* charlit */);
- { // ( ... )*
- for (;;) {
- if ((LA(1) == 0x5c /* '\\' */) && (_tokenSet_4.member(LA(2)))) {
- mEscape(false);
- } else if ((LA(1) == 0x5c /* '\\' */) &&
- (LA(2) == 0xa /* '\n' */ || LA(2) == 0xd /* '\r' */)) {
- {
- if ((LA(1) == 0x5c /* '\\' */) && (LA(2) == 0xd /* '\r' */) &&
- (LA(3) == 0xa /* '\n' */)) {
- match("\\\r\n");
- } else if ((LA(1) == 0x5c /* '\\' */) && (LA(2) == 0xd /* '\r' */) &&
- (_tokenSet_3.member(LA(3)))) {
- match("\\\r");
- } else if ((LA(1) == 0x5c /* '\\' */) && (LA(2) == 0xa /* '\n' */)) {
- match("\\\n");
- } else {
- throw ANTLR_USE_NAMESPACE(antlr) NoViableAltForCharException(
- LA(1), getFilename(), getLine(), getColumn());
- }
- }
- if (inputState->guessing == 0) {
-#line 2496 "CPP_parser.g"
- deferredNewline();
-#line 1555 "CPPLexer.cpp"
- }
- } else if ((_tokenSet_5.member(LA(1)))) {
- { match(_tokenSet_5); }
- } else {
- goto _loop694;
- }
- }
- _loop694:;
- } // ( ... )*
- match('\"' /* charlit */);
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mPragma(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = Pragma;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- {
- match('#' /* charlit */);
- match("pragma");
- { // ( ... )*
- for (;;) {
- if ((_tokenSet_3.member(LA(1)))) {
- { match(_tokenSet_3); }
- } else {
- goto _loop680;
- }
- }
- _loop680:;
- } // ( ... )*
- mEndOfLine(false);
- }
- if (inputState->guessing == 0) {
-#line 2451 "CPP_parser.g"
- _ttype = ANTLR_USE_NAMESPACE(antlr) Token::SKIP;
- newline();
-#line 1606 "CPPLexer.cpp"
- }
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mError(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = Error;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- {
- match('#' /* charlit */);
- match("error");
- { // ( ... )*
- for (;;) {
- if ((_tokenSet_3.member(LA(1)))) {
- { match(_tokenSet_3); }
- } else {
- goto _loop685;
- }
- }
- _loop685:;
- } // ( ... )*
- mEndOfLine(false);
- }
- if (inputState->guessing == 0) {
-#line 2458 "CPP_parser.g"
- _ttype = ANTLR_USE_NAMESPACE(antlr) Token::SKIP;
- newline();
-#line 1643 "CPPLexer.cpp"
- }
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mCharLiteral(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = CharLiteral;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match('\'' /* charlit */);
- {
- if ((LA(1) == 0x5c /* '\\' */) && (_tokenSet_4.member(LA(2))) &&
- (_tokenSet_6.member(LA(3)))) {
- mEscape(false);
- } else if ((_tokenSet_7.member(LA(1))) && (LA(2) == 0x27 /* '\'' */) &&
- (true)) {
- { match(_tokenSet_7); }
- } else {
- throw ANTLR_USE_NAMESPACE(antlr) NoViableAltForCharException(
- LA(1), getFilename(), getLine(), getColumn());
- }
- }
- match('\'' /* charlit */);
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mEscape(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = Escape;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match('\\' /* charlit */);
- {
- switch (LA(1)) {
- case 0x61 /* 'a' */: {
- match('a' /* charlit */);
- break;
- }
- case 0x62 /* 'b' */: {
- match('b' /* charlit */);
- break;
- }
- case 0x66 /* 'f' */: {
- match('f' /* charlit */);
- break;
- }
- case 0x6e /* 'n' */: {
- match('n' /* charlit */);
- break;
- }
- case 0x72 /* 'r' */: {
- match('r' /* charlit */);
- break;
- }
- case 0x74 /* 't' */: {
- match('t' /* charlit */);
- break;
- }
- case 0x76 /* 'v' */: {
- match('v' /* charlit */);
- break;
- }
- case 0x22 /* '\"' */: {
- match('\"' /* charlit */);
- break;
- }
- case 0x27 /* '\'' */: {
- match('\'' /* charlit */);
- break;
- }
- case 0x5c /* '\\' */: {
- match('\\' /* charlit */);
- break;
- }
- case 0x3f /* '?' */: {
- match('?' /* charlit */);
- break;
- }
- case 0x30 /* '0' */:
- case 0x31 /* '1' */:
- case 0x32 /* '2' */:
- case 0x33 /* '3' */: {
- { matchRange('0', '3'); }
- {
- if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */)) &&
- (_tokenSet_3.member(LA(2))) && (true)) {
- mDigit(false);
- {
- if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */)) &&
- (_tokenSet_3.member(LA(2))) && (true)) {
- mDigit(false);
- } else if ((_tokenSet_3.member(LA(1))) && (true) && (true)) {
- } else {
- throw ANTLR_USE_NAMESPACE(antlr) NoViableAltForCharException(
- LA(1), getFilename(), getLine(), getColumn());
- }
- }
- } else if ((_tokenSet_3.member(LA(1))) && (true) && (true)) {
- } else {
- throw ANTLR_USE_NAMESPACE(antlr) NoViableAltForCharException(
- LA(1), getFilename(), getLine(), getColumn());
- }
- }
- break;
- }
- case 0x34 /* '4' */:
- case 0x35 /* '5' */:
- case 0x36 /* '6' */:
- case 0x37 /* '7' */: {
- { matchRange('4', '7'); }
- {
- if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */)) &&
- (_tokenSet_3.member(LA(2))) && (true)) {
- mDigit(false);
- } else if ((_tokenSet_3.member(LA(1))) && (true) && (true)) {
- } else {
- throw ANTLR_USE_NAMESPACE(antlr) NoViableAltForCharException(
- LA(1), getFilename(), getLine(), getColumn());
- }
- }
- break;
- }
- case 0x78 /* 'x' */: {
- match('x' /* charlit */);
- { // ( ... )+
- int _cnt706 = 0;
- for (;;) {
- if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */)) &&
- (_tokenSet_3.member(LA(2))) && (true)) {
- mDigit(false);
- } else if (((LA(1) >= 0x61 /* 'a' */ && LA(1) <= 0x66 /* 'f' */)) &&
- (_tokenSet_3.member(LA(2))) && (true)) {
- matchRange('a', 'f');
- } else if (((LA(1) >= 0x41 /* 'A' */ && LA(1) <= 0x46 /* 'F' */)) &&
- (_tokenSet_3.member(LA(2))) && (true)) {
- matchRange('A', 'F');
- } else {
- if (_cnt706 >= 1) {
- goto _loop706;
- } else {
- throw ANTLR_USE_NAMESPACE(antlr) NoViableAltForCharException(
- LA(1), getFilename(), getLine(), getColumn());
- }
- }
-
- _cnt706++;
- }
- _loop706:;
- } // ( ... )+
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr) NoViableAltForCharException(
- LA(1), getFilename(), getLine(), getColumn());
- }
- }
- }
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mWCharLiteral(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = WCharLiteral;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match('L' /* charlit */);
- mCharLiteral(false);
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mWStringLiteral(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = WStringLiteral;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- match('L' /* charlit */);
- mStringLiteral(false);
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mDigit(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = Digit;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- matchRange('0', '9');
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mLongSuffix(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = LongSuffix;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- switch (LA(1)) {
- case 0x6c /* 'l' */: {
- match('l' /* charlit */);
- break;
- }
- case 0x4c /* 'L' */: {
- match('L' /* charlit */);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr) NoViableAltForCharException(
- LA(1), getFilename(), getLine(), getColumn());
- }
- }
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mUnsignedSuffix(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = UnsignedSuffix;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- switch (LA(1)) {
- case 0x75 /* 'u' */: {
- match('u' /* charlit */);
- break;
- }
- case 0x55 /* 'U' */: {
- match('U' /* charlit */);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr) NoViableAltForCharException(
- LA(1), getFilename(), getLine(), getColumn());
- }
- }
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mFloatSuffix(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = FloatSuffix;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- switch (LA(1)) {
- case 0x66 /* 'f' */: {
- match('f' /* charlit */);
- break;
- }
- case 0x46 /* 'F' */: {
- match('F' /* charlit */);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr) NoViableAltForCharException(
- LA(1), getFilename(), getLine(), getColumn());
- }
- }
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mExponent(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = Exponent;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- {
- switch (LA(1)) {
- case 0x65 /* 'e' */: {
- match('e' /* charlit */);
- break;
- }
- case 0x45 /* 'E' */: {
- match('E' /* charlit */);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr) NoViableAltForCharException(
- LA(1), getFilename(), getLine(), getColumn());
- }
- }
- }
- {
- switch (LA(1)) {
- case 0x2b /* '+' */: {
- match('+' /* charlit */);
- break;
- }
- case 0x2d /* '-' */: {
- match('-' /* charlit */);
- break;
- }
- case 0x30 /* '0' */:
- case 0x31 /* '1' */:
- case 0x32 /* '2' */:
- case 0x33 /* '3' */:
- case 0x34 /* '4' */:
- case 0x35 /* '5' */:
- case 0x36 /* '6' */:
- case 0x37 /* '7' */:
- case 0x38 /* '8' */:
- case 0x39 /* '9' */: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr) NoViableAltForCharException(
- LA(1), getFilename(), getLine(), getColumn());
- }
- }
- }
- { // ( ... )+
- int _cnt718 = 0;
- for (;;) {
- if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */))) {
- mDigit(false);
- } else {
- if (_cnt718 >= 1) {
- goto _loop718;
- } else {
- throw ANTLR_USE_NAMESPACE(antlr) NoViableAltForCharException(
- LA(1), getFilename(), getLine(), getColumn());
- }
- }
-
- _cnt718++;
- }
- _loop718:;
- } // ( ... )+
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mVocabulary(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = Vocabulary;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- matchRange('\3', static_cast<unsigned char>('\377'));
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mNumber(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = Number;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- bool synPredMatched725 = false;
- if ((((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */)) &&
- (_tokenSet_8.member(LA(2))) && (true))) {
- int _m725 = mark();
- synPredMatched725 = true;
- inputState->guessing++;
- try {
- {
- { // ( ... )+
- int _cnt723 = 0;
- for (;;) {
- if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */))) {
- mDigit(false);
- } else {
- if (_cnt723 >= 1) {
- goto _loop723;
- } else {
- throw ANTLR_USE_NAMESPACE(antlr) NoViableAltForCharException(
- LA(1), getFilename(), getLine(), getColumn());
- }
- }
-
- _cnt723++;
- }
- _loop723:;
- } // ( ... )+
- {
- switch (LA(1)) {
- case 0x2e /* '.' */: {
- match('.' /* charlit */);
- break;
- }
- case 0x65 /* 'e' */: {
- match('e' /* charlit */);
- break;
- }
- case 0x45 /* 'E' */: {
- match('E' /* charlit */);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr) NoViableAltForCharException(
- LA(1), getFilename(), getLine(), getColumn());
- }
- }
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& pe) {
- synPredMatched725 = false;
- }
- rewind(_m725);
- inputState->guessing--;
- }
- if (synPredMatched725) {
- { // ( ... )+
- int _cnt727 = 0;
- for (;;) {
- if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */))) {
- mDigit(false);
- } else {
- if (_cnt727 >= 1) {
- goto _loop727;
- } else {
- throw ANTLR_USE_NAMESPACE(antlr) NoViableAltForCharException(
- LA(1), getFilename(), getLine(), getColumn());
- }
- }
-
- _cnt727++;
- }
- _loop727:;
- } // ( ... )+
- {
- switch (LA(1)) {
- case 0x2e /* '.' */: {
- match('.' /* charlit */);
- { // ( ... )*
- for (;;) {
- if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */))) {
- mDigit(false);
- } else {
- goto _loop730;
- }
- }
- _loop730:;
- } // ( ... )*
- {
- if ((LA(1) == 0x45 /* 'E' */ || LA(1) == 0x65 /* 'e' */)) {
- mExponent(false);
- } else {
- }
- }
- if (inputState->guessing == 0) {
-#line 2606 "CPP_parser.g"
- _ttype = FLOATONE;
-#line 2158 "CPPLexer.cpp"
- }
- break;
- }
- case 0x45 /* 'E' */:
- case 0x65 /* 'e' */: {
- mExponent(false);
- if (inputState->guessing == 0) {
-#line 2607 "CPP_parser.g"
- _ttype = FLOATTWO;
-#line 2169 "CPPLexer.cpp"
- }
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr) NoViableAltForCharException(
- LA(1), getFilename(), getLine(), getColumn());
- }
- }
- }
- {
- switch (LA(1)) {
- case 0x46 /* 'F' */:
- case 0x66 /* 'f' */: {
- mFloatSuffix(false);
- break;
- }
- case 0x4c /* 'L' */:
- case 0x6c /* 'l' */: {
- mLongSuffix(false);
- break;
- }
- default: {}
- }
- }
- } else {
- bool synPredMatched734 = false;
- if (((LA(1) == 0x2e /* '.' */) && (LA(2) == 0x2e /* '.' */))) {
- int _m734 = mark();
- synPredMatched734 = true;
- inputState->guessing++;
- try {
- { match("..."); }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& pe) {
- synPredMatched734 = false;
- }
- rewind(_m734);
- inputState->guessing--;
- }
- if (synPredMatched734) {
- match("...");
- if (inputState->guessing == 0) {
-#line 2613 "CPP_parser.g"
- _ttype = ELLIPSIS;
-#line 2221 "CPPLexer.cpp"
- }
- } else if ((LA(1) == 0x30 /* '0' */) &&
- (LA(2) == 0x58 /* 'X' */ || LA(2) == 0x78 /* 'x' */)) {
- match('0' /* charlit */);
- {
- switch (LA(1)) {
- case 0x78 /* 'x' */: {
- match('x' /* charlit */);
- break;
- }
- case 0x58 /* 'X' */: {
- match('X' /* charlit */);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr) NoViableAltForCharException(
- LA(1), getFilename(), getLine(), getColumn());
- }
- }
- }
- { // ( ... )+
- int _cnt750 = 0;
- for (;;) {
- switch (LA(1)) {
- case 0x61 /* 'a' */:
- case 0x62 /* 'b' */:
- case 0x63 /* 'c' */:
- case 0x64 /* 'd' */:
- case 0x65 /* 'e' */:
- case 0x66 /* 'f' */: {
- matchRange('a', 'f');
- break;
- }
- case 0x41 /* 'A' */:
- case 0x42 /* 'B' */:
- case 0x43 /* 'C' */:
- case 0x44 /* 'D' */:
- case 0x45 /* 'E' */:
- case 0x46 /* 'F' */: {
- matchRange('A', 'F');
- break;
- }
- case 0x30 /* '0' */:
- case 0x31 /* '1' */:
- case 0x32 /* '2' */:
- case 0x33 /* '3' */:
- case 0x34 /* '4' */:
- case 0x35 /* '5' */:
- case 0x36 /* '6' */:
- case 0x37 /* '7' */:
- case 0x38 /* '8' */:
- case 0x39 /* '9' */: {
- mDigit(false);
- break;
- }
- default: {
- if (_cnt750 >= 1) {
- goto _loop750;
- } else {
- throw ANTLR_USE_NAMESPACE(antlr) NoViableAltForCharException(
- LA(1), getFilename(), getLine(), getColumn());
- }
- }
- }
- _cnt750++;
- }
- _loop750:;
- } // ( ... )+
- { // ( ... )*
- for (;;) {
- switch (LA(1)) {
- case 0x4c /* 'L' */:
- case 0x6c /* 'l' */: {
- mLongSuffix(false);
- break;
- }
- case 0x55 /* 'U' */:
- case 0x75 /* 'u' */: {
- mUnsignedSuffix(false);
- break;
- }
- default: { goto _loop752; }
- }
- }
- _loop752:;
- } // ( ... )*
- if (inputState->guessing == 0) {
-#line 2637 "CPP_parser.g"
- _ttype = HEXADECIMALINT;
-#line 2317 "CPPLexer.cpp"
- }
- } else if ((LA(1) == 0x2e /* '.' */) && (true)) {
- match('.' /* charlit */);
- if (inputState->guessing == 0) {
-#line 2615 "CPP_parser.g"
- _ttype = DOT;
-#line 2325 "CPPLexer.cpp"
- }
- {
- if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */))) {
- { // ( ... )+
- int _cnt737 = 0;
- for (;;) {
- if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */))) {
- mDigit(false);
- } else {
- if (_cnt737 >= 1) {
- goto _loop737;
- } else {
- throw ANTLR_USE_NAMESPACE(antlr) NoViableAltForCharException(
- LA(1), getFilename(), getLine(), getColumn());
- }
- }
-
- _cnt737++;
- }
- _loop737:;
- } // ( ... )+
- {
- if ((LA(1) == 0x45 /* 'E' */ || LA(1) == 0x65 /* 'e' */)) {
- mExponent(false);
- } else {
- }
- }
- if (inputState->guessing == 0) {
-#line 2616 "CPP_parser.g"
- _ttype = FLOATONE;
-#line 2354 "CPPLexer.cpp"
- }
- {
- switch (LA(1)) {
- case 0x46 /* 'F' */:
- case 0x66 /* 'f' */: {
- mFloatSuffix(false);
- break;
- }
- case 0x4c /* 'L' */:
- case 0x6c /* 'l' */: {
- mLongSuffix(false);
- break;
- }
- default: {}
- }
- }
- } else {
- }
- }
- } else if ((LA(1) == 0x30 /* '0' */) && (true) && (true)) {
- match('0' /* charlit */);
- { // ( ... )*
- for (;;) {
- if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x37 /* '7' */))) {
- matchRange('0', '7');
- } else {
- goto _loop741;
- }
- }
- _loop741:;
- } // ( ... )*
- { // ( ... )*
- for (;;) {
- switch (LA(1)) {
- case 0x4c /* 'L' */:
- case 0x6c /* 'l' */: {
- mLongSuffix(false);
- break;
- }
- case 0x55 /* 'U' */:
- case 0x75 /* 'u' */: {
- mUnsignedSuffix(false);
- break;
- }
- default: { goto _loop743; }
- }
- }
- _loop743:;
- } // ( ... )*
- if (inputState->guessing == 0) {
-#line 2626 "CPP_parser.g"
- _ttype = OCTALINT;
-#line 2421 "CPPLexer.cpp"
- }
- } else if (((LA(1) >= 0x31 /* '1' */ && LA(1) <= 0x39 /* '9' */)) &&
- (true) && (true)) {
- matchRange('1', '9');
- { // ( ... )*
- for (;;) {
- if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */))) {
- mDigit(false);
- } else {
- goto _loop745;
- }
- }
- _loop745:;
- } // ( ... )*
- { // ( ... )*
- for (;;) {
- switch (LA(1)) {
- case 0x4c /* 'L' */:
- case 0x6c /* 'l' */: {
- mLongSuffix(false);
- break;
- }
- case 0x55 /* 'U' */:
- case 0x75 /* 'u' */: {
- mUnsignedSuffix(false);
- break;
- }
- default: { goto _loop747; }
- }
- }
- _loop747:;
- } // ( ... )*
- if (inputState->guessing == 0) {
-#line 2631 "CPP_parser.g"
- _ttype = DECIMALINT;
-#line 2464 "CPPLexer.cpp"
- }
- } else {
- throw ANTLR_USE_NAMESPACE(antlr) NoViableAltForCharException(
- LA(1), getFilename(), getLine(), getColumn());
- }
- }
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-void CPPLexer::mID(bool _createToken) {
- int _ttype;
- ANTLR_USE_NAMESPACE(antlr) RefToken _token;
- ANTLR_USE_NAMESPACE(std) string::size_type _begin = text.length();
- _ttype = ID;
- ANTLR_USE_NAMESPACE(std) string::size_type _saveIndex;
-
- {
- switch (LA(1)) {
- case 0x61 /* 'a' */:
- case 0x62 /* 'b' */:
- case 0x63 /* 'c' */:
- case 0x64 /* 'd' */:
- case 0x65 /* 'e' */:
- case 0x66 /* 'f' */:
- case 0x67 /* 'g' */:
- case 0x68 /* 'h' */:
- case 0x69 /* 'i' */:
- case 0x6a /* 'j' */:
- case 0x6b /* 'k' */:
- case 0x6c /* 'l' */:
- case 0x6d /* 'm' */:
- case 0x6e /* 'n' */:
- case 0x6f /* 'o' */:
- case 0x70 /* 'p' */:
- case 0x71 /* 'q' */:
- case 0x72 /* 'r' */:
- case 0x73 /* 's' */:
- case 0x74 /* 't' */:
- case 0x75 /* 'u' */:
- case 0x76 /* 'v' */:
- case 0x77 /* 'w' */:
- case 0x78 /* 'x' */:
- case 0x79 /* 'y' */:
- case 0x7a /* 'z' */: {
- matchRange('a', 'z');
- break;
- }
- case 0x41 /* 'A' */:
- case 0x42 /* 'B' */:
- case 0x43 /* 'C' */:
- case 0x44 /* 'D' */:
- case 0x45 /* 'E' */:
- case 0x46 /* 'F' */:
- case 0x47 /* 'G' */:
- case 0x48 /* 'H' */:
- case 0x49 /* 'I' */:
- case 0x4a /* 'J' */:
- case 0x4b /* 'K' */:
- case 0x4c /* 'L' */:
- case 0x4d /* 'M' */:
- case 0x4e /* 'N' */:
- case 0x4f /* 'O' */:
- case 0x50 /* 'P' */:
- case 0x51 /* 'Q' */:
- case 0x52 /* 'R' */:
- case 0x53 /* 'S' */:
- case 0x54 /* 'T' */:
- case 0x55 /* 'U' */:
- case 0x56 /* 'V' */:
- case 0x57 /* 'W' */:
- case 0x58 /* 'X' */:
- case 0x59 /* 'Y' */:
- case 0x5a /* 'Z' */: {
- matchRange('A', 'Z');
- break;
- }
- case 0x5f /* '_' */: {
- match('_' /* charlit */);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr) NoViableAltForCharException(
- LA(1), getFilename(), getLine(), getColumn());
- }
- }
- }
- { // ( ... )*
- for (;;) {
- switch (LA(1)) {
- case 0x61 /* 'a' */:
- case 0x62 /* 'b' */:
- case 0x63 /* 'c' */:
- case 0x64 /* 'd' */:
- case 0x65 /* 'e' */:
- case 0x66 /* 'f' */:
- case 0x67 /* 'g' */:
- case 0x68 /* 'h' */:
- case 0x69 /* 'i' */:
- case 0x6a /* 'j' */:
- case 0x6b /* 'k' */:
- case 0x6c /* 'l' */:
- case 0x6d /* 'm' */:
- case 0x6e /* 'n' */:
- case 0x6f /* 'o' */:
- case 0x70 /* 'p' */:
- case 0x71 /* 'q' */:
- case 0x72 /* 'r' */:
- case 0x73 /* 's' */:
- case 0x74 /* 't' */:
- case 0x75 /* 'u' */:
- case 0x76 /* 'v' */:
- case 0x77 /* 'w' */:
- case 0x78 /* 'x' */:
- case 0x79 /* 'y' */:
- case 0x7a /* 'z' */: {
- matchRange('a', 'z');
- break;
- }
- case 0x41 /* 'A' */:
- case 0x42 /* 'B' */:
- case 0x43 /* 'C' */:
- case 0x44 /* 'D' */:
- case 0x45 /* 'E' */:
- case 0x46 /* 'F' */:
- case 0x47 /* 'G' */:
- case 0x48 /* 'H' */:
- case 0x49 /* 'I' */:
- case 0x4a /* 'J' */:
- case 0x4b /* 'K' */:
- case 0x4c /* 'L' */:
- case 0x4d /* 'M' */:
- case 0x4e /* 'N' */:
- case 0x4f /* 'O' */:
- case 0x50 /* 'P' */:
- case 0x51 /* 'Q' */:
- case 0x52 /* 'R' */:
- case 0x53 /* 'S' */:
- case 0x54 /* 'T' */:
- case 0x55 /* 'U' */:
- case 0x56 /* 'V' */:
- case 0x57 /* 'W' */:
- case 0x58 /* 'X' */:
- case 0x59 /* 'Y' */:
- case 0x5a /* 'Z' */: {
- matchRange('A', 'Z');
- break;
- }
- case 0x5f /* '_' */: {
- match('_' /* charlit */);
- break;
- }
- case 0x30 /* '0' */:
- case 0x31 /* '1' */:
- case 0x32 /* '2' */:
- case 0x33 /* '3' */:
- case 0x34 /* '4' */:
- case 0x35 /* '5' */:
- case 0x36 /* '6' */:
- case 0x37 /* '7' */:
- case 0x38 /* '8' */:
- case 0x39 /* '9' */: {
- matchRange('0', '9');
- break;
- }
- default: { goto _loop756; }
- }
- }
- _loop756:;
- } // ( ... )*
- _ttype = testLiteralsTable(_ttype);
- if (_createToken && _token == ANTLR_USE_NAMESPACE(antlr) nullToken &&
- _ttype != ANTLR_USE_NAMESPACE(antlr) Token::SKIP) {
- _token = makeToken(_ttype);
- _token->setText(text.substr(_begin, text.length() - _begin));
- }
- _returnToken = _token;
- _saveIndex = 0;
-}
-
-const unsigned long CPPLexer::_tokenSet_0_data_[] = {
- 0UL, 67059712UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// . 0 1 2 3 4 5 6 7 8 9
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPLexer::_tokenSet_0(_tokenSet_0_data_,
- 10);
-const unsigned long CPPLexer::_tokenSet_1_data_[] = {
- 0UL, 0UL, 2281701374UL, 134217726UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// A B C D E F G H I J K L M N O P Q R S T U V W X Y Z _ a b c d e f g
-// h i j k l m n o p q r s t u v w x y z
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPLexer::_tokenSet_1(_tokenSet_1_data_,
- 10);
-const unsigned long CPPLexer::_tokenSet_2_data_[] = {
- 4294958079UL, 4294966271UL, 4294967295UL, 4294967295UL,
- 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL,
- 0UL, 0UL, 0UL, 0UL,
- 0UL, 0UL, 0UL, 0UL};
-// 0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xb 0xc 0xe 0xf 0x10 0x11 0x12
-// 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f !
-// \" # $ % & \' ( ) + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C
-// D E F G H I J K L M N O P Q R S T U V W X Y Z [ 0x5c ] ^ _ ` a b c d
-// e f g h i j k l m n o p q r s t u v w x y z { | } ~ 0x7f 0x80 0x81 0x82
-// 0x83 0x84 0x85 0x86 0x87 0x88 0x89 0x8a 0x8b 0x8c 0x8d 0x8e 0x8f 0x90
-// 0x91 0x92 0x93 0x94 0x95 0x96 0x97 0x98 0x99 0x9a 0x9b 0x9c 0x9d 0x9e
-// 0x9f 0xa0 0xa1 0xa2 0xa3 0xa4 0xa5 0xa6 0xa7 0xa8 0xa9 0xaa 0xab 0xac
-// 0xad 0xae 0xaf 0xb0 0xb1 0xb2 0xb3 0xb4 0xb5 0xb6 0xb7 0xb8 0xb9 0xba
-// 0xbb 0xbc 0xbd 0xbe 0xbf 0xc0
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPLexer::_tokenSet_2(_tokenSet_2_data_,
- 16);
-const unsigned long CPPLexer::_tokenSet_3_data_[] = {
- 4294958079UL, 4294967295UL, 4294967295UL, 4294967295UL,
- 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL,
- 0UL, 0UL, 0UL, 0UL,
- 0UL, 0UL, 0UL, 0UL};
-// 0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xb 0xc 0xe 0xf 0x10 0x11 0x12
-// 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f !
-// \" # $ % & \' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B
-// C D E F G H I J K L M N O P Q R S T U V W X Y Z [ 0x5c ] ^ _ ` a b c
-// d e f g h i j k l m n o p q r s t u v w x y z { | } ~ 0x7f 0x80 0x81
-// 0x82 0x83 0x84 0x85 0x86 0x87 0x88 0x89 0x8a 0x8b 0x8c 0x8d 0x8e 0x8f
-// 0x90 0x91 0x92 0x93 0x94 0x95 0x96 0x97 0x98 0x99 0x9a 0x9b 0x9c 0x9d
-// 0x9e 0x9f 0xa0 0xa1 0xa2 0xa3 0xa4 0xa5 0xa6 0xa7 0xa8 0xa9 0xaa 0xab
-// 0xac 0xad 0xae 0xaf 0xb0 0xb1 0xb2 0xb3 0xb4 0xb5 0xb6 0xb7 0xb8 0xb9
-// 0xba 0xbb 0xbc 0xbd 0xbe 0xbf 0xc0
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPLexer::_tokenSet_3(_tokenSet_3_data_,
- 16);
-const unsigned long CPPLexer::_tokenSet_4_data_[] = {
- 0UL, 2164195460UL, 268435456UL, 22298694UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// \" \' 0 1 2 3 4 5 6 7 ? 0x5c a b f n r t v x
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPLexer::_tokenSet_4(_tokenSet_4_data_,
- 10);
-const unsigned long CPPLexer::_tokenSet_5_data_[] = {
- 4294958079UL, 4294967291UL, 4026531839UL, 4294967295UL,
- 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL,
- 0UL, 0UL, 0UL, 0UL,
- 0UL, 0UL, 0UL, 0UL};
-// 0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xb 0xc 0xe 0xf 0x10 0x11 0x12
-// 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f !
-// # $ % & \' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D
-// E F G H I J K L M N O P Q R S T U V W X Y Z [ ] ^ _ ` a b c d e f g
-// h i j k l m n o p q r s t u v w x y z { | } ~ 0x7f 0x80 0x81 0x82 0x83
-// 0x84 0x85 0x86 0x87 0x88 0x89 0x8a 0x8b 0x8c 0x8d 0x8e 0x8f 0x90 0x91
-// 0x92 0x93 0x94 0x95 0x96 0x97 0x98 0x99 0x9a 0x9b 0x9c 0x9d 0x9e 0x9f
-// 0xa0 0xa1 0xa2 0xa3 0xa4 0xa5 0xa6 0xa7 0xa8 0xa9 0xaa 0xab 0xac 0xad
-// 0xae 0xaf 0xb0 0xb1 0xb2 0xb3 0xb4 0xb5 0xb6 0xb7 0xb8 0xb9 0xba 0xbb
-// 0xbc 0xbd 0xbe 0xbf 0xc0
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPLexer::_tokenSet_5(_tokenSet_5_data_,
- 16);
-const unsigned long CPPLexer::_tokenSet_6_data_[] = {
- 0UL, 67043456UL, 126UL, 126UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// \' 0 1 2 3 4 5 6 7 8 9 A B C D E F a b c d e f
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPLexer::_tokenSet_6(_tokenSet_6_data_,
- 10);
-const unsigned long CPPLexer::_tokenSet_7_data_[] = {
- 4294967295UL, 4294967167UL, 4294967295UL, 4294967295UL,
- 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL,
- 0UL, 0UL, 0UL, 0UL,
- 0UL, 0UL, 0UL, 0UL};
-// 0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10
-// 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e
-// 0x1f ! \" # $ % & ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ?
-// @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ 0x5c ] ^ _ `
-// a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~ 0x7f 0x80
-// 0x81 0x82 0x83 0x84 0x85 0x86 0x87 0x88 0x89 0x8a 0x8b 0x8c 0x8d 0x8e
-// 0x8f 0x90 0x91 0x92 0x93 0x94 0x95 0x96 0x97 0x98 0x99 0x9a 0x9b 0x9c
-// 0x9d 0x9e 0x9f 0xa0 0xa1 0xa2 0xa3 0xa4 0xa5 0xa6 0xa7 0xa8 0xa9 0xaa
-// 0xab 0xac 0xad 0xae 0xaf 0xb0 0xb1 0xb2 0xb3 0xb4 0xb5 0xb6 0xb7 0xb8
-// 0xb9 0xba 0xbb 0xbc 0xbd 0xbe 0xbf 0xc0
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPLexer::_tokenSet_7(_tokenSet_7_data_,
- 16);
-const unsigned long CPPLexer::_tokenSet_8_data_[] = {
- 0UL, 67059712UL, 32UL, 32UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// . 0 1 2 3 4 5 6 7 8 9 E e
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPLexer::_tokenSet_8(_tokenSet_8_data_,
- 10);
diff --git a/contrib/pdxautoserializer/src/impl/CPPParser/CPPLexer.hpp b/contrib/pdxautoserializer/src/impl/CPPParser/CPPLexer.hpp
deleted file mode 100644
index 2955256..0000000
--- a/contrib/pdxautoserializer/src/impl/CPPParser/CPPLexer.hpp
+++ /dev/null
@@ -1,304 +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.
- */
-#ifndef INC_CPPLexer_hpp_
-#define INC_CPPLexer_hpp_
-
-#include <antlr/config.hpp>
-/* $ANTLR 2.7.7 (20130409): "CPP_parser.g" -> "CPPLexer.hpp"$ */
-#include <antlr/CommonToken.hpp>
-#include <antlr/InputBuffer.hpp>
-#include <antlr/BitSet.hpp>
-#include "STDCTokenTypes.hpp"
-#include <antlr/CharScanner.hpp>
-#line 79 "CPP_parser.g"
-
-// File generated from CPP_parser.g
-// Version 3.1 November 2005
-// This file is best viewed in courier font with tabs set to 4 spaces
-//
-// The statements in this block appear in both CPPLexer.hpp and CPPParser.hpp
-#include <stdio.h>
-#include <string.h>
-#include "antlr/CharScanner.hpp"
-#include "CPPDictionary.hpp"
-
-// Defined in main.cpp
-extern void process_line_directive(const char*, const char*);
-
-// Declared in main.cpp
-extern int deferredLineCount;
-
-#line 30 "CPPLexer.hpp"
-class CUSTOM_API CPPLexer : public ANTLR_USE_NAMESPACE(antlr) CharScanner,
- public STDCTokenTypes {
-#line 2303 "CPP_parser.g"
-
- void deferredNewline() {
- deferredLineCount++; // Declared and initialised in main.cpp
- }
-
- void newline() {
- for (; deferredLineCount > 0; deferredLineCount--) {
- CharScanner::newline();
- }
- CharScanner::newline();
- }
-#line 34 "CPPLexer.hpp"
- private:
- void initLiterals();
-
- public:
- bool getCaseSensitiveLiterals() const { return true; }
-
- public:
- CPPLexer(ANTLR_USE_NAMESPACE(std) istream& in);
- CPPLexer(ANTLR_USE_NAMESPACE(antlr) InputBuffer& ib);
- CPPLexer(const ANTLR_USE_NAMESPACE(antlr) LexerSharedInputState& state);
- ANTLR_USE_NAMESPACE(antlr) RefToken nextToken();
-
- public:
- void mASSIGNEQUAL(bool _createToken);
-
- public:
- void mCOLON(bool _createToken);
-
- public:
- void mCOMMA(bool _createToken);
-
- public:
- void mQUESTIONMARK(bool _createToken);
-
- public:
- void mSEMICOLON(bool _createToken);
-
- public:
- void mPOINTERTO(bool _createToken);
-
- public:
- void mLPAREN(bool _createToken);
-
- public:
- void mRPAREN(bool _createToken);
-
- public:
- void mLSQUARE(bool _createToken);
-
- public:
- void mRSQUARE(bool _createToken);
-
- public:
- void mLCURLY(bool _createToken);
-
- public:
- void mRCURLY(bool _createToken);
-
- public:
- void mEQUAL(bool _createToken);
-
- public:
- void mNOTEQUAL(bool _createToken);
-
- public:
- void mLESSTHANOREQUALTO(bool _createToken);
-
- public:
- void mLESSTHAN(bool _createToken);
-
- public:
- void mGREATERTHANOREQUALTO(bool _createToken);
-
- public:
- void mGREATERTHAN(bool _createToken);
-
- public:
- void mDIVIDE(bool _createToken);
-
- public:
- void mDIVIDEEQUAL(bool _createToken);
-
- public:
- void mPLUS(bool _createToken);
-
- public:
- void mPLUSEQUAL(bool _createToken);
-
- public:
- void mPLUSPLUS(bool _createToken);
-
- public:
- void mMINUS(bool _createToken);
-
- public:
- void mMINUSEQUAL(bool _createToken);
-
- public:
- void mMINUSMINUS(bool _createToken);
-
- public:
- void mSTAR(bool _createToken);
-
- public:
- void mTIMESEQUAL(bool _createToken);
-
- public:
- void mMOD(bool _createToken);
-
- public:
- void mMODEQUAL(bool _createToken);
-
- public:
- void mSHIFTRIGHT(bool _createToken);
-
- public:
- void mSHIFTRIGHTEQUAL(bool _createToken);
-
- public:
- void mSHIFTLEFT(bool _createToken);
-
- public:
- void mSHIFTLEFTEQUAL(bool _createToken);
-
- public:
- void mAND(bool _createToken);
-
- public:
- void mNOT(bool _createToken);
-
- public:
- void mOR(bool _createToken);
-
- public:
- void mAMPERSAND(bool _createToken);
-
- public:
- void mBITWISEANDEQUAL(bool _createToken);
-
- public:
- void mTILDE(bool _createToken);
-
- public:
- void mBITWISEOR(bool _createToken);
-
- public:
- void mBITWISEOREQUAL(bool _createToken);
-
- public:
- void mBITWISEXOR(bool _createToken);
-
- public:
- void mBITWISEXOREQUAL(bool _createToken);
-
- public:
- void mPOINTERTOMBR(bool _createToken);
-
- public:
- void mDOTMBR(bool _createToken);
-
- public:
- void mSCOPE(bool _createToken);
-
- public:
- void mWhitespace(bool _createToken);
-
- public:
- void mComment(bool _createToken);
-
- protected:
- void mEndOfLine(bool _createToken);
-
- public:
- void mCPPComment(bool _createToken);
-
- public:
- void mPREPROC_DIRECTIVE(bool _createToken);
-
- protected:
- void mLineDirective(bool _createToken);
-
- protected:
- void mSpace(bool _createToken);
-
- protected:
- void mDecimal(bool _createToken);
-
- public:
- void mStringLiteral(bool _createToken);
-
- protected:
- void mPragma(bool _createToken);
-
- protected:
- void mError(bool _createToken);
-
- public:
- void mCharLiteral(bool _createToken);
-
- protected:
- void mEscape(bool _createToken);
-
- public:
- void mWCharLiteral(bool _createToken);
-
- public:
- void mWStringLiteral(bool _createToken);
-
- protected:
- void mDigit(bool _createToken);
-
- protected:
- void mLongSuffix(bool _createToken);
-
- protected:
- void mUnsignedSuffix(bool _createToken);
-
- protected:
- void mFloatSuffix(bool _createToken);
-
- protected:
- void mExponent(bool _createToken);
-
- protected:
- void mVocabulary(bool _createToken);
-
- public:
- void mNumber(bool _createToken);
-
- public:
- void mID(bool _createToken);
-
- private:
- static const unsigned long _tokenSet_0_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_0;
- static const unsigned long _tokenSet_1_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_1;
- static const unsigned long _tokenSet_2_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_2;
- static const unsigned long _tokenSet_3_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_3;
- static const unsigned long _tokenSet_4_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_4;
- static const unsigned long _tokenSet_5_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_5;
- static const unsigned long _tokenSet_6_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_6;
- static const unsigned long _tokenSet_7_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_7;
- static const unsigned long _tokenSet_8_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_8;
-};
-
-#endif /*INC_CPPLexer_hpp_*/
diff --git a/contrib/pdxautoserializer/src/impl/CPPParser/CPPParser.cpp b/contrib/pdxautoserializer/src/impl/CPPParser/CPPParser.cpp
deleted file mode 100644
index f0278ce..0000000
--- a/contrib/pdxautoserializer/src/impl/CPPParser/CPPParser.cpp
+++ /dev/null
@@ -1,14278 +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.
- */
-/* $ANTLR 2.7.7 (20130409): "CPP_parser.g" -> "CPPParser.cpp"$ */
-#include "CPPParser.hpp"
-#include <antlr/NoViableAltException.hpp>
-#include <antlr/SemanticException.hpp>
-#include <antlr/ASTFactory.hpp>
-#line 102 "CPP_parser.g"
-
-// File generated from CPP_parser.g
-// Version 3.1 November 2005
-// This file is best viewed in courier font with tabs set to 4 spaces
-//
-// The statements in this block appear only in CPPParser.cpp and not in
-// CPPLexer.cpp
-
-// These constants used in the previous version (3.0 July 2004) have now been
-// replaced by the following,
-// ID_VAR_NAME is now CPPSymbol::otVariable
-// ID_FUN_NAME is now CPPSymbol::otFunction
-// ID_INPUT_PARAMETER is now not used
-// ID_CLASS_DEF is now CPPSymbol::otClass
-// ID_SYSTEM_FUNCTION is now not used
-// ID_CONST_DECL is now not used
-// ID_TYPEDEF_VAR is now CPPSymbol::otTypedef
-
-int statementTrace =
- 2; // Used to control selected (level) tracing (see support.cpp)
-// 1 Shows which external and member statements selected
-// 2 Shows above plus all declarations/definitions
-// 3 reserved for future use
-// 4 and above available for user
-
-void CPPParser::init() {
- antlrTrace(false); // This is a dynamic trace facility for use with
- // -traceParser etc.
- // It requires modification in LLkParser.cpp and LLkParser.hpp
- // otherwise it should be commented out (see MyReadMe.txt)
- // true shows antlr trace (or can be set and reset during parsing)
- // false stops showing antlr trace
- // Provided the parser is always generated with -traceParser this
- // facility allows trace output to be turned on or off by changing
- // the setting here from false to true or vice versa and then
- // recompiling and linking CPPParser only thus avoiding the need
- // to use antlr.Tool to re-generate the lexer and parser again
- // with (or without) -traceParser.
- // Antlr trace can also be turned on and off dynamically using
- // antlrTrace_on or antlrTrace_off statements inserted into the
- // source code being parsed (See below).
-
- // Creates a dictionary to hold symbols with 4001 buckets, 200 scopes and
- // 800,000 characters
- // These can be changed to suit the size of program(s) being parsed
- symbols = new CPPDictionary(4001, 200, 800000);
-
- // Set template parameter scope - Not used at present
- templateParameterScope =
- symbols->getCurrentScopeIndex(); // Set template parameter scope to 0
-
- symbols->saveScope(); // Advance currentScope from 0 to 1
- // Set "external" scope for all types
- externalScope =
- symbols->getCurrentScopeIndex(); // Set "external" scope to 1 for types
-
- // Declare predefined scope "std" in external scope
- CPPSymbol* a = new CPPSymbol("std", CPPSymbol::otTypedef);
- symbols->define("std", a);
-
- symbols->saveScope(); // Advance currentScope from 1 to 2 (and higher) for
- // all other symbols
- // treated as locals
-
- // Global flags to allow for nested declarations
- _td = false; // For typedef
- _fd = false; // For friend
- _sc = scInvalid; // For StorageClass
- _tq = tqInvalid; // For TypeQualifier
- _ts = tsInvalid; // For TypeSpecifier
- _fs = fsInvalid; // For FunctionSpecifier
-
- functionDefinition = 0;
- qualifierPrefix[0] = '\0';
- enclosingClass = (char*)"";
- assign_stmt_RHS_found = 0;
- in_parameter_list = false;
- K_and_R = false; // used to distinguish old K & R parameter definitions
- in_return = false;
- is_address = false;
- is_pointer = false;
-}
-
-#line 85 "CPPParser.cpp"
-CPPParser::CPPParser(ANTLR_USE_NAMESPACE(antlr) TokenBuffer& tokenBuf, int k)
- : ANTLR_USE_NAMESPACE(antlr) LLkParser(tokenBuf, k) {}
-
-CPPParser::CPPParser(ANTLR_USE_NAMESPACE(antlr) TokenBuffer& tokenBuf)
- : ANTLR_USE_NAMESPACE(antlr) LLkParser(tokenBuf, 2) {}
-
-CPPParser::CPPParser(ANTLR_USE_NAMESPACE(antlr) TokenStream& lexer, int k)
- : ANTLR_USE_NAMESPACE(antlr) LLkParser(lexer, k) {}
-
-CPPParser::CPPParser(ANTLR_USE_NAMESPACE(antlr) TokenStream& lexer)
- : ANTLR_USE_NAMESPACE(antlr) LLkParser(lexer, 2) {}
-
-CPPParser::CPPParser(const ANTLR_USE_NAMESPACE(antlr)
- ParserSharedInputState& state)
- : ANTLR_USE_NAMESPACE(antlr) LLkParser(state, 2) {}
-
-void CPPParser::translation_unit() {
- try { // for error handling
- if (inputState->guessing == 0) {
-#line 376 "CPP_parser.g"
- enterExternalScope();
-#line 117 "CPPParser.cpp"
- }
- { // ( ... )+
- int _cnt3 = 0;
- for (;;) {
- if ((_tokenSet_0.member(LA(1)))) {
- external_declaration();
- } else {
- if (_cnt3 >= 1) {
- goto _loop3;
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
-
- _cnt3++;
- }
- _loop3:;
- } // ( ... )+
- match(ANTLR_USE_NAMESPACE(antlr) Token::EOF_TYPE);
- if (inputState->guessing == 0) {
-#line 378 "CPP_parser.g"
- exitExternalScope();
-#line 137 "CPPParser.cpp"
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_1);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::external_declaration() {
-#line 381 "CPP_parser.g"
- char* s;
- K_and_R = false;
- FunctionSpecifier fs = fsInvalid; // inline,virtual,explicit
-
-#line 156 "CPPParser.cpp"
-
- try { // for error handling
- {
- switch (LA(1)) {
- case LITERAL_namespace: {
- if (inputState->guessing == 0) {
-#line 539 "CPP_parser.g"
- if (statementTrace >= 1) {
- printf("%d external_declaration Namespace definition\n",
- LT(1)->getLine());
- }
-
-#line 168 "CPPParser.cpp"
- }
- match(LITERAL_namespace);
- namespace_definition();
- break;
- }
- case SEMICOLON: {
- if (inputState->guessing == 0) {
-#line 551 "CPP_parser.g"
- if (statementTrace >= 1) {
- printf("%d external_declaration Semicolon\n", LT(1)->getLine());
- }
-
-#line 181 "CPPParser.cpp"
- }
- match(SEMICOLON);
- if (inputState->guessing == 0) {
-#line 554 "CPP_parser.g"
- end_of_stmt();
-#line 187 "CPPParser.cpp"
- }
- break;
- }
- case LITERAL_antlrTrace_on: {
- match(LITERAL_antlrTrace_on);
- if (inputState->guessing == 0) {
-#line 558 "CPP_parser.g"
- antlrTrace(true);
-#line 197 "CPPParser.cpp"
- }
- break;
- }
- case LITERAL_antlrTrace_off: {
- match(LITERAL_antlrTrace_off);
- if (inputState->guessing == 0) {
-#line 561 "CPP_parser.g"
- antlrTrace(false);
-#line 207 "CPPParser.cpp"
- }
- break;
- }
- default:
- bool synPredMatched7 = false;
- if (((LA(1) == LITERAL_template) && (LA(2) == LESSTHAN))) {
- int _m7 = mark();
- synPredMatched7 = true;
- inputState->guessing++;
- try {
- {
- match(LITERAL_template);
- match(LESSTHAN);
- match(GREATERTHAN);
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& pe) {
- synPredMatched7 = false;
- }
- rewind(_m7);
- inputState->guessing--;
- }
- if (synPredMatched7) {
- if (inputState->guessing == 0) {
-#line 390 "CPP_parser.g"
- if (statementTrace >= 1) {
- printf(
- "%d external_declaration template "
- "explicit-specialisation\n",
- LT(1)->getLine());
- }
-
-#line 236 "CPPParser.cpp"
- }
- match(LITERAL_template);
- match(LESSTHAN);
- match(GREATERTHAN);
- external_declaration();
- } else {
- bool synPredMatched9 = false;
- if (((_tokenSet_2.member(LA(1))) && (_tokenSet_3.member(LA(2))))) {
- int _m9 = mark();
- synPredMatched9 = true;
- inputState->guessing++;
- try {
- { match(LITERAL_typedef); }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& pe) {
- synPredMatched9 = false;
- }
- rewind(_m9);
- inputState->guessing--;
- }
- if (synPredMatched9) {
- {
- bool synPredMatched12 = false;
- if (((LA(1) == LITERAL_typedef) &&
- ((LA(2) >= LITERAL_struct && LA(2) <= LITERAL_class)))) {
- int _m12 = mark();
- synPredMatched12 = true;
- inputState->guessing++;
- try {
- {
- match(LITERAL_typedef);
- class_specifier();
- }
- } catch (ANTLR_USE_NAMESPACE(antlr)
- RecognitionException& pe) {
- synPredMatched12 = false;
- }
- rewind(_m12);
- inputState->guessing--;
- }
- if (synPredMatched12) {
- if (inputState->guessing == 0) {
-#line 399 "CPP_parser.g"
- if (statementTrace >= 1) {
- printf("%d external_declaration Typedef class type\n",
- LT(1)->getLine());
- }
-
-#line 285 "CPPParser.cpp"
- }
- match(LITERAL_typedef);
- class_decl_or_def(fs);
- if (inputState->guessing == 0) {
-#line 402 "CPP_parser.g"
- _td = true;
-#line 292 "CPPParser.cpp"
- }
- {
- switch (LA(1)) {
- case ID:
- case LITERAL__stdcall:
- case LITERAL___stdcall:
- case LPAREN:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case TILDE:
- case STAR:
- case AMPERSAND:
- case SCOPE:
- case LITERAL__cdecl:
- case LITERAL___cdecl:
- case LITERAL__near:
- case LITERAL___near:
- case LITERAL__far:
- case LITERAL___far:
- case LITERAL___interrupt:
- case LITERAL_pascal:
- case LITERAL__pascal:
- case LITERAL___pascal: {
- init_declarator_list();
- break;
- }
- case SEMICOLON: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- match(SEMICOLON);
- if (inputState->guessing == 0) {
-#line 402 "CPP_parser.g"
- end_of_stmt();
-#line 336 "CPPParser.cpp"
- }
- } else {
- bool synPredMatched15 = false;
- if (((LA(1) == LITERAL_typedef) && (LA(2) == LITERAL_enum))) {
- int _m15 = mark();
- synPredMatched15 = true;
- inputState->guessing++;
- try {
- {
- match(LITERAL_typedef);
- match(LITERAL_enum);
- }
- } catch (ANTLR_USE_NAMESPACE(antlr)
- RecognitionException& pe) {
- synPredMatched15 = false;
- }
- rewind(_m15);
- inputState->guessing--;
- }
- if (synPredMatched15) {
- if (inputState->guessing == 0) {
-#line 405 "CPP_parser.g"
- if (statementTrace >= 1) {
- printf("%d external_declaration Typedef enum type\n",
- LT(1)->getLine());
- }
-
-#line 363 "CPPParser.cpp"
- }
- match(LITERAL_typedef);
- enum_specifier();
- if (inputState->guessing == 0) {
-#line 408 "CPP_parser.g"
- _td = true;
-#line 370 "CPPParser.cpp"
- }
- {
- switch (LA(1)) {
- case ID:
- case LITERAL__stdcall:
- case LITERAL___stdcall:
- case LPAREN:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case TILDE:
- case STAR:
- case AMPERSAND:
- case SCOPE:
- case LITERAL__cdecl:
- case LITERAL___cdecl:
- case LITERAL__near:
- case LITERAL___near:
- case LITERAL__far:
- case LITERAL___far:
- case LITERAL___interrupt:
- case LITERAL_pascal:
- case LITERAL__pascal:
- case LITERAL___pascal: {
- init_declarator_list();
- break;
- }
- case SEMICOLON: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- match(SEMICOLON);
- if (inputState->guessing == 0) {
-#line 408 "CPP_parser.g"
- end_of_stmt();
-#line 414 "CPPParser.cpp"
- }
- } else {
- bool synPredMatched18 = false;
- if (((_tokenSet_2.member(LA(1))) &&
- (_tokenSet_3.member(LA(2))))) {
- int _m18 = mark();
- synPredMatched18 = true;
- inputState->guessing++;
- try {
- {
- declaration_specifiers();
- function_declarator(0);
- match(SEMICOLON);
- }
- } catch (ANTLR_USE_NAMESPACE(antlr)
- RecognitionException& pe) {
- synPredMatched18 = false;
- }
- rewind(_m18);
- inputState->guessing--;
- }
- if (synPredMatched18) {
- if (inputState->guessing == 0) {
-#line 411 "CPP_parser.g"
- if (statementTrace >= 1) {
- printf(
- "%d external_declaration Typedef function type\n",
- LT(1)->getLine());
- }
-
-#line 442 "CPPParser.cpp"
- }
- declaration();
- } else if ((_tokenSet_2.member(LA(1))) &&
- (_tokenSet_3.member(LA(2)))) {
- if (inputState->guessing == 0) {
-#line 416 "CPP_parser.g"
- if (statementTrace >= 1) {
- printf(
- "%d external_declaration Typedef variable type\n",
- LT(1)->getLine());
- }
-
-#line 452 "CPPParser.cpp"
- }
- declaration();
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- }
- } else {
- bool synPredMatched22 = false;
- if (((LA(1) == LITERAL_template) && (LA(2) == LESSTHAN))) {
- int _m22 = mark();
- synPredMatched22 = true;
- inputState->guessing++;
- try {
- {
- template_head();
- { // ( ... )*
- for (;;) {
- if ((_tokenSet_4.member(LA(1)))) {
- fs = function_specifier();
- } else {
- goto _loop21;
- }
- }
- _loop21:;
- } // ( ... )*
- class_specifier();
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& pe) {
- synPredMatched22 = false;
- }
- rewind(_m22);
- inputState->guessing--;
- }
- if (synPredMatched22) {
- if (inputState->guessing == 0) {
-#line 424 "CPP_parser.g"
- if (statementTrace >= 1) {
- printf(
- "%d external_declaration Templated class decl or def\n",
- LT(1)->getLine());
- }
-
-#line 498 "CPPParser.cpp"
- }
- template_head();
- { // ( ... )*
- for (;;) {
- if ((_tokenSet_4.member(LA(1)))) {
- fs = function_specifier();
- } else {
- goto _loop24;
- }
- }
- _loop24:;
- } // ( ... )*
- class_decl_or_def(fs);
- {
- switch (LA(1)) {
- case ID:
- case LITERAL__stdcall:
- case LITERAL___stdcall:
- case LPAREN:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case TILDE:
- case STAR:
- case AMPERSAND:
- case SCOPE:
- case LITERAL__cdecl:
- case LITERAL___cdecl:
- case LITERAL__near:
- case LITERAL___near:
- case LITERAL__far:
- case LITERAL___far:
- case LITERAL___interrupt:
- case LITERAL_pascal:
- case LITERAL__pascal:
- case LITERAL___pascal: {
- init_declarator_list();
- break;
- }
- case SEMICOLON: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- match(SEMICOLON);
- if (inputState->guessing == 0) {
-#line 427 "CPP_parser.g"
- end_of_stmt();
-#line 556 "CPPParser.cpp"
- }
- } else {
- bool synPredMatched28 = false;
- if (((LA(1) == LITERAL_enum) && (_tokenSet_5.member(LA(2))))) {
- int _m28 = mark();
- synPredMatched28 = true;
- inputState->guessing++;
- try {
- {
- match(LITERAL_enum);
- {
- switch (LA(1)) {
- case ID: {
- match(ID);
- break;
- }
- case LCURLY: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- match(LCURLY);
- }
- } catch (ANTLR_USE_NAMESPACE(antlr)
- RecognitionException& pe) {
- synPredMatched28 = false;
- }
- rewind(_m28);
- inputState->guessing--;
- }
- if (synPredMatched28) {
- if (inputState->guessing == 0) {
-#line 431 "CPP_parser.g"
- if (statementTrace >= 1) {
- printf("%d external_declaration Enum definition\n",
- LT(1)->getLine());
- }
-
-#line 600 "CPPParser.cpp"
- }
- enum_specifier();
- {
- switch (LA(1)) {
- case ID:
- case LITERAL__stdcall:
- case LITERAL___stdcall:
- case LPAREN:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case TILDE:
- case STAR:
- case AMPERSAND:
- case SCOPE:
- case LITERAL__cdecl:
- case LITERAL___cdecl:
- case LITERAL__near:
- case LITERAL___near:
- case LITERAL__far:
- case LITERAL___far:
- case LITERAL___interrupt:
- case LITERAL_pascal:
- case LITERAL__pascal:
- case LITERAL___pascal: {
- init_declarator_list();
- break;
- }
- case SEMICOLON: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- match(SEMICOLON);
- if (inputState->guessing == 0) {
-#line 434 "CPP_parser.g"
- end_of_stmt();
-#line 645 "CPPParser.cpp"
- }
- } else {
- bool synPredMatched32 = false;
- if (((_tokenSet_6.member(LA(1))) &&
- (_tokenSet_7.member(LA(2))))) {
- int _m32 = mark();
- synPredMatched32 = true;
- inputState->guessing++;
- try {
- {
- {
- switch (LA(1)) {
- case LITERAL_template: {
- template_head();
- break;
- }
- case ID:
- case LITERAL_inline:
- case LITERAL__inline:
- case LITERAL___inline:
- case LITERAL_virtual:
- case TILDE:
- case SCOPE: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- dtor_head(1);
- match(LCURLY);
- }
- } catch (ANTLR_USE_NAMESPACE(antlr)
- RecognitionException& pe) {
- synPredMatched32 = false;
- }
- rewind(_m32);
- inputState->guessing--;
- }
- if (synPredMatched32) {
- if (inputState->guessing == 0) {
-#line 438 "CPP_parser.g"
- if (statementTrace >= 1) {
- printf(
- "%d external_declaration Destructor definition\n",
- LT(1)->getLine());
- }
-
-#line 695 "CPPParser.cpp"
- }
- {
- switch (LA(1)) {
- case LITERAL_template: {
- template_head();
- break;
- }
- case ID:
- case LITERAL_inline:
- case LITERAL__inline:
- case LITERAL___inline:
- case LITERAL_virtual:
- case TILDE:
- case SCOPE: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- dtor_head(1);
- dtor_body();
- } else {
- bool synPredMatched36 = false;
- if (((_tokenSet_8.member(LA(1))) &&
- (_tokenSet_9.member(LA(2))))) {
- int _m36 = mark();
- synPredMatched36 = true;
- inputState->guessing++;
- try {
- {
- {
- if ((true) && (true)) {
- ctor_decl_spec();
- } else {
- }
- }
- if (!(qualifiedItemIsOneOf(qiCtor))) {
- throw ANTLR_USE_NAMESPACE(antlr) SemanticException(
- "qualifiedItemIsOneOf(qiCtor)");
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr)
- RecognitionException& pe) {
- synPredMatched36 = false;
- }
- rewind(_m36);
- inputState->guessing--;
- }
- if (synPredMatched36) {
- if (inputState->guessing == 0) {
-#line 451 "CPP_parser.g"
- if (statementTrace >= 1) {
- printf(
- "%d external_declaration Constructor "
- "definition\n",
- LT(1)->getLine());
- }
-
-#line 755 "CPPParser.cpp"
- }
- ctor_definition();
- } else {
- bool synPredMatched39 = false;
- if (((_tokenSet_10.member(LA(1))) &&
- (_tokenSet_11.member(LA(2))))) {
- int _m39 = mark();
- synPredMatched39 = true;
- inputState->guessing++;
- try {
- {
- {
- switch (LA(1)) {
- case LITERAL_inline: {
- match(LITERAL_inline);
- break;
- }
- case ID:
- case OPERATOR:
- case SCOPE: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1),
- getFilename());
- }
- }
- }
- scope_override();
- conversion_function_decl_or_def();
- }
- } catch (ANTLR_USE_NAMESPACE(antlr)
- RecognitionException& pe) {
- synPredMatched39 = false;
- }
- rewind(_m39);
- inputState->guessing--;
- }
- if (synPredMatched39) {
- if (inputState->guessing == 0) {
-#line 458 "CPP_parser.g"
- if (statementTrace >= 1) {
- printf(
- "%d external_declaration Operator function\n",
- LT(1)->getLine());
- }
-
-#line 802 "CPPParser.cpp"
- }
- {
- switch (LA(1)) {
- case LITERAL_inline: {
- match(LITERAL_inline);
- break;
- }
- case ID:
- case OPERATOR:
- case SCOPE: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- s = scope_override();
- conversion_function_decl_or_def();
- } else {
- bool synPredMatched42 = false;
- if (((_tokenSet_12.member(LA(1))) &&
- (_tokenSet_13.member(LA(2))))) {
- int _m42 = mark();
- synPredMatched42 = true;
- inputState->guessing++;
- try {
- {
- declaration_specifiers();
- function_declarator(0);
- match(SEMICOLON);
- }
- } catch (ANTLR_USE_NAMESPACE(antlr)
- RecognitionException& pe) {
- synPredMatched42 = false;
- }
- rewind(_m42);
- inputState->guessing--;
- }
- if (synPredMatched42) {
- if (inputState->guessing == 0) {
-#line 465 "CPP_parser.g"
- if (statementTrace >= 1) {
- printf(
- "%d external_declaration Function "
- "declaration\n",
- LT(1)->getLine());
- }
-
-#line 851 "CPPParser.cpp"
- }
- declaration_specifiers();
- function_declarator(0);
- match(SEMICOLON);
- if (inputState->guessing == 0) {
-#line 468 "CPP_parser.g"
- end_of_stmt();
-#line 859 "CPPParser.cpp"
- }
- } else {
- bool synPredMatched44 = false;
- if (((_tokenSet_14.member(LA(1))) &&
- (_tokenSet_15.member(LA(2))))) {
- int _m44 = mark();
- synPredMatched44 = true;
- inputState->guessing++;
- try {
- {
- declaration_specifiers();
- function_declarator(1);
- match(LCURLY);
- }
- } catch (ANTLR_USE_NAMESPACE(antlr)
- RecognitionException& pe) {
- synPredMatched44 = false;
- }
- rewind(_m44);
- inputState->guessing--;
- }
- if (synPredMatched44) {
- if (inputState->guessing == 0) {
-#line 472 "CPP_parser.g"
- if (statementTrace >= 1) {
- printf(
- "%d external_declaration Function "
- "definition\n",
- LT(1)->getLine());
- }
-
-#line 887 "CPPParser.cpp"
- }
- function_definition();
- } else {
- bool synPredMatched46 = false;
- if (((_tokenSet_14.member(LA(1))) &&
- (_tokenSet_15.member(LA(2))))) {
- int _m46 = mark();
- synPredMatched46 = true;
- inputState->guessing++;
- try {
- {
- declaration_specifiers();
- function_declarator(1);
- declaration();
- }
- } catch (ANTLR_USE_NAMESPACE(antlr)
- RecognitionException& pe) {
- synPredMatched46 = false;
- }
- rewind(_m46);
- inputState->guessing--;
- }
- if (synPredMatched46) {
- if (inputState->guessing == 0) {
-#line 479 "CPP_parser.g"
- K_and_R = true;
- if (statementTrace >= 1) {
- printf(
- "%d external_declaration K & R function "
- "definition\n",
- LT(1)->getLine());
- }
-
-#line 917 "CPPParser.cpp"
- }
- function_definition();
- } else {
- bool synPredMatched48 = false;
- if (((_tokenSet_14.member(LA(1))) &&
- (_tokenSet_15.member(LA(2))))) {
- int _m48 = mark();
- synPredMatched48 = true;
- inputState->guessing++;
- try {
- {
- function_declarator(1);
- declaration();
- }
- } catch (ANTLR_USE_NAMESPACE(antlr)
- RecognitionException& pe) {
- synPredMatched48 = false;
- }
- rewind(_m48);
- inputState->guessing--;
- }
- if (synPredMatched48) {
- if (inputState->guessing == 0) {
-#line 487 "CPP_parser.g"
- K_and_R = true;
- if (statementTrace >= 1) {
- printf(
- "%d external_declaration K & R "
- "function definition without return "
- "type\n",
- LT(1)->getLine());
- }
-
-#line 946 "CPPParser.cpp"
- }
- function_definition();
- } else {
- bool synPredMatched53 = false;
- if (((_tokenSet_16.member(LA(1))) &&
- (_tokenSet_17.member(LA(2))))) {
- int _m53 = mark();
- synPredMatched53 = true;
- inputState->guessing++;
- try {
- {
- {
- switch (LA(1)) {
- case LITERAL_friend: {
- match(LITERAL_friend);
- break;
- }
- case LITERAL_inline:
- case LITERAL_struct:
- case LITERAL_union:
- case LITERAL_class:
- case LITERAL__inline:
- case LITERAL___inline:
- case LITERAL_virtual:
- case LITERAL_explicit: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(
- LT(1), getFilename());
- }
- }
- }
- { // ( ... )*
- for (;;) {
- if ((_tokenSet_4.member(LA(1)))) {
- fs = function_specifier();
- } else {
- goto _loop52;
- }
- }
- _loop52:;
- } // ( ... )*
- class_specifier();
- }
- } catch (ANTLR_USE_NAMESPACE(antlr)
- RecognitionException& pe) {
- synPredMatched53 = false;
- }
- rewind(_m53);
- inputState->guessing--;
- }
- if (synPredMatched53) {
- if (inputState->guessing == 0) {
-#line 495 "CPP_parser.g"
- if (statementTrace >= 1) {
- printf(
- "%d external_declaration Class decl "
- "or def\n",
- LT(1)->getLine());
- }
-
-#line 1009 "CPPParser.cpp"
- }
- {
- switch (LA(1)) {
- case LITERAL_friend: {
- match(LITERAL_friend);
- break;
- }
- case LITERAL_inline:
- case LITERAL_struct:
- case LITERAL_union:
- case LITERAL_class:
- case LITERAL__inline:
- case LITERAL___inline:
- case LITERAL_virtual:
- case LITERAL_explicit: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1),
- getFilename());
- }
- }
- }
- { // ( ... )*
- for (;;) {
- if ((_tokenSet_4.member(LA(1)))) {
- fs = function_specifier();
- } else {
- goto _loop56;
- }
- }
- _loop56:;
- } // ( ... )*
- class_decl_or_def(fs);
- {
- switch (LA(1)) {
- case ID:
- case LITERAL__stdcall:
- case LITERAL___stdcall:
- case LPAREN:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case TILDE:
- case STAR:
- case AMPERSAND:
- case SCOPE:
- case LITERAL__cdecl:
- case LITERAL___cdecl:
- case LITERAL__near:
- case LITERAL___near:
- case LITERAL__far:
- case LITERAL___far:
- case LITERAL___interrupt:
- case LITERAL_pascal:
- case LITERAL__pascal:
- case LITERAL___pascal: {
- init_declarator_list();
- break;
- }
- case SEMICOLON: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1),
- getFilename());
- }
- }
- }
- match(SEMICOLON);
- if (inputState->guessing == 0) {
-#line 498 "CPP_parser.g"
- end_of_stmt();
-#line 1090 "CPPParser.cpp"
- }
- } else if ((LA(1) == LITERAL_template) &&
- (LA(2) == LESSTHAN)) {
- if (inputState->guessing == 0) {
-#line 501 "CPP_parser.g"
- beginTemplateDeclaration();
-#line 1097 "CPPParser.cpp"
- }
- template_head();
- {
- bool synPredMatched61 = false;
- if (((_tokenSet_12.member(LA(1))) &&
- (_tokenSet_18.member(LA(2))))) {
- int _m61 = mark();
- synPredMatched61 = true;
- inputState->guessing++;
- try {
- {
- declaration_specifiers();
- {
- switch (LA(1)) {
- case ID:
- case LITERAL__stdcall:
- case LITERAL___stdcall:
- case LPAREN:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case TILDE:
- case STAR:
- case AMPERSAND:
- case SCOPE:
- case LITERAL__cdecl:
- case LITERAL___cdecl:
- case LITERAL__near:
- case LITERAL___near:
- case LITERAL__far:
- case LITERAL___far:
- case LITERAL___interrupt:
- case LITERAL_pascal:
- case LITERAL__pascal:
- case LITERAL___pascal: {
- init_declarator_list();
- break;
- }
- case SEMICOLON: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(
- LT(1), getFilename());
- }
- }
- }
- match(SEMICOLON);
- if (inputState->guessing == 0) {
-#line 505 "CPP_parser.g"
- end_of_stmt();
-#line 1151 "CPPParser.cpp"
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr)
- RecognitionException& pe) {
- synPredMatched61 = false;
- }
- rewind(_m61);
- inputState->guessing--;
- }
- if (synPredMatched61) {
- if (inputState->guessing == 0) {
-#line 506 "CPP_parser.g"
- if (statementTrace >= 1) {
- printf(
- "%d external_declaration "
- "Templated class forward "
- "declaration\n",
- LT(1)->getLine());
- }
-
-#line 1167 "CPPParser.cpp"
- }
- declaration_specifiers();
- {
- switch (LA(1)) {
- case ID:
- case LITERAL__stdcall:
- case LITERAL___stdcall:
- case LPAREN:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case TILDE:
- case STAR:
- case AMPERSAND:
- case SCOPE:
- case LITERAL__cdecl:
- case LITERAL___cdecl:
- case LITERAL__near:
- case LITERAL___near:
- case LITERAL__far:
- case LITERAL___far:
- case LITERAL___interrupt:
- case LITERAL_pascal:
- case LITERAL__pascal:
- case LITERAL___pascal: {
- init_declarator_list();
- break;
- }
- case SEMICOLON: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(
- LT(1), getFilename());
- }
- }
- }
- match(SEMICOLON);
- if (inputState->guessing == 0) {
-#line 509 "CPP_parser.g"
- end_of_stmt();
-#line 1212 "CPPParser.cpp"
- }
- } else {
- bool synPredMatched64 = false;
- if (((_tokenSet_2.member(LA(1))) &&
- (_tokenSet_3.member(LA(2))))) {
- int _m64 = mark();
- synPredMatched64 = true;
- inputState->guessing++;
- try {
- {
- declaration_specifiers();
- function_declarator(0);
- match(SEMICOLON);
- }
- } catch (ANTLR_USE_NAMESPACE(antlr)
- RecognitionException& pe) {
- synPredMatched64 = false;
- }
- rewind(_m64);
- inputState->guessing--;
- }
- if (synPredMatched64) {
- if (inputState->guessing == 0) {
-#line 513 "CPP_parser.g"
- if (statementTrace >= 1) {
- printf(
- "%d external_declaration "
- "Templated function "
- "declaration\n",
- LT(1)->getLine());
- }
-
-#line 1240 "CPPParser.cpp"
- }
- declaration();
- } else {
- bool synPredMatched66 = false;
- if (((_tokenSet_14.member(LA(1))) &&
- (_tokenSet_15.member(LA(2))))) {
- int _m66 = mark();
- synPredMatched66 = true;
- inputState->guessing++;
- try {
- {
- declaration_specifiers();
- function_declarator(1);
- match(LCURLY);
- }
- } catch (ANTLR_USE_NAMESPACE(
- antlr) RecognitionException& pe) {
- synPredMatched66 = false;
- }
- rewind(_m66);
- inputState->guessing--;
- }
- if (synPredMatched66) {
- if (inputState->guessing == 0) {
-#line 520 "CPP_parser.g"
- if (statementTrace >= 1) {
- printf(
- "%d external_declaration_10c "
- "Templated function "
- "definition\n",
- LT(1)->getLine());
- }
-
-#line 1269 "CPPParser.cpp"
- }
- function_definition();
- } else {
- bool synPredMatched68 = false;
- if (((_tokenSet_8.member(LA(1))) &&
- (_tokenSet_9.member(LA(2))))) {
- int _m68 = mark();
- synPredMatched68 = true;
- inputState->guessing++;
- try {
- {
- ctor_decl_spec();
- if (!(qualifiedItemIsOneOf(
- qiCtor))) {
- throw ANTLR_USE_NAMESPACE(
- antlr)
- SemanticException(
- "qualifiedItemIsOneOf"
- "(qiCtor)");
- }
- }
- } catch (
- ANTLR_USE_NAMESPACE(antlr)
- RecognitionException& pe) {
- synPredMatched68 = false;
- }
- rewind(_m68);
- inputState->guessing--;
- }
- if (synPredMatched68) {
- if (inputState->guessing == 0) {
-#line 531 "CPP_parser.g"
- if (statementTrace >= 1) {
- printf(
- "%d external_declaration "
- "Templated constructor "
- "definition\n",
- LT(1)->getLine());
- }
-
-#line 1298 "CPPParser.cpp"
- }
- ctor_definition();
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(
- LT(1), getFilename());
- }
- }
- }
- }
- }
- if (inputState->guessing == 0) {
-#line 536 "CPP_parser.g"
- endTemplateDeclaration();
-#line 1310 "CPPParser.cpp"
- }
- } else if ((_tokenSet_2.member(LA(1))) &&
- (_tokenSet_3.member(LA(2)))) {
- if (inputState->guessing == 0) {
-#line 545 "CPP_parser.g"
- if (statementTrace >= 1) {
- printf(
- "%d external_declaration "
- "Declaration\n",
- LT(1)->getLine());
- }
-
-#line 1319 "CPPParser.cpp"
- }
- declaration();
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1),
- getFilename());
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_19);
- } else {
- throw;
- }
- }
-}
-
-CPPParser::TypeSpecifier CPPParser::class_specifier() {
-#line 1016 "CPP_parser.g"
- CPPParser::TypeSpecifier ts = tsInvalid;
-#line 1342 "CPPParser.cpp"
-
- try { // for error handling
- {
- switch (LA(1)) {
- case LITERAL_class: {
- match(LITERAL_class);
- if (inputState->guessing == 0) {
-#line 1018 "CPP_parser.g"
- ts = tsCLASS;
-#line 1353 "CPPParser.cpp"
- }
- break;
- }
- case LITERAL_struct: {
- match(LITERAL_struct);
- if (inputState->guessing == 0) {
-#line 1019 "CPP_parser.g"
- ts = tsSTRUCT;
-#line 1363 "CPPParser.cpp"
- }
- break;
- }
- case LITERAL_union: {
- match(LITERAL_union);
- if (inputState->guessing == 0) {
-#line 1020 "CPP_parser.g"
- ts = tsUNION;
-#line 1373 "CPPParser.cpp"
- }
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_12);
- } else {
- throw;
- }
- }
- return ts;
-}
-
-void CPPParser::class_decl_or_def(FunctionSpecifier fs) {
-#line 1042 "CPP_parser.g"
- char* saveClass;
- char* id;
- TypeSpecifier ts = tsInvalid; // Available for use
-
-#line 1403 "CPPParser.cpp"
-
- try { // for error handling
- {
- switch (LA(1)) {
- case LITERAL_class: {
- match(LITERAL_class);
- if (inputState->guessing == 0) {
-#line 1048 "CPP_parser.g"
- ts = tsCLASS;
-#line 1414 "CPPParser.cpp"
- }
- break;
- }
- case LITERAL_struct: {
- match(LITERAL_struct);
- if (inputState->guessing == 0) {
-#line 1049 "CPP_parser.g"
- ts = tsSTRUCT;
-#line 1424 "CPPParser.cpp"
- }
- break;
- }
- case LITERAL_union: {
- match(LITERAL_union);
- if (inputState->guessing == 0) {
-#line 1050 "CPP_parser.g"
- ts = tsUNION;
-#line 1434 "CPPParser.cpp"
- }
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- class_prefix();
- { // ( ... )*
- for (;;) {
- if ((LA(1) == LITERAL_GFIGNORE)) {
- match(LITERAL_GFIGNORE);
- match(LPAREN);
- expression();
- match(RPAREN);
- if (inputState->guessing == 0) {
-#line 1053 "CPP_parser.g"
-#line 1454 "CPPParser.cpp"
- }
- } else {
- goto _loop208;
- }
- }
- _loop208:;
- } // ( ... )*
- {
- switch (LA(1)) {
- case ID:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case SCOPE: {
- id = qualified_id();
- {
- switch (LA(1)) {
- case SEMICOLON:
- case ID:
- case LITERAL__stdcall:
- case LITERAL___stdcall:
- case LPAREN:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case TILDE:
- case STAR:
- case AMPERSAND:
- case SCOPE:
- case LITERAL__cdecl:
- case LITERAL___cdecl:
- case LITERAL__near:
- case LITERAL___near:
- case LITERAL__far:
- case LITERAL___far:
- case LITERAL___interrupt:
- case LITERAL_pascal:
- case LITERAL__pascal:
- case LITERAL___pascal: {
- if (inputState->guessing == 0) {
-#line 1058 "CPP_parser.g"
- classForwardDeclaration(ts, fs, id);
-#line 1503 "CPPParser.cpp"
- }
- break;
- }
- case LCURLY:
- case COLON: {
- if (inputState->guessing == 0) {
-#line 1060 "CPP_parser.g"
- saveClass = enclosingClass;
- enclosingClass = symbols->strdup(id);
-
-#line 1515 "CPPParser.cpp"
- }
- {
- switch (LA(1)) {
- case COLON: {
- base_clause();
- break;
- }
- case LCURLY: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- match(LCURLY);
- if (inputState->guessing == 0) {
-#line 1065 "CPP_parser.g"
- beginClassDefinition(ts, id);
-#line 1538 "CPPParser.cpp"
- }
- { // ( ... )*
- for (;;) {
- if ((_tokenSet_20.member(LA(1)))) {
- member_declaration();
- } else {
- goto _loop215;
- }
- }
- _loop215:;
- } // ( ... )*
- if (inputState->guessing == 0) {
-#line 1067 "CPP_parser.g"
- endClassDefinition();
-#line 1555 "CPPParser.cpp"
- }
- match(RCURLY);
- if (inputState->guessing == 0) {
-#line 1069 "CPP_parser.g"
- enclosingClass = saveClass;
-#line 1561 "CPPParser.cpp"
- }
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- break;
- }
- case LCURLY: {
- match(LCURLY);
- if (inputState->guessing == 0) {
-#line 1073 "CPP_parser.g"
- saveClass = enclosingClass;
- enclosingClass = (char*)"__anonymous";
-#line 1579 "CPPParser.cpp"
- }
- if (inputState->guessing == 0) {
-#line 1074 "CPP_parser.g"
- beginClassDefinition(ts, "anonymous");
-#line 1584 "CPPParser.cpp"
- }
- { // ( ... )*
- for (;;) {
- if ((_tokenSet_20.member(LA(1)))) {
- member_declaration();
- } else {
- goto _loop217;
- }
- }
- _loop217:;
- } // ( ... )*
- if (inputState->guessing == 0) {
-#line 1076 "CPP_parser.g"
- endClassDefinition();
-#line 1601 "CPPParser.cpp"
- }
- match(RCURLY);
- if (inputState->guessing == 0) {
-#line 1078 "CPP_parser.g"
- enclosingClass = saveClass;
-#line 1607 "CPPParser.cpp"
- }
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_21);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::init_declarator_list() {
- try { // for error handling
- init_declarator();
- { // ( ... )*
- for (;;) {
- if ((LA(1) == COMMA)) {
- match(COMMA);
- init_declarator();
- } else {
- goto _loop242;
- }
- }
- _loop242:;
- } // ( ... )*
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_22);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::enum_specifier() {
-#line 1108 "CPP_parser.g"
- char* id;
-#line 1659 "CPPParser.cpp"
-
- try { // for error handling
- match(LITERAL_enum);
- {
- switch (LA(1)) {
- case LCURLY: {
- match(LCURLY);
- enumerator_list();
- match(RCURLY);
- break;
- }
- case ID:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case SCOPE: {
- id = qualified_id();
- if (inputState->guessing == 0) {
-#line 1116 "CPP_parser.g"
- beginEnumDefinition(id);
-#line 1683 "CPPParser.cpp"
- }
- {
- switch (LA(1)) {
- case LCURLY: {
- match(LCURLY);
- enumerator_list();
- match(RCURLY);
- break;
- }
- case SEMICOLON:
- case ID:
- case COLON:
- case LITERAL__stdcall:
- case LITERAL___stdcall:
- case LPAREN:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case TILDE:
- case STAR:
- case AMPERSAND:
- case SCOPE:
- case LITERAL__cdecl:
- case LITERAL___cdecl:
- case LITERAL__near:
- case LITERAL___near:
- case LITERAL__far:
- case LITERAL___far:
- case LITERAL___interrupt:
- case LITERAL_pascal:
- case LITERAL__pascal:
- case LITERAL___pascal: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- if (inputState->guessing == 0) {
-#line 1118 "CPP_parser.g"
- endEnumDefinition();
-#line 1730 "CPPParser.cpp"
- }
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_23);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::declaration_specifiers() {
- ANTLR_USE_NAMESPACE(antlr)
- RefToken gfArr = ANTLR_USE_NAMESPACE(antlr) nullToken;
- ANTLR_USE_NAMESPACE(antlr)
- RefToken gfArrList = ANTLR_USE_NAMESPACE(antlr) nullToken;
- ANTLR_USE_NAMESPACE(antlr)
- RefToken gfArrElem = ANTLR_USE_NAMESPACE(antlr) nullToken;
-#line 885 "CPP_parser.g"
- // Locals
- bool td = false; // For typedef
- bool fd = false; // For friend
- StorageClass sc = scInvalid; // auto,register,static,extern,mutable
- TypeQualifier tq =
- tqInvalid; // const,volatile // aka cv_qualifier See type_qualifier
- TypeSpecifier ts = tsInvalid; // char,int,double, etc., class,struct,union
- FunctionSpecifier fs = fsInvalid; // inline,virtual,explicit
-
-#line 1764 "CPPParser.cpp"
-
- try { // for error handling
- if (inputState->guessing == 0) {
-#line 895 "CPP_parser.g"
-
- // Global flags to allow for nested declarations
- _td = false; // For typedef
- _fd = false; // For friend
- _sc = scInvalid; // For StorageClass //
- // auto,register,static,extern,mutable
- _tq = tqInvalid; // For TypeQualifier // aka cv_qualifier See
- // type_qualifier
- _ts = tsInvalid; // For TypeSpecifier
- _fs = fsInvalid; // For FunctionSpecifier // inline,virtual,explicit
-
-#line 1779 "CPPParser.cpp"
- }
- {
- { // ( ... )*
- for (;;) {
- switch (LA(1)) {
- case LITERAL_typedef: {
- match(LITERAL_typedef);
- if (inputState->guessing == 0) {
-#line 906 "CPP_parser.g"
- td = true;
-#line 1791 "CPPParser.cpp"
- }
- break;
- }
- case LITERAL_friend: {
- match(LITERAL_friend);
- if (inputState->guessing == 0) {
-#line 907 "CPP_parser.g"
- fd = true;
-#line 1801 "CPPParser.cpp"
- }
- break;
- }
- case LITERAL_extern:
- case LITERAL_auto:
- case LITERAL_register:
- case LITERAL_static:
- case LITERAL_mutable: {
- sc = storage_class_specifier();
- break;
- }
- case LITERAL_const:
- case LITERAL___const:
- case LITERAL_volatile:
- case LITERAL___volatile__: {
- tq = type_qualifier();
- break;
- }
- case LITERAL_struct:
- case LITERAL_union:
- case LITERAL_class: {
- ts = class_specifier();
- break;
- }
- case LITERAL_enum: {
- match(LITERAL_enum);
- break;
- }
- case LITERAL_inline:
- case LITERAL__inline:
- case LITERAL___inline:
- case LITERAL_virtual:
- case LITERAL_explicit: {
- fs = function_specifier();
- break;
- }
- case LITERAL__stdcall:
- case LITERAL___stdcall: {
- {
- switch (LA(1)) {
- case LITERAL__stdcall: {
- match(LITERAL__stdcall);
- break;
- }
- case LITERAL___stdcall: {
- match(LITERAL___stdcall);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- break;
- }
- case LITERAL_GFEXCLUDE: {
- match(LITERAL_GFEXCLUDE);
- if (inputState->guessing == 0) {
-#line 914 "CPP_parser.g"
- tq |= tqGFEXCLUDE;
- _tq |= tqGFEXCLUDE;
-#line 1872 "CPPParser.cpp"
- }
- break;
- }
- case LITERAL_GFINCLUDE: {
- match(LITERAL_GFINCLUDE);
- if (inputState->guessing == 0) {
-#line 915 "CPP_parser.g"
- tq |= tqGFINCLUDE;
- _tq |= tqGFINCLUDE;
-#line 1882 "CPPParser.cpp"
- }
- break;
- }
- case LITERAL_GFID: {
- match(LITERAL_GFID);
- if (inputState->guessing == 0) {
-#line 916 "CPP_parser.g"
- tq |= tqGFID;
- _tq |= tqGFID;
-#line 1892 "CPPParser.cpp"
- }
- break;
- }
- case LITERAL_GFUNREAD: {
- match(LITERAL_GFUNREAD);
- if (inputState->guessing == 0) {
-#line 917 "CPP_parser.g"
- tq |= tqGFUNREAD;
- _tq |= tqGFUNREAD;
-#line 1902 "CPPParser.cpp"
- }
- break;
- }
- case LITERAL_GFARRAYSIZE: {
- match(LITERAL_GFARRAYSIZE);
- match(LPAREN);
- gfArr = LT(1);
- match(ID);
- match(RPAREN);
- if (inputState->guessing == 0) {
-#line 918 "CPP_parser.g"
- gfArraySize(gfArr->getText().data());
-#line 1916 "CPPParser.cpp"
- }
- break;
- }
- case LITERAL_GFARRAYSIZES: {
- match(LITERAL_GFARRAYSIZES);
- match(LPAREN);
- gfArrList = LT(1);
- match(StringLiteral);
- match(RPAREN);
- if (inputState->guessing == 0) {
-#line 919 "CPP_parser.g"
- gfArraySize(gfArrList->getText().data());
-#line 1930 "CPPParser.cpp"
- }
- break;
- }
- case LITERAL_GFARRAYELEMSIZE: {
- match(LITERAL_GFARRAYELEMSIZE);
- match(LPAREN);
- gfArrElem = LT(1);
- match(ID);
- match(RPAREN);
- if (inputState->guessing == 0) {
-#line 920 "CPP_parser.g"
- gfArrayElemSize(gfArrElem->getText().data());
-#line 1944 "CPPParser.cpp"
- }
- break;
- }
- default: { goto _loop174; }
- }
- }
- _loop174:;
- } // ( ... )*
- ts = type_specifier();
- }
- if (inputState->guessing == 0) {
-#line 924 "CPP_parser.g"
- declarationSpecifier(td, fd, sc, tq, ts, fs);
-#line 1961 "CPPParser.cpp"
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_24);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::function_declarator(int definition) {
- try { // for error handling
- bool synPredMatched298 = false;
- if (((_tokenSet_25.member(LA(1))) && (_tokenSet_26.member(LA(2))))) {
- int _m298 = mark();
- synPredMatched298 = true;
- inputState->guessing++;
- try {
- { ptr_operator(); }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& pe) {
- synPredMatched298 = false;
- }
- rewind(_m298);
- inputState->guessing--;
- }
- if (synPredMatched298) {
- ptr_operator();
- function_declarator(definition);
- } else if ((_tokenSet_27.member(LA(1))) && (_tokenSet_28.member(LA(2)))) {
- function_direct_declarator(definition);
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
-
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_29);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::declaration() {
- try { // for error handling
- bool synPredMatched159 = false;
- if (((LA(1) == LITERAL_extern) && (LA(2) == StringLiteral))) {
- int _m159 = mark();
- synPredMatched159 = true;
- inputState->guessing++;
- try {
- {
- match(LITERAL_extern);
- match(StringLiteral);
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& pe) {
- synPredMatched159 = false;
- }
- rewind(_m159);
- inputState->guessing--;
- }
- if (synPredMatched159) {
- linkage_specification();
- } else if ((_tokenSet_12.member(LA(1))) && (_tokenSet_18.member(LA(2)))) {
- if (inputState->guessing == 0) {
-#line 853 "CPP_parser.g"
- beginDeclaration();
-#line 2044 "CPPParser.cpp"
- }
- declaration_specifiers();
- {
- switch (LA(1)) {
- case ID:
- case LITERAL__stdcall:
- case LITERAL___stdcall:
- case LPAREN:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case TILDE:
- case STAR:
- case AMPERSAND:
- case SCOPE:
- case LITERAL__cdecl:
- case LITERAL___cdecl:
- case LITERAL__near:
- case LITERAL___near:
- case LITERAL__far:
- case LITERAL___far:
- case LITERAL___interrupt:
- case LITERAL_pascal:
- case LITERAL__pascal:
- case LITERAL___pascal: {
- init_declarator_list();
- break;
- }
- case SEMICOLON: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- match(SEMICOLON);
- if (inputState->guessing == 0) {
-#line 854 "CPP_parser.g"
- end_of_stmt();
-#line 2089 "CPPParser.cpp"
- }
- if (inputState->guessing == 0) {
-#line 855 "CPP_parser.g"
- endDeclaration();
-#line 2094 "CPPParser.cpp"
- }
- } else if ((LA(1) == LITERAL_using)) {
- using_statement();
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
-
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_30);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::template_head() {
- try { // for error handling
- match(LITERAL_template);
- match(LESSTHAN);
- template_parameter_list();
- match(GREATERTHAN);
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_31);
- } else {
- throw;
- }
- }
-}
-
-CPPParser::FunctionSpecifier CPPParser::function_specifier() {
-#line 937 "CPP_parser.g"
- CPPParser::FunctionSpecifier fs = fsInvalid;
-#line 2136 "CPPParser.cpp"
-
- try { // for error handling
- switch (LA(1)) {
- case LITERAL_inline:
- case LITERAL__inline:
- case LITERAL___inline: {
- {
- switch (LA(1)) {
- case LITERAL_inline: {
- match(LITERAL_inline);
- break;
- }
- case LITERAL__inline: {
- match(LITERAL__inline);
- break;
- }
- case LITERAL___inline: {
- match(LITERAL___inline);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- if (inputState->guessing == 0) {
-#line 938 "CPP_parser.g"
- fs = fsINLINE;
-#line 2170 "CPPParser.cpp"
- }
- break;
- }
- case LITERAL_virtual: {
- match(LITERAL_virtual);
- if (inputState->guessing == 0) {
-#line 939 "CPP_parser.g"
- fs = fsVIRTUAL;
-#line 2180 "CPPParser.cpp"
- }
- break;
- }
- case LITERAL_explicit: {
- match(LITERAL_explicit);
- if (inputState->guessing == 0) {
-#line 940 "CPP_parser.g"
- fs = fsEXPLICIT;
-#line 2190 "CPPParser.cpp"
- }
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_14);
- } else {
- throw;
- }
- }
- return fs;
-}
-
-void CPPParser::dtor_head(int definition) {
- try { // for error handling
- dtor_decl_spec();
- dtor_declarator(definition);
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_32);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::dtor_body() {
- try { // for error handling
- compound_statement();
- if (inputState->guessing == 0) {
-#line 1476 "CPP_parser.g"
- endDestructorDefinition();
-#line 2236 "CPPParser.cpp"
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_30);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::ctor_decl_spec() {
- try { // for error handling
- { // ( ... )*
- for (;;) {
- switch (LA(1)) {
- case LITERAL_inline:
- case LITERAL__inline:
- case LITERAL___inline: {
- {
- switch (LA(1)) {
- case LITERAL_inline: {
- match(LITERAL_inline);
- break;
- }
- case LITERAL__inline: {
- match(LITERAL__inline);
- break;
- }
- case LITERAL___inline: {
- match(LITERAL___inline);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- break;
- }
- case LITERAL_explicit: {
- match(LITERAL_explicit);
- break;
- }
- default: { goto _loop311; }
- }
- }
- _loop311:;
- } // ( ... )*
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_33);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::ctor_definition() {
- try { // for error handling
- ctor_head();
- ctor_body();
- if (inputState->guessing == 0) {
-#line 1385 "CPP_parser.g"
- endConstructorDefinition();
-#line 2316 "CPPParser.cpp"
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_30);
- } else {
- throw;
- }
- }
-}
-
-char* CPPParser::scope_override() {
-#line 2226 "CPP_parser.g"
- char* s = NULL;
-#line 2332 "CPPParser.cpp"
- ANTLR_USE_NAMESPACE(antlr) RefToken id = ANTLR_USE_NAMESPACE(antlr) nullToken;
-#line 2226 "CPP_parser.g"
-
- static char sitem[CPPParser_MaxQualifiedItemSize + 1];
- sitem[0] = '\0';
-
-#line 2339 "CPPParser.cpp"
-
- try { // for error handling
- {
- switch (LA(1)) {
- case SCOPE: {
- match(SCOPE);
- if (inputState->guessing == 0) {
-#line 2232 "CPP_parser.g"
- strcat(sitem, "::");
-#line 2350 "CPPParser.cpp"
- }
- break;
- }
- case ID:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case TILDE:
- case STAR: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- { // ( ... )*
- for (;;) {
- if (((LA(1) == ID) && (LA(2) == LESSTHAN || LA(2) == SCOPE)) &&
- (scopedItem())) {
- id = LT(1);
- match(ID);
- {
- switch (LA(1)) {
- case LESSTHAN: {
- match(LESSTHAN);
- template_argument_list();
- match(GREATERTHAN);
- break;
- }
- case SCOPE: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- match(SCOPE);
- {
- switch (LA(1)) {
- case LITERAL_template: {
- match(LITERAL_template);
- break;
- }
- case ID:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case TILDE:
- case STAR: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- if (inputState->guessing == 0) {
-#line 2238 "CPP_parser.g"
-
- CPPSymbol* cs = (CPPSymbol*)symbols->lookup((id->getText()).data());
- strcat(sitem, (id->getText()).data());
- strcat(sitem, "::");
-
-#line 2425 "CPPParser.cpp"
- }
- } else {
- goto _loop587;
- }
- }
- _loop587:;
- } // ( ... )*
- if (inputState->guessing == 0) {
-#line 2244 "CPP_parser.g"
- s = sitem;
-#line 2438 "CPPParser.cpp"
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_34);
- } else {
- throw;
- }
- }
- return s;
-}
-
-void CPPParser::conversion_function_decl_or_def() {
-#line 1302 "CPP_parser.g"
- CPPParser::TypeQualifier tq;
-#line 2455 "CPPParser.cpp"
-
- try { // for error handling
- match(OPERATOR);
- declaration_specifiers();
- {
- switch (LA(1)) {
- case STAR: {
- match(STAR);
- break;
- }
- case AMPERSAND: {
- match(AMPERSAND);
- break;
- }
- case LESSTHAN:
- case LPAREN: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- {
- switch (LA(1)) {
- case LESSTHAN: {
- match(LESSTHAN);
- template_parameter_list();
- match(GREATERTHAN);
- break;
- }
- case LPAREN: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- match(LPAREN);
- {
- switch (LA(1)) {
- case LITERAL_typedef:
- case LITERAL_enum:
- case ID:
- case LITERAL_inline:
- case LITERAL_friend:
- case LITERAL_extern:
- case LITERAL_struct:
- case LITERAL_union:
- case LITERAL_class:
- case LITERAL__stdcall:
- case LITERAL___stdcall:
- case LITERAL_GFEXCLUDE:
- case LITERAL_GFINCLUDE:
- case LITERAL_GFID:
- case LITERAL_GFUNREAD:
- case LITERAL_GFARRAYSIZE:
- case LPAREN:
- case LITERAL_GFARRAYSIZES:
- case LITERAL_GFARRAYELEMSIZE:
- case LITERAL_auto:
- case LITERAL_register:
- case LITERAL_static:
- case LITERAL_mutable:
- case LITERAL__inline:
- case LITERAL___inline:
- case LITERAL_virtual:
- case LITERAL_explicit:
- case LITERAL_typename:
- case LITERAL_char:
- case LITERAL_wchar_t:
- case LITERAL_bool:
- case LITERAL_short:
- case LITERAL_int:
- case 50:
- case 51:
- case 52:
- case 53:
- case 54:
- case 55:
- case 56:
- case 57:
- case 58:
- case 59:
- case 60:
- case 61:
- case 62:
- case 63:
- case 64:
- case 65:
- case 66:
- case 67:
- case LITERAL_long:
- case LITERAL_signed:
- case LITERAL_unsigned:
- case LITERAL_float:
- case LITERAL_double:
- case LITERAL_void:
- case LITERAL__declspec:
- case LITERAL___declspec:
- case LITERAL_const:
- case LITERAL___const:
- case LITERAL_volatile:
- case LITERAL___volatile__:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case TILDE:
- case STAR:
- case AMPERSAND:
- case ELLIPSIS:
- case SCOPE:
- case LITERAL__cdecl:
- case LITERAL___cdecl:
- case LITERAL__near:
- case LITERAL___near:
- case LITERAL__far:
- case LITERAL___far:
- case LITERAL___interrupt:
- case LITERAL_pascal:
- case LITERAL__pascal:
- case LITERAL___pascal: {
- parameter_list();
- break;
- }
- case RPAREN: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- match(RPAREN);
- { // ( ... )*
- for (;;) {
- if (((LA(1) >= LITERAL_const && LA(1) <= LITERAL___volatile__))) {
- tq = type_qualifier();
- } else {
- goto _loop293;
- }
- }
- _loop293:;
- } // ( ... )*
- {
- switch (LA(1)) {
- case LITERAL_throw: {
- exception_specification();
- break;
- }
- case SEMICOLON:
- case LCURLY: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- {
- switch (LA(1)) {
- case LCURLY: {
- compound_statement();
- break;
- }
- case SEMICOLON: {
- match(SEMICOLON);
- if (inputState->guessing == 0) {
-#line 1311 "CPP_parser.g"
- end_of_stmt();
-#line 2645 "CPPParser.cpp"
- }
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_30);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::function_definition() {
- try { // for error handling
- if (inputState->guessing == 0) {
-#line 822 "CPP_parser.g"
-
- beginFunctionDefinition();
-
-#line 2674 "CPPParser.cpp"
- }
- {
- if (((_tokenSet_12.member(LA(1))) && (_tokenSet_13.member(LA(2)))) &&
- ((!(LA(1) == SCOPE || LA(1) == ID) ||
- qualifiedItemIsOneOf(qiType | qiCtor)))) {
- declaration_specifiers();
- function_declarator(1);
- {
- if ((_tokenSet_35.member(LA(1))) && (_tokenSet_36.member(LA(2)))) {
- { // ( ... )*
- for (;;) {
- if ((_tokenSet_2.member(LA(1)))) {
- declaration();
- } else {
- goto _loop153;
- }
- }
- _loop153:;
- } // ( ... )*
- if (inputState->guessing == 0) {
-#line 831 "CPP_parser.g"
- in_parameter_list = false;
-#line 2697 "CPPParser.cpp"
- }
- } else if ((LA(1) == LCURLY) && (_tokenSet_37.member(LA(2)))) {
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- compound_statement();
- } else if ((_tokenSet_38.member(LA(1))) && (_tokenSet_39.member(LA(2)))) {
- function_declarator(1);
- {
- if ((_tokenSet_35.member(LA(1))) && (_tokenSet_36.member(LA(2)))) {
- { // ( ... )*
- for (;;) {
- if ((_tokenSet_2.member(LA(1)))) {
- declaration();
- } else {
- goto _loop156;
- }
- }
- _loop156:;
- } // ( ... )*
- if (inputState->guessing == 0) {
-#line 840 "CPP_parser.g"
- in_parameter_list = false;
-#line 2728 "CPPParser.cpp"
- }
- } else if ((LA(1) == LCURLY) && (_tokenSet_37.member(LA(2)))) {
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- compound_statement();
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- if (inputState->guessing == 0) {
-#line 844 "CPP_parser.g"
- endFunctionDefinition();
-#line 2748 "CPPParser.cpp"
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_30);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::namespace_definition() {
- ANTLR_USE_NAMESPACE(antlr) RefToken ns = ANTLR_USE_NAMESPACE(antlr) nullToken;
-
- try { // for error handling
- {
- switch (LA(1)) {
- case ID: {
- ns = LT(1);
- match(ID);
- if (inputState->guessing == 0) {
-#line 568 "CPP_parser.g"
- declaratorID((ns->getText()).data(), qiNamespace);
-#line 2774 "CPPParser.cpp"
- }
- break;
- }
- case LCURLY: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- match(LCURLY);
- if (inputState->guessing == 0) {
-#line 570 "CPP_parser.g"
- enterNewLocalScope();
-#line 2792 "CPPParser.cpp"
- }
- { // ( ... )*
- for (;;) {
- if ((_tokenSet_0.member(LA(1)))) {
- external_declaration();
- } else {
- goto _loop72;
- }
- }
- _loop72:;
- } // ( ... )*
- if (inputState->guessing == 0) {
-#line 572 "CPP_parser.g"
- exitNamespaceScope();
- exitLocalScope();
-#line 2809 "CPPParser.cpp"
- }
- match(RCURLY);
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_19);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::namespace_alias_definition() {
- ANTLR_USE_NAMESPACE(antlr)
- RefToken ns2 = ANTLR_USE_NAMESPACE(antlr) nullToken;
-#line 577 "CPP_parser.g"
- char* qid;
-#line 2827 "CPPParser.cpp"
-
- try { // for error handling
- match(LITERAL_namespace);
- ns2 = LT(1);
- match(ID);
- if (inputState->guessing == 0) {
-#line 581 "CPP_parser.g"
- declaratorID((ns2->getText()).data(), qiNamespace);
-#line 2836 "CPPParser.cpp"
- }
- match(ASSIGNEQUAL);
- qid = qualified_id();
- match(SEMICOLON);
- if (inputState->guessing == 0) {
-#line 582 "CPP_parser.g"
- end_of_stmt();
-#line 2844 "CPPParser.cpp"
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_40);
- } else {
- throw;
- }
- }
-}
-
-char* CPPParser::qualified_id() {
-#line 1143 "CPP_parser.g"
- char* q = NULL;
-#line 2860 "CPPParser.cpp"
- ANTLR_USE_NAMESPACE(antlr) RefToken id = ANTLR_USE_NAMESPACE(antlr) nullToken;
-#line 1143 "CPP_parser.g"
-
- char* so = NULL;
- static char qitem[CPPParser_MaxQualifiedItemSize + 1];
-
-#line 2867 "CPPParser.cpp"
-
- try { // for error handling
- so = scope_override();
- if (inputState->guessing == 0) {
-#line 1150 "CPP_parser.g"
- strcpy(qitem, so);
-#line 2874 "CPPParser.cpp"
- }
- {
- switch (LA(1)) {
- case ID: {
- id = LT(1);
- match(ID);
- {
- switch (LA(1)) {
- case LESSTHAN: {
- match(LESSTHAN);
- template_argument_list();
- match(GREATERTHAN);
- break;
- }
- case GREATERTHAN:
- case SEMICOLON:
- case ID:
- case LCURLY:
- case ASSIGNEQUAL:
- case COLON:
- case LITERAL__stdcall:
- case LITERAL___stdcall:
- case LPAREN:
- case RPAREN:
- case COMMA:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case LSQUARE:
- case TILDE:
- case STAR:
- case AMPERSAND:
- case ELLIPSIS:
- case SCOPE:
- case LITERAL__cdecl:
- case LITERAL___cdecl:
- case LITERAL__near:
- case LITERAL___near:
- case LITERAL__far:
- case LITERAL___far:
- case LITERAL___interrupt:
- case LITERAL_pascal:
- case LITERAL__pascal:
- case LITERAL___pascal: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- if (inputState->guessing == 0) {
-#line 1155 "CPP_parser.g"
- strcat(qitem, (id->getText()).data());
-#line 2934 "CPPParser.cpp"
- }
- break;
- }
- case OPERATOR: {
- match(OPERATOR);
- optor();
- if (inputState->guessing == 0) {
-#line 1158 "CPP_parser.g"
- strcat(qitem, "operator");
- strcat(qitem, "NYI");
-#line 2945 "CPPParser.cpp"
- }
- break;
- }
- case LITERAL_this: {
- match(LITERAL_this);
- break;
- }
- case LITERAL_true:
- case LITERAL_false: {
- {
- switch (LA(1)) {
- case LITERAL_true: {
- match(LITERAL_true);
- break;
- }
- case LITERAL_false: {
- match(LITERAL_false);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- if (inputState->guessing == 0) {
-#line 1164 "CPP_parser.g"
- q = qitem;
-#line 2986 "CPPParser.cpp"
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_41);
- } else {
- throw;
- }
- }
- return q;
-}
-
-void CPPParser::member_declaration() {
-#line 585 "CPP_parser.g"
- char* q;
- FunctionSpecifier fs = fsInvalid; // inline,virtual,explicit
-
-#line 3005 "CPPParser.cpp"
-
- try { // for error handling
- {
- switch (LA(1)) {
- case LITERAL_public:
- case LITERAL_protected:
- case LITERAL_private: {
- if (inputState->guessing == 0) {
-#line 799 "CPP_parser.g"
- if (statementTrace >= 1) {
- printf("%d member_declaration Access specifier\n",
- LT(1)->getLine());
- }
-
-#line 3019 "CPPParser.cpp"
- }
- access_specifier();
- match(COLON);
- break;
- }
- case SEMICOLON: {
- if (inputState->guessing == 0) {
-#line 805 "CPP_parser.g"
- if (statementTrace >= 1) {
- printf("%d member_declaration Semicolon\n", LT(1)->getLine());
- }
-
-#line 3032 "CPPParser.cpp"
- }
- match(SEMICOLON);
- if (inputState->guessing == 0) {
-#line 808 "CPP_parser.g"
- end_of_stmt();
-#line 3038 "CPPParser.cpp"
- }
- break;
- }
- case LITERAL_antlrTrace_on: {
- match(LITERAL_antlrTrace_on);
- if (inputState->guessing == 0) {
-#line 812 "CPP_parser.g"
- antlrTrace(true);
-#line 3048 "CPPParser.cpp"
- }
- break;
- }
- case LITERAL_antlrTrace_off: {
- match(LITERAL_antlrTrace_off);
- if (inputState->guessing == 0) {
-#line 815 "CPP_parser.g"
- antlrTrace(false);
-#line 3058 "CPPParser.cpp"
- }
- break;
- }
- default:
- bool synPredMatched77 = false;
- if (((LA(1) == LITERAL_template) && (LA(2) == LESSTHAN))) {
- int _m77 = mark();
- synPredMatched77 = true;
- inputState->guessing++;
- try {
- {
- match(LITERAL_template);
- match(LESSTHAN);
- match(GREATERTHAN);
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& pe) {
- synPredMatched77 = false;
- }
- rewind(_m77);
- inputState->guessing--;
- }
- if (synPredMatched77) {
- if (inputState->guessing == 0) {
-#line 593 "CPP_parser.g"
- if (statementTrace >= 1) {
- printf(
- "%d member_declaration Template explicit-specialisation\n",
- LT(1)->getLine());
- }
-
-#line 3087 "CPPParser.cpp"
- }
- match(LITERAL_template);
- match(LESSTHAN);
- match(GREATERTHAN);
- member_declaration();
- } else {
- bool synPredMatched79 = false;
- if (((_tokenSet_2.member(LA(1))) && (_tokenSet_3.member(LA(2))))) {
- int _m79 = mark();
- synPredMatched79 = true;
- inputState->guessing++;
- try {
- { match(LITERAL_typedef); }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& pe) {
- synPredMatched79 = false;
- }
- rewind(_m79);
- inputState->guessing--;
- }
- if (synPredMatched79) {
- {
- bool synPredMatched82 = false;
- if (((LA(1) == LITERAL_typedef) &&
- ((LA(2) >= LITERAL_struct && LA(2) <= LITERAL_class)))) {
- int _m82 = mark();
- synPredMatched82 = true;
- inputState->guessing++;
- try {
- {
- match(LITERAL_typedef);
- class_specifier();
- }
- } catch (ANTLR_USE_NAMESPACE(antlr)
- RecognitionException& pe) {
- synPredMatched82 = false;
- }
- rewind(_m82);
- inputState->guessing--;
- }
- if (synPredMatched82) {
- if (inputState->guessing == 0) {
-#line 602 "CPP_parser.g"
- if (statementTrace >= 1) {
- printf("%d member_declaration Typedef class type\n",
- LT(1)->getLine());
- }
-
-#line 3136 "CPPParser.cpp"
- }
- match(LITERAL_typedef);
- class_decl_or_def(fs);
- if (inputState->guessing == 0) {
-#line 605 "CPP_parser.g"
- _td = true;
-#line 3143 "CPPParser.cpp"
- }
- {
- switch (LA(1)) {
- case ID:
- case LITERAL__stdcall:
- case LITERAL___stdcall:
- case LPAREN:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case TILDE:
- case STAR:
- case AMPERSAND:
- case SCOPE:
- case LITERAL__cdecl:
- case LITERAL___cdecl:
- case LITERAL__near:
- case LITERAL___near:
- case LITERAL__far:
- case LITERAL___far:
- case LITERAL___interrupt:
- case LITERAL_pascal:
- case LITERAL__pascal:
- case LITERAL___pascal: {
- init_declarator_list();
- break;
- }
- case SEMICOLON: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- match(SEMICOLON);
- if (inputState->guessing == 0) {
-#line 605 "CPP_parser.g"
- end_of_stmt();
-#line 3187 "CPPParser.cpp"
- }
- } else {
- bool synPredMatched85 = false;
- if (((LA(1) == LITERAL_typedef) && (LA(2) == LITERAL_enum))) {
- int _m85 = mark();
- synPredMatched85 = true;
- inputState->guessing++;
- try {
- {
- match(LITERAL_typedef);
- match(LITERAL_enum);
- }
- } catch (ANTLR_USE_NAMESPACE(antlr)
- RecognitionException& pe) {
- synPredMatched85 = false;
- }
- rewind(_m85);
- inputState->guessing--;
- }
- if (synPredMatched85) {
- if (inputState->guessing == 0) {
-#line 608 "CPP_parser.g"
- if (statementTrace >= 1) {
- printf("%d member_declaration Typedef enum type\n",
- LT(1)->getLine());
- }
-
-#line 3214 "CPPParser.cpp"
- }
- match(LITERAL_typedef);
- enum_specifier();
- if (inputState->guessing == 0) {
-#line 611 "CPP_parser.g"
- _td = true;
-#line 3221 "CPPParser.cpp"
- }
- {
- switch (LA(1)) {
- case ID:
- case LITERAL__stdcall:
- case LITERAL___stdcall:
- case LPAREN:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case TILDE:
- case STAR:
- case AMPERSAND:
- case SCOPE:
- case LITERAL__cdecl:
- case LITERAL___cdecl:
- case LITERAL__near:
- case LITERAL___near:
- case LITERAL__far:
- case LITERAL___far:
- case LITERAL___interrupt:
- case LITERAL_pascal:
- case LITERAL__pascal:
- case LITERAL___pascal: {
- init_declarator_list();
- break;
- }
- case SEMICOLON: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- match(SEMICOLON);
- if (inputState->guessing == 0) {
-#line 611 "CPP_parser.g"
- end_of_stmt();
-#line 3265 "CPPParser.cpp"
- }
- } else {
- bool synPredMatched88 = false;
- if (((_tokenSet_2.member(LA(1))) &&
- (_tokenSet_3.member(LA(2))))) {
- int _m88 = mark();
- synPredMatched88 = true;
- inputState->guessing++;
- try {
- {
- declaration_specifiers();
- function_declarator(0);
- match(SEMICOLON);
- }
- } catch (ANTLR_USE_NAMESPACE(antlr)
- RecognitionException& pe) {
- synPredMatched88 = false;
- }
- rewind(_m88);
- inputState->guessing--;
- }
- if (synPredMatched88) {
- if (inputState->guessing == 0) {
-#line 614 "CPP_parser.g"
- if (statementTrace >= 1) {
- printf(
- "%d member_declaration Typedef function type\n",
- LT(1)->getLine());
- }
-
-#line 3293 "CPPParser.cpp"
- }
- declaration();
- } else if ((_tokenSet_2.member(LA(1))) &&
- (_tokenSet_3.member(LA(2)))) {
- if (inputState->guessing == 0) {
-#line 619 "CPP_parser.g"
- if (statementTrace >= 1) {
- printf(
- "%d member_declaration Typedef variable type\n",
- LT(1)->getLine());
- }
-
-#line 3303 "CPPParser.cpp"
- }
- declaration();
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- }
- } else {
- bool synPredMatched92 = false;
- if (((LA(1) == LITERAL_template) && (LA(2) == LESSTHAN))) {
- int _m92 = mark();
- synPredMatched92 = true;
- inputState->guessing++;
- try {
- {
- template_head();
- { // ( ... )*
- for (;;) {
- if ((_tokenSet_4.member(LA(1)))) {
- fs = function_specifier();
- } else {
- goto _loop91;
- }
- }
- _loop91:;
- } // ( ... )*
- class_specifier();
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& pe) {
- synPredMatched92 = false;
- }
- rewind(_m92);
- inputState->guessing--;
- }
- if (synPredMatched92) {
- if (inputState->guessing == 0) {
-#line 627 "CPP_parser.g"
- if (statementTrace >= 1) {
- printf(
- "%d member_declaration Templated class decl or def\n",
- LT(1)->getLine());
- }
-
-#line 3349 "CPPParser.cpp"
- }
- template_head();
- { // ( ... )*
- for (;;) {
- if ((_tokenSet_4.member(LA(1)))) {
- fs = function_specifier();
- } else {
- goto _loop94;
- }
- }
- _loop94:;
- } // ( ... )*
- class_decl_or_def(fs);
- {
- switch (LA(1)) {
- case ID:
- case LITERAL__stdcall:
- case LITERAL___stdcall:
- case LPAREN:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case TILDE:
- case STAR:
- case AMPERSAND:
- case SCOPE:
- case LITERAL__cdecl:
- case LITERAL___cdecl:
- case LITERAL__near:
- case LITERAL___near:
- case LITERAL__far:
- case LITERAL___far:
- case LITERAL___interrupt:
- case LITERAL_pascal:
- case LITERAL__pascal:
- case LITERAL___pascal: {
- init_declarator_list();
- break;
- }
- case SEMICOLON: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- match(SEMICOLON);
- if (inputState->guessing == 0) {
-#line 630 "CPP_parser.g"
- end_of_stmt();
-#line 3407 "CPPParser.cpp"
- }
- } else {
- bool synPredMatched98 = false;
- if (((LA(1) == LITERAL_enum) && (_tokenSet_5.member(LA(2))))) {
- int _m98 = mark();
- synPredMatched98 = true;
- inputState->guessing++;
- try {
- {
- match(LITERAL_enum);
- {
- switch (LA(1)) {
- case ID: {
- match(ID);
- break;
- }
- case LCURLY: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- match(LCURLY);
- }
- } catch (ANTLR_USE_NAMESPACE(antlr)
- RecognitionException& pe) {
- synPredMatched98 = false;
- }
- rewind(_m98);
- inputState->guessing--;
- }
- if (synPredMatched98) {
- if (inputState->guessing == 0) {
-#line 634 "CPP_parser.g"
- if (statementTrace >= 1) {
- printf("%d member_declaration Enum definition\n",
- LT(1)->getLine());
- }
-
-#line 3451 "CPPParser.cpp"
- }
- enum_specifier();
- {
- switch (LA(1)) {
- case ID:
- case COLON:
- case LITERAL__stdcall:
- case LITERAL___stdcall:
- case LPAREN:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case TILDE:
- case STAR:
- case AMPERSAND:
- case SCOPE:
- case LITERAL__cdecl:
- case LITERAL___cdecl:
- case LITERAL__near:
- case LITERAL___near:
- case LITERAL__far:
- case LITERAL___far:
- case LITERAL___interrupt:
- case LITERAL_pascal:
- case LITERAL__pascal:
- case LITERAL___pascal: {
- member_declarator_list();
- break;
- }
- case SEMICOLON: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- match(SEMICOLON);
- if (inputState->guessing == 0) {
-#line 637 "CPP_parser.g"
- end_of_stmt();
-#line 3497 "CPPParser.cpp"
- }
- } else {
- bool synPredMatched101 = false;
- if (((_tokenSet_8.member(LA(1))) &&
- (_tokenSet_9.member(LA(2))))) {
- int _m101 = mark();
- synPredMatched101 = true;
- inputState->guessing++;
- try {
- {
- ctor_decl_spec();
- if (!(qualifiedItemIsOneOf(qiCtor))) {
- throw ANTLR_USE_NAMESPACE(antlr)
- SemanticException("qualifiedItemIsOneOf(qiCtor)");
- }
- ctor_declarator(0);
- match(SEMICOLON);
- }
- } catch (ANTLR_USE_NAMESPACE(antlr)
- RecognitionException& pe) {
- synPredMatched101 = false;
- }
- rewind(_m101);
- inputState->guessing--;
- }
- if (synPredMatched101) {
- if (inputState->guessing == 0) {
-#line 644 "CPP_parser.g"
- if (statementTrace >= 1) {
- printf("%d member_declaration Constructor declarator\n",
- LT(1)->getLine());
- }
-
-#line 3527 "CPPParser.cpp"
- }
- ctor_decl_spec();
- ctor_declarator(0);
- match(SEMICOLON);
- if (inputState->guessing == 0) {
-#line 647 "CPP_parser.g"
- end_of_stmt();
-#line 3535 "CPPParser.cpp"
- }
- } else {
- bool synPredMatched104 = false;
- if (((_tokenSet_8.member(LA(1))) &&
- (_tokenSet_9.member(LA(2))))) {
- int _m104 = mark();
- synPredMatched104 = true;
- inputState->guessing++;
- try {
- {
- ctor_decl_spec();
- if (!(qualifiedItemIsOneOf(qiCtor))) {
- throw ANTLR_USE_NAMESPACE(antlr) SemanticException(
- "qualifiedItemIsOneOf(qiCtor)");
- }
- ctor_declarator(1);
- {
- switch (LA(1)) {
- case COLON: {
- match(COLON);
- break;
- }
- case LCURLY: {
- match(LCURLY);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr)
- RecognitionException& pe) {
- synPredMatched104 = false;
- }
- rewind(_m104);
- inputState->guessing--;
- }
- if (synPredMatched104) {
- if (inputState->guessing == 0) {
-#line 661 "CPP_parser.g"
- if (statementTrace >= 1) {
- printf(
- "%d member_declaration Constructor definition\n",
- LT(1)->getLine());
- }
-
-#line 3582 "CPPParser.cpp"
- }
- ctor_definition();
- } else {
- bool synPredMatched106 = false;
- if (((_tokenSet_42.member(LA(1))) &&
- (_tokenSet_7.member(LA(2))))) {
- int _m106 = mark();
- synPredMatched106 = true;
- inputState->guessing++;
- try {
- {
- dtor_head(0);
- match(SEMICOLON);
- }
- } catch (ANTLR_USE_NAMESPACE(antlr)
- RecognitionException& pe) {
- synPredMatched106 = false;
- }
- rewind(_m106);
- inputState->guessing--;
- }
- if (synPredMatched106) {
- if (inputState->guessing == 0) {
-#line 670 "CPP_parser.g"
- if (statementTrace >= 1) {
- printf(
- "%d member_declaration Destructor "
- "declaration\n",
- LT(1)->getLine());
- }
-
-#line 3610 "CPPParser.cpp"
- }
- dtor_head(0);
- match(SEMICOLON);
- if (inputState->guessing == 0) {
-#line 673 "CPP_parser.g"
- end_of_stmt();
-#line 3617 "CPPParser.cpp"
- }
- } else {
- bool synPredMatched108 = false;
- if (((_tokenSet_42.member(LA(1))) &&
- (_tokenSet_7.member(LA(2))))) {
- int _m108 = mark();
- synPredMatched108 = true;
- inputState->guessing++;
- try {
- {
- dtor_head(1);
- match(LCURLY);
- }
- } catch (ANTLR_USE_NAMESPACE(antlr)
- RecognitionException& pe) {
- synPredMatched108 = false;
- }
- rewind(_m108);
- inputState->guessing--;
- }
- if (synPredMatched108) {
- if (inputState->guessing == 0) {
-#line 679 "CPP_parser.g"
- if (statementTrace >= 1) {
- printf(
- "%d member_declaration Destructor "
- "definition\n",
- LT(1)->getLine());
- }
-
-#line 3644 "CPPParser.cpp"
- }
- dtor_head(1);
- dtor_body();
- } else {
- bool synPredMatched110 = false;
- if (((_tokenSet_12.member(LA(1))) &&
- (_tokenSet_13.member(LA(2))))) {
- int _m110 = mark();
- synPredMatched110 = true;
- inputState->guessing++;
- try {
- {
- declaration_specifiers();
- function_declarator(0);
- match(SEMICOLON);
- }
- } catch (ANTLR_USE_NAMESPACE(antlr)
- RecognitionException& pe) {
- synPredMatched110 = false;
- }
- rewind(_m110);
- inputState->guessing--;
- }
- if (synPredMatched110) {
- if (inputState->guessing == 0) {
-#line 686 "CPP_parser.g"
- if (statementTrace >= 1) {
- printf(
- "%d member_declaration Function "
- "declaration\n",
- LT(1)->getLine());
- }
-
-#line 3674 "CPPParser.cpp"
- }
- declaration_specifiers();
- function_declarator(0);
- match(SEMICOLON);
- if (inputState->guessing == 0) {
-#line 689 "CPP_parser.g"
- end_of_stmt();
-#line 3682 "CPPParser.cpp"
- }
- } else {
- bool synPredMatched112 = false;
- if (((_tokenSet_14.member(LA(1))) &&
- (_tokenSet_15.member(LA(2))))) {
- int _m112 = mark();
- synPredMatched112 = true;
- inputState->guessing++;
- try {
- {
- declaration_specifiers();
- function_declarator(1);
- match(LCURLY);
- }
- } catch (ANTLR_USE_NAMESPACE(antlr)
- RecognitionException& pe) {
- synPredMatched112 = false;
- }
- rewind(_m112);
- inputState->guessing--;
- }
- if (synPredMatched112) {
- if (inputState->guessing == 0) {
-#line 693 "CPP_parser.g"
- beginFieldDeclaration();
- if (statementTrace >= 1) {
- printf(
- "%d member_declaration Function "
- "definition\n",
- LT(1)->getLine());
- }
-
-#line 3711 "CPPParser.cpp"
- }
- function_definition();
- } else {
- bool synPredMatched115 = false;
- if (((LA(1) == LITERAL_inline ||
- LA(1) == OPERATOR) &&
- (_tokenSet_43.member(LA(2))))) {
- int _m115 = mark();
- synPredMatched115 = true;
- inputState->guessing++;
- try {
- {
- {
- switch (LA(1)) {
- case LITERAL_inline: {
- match(LITERAL_inline);
- break;
- }
- case OPERATOR: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(
- LT(1), getFilename());
- }
- }
- }
- conversion_function_decl_or_def();
- }
- } catch (ANTLR_USE_NAMESPACE(antlr)
- RecognitionException& pe) {
- synPredMatched115 = false;
- }
- rewind(_m115);
- inputState->guessing--;
- }
- if (synPredMatched115) {
- if (inputState->guessing == 0) {
-#line 701 "CPP_parser.g"
- if (statementTrace >= 1) {
- printf(
- "%d member_declaration Operator "
- "function\n",
- LT(1)->getLine());
- }
-
-#line 3755 "CPPParser.cpp"
- }
- {
- switch (LA(1)) {
- case LITERAL_inline: {
- match(LITERAL_inline);
- break;
- }
- case OPERATOR: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1),
- getFilename());
- }
- }
- }
- conversion_function_decl_or_def();
- } else {
- bool synPredMatched118 = false;
- if (((_tokenSet_44.member(LA(1))) &&
- (_tokenSet_45.member(LA(2))))) {
- int _m118 = mark();
- synPredMatched118 = true;
- inputState->guessing++;
- try {
- {
- qualified_id();
- match(SEMICOLON);
- }
- } catch (ANTLR_USE_NAMESPACE(antlr)
- RecognitionException& pe) {
- synPredMatched118 = false;
- }
- rewind(_m118);
- inputState->guessing--;
- }
- if (synPredMatched118) {
- if (inputState->guessing == 0) {
-#line 710 "CPP_parser.g"
- if (statementTrace >= 1) {
- printf(
- "%d member_declaration Qualified "
- "ID\n",
- LT(1)->getLine());
- }
-
-#line 3800 "CPPParser.cpp"
- }
- q = qualified_id();
- match(SEMICOLON);
- if (inputState->guessing == 0) {
-#line 713 "CPP_parser.g"
- end_of_stmt();
-#line 3807 "CPPParser.cpp"
- }
- } else {
- bool synPredMatched121 = false;
- if (((_tokenSet_2.member(LA(1))) &&
- (_tokenSet_3.member(LA(2))))) {
- int _m121 = mark();
- synPredMatched121 = true;
- inputState->guessing++;
- try {
- {
- declaration_specifiers();
- {
- switch (LA(1)) {
- case ID:
- case LITERAL__stdcall:
- case LITERAL___stdcall:
- case LPAREN:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case TILDE:
- case STAR:
- case AMPERSAND:
- case SCOPE:
- case LITERAL__cdecl:
- case LITERAL___cdecl:
- case LITERAL__near:
- case LITERAL___near:
- case LITERAL__far:
- case LITERAL___far:
- case LITERAL___interrupt:
- case LITERAL_pascal:
- case LITERAL__pascal:
- case LITERAL___pascal: {
- init_declarator_list();
- break;
- }
- case SEMICOLON: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(
- LT(1), getFilename());
- }
- }
- }
- match(SEMICOLON);
- }
- } catch (ANTLR_USE_NAMESPACE(antlr)
- RecognitionException& pe) {
- synPredMatched121 = false;
- }
- rewind(_m121);
- inputState->guessing--;
- }
- if (synPredMatched121) {
- if (inputState->guessing == 0) {
-#line 718 "CPP_parser.g"
- beginFieldDeclaration();
- if (statementTrace >= 1) {
- printf(
- "%d member_declaration "
- "Declaration\n",
- LT(1)->getLine());
- }
-
-#line 3873 "CPPParser.cpp"
- }
- declaration();
- } else {
- bool synPredMatched126 = false;
- if (((_tokenSet_16.member(LA(1))) &&
- (_tokenSet_17.member(LA(2))))) {
- int _m126 = mark();
- synPredMatched126 = true;
- inputState->guessing++;
- try {
- {
- {
- switch (LA(1)) {
- case LITERAL_friend: {
- match(LITERAL_friend);
- break;
- }
- case LITERAL_inline:
- case LITERAL_struct:
- case LITERAL_union:
- case LITERAL_class:
- case LITERAL__inline:
- case LITERAL___inline:
- case LITERAL_virtual:
- case LITERAL_explicit: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(
- LT(1), getFilename());
- }
- }
- }
- { // ( ... )*
- for (;;) {
- if ((_tokenSet_4.member(LA(1)))) {
- fs = function_specifier();
- } else {
- goto _loop125;
- }
- }
- _loop125:;
- } // ( ... )*
- class_specifier();
- }
- } catch (ANTLR_USE_NAMESPACE(antlr)
- RecognitionException& pe) {
- synPredMatched126 = false;
- }
- rewind(_m126);
- inputState->guessing--;
- }
- if (synPredMatched126) {
- if (inputState->guessing == 0) {
-#line 726 "CPP_parser.g"
- if (statementTrace >= 1) {
- printf(
- "%d member_declaration Class "
- "decl or def\n",
- LT(1)->getLine());
- }
-
-#line 3936 "CPPParser.cpp"
- }
- {
- switch (LA(1)) {
- case LITERAL_friend: {
- match(LITERAL_friend);
- break;
- }
- case LITERAL_inline:
- case LITERAL_struct:
- case LITERAL_union:
- case LITERAL_class:
- case LITERAL__inline:
- case LITERAL___inline:
- case LITERAL_virtual:
- case LITERAL_explicit: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(
- LT(1), getFilename());
- }
- }
- }
- { // ( ... )*
- for (;;) {
- if ((_tokenSet_4.member(LA(1)))) {
- fs = function_specifier();
- } else {
- goto _loop129;
- }
- }
- _loop129:;
- } // ( ... )*
- class_decl_or_def(fs);
- {
- switch (LA(1)) {
- case ID:
- case LITERAL__stdcall:
- case LITERAL___stdcall:
- case LPAREN:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case TILDE:
- case STAR:
- case AMPERSAND:
- case SCOPE:
- case LITERAL__cdecl:
- case LITERAL___cdecl:
- case LITERAL__near:
- case LITERAL___near:
- case LITERAL__far:
- case LITERAL___far:
- case LITERAL___interrupt:
- case LITERAL_pascal:
- case LITERAL__pascal:
- case LITERAL___pascal: {
- init_declarator_list();
- break;
- }
- case SEMICOLON: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(
- LT(1), getFilename());
- }
- }
- }
- match(SEMICOLON);
- if (inputState->guessing == 0) {
-#line 729 "CPP_parser.g"
- end_of_stmt();
-#line 4017 "CPPParser.cpp"
- }
- } else {
- bool synPredMatched134 = false;
- if (((_tokenSet_46.member(LA(1))) &&
- (_tokenSet_47.member(LA(2))))) {
- int _m134 = mark();
- synPredMatched134 = true;
- inputState->guessing++;
- try {
- {
- { // ( ... )*
- for (;;) {
- if ((_tokenSet_4.member(
- LA(1)))) {
- fs = function_specifier();
- } else {
- goto _loop133;
- }
- }
- _loop133:;
- } // ( ... )*
- function_declarator(0);
- match(SEMICOLON);
- }
- } catch (ANTLR_USE_NAMESPACE(antlr)
- RecognitionException& pe) {
- synPredMatched134 = false;
- }
- rewind(_m134);
- inputState->guessing--;
- }
- if (synPredMatched134) {
- if (inputState->guessing == 0) {
-#line 733 "CPP_parser.g"
- beginFieldDeclaration();
- fprintf(stderr,
- "%d warning Function "
- "declaration found without "
- "return type\n",
- LT(1)->getLine());
- if (statementTrace >= 1) {
- printf(
- "%d member_declaration "
- "Function declaration\n",
- LT(1)->getLine());
- }
-
-#line 4058 "CPPParser.cpp"
- }
- { // ( ... )*
- for (;;) {
- if ((_tokenSet_4.member(LA(1)))) {
- fs = function_specifier();
- } else {
- goto _loop136;
- }
- }
- _loop136:;
- } // ( ... )*
- function_declarator(0);
- match(SEMICOLON);
- if (inputState->guessing == 0) {
-#line 738 "CPP_parser.g"
- end_of_stmt();
-#line 4077 "CPPParser.cpp"
- }
- } else if ((_tokenSet_38.member(LA(1))) &&
- (_tokenSet_39.member(LA(2)))) {
- if (inputState->guessing == 0) {
-#line 742 "CPP_parser.g"
-
- fprintf(stderr,
- "%d warning Function "
- "definition found without "
- "return type\n",
- LT(1)->getLine());
- if (statementTrace >= 1) {
- printf(
- "%d member_declaration "
- "Function definition without "
- "return type\n",
- LT(1)->getLine());
- }
-
-#line 4088 "CPPParser.cpp"
- }
- function_declarator(1);
- compound_statement();
- if (inputState->guessing == 0) {
-#line 747 "CPP_parser.g"
- endFunctionDefinition();
-#line 4095 "CPPParser.cpp"
- }
- } else if ((LA(1) == LITERAL_template) &&
- (LA(2) == LESSTHAN)) {
- if (inputState->guessing == 0) {
-#line 750 "CPP_parser.g"
- beginTemplateDeclaration();
-#line 4102 "CPPParser.cpp"
- }
- template_head();
- {
- bool synPredMatched140 = false;
- if (((_tokenSet_12.member(LA(1))) &&
- (_tokenSet_18.member(LA(2))))) {
- int _m140 = mark();
- synPredMatched140 = true;
- inputState->guessing++;
- try {
- {
- declaration_specifiers();
- {
- switch (LA(1)) {
- case ID:
- case LITERAL__stdcall:
- case LITERAL___stdcall:
- case LPAREN:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case TILDE:
- case STAR:
- case AMPERSAND:
- case SCOPE:
- case LITERAL__cdecl:
- case LITERAL___cdecl:
- case LITERAL__near:
- case LITERAL___near:
- case LITERAL__far:
- case LITERAL___far:
- case LITERAL___interrupt:
- case LITERAL_pascal:
- case LITERAL__pascal:
- case LITERAL___pascal: {
- init_declarator_list();
- break;
- }
- case SEMICOLON: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(
- antlr)
- NoViableAltException(
- LT(1),
- getFilename());
- }
- }
- }
- match(SEMICOLON);
- }
- } catch (
- ANTLR_USE_NAMESPACE(antlr)
- RecognitionException& pe) {
- synPredMatched140 = false;
- }
- rewind(_m140);
- inputState->guessing--;
- }
- if (synPredMatched140) {
- if (inputState->guessing == 0) {
-#line 755 "CPP_parser.g"
- if (statementTrace >= 1) {
- printf(
- "%d member_declaration "
- "Templated forward "
- "declaration\n",
- LT(1)->getLine());
- }
-
-#line 4167 "CPPParser.cpp"
- }
- declaration_specifiers();
- {
- switch (LA(1)) {
- case ID:
- case LITERAL__stdcall:
- case LITERAL___stdcall:
- case LPAREN:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case TILDE:
- case STAR:
- case AMPERSAND:
- case SCOPE:
- case LITERAL__cdecl:
- case LITERAL___cdecl:
- case LITERAL__near:
- case LITERAL___near:
- case LITERAL__far:
- case LITERAL___far:
- case LITERAL___interrupt:
- case LITERAL_pascal:
- case LITERAL__pascal:
- case LITERAL___pascal: {
- init_declarator_list();
- break;
- }
- case SEMICOLON: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(
- antlr)
- NoViableAltException(
- LT(1), getFilename());
- }
- }
- }
- match(SEMICOLON);
- if (inputState->guessing == 0) {
-#line 758 "CPP_parser.g"
- end_of_stmt();
-#line 4212 "CPPParser.cpp"
- }
- } else {
- bool synPredMatched143 = false;
- if (((_tokenSet_2.member(LA(1))) &&
- (_tokenSet_3.member(LA(2))))) {
- int _m143 = mark();
- synPredMatched143 = true;
- inputState->guessing++;
- try {
- {
- declaration_specifiers();
- function_declarator(0);
- match(SEMICOLON);
- }
- } catch (ANTLR_USE_NAMESPACE(
- antlr) RecognitionException&
- pe) {
- synPredMatched143 = false;
- }
- rewind(_m143);
- inputState->guessing--;
- }
- if (synPredMatched143) {
- if (inputState->guessing == 0) {
-#line 762 "CPP_parser.g"
- if (statementTrace >= 1) {
- printf(
- "%d member_declaration "
- "Templated function "
- "declaration\n",
- LT(1)->getLine());
- }
-
-#line 4240 "CPPParser.cpp"
- }
- declaration();
- } else {
- bool synPredMatched145 = false;
- if (((_tokenSet_14.member(
- LA(1))) &&
- (_tokenSet_15.member(
- LA(2))))) {
- int _m145 = mark();
- synPredMatched145 = true;
- inputState->guessing++;
- try {
- {
- declaration_specifiers();
- function_declarator(1);
- match(LCURLY);
- }
- } catch (ANTLR_USE_NAMESPACE(
- antlr) RecognitionException&
- pe) {
- synPredMatched145 = false;
- }
- rewind(_m145);
- inputState->guessing--;
- }
- if (synPredMatched145) {
- if (inputState->guessing == 0) {
-#line 769 "CPP_parser.g"
- if (statementTrace >= 1) {
- printf(
- "%d member_declaration "
- "Templated function "
- "definition\n",
- LT(1)->getLine());
- }
-
-#line 4269 "CPPParser.cpp"
- }
- function_definition();
- } else {
- bool synPredMatched147 = false;
- if (((_tokenSet_8.member(
- LA(1))) &&
- (_tokenSet_9.member(
- LA(2))))) {
- int _m147 = mark();
- synPredMatched147 = true;
- inputState->guessing++;
- try {
- {
- ctor_decl_spec();
- if (!(qualifiedItemIsOneOf(
- qiCtor))) {
- throw ANTLR_USE_NAMESPACE(
- antlr)
- SemanticException(
- "qualifiedItemI"
- "sOneOf("
- "qiCtor)");
- }
- }
- } catch (
- ANTLR_USE_NAMESPACE(antlr)
- RecognitionException&
- pe) {
- synPredMatched147 = false;
- }
- rewind(_m147);
- inputState->guessing--;
- }
- if (synPredMatched147) {
- if (inputState->guessing ==
- 0) {
-#line 779 "CPP_parser.g"
- if (statementTrace >= 1) {
- printf(
- "%d "
- "member_declaration "
- "Templated "
- "constructor "
- "definition\n",
- LT(1)->getLine());
- }
-
-#line 4298 "CPPParser.cpp"
- }
- ctor_definition();
- } else if ((LA(1) ==
- OPERATOR) &&
- (_tokenSet_12.member(
- LA(2)))) {
- if (inputState->guessing ==
- 0) {
-#line 785 "CPP_parser.g"
- if (statementTrace >= 1) {
- printf(
- "%d "
- "member_declaration "
- "Templated operator "
- "function\n",
- LT(1)->getLine());
- }
-
-#line 4308 "CPPParser.cpp"
- }
- conversion_function_decl_or_def();
- } else if (
- ((LA(1) >= LITERAL_struct &&
- LA(1) <=
- LITERAL_class)) &&
- (LA(2) == ID ||
- LA(2) == LCURLY)) {
- if (inputState->guessing ==
- 0) {
-#line 791 "CPP_parser.g"
- if (statementTrace >= 1) {
- printf(
- "%d "
- "member_declaration "
- "Templated class "
- "definition\n",
- LT(1)->getLine());
- }
-
-#line 4318 "CPPParser.cpp"
- }
- class_head();
- declaration_specifiers();
- {
- switch (LA(1)) {
- case ID:
- case LITERAL__stdcall:
- case LITERAL___stdcall:
- case LPAREN:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case TILDE:
- case STAR:
- case AMPERSAND:
- case SCOPE:
- case LITERAL__cdecl:
- case LITERAL___cdecl:
- case LITERAL__near:
- case LITERAL___near:
- case LITERAL__far:
- case LITERAL___far:
- case LITERAL___interrupt:
- case LITERAL_pascal:
- case LITERAL__pascal:
- case LITERAL___pascal: {
- init_declarator_list();
- break;
- }
- case SEMICOLON: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(
- antlr)
- NoViableAltException(
- LT(1),
- getFilename());
- }
- }
- }
- match(SEMICOLON);
- if (inputState->guessing ==
- 0) {
-#line 794 "CPP_parser.g"
- end_of_stmt();
-#line 4364 "CPPParser.cpp"
- }
- } else {
- throw ANTLR_USE_NAMESPACE(
- antlr)
- NoViableAltException(
- LT(1), getFilename());
- }
- }
- }
- }
- }
- if (inputState->guessing == 0) {
-#line 796 "CPP_parser.g"
- endTemplateDeclaration();
-#line 4375 "CPPParser.cpp"
- }
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1),
- getFilename());
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_40);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::member_declarator_list() {
- try { // for error handling
- member_declarator();
- {
- switch (LA(1)) {
- case ASSIGNEQUAL: {
- match(ASSIGNEQUAL);
- match(OCTALINT);
- break;
- }
- case SEMICOLON:
- case COMMA: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- { // ( ... )*
- for (;;) {
- if ((LA(1) == COMMA)) {
- match(COMMA);
- member_declarator();
- {
- switch (LA(1)) {
- case ASSIGNEQUAL: {
- match(ASSIGNEQUAL);
- match(OCTALINT);
- break;
- }
- case SEMICOLON:
- case COMMA: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- } else {
- goto _loop253;
- }
- }
- _loop253:;
- } // ( ... )*
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_22);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::ctor_declarator(int definition) {
-#line 1402 "CPP_parser.g"
- char* q;
-#line 4465 "CPPParser.cpp"
-
- try { // for error handling
- q = qualified_ctor_id();
- if (inputState->guessing == 0) {
-#line 1406 "CPP_parser.g"
- declaratorParameterList(definition);
-#line 4472 "CPPParser.cpp"
- }
- match(LPAREN);
- {
- switch (LA(1)) {
- case LITERAL_typedef:
- case LITERAL_enum:
- case ID:
- case LITERAL_inline:
- case LITERAL_friend:
- case LITERAL_extern:
- case LITERAL_struct:
- case LITERAL_union:
- case LITERAL_class:
- case LITERAL__stdcall:
- case LITERAL___stdcall:
- case LITERAL_GFEXCLUDE:
- case LITERAL_GFINCLUDE:
- case LITERAL_GFID:
- case LITERAL_GFUNREAD:
- case LITERAL_GFARRAYSIZE:
- case LPAREN:
- case LITERAL_GFARRAYSIZES:
- case LITERAL_GFARRAYELEMSIZE:
- case LITERAL_auto:
- case LITERAL_register:
- case LITERAL_static:
- case LITERAL_mutable:
- case LITERAL__inline:
- case LITERAL___inline:
- case LITERAL_virtual:
- case LITERAL_explicit:
- case LITERAL_typename:
- case LITERAL_char:
- case LITERAL_wchar_t:
- case LITERAL_bool:
- case LITERAL_short:
- case LITERAL_int:
- case 50:
- case 51:
- case 52:
- case 53:
- case 54:
- case 55:
- case 56:
- case 57:
- case 58:
- case 59:
- case 60:
- case 61:
- case 62:
- case 63:
- case 64:
- case 65:
- case 66:
- case 67:
- case LITERAL_long:
- case LITERAL_signed:
- case LITERAL_unsigned:
- case LITERAL_float:
- case LITERAL_double:
- case LITERAL_void:
- case LITERAL__declspec:
- case LITERAL___declspec:
- case LITERAL_const:
- case LITERAL___const:
- case LITERAL_volatile:
- case LITERAL___volatile__:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case TILDE:
- case STAR:
- case AMPERSAND:
- case ELLIPSIS:
- case SCOPE:
- case LITERAL__cdecl:
- case LITERAL___cdecl:
- case LITERAL__near:
- case LITERAL___near:
- case LITERAL__far:
- case LITERAL___far:
- case LITERAL___interrupt:
- case LITERAL_pascal:
- case LITERAL__pascal:
- case LITERAL___pascal: {
- parameter_list();
- break;
- }
- case RPAREN: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- match(RPAREN);
- if (inputState->guessing == 0) {
-#line 1408 "CPP_parser.g"
- declaratorEndParameterList(definition);
-#line 4577 "CPPParser.cpp"
- }
- {
- switch (LA(1)) {
- case LITERAL_throw: {
- exception_specification();
- break;
- }
- case SEMICOLON:
- case LCURLY:
- case COLON: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_48);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::compound_statement() {
- try { // for error handling
- match(LCURLY);
- if (inputState->guessing == 0) {
-#line 1746 "CPP_parser.g"
- end_of_stmt();
- enterNewLocalScope();
-
-#line 4618 "CPPParser.cpp"
- }
- {
- if ((_tokenSet_49.member(LA(1)))) {
- statement_list();
- } else if ((LA(1) == RCURLY)) {
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- match(RCURLY);
- if (inputState->guessing == 0) {
-#line 1751 "CPP_parser.g"
- exitLocalScope();
-#line 4635 "CPPParser.cpp"
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_50);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::class_head() {
- try { // for error handling
- {
- switch (LA(1)) {
- case LITERAL_struct: {
- match(LITERAL_struct);
- break;
- }
- case LITERAL_union: {
- match(LITERAL_union);
- break;
- }
- case LITERAL_class: {
- match(LITERAL_class);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- {
- switch (LA(1)) {
- case ID: {
- match(ID);
- {
- switch (LA(1)) {
- case LESSTHAN: {
- match(LESSTHAN);
- template_argument_list();
- match(GREATERTHAN);
- break;
- }
- case LCURLY:
- case COLON: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- {
- switch (LA(1)) {
- case COLON: {
- base_clause();
- break;
- }
- case LCURLY: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- break;
- }
- case LCURLY: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- match(LCURLY);
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_12);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::access_specifier() {
- try { // for error handling
- {
- switch (LA(1)) {
- case LITERAL_public: {
- match(LITERAL_public);
- break;
- }
- case LITERAL_protected: {
- match(LITERAL_protected);
- break;
- }
- case LITERAL_private: {
- match(LITERAL_private);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_51);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::linkage_specification() {
- try { // for error handling
- match(LITERAL_extern);
- match(StringLiteral);
- {
- switch (LA(1)) {
- case LCURLY: {
- match(LCURLY);
- { // ( ... )*
- for (;;) {
- if ((_tokenSet_0.member(LA(1)))) {
- external_declaration();
- } else {
- goto _loop164;
- }
- }
- _loop164:;
- } // ( ... )*
- match(RCURLY);
- break;
- }
- case LITERAL_typedef:
- case LITERAL_enum:
- case ID:
- case LITERAL_inline:
- case LITERAL_friend:
- case LITERAL_extern:
- case LITERAL_struct:
- case LITERAL_union:
- case LITERAL_class:
- case LITERAL__stdcall:
- case LITERAL___stdcall:
- case LITERAL_GFEXCLUDE:
- case LITERAL_GFINCLUDE:
- case LITERAL_GFID:
- case LITERAL_GFUNREAD:
- case LITERAL_GFARRAYSIZE:
- case LITERAL_GFARRAYSIZES:
- case LITERAL_GFARRAYELEMSIZE:
- case LITERAL_auto:
- case LITERAL_register:
- case LITERAL_static:
- case LITERAL_mutable:
- case LITERAL__inline:
- case LITERAL___inline:
- case LITERAL_virtual:
- case LITERAL_explicit:
- case LITERAL_typename:
- case LITERAL_char:
- case LITERAL_wchar_t:
- case LITERAL_bool:
- case LITERAL_short:
- case LITERAL_int:
- case 50:
- case 51:
- case 52:
- case 53:
- case 54:
- case 55:
- case 56:
- case 57:
- case 58:
- case 59:
- case 60:
- case 61:
- case 62:
- case 63:
- case 64:
- case 65:
- case 66:
- case 67:
- case LITERAL_long:
- case LITERAL_signed:
- case LITERAL_unsigned:
- case LITERAL_float:
- case LITERAL_double:
- case LITERAL_void:
- case LITERAL__declspec:
- case LITERAL___declspec:
- case LITERAL_const:
- case LITERAL___const:
- case LITERAL_volatile:
- case LITERAL___volatile__:
- case LITERAL_using:
- case SCOPE: {
- declaration();
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_30);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::using_statement() {
-#line 1836 "CPP_parser.g"
- char* qid;
-#line 4890 "CPPParser.cpp"
-
- try { // for error handling
- match(LITERAL_using);
- {
- switch (LA(1)) {
- case LITERAL_namespace: {
- match(LITERAL_namespace);
- qid = qualified_id();
- break;
- }
- case ID:
- case LITERAL_typename:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case SCOPE: {
- {
- switch (LA(1)) {
- case LITERAL_typename: {
- match(LITERAL_typename);
- break;
- }
- case ID:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case SCOPE: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- qid = qualified_id();
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- match(SEMICOLON);
- if (inputState->guessing == 0) {
-#line 1843 "CPP_parser.g"
- end_of_stmt();
-#line 4945 "CPPParser.cpp"
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_30);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::template_argument_list() {
- try { // for error handling
- template_argument();
- { // ( ... )*
- for (;;) {
- if ((LA(1) == COMMA)) {
- match(COMMA);
- template_argument();
- } else {
- goto _loop385;
- }
- }
- _loop385:;
- } // ( ... )*
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_52);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::base_clause() {
- try { // for error handling
- match(COLON);
- base_specifier();
- { // ( ... )*
- for (;;) {
- if ((LA(1) == COMMA)) {
- match(COMMA);
- base_specifier();
- } else {
- goto _loop220;
- }
- }
- _loop220:;
- } // ( ... )*
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_53);
- } else {
- throw;
- }
- }
-}
-
-CPPParser::StorageClass CPPParser::storage_class_specifier() {
-#line 928 "CPP_parser.g"
- CPPParser::StorageClass sc = scInvalid;
-#line 5018 "CPPParser.cpp"
-
- try { // for error handling
- switch (LA(1)) {
- case LITERAL_auto: {
- match(LITERAL_auto);
- if (inputState->guessing == 0) {
-#line 929 "CPP_parser.g"
- sc = scAUTO;
-#line 5028 "CPPParser.cpp"
- }
- break;
- }
- case LITERAL_register: {
- match(LITERAL_register);
- if (inputState->guessing == 0) {
-#line 930 "CPP_parser.g"
- sc = scREGISTER;
-#line 5038 "CPPParser.cpp"
- }
- break;
- }
- case LITERAL_static: {
- match(LITERAL_static);
- if (inputState->guessing == 0) {
-#line 931 "CPP_parser.g"
- sc = scSTATIC;
-#line 5048 "CPPParser.cpp"
- }
- break;
- }
- case LITERAL_extern: {
- match(LITERAL_extern);
- if (inputState->guessing == 0) {
-#line 932 "CPP_parser.g"
- sc = scEXTERN;
-#line 5058 "CPPParser.cpp"
- }
- break;
- }
- case LITERAL_mutable: {
- match(LITERAL_mutable);
- if (inputState->guessing == 0) {
-#line 933 "CPP_parser.g"
- sc = scMUTABLE;
-#line 5068 "CPPParser.cpp"
- }
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_12);
- } else {
- throw;
- }
- }
- return sc;
-}
-
-CPPParser::TypeQualifier CPPParser::type_qualifier() {
-#line 1025 "CPP_parser.g"
- CPPParser::TypeQualifier tq = tqInvalid;
-#line 5092 "CPPParser.cpp"
-
- try { // for error handling
- {
- switch (LA(1)) {
- case LITERAL_const:
- case LITERAL___const: {
- {
- switch (LA(1)) {
- case LITERAL_const: {
- match(LITERAL_const);
- break;
- }
- case LITERAL___const: {
- match(LITERAL___const);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- if (inputState->guessing == 0) {
-#line 1027 "CPP_parser.g"
- tq = tqCONST;
-#line 5121 "CPPParser.cpp"
- }
- break;
- }
- case LITERAL_volatile:
- case LITERAL___volatile__: {
- {
- switch (LA(1)) {
- case LITERAL_volatile: {
- match(LITERAL_volatile);
- break;
- }
- case LITERAL___volatile__: {
- match(LITERAL___volatile__);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- if (inputState->guessing == 0) {
-#line 1028 "CPP_parser.g"
- tq = tqVOLATILE;
-#line 5149 "CPPParser.cpp"
- }
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_54);
- } else {
- throw;
- }
- }
- return tq;
-}
-
-CPPParser::TypeSpecifier CPPParser::type_specifier() {
-#line 944 "CPP_parser.g"
- CPPParser::TypeSpecifier ts = tsInvalid;
-#line 5174 "CPPParser.cpp"
-#line 944 "CPP_parser.g"
-
- TypeQualifier tq = tqInvalid;
-
-#line 5179 "CPPParser.cpp"
-
- try { // for error handling
- ts = simple_type_specifier();
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_24);
- } else {
- throw;
- }
- }
- return ts;
-}
-
-CPPParser::TypeSpecifier CPPParser::simple_type_specifier() {
-#line 953 "CPP_parser.g"
- CPPParser::TypeSpecifier ts = tsInvalid;
-#line 5198 "CPPParser.cpp"
-#line 953 "CPP_parser.g"
- char* s;
- ts = tsInvalid;
-
-#line 5203 "CPPParser.cpp"
-
- try { // for error handling
- {
- switch (LA(1)) {
- case LITERAL_typename: {
- match(LITERAL_typename);
- s = qualified_type();
- if (inputState->guessing == 0) {
-#line 962 "CPP_parser.g"
- declaratorID(s, qiType);
-#line 5215 "CPPParser.cpp"
- }
- break;
- }
- case LITERAL_char:
- case LITERAL_wchar_t:
- case LITERAL_bool:
- case LITERAL_short:
- case LITERAL_int:
- case 50:
- case 51:
- case 52:
- case 53:
- case 54:
- case 55:
- case 56:
- case 57:
- case 58:
- case 59:
- case 60:
- case 61:
- case 62:
- case 63:
- case 64:
- case 65:
- case 66:
- case 67:
- case LITERAL_long:
- case LITERAL_signed:
- case LITERAL_unsigned:
- case LITERAL_float:
- case LITERAL_double:
- case LITERAL_void:
- case LITERAL__declspec:
- case LITERAL___declspec: {
- { // ( ... )+
- int _cnt192 = 0;
- for (;;) {
- switch (LA(1)) {
- case LITERAL_char: {
- match(LITERAL_char);
- if (inputState->guessing == 0) {
-#line 964 "CPP_parser.g"
- ts |= tsCHAR;
-#line 5261 "CPPParser.cpp"
- }
- break;
- }
- case LITERAL_wchar_t: {
- match(LITERAL_wchar_t);
- if (inputState->guessing == 0) {
-#line 965 "CPP_parser.g"
- ts |= tsWCHAR_T;
-#line 5271 "CPPParser.cpp"
- }
- break;
- }
- case LITERAL_bool: {
- match(LITERAL_bool);
- if (inputState->guessing == 0) {
-#line 966 "CPP_parser.g"
- ts |= tsBOOL;
-#line 5281 "CPPParser.cpp"
- }
- break;
- }
- case LITERAL_short: {
- match(LITERAL_short);
- if (inputState->guessing == 0) {
-#line 967 "CPP_parser.g"
- ts |= tsSHORT;
-#line 5291 "CPPParser.cpp"
- }
- break;
- }
- case LITERAL_int: {
- match(LITERAL_int);
- if (inputState->guessing == 0) {
-#line 968 "CPP_parser.g"
- ts |= tsINT;
-#line 5301 "CPPParser.cpp"
- }
- break;
- }
- case 50:
- case 51:
- case 52: {
- {
- switch (LA(1)) {
- case 50: {
- match(50);
- break;
- }
- case 51: {
- match(51);
- break;
- }
- case 52: {
- match(52);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- if (inputState->guessing == 0) {
-#line 969 "CPP_parser.g"
- ts |= tsINT;
-#line 5335 "CPPParser.cpp"
- }
- break;
- }
- case 53:
- case 54:
- case 55: {
- {
- switch (LA(1)) {
- case 53: {
- match(53);
- break;
- }
- case 54: {
- match(54);
- break;
- }
- case 55: {
- match(55);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- if (inputState->guessing == 0) {
-#line 970 "CPP_parser.g"
- ts |= tsINT;
-#line 5369 "CPPParser.cpp"
- }
- break;
- }
- case 56:
- case 57:
- case 58: {
- {
- switch (LA(1)) {
- case 56: {
- match(56);
- break;
- }
- case 57: {
- match(57);
- break;
- }
- case 58: {
- match(58);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- if (inputState->guessing == 0) {
-#line 971 "CPP_parser.g"
- ts |= tsLONG;
-#line 5403 "CPPParser.cpp"
- }
- break;
- }
- case 59:
- case 60:
- case 61: {
- {
- switch (LA(1)) {
- case 59: {
- match(59);
- break;
- }
- case 60: {
- match(60);
- break;
- }
- case 61: {
- match(61);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- if (inputState->guessing == 0) {
-#line 972 "CPP_parser.g"
- ts |= tsLONG;
-#line 5437 "CPPParser.cpp"
- }
- break;
- }
- case 62: {
- { match(62); }
- if (inputState->guessing == 0) {
-#line 973 "CPP_parser.g"
- ts |= (tsUNSIGNED | tsINT);
-#line 5449 "CPPParser.cpp"
- }
- break;
- }
- case 63: {
- { match(63); }
- if (inputState->guessing == 0) {
-#line 974 "CPP_parser.g"
- ts |= (tsUNSIGNED | tsINT);
-#line 5461 "CPPParser.cpp"
- }
- break;
- }
- case 64: {
- { match(64); }
- if (inputState->guessing == 0) {
-#line 975 "CPP_parser.g"
- ts |= (tsUNSIGNED | tsLONG);
-#line 5473 "CPPParser.cpp"
- }
- break;
- }
- case 65: {
- { match(65); }
- if (inputState->guessing == 0) {
-#line 976 "CPP_parser.g"
- ts |= (tsUNSIGNED | tsLONG);
-#line 5485 "CPPParser.cpp"
- }
- break;
- }
- case 66:
- case 67: {
- {
- switch (LA(1)) {
- case 66: {
- match(66);
- break;
- }
- case 67: {
- match(67);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- if (inputState->guessing == 0) {
-#line 977 "CPP_parser.g"
- ts |= tsLONG;
-#line 5513 "CPPParser.cpp"
- }
- break;
- }
- case LITERAL_long: {
- match(LITERAL_long);
- if (inputState->guessing == 0) {
-#line 978 "CPP_parser.g"
- ts |= tsLONG;
-#line 5523 "CPPParser.cpp"
- }
- break;
- }
- case LITERAL_signed: {
- match(LITERAL_signed);
- if (inputState->guessing == 0) {
-#line 979 "CPP_parser.g"
- ts |= tsSIGNED;
-#line 5533 "CPPParser.cpp"
- }
- break;
- }
- case LITERAL_unsigned: {
- match(LITERAL_unsigned);
- if (inputState->guessing == 0) {
-#line 980 "CPP_parser.g"
- ts |= tsUNSIGNED;
-#line 5543 "CPPParser.cpp"
- }
- break;
- }
- case LITERAL_float: {
- match(LITERAL_float);
- if (inputState->guessing == 0) {
-#line 981 "CPP_parser.g"
- ts |= tsFLOAT;
-#line 5553 "CPPParser.cpp"
- }
- break;
- }
- case LITERAL_double: {
- match(LITERAL_double);
- if (inputState->guessing == 0) {
-#line 982 "CPP_parser.g"
- ts |= tsDOUBLE;
-#line 5563 "CPPParser.cpp"
- }
- break;
- }
- case LITERAL_void: {
- match(LITERAL_void);
- if (inputState->guessing == 0) {
-#line 983 "CPP_parser.g"
- ts |= tsVOID;
-#line 5573 "CPPParser.cpp"
- }
- break;
- }
- case LITERAL__declspec:
- case LITERAL___declspec: {
- {
- switch (LA(1)) {
- case LITERAL__declspec: {
- match(LITERAL__declspec);
- break;
- }
- case LITERAL___declspec: {
- match(LITERAL___declspec);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- match(LPAREN);
- match(ID);
- match(RPAREN);
- break;
- }
- default: {
- if (_cnt192 >= 1) {
- goto _loop192;
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- _cnt192++;
- }
- _loop192:;
- } // ( ... )+
- break;
- }
- default:
- if (((LA(1) == ID || LA(1) == SCOPE)) &&
- (qualifiedItemIsOneOf(qiType | qiCtor))) {
- s = qualified_type();
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_24);
- } else {
- throw;
- }
- }
- return ts;
-}
-
-char* CPPParser::qualified_type() {
-#line 994 "CPP_parser.g"
- char* q = NULL;
-#line 5638 "CPPParser.cpp"
- ANTLR_USE_NAMESPACE(antlr) RefToken id = ANTLR_USE_NAMESPACE(antlr) nullToken;
-#line 994 "CPP_parser.g"
- char* s;
- static char qitem[CPPParser_MaxQualifiedItemSize + 1];
-#line 5642 "CPPParser.cpp"
-
- try { // for error handling
- s = scope_override();
- id = LT(1);
- match(ID);
- {
- if ((LA(1) == LESSTHAN) && (_tokenSet_55.member(LA(2)))) {
- match(LESSTHAN);
- template_argument_list();
- match(GREATERTHAN);
- } else if ((_tokenSet_56.member(LA(1))) && (_tokenSet_57.member(LA(2)))) {
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- if (inputState->guessing == 0) {
-#line 1008 "CPP_parser.g"
-
- strcpy(qitem, s);
- strcat(qitem, (id->getText()).data());
- q = qitem;
-
-#line 5668 "CPPParser.cpp"
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_56);
- } else {
- throw;
- }
- }
- return q;
-}
-
-void CPPParser::class_prefix() {
- try { // for error handling
- { // ( ... )*
- for (;;) {
- if ((LA(1) == LITERAL__declspec || LA(1) == LITERAL___declspec)) {
- {
- switch (LA(1)) {
- case LITERAL__declspec: {
- match(LITERAL__declspec);
- break;
- }
- case LITERAL___declspec: {
- match(LITERAL___declspec);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- match(LPAREN);
- expression();
- match(RPAREN);
- } else {
- goto _loop204;
- }
- }
- _loop204:;
- } // ( ... )*
- if (inputState->guessing == 0) {
-#line 1036 "CPP_parser.g"
-
-#line 5721 "CPPParser.cpp"
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_58);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::expression() {
- try { // for error handling
- assignment_expression();
- { // ( ... )*
- for (;;) {
- if ((LA(1) == COMMA)) {
- match(COMMA);
- assignment_expression();
- } else {
- goto _loop444;
- }
- }
- _loop444:;
- } // ( ... )*
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_59);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::base_specifier() {
-#line 1089 "CPP_parser.g"
- char* qt;
-#line 5765 "CPPParser.cpp"
-
- try { // for error handling
- {
- switch (LA(1)) {
- case LITERAL_virtual: {
- match(LITERAL_virtual);
- {
- switch (LA(1)) {
- case LITERAL_public:
- case LITERAL_protected:
- case LITERAL_private: {
- access_specifier();
- break;
- }
- case ID:
- case SCOPE: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- qt = qualified_type();
- break;
- }
- case LITERAL_public:
- case LITERAL_protected:
- case LITERAL_private: {
- access_specifier();
- {
- switch (LA(1)) {
- case LITERAL_virtual: {
- match(LITERAL_virtual);
- break;
- }
- case ID:
- case SCOPE: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- qt = qualified_type();
- break;
- }
- case ID:
- case SCOPE: {
- qt = qualified_type();
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_60);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::enumerator_list() {
- try { // for error handling
- enumerator();
- { // ( ... )*
- for (;;) {
- if ((LA(1) == COMMA)) {
- match(COMMA);
- enumerator();
- } else {
- goto _loop232;
- }
- }
- _loop232:;
- } // ( ... )*
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_61);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::enumerator() {
- ANTLR_USE_NAMESPACE(antlr) RefToken id = ANTLR_USE_NAMESPACE(antlr) nullToken;
-
- try { // for error handling
- id = LT(1);
- match(ID);
- {
- switch (LA(1)) {
- case ASSIGNEQUAL: {
- match(ASSIGNEQUAL);
- constant_expression();
- break;
- }
- case RCURLY:
- case COMMA: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- if (inputState->guessing == 0) {
-#line 1132 "CPP_parser.g"
- enumElement((id->getText()).data());
-#line 5901 "CPPParser.cpp"
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_62);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::constant_expression() {
- try { // for error handling
- conditional_expression();
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_63);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::optor() {
- try { // for error handling
- switch (LA(1)) {
- case LITERAL_new: {
- match(LITERAL_new);
- {
- if ((LA(1) == LSQUARE) && (LA(2) == RSQUARE)) {
- match(LSQUARE);
- match(RSQUARE);
- } else if ((_tokenSet_64.member(LA(1))) &&
- (_tokenSet_57.member(LA(2)))) {
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- break;
- }
- case LITERAL_delete: {
- match(LITERAL_delete);
- {
- if ((LA(1) == LSQUARE) && (LA(2) == RSQUARE)) {
- match(LSQUARE);
- match(RSQUARE);
- } else if ((_tokenSet_64.member(LA(1))) &&
- (_tokenSet_57.member(LA(2)))) {
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- break;
- }
- case LPAREN: {
- match(LPAREN);
- match(RPAREN);
- break;
- }
- case LSQUARE: {
- match(LSQUARE);
- match(RSQUARE);
- break;
- }
- case LESSTHAN:
- case GREATERTHAN:
- case ASSIGNEQUAL:
- case COMMA:
- case TILDE:
- case STAR:
- case AMPERSAND:
- case TIMESEQUAL:
- case DIVIDEEQUAL:
- case MINUSEQUAL:
- case PLUSEQUAL:
- case MODEQUAL:
- case SHIFTLEFTEQUAL:
- case SHIFTRIGHTEQUAL:
- case BITWISEANDEQUAL:
- case BITWISEXOREQUAL:
- case BITWISEOREQUAL:
- case OR:
- case AND:
- case BITWISEOR:
- case BITWISEXOR:
- case NOTEQUAL:
- case EQUAL:
- case LESSTHANOREQUALTO:
- case GREATERTHANOREQUALTO:
- case SHIFTLEFT:
- case SHIFTRIGHT:
- case PLUS:
- case MINUS:
- case DIVIDE:
- case MOD:
- case POINTERTOMBR:
- case PLUSPLUS:
- case MINUSMINUS:
- case POINTERTO:
- case NOT: {
- optor_simple_tokclass();
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_64);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::typeID() {
- try { // for error handling
- if (!(isTypeName((LT(1)->getText()).data()))) {
- throw ANTLR_USE_NAMESPACE(antlr)
- SemanticException("isTypeName((LT(1)->getText()).data())");
- }
- match(ID);
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_1);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::init_declarator() {
- try { // for error handling
- declarator();
- {
- switch (LA(1)) {
- case ASSIGNEQUAL: {
- match(ASSIGNEQUAL);
- initializer();
- break;
- }
- case LPAREN: {
- match(LPAREN);
- expression_list();
- match(RPAREN);
- break;
- }
- case SEMICOLON:
- case COMMA: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_65);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::declarator() {
- try { // for error handling
- bool synPredMatched261 = false;
- if (((_tokenSet_25.member(LA(1))) && (_tokenSet_66.member(LA(2))))) {
- int _m261 = mark();
- synPredMatched261 = true;
- inputState->guessing++;
- try {
- { ptr_operator(); }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& pe) {
- synPredMatched261 = false;
- }
- rewind(_m261);
- inputState->guessing--;
- }
- if (synPredMatched261) {
- ptr_operator();
- declarator();
- } else if ((_tokenSet_67.member(LA(1))) && (_tokenSet_68.member(LA(2)))) {
- direct_declarator();
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
-
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_69);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::initializer() {
- try { // for error handling
- switch (LA(1)) {
- case ID:
- case StringLiteral:
- case LPAREN:
- case LITERAL_typename:
- case LITERAL_char:
- case LITERAL_wchar_t:
- case LITERAL_bool:
- case LITERAL_short:
- case LITERAL_int:
- case 50:
- case 51:
- case 52:
- case 53:
- case 54:
- case 55:
- case 56:
- case 57:
- case 58:
- case 59:
- case 60:
- case 61:
- case 62:
- case 63:
- case 64:
- case 65:
- case 66:
- case 67:
- case LITERAL_long:
- case LITERAL_signed:
- case LITERAL_unsigned:
- case LITERAL_float:
- case LITERAL_double:
- case LITERAL_void:
- case LITERAL__declspec:
- case LITERAL___declspec:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case OCTALINT:
- case TILDE:
- case STAR:
- case AMPERSAND:
- case PLUS:
- case MINUS:
- case PLUSPLUS:
- case MINUSMINUS:
- case LITERAL_sizeof:
- case LITERAL___alignof__:
- case SCOPE:
- case LITERAL_dynamic_cast:
- case LITERAL_static_cast:
- case LITERAL_reinterpret_cast:
- case LITERAL_const_cast:
- case LITERAL_typeid:
- case DECIMALINT:
- case HEXADECIMALINT:
- case CharLiteral:
- case WCharLiteral:
- case WStringLiteral:
- case FLOATONE:
- case FLOATTWO:
- case NOT:
- case LITERAL_new:
- case LITERAL_delete: {
- remainder_expression();
- break;
- }
- case LCURLY: {
- match(LCURLY);
- initializer();
- { // ( ... )*
- for (;;) {
- if ((LA(1) == COMMA)) {
- match(COMMA);
- {
- switch (LA(1)) {
- case ID:
- case LCURLY:
- case StringLiteral:
- case LPAREN:
- case LITERAL_typename:
- case LITERAL_char:
- case LITERAL_wchar_t:
- case LITERAL_bool:
- case LITERAL_short:
- case LITERAL_int:
- case 50:
- case 51:
- case 52:
- case 53:
- case 54:
- case 55:
- case 56:
- case 57:
- case 58:
- case 59:
- case 60:
- case 61:
- case 62:
- case 63:
- case 64:
- case 65:
- case 66:
- case 67:
- case LITERAL_long:
- case LITERAL_signed:
- case LITERAL_unsigned:
- case LITERAL_float:
- case LITERAL_double:
- case LITERAL_void:
- case LITERAL__declspec:
- case LITERAL___declspec:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case OCTALINT:
- case TILDE:
- case STAR:
- case AMPERSAND:
- case PLUS:
- case MINUS:
- case PLUSPLUS:
- case MINUSMINUS:
- case LITERAL_sizeof:
- case LITERAL___alignof__:
- case SCOPE:
- case LITERAL_dynamic_cast:
- case LITERAL_static_cast:
- case LITERAL_reinterpret_cast:
- case LITERAL_const_cast:
- case LITERAL_typeid:
- case DECIMALINT:
- case HEXADECIMALINT:
- case CharLiteral:
- case WCharLiteral:
- case WStringLiteral:
- case FLOATONE:
- case FLOATTWO:
- case NOT:
- case LITERAL_new:
- case LITERAL_delete: {
- initializer();
- break;
- }
- case RCURLY:
- case COMMA: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- } else {
- goto _loop248;
- }
- }
- _loop248:;
- } // ( ... )*
- match(RCURLY);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_70);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::expression_list() {
- try { // for error handling
- assignment_expression();
- { // ( ... )*
- for (;;) {
- if ((LA(1) == COMMA)) {
- match(COMMA);
- assignment_expression();
- } else {
- goto _loop592;
- }
- }
- _loop592:;
- } // ( ... )*
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_71);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::remainder_expression() {
- try { // for error handling
- {
- bool synPredMatched452 = false;
- if (((_tokenSet_72.member(LA(1))) && (_tokenSet_73.member(LA(2))))) {
- int _m452 = mark();
- synPredMatched452 = true;
- inputState->guessing++;
- try {
- {
- conditional_expression();
- {
- switch (LA(1)) {
- case COMMA: {
- match(COMMA);
- break;
- }
- case SEMICOLON: {
- match(SEMICOLON);
- break;
- }
- case RPAREN: {
- match(RPAREN);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& pe) {
- synPredMatched452 = false;
- }
- rewind(_m452);
- inputState->guessing--;
- }
- if (synPredMatched452) {
- if (inputState->guessing == 0) {
-#line 1879 "CPP_parser.g"
- assign_stmt_RHS_found += 1;
-#line 6400 "CPPParser.cpp"
- }
- assignment_expression();
- if (inputState->guessing == 0) {
-#line 1881 "CPP_parser.g"
-
- if (assign_stmt_RHS_found > 0) {
- assign_stmt_RHS_found -= 1;
- } else {
- fprintf(stderr, "%d warning Error in assign_stmt_RHS_found = %d\n",
- LT(1)->getLine(), assign_stmt_RHS_found);
- fprintf(stderr, "Press return to continue\n");
- getchar();
- }
-
-#line 6416 "CPPParser.cpp"
- }
- } else if ((_tokenSet_72.member(LA(1))) && (_tokenSet_73.member(LA(2)))) {
- assignment_expression();
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_74);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::member_declarator() {
- try { // for error handling
- bool synPredMatched257 = false;
- if (((LA(1) == ID || LA(1) == COLON) && (_tokenSet_75.member(LA(2))))) {
- int _m257 = mark();
- synPredMatched257 = true;
- inputState->guessing++;
- try {
- {
- {
- switch (LA(1)) {
- case ID: {
- match(ID);
- break;
- }
- case COLON: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- match(COLON);
- constant_expression();
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& pe) {
- synPredMatched257 = false;
- }
- rewind(_m257);
- inputState->guessing--;
- }
- if (synPredMatched257) {
- {
- switch (LA(1)) {
- case ID: {
- match(ID);
- break;
- }
- case COLON: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- match(COLON);
- constant_expression();
- } else if ((_tokenSet_76.member(LA(1))) && (_tokenSet_77.member(LA(2)))) {
- declarator();
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
-
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_78);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::ptr_operator() {
- try { // for error handling
- {
- switch (LA(1)) {
- case AMPERSAND: {
- match(AMPERSAND);
- if (inputState->guessing == 0) {
-#line 2198 "CPP_parser.g"
- is_address = true;
-#line 6525 "CPPParser.cpp"
- }
- break;
- }
- case LITERAL__cdecl:
- case LITERAL___cdecl: {
- {
- switch (LA(1)) {
- case LITERAL__cdecl: {
- match(LITERAL__cdecl);
- break;
- }
- case LITERAL___cdecl: {
- match(LITERAL___cdecl);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- break;
- }
- case LITERAL__near:
- case LITERAL___near: {
- {
- switch (LA(1)) {
- case LITERAL__near: {
- match(LITERAL__near);
- break;
- }
- case LITERAL___near: {
- match(LITERAL___near);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- break;
- }
- case LITERAL__far:
- case LITERAL___far: {
- {
- switch (LA(1)) {
- case LITERAL__far: {
- match(LITERAL__far);
- break;
- }
- case LITERAL___far: {
- match(LITERAL___far);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- break;
- }
- case LITERAL___interrupt: {
- match(LITERAL___interrupt);
- break;
- }
- case LITERAL_pascal:
- case LITERAL__pascal:
- case LITERAL___pascal: {
- {
- switch (LA(1)) {
- case LITERAL_pascal: {
- match(LITERAL_pascal);
- break;
- }
- case LITERAL__pascal: {
- match(LITERAL__pascal);
- break;
- }
- case LITERAL___pascal: {
- match(LITERAL___pascal);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- break;
- }
- case LITERAL__stdcall:
- case LITERAL___stdcall: {
- {
- switch (LA(1)) {
- case LITERAL__stdcall: {
- match(LITERAL__stdcall);
- break;
- }
- case LITERAL___stdcall: {
- match(LITERAL___stdcall);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- break;
- }
- case ID:
- case STAR:
- case SCOPE: {
- ptr_to_member();
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_24);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::direct_declarator() {
- ANTLR_USE_NAMESPACE(antlr)
- RefToken dtor = ANTLR_USE_NAMESPACE(antlr) nullToken;
-#line 1225 "CPP_parser.g"
- char* id;
- CPPParser::TypeQualifier tq;
-#line 6684 "CPPParser.cpp"
-
- try { // for error handling
- switch (LA(1)) {
- case TILDE: {
- match(TILDE);
- dtor = LT(1);
- match(ID);
- if (inputState->guessing == 0) {
-#line 1271 "CPP_parser.g"
- declaratorID((dtor->getText()).data(), qiDtor);
-#line 6696 "CPPParser.cpp"
- }
- if (inputState->guessing == 0) {
-#line 1272 "CPP_parser.g"
- fprintf(
- stderr,
- "%d warning direct_declarator5 entered unexpectedly with %s\n",
- LT(1)->getLine(), (dtor->getText()).data());
-#line 6702 "CPPParser.cpp"
- }
- match(LPAREN);
- if (inputState->guessing == 0) {
-#line 1274 "CPP_parser.g"
- declaratorParameterList(0);
-#line 6708 "CPPParser.cpp"
- }
- {
- switch (LA(1)) {
- case LITERAL_typedef:
- case LITERAL_enum:
- case ID:
- case LITERAL_inline:
- case LITERAL_friend:
- case LITERAL_extern:
- case LITERAL_struct:
- case LITERAL_union:
- case LITERAL_class:
- case LITERAL__stdcall:
- case LITERAL___stdcall:
- case LITERAL_GFEXCLUDE:
- case LITERAL_GFINCLUDE:
- case LITERAL_GFID:
- case LITERAL_GFUNREAD:
- case LITERAL_GFARRAYSIZE:
- case LPAREN:
- case LITERAL_GFARRAYSIZES:
- case LITERAL_GFARRAYELEMSIZE:
- case LITERAL_auto:
- case LITERAL_register:
- case LITERAL_static:
- case LITERAL_mutable:
- case LITERAL__inline:
- case LITERAL___inline:
- case LITERAL_virtual:
- case LITERAL_explicit:
- case LITERAL_typename:
- case LITERAL_char:
- case LITERAL_wchar_t:
- case LITERAL_bool:
- case LITERAL_short:
- case LITERAL_int:
- case 50:
- case 51:
- case 52:
- case 53:
- case 54:
- case 55:
- case 56:
- case 57:
- case 58:
- case 59:
- case 60:
- case 61:
- case 62:
- case 63:
- case 64:
- case 65:
- case 66:
- case 67:
- case LITERAL_long:
- case LITERAL_signed:
- case LITERAL_unsigned:
- case LITERAL_float:
- case LITERAL_double:
- case LITERAL_void:
- case LITERAL__declspec:
- case LITERAL___declspec:
- case LITERAL_const:
- case LITERAL___const:
- case LITERAL_volatile:
- case LITERAL___volatile__:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case TILDE:
- case STAR:
- case AMPERSAND:
- case ELLIPSIS:
- case SCOPE:
- case LITERAL__cdecl:
- case LITERAL___cdecl:
- case LITERAL__near:
- case LITERAL___near:
- case LITERAL__far:
- case LITERAL___far:
- case LITERAL___interrupt:
- case LITERAL_pascal:
- case LITERAL__pascal:
- case LITERAL___pascal: {
- parameter_list();
- break;
- }
- case RPAREN: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- match(RPAREN);
- if (inputState->guessing == 0) {
-#line 1276 "CPP_parser.g"
- declaratorEndParameterList(0);
-#line 6812 "CPPParser.cpp"
- }
- break;
- }
- case LPAREN: {
- match(LPAREN);
- declarator();
- match(RPAREN);
- {
- if ((LA(1) == LPAREN || LA(1) == LSQUARE) &&
- (_tokenSet_79.member(LA(2)))) {
- declarator_suffix();
- } else if ((_tokenSet_69.member(LA(1))) &&
- (_tokenSet_80.member(LA(2)))) {
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- break;
- }
- default:
- bool synPredMatched265 = false;
- if (((_tokenSet_44.member(LA(1))) && (_tokenSet_28.member(LA(2))))) {
- int _m265 = mark();
- synPredMatched265 = true;
- inputState->guessing++;
- try {
- {
- qualified_id();
- match(LPAREN);
- {
- switch (LA(1)) {
- case RPAREN: {
- match(RPAREN);
- break;
- }
- case LITERAL_typedef:
- case LITERAL_enum:
- case ID:
- case LITERAL_inline:
- case LITERAL_friend:
- case LITERAL_extern:
- case LITERAL_struct:
- case LITERAL_union:
- case LITERAL_class:
- case LITERAL__stdcall:
- case LITERAL___stdcall:
- case LITERAL_GFEXCLUDE:
- case LITERAL_GFINCLUDE:
- case LITERAL_GFID:
- case LITERAL_GFUNREAD:
- case LITERAL_GFARRAYSIZE:
- case LITERAL_GFARRAYSIZES:
- case LITERAL_GFARRAYELEMSIZE:
- case LITERAL_auto:
- case LITERAL_register:
- case LITERAL_static:
- case LITERAL_mutable:
- case LITERAL__inline:
- case LITERAL___inline:
- case LITERAL_virtual:
- case LITERAL_explicit:
- case LITERAL_typename:
- case LITERAL_char:
- case LITERAL_wchar_t:
- case LITERAL_bool:
- case LITERAL_short:
- case LITERAL_int:
- case 50:
- case 51:
- case 52:
- case 53:
- case 54:
- case 55:
- case 56:
- case 57:
- case 58:
- case 59:
- case 60:
- case 61:
- case 62:
- case 63:
- case 64:
- case 65:
- case 66:
- case 67:
- case LITERAL_long:
- case LITERAL_signed:
- case LITERAL_unsigned:
- case LITERAL_float:
- case LITERAL_double:
- case LITERAL_void:
- case LITERAL__declspec:
- case LITERAL___declspec:
- case LITERAL_const:
- case LITERAL___const:
- case LITERAL_volatile:
- case LITERAL___volatile__:
- case SCOPE: {
- declaration_specifiers();
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& pe) {
- synPredMatched265 = false;
- }
- rewind(_m265);
- inputState->guessing--;
- }
- if (synPredMatched265) {
- id = qualified_id();
- if (inputState->guessing == 0) {
-#line 1231 "CPP_parser.g"
- if (_td == true) { // This statement is a typedef
- declaratorID(id, qiType);
- } else {
- declaratorID(id, qiFun);
- }
-
-#line 6941 "CPPParser.cpp"
- }
- match(LPAREN);
- if (inputState->guessing == 0) {
-#line 1236 "CPP_parser.g"
- declaratorParameterList(0);
-#line 6947 "CPPParser.cpp"
- }
- {
- switch (LA(1)) {
- case LITERAL_typedef:
- case LITERAL_enum:
- case ID:
- case LITERAL_inline:
- case LITERAL_friend:
- case LITERAL_extern:
- case LITERAL_struct:
- case LITERAL_union:
- case LITERAL_class:
- case LITERAL__stdcall:
- case LITERAL___stdcall:
- case LITERAL_GFEXCLUDE:
- case LITERAL_GFINCLUDE:
- case LITERAL_GFID:
- case LITERAL_GFUNREAD:
- case LITERAL_GFARRAYSIZE:
- case LPAREN:
- case LITERAL_GFARRAYSIZES:
- case LITERAL_GFARRAYELEMSIZE:
- case LITERAL_auto:
- case LITERAL_register:
- case LITERAL_static:
- case LITERAL_mutable:
- case LITERAL__inline:
- case LITERAL___inline:
- case LITERAL_virtual:
- case LITERAL_explicit:
- case LITERAL_typename:
- case LITERAL_char:
- case LITERAL_wchar_t:
- case LITERAL_bool:
- case LITERAL_short:
- case LITERAL_int:
- case 50:
- case 51:
- case 52:
- case 53:
- case 54:
- case 55:
- case 56:
- case 57:
- case 58:
- case 59:
- case 60:
- case 61:
- case 62:
- case 63:
- case 64:
- case 65:
- case 66:
- case 67:
- case LITERAL_long:
- case LITERAL_signed:
- case LITERAL_unsigned:
- case LITERAL_float:
- case LITERAL_double:
- case LITERAL_void:
- case LITERAL__declspec:
- case LITERAL___declspec:
- case LITERAL_const:
- case LITERAL___const:
- case LITERAL_volatile:
- case LITERAL___volatile__:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case TILDE:
- case STAR:
- case AMPERSAND:
- case ELLIPSIS:
- case SCOPE:
- case LITERAL__cdecl:
- case LITERAL___cdecl:
- case LITERAL__near:
- case LITERAL___near:
- case LITERAL__far:
- case LITERAL___far:
- case LITERAL___interrupt:
- case LITERAL_pascal:
- case LITERAL__pascal:
- case LITERAL___pascal: {
- parameter_list();
- break;
- }
- case RPAREN: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- match(RPAREN);
- if (inputState->guessing == 0) {
-#line 1238 "CPP_parser.g"
- declaratorEndParameterList(0);
-#line 7051 "CPPParser.cpp"
- }
- { // ( ... )*
- for (;;) {
- if (((LA(1) >= LITERAL_const && LA(1) <= LITERAL___volatile__))) {
- tq = type_qualifier();
- } else {
- goto _loop268;
- }
- }
- _loop268:;
- } // ( ... )*
- {
- switch (LA(1)) {
- case LITERAL_throw: {
- exception_specification();
- break;
- }
- case GREATERTHAN:
- case SEMICOLON:
- case ASSIGNEQUAL:
- case LPAREN:
- case RPAREN:
- case COMMA:
- case ELLIPSIS: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- } else {
- bool synPredMatched271 = false;
- if (((_tokenSet_44.member(LA(1))) && (_tokenSet_28.member(LA(2))))) {
- int _m271 = mark();
- synPredMatched271 = true;
- inputState->guessing++;
- try {
- {
- qualified_id();
- match(LPAREN);
- qualified_id();
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& pe) {
- synPredMatched271 = false;
- }
- rewind(_m271);
- inputState->guessing--;
- }
- if (synPredMatched271) {
- id = qualified_id();
- if (inputState->guessing == 0) {
-#line 1244 "CPP_parser.g"
- declaratorID(id, qiVar);
-#line 7113 "CPPParser.cpp"
- }
- match(LPAREN);
- expression_list();
- match(RPAREN);
- } else {
- bool synPredMatched273 = false;
- if (((_tokenSet_44.member(LA(1))) &&
- (_tokenSet_28.member(LA(2))))) {
- int _m273 = mark();
- synPredMatched273 = true;
- inputState->guessing++;
- try {
- {
- qualified_id();
- match(LSQUARE);
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& pe) {
- synPredMatched273 = false;
- }
- rewind(_m273);
- inputState->guessing--;
- }
- if (synPredMatched273) {
- id = qualified_id();
- if (inputState->guessing == 0) {
-#line 1251 "CPP_parser.g"
- if (_td == true) { // This statement is a typedef
- declaratorID(id, qiType); // This statement is a typedef
- } else {
- declaratorID(id, qiVar);
- }
- is_address = false;
- is_pointer = false;
-
-#line 7147 "CPPParser.cpp"
- }
- { // ( ... )+
- int _cnt276 = 0;
- for (;;) {
- if ((LA(1) == LSQUARE)) {
- match(LSQUARE);
- {
- switch (LA(1)) {
- case ID:
- case StringLiteral:
- case LPAREN:
- case LITERAL_typename:
- case LITERAL_char:
- case LITERAL_wchar_t:
- case LITERAL_bool:
- case LITERAL_short:
- case LITERAL_int:
- case 50:
- case 51:
- case 52:
- case 53:
- case 54:
- case 55:
- case 56:
- case 57:
- case 58:
- case 59:
- case 60:
- case 61:
- case 62:
- case 63:
- case 64:
- case 65:
- case 66:
- case 67:
- case LITERAL_long:
- case LITERAL_signed:
- case LITERAL_unsigned:
- case LITERAL_float:
- case LITERAL_double:
- case LITERAL_void:
- case LITERAL__declspec:
- case LITERAL___declspec:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case OCTALINT:
- case TILDE:
- case STAR:
- case AMPERSAND:
- case PLUS:
- case MINUS:
- case PLUSPLUS:
- case MINUSMINUS:
- case LITERAL_sizeof:
- case LITERAL___alignof__:
- case SCOPE:
- case LITERAL_dynamic_cast:
- case LITERAL_static_cast:
- case LITERAL_reinterpret_cast:
- case LITERAL_const_cast:
- case LITERAL_typeid:
- case DECIMALINT:
- case HEXADECIMALINT:
- case CharLiteral:
- case WCharLiteral:
- case WStringLiteral:
- case FLOATONE:
- case FLOATTWO:
- case NOT:
- case LITERAL_new:
- case LITERAL_delete: {
- constant_expression();
- break;
- }
- case RSQUARE: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- match(RSQUARE);
- } else {
- if (_cnt276 >= 1) {
- goto _loop276;
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
-
- _cnt276++;
- }
- _loop276:;
- } // ( ... )+
- if (inputState->guessing == 0) {
-#line 1259 "CPP_parser.g"
- declaratorArray();
-#line 7248 "CPPParser.cpp"
- }
- } else if ((_tokenSet_44.member(LA(1))) &&
- (_tokenSet_81.member(LA(2)))) {
- id = qualified_id();
- if (inputState->guessing == 0) {
-#line 1262 "CPP_parser.g"
- if (_td == true) {
- declaratorID(id, qiType); // This statement is a typedef
- } else {
- declaratorID(id, qiVar);
- }
- is_address = false;
- is_pointer = false;
-
-#line 7261 "CPPParser.cpp"
- }
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_69);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::parameter_list() {
- try { // for error handling
- parameter_declaration_list();
- {
- switch (LA(1)) {
- case ELLIPSIS: {
- match(ELLIPSIS);
- break;
- }
- case RPAREN: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_71);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::exception_specification() {
-#line 1560 "CPP_parser.g"
- char* so;
-#line 7314 "CPPParser.cpp"
-
- try { // for error handling
- match(LITERAL_throw);
- match(LPAREN);
- {
- switch (LA(1)) {
- case ID:
- case RPAREN:
- case SCOPE: {
- {
- switch (LA(1)) {
- case ID:
- case SCOPE: {
- so = scope_override();
- match(ID);
- { // ( ... )*
- for (;;) {
- if ((LA(1) == COMMA)) {
- match(COMMA);
- so = scope_override();
- match(ID);
- } else {
- goto _loop366;
- }
- }
- _loop366:;
- } // ( ... )*
- break;
- }
- case RPAREN: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- break;
- }
- case ELLIPSIS: {
- match(ELLIPSIS);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- match(RPAREN);
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_82);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::declarator_suffix() {
-#line 1284 "CPP_parser.g"
- CPPParser::TypeQualifier tq;
-#line 7386 "CPPParser.cpp"
-
- try { // for error handling
- {
- if ((LA(1) == LSQUARE)) {
- { // ( ... )+
- int _cnt283 = 0;
- for (;;) {
- if ((LA(1) == LSQUARE)) {
- match(LSQUARE);
- {
- switch (LA(1)) {
- case ID:
- case StringLiteral:
- case LPAREN:
- case LITERAL_typename:
- case LITERAL_char:
- case LITERAL_wchar_t:
- case LITERAL_bool:
- case LITERAL_short:
- case LITERAL_int:
- case 50:
- case 51:
- case 52:
- case 53:
- case 54:
- case 55:
- case 56:
- case 57:
- case 58:
- case 59:
- case 60:
- case 61:
- case 62:
- case 63:
- case 64:
- case 65:
- case 66:
- case 67:
- case LITERAL_long:
- case LITERAL_signed:
- case LITERAL_unsigned:
- case LITERAL_float:
- case LITERAL_double:
- case LITERAL_void:
- case LITERAL__declspec:
- case LITERAL___declspec:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case OCTALINT:
- case TILDE:
- case STAR:
- case AMPERSAND:
- case PLUS:
- case MINUS:
- case PLUSPLUS:
- case MINUSMINUS:
- case LITERAL_sizeof:
- case LITERAL___alignof__:
- case SCOPE:
- case LITERAL_dynamic_cast:
- case LITERAL_static_cast:
- case LITERAL_reinterpret_cast:
- case LITERAL_const_cast:
- case LITERAL_typeid:
- case DECIMALINT:
- case HEXADECIMALINT:
- case CharLiteral:
- case WCharLiteral:
- case WStringLiteral:
- case FLOATONE:
- case FLOATTWO:
- case NOT:
- case LITERAL_new:
- case LITERAL_delete: {
- constant_expression();
- break;
- }
- case RSQUARE: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- match(RSQUARE);
- } else {
- if (_cnt283 >= 1) {
- goto _loop283;
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
-
- _cnt283++;
- }
- _loop283:;
- } // ( ... )+
- if (inputState->guessing == 0) {
-#line 1290 "CPP_parser.g"
- declaratorArray();
-#line 7490 "CPPParser.cpp"
- }
- } else if (((LA(1) == LPAREN)) &&
- ((!((LA(1) == LPAREN) && (LA(2) == ID)) ||
- (qualifiedItemIsOneOf(qiType | qiCtor, 1))))) {
- match(LPAREN);
- if (inputState->guessing == 0) {
-#line 1293 "CPP_parser.g"
- declaratorParameterList(0);
-#line 7498 "CPPParser.cpp"
- }
- {
- switch (LA(1)) {
- case LITERAL_typedef:
- case LITERAL_enum:
- case ID:
- case LITERAL_inline:
- case LITERAL_friend:
- case LITERAL_extern:
- case LITERAL_struct:
- case LITERAL_union:
- case LITERAL_class:
- case LITERAL__stdcall:
- case LITERAL___stdcall:
- case LITERAL_GFEXCLUDE:
- case LITERAL_GFINCLUDE:
- case LITERAL_GFID:
- case LITERAL_GFUNREAD:
- case LITERAL_GFARRAYSIZE:
- case LPAREN:
- case LITERAL_GFARRAYSIZES:
- case LITERAL_GFARRAYELEMSIZE:
- case LITERAL_auto:
- case LITERAL_register:
- case LITERAL_static:
- case LITERAL_mutable:
- case LITERAL__inline:
- case LITERAL___inline:
- case LITERAL_virtual:
- case LITERAL_explicit:
- case LITERAL_typename:
- case LITERAL_char:
- case LITERAL_wchar_t:
- case LITERAL_bool:
- case LITERAL_short:
- case LITERAL_int:
- case 50:
- case 51:
- case 52:
- case 53:
- case 54:
- case 55:
- case 56:
- case 57:
- case 58:
- case 59:
- case 60:
- case 61:
- case 62:
- case 63:
- case 64:
- case 65:
- case 66:
- case 67:
- case LITERAL_long:
- case LITERAL_signed:
- case LITERAL_unsigned:
- case LITERAL_float:
- case LITERAL_double:
- case LITERAL_void:
- case LITERAL__declspec:
- case LITERAL___declspec:
- case LITERAL_const:
- case LITERAL___const:
- case LITERAL_volatile:
- case LITERAL___volatile__:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case TILDE:
- case STAR:
- case AMPERSAND:
- case ELLIPSIS:
- case SCOPE:
- case LITERAL__cdecl:
- case LITERAL___cdecl:
- case LITERAL__near:
- case LITERAL___near:
- case LITERAL__far:
- case LITERAL___far:
- case LITERAL___interrupt:
- case LITERAL_pascal:
- case LITERAL__pascal:
- case LITERAL___pascal: {
- parameter_list();
- break;
- }
- case RPAREN: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- match(RPAREN);
- if (inputState->guessing == 0) {
-#line 1295 "CPP_parser.g"
- declaratorEndParameterList(0);
-#line 7602 "CPPParser.cpp"
- }
- { // ( ... )*
- for (;;) {
- if (((LA(1) >= LITERAL_const && LA(1) <= LITERAL___volatile__))) {
- tq = type_qualifier();
- } else {
- goto _loop286;
- }
- }
- _loop286:;
- } // ( ... )*
- {
- switch (LA(1)) {
- case LITERAL_throw: {
- exception_specification();
- break;
- }
- case GREATERTHAN:
- case SEMICOLON:
- case ASSIGNEQUAL:
- case LPAREN:
- case RPAREN:
- case COMMA:
- case ELLIPSIS: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_69);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::template_parameter_list() {
- try { // for error handling
- if (inputState->guessing == 0) {
-#line 1581 "CPP_parser.g"
- beginTemplateParameterList();
-#line 7662 "CPPParser.cpp"
- }
- template_parameter();
- { // ( ... )*
- for (;;) {
- if ((LA(1) == COMMA)) {
- match(COMMA);
- template_parameter();
- } else {
- goto _loop370;
- }
- }
- _loop370:;
- } // ( ... )*
- if (inputState->guessing == 0) {
-#line 1583 "CPP_parser.g"
- endTemplateParameterList();
-#line 7681 "CPPParser.cpp"
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_52);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::function_direct_declarator(int definition) {
-#line 1324 "CPP_parser.g"
- char* q;
- CPPParser::TypeQualifier tq;
-#line 7700 "CPPParser.cpp"
-
- try { // for error handling
- {
- switch (LA(1)) {
- case LPAREN: {
- match(LPAREN);
- q = qualified_id();
- if (inputState->guessing == 0) {
-#line 1340 "CPP_parser.g"
-
- declaratorID(q, qiFun);
-
-#line 7714 "CPPParser.cpp"
- }
- match(RPAREN);
- break;
- }
- case ID:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case SCOPE: {
- q = qualified_id();
- if (inputState->guessing == 0) {
-#line 1346 "CPP_parser.g"
-
- declaratorID(q, qiFun);
-
-#line 7732 "CPPParser.cpp"
- }
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- if (inputState->guessing == 0) {
-#line 1351 "CPP_parser.g"
-
-#ifdef MYCODE
- if (definition) myCode_function_direct_declarator(q);
-#endif // MYCODE
-
-#line 7750 "CPPParser.cpp"
- }
- match(LPAREN);
- if (inputState->guessing == 0) {
-#line 1359 "CPP_parser.g"
-
- functionParameterList();
- if (K_and_R == false) in_parameter_list = true;
-
-#line 7760 "CPPParser.cpp"
- }
- {
- switch (LA(1)) {
- case LITERAL_typedef:
- case LITERAL_enum:
- case ID:
- case LITERAL_inline:
- case LITERAL_friend:
- case LITERAL_extern:
- case LITERAL_struct:
- case LITERAL_union:
- case LITERAL_class:
- case LITERAL__stdcall:
- case LITERAL___stdcall:
- case LITERAL_GFEXCLUDE:
- case LITERAL_GFINCLUDE:
- case LITERAL_GFID:
- case LITERAL_GFUNREAD:
- case LITERAL_GFARRAYSIZE:
- case LPAREN:
- case LITERAL_GFARRAYSIZES:
- case LITERAL_GFARRAYELEMSIZE:
- case LITERAL_auto:
- case LITERAL_register:
- case LITERAL_static:
- case LITERAL_mutable:
- case LITERAL__inline:
- case LITERAL___inline:
- case LITERAL_virtual:
- case LITERAL_explicit:
- case LITERAL_typename:
- case LITERAL_char:
- case LITERAL_wchar_t:
- case LITERAL_bool:
- case LITERAL_short:
- case LITERAL_int:
- case 50:
- case 51:
- case 52:
- case 53:
- case 54:
- case 55:
- case 56:
- case 57:
- case 58:
- case 59:
- case 60:
- case 61:
- case 62:
- case 63:
- case 64:
- case 65:
- case 66:
- case 67:
- case LITERAL_long:
- case LITERAL_signed:
- case LITERAL_unsigned:
- case LITERAL_float:
- case LITERAL_double:
- case LITERAL_void:
- case LITERAL__declspec:
- case LITERAL___declspec:
- case LITERAL_const:
- case LITERAL___const:
- case LITERAL_volatile:
- case LITERAL___volatile__:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case TILDE:
- case STAR:
- case AMPERSAND:
- case ELLIPSIS:
- case SCOPE:
- case LITERAL__cdecl:
- case LITERAL___cdecl:
- case LITERAL__near:
- case LITERAL___near:
- case LITERAL__far:
- case LITERAL___far:
- case LITERAL___interrupt:
- case LITERAL_pascal:
- case LITERAL__pascal:
- case LITERAL___pascal: {
- parameter_list();
- break;
- }
- case RPAREN: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- if (inputState->guessing == 0) {
-#line 1365 "CPP_parser.g"
-
- if (K_and_R == false) {
- in_parameter_list = false;
- } else {
- in_parameter_list = true;
- }
-
-#line 7868 "CPPParser.cpp"
- }
- match(RPAREN);
- { // ( ... )*
- for (;;) {
- if (((LA(1) >= LITERAL_const && LA(1) <= LITERAL___volatile__)) &&
- (_tokenSet_83.member(LA(2)))) {
- tq = type_qualifier();
- } else {
- goto _loop303;
- }
- }
- _loop303:;
- } // ( ... )*
- {
- switch (LA(1)) {
- case ASSIGNEQUAL: {
- match(ASSIGNEQUAL);
- match(OCTALINT);
- break;
- }
- case LITERAL_typedef:
- case SEMICOLON:
- case LITERAL_enum:
- case ID:
- case LCURLY:
- case LITERAL_inline:
- case LITERAL_friend:
- case LITERAL_extern:
- case LITERAL_struct:
- case LITERAL_union:
- case LITERAL_class:
- case LITERAL__stdcall:
- case LITERAL___stdcall:
- case LITERAL_GFEXCLUDE:
- case LITERAL_GFINCLUDE:
- case LITERAL_GFID:
- case LITERAL_GFUNREAD:
- case LITERAL_GFARRAYSIZE:
- case LITERAL_GFARRAYSIZES:
- case LITERAL_GFARRAYELEMSIZE:
- case LITERAL_auto:
- case LITERAL_register:
- case LITERAL_static:
- case LITERAL_mutable:
- case LITERAL__inline:
- case LITERAL___inline:
- case LITERAL_virtual:
- case LITERAL_explicit:
- case LITERAL_typename:
- case LITERAL_char:
- case LITERAL_wchar_t:
- case LITERAL_bool:
- case LITERAL_short:
- case LITERAL_int:
- case 50:
- case 51:
- case 52:
- case 53:
- case 54:
- case 55:
- case 56:
- case 57:
- case 58:
- case 59:
- case 60:
- case 61:
- case 62:
- case 63:
- case 64:
- case 65:
- case 66:
- case 67:
- case LITERAL_long:
- case LITERAL_signed:
- case LITERAL_unsigned:
- case LITERAL_float:
- case LITERAL_double:
- case LITERAL_void:
- case LITERAL__declspec:
- case LITERAL___declspec:
- case LITERAL_const:
- case LITERAL___const:
- case LITERAL_volatile:
- case LITERAL___volatile__:
- case LITERAL_throw:
- case LITERAL_using:
- case SCOPE: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- if (inputState->guessing == 0) {
-#line 1375 "CPP_parser.g"
- functionEndParameterList(definition);
-#line 7970 "CPPParser.cpp"
- }
- {
- switch (LA(1)) {
- case LITERAL_throw: {
- exception_specification();
- break;
- }
- case LITERAL_typedef:
- case SEMICOLON:
- case LITERAL_enum:
- case ID:
- case LCURLY:
- case LITERAL_inline:
- case LITERAL_friend:
- case LITERAL_extern:
- case LITERAL_struct:
- case LITERAL_union:
- case LITERAL_class:
- case LITERAL__stdcall:
- case LITERAL___stdcall:
- case LITERAL_GFEXCLUDE:
- case LITERAL_GFINCLUDE:
- case LITERAL_GFID:
- case LITERAL_GFUNREAD:
- case LITERAL_GFARRAYSIZE:
- case LITERAL_GFARRAYSIZES:
- case LITERAL_GFARRAYELEMSIZE:
- case LITERAL_auto:
- case LITERAL_register:
- case LITERAL_static:
- case LITERAL_mutable:
- case LITERAL__inline:
- case LITERAL___inline:
- case LITERAL_virtual:
- case LITERAL_explicit:
- case LITERAL_typename:
- case LITERAL_char:
- case LITERAL_wchar_t:
- case LITERAL_bool:
- case LITERAL_short:
- case LITERAL_int:
- case 50:
- case 51:
- case 52:
- case 53:
- case 54:
- case 55:
- case 56:
- case 57:
- case 58:
- case 59:
- case 60:
- case 61:
- case 62:
- case 63:
- case 64:
- case 65:
- case 66:
- case 67:
- case LITERAL_long:
- case LITERAL_signed:
- case LITERAL_unsigned:
- case LITERAL_float:
- case LITERAL_double:
- case LITERAL_void:
- case LITERAL__declspec:
- case LITERAL___declspec:
- case LITERAL_const:
- case LITERAL___const:
- case LITERAL_volatile:
- case LITERAL___volatile__:
- case LITERAL_using:
- case SCOPE: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_29);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::ctor_head() {
- try { // for error handling
- ctor_decl_spec();
- ctor_declarator(1);
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_84);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::ctor_body() {
- try { // for error handling
- {
- switch (LA(1)) {
- case COLON: {
- ctor_initializer();
- break;
- }
- case LCURLY: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- compound_statement();
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_30);
- } else {
- throw;
- }
- }
-}
-
-char* CPPParser::qualified_ctor_id() {
-#line 1414 "CPP_parser.g"
- char* q = NULL;
-#line 8116 "CPPParser.cpp"
- ANTLR_USE_NAMESPACE(antlr) RefToken id = ANTLR_USE_NAMESPACE(antlr) nullToken;
-#line 1414 "CPP_parser.g"
-
- char* so;
- static char qitem[CPPParser_MaxQualifiedItemSize + 1];
-
-#line 8123 "CPPParser.cpp"
-
- try { // for error handling
- so = scope_override();
- if (inputState->guessing == 0) {
-#line 1421 "CPP_parser.g"
- strcpy(qitem, so);
-#line 8130 "CPPParser.cpp"
- }
- id = LT(1);
- match(ID);
- if (inputState->guessing == 0) {
-#line 1423 "CPP_parser.g"
- strcat(qitem, (id->getText()).data());
- q = qitem;
-#line 8138 "CPPParser.cpp"
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_85);
- } else {
- throw;
- }
- }
- return q;
-}
-
-void CPPParser::ctor_initializer() {
- try { // for error handling
- match(COLON);
- superclass_init();
- { // ( ... )*
- for (;;) {
- if ((LA(1) == COMMA)) {
- match(COMMA);
- superclass_init();
- } else {
- goto _loop320;
- }
- }
- _loop320:;
- } // ( ... )*
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_53);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::superclass_init() {
-#line 1441 "CPP_parser.g"
- char* q;
-#line 8184 "CPPParser.cpp"
-
- try { // for error handling
- q = qualified_id();
- match(LPAREN);
- {
- switch (LA(1)) {
- case ID:
- case StringLiteral:
- case LPAREN:
- case LITERAL_typename:
- case LITERAL_char:
- case LITERAL_wchar_t:
- case LITERAL_bool:
- case LITERAL_short:
- case LITERAL_int:
- case 50:
- case 51:
- case 52:
- case 53:
- case 54:
- case 55:
- case 56:
- case 57:
- case 58:
- case 59:
- case 60:
- case 61:
- case 62:
- case 63:
- case 64:
- case 65:
- case 66:
- case 67:
- case LITERAL_long:
- case LITERAL_signed:
- case LITERAL_unsigned:
- case LITERAL_float:
- case LITERAL_double:
- case LITERAL_void:
- case LITERAL__declspec:
- case LITERAL___declspec:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case OCTALINT:
- case TILDE:
- case STAR:
- case AMPERSAND:
- case PLUS:
- case MINUS:
- case PLUSPLUS:
- case MINUSMINUS:
- case LITERAL_sizeof:
- case LITERAL___alignof__:
- case SCOPE:
- case LITERAL_dynamic_cast:
- case LITERAL_static_cast:
- case LITERAL_reinterpret_cast:
- case LITERAL_const_cast:
- case LITERAL_typeid:
- case DECIMALINT:
- case HEXADECIMALINT:
- case CharLiteral:
- case WCharLiteral:
- case WStringLiteral:
- case FLOATONE:
- case FLOATTWO:
- case NOT:
- case LITERAL_new:
- case LITERAL_delete: {
- expression_list();
- break;
- }
- case RPAREN: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- match(RPAREN);
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_60);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::dtor_decl_spec() {
- try { // for error handling
- { // ( ... )*
- for (;;) {
- switch (LA(1)) {
- case LITERAL_inline:
- case LITERAL__inline:
- case LITERAL___inline: {
- {
- switch (LA(1)) {
- case LITERAL_inline: {
- match(LITERAL_inline);
- break;
- }
- case LITERAL__inline: {
- match(LITERAL__inline);
- break;
- }
- case LITERAL___inline: {
- match(LITERAL___inline);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- break;
- }
- case LITERAL_virtual: {
- match(LITERAL_virtual);
- break;
- }
- default: { goto _loop327; }
- }
- }
- _loop327:;
- } // ( ... )*
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_86);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::dtor_declarator(int definition) {
-#line 1461 "CPP_parser.g"
- char* s;
-#line 8346 "CPPParser.cpp"
-
- try { // for error handling
- s = scope_override();
- match(TILDE);
- match(ID);
- if (inputState->guessing == 0) {
-#line 1466 "CPP_parser.g"
- declaratorParameterList(definition);
-#line 8355 "CPPParser.cpp"
- }
- match(LPAREN);
- {
- switch (LA(1)) {
- case LITERAL_void: {
- match(LITERAL_void);
- break;
- }
- case RPAREN: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- match(RPAREN);
- if (inputState->guessing == 0) {
-#line 1468 "CPP_parser.g"
- declaratorEndParameterList(definition);
-#line 8379 "CPPParser.cpp"
- }
- {
- switch (LA(1)) {
- case LITERAL_throw: {
- exception_specification();
- break;
- }
- case SEMICOLON:
- case LCURLY: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_32);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::parameter_declaration_list() {
- try { // for error handling
- {
- parameter_declaration();
- { // ( ... )*
- for (;;) {
- if ((LA(1) == COMMA)) {
- match(COMMA);
- parameter_declaration();
- } else {
- goto _loop337;
- }
- }
- _loop337:;
- } // ( ... )*
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_87);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::parameter_declaration() {
- try { // for error handling
- if (inputState->guessing == 0) {
-#line 1494 "CPP_parser.g"
- beginParameterDeclaration();
-#line 8446 "CPPParser.cpp"
- }
- {
- if (((_tokenSet_12.member(LA(1))) && (_tokenSet_88.member(LA(2)))) &&
- (!((LA(1) == SCOPE) && (LA(2) == STAR || LA(2) == OPERATOR)) &&
- (!(LA(1) == SCOPE || LA(1) == ID) ||
- qualifiedItemIsOneOf(qiType | qiCtor)))) {
- declaration_specifiers();
- {
- bool synPredMatched342 = false;
- if (((_tokenSet_76.member(LA(1))) && (_tokenSet_89.member(LA(2))))) {
- int _m342 = mark();
- synPredMatched342 = true;
- inputState->guessing++;
- try {
- { declarator(); }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& pe) {
- synPredMatched342 = false;
- }
- rewind(_m342);
- inputState->guessing--;
- }
- if (synPredMatched342) {
- declarator();
- } else if ((_tokenSet_90.member(LA(1))) &&
- (_tokenSet_91.member(LA(2)))) {
- abstract_declarator();
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- } else {
- bool synPredMatched344 = false;
- if (((_tokenSet_76.member(LA(1))) && (_tokenSet_89.member(LA(2))))) {
- int _m344 = mark();
- synPredMatched344 = true;
- inputState->guessing++;
- try {
- { declarator(); }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& pe) {
- synPredMatched344 = false;
- }
- rewind(_m344);
- inputState->guessing--;
- }
- if (synPredMatched344) {
- declarator();
- } else if ((LA(1) == ELLIPSIS)) {
- match(ELLIPSIS);
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- {
- switch (LA(1)) {
- case ASSIGNEQUAL: {
- match(ASSIGNEQUAL);
- remainder_expression();
- break;
- }
- case GREATERTHAN:
- case RPAREN:
- case COMMA:
- case ELLIPSIS: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_92);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::abstract_declarator() {
- try { // for error handling
- if ((_tokenSet_25.member(LA(1)))) {
- ptr_operator();
- abstract_declarator();
- } else {
- bool synPredMatched351 = false;
- if (((LA(1) == LPAREN) && (_tokenSet_25.member(LA(2))))) {
- int _m351 = mark();
- synPredMatched351 = true;
- inputState->guessing++;
- try {
- {
- match(LPAREN);
- { // ( ... )+
- int _cnt350 = 0;
- for (;;) {
- if ((_tokenSet_25.member(LA(1)))) {
- ptr_operator();
- } else {
- if (_cnt350 >= 1) {
- goto _loop350;
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
-
- _cnt350++;
- }
- _loop350:;
- } // ( ... )+
- match(RPAREN);
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& pe) {
- synPredMatched351 = false;
- }
- rewind(_m351);
- inputState->guessing--;
- }
- if (synPredMatched351) {
- match(LPAREN);
- { // ( ... )+
- int _cnt353 = 0;
- for (;;) {
- if ((_tokenSet_25.member(LA(1)))) {
- ptr_operator();
- } else {
- if (_cnt353 >= 1) {
- goto _loop353;
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
-
- _cnt353++;
- }
- _loop353:;
- } // ( ... )+
- match(RPAREN);
- {
- switch (LA(1)) {
- case LPAREN:
- case LSQUARE: {
- abstract_declarator_suffix();
- break;
- }
- case GREATERTHAN:
- case ASSIGNEQUAL:
- case RPAREN:
- case COMMA:
- case ELLIPSIS: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- } else if ((_tokenSet_93.member(LA(1))) && (_tokenSet_94.member(LA(2)))) {
- {
- switch (LA(1)) {
- case LPAREN:
- case LSQUARE: {
- abstract_declarator_suffix();
- break;
- }
- case GREATERTHAN:
- case ASSIGNEQUAL:
- case RPAREN:
- case COMMA:
- case ELLIPSIS: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_95);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::type_id() {
- try { // for error handling
- declaration_specifiers();
- abstract_declarator();
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_96);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::abstract_declarator_suffix() {
- try { // for error handling
- switch (LA(1)) {
- case LSQUARE: {
- { // ( ... )+
- int _cnt359 = 0;
- for (;;) {
- if ((LA(1) == LSQUARE)) {
- match(LSQUARE);
- {
- switch (LA(1)) {
- case ID:
- case StringLiteral:
- case LPAREN:
- case LITERAL_typename:
- case LITERAL_char:
- case LITERAL_wchar_t:
- case LITERAL_bool:
- case LITERAL_short:
- case LITERAL_int:
- case 50:
- case 51:
- case 52:
- case 53:
- case 54:
- case 55:
- case 56:
- case 57:
- case 58:
- case 59:
- case 60:
- case 61:
- case 62:
- case 63:
- case 64:
- case 65:
- case 66:
- case 67:
- case LITERAL_long:
- case LITERAL_signed:
- case LITERAL_unsigned:
- case LITERAL_float:
- case LITERAL_double:
- case LITERAL_void:
- case LITERAL__declspec:
- case LITERAL___declspec:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case OCTALINT:
- case TILDE:
- case STAR:
- case AMPERSAND:
- case PLUS:
- case MINUS:
- case PLUSPLUS:
- case MINUSMINUS:
- case LITERAL_sizeof:
- case LITERAL___alignof__:
- case SCOPE:
- case LITERAL_dynamic_cast:
- case LITERAL_static_cast:
- case LITERAL_reinterpret_cast:
- case LITERAL_const_cast:
- case LITERAL_typeid:
- case DECIMALINT:
- case HEXADECIMALINT:
- case CharLiteral:
- case WCharLiteral:
- case WStringLiteral:
- case FLOATONE:
- case FLOATTWO:
- case NOT:
- case LITERAL_new:
- case LITERAL_delete: {
- constant_expression();
- break;
- }
- case RSQUARE: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- match(RSQUARE);
- } else {
- if (_cnt359 >= 1) {
- goto _loop359;
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
-
- _cnt359++;
- }
- _loop359:;
- } // ( ... )+
- if (inputState->guessing == 0) {
-#line 1548 "CPP_parser.g"
- declaratorArray();
-#line 8780 "CPPParser.cpp"
- }
- break;
- }
- case LPAREN: {
- match(LPAREN);
- if (inputState->guessing == 0) {
-#line 1551 "CPP_parser.g"
- declaratorParameterList(0);
-#line 8790 "CPPParser.cpp"
- }
- {
- switch (LA(1)) {
- case LITERAL_typedef:
- case LITERAL_enum:
- case ID:
- case LITERAL_inline:
- case LITERAL_friend:
- case LITERAL_extern:
- case LITERAL_struct:
- case LITERAL_union:
- case LITERAL_class:
- case LITERAL__stdcall:
- case LITERAL___stdcall:
- case LITERAL_GFEXCLUDE:
- case LITERAL_GFINCLUDE:
- case LITERAL_GFID:
- case LITERAL_GFUNREAD:
- case LITERAL_GFARRAYSIZE:
- case LPAREN:
- case LITERAL_GFARRAYSIZES:
- case LITERAL_GFARRAYELEMSIZE:
- case LITERAL_auto:
- case LITERAL_register:
- case LITERAL_static:
- case LITERAL_mutable:
- case LITERAL__inline:
- case LITERAL___inline:
- case LITERAL_virtual:
- case LITERAL_explicit:
- case LITERAL_typename:
- case LITERAL_char:
- case LITERAL_wchar_t:
- case LITERAL_bool:
- case LITERAL_short:
- case LITERAL_int:
- case 50:
- case 51:
- case 52:
- case 53:
- case 54:
- case 55:
- case 56:
- case 57:
- case 58:
- case 59:
- case 60:
- case 61:
- case 62:
- case 63:
- case 64:
- case 65:
- case 66:
- case 67:
- case LITERAL_long:
- case LITERAL_signed:
- case LITERAL_unsigned:
- case LITERAL_float:
- case LITERAL_double:
- case LITERAL_void:
- case LITERAL__declspec:
- case LITERAL___declspec:
- case LITERAL_const:
- case LITERAL___const:
- case LITERAL_volatile:
- case LITERAL___volatile__:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case TILDE:
- case STAR:
- case AMPERSAND:
- case ELLIPSIS:
- case SCOPE:
- case LITERAL__cdecl:
- case LITERAL___cdecl:
- case LITERAL__near:
- case LITERAL___near:
- case LITERAL__far:
- case LITERAL___far:
- case LITERAL___interrupt:
- case LITERAL_pascal:
- case LITERAL__pascal:
- case LITERAL___pascal: {
- parameter_list();
- break;
- }
- case RPAREN: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- match(RPAREN);
- if (inputState->guessing == 0) {
-#line 1554 "CPP_parser.g"
- declaratorEndParameterList(0);
-#line 8894 "CPPParser.cpp"
- }
- cv_qualifier_seq();
- {
- switch (LA(1)) {
- case LITERAL_throw: {
- exception_specification();
- break;
- }
- case GREATERTHAN:
- case ASSIGNEQUAL:
- case RPAREN:
- case COMMA:
- case ELLIPSIS: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_95);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::cv_qualifier_seq() {
-#line 2218 "CPP_parser.g"
- CPPParser::TypeQualifier tq;
-#line 8939 "CPPParser.cpp"
-
- try { // for error handling
- { // ( ... )*
- for (;;) {
- if (((LA(1) >= LITERAL_const && LA(1) <= LITERAL___volatile__))) {
- tq = type_qualifier();
- } else {
- goto _loop581;
- }
- }
- _loop581:;
- } // ( ... )*
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_97);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::template_parameter() {
- try { // for error handling
- {
- if ((_tokenSet_98.member(LA(1))) && (_tokenSet_99.member(LA(2)))) {
- type_parameter();
- } else if ((_tokenSet_100.member(LA(1))) &&
- (_tokenSet_15.member(LA(2)))) {
- parameter_declaration();
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_101);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::type_parameter() {
- ANTLR_USE_NAMESPACE(antlr) RefToken id = ANTLR_USE_NAMESPACE(antlr) nullToken;
- ANTLR_USE_NAMESPACE(antlr)
- RefToken id2 = ANTLR_USE_NAMESPACE(antlr) nullToken;
-
- try { // for error handling
- {
- switch (LA(1)) {
- case LITERAL_class:
- case LITERAL_typename: {
- {
- switch (LA(1)) {
- case LITERAL_class: {
- match(LITERAL_class);
- break;
- }
- case LITERAL_typename: {
- match(LITERAL_typename);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- {
- switch (LA(1)) {
- case ID: {
- id = LT(1);
- match(ID);
- if (inputState->guessing == 0) {
-#line 1610 "CPP_parser.g"
-
- templateTypeParameter((id->getText()).data());
-
-#line 9030 "CPPParser.cpp"
- }
- {
- switch (LA(1)) {
- case ASSIGNEQUAL: {
- match(ASSIGNEQUAL);
- assigned_type_name();
- break;
- }
- case GREATERTHAN:
- case COMMA: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- break;
- }
- case GREATERTHAN:
- case COMMA: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- break;
- }
- case LITERAL_template: {
- template_head();
- match(LITERAL_class);
- {
- switch (LA(1)) {
- case ID: {
- id2 = LT(1);
- match(ID);
- if (inputState->guessing == 0) {
-#line 1618 "CPP_parser.g"
-
- templateTypeParameter((id2->getText()).data());
-
-#line 9081 "CPPParser.cpp"
- }
- {
- switch (LA(1)) {
- case ASSIGNEQUAL: {
- match(ASSIGNEQUAL);
- assigned_type_name();
- break;
- }
- case GREATERTHAN:
- case COMMA: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- break;
- }
- case GREATERTHAN:
- case COMMA: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_101);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::assigned_type_name() {
-#line 1631 "CPP_parser.g"
- char* qt;
- TypeSpecifier ts;
-#line 9137 "CPPParser.cpp"
-
- try { // for error handling
- {
- if ((LA(1) == ID || LA(1) == SCOPE) && (_tokenSet_102.member(LA(2)))) {
- qt = qualified_type();
- abstract_declarator();
- } else if ((_tokenSet_103.member(LA(1))) &&
- (_tokenSet_104.member(LA(2)))) {
- ts = simple_type_specifier();
- abstract_declarator();
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_101);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::template_id() {
- try { // for error handling
- match(ID);
- match(LESSTHAN);
- template_argument_list();
- match(GREATERTHAN);
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_1);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::template_argument() {
- try { // for error handling
- if (((_tokenSet_12.member(LA(1))) && (_tokenSet_105.member(LA(2)))) &&
- ((!(LA(1) == SCOPE || LA(1) == ID) ||
- qualifiedItemIsOneOf(qiType | qiCtor)))) {
- type_id();
- } else if ((_tokenSet_72.member(LA(1))) && (_tokenSet_106.member(LA(2)))) {
- shift_expression();
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
-
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_101);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::shift_expression() {
- try { // for error handling
- additive_expression();
- { // ( ... )*
- for (;;) {
- if ((LA(1) == SHIFTLEFT || LA(1) == SHIFTRIGHT)) {
- {
- switch (LA(1)) {
- case SHIFTLEFT: {
- match(SHIFTLEFT);
- break;
- }
- case SHIFTRIGHT: {
- match(SHIFTRIGHT);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- additive_expression();
- } else {
- goto _loop482;
- }
- }
- _loop482:;
- } // ( ... )*
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_107);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::statement_list() {
- try { // for error handling
- { // ( ... )+
- int _cnt389 = 0;
- for (;;) {
- if ((_tokenSet_49.member(LA(1)))) {
- statement();
- } else {
- if (_cnt389 >= 1) {
- goto _loop389;
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
-
- _cnt389++;
- }
- _loop389:;
- } // ( ... )+
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_61);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::statement() {
-#line 1680 "CPP_parser.g"
-
- FunctionSpecifier fs = fsInvalid; // inline,virtual,explicit
-
-#line 9285 "CPPParser.cpp"
-
- try { // for error handling
- {
- switch (LA(1)) {
- case LITERAL_case: {
- case_statement();
- break;
- }
- case LITERAL_default: {
- default_statement();
- break;
- }
- case LCURLY: {
- compound_statement();
- break;
- }
- case LITERAL_if:
- case LITERAL_switch: {
- selection_statement();
- break;
- }
- case LITERAL_while:
- case LITERAL_do:
- case LITERAL_for: {
- iteration_statement();
- break;
- }
- case LITERAL_goto:
- case LITERAL_continue:
- case LITERAL_break:
- case LITERAL_return: {
- jump_statement();
- break;
- }
- case LITERAL_try: {
- try_block();
- break;
- }
- case LITERAL_throw: {
- throw_statement();
- break;
- }
- default:
- bool synPredMatched393 = false;
- if (((_tokenSet_108.member(LA(1))) &&
- (_tokenSet_109.member(LA(2))))) {
- int _m393 = mark();
- synPredMatched393 = true;
- inputState->guessing++;
- try {
- {
- switch (LA(1)) {
- case LITERAL_namespace: {
- match(LITERAL_namespace);
- break;
- }
- case LITERAL_using: {
- match(LITERAL_using);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& pe) {
- synPredMatched393 = false;
- }
- rewind(_m393);
- inputState->guessing--;
- }
- if (synPredMatched393) {
- block_declaration();
- } else {
- bool synPredMatched397 = false;
- if (((_tokenSet_20.member(LA(1))) &&
- (_tokenSet_110.member(LA(2))))) {
- int _m397 = mark();
- synPredMatched397 = true;
- inputState->guessing++;
- try {
- {
- {
- switch (LA(1)) {
- case LITERAL_typedef: {
- match(LITERAL_typedef);
- break;
- }
- case LITERAL_struct:
- case LITERAL_union:
- case LITERAL_class: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- class_specifier();
- {
- switch (LA(1)) {
- case ID:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case SCOPE: {
- qualified_id();
- break;
- }
- case LCURLY: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- match(LCURLY);
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& pe) {
- synPredMatched397 = false;
- }
- rewind(_m397);
- inputState->guessing--;
- }
- if (synPredMatched397) {
- member_declaration();
- } else {
- bool synPredMatched399 = false;
- if (((_tokenSet_20.member(LA(1))) &&
- (_tokenSet_110.member(LA(2))))) {
- int _m399 = mark();
- synPredMatched399 = true;
- inputState->guessing++;
- try {
- {
- declaration_specifiers();
- match(LPAREN);
- ptr_operator();
- qualified_id();
- match(RPAREN);
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& pe) {
- synPredMatched399 = false;
- }
- rewind(_m399);
- inputState->guessing--;
- }
- if (synPredMatched399) {
- member_declaration();
- } else {
- bool synPredMatched402 = false;
- if (((_tokenSet_20.member(LA(1))) &&
- (_tokenSet_110.member(LA(2))))) {
- int _m402 = mark();
- synPredMatched402 = true;
- inputState->guessing++;
- try {
- {
- declaration_specifiers();
- {
- ptr_operator();
- ptr_operator();
- }
- qualified_id();
- }
- } catch (ANTLR_USE_NAMESPACE(antlr)
- RecognitionException& pe) {
- synPredMatched402 = false;
- }
- rewind(_m402);
- inputState->guessing--;
- }
- if (synPredMatched402) {
- member_declaration();
- } else {
- bool synPredMatched407 = false;
- if (((_tokenSet_20.member(LA(1))) &&
- (_tokenSet_110.member(LA(2))))) {
- int _m407 = mark();
- synPredMatched407 = true;
- inputState->guessing++;
- try {
- {
- declaration_specifiers();
- {
- bool synPredMatched406 = false;
- if (((_tokenSet_25.member(LA(1))) &&
- (_tokenSet_111.member(LA(2))))) {
- int _m406 = mark();
- synPredMatched406 = true;
- inputState->guessing++;
- try {
- { ptr_operator(); }
- } catch (ANTLR_USE_NAMESPACE(antlr)
- RecognitionException& pe) {
- synPredMatched406 = false;
- }
- rewind(_m406);
- inputState->guessing--;
- }
- if (synPredMatched406) {
- ptr_operator();
- } else if ((_tokenSet_44.member(LA(1))) && (true)) {
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- qualified_id();
- }
- } catch (ANTLR_USE_NAMESPACE(antlr)
- RecognitionException& pe) {
- synPredMatched407 = false;
- }
- rewind(_m407);
- inputState->guessing--;
- }
- if (synPredMatched407) {
- member_declaration();
- } else if ((LA(1) == ID) && (LA(2) == COLON)) {
- labeled_statement();
- } else if ((_tokenSet_72.member(LA(1))) &&
- (_tokenSet_112.member(LA(2)))) {
- expression();
- match(SEMICOLON);
- if (inputState->guessing == 0) {
-#line 1698 "CPP_parser.g"
- end_of_stmt();
-#line 9539 "CPPParser.cpp"
- }
- } else if ((LA(1) == SEMICOLON) &&
- (_tokenSet_40.member(LA(2)))) {
- match(SEMICOLON);
- if (inputState->guessing == 0) {
-#line 1703 "CPP_parser.g"
- end_of_stmt();
-#line 9547 "CPPParser.cpp"
- }
- } else if ((LA(1) == LITERAL_antlrTrace_on) &&
- (_tokenSet_40.member(LA(2)))) {
- match(LITERAL_antlrTrace_on);
- if (inputState->guessing == 0) {
-#line 1708 "CPP_parser.g"
- antlrTrace(true);
-#line 9555 "CPPParser.cpp"
- }
- } else if ((LA(1) == LITERAL_antlrTrace_off) &&
- (_tokenSet_40.member(LA(2)))) {
- match(LITERAL_antlrTrace_off);
- if (inputState->guessing == 0) {
-#line 1710 "CPP_parser.g"
- antlrTrace(false);
-#line 9563 "CPPParser.cpp"
- }
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- }
- }
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_40);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::block_declaration() {
- try { // for error handling
- switch (LA(1)) {
- case LITERAL_typedef:
- case LITERAL_enum:
- case ID:
- case LITERAL_inline:
- case LITERAL_friend:
- case LITERAL_extern:
- case LITERAL_struct:
- case LITERAL_union:
- case LITERAL_class:
- case LITERAL__stdcall:
- case LITERAL___stdcall:
- case LITERAL_GFEXCLUDE:
- case LITERAL_GFINCLUDE:
- case LITERAL_GFID:
- case LITERAL_GFUNREAD:
- case LITERAL_GFARRAYSIZE:
- case LITERAL_GFARRAYSIZES:
- case LITERAL_GFARRAYELEMSIZE:
- case LITERAL_auto:
- case LITERAL_register:
- case LITERAL_static:
- case LITERAL_mutable:
- case LITERAL__inline:
- case LITERAL___inline:
- case LITERAL_virtual:
- case LITERAL_explicit:
- case LITERAL_typename:
- case LITERAL_char:
- case LITERAL_wchar_t:
- case LITERAL_bool:
- case LITERAL_short:
- case LITERAL_int:
- case 50:
- case 51:
- case 52:
- case 53:
- case 54:
- case 55:
- case 56:
- case 57:
- case 58:
- case 59:
- case 60:
- case 61:
- case 62:
- case 63:
- case 64:
- case 65:
- case 66:
- case 67:
- case LITERAL_long:
- case LITERAL_signed:
- case LITERAL_unsigned:
- case LITERAL_float:
- case LITERAL_double:
- case LITERAL_void:
- case LITERAL__declspec:
- case LITERAL___declspec:
- case LITERAL_const:
- case LITERAL___const:
- case LITERAL_volatile:
- case LITERAL___volatile__:
- case SCOPE: {
- simple_declaration();
- break;
- }
- case LITERAL_asm:
- case LITERAL__asm:
- case LITERAL___asm:
- case LITERAL___asm__: {
- asm_definition();
- break;
- }
- case LITERAL_namespace: {
- namespace_alias_definition();
- break;
- }
- case LITERAL_using: {
- using_statement();
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_40);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::labeled_statement() {
- try { // for error handling
- match(ID);
- match(COLON);
- statement();
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_40);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::case_statement() {
- try { // for error handling
- match(LITERAL_case);
- constant_expression();
- match(COLON);
- statement();
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_40);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::default_statement() {
- try { // for error handling
- match(LITERAL_default);
- match(COLON);
- statement();
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_40);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::selection_statement() {
- try { // for error handling
- switch (LA(1)) {
- case LITERAL_if: {
- match(LITERAL_if);
- match(LPAREN);
- expression();
- match(RPAREN);
- statement();
- {
- if ((LA(1) == LITERAL_else) && (_tokenSet_49.member(LA(2)))) {
- match(LITERAL_else);
- statement();
- } else if ((_tokenSet_40.member(LA(1))) &&
- (_tokenSet_113.member(LA(2)))) {
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- break;
- }
- case LITERAL_switch: {
- match(LITERAL_switch);
- match(LPAREN);
- expression();
- match(RPAREN);
- statement();
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_40);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::iteration_statement() {
- try { // for error handling
- switch (LA(1)) {
- case LITERAL_while: {
- match(LITERAL_while);
- match(LPAREN);
- expression();
- match(RPAREN);
- statement();
- break;
- }
- case LITERAL_do: {
- match(LITERAL_do);
- statement();
- match(LITERAL_while);
- match(LPAREN);
- expression();
- match(RPAREN);
- match(SEMICOLON);
- if (inputState->guessing == 0) {
-#line 1777 "CPP_parser.g"
- end_of_stmt();
-#line 9814 "CPPParser.cpp"
- }
- break;
- }
- case LITERAL_for: {
- match(LITERAL_for);
- match(LPAREN);
- {
- bool synPredMatched421 = false;
- if (((_tokenSet_2.member(LA(1))) && (_tokenSet_3.member(LA(2))))) {
- int _m421 = mark();
- synPredMatched421 = true;
- inputState->guessing++;
- try {
- { declaration(); }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& pe) {
- synPredMatched421 = false;
- }
- rewind(_m421);
- inputState->guessing--;
- }
- if (synPredMatched421) {
- declaration();
- } else if ((_tokenSet_72.member(LA(1))) &&
- (_tokenSet_112.member(LA(2)))) {
- expression();
- match(SEMICOLON);
- if (inputState->guessing == 0) {
-#line 1781 "CPP_parser.g"
- end_of_stmt();
-#line 9848 "CPPParser.cpp"
- }
- } else if ((LA(1) == SEMICOLON)) {
- match(SEMICOLON);
- if (inputState->guessing == 0) {
-#line 1782 "CPP_parser.g"
- end_of_stmt();
-#line 9856 "CPPParser.cpp"
- }
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- {
- switch (LA(1)) {
- case ID:
- case StringLiteral:
- case LPAREN:
- case LITERAL_typename:
- case LITERAL_char:
- case LITERAL_wchar_t:
- case LITERAL_bool:
- case LITERAL_short:
- case LITERAL_int:
- case 50:
- case 51:
- case 52:
- case 53:
- case 54:
- case 55:
- case 56:
- case 57:
- case 58:
- case 59:
- case 60:
- case 61:
- case 62:
- case 63:
- case 64:
- case 65:
- case 66:
- case 67:
- case LITERAL_long:
- case LITERAL_signed:
- case LITERAL_unsigned:
- case LITERAL_float:
- case LITERAL_double:
- case LITERAL_void:
- case LITERAL__declspec:
- case LITERAL___declspec:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case OCTALINT:
- case TILDE:
- case STAR:
- case AMPERSAND:
- case PLUS:
- case MINUS:
- case PLUSPLUS:
- case MINUSMINUS:
- case LITERAL_sizeof:
- case LITERAL___alignof__:
- case SCOPE:
- case LITERAL_dynamic_cast:
- case LITERAL_static_cast:
- case LITERAL_reinterpret_cast:
- case LITERAL_const_cast:
- case LITERAL_typeid:
- case DECIMALINT:
- case HEXADECIMALINT:
- case CharLiteral:
- case WCharLiteral:
- case WStringLiteral:
- case FLOATONE:
- case FLOATTWO:
- case NOT:
- case LITERAL_new:
- case LITERAL_delete: {
- expression();
- break;
- }
- case SEMICOLON: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- match(SEMICOLON);
- if (inputState->guessing == 0) {
-#line 1784 "CPP_parser.g"
- end_of_stmt();
-#line 9949 "CPPParser.cpp"
- }
- {
- switch (LA(1)) {
- case ID:
- case StringLiteral:
- case LPAREN:
- case LITERAL_typename:
- case LITERAL_char:
- case LITERAL_wchar_t:
- case LITERAL_bool:
- case LITERAL_short:
- case LITERAL_int:
- case 50:
- case 51:
- case 52:
- case 53:
- case 54:
- case 55:
- case 56:
- case 57:
- case 58:
- case 59:
- case 60:
- case 61:
- case 62:
- case 63:
- case 64:
- case 65:
- case 66:
- case 67:
- case LITERAL_long:
- case LITERAL_signed:
- case LITERAL_unsigned:
- case LITERAL_float:
- case LITERAL_double:
- case LITERAL_void:
- case LITERAL__declspec:
- case LITERAL___declspec:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case OCTALINT:
- case TILDE:
- case STAR:
- case AMPERSAND:
- case PLUS:
- case MINUS:
- case PLUSPLUS:
- case MINUSMINUS:
- case LITERAL_sizeof:
- case LITERAL___alignof__:
- case SCOPE:
- case LITERAL_dynamic_cast:
- case LITERAL_static_cast:
- case LITERAL_reinterpret_cast:
- case LITERAL_const_cast:
- case LITERAL_typeid:
- case DECIMALINT:
- case HEXADECIMALINT:
- case CharLiteral:
- case WCharLiteral:
- case WStringLiteral:
- case FLOATONE:
- case FLOATTWO:
- case NOT:
- case LITERAL_new:
- case LITERAL_delete: {
- expression();
- break;
- }
- case RPAREN: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- match(RPAREN);
- statement();
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_40);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::jump_statement() {
- try { // for error handling
- {
- switch (LA(1)) {
- case LITERAL_goto: {
- match(LITERAL_goto);
- match(ID);
- match(SEMICOLON);
- if (inputState->guessing == 0) {
-#line 1791 "CPP_parser.g"
- end_of_stmt();
-#line 10065 "CPPParser.cpp"
- }
- break;
- }
- case LITERAL_continue: {
- match(LITERAL_continue);
- match(SEMICOLON);
- if (inputState->guessing == 0) {
-#line 1792 "CPP_parser.g"
- end_of_stmt();
-#line 10076 "CPPParser.cpp"
- }
- break;
- }
- case LITERAL_break: {
- match(LITERAL_break);
- match(SEMICOLON);
- if (inputState->guessing == 0) {
-#line 1793 "CPP_parser.g"
- end_of_stmt();
-#line 10087 "CPPParser.cpp"
- }
- break;
- }
- case LITERAL_return: {
- match(LITERAL_return);
- if (inputState->guessing == 0) {
-#line 1795 "CPP_parser.g"
- in_return = true;
-#line 10097 "CPPParser.cpp"
- }
- {
- bool synPredMatched428 = false;
- if (((LA(1) == LPAREN) && (LA(2) == ID))) {
- int _m428 = mark();
- synPredMatched428 = true;
- inputState->guessing++;
- try {
- {
- match(LPAREN);
- if (!((qualifiedItemIsOneOf(qiType)))) {
- throw ANTLR_USE_NAMESPACE(antlr)
- SemanticException("(qualifiedItemIsOneOf(qiType) )");
- }
- match(ID);
- match(RPAREN);
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& pe) {
- synPredMatched428 = false;
- }
- rewind(_m428);
- inputState->guessing--;
- }
- if (synPredMatched428) {
- match(LPAREN);
- match(ID);
- match(RPAREN);
- {
- switch (LA(1)) {
- case ID:
- case StringLiteral:
- case LPAREN:
- case LITERAL_typename:
- case LITERAL_char:
- case LITERAL_wchar_t:
- case LITERAL_bool:
- case LITERAL_short:
- case LITERAL_int:
- case 50:
- case 51:
- case 52:
- case 53:
- case 54:
- case 55:
- case 56:
- case 57:
- case 58:
- case 59:
- case 60:
- case 61:
- case 62:
- case 63:
- case 64:
- case 65:
- case 66:
- case 67:
- case LITERAL_long:
- case LITERAL_signed:
- case LITERAL_unsigned:
- case LITERAL_float:
- case LITERAL_double:
- case LITERAL_void:
- case LITERAL__declspec:
- case LITERAL___declspec:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case OCTALINT:
- case TILDE:
- case STAR:
- case AMPERSAND:
- case PLUS:
- case MINUS:
- case PLUSPLUS:
- case MINUSMINUS:
- case LITERAL_sizeof:
- case LITERAL___alignof__:
- case SCOPE:
- case LITERAL_dynamic_cast:
- case LITERAL_static_cast:
- case LITERAL_reinterpret_cast:
- case LITERAL_const_cast:
- case LITERAL_typeid:
- case DECIMALINT:
- case HEXADECIMALINT:
- case CharLiteral:
- case WCharLiteral:
- case WStringLiteral:
- case FLOATONE:
- case FLOATTWO:
- case NOT:
- case LITERAL_new:
- case LITERAL_delete: {
- expression();
- break;
- }
- case SEMICOLON: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- } else if ((_tokenSet_72.member(LA(1))) &&
- (_tokenSet_112.member(LA(2)))) {
- expression();
- } else if ((LA(1) == SEMICOLON)) {
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- match(SEMICOLON);
- if (inputState->guessing == 0) {
-#line 1802 "CPP_parser.g"
- in_return = false, end_of_stmt();
-#line 10220 "CPPParser.cpp"
- }
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_40);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::try_block() {
- try { // for error handling
- match(LITERAL_try);
- compound_statement();
- { // ( ... )*
- for (;;) {
- if ((LA(1) == LITERAL_catch)) {
- handler();
- } else {
- goto _loop432;
- }
- }
- _loop432:;
- } // ( ... )*
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_40);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::throw_statement() {
- try { // for error handling
- match(LITERAL_throw);
- {
- switch (LA(1)) {
- case ID:
- case StringLiteral:
- case LPAREN:
- case LITERAL_typename:
- case LITERAL_char:
- case LITERAL_wchar_t:
- case LITERAL_bool:
- case LITERAL_short:
- case LITERAL_int:
- case 50:
- case 51:
- case 52:
- case 53:
- case 54:
- case 55:
- case 56:
- case 57:
- case 58:
- case 59:
- case 60:
- case 61:
- case 62:
- case 63:
- case 64:
- case 65:
- case 66:
- case 67:
- case LITERAL_long:
- case LITERAL_signed:
- case LITERAL_unsigned:
- case LITERAL_float:
- case LITERAL_double:
- case LITERAL_void:
- case LITERAL__declspec:
- case LITERAL___declspec:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case OCTALINT:
- case TILDE:
- case STAR:
- case AMPERSAND:
- case PLUS:
- case MINUS:
- case PLUSPLUS:
- case MINUSMINUS:
- case LITERAL_sizeof:
- case LITERAL___alignof__:
- case SCOPE:
- case LITERAL_dynamic_cast:
- case LITERAL_static_cast:
- case LITERAL_reinterpret_cast:
- case LITERAL_const_cast:
- case LITERAL_typeid:
- case DECIMALINT:
- case HEXADECIMALINT:
- case CharLiteral:
- case WCharLiteral:
- case WStringLiteral:
- case FLOATONE:
- case FLOATTWO:
- case NOT:
- case LITERAL_new:
- case LITERAL_delete: {
- assignment_expression();
- break;
- }
- case SEMICOLON: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- match(SEMICOLON);
- if (inputState->guessing == 0) {
-#line 1833 "CPP_parser.g"
- end_of_stmt();
-#line 10358 "CPPParser.cpp"
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_40);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::simple_declaration() {
- try { // for error handling
- declaration_specifiers();
- {
- switch (LA(1)) {
- case ID:
- case LITERAL__stdcall:
- case LITERAL___stdcall:
- case LPAREN:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case TILDE:
- case STAR:
- case AMPERSAND:
- case SCOPE:
- case LITERAL__cdecl:
- case LITERAL___cdecl:
- case LITERAL__near:
- case LITERAL___near:
- case LITERAL__far:
- case LITERAL___far:
- case LITERAL___interrupt:
- case LITERAL_pascal:
- case LITERAL__pascal:
- case LITERAL___pascal: {
- init_declarator_list();
- break;
- }
- case SEMICOLON: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- match(SEMICOLON);
- if (inputState->guessing == 0) {
-#line 1725 "CPP_parser.g"
- end_of_stmt();
-#line 10417 "CPPParser.cpp"
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_40);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::asm_definition() {
- try { // for error handling
- {
- switch (LA(1)) {
- case LITERAL_asm: {
- match(LITERAL_asm);
- break;
- }
- case LITERAL__asm: {
- match(LITERAL__asm);
- break;
- }
- case LITERAL___asm: {
- match(LITERAL___asm);
- break;
- }
- case LITERAL___asm__: {
- match(LITERAL___asm__);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- match(LPAREN);
- match(StringLiteral);
- match(RPAREN);
- match(SEMICOLON);
- if (inputState->guessing == 0) {
-#line 1848 "CPP_parser.g"
- end_of_stmt();
-#line 10468 "CPPParser.cpp"
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_40);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::handler() {
- try { // for error handling
- match(LITERAL_catch);
- if (inputState->guessing == 0) {
-#line 1814 "CPP_parser.g"
- exceptionBeginHandler();
-#line 10488 "CPPParser.cpp"
- }
- if (inputState->guessing == 0) {
-#line 1815 "CPP_parser.g"
- declaratorParameterList(1);
-#line 10493 "CPPParser.cpp"
- }
- match(LPAREN);
- exception_declaration();
- match(RPAREN);
- if (inputState->guessing == 0) {
-#line 1817 "CPP_parser.g"
- declaratorEndParameterList(1);
-#line 10501 "CPPParser.cpp"
- }
- compound_statement();
- if (inputState->guessing == 0) {
-#line 1819 "CPP_parser.g"
- exceptionEndHandler();
-#line 10507 "CPPParser.cpp"
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_114);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::exception_declaration() {
- try { // for error handling
- parameter_declaration_list();
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_71);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::assignment_expression() {
- try { // for error handling
- conditional_expression();
- {
- switch (LA(1)) {
- case ASSIGNEQUAL:
- case TIMESEQUAL:
- case DIVIDEEQUAL:
- case MINUSEQUAL:
- case PLUSEQUAL:
- case MODEQUAL:
- case SHIFTLEFTEQUAL:
- case SHIFTRIGHTEQUAL:
- case BITWISEANDEQUAL:
- case BITWISEXOREQUAL:
- case BITWISEOREQUAL: {
- {
- switch (LA(1)) {
- case ASSIGNEQUAL: {
- match(ASSIGNEQUAL);
- break;
- }
- case TIMESEQUAL: {
- match(TIMESEQUAL);
- break;
- }
- case DIVIDEEQUAL: {
- match(DIVIDEEQUAL);
- break;
- }
- case MINUSEQUAL: {
- match(MINUSEQUAL);
- break;
- }
- case PLUSEQUAL: {
- match(PLUSEQUAL);
- break;
- }
- case MODEQUAL: {
- match(MODEQUAL);
- break;
- }
- case SHIFTLEFTEQUAL: {
- match(SHIFTLEFTEQUAL);
- break;
- }
- case SHIFTRIGHTEQUAL: {
- match(SHIFTRIGHTEQUAL);
- break;
- }
- case BITWISEANDEQUAL: {
- match(BITWISEANDEQUAL);
- break;
- }
- case BITWISEXOREQUAL: {
- match(BITWISEXOREQUAL);
- break;
- }
- case BITWISEOREQUAL: {
- match(BITWISEOREQUAL);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- remainder_expression();
- break;
- }
- case GREATERTHAN:
- case SEMICOLON:
- case RCURLY:
- case COLON:
- case RPAREN:
- case COMMA:
- case RSQUARE:
- case ELLIPSIS: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_74);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::conditional_expression() {
- try { // for error handling
- logical_or_expression();
- {
- switch (LA(1)) {
- case QUESTIONMARK: {
- match(QUESTIONMARK);
- expression();
- match(COLON);
- conditional_expression();
- break;
- }
- case GREATERTHAN:
- case SEMICOLON:
- case RCURLY:
- case ASSIGNEQUAL:
- case COLON:
- case RPAREN:
- case COMMA:
- case RSQUARE:
- case ELLIPSIS:
- case TIMESEQUAL:
- case DIVIDEEQUAL:
- case MINUSEQUAL:
- case PLUSEQUAL:
- case MODEQUAL:
- case SHIFTLEFTEQUAL:
- case SHIFTRIGHTEQUAL:
- case BITWISEANDEQUAL:
- case BITWISEXOREQUAL:
- case BITWISEOREQUAL: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_115);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::logical_or_expression() {
- try { // for error handling
- logical_and_expression();
- { // ( ... )*
- for (;;) {
- if ((LA(1) == OR)) {
- match(OR);
- logical_and_expression();
- } else {
- goto _loop458;
- }
- }
- _loop458:;
- } // ( ... )*
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_116);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::logical_and_expression() {
- try { // for error handling
- inclusive_or_expression();
- { // ( ... )*
- for (;;) {
- if ((LA(1) == AND)) {
- match(AND);
- inclusive_or_expression();
- } else {
- goto _loop461;
- }
- }
- _loop461:;
- } // ( ... )*
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_117);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::inclusive_or_expression() {
- try { // for error handling
- exclusive_or_expression();
- { // ( ... )*
- for (;;) {
- if ((LA(1) == BITWISEOR)) {
- match(BITWISEOR);
- exclusive_or_expression();
- } else {
- goto _loop464;
- }
- }
- _loop464:;
- } // ( ... )*
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_118);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::exclusive_or_expression() {
- try { // for error handling
- and_expression();
- { // ( ... )*
- for (;;) {
- if ((LA(1) == BITWISEXOR)) {
- match(BITWISEXOR);
- and_expression();
- } else {
- goto _loop467;
- }
- }
- _loop467:;
- } // ( ... )*
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_119);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::and_expression() {
- try { // for error handling
- equality_expression();
- { // ( ... )*
- for (;;) {
- if ((LA(1) == AMPERSAND)) {
- match(AMPERSAND);
- equality_expression();
- } else {
- goto _loop470;
- }
- }
- _loop470:;
- } // ( ... )*
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_120);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::equality_expression() {
- try { // for error handling
- relational_expression();
- { // ( ... )*
- for (;;) {
- if ((LA(1) == NOTEQUAL || LA(1) == EQUAL)) {
- {
- switch (LA(1)) {
- case NOTEQUAL: {
- match(NOTEQUAL);
- break;
- }
- case EQUAL: {
- match(EQUAL);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- relational_expression();
- } else {
- goto _loop474;
- }
- }
- _loop474:;
- } // ( ... )*
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_121);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::relational_expression() {
- try { // for error handling
- shift_expression();
- { // ( ... )*
- for (;;) {
- if ((_tokenSet_122.member(LA(1))) && (_tokenSet_72.member(LA(2)))) {
- {
- switch (LA(1)) {
- case LESSTHAN: {
- match(LESSTHAN);
- break;
- }
- case GREATERTHAN: {
- match(GREATERTHAN);
- break;
- }
- case LESSTHANOREQUALTO: {
- match(LESSTHANOREQUALTO);
- break;
- }
- case GREATERTHANOREQUALTO: {
- match(GREATERTHANOREQUALTO);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- shift_expression();
- } else {
- goto _loop478;
- }
- }
- _loop478:;
- } // ( ... )*
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_123);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::additive_expression() {
- try { // for error handling
- multiplicative_expression();
- { // ( ... )*
- for (;;) {
- if ((LA(1) == PLUS || LA(1) == MINUS)) {
- {
- switch (LA(1)) {
- case PLUS: {
- match(PLUS);
- break;
- }
- case MINUS: {
- match(MINUS);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- multiplicative_expression();
- } else {
- goto _loop486;
- }
- }
- _loop486:;
- } // ( ... )*
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_124);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::multiplicative_expression() {
- try { // for error handling
- pm_expression();
- { // ( ... )*
- for (;;) {
- if ((_tokenSet_125.member(LA(1)))) {
- {
- switch (LA(1)) {
- case STAR: {
- match(STAR);
- break;
- }
- case DIVIDE: {
- match(DIVIDE);
- break;
- }
- case MOD: {
- match(MOD);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- pm_expression();
- } else {
- goto _loop490;
- }
- }
- _loop490:;
- } // ( ... )*
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_126);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::pm_expression() {
- try { // for error handling
- cast_expression();
- { // ( ... )*
- for (;;) {
- if ((LA(1) == DOTMBR || LA(1) == POINTERTOMBR)) {
- {
- switch (LA(1)) {
- case DOTMBR: {
- match(DOTMBR);
- break;
- }
- case POINTERTOMBR: {
- match(POINTERTOMBR);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- cast_expression();
- } else {
- goto _loop494;
- }
- }
- _loop494:;
- } // ( ... )*
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_127);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::cast_expression() {
-#line 2021 "CPP_parser.g"
- TypeQualifier tq;
- TypeSpecifier ts;
-#line 11084 "CPPParser.cpp"
-
- try { // for error handling
- bool synPredMatched501 = false;
- if (((LA(1) == LPAREN) && (_tokenSet_128.member(LA(2))))) {
- int _m501 = mark();
- synPredMatched501 = true;
- inputState->guessing++;
- try {
- {
- match(LPAREN);
- { // ( ... )*
- for (;;) {
- if (((LA(1) >= LITERAL_const && LA(1) <= LITERAL___volatile__))) {
- type_qualifier();
- } else {
- goto _loop498;
- }
- }
- _loop498:;
- } // ( ... )*
- simple_type_specifier();
- { // ( ... )*
- for (;;) {
- if ((_tokenSet_25.member(LA(1)))) {
- ptr_operator();
- } else {
- goto _loop500;
- }
- }
- _loop500:;
- } // ( ... )*
- match(RPAREN);
- unary_expression();
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& pe) {
- synPredMatched501 = false;
- }
- rewind(_m501);
- inputState->guessing--;
- }
- if (synPredMatched501) {
- match(LPAREN);
- { // ( ... )*
- for (;;) {
- if (((LA(1) >= LITERAL_const && LA(1) <= LITERAL___volatile__))) {
- tq = type_qualifier();
- } else {
- goto _loop503;
- }
- }
- _loop503:;
- } // ( ... )*
- ts = simple_type_specifier();
- { // ( ... )*
- for (;;) {
- if ((_tokenSet_25.member(LA(1)))) {
- ptr_operator();
- } else {
- goto _loop505;
- }
- }
- _loop505:;
- } // ( ... )*
- match(RPAREN);
- unary_expression();
- } else {
- bool synPredMatched511 = false;
- if (((LA(1) == LPAREN) && (_tokenSet_128.member(LA(2))))) {
- int _m511 = mark();
- synPredMatched511 = true;
- inputState->guessing++;
- try {
- {
- match(LPAREN);
- { // ( ... )*
- for (;;) {
- if (((LA(1) >= LITERAL_const &&
- LA(1) <= LITERAL___volatile__))) {
- type_qualifier();
- } else {
- goto _loop508;
- }
- }
- _loop508:;
- } // ( ... )*
- simple_type_specifier();
- { // ( ... )*
- for (;;) {
- if ((_tokenSet_25.member(LA(1)))) {
- ptr_operator();
- } else {
- goto _loop510;
- }
- }
- _loop510:;
- } // ( ... )*
- match(RPAREN);
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& pe) {
- synPredMatched511 = false;
- }
- rewind(_m511);
- inputState->guessing--;
- }
- if (synPredMatched511) {
- match(LPAREN);
- { // ( ... )*
- for (;;) {
- if (((LA(1) >= LITERAL_const && LA(1) <= LITERAL___volatile__))) {
- tq = type_qualifier();
- } else {
- goto _loop513;
- }
- }
- _loop513:;
- } // ( ... )*
- ts = simple_type_specifier();
- { // ( ... )*
- for (;;) {
- if ((_tokenSet_25.member(LA(1)))) {
- ptr_operator();
- } else {
- goto _loop515;
- }
- }
- _loop515:;
- } // ( ... )*
- match(RPAREN);
- cast_expression();
- } else if ((_tokenSet_72.member(LA(1))) && (_tokenSet_73.member(LA(2)))) {
- unary_expression();
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_129);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::unary_expression() {
- try { // for error handling
- {
- switch (LA(1)) {
- case PLUSPLUS: {
- match(PLUSPLUS);
- unary_expression();
- break;
- }
- case MINUSMINUS: {
- match(MINUSMINUS);
- unary_expression();
- break;
- }
- case LITERAL_sizeof:
- case LITERAL___alignof__: {
- {
- switch (LA(1)) {
- case LITERAL_sizeof: {
- match(LITERAL_sizeof);
- break;
- }
- case LITERAL___alignof__: {
- match(LITERAL___alignof__);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- {
- bool synPredMatched523 = false;
- if (((_tokenSet_72.member(LA(1))) &&
- (_tokenSet_73.member(LA(2))))) {
- int _m523 = mark();
- synPredMatched523 = true;
- inputState->guessing++;
- try {
- { unary_expression(); }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& pe) {
- synPredMatched523 = false;
- }
- rewind(_m523);
- inputState->guessing--;
- }
- if (synPredMatched523) {
- unary_expression();
- } else if ((LA(1) == LPAREN) && (_tokenSet_12.member(LA(2)))) {
- match(LPAREN);
- type_id();
- match(RPAREN);
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- break;
- }
- default:
- bool synPredMatched519 = false;
- if (((_tokenSet_130.member(LA(1))) &&
- (_tokenSet_131.member(LA(2))))) {
- int _m519 = mark();
- synPredMatched519 = true;
- inputState->guessing++;
- try {
- { postfix_expression(); }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& pe) {
- synPredMatched519 = false;
- }
- rewind(_m519);
- inputState->guessing--;
- }
- if (synPredMatched519) {
- postfix_expression();
- } else if ((_tokenSet_132.member(LA(1))) &&
- (_tokenSet_72.member(LA(2)))) {
- unary_operator();
- cast_expression();
- } else if ((_tokenSet_133.member(LA(1))) &&
- (_tokenSet_134.member(LA(2)))) {
- {
- switch (LA(1)) {
- case SCOPE: {
- match(SCOPE);
- break;
- }
- case LITERAL_new:
- case LITERAL_delete: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- {
- switch (LA(1)) {
- case LITERAL_new: {
- new_expression();
- break;
- }
- case LITERAL_delete: {
- delete_expression();
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_129);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::postfix_expression() {
-#line 2063 "CPP_parser.g"
-
- TypeSpecifier ts;
-
-#line 11404 "CPPParser.cpp"
-
- try { // for error handling
- {
- switch (LA(1)) {
- case LITERAL_dynamic_cast:
- case LITERAL_static_cast:
- case LITERAL_reinterpret_cast:
- case LITERAL_const_cast: {
- {
- switch (LA(1)) {
- case LITERAL_dynamic_cast: {
- match(LITERAL_dynamic_cast);
- break;
- }
- case LITERAL_static_cast: {
- match(LITERAL_static_cast);
- break;
- }
- case LITERAL_reinterpret_cast: {
- match(LITERAL_reinterpret_cast);
- break;
- }
- case LITERAL_const_cast: {
- match(LITERAL_const_cast);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- match(LESSTHAN);
- {
- switch (LA(1)) {
- case LITERAL_const: {
- match(LITERAL_const);
- break;
- }
- case LITERAL___const: {
- match(LITERAL___const);
- break;
- }
- case ID:
- case LITERAL_typename:
- case LITERAL_char:
- case LITERAL_wchar_t:
- case LITERAL_bool:
- case LITERAL_short:
- case LITERAL_int:
- case 50:
- case 51:
- case 52:
- case 53:
- case 54:
- case 55:
- case 56:
- case 57:
- case 58:
- case 59:
- case 60:
- case 61:
- case 62:
- case 63:
- case 64:
- case 65:
- case 66:
- case 67:
- case LITERAL_long:
- case LITERAL_signed:
- case LITERAL_unsigned:
- case LITERAL_float:
- case LITERAL_double:
- case LITERAL_void:
- case LITERAL__declspec:
- case LITERAL___declspec:
- case SCOPE: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- ts = type_specifier();
- {
- switch (LA(1)) {
- case ID:
- case LITERAL__stdcall:
- case LITERAL___stdcall:
- case STAR:
- case AMPERSAND:
- case SCOPE:
- case LITERAL__cdecl:
- case LITERAL___cdecl:
- case LITERAL__near:
- case LITERAL___near:
- case LITERAL__far:
- case LITERAL___far:
- case LITERAL___interrupt:
- case LITERAL_pascal:
- case LITERAL__pascal:
- case LITERAL___pascal: {
- ptr_operator();
- break;
- }
- case GREATERTHAN: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- match(GREATERTHAN);
- match(LPAREN);
- expression();
- match(RPAREN);
- break;
- }
- case LITERAL_typeid: {
- match(LITERAL_typeid);
- match(LPAREN);
- {
- bool synPredMatched544 = false;
- if (((_tokenSet_12.member(LA(1))) &&
- (_tokenSet_135.member(LA(2))))) {
- int _m544 = mark();
- synPredMatched544 = true;
- inputState->guessing++;
- try {
- { type_id(); }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& pe) {
- synPredMatched544 = false;
- }
- rewind(_m544);
- inputState->guessing--;
- }
- if (synPredMatched544) {
- type_id();
- } else if ((_tokenSet_72.member(LA(1))) &&
- (_tokenSet_136.member(LA(2)))) {
- expression();
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- match(RPAREN);
- break;
- }
- default:
- bool synPredMatched529 = false;
- if ((((_tokenSet_103.member(LA(1))) &&
- (_tokenSet_137.member(LA(2)))) &&
- (!(LA(1) == LPAREN)))) {
- int _m529 = mark();
- synPredMatched529 = true;
- inputState->guessing++;
- try {
- {
- ts = simple_type_specifier();
- match(LPAREN);
- match(RPAREN);
- match(LPAREN);
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& pe) {
- synPredMatched529 = false;
- }
- rewind(_m529);
- inputState->guessing--;
- }
- if (synPredMatched529) {
- ts = simple_type_specifier();
- match(LPAREN);
- match(RPAREN);
- match(LPAREN);
- {
- switch (LA(1)) {
- case ID:
- case StringLiteral:
- case LPAREN:
- case LITERAL_typename:
- case LITERAL_char:
- case LITERAL_wchar_t:
- case LITERAL_bool:
- case LITERAL_short:
- case LITERAL_int:
- case 50:
- case 51:
- case 52:
- case 53:
- case 54:
- case 55:
- case 56:
- case 57:
- case 58:
- case 59:
- case 60:
- case 61:
- case 62:
- case 63:
- case 64:
- case 65:
- case 66:
- case 67:
- case LITERAL_long:
- case LITERAL_signed:
- case LITERAL_unsigned:
- case LITERAL_float:
- case LITERAL_double:
- case LITERAL_void:
- case LITERAL__declspec:
- case LITERAL___declspec:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case OCTALINT:
- case TILDE:
- case STAR:
- case AMPERSAND:
- case PLUS:
- case MINUS:
- case PLUSPLUS:
- case MINUSMINUS:
- case LITERAL_sizeof:
- case LITERAL___alignof__:
- case SCOPE:
- case LITERAL_dynamic_cast:
- case LITERAL_static_cast:
- case LITERAL_reinterpret_cast:
- case LITERAL_const_cast:
- case LITERAL_typeid:
- case DECIMALINT:
- case HEXADECIMALINT:
- case CharLiteral:
- case WCharLiteral:
- case WStringLiteral:
- case FLOATONE:
- case FLOATTWO:
- case NOT:
- case LITERAL_new:
- case LITERAL_delete: {
- expression_list();
- break;
- }
- case RPAREN: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- match(RPAREN);
- } else {
- bool synPredMatched532 = false;
- if ((((_tokenSet_103.member(LA(1))) &&
- (_tokenSet_137.member(LA(2)))) &&
- (!(LA(1) == LPAREN)))) {
- int _m532 = mark();
- synPredMatched532 = true;
- inputState->guessing++;
- try {
- {
- ts = simple_type_specifier();
- match(LPAREN);
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& pe) {
- synPredMatched532 = false;
- }
- rewind(_m532);
- inputState->guessing--;
- }
- if (synPredMatched532) {
- ts = simple_type_specifier();
- match(LPAREN);
- {
- switch (LA(1)) {
- case ID:
- case StringLiteral:
- case LPAREN:
- case LITERAL_typename:
- case LITERAL_char:
- case LITERAL_wchar_t:
- case LITERAL_bool:
- case LITERAL_short:
- case LITERAL_int:
- case 50:
- case 51:
- case 52:
- case 53:
- case 54:
- case 55:
- case 56:
- case 57:
- case 58:
- case 59:
- case 60:
- case 61:
- case 62:
- case 63:
- case 64:
- case 65:
- case 66:
- case 67:
- case LITERAL_long:
- case LITERAL_signed:
- case LITERAL_unsigned:
- case LITERAL_float:
- case LITERAL_double:
- case LITERAL_void:
- case LITERAL__declspec:
- case LITERAL___declspec:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case OCTALINT:
- case TILDE:
- case STAR:
- case AMPERSAND:
- case PLUS:
- case MINUS:
- case PLUSPLUS:
- case MINUSMINUS:
- case LITERAL_sizeof:
- case LITERAL___alignof__:
- case SCOPE:
- case LITERAL_dynamic_cast:
- case LITERAL_static_cast:
- case LITERAL_reinterpret_cast:
- case LITERAL_const_cast:
- case LITERAL_typeid:
- case DECIMALINT:
- case HEXADECIMALINT:
- case CharLiteral:
- case WCharLiteral:
- case WStringLiteral:
- case FLOATONE:
- case FLOATTWO:
- case NOT:
- case LITERAL_new:
- case LITERAL_delete: {
- expression_list();
- break;
- }
- case RPAREN: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- match(RPAREN);
- } else if ((_tokenSet_138.member(LA(1))) &&
- (_tokenSet_131.member(LA(2)))) {
- primary_expression();
- { // ( ... )*
- for (;;) {
- switch (LA(1)) {
- case LSQUARE: {
- match(LSQUARE);
- expression();
- match(RSQUARE);
- break;
- }
- case LPAREN: {
- match(LPAREN);
- {
- switch (LA(1)) {
- case ID:
- case StringLiteral:
- case LPAREN:
- case LITERAL_typename:
- case LITERAL_char:
- case LITERAL_wchar_t:
- case LITERAL_bool:
- case LITERAL_short:
- case LITERAL_int:
- case 50:
- case 51:
- case 52:
- case 53:
- case 54:
- case 55:
- case 56:
- case 57:
- case 58:
- case 59:
- case 60:
- case 61:
- case 62:
- case 63:
- case 64:
- case 65:
- case 66:
- case 67:
- case LITERAL_long:
- case LITERAL_signed:
- case LITERAL_unsigned:
- case LITERAL_float:
- case LITERAL_double:
- case LITERAL_void:
- case LITERAL__declspec:
- case LITERAL___declspec:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case OCTALINT:
- case TILDE:
- case STAR:
- case AMPERSAND:
- case PLUS:
- case MINUS:
- case PLUSPLUS:
- case MINUSMINUS:
- case LITERAL_sizeof:
- case LITERAL___alignof__:
- case SCOPE:
- case LITERAL_dynamic_cast:
- case LITERAL_static_cast:
- case LITERAL_reinterpret_cast:
- case LITERAL_const_cast:
- case LITERAL_typeid:
- case DECIMALINT:
- case HEXADECIMALINT:
- case CharLiteral:
- case WCharLiteral:
- case WStringLiteral:
- case FLOATONE:
- case FLOATTWO:
- case NOT:
- case LITERAL_new:
- case LITERAL_delete: {
- expression_list();
- break;
- }
- case RPAREN: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- match(RPAREN);
- break;
- }
- case DOT:
- case POINTERTO: {
- {
- switch (LA(1)) {
- case DOT: {
- match(DOT);
- break;
- }
- case POINTERTO: {
- match(POINTERTO);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- {
- switch (LA(1)) {
- case LITERAL_template: {
- match(LITERAL_template);
- break;
- }
- case ID:
- case OPERATOR:
- case TILDE:
- case SCOPE: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- id_expression();
- break;
- }
- case PLUSPLUS: {
- match(PLUSPLUS);
- break;
- }
- case MINUSMINUS: {
- match(MINUSMINUS);
- break;
- }
- default: { goto _loop538; }
- }
- }
- _loop538:;
- } // ( ... )*
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_129);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::unary_operator() {
- try { // for error handling
- switch (LA(1)) {
- case AMPERSAND: {
- match(AMPERSAND);
- break;
- }
- case STAR: {
- match(STAR);
- break;
- }
- case PLUS: {
- match(PLUS);
- break;
- }
- case MINUS: {
- match(MINUS);
- break;
- }
- case TILDE: {
- match(TILDE);
- break;
- }
- case NOT: {
- match(NOT);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_72);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::new_expression() {
- try { // for error handling
- {
- match(LITERAL_new);
- {
- bool synPredMatched557 = false;
- if (((LA(1) == LPAREN) && (_tokenSet_72.member(LA(2))))) {
- int _m557 = mark();
- synPredMatched557 = true;
- inputState->guessing++;
- try {
- {
- match(LPAREN);
- expression_list();
- match(RPAREN);
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& pe) {
- synPredMatched557 = false;
- }
- rewind(_m557);
- inputState->guessing--;
- }
- if (synPredMatched557) {
- match(LPAREN);
- expression_list();
- match(RPAREN);
- } else if ((_tokenSet_139.member(LA(1))) &&
- (_tokenSet_140.member(LA(2)))) {
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- {
- switch (LA(1)) {
- case LITERAL_typedef:
- case LITERAL_enum:
- case ID:
- case LITERAL_inline:
- case LITERAL_friend:
- case LITERAL_extern:
- case LITERAL_struct:
- case LITERAL_union:
- case LITERAL_class:
- case LITERAL__stdcall:
- case LITERAL___stdcall:
- case LITERAL_GFEXCLUDE:
- case LITERAL_GFINCLUDE:
- case LITERAL_GFID:
- case LITERAL_GFUNREAD:
- case LITERAL_GFARRAYSIZE:
- case LITERAL_GFARRAYSIZES:
- case LITERAL_GFARRAYELEMSIZE:
- case LITERAL_auto:
- case LITERAL_register:
- case LITERAL_static:
- case LITERAL_mutable:
- case LITERAL__inline:
- case LITERAL___inline:
- case LITERAL_virtual:
- case LITERAL_explicit:
- case LITERAL_typename:
- case LITERAL_char:
- case LITERAL_wchar_t:
- case LITERAL_bool:
- case LITERAL_short:
- case LITERAL_int:
- case 50:
- case 51:
- case 52:
- case 53:
- case 54:
- case 55:
- case 56:
- case 57:
- case 58:
- case 59:
- case 60:
- case 61:
- case 62:
- case 63:
- case 64:
- case 65:
- case 66:
- case 67:
- case LITERAL_long:
- case LITERAL_signed:
- case LITERAL_unsigned:
- case LITERAL_float:
- case LITERAL_double:
- case LITERAL_void:
- case LITERAL__declspec:
- case LITERAL___declspec:
- case LITERAL_const:
- case LITERAL___const:
- case LITERAL_volatile:
- case LITERAL___volatile__:
- case SCOPE: {
- new_type_id();
- break;
- }
- case LPAREN: {
- match(LPAREN);
- type_id();
- match(RPAREN);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- {
- switch (LA(1)) {
- case LPAREN: {
- new_initializer();
- break;
- }
- case LESSTHAN:
- case GREATERTHAN:
- case SEMICOLON:
- case RCURLY:
- case ASSIGNEQUAL:
- case COLON:
- case RPAREN:
- case COMMA:
- case RSQUARE:
- case STAR:
- case AMPERSAND:
- case ELLIPSIS:
- case TIMESEQUAL:
- case DIVIDEEQUAL:
- case MINUSEQUAL:
- case PLUSEQUAL:
- case MODEQUAL:
- case SHIFTLEFTEQUAL:
- case SHIFTRIGHTEQUAL:
- case BITWISEANDEQUAL:
- case BITWISEXOREQUAL:
- case BITWISEOREQUAL:
- case QUESTIONMARK:
- case OR:
- case AND:
- case BITWISEOR:
- case BITWISEXOR:
- case NOTEQUAL:
- case EQUAL:
- case LESSTHANOREQUALTO:
- case GREATERTHANOREQUALTO:
- case SHIFTLEFT:
- case SHIFTRIGHT:
- case PLUS:
- case MINUS:
- case DIVIDE:
- case MOD:
- case DOTMBR:
- case POINTERTOMBR: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_129);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::delete_expression() {
- try { // for error handling
- match(LITERAL_delete);
- {
- switch (LA(1)) {
- case LSQUARE: {
- match(LSQUARE);
- match(RSQUARE);
- break;
- }
- case ID:
- case StringLiteral:
- case LPAREN:
- case LITERAL_typename:
- case LITERAL_char:
- case LITERAL_wchar_t:
- case LITERAL_bool:
- case LITERAL_short:
- case LITERAL_int:
- case 50:
- case 51:
- case 52:
- case 53:
- case 54:
- case 55:
- case 56:
- case 57:
- case 58:
- case 59:
- case 60:
- case 61:
- case 62:
- case 63:
- case 64:
- case 65:
- case 66:
- case 67:
- case LITERAL_long:
- case LITERAL_signed:
- case LITERAL_unsigned:
- case LITERAL_float:
- case LITERAL_double:
- case LITERAL_void:
- case LITERAL__declspec:
- case LITERAL___declspec:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case OCTALINT:
- case TILDE:
- case STAR:
- case AMPERSAND:
- case PLUS:
- case MINUS:
- case PLUSPLUS:
- case MINUSMINUS:
- case LITERAL_sizeof:
- case LITERAL___alignof__:
- case SCOPE:
- case LITERAL_dynamic_cast:
- case LITERAL_static_cast:
- case LITERAL_reinterpret_cast:
- case LITERAL_const_cast:
- case LITERAL_typeid:
- case DECIMALINT:
- case HEXADECIMALINT:
- case CharLiteral:
- case WCharLiteral:
- case WStringLiteral:
- case FLOATONE:
- case FLOATTWO:
- case NOT:
- case LITERAL_new:
- case LITERAL_delete: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- cast_expression();
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_129);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::primary_expression() {
- try { // for error handling
- switch (LA(1)) {
- case ID:
- case OPERATOR:
- case TILDE:
- case SCOPE: {
- id_expression();
- break;
- }
- case StringLiteral:
- case LITERAL_true:
- case LITERAL_false:
- case OCTALINT:
- case DECIMALINT:
- case HEXADECIMALINT:
- case CharLiteral:
- case WCharLiteral:
- case WStringLiteral:
- case FLOATONE:
- case FLOATTWO: {
- constant();
- break;
- }
- case LITERAL_this: {
- match(LITERAL_this);
- break;
- }
- case LPAREN: {
- match(LPAREN);
- expression();
- match(RPAREN);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_141);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::id_expression() {
-#line 2105 "CPP_parser.g"
- char* s;
-#line 12353 "CPPParser.cpp"
-
- try { // for error handling
- s = scope_override();
- {
- switch (LA(1)) {
- case ID: {
- match(ID);
- break;
- }
- case OPERATOR: {
- match(OPERATOR);
- optor();
- break;
- }
- case TILDE: {
- match(TILDE);
- {
- switch (LA(1)) {
- case STAR: {
- match(STAR);
- break;
- }
- case ID: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- match(ID);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_141);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::constant() {
- try { // for error handling
- switch (LA(1)) {
- case OCTALINT: {
- match(OCTALINT);
- break;
- }
- case DECIMALINT: {
- match(DECIMALINT);
- break;
- }
- case HEXADECIMALINT: {
- match(HEXADECIMALINT);
- break;
- }
- case CharLiteral: {
- match(CharLiteral);
- break;
- }
- case WCharLiteral: {
- match(WCharLiteral);
- break;
- }
- case StringLiteral:
- case WStringLiteral: {
- { // ( ... )+
- int _cnt551 = 0;
- for (;;) {
- switch (LA(1)) {
- case StringLiteral: {
- match(StringLiteral);
- break;
- }
- case WStringLiteral: {
- match(WStringLiteral);
- break;
- }
- default: {
- if (_cnt551 >= 1) {
- goto _loop551;
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- _cnt551++;
- }
- _loop551:;
- } // ( ... )+
- break;
- }
- case FLOATONE: {
- match(FLOATONE);
- break;
- }
- case FLOATTWO: {
- match(FLOATTWO);
- break;
- }
- case LITERAL_true: {
- match(LITERAL_true);
- break;
- }
- case LITERAL_false: {
- match(LITERAL_false);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_141);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::new_type_id() {
- try { // for error handling
- declaration_specifiers();
- {
- if ((_tokenSet_142.member(LA(1))) && (_tokenSet_143.member(LA(2)))) {
- new_declarator();
- } else if ((_tokenSet_144.member(LA(1))) &&
- (_tokenSet_57.member(LA(2)))) {
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_144);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::new_initializer() {
- try { // for error handling
- match(LPAREN);
- {
- switch (LA(1)) {
- case ID:
- case StringLiteral:
- case LPAREN:
- case LITERAL_typename:
- case LITERAL_char:
- case LITERAL_wchar_t:
- case LITERAL_bool:
- case LITERAL_short:
- case LITERAL_int:
- case 50:
- case 51:
- case 52:
- case 53:
- case 54:
- case 55:
- case 56:
- case 57:
- case 58:
- case 59:
- case 60:
- case 61:
- case 62:
- case 63:
- case 64:
- case 65:
- case 66:
- case 67:
- case LITERAL_long:
- case LITERAL_signed:
- case LITERAL_unsigned:
- case LITERAL_float:
- case LITERAL_double:
- case LITERAL_void:
- case LITERAL__declspec:
- case LITERAL___declspec:
- case OPERATOR:
- case LITERAL_this:
- case LITERAL_true:
- case LITERAL_false:
- case OCTALINT:
- case TILDE:
- case STAR:
- case AMPERSAND:
- case PLUS:
- case MINUS:
- case PLUSPLUS:
- case MINUSMINUS:
- case LITERAL_sizeof:
- case LITERAL___alignof__:
- case SCOPE:
- case LITERAL_dynamic_cast:
- case LITERAL_static_cast:
- case LITERAL_reinterpret_cast:
- case LITERAL_const_cast:
- case LITERAL_typeid:
- case DECIMALINT:
- case HEXADECIMALINT:
- case CharLiteral:
- case WCharLiteral:
- case WStringLiteral:
- case FLOATONE:
- case FLOATTWO:
- case NOT:
- case LITERAL_new:
- case LITERAL_delete: {
- expression_list();
- break;
- }
- case RPAREN: {
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- match(RPAREN);
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_129);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::new_declarator() {
- try { // for error handling
- switch (LA(1)) {
- case ID:
- case LITERAL__stdcall:
- case LITERAL___stdcall:
- case STAR:
- case AMPERSAND:
- case SCOPE:
- case LITERAL__cdecl:
- case LITERAL___cdecl:
- case LITERAL__near:
- case LITERAL___near:
- case LITERAL__far:
- case LITERAL___far:
- case LITERAL___interrupt:
- case LITERAL_pascal:
- case LITERAL__pascal:
- case LITERAL___pascal: {
- ptr_operator();
- {
- if ((_tokenSet_142.member(LA(1))) && (_tokenSet_143.member(LA(2)))) {
- new_declarator();
- } else if ((_tokenSet_144.member(LA(1))) &&
- (_tokenSet_57.member(LA(2)))) {
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- break;
- }
- case LSQUARE: {
- direct_new_declarator();
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_144);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::direct_new_declarator() {
- try { // for error handling
- { // ( ... )+
- int _cnt570 = 0;
- for (;;) {
- if ((LA(1) == LSQUARE)) {
- match(LSQUARE);
- expression();
- match(RSQUARE);
- } else {
- if (_cnt570 >= 1) {
- goto _loop570;
- } else {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
-
- _cnt570++;
- }
- _loop570:;
- } // ( ... )+
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_144);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::ptr_to_member() {
-#line 2211 "CPP_parser.g"
- char* s;
-#line 12715 "CPPParser.cpp"
-
- try { // for error handling
- s = scope_override();
- match(STAR);
- if (inputState->guessing == 0) {
-#line 2214 "CPP_parser.g"
- is_pointer = true;
-#line 12723 "CPPParser.cpp"
- }
- cv_qualifier_seq();
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_24);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::optor_simple_tokclass() {
- try { // for error handling
- {
- switch (LA(1)) {
- case PLUS: {
- match(PLUS);
- break;
- }
- case MINUS: {
- match(MINUS);
- break;
- }
- case STAR: {
- match(STAR);
- break;
- }
- case DIVIDE: {
- match(DIVIDE);
- break;
- }
- case MOD: {
- match(MOD);
- break;
- }
- case BITWISEXOR: {
- match(BITWISEXOR);
- break;
- }
- case AMPERSAND: {
- match(AMPERSAND);
- break;
- }
- case BITWISEOR: {
- match(BITWISEOR);
- break;
- }
- case TILDE: {
- match(TILDE);
- break;
- }
- case NOT: {
- match(NOT);
- break;
- }
- case SHIFTLEFT: {
- match(SHIFTLEFT);
- break;
- }
- case SHIFTRIGHT: {
- match(SHIFTRIGHT);
- break;
- }
- case ASSIGNEQUAL: {
- match(ASSIGNEQUAL);
- break;
- }
- case TIMESEQUAL: {
- match(TIMESEQUAL);
- break;
- }
- case DIVIDEEQUAL: {
- match(DIVIDEEQUAL);
- break;
- }
- case MODEQUAL: {
- match(MODEQUAL);
- break;
- }
- case PLUSEQUAL: {
- match(PLUSEQUAL);
- break;
- }
- case MINUSEQUAL: {
- match(MINUSEQUAL);
- break;
- }
- case SHIFTLEFTEQUAL: {
- match(SHIFTLEFTEQUAL);
- break;
- }
- case SHIFTRIGHTEQUAL: {
- match(SHIFTRIGHTEQUAL);
- break;
- }
- case BITWISEANDEQUAL: {
- match(BITWISEANDEQUAL);
- break;
- }
- case BITWISEXOREQUAL: {
- match(BITWISEXOREQUAL);
- break;
- }
- case BITWISEOREQUAL: {
- match(BITWISEOREQUAL);
- break;
- }
- case EQUAL: {
- match(EQUAL);
- break;
- }
- case NOTEQUAL: {
- match(NOTEQUAL);
- break;
- }
- case LESSTHAN: {
- match(LESSTHAN);
- break;
- }
- case GREATERTHAN: {
- match(GREATERTHAN);
- break;
- }
- case LESSTHANOREQUALTO: {
- match(LESSTHANOREQUALTO);
- break;
- }
- case GREATERTHANOREQUALTO: {
- match(GREATERTHANOREQUALTO);
- break;
- }
- case OR: {
- match(OR);
- break;
- }
- case AND: {
- match(AND);
- break;
- }
- case PLUSPLUS: {
- match(PLUSPLUS);
- break;
- }
- case MINUSMINUS: {
- match(MINUSMINUS);
- break;
- }
- case COMMA: {
- match(COMMA);
- break;
- }
- case POINTERTO: {
- match(POINTERTO);
- break;
- }
- case POINTERTOMBR: {
- match(POINTERTOMBR);
- break;
- }
- default: {
- throw ANTLR_USE_NAMESPACE(antlr)
- NoViableAltException(LT(1), getFilename());
- }
- }
- }
- } catch (ANTLR_USE_NAMESPACE(antlr) RecognitionException& ex) {
- if (inputState->guessing == 0) {
- reportError(ex);
- recover(ex, _tokenSet_64);
- } else {
- throw;
- }
- }
-}
-
-void CPPParser::initializeASTFactory(ANTLR_USE_NAMESPACE(antlr) ASTFactory&) {}
-const char* CPPParser::tokenNames[] = {"<0>",
- "EOF",
- "<2>",
- "NULL_TREE_LOOKAHEAD",
- "\"template\"",
- "LESSTHAN",
- "GREATERTHAN",
- "\"typedef\"",
- "SEMICOLON",
- "\"enum\"",
- "ID",
- "LCURLY",
- "\"inline\"",
- "\"friend\"",
- "\"namespace\"",
- "\"antlrTrace_on\"",
- "\"antlrTrace_off\"",
- "RCURLY",
- "ASSIGNEQUAL",
- "COLON",
- "\"extern\"",
- "StringLiteral",
- "\"struct\"",
- "\"union\"",
- "\"class\"",
- "\"_stdcall\"",
- "\"__stdcall\"",
- "\"GFEXCLUDE\"",
- "\"GFINCLUDE\"",
- "\"GFID\"",
- "\"GFUNREAD\"",
- "\"GFARRAYSIZE\"",
- "LPAREN",
- "RPAREN",
- "\"GFARRAYSIZES\"",
- "\"GFARRAYELEMSIZE\"",
- "\"auto\"",
- "\"register\"",
- "\"static\"",
- "\"mutable\"",
- "\"_inline\"",
- "\"__inline\"",
- "\"virtual\"",
- "\"explicit\"",
- "\"typename\"",
- "\"char\"",
- "\"wchar_t\"",
- "\"bool\"",
- "\"short\"",
- "\"int\"",
- "\"_int8\"",
- "\"__int8\"",
- "\"int8_t\"",
- "\"_int16\"",
- "\"__int16\"",
- "\"int16_t\"",
- "\"_int32\"",
- "\"__int32\"",
- "\"int32_t\"",
- "\"_int64\"",
- "\"__int64\"",
- "\"int64_t\"",
- "\"uint8_t\"",
- "\"uint16_t\"",
- "\"uint32_t\"",
- "\"uint64_t\"",
- "\"_w64\"",
- "\"__w64\"",
- "\"long\"",
- "\"signed\"",
- "\"unsigned\"",
- "\"float\"",
- "\"double\"",
- "\"void\"",
- "\"_declspec\"",
- "\"__declspec\"",
- "\"const\"",
- "\"__const\"",
- "\"volatile\"",
- "\"__volatile__\"",
- "\"GFIGNORE\"",
- "COMMA",
- "\"public\"",
- "\"protected\"",
- "\"private\"",
- "\"operator\"",
- "\"this\"",
- "\"true\"",
- "\"false\"",
- "OCTALINT",
- "LSQUARE",
- "RSQUARE",
- "TILDE",
- "STAR",
- "AMPERSAND",
- "ELLIPSIS",
- "\"throw\"",
- "\"using\"",
- "\"case\"",
- "\"default\"",
- "\"if\"",
- "\"else\"",
- "\"switch\"",
- "\"while\"",
- "\"do\"",
- "\"for\"",
- "\"goto\"",
- "\"continue\"",
- "\"break\"",
- "\"return\"",
- "\"try\"",
- "\"catch\"",
- "\"asm\"",
- "\"_asm\"",
- "\"__asm\"",
- "\"__asm__\"",
- "TIMESEQUAL",
- "DIVIDEEQUAL",
- "MINUSEQUAL",
- "PLUSEQUAL",
- "MODEQUAL",
- "SHIFTLEFTEQUAL",
- "SHIFTRIGHTEQUAL",
- "BITWISEANDEQUAL",
- "BITWISEXOREQUAL",
- "BITWISEOREQUAL",
- "QUESTIONMARK",
- "OR",
- "AND",
- "BITWISEOR",
- "BITWISEXOR",
- "NOTEQUAL",
- "EQUAL",
- "LESSTHANOREQUALTO",
- "GREATERTHANOREQUALTO",
- "SHIFTLEFT",
- "SHIFTRIGHT",
- "PLUS",
- "MINUS",
- "DIVIDE",
- "MOD",
- "DOTMBR",
- "POINTERTOMBR",
- "PLUSPLUS",
- "MINUSMINUS",
- "\"sizeof\"",
- "\"__alignof__\"",
- "SCOPE",
- "DOT",
- "POINTERTO",
- "\"dynamic_cast\"",
- "\"static_cast\"",
- "\"reinterpret_cast\"",
- "\"const_cast\"",
- "\"typeid\"",
- "DECIMALINT",
- "HEXADECIMALINT",
- "CharLiteral",
- "WCharLiteral",
- "WStringLiteral",
- "FLOATONE",
- "FLOATTWO",
- "NOT",
- "\"new\"",
- "\"_cdecl\"",
- "\"__cdecl\"",
- "\"_near\"",
- "\"__near\"",
- "\"_far\"",
- "\"__far\"",
- "\"__interrupt\"",
- "\"pascal\"",
- "\"_pascal\"",
- "\"__pascal\"",
- "\"delete\"",
- "Whitespace",
- "Comment",
- "CPPComment",
- "a preprocessor directive",
- "LineDirective",
- "Space",
- "Pragma",
- "Error",
- "EndOfLine",
- "Escape",
- "Digit",
- "Decimal",
- "LongSuffix",
- "UnsignedSuffix",
- "FloatSuffix",
- "Exponent",
- "Vocabulary",
- "Number",
- 0};
-
-const unsigned long CPPParser::_tokenSet_0_data_[] = {
- 4291950480UL, 4294967293UL, 1910571007UL, 2UL, 524288UL, 16368UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// "template" "typedef" SEMICOLON "enum" ID "inline" "friend" "namespace"
-// "antlrTrace_on" "antlrTrace_off" "extern" "struct" "union" "class" "_stdcall"
-// "__stdcall" "GFEXCLUDE" "GFINCLUDE" "GFID" "GFUNREAD" "GFARRAYSIZE"
-// LPAREN "GFARRAYSIZES" "GFARRAYELEMSIZE" "auto" "register" "static" "mutable"
-// "_inline" "__inline" "virtual" "explicit" "typename" "char" "wchar_t"
-// "bool" "short" "int" "_int8" "__int8" "int8_t" "_int16" "__int16" "int16_t"
-// "_int32" "__int32" "int32_t" "_int64" "__int64" "int64_t" "uint8_t"
-// "uint16_t" "uint32_t" "uint64_t" "_w64" "__w64" "long" "signed" "unsigned"
-// "float" "double" "void" "_declspec" "__declspec" "const" "__const" "volatile"
-// "__volatile__" "operator" "this" "true" "false" TILDE STAR AMPERSAND
-// "using" SCOPE "_cdecl" "__cdecl" "_near" "__near" "_far" "__far"
-// "__interrupt"
-// "pascal" "_pascal" "__pascal"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_0(
- _tokenSet_0_data_, 12);
-const unsigned long CPPParser::_tokenSet_1_data_[] = {2UL, 0UL, 0UL, 0UL,
- 0UL, 0UL, 0UL, 0UL};
-// EOF
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_1(
- _tokenSet_1_data_, 8);
-const unsigned long CPPParser::_tokenSet_2_data_[] = {
- 4291835520UL, 4294967292UL, 65535UL, 2UL, 524288UL, 0UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// "typedef" "enum" ID "inline" "friend" "extern" "struct" "union" "class"
-// "_stdcall" "__stdcall" "GFEXCLUDE" "GFINCLUDE" "GFID" "GFUNREAD"
-// "GFARRAYSIZE"
-// "GFARRAYSIZES" "GFARRAYELEMSIZE" "auto" "register" "static" "mutable"
-// "_inline" "__inline" "virtual" "explicit" "typename" "char" "wchar_t"
-// "bool" "short" "int" "_int8" "__int8" "int8_t" "_int16" "__int16" "int16_t"
-// "_int32" "__int32" "int32_t" "_int64" "__int64" "int64_t" "uint8_t"
-// "uint16_t" "uint32_t" "uint64_t" "_w64" "__w64" "long" "signed" "unsigned"
-// "float" "double" "void" "_declspec" "__declspec" "const" "__const" "volatile"
-// "__volatile__" "using" SCOPE
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_2(
- _tokenSet_2_data_, 12);
-const unsigned long CPPParser::_tokenSet_3_data_[] = {
- 4293949344UL, 4294967293UL, 1910571007UL, 0UL, 524288UL, 16368UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// LESSTHAN "typedef" SEMICOLON "enum" ID "inline" "friend" "namespace"
-// "extern" StringLiteral "struct" "union" "class" "_stdcall" "__stdcall"
-// "GFEXCLUDE" "GFINCLUDE" "GFID" "GFUNREAD" "GFARRAYSIZE" LPAREN "GFARRAYSIZES"
-// "GFARRAYELEMSIZE" "auto" "register" "static" "mutable" "_inline" "__inline"
-// "virtual" "explicit" "typename" "char" "wchar_t" "bool" "short" "int"
-// "_int8" "__int8" "int8_t" "_int16" "__int16" "int16_t" "_int32" "__int32"
-// "int32_t" "_int64" "__int64" "int64_t" "uint8_t" "uint16_t" "uint32_t"
-// "uint64_t" "_w64" "__w64" "long" "signed" "unsigned" "float" "double"
-// "void" "_declspec" "__declspec" "const" "__const" "volatile" "__volatile__"
-// "operator" "this" "true" "false" TILDE STAR AMPERSAND SCOPE "_cdecl"
-// "__cdecl" "_near" "__near" "_far" "__far" "__interrupt" "pascal" "_pascal"
-// "__pascal"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_3(
- _tokenSet_3_data_, 12);
-const unsigned long CPPParser::_tokenSet_4_data_[] = {4096UL, 3840UL, 0UL, 0UL,
- 0UL, 0UL, 0UL, 0UL};
-// "inline" "_inline" "__inline" "virtual" "explicit"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_4(
- _tokenSet_4_data_, 8);
-const unsigned long CPPParser::_tokenSet_5_data_[] = {
- 3072UL, 0UL, 31457280UL, 0UL, 524288UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// ID LCURLY "operator" "this" "true" "false" SCOPE
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_5(
- _tokenSet_5_data_, 12);
-const unsigned long CPPParser::_tokenSet_6_data_[] = {
- 5136UL, 1792UL, 268435456UL, 0UL, 524288UL, 0UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// "template" ID "inline" "_inline" "__inline" "virtual" TILDE SCOPE
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_6(
- _tokenSet_6_data_, 12);
-const unsigned long CPPParser::_tokenSet_7_data_[] = {
- 5152UL, 1792UL, 268435456UL, 0UL, 524288UL, 0UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// LESSTHAN ID "inline" "_inline" "__inline" "virtual" TILDE SCOPE
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_7(
- _tokenSet_7_data_, 12);
-const unsigned long CPPParser::_tokenSet_8_data_[] = {
- 5120UL, 2816UL, 0UL, 0UL, 524288UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// ID "inline" "_inline" "__inline" "explicit" SCOPE
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_8(
- _tokenSet_8_data_, 12);
-const unsigned long CPPParser::_tokenSet_9_data_[] = {
- 5152UL, 2817UL, 0UL, 0UL, 524288UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// LESSTHAN ID "inline" LPAREN "_inline" "__inline" "explicit" SCOPE
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_9(
- _tokenSet_9_data_, 12);
-const unsigned long CPPParser::_tokenSet_10_data_[] = {
- 5120UL, 0UL, 2097152UL, 0UL, 524288UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// ID "inline" "operator" SCOPE
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_10(
- _tokenSet_10_data_, 12);
-const unsigned long CPPParser::_tokenSet_11_data_[] = {
- 4291835552UL, 4294967292UL, 2162687UL, 0UL, 524288UL, 0UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// LESSTHAN "typedef" "enum" ID "inline" "friend" "extern" "struct" "union"
-// "class" "_stdcall" "__stdcall" "GFEXCLUDE" "GFINCLUDE" "GFID" "GFUNREAD"
-// "GFARRAYSIZE" "GFARRAYSIZES" "GFARRAYELEMSIZE" "auto" "register" "static"
-// "mutable" "_inline" "__inline" "virtual" "explicit" "typename" "char"
-// "wchar_t" "bool" "short" "int" "_int8" "__int8" "int8_t" "_int16" "__int16"
-// "int16_t" "_int32" "__int32" "int32_t" "_int64" "__int64" "int64_t"
-// "uint8_t" "uint16_t" "uint32_t" "uint64_t" "_w64" "__w64" "long" "signed"
-// "unsigned" "float" "double" "void" "_declspec" "__declspec" "const"
-// "__const" "volatile" "__volatile__" "operator" SCOPE
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_11(
- _tokenSet_11_data_, 12);
-const unsigned long CPPParser::_tokenSet_12_data_[] = {
- 4291835520UL, 4294967292UL, 65535UL, 0UL, 524288UL, 0UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// "typedef" "enum" ID "inline" "friend" "extern" "struct" "union" "class"
-// "_stdcall" "__stdcall" "GFEXCLUDE" "GFINCLUDE" "GFID" "GFUNREAD"
-// "GFARRAYSIZE"
-// "GFARRAYSIZES" "GFARRAYELEMSIZE" "auto" "register" "static" "mutable"
-// "_inline" "__inline" "virtual" "explicit" "typename" "char" "wchar_t"
-// "bool" "short" "int" "_int8" "__int8" "int8_t" "_int16" "__int16" "int16_t"
-// "_int32" "__int32" "int32_t" "_int64" "__int64" "int64_t" "uint8_t"
-// "uint16_t" "uint32_t" "uint64_t" "_w64" "__w64" "long" "signed" "unsigned"
-// "float" "double" "void" "_declspec" "__declspec" "const" "__const" "volatile"
-// "__volatile__" SCOPE
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_12(
- _tokenSet_12_data_, 12);
-const unsigned long CPPParser::_tokenSet_13_data_[] = {
- 4291835552UL, 4294967293UL, 1642135551UL, 0UL, 524288UL, 16368UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// LESSTHAN "typedef" "enum" ID "inline" "friend" "extern" "struct" "union"
-// "class" "_stdcall" "__stdcall" "GFEXCLUDE" "GFINCLUDE" "GFID" "GFUNREAD"
-// "GFARRAYSIZE" LPAREN "GFARRAYSIZES" "GFARRAYELEMSIZE" "auto" "register"
-// "static" "mutable" "_inline" "__inline" "virtual" "explicit" "typename"
-// "char" "wchar_t" "bool" "short" "int" "_int8" "__int8" "int8_t" "_int16"
-// "__int16" "int16_t" "_int32" "__int32" "int32_t" "_int64" "__int64"
-// "int64_t" "uint8_t" "uint16_t" "uint32_t" "uint64_t" "_w64" "__w64"
-// "long" "signed" "unsigned" "float" "double" "void" "_declspec" "__declspec"
-// "const" "__const" "volatile" "__volatile__" "operator" "this" "true"
-// "false" STAR AMPERSAND SCOPE "_cdecl" "__cdecl" "_near" "__near" "_far"
-// "__far" "__interrupt" "pascal" "_pascal" "__pascal"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_13(
- _tokenSet_13_data_, 12);
-const unsigned long CPPParser::_tokenSet_14_data_[] = {
- 4291835520UL, 4294967293UL, 1642135551UL, 0UL, 524288UL, 16368UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// "typedef" "enum" ID "inline" "friend" "extern" "struct" "union" "class"
-// "_stdcall" "__stdcall" "GFEXCLUDE" "GFINCLUDE" "GFID" "GFUNREAD"
-// "GFARRAYSIZE"
-// LPAREN "GFARRAYSIZES" "GFARRAYELEMSIZE" "auto" "register" "static" "mutable"
-// "_inline" "__inline" "virtual" "explicit" "typename" "char" "wchar_t"
-// "bool" "short" "int" "_int8" "__int8" "int8_t" "_int16" "__int16" "int16_t"
-// "_int32" "__int32" "int32_t" "_int64" "__int64" "int64_t" "uint8_t"
-// "uint16_t" "uint32_t" "uint64_t" "_w64" "__w64" "long" "signed" "unsigned"
-// "float" "double" "void" "_declspec" "__declspec" "const" "__const" "volatile"
-// "__volatile__" "operator" "this" "true" "false" STAR AMPERSAND SCOPE
-// "_cdecl" "__cdecl" "_near" "__near" "_far" "__far" "__interrupt" "pascal"
-// "_pascal" "__pascal"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_14(
- _tokenSet_14_data_, 12);
-const unsigned long CPPParser::_tokenSet_15_data_[] = {
- 4292097760UL, 4294967293UL, 1977810943UL, 3220176896UL, 2744319UL, 32764UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// LESSTHAN GREATERTHAN "typedef" "enum" ID "inline" "friend" ASSIGNEQUAL
-// "extern" "struct" "union" "class" "_stdcall" "__stdcall" "GFEXCLUDE"
-// "GFINCLUDE" "GFID" "GFUNREAD" "GFARRAYSIZE" LPAREN "GFARRAYSIZES"
-// "GFARRAYELEMSIZE"
-// "auto" "register" "static" "mutable" "_inline" "__inline" "virtual"
-// "explicit" "typename" "char" "wchar_t" "bool" "short" "int" "_int8"
-// "__int8" "int8_t" "_int16" "__int16" "int16_t" "_int32" "__int32" "int32_t"
-// "_int64" "__int64" "int64_t" "uint8_t" "uint16_t" "uint32_t" "uint64_t"
-// "_w64" "__w64" "long" "signed" "unsigned" "float" "double" "void" "_declspec"
-// "__declspec" "const" "__const" "volatile" "__volatile__" COMMA "operator"
-// "this" "true" "false" LSQUARE TILDE STAR AMPERSAND TIMESEQUAL DIVIDEEQUAL
-// MINUSEQUAL PLUSEQUAL MODEQUAL SHIFTLEFTEQUAL SHIFTRIGHTEQUAL BITWISEANDEQUAL
-// BITWISEXOREQUAL BITWISEOREQUAL OR AND BITWISEOR BITWISEXOR NOTEQUAL
-// EQUAL LESSTHANOREQUALTO GREATERTHANOREQUALTO SHIFTLEFT SHIFTRIGHT PLUS
-// MINUS DIVIDE MOD POINTERTOMBR PLUSPLUS MINUSMINUS SCOPE POINTERTO NOT
-// "new" "_cdecl" "__cdecl" "_near" "__near" "_far" "__far" "__interrupt"
-// "pascal" "_pascal" "__pascal" "delete"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_15(
- _tokenSet_15_data_, 12);
-const unsigned long CPPParser::_tokenSet_16_data_[] = {
- 29372416UL, 3840UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// "inline" "friend" "struct" "union" "class" "_inline" "__inline" "virtual"
-// "explicit"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_16(
- _tokenSet_16_data_, 8);
-const unsigned long CPPParser::_tokenSet_17_data_[] = {
- 29367296UL, 3840UL, 31525888UL, 0UL, 524288UL, 0UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// ID LCURLY "inline" "struct" "union" "class" "_inline" "__inline" "virtual"
-// "explicit" "_declspec" "__declspec" "GFIGNORE" "operator" "this" "true"
-// "false" SCOPE
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_17(
- _tokenSet_17_data_, 12);
-const unsigned long CPPParser::_tokenSet_18_data_[] = {
- 4291835808UL, 4294967293UL, 1910571007UL, 0UL, 524288UL, 16368UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// LESSTHAN "typedef" SEMICOLON "enum" ID "inline" "friend" "extern" "struct"
-// "union" "class" "_stdcall" "__stdcall" "GFEXCLUDE" "GFINCLUDE" "GFID"
-// "GFUNREAD" "GFARRAYSIZE" LPAREN "GFARRAYSIZES" "GFARRAYELEMSIZE" "auto"
-// "register" "static" "mutable" "_inline" "__inline" "virtual" "explicit"
-// "typename" "char" "wchar_t" "bool" "short" "int" "_int8" "__int8" "int8_t"
-// "_int16" "__int16" "int16_t" "_int32" "__int32" "int32_t" "_int64" "__int64"
-// "int64_t" "uint8_t" "uint16_t" "uint32_t" "uint64_t" "_w64" "__w64"
-// "long" "signed" "unsigned" "float" "double" "void" "_declspec" "__declspec"
-// "const" "__const" "volatile" "__volatile__" "operator" "this" "true"
-// "false" TILDE STAR AMPERSAND SCOPE "_cdecl" "__cdecl" "_near" "__near"
-// "_far" "__far" "__interrupt" "pascal" "_pascal" "__pascal"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_18(
- _tokenSet_18_data_, 12);
-const unsigned long CPPParser::_tokenSet_19_data_[] = {
- 4292081554UL, 4294967293UL, 1910571007UL, 2UL, 524288UL, 16368UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// EOF "template" "typedef" SEMICOLON "enum" ID "inline" "friend" "namespace"
-// "antlrTrace_on" "antlrTrace_off" RCURLY "extern" "struct" "union" "class"
-// "_stdcall" "__stdcall" "GFEXCLUDE" "GFINCLUDE" "GFID" "GFUNREAD"
-// "GFARRAYSIZE"
-// LPAREN "GFARRAYSIZES" "GFARRAYELEMSIZE" "auto" "register" "static" "mutable"
-// "_inline" "__inline" "virtual" "explicit" "typename" "char" "wchar_t"
-// "bool" "short" "int" "_int8" "__int8" "int8_t" "_int16" "__int16" "int16_t"
-// "_int32" "__int32" "int32_t" "_int64" "__int64" "int64_t" "uint8_t"
-// "uint16_t" "uint32_t" "uint64_t" "_w64" "__w64" "long" "signed" "unsigned"
-// "float" "double" "void" "_declspec" "__declspec" "const" "__const" "volatile"
-// "__volatile__" "operator" "this" "true" "false" TILDE STAR AMPERSAND
-// "using" SCOPE "_cdecl" "__cdecl" "_near" "__near" "_far" "__far"
-// "__interrupt"
-// "pascal" "_pascal" "__pascal"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_19(
- _tokenSet_19_data_, 12);
-const unsigned long CPPParser::_tokenSet_20_data_[] = {
- 4291934096UL, 4294967293UL, 1912406015UL, 2UL, 524288UL, 16368UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// "template" "typedef" SEMICOLON "enum" ID "inline" "friend" "antlrTrace_on"
-// "antlrTrace_off" "extern" "struct" "union" "class" "_stdcall" "__stdcall"
-// "GFEXCLUDE" "GFINCLUDE" "GFID" "GFUNREAD" "GFARRAYSIZE" LPAREN "GFARRAYSIZES"
-// "GFARRAYELEMSIZE" "auto" "register" "static" "mutable" "_inline" "__inline"
-// "virtual" "explicit" "typename" "char" "wchar_t" "bool" "short" "int"
-// "_int8" "__int8" "int8_t" "_int16" "__int16" "int16_t" "_int32" "__int32"
-// "int32_t" "_int64" "__int64" "int64_t" "uint8_t" "uint16_t" "uint32_t"
-// "uint64_t" "_w64" "__w64" "long" "signed" "unsigned" "float" "double"
-// "void" "_declspec" "__declspec" "const" "__const" "volatile" "__volatile__"
-// "public" "protected" "private" "operator" "this" "true" "false" TILDE
-// STAR AMPERSAND "using" SCOPE "_cdecl" "__cdecl" "_near" "__near" "_far"
-// "__far" "__interrupt" "pascal" "_pascal" "__pascal"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_20(
- _tokenSet_20_data_, 12);
-const unsigned long CPPParser::_tokenSet_21_data_[] = {
- 100664576UL, 1UL, 1910505472UL, 0UL, 524288UL, 16368UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// SEMICOLON ID "_stdcall" "__stdcall" LPAREN "operator" "this" "true"
-// "false" TILDE STAR AMPERSAND SCOPE "_cdecl" "__cdecl" "_near" "__near"
-// "_far" "__far" "__interrupt" "pascal" "_pascal" "__pascal"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_21(
- _tokenSet_21_data_, 12);
-const unsigned long CPPParser::_tokenSet_22_data_[] = {256UL, 0UL, 0UL, 0UL,
- 0UL, 0UL, 0UL, 0UL};
-// SEMICOLON
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_22(
- _tokenSet_22_data_, 8);
-const unsigned long CPPParser::_tokenSet_23_data_[] = {
- 101188864UL, 1UL, 1910505472UL, 0UL, 524288UL, 16368UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// SEMICOLON ID COLON "_stdcall" "__stdcall" LPAREN "operator" "this" "true"
-// "false" TILDE STAR AMPERSAND SCOPE "_cdecl" "__cdecl" "_near" "__near"
-// "_far" "__far" "__interrupt" "pascal" "_pascal" "__pascal"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_23(
- _tokenSet_23_data_, 12);
-const unsigned long CPPParser::_tokenSet_24_data_[] = {
- 101582176UL, 3UL, 4259446784UL, 4293918720UL, 557055UL, 16368UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// LESSTHAN GREATERTHAN SEMICOLON ID RCURLY ASSIGNEQUAL COLON "_stdcall"
-// "__stdcall" LPAREN RPAREN COMMA "operator" "this" "true" "false" LSQUARE
-// RSQUARE TILDE STAR AMPERSAND ELLIPSIS TIMESEQUAL DIVIDEEQUAL MINUSEQUAL
-// PLUSEQUAL MODEQUAL SHIFTLEFTEQUAL SHIFTRIGHTEQUAL BITWISEANDEQUAL
-// BITWISEXOREQUAL
-// BITWISEOREQUAL QUESTIONMARK OR AND BITWISEOR BITWISEXOR NOTEQUAL EQUAL
-// LESSTHANOREQUALTO GREATERTHANOREQUALTO SHIFTLEFT SHIFTRIGHT PLUS MINUS
-// DIVIDE MOD DOTMBR POINTERTOMBR SCOPE "_cdecl" "__cdecl" "_near" "__near"
-// "_far" "__far" "__interrupt" "pascal" "_pascal" "__pascal"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_24(
- _tokenSet_24_data_, 12);
-const unsigned long CPPParser::_tokenSet_25_data_[] = {
- 100664320UL, 0UL, 1610612736UL, 0UL, 524288UL, 16368UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// ID "_stdcall" "__stdcall" STAR AMPERSAND SCOPE "_cdecl" "__cdecl" "_near"
-// "__near" "_far" "__far" "__interrupt" "pascal" "_pascal" "__pascal"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_25(
- _tokenSet_25_data_, 12);
-const unsigned long CPPParser::_tokenSet_26_data_[] = {
- 100664352UL, 1UL, 1642131456UL, 0UL, 524288UL, 16368UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// LESSTHAN ID "_stdcall" "__stdcall" LPAREN "const" "__const" "volatile"
-// "__volatile__" "operator" "this" "true" "false" STAR AMPERSAND SCOPE
-// "_cdecl" "__cdecl" "_near" "__near" "_far" "__far" "__interrupt" "pascal"
-// "_pascal" "__pascal"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_26(
- _tokenSet_26_data_, 12);
-const unsigned long CPPParser::_tokenSet_27_data_[] = {
- 1024UL, 1UL, 31457280UL, 0UL, 524288UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// ID LPAREN "operator" "this" "true" "false" SCOPE
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_27(
- _tokenSet_27_data_, 12);
-const unsigned long CPPParser::_tokenSet_28_data_[] = {
- 263264UL, 1UL, 1977745408UL, 3220176896UL, 2744319UL, 16396UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// LESSTHAN GREATERTHAN ID ASSIGNEQUAL LPAREN COMMA "operator" "this" "true"
-// "false" LSQUARE TILDE STAR AMPERSAND TIMESEQUAL DIVIDEEQUAL MINUSEQUAL
-// PLUSEQUAL MODEQUAL SHIFTLEFTEQUAL SHIFTRIGHTEQUAL BITWISEANDEQUAL
-// BITWISEXOREQUAL
-// BITWISEOREQUAL OR AND BITWISEOR BITWISEXOR NOTEQUAL EQUAL LESSTHANOREQUALTO
-// GREATERTHANOREQUALTO SHIFTLEFT SHIFTRIGHT PLUS MINUS DIVIDE MOD POINTERTOMBR
-// PLUSPLUS MINUSMINUS SCOPE POINTERTO NOT "new" "delete"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_28(
- _tokenSet_28_data_, 12);
-const unsigned long CPPParser::_tokenSet_29_data_[] = {
- 4291837824UL, 4294967292UL, 65535UL, 2UL, 524288UL, 0UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// "typedef" SEMICOLON "enum" ID LCURLY "inline" "friend" "extern" "struct"
-// "union" "class" "_stdcall" "__stdcall" "GFEXCLUDE" "GFINCLUDE" "GFID"
-// "GFUNREAD" "GFARRAYSIZE" "GFARRAYSIZES" "GFARRAYELEMSIZE" "auto" "register"
-// "static" "mutable" "_inline" "__inline" "virtual" "explicit" "typename"
-// "char" "wchar_t" "bool" "short" "int" "_int8" "__int8" "int8_t" "_int16"
-// "__int16" "int16_t" "_int32" "__int32" "int32_t" "_int64" "__int64"
-// "int64_t" "uint8_t" "uint16_t" "uint32_t" "uint64_t" "_w64" "__w64"
-// "long" "signed" "unsigned" "float" "double" "void" "_declspec" "__declspec"
-// "const" "__const" "volatile" "__volatile__" "using" SCOPE
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_29(
- _tokenSet_29_data_, 12);
-const unsigned long CPPParser::_tokenSet_30_data_[] = {
- 4294180754UL, 4294967293UL, 1945960447UL, 1015807UL, 4291790336UL, 32767UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// EOF "template" "typedef" SEMICOLON "enum" ID LCURLY "inline" "friend"
-// "namespace" "antlrTrace_on" "antlrTrace_off" RCURLY "extern" StringLiteral
-// "struct" "union" "class" "_stdcall" "__stdcall" "GFEXCLUDE" "GFINCLUDE"
-// "GFID" "GFUNREAD" "GFARRAYSIZE" LPAREN "GFARRAYSIZES" "GFARRAYELEMSIZE"
-// "auto" "register" "static" "mutable" "_inline" "__inline" "virtual"
-// "explicit" "typename" "char" "wchar_t" "bool" "short" "int" "_int8"
-// "__int8" "int8_t" "_int16" "__int16" "int16_t" "_int32" "__int32" "int32_t"
-// "_int64" "__int64" "int64_t" "uint8_t" "uint16_t" "uint32_t" "uint64_t"
-// "_w64" "__w64" "long" "signed" "unsigned" "float" "double" "void" "_declspec"
-// "__declspec" "const" "__const" "volatile" "__volatile__" "public" "protected"
-// "private" "operator" "this" "true" "false" OCTALINT TILDE STAR AMPERSAND
-// "throw" "using" "case" "default" "if" "else" "switch" "while" "do" "for"
-// "goto" "continue" "break" "return" "try" "asm" "_asm" "__asm" "__asm__"
-// PLUS MINUS PLUSPLUS MINUSMINUS "sizeof" "__alignof__" SCOPE "dynamic_cast"
-// "static_cast" "reinterpret_cast" "const_cast" "typeid" DECIMALINT
-// HEXADECIMALINT
-// CharLiteral WCharLiteral WStringLiteral FLOATONE FLOATTWO NOT "new"
-// "_cdecl" "__cdecl" "_near" "__near" "_far" "__far" "__interrupt" "pascal"
-// "_pascal" "__pascal" "delete"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_30(
- _tokenSet_30_data_, 12);
-const unsigned long CPPParser::_tokenSet_31_data_[] = {
- 4291835520UL, 4294967293UL, 1910571007UL, 2UL, 524288UL, 16368UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// "typedef" "enum" ID "inline" "friend" "extern" "struct" "union" "class"
-// "_stdcall" "__stdcall" "GFEXCLUDE" "GFINCLUDE" "GFID" "GFUNREAD"
-// "GFARRAYSIZE"
-// LPAREN "GFARRAYSIZES" "GFARRAYELEMSIZE" "auto" "register" "static" "mutable"
-// "_inline" "__inline" "virtual" "explicit" "typename" "char" "wchar_t"
-// "bool" "short" "int" "_int8" "__int8" "int8_t" "_int16" "__int16" "int16_t"
-// "_int32" "__int32" "int32_t" "_int64" "__int64" "int64_t" "uint8_t"
-// "uint16_t" "uint32_t" "uint64_t" "_w64" "__w64" "long" "signed" "unsigned"
-// "float" "double" "void" "_declspec" "__declspec" "const" "__const" "volatile"
-// "__volatile__" "operator" "this" "true" "false" TILDE STAR AMPERSAND
-// "using" SCOPE "_cdecl" "__cdecl" "_near" "__near" "_far" "__far"
-// "__interrupt"
-// "pascal" "_pascal" "__pascal"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_31(
- _tokenSet_31_data_, 12);
-const unsigned long CPPParser::_tokenSet_32_data_[] = {2304UL, 0UL, 0UL, 0UL,
- 0UL, 0UL, 0UL, 0UL};
-// SEMICOLON LCURLY
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_32(
- _tokenSet_32_data_, 8);
-const unsigned long CPPParser::_tokenSet_33_data_[] = {
- 1024UL, 0UL, 0UL, 0UL, 524288UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// ID SCOPE
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_33(
- _tokenSet_33_data_, 12);
-const unsigned long CPPParser::_tokenSet_34_data_[] = {
- 1024UL, 0UL, 836763648UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// ID "operator" "this" "true" "false" TILDE STAR
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_34(
- _tokenSet_34_data_, 8);
-const unsigned long CPPParser::_tokenSet_35_data_[] = {
- 4291837568UL, 4294967292UL, 65535UL, 2UL, 524288UL, 0UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// "typedef" "enum" ID LCURLY "inline" "friend" "extern" "struct" "union"
-// "class" "_stdcall" "__stdcall" "GFEXCLUDE" "GFINCLUDE" "GFID" "GFUNREAD"
-// "GFARRAYSIZE" "GFARRAYSIZES" "GFARRAYELEMSIZE" "auto" "register" "static"
-// "mutable" "_inline" "__inline" "virtual" "explicit" "typename" "char"
-// "wchar_t" "bool" "short" "int" "_int8" "__int8" "int8_t" "_int16" "__int16"
-// "int16_t" "_int32" "__int32" "int32_t" "_int64" "__int64" "int64_t"
-// "uint8_t" "uint16_t" "uint32_t" "uint64_t" "_w64" "__w64" "long" "signed"
-// "unsigned" "float" "double" "void" "_declspec" "__declspec" "const"
-// "__const" "volatile" "__volatile__" "using" SCOPE
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_35(
- _tokenSet_35_data_, 12);
-const unsigned long CPPParser::_tokenSet_36_data_[] = {
- 4294180784UL, 4294967293UL, 1945960447UL, 1015775UL, 4291790336UL, 32767UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// "template" LESSTHAN "typedef" SEMICOLON "enum" ID LCURLY "inline" "friend"
-// "namespace" "antlrTrace_on" "antlrTrace_off" RCURLY "extern" StringLiteral
-// "struct" "union" "class" "_stdcall" "__stdcall" "GFEXCLUDE" "GFINCLUDE"
-// "GFID" "GFUNREAD" "GFARRAYSIZE" LPAREN "GFARRAYSIZES" "GFARRAYELEMSIZE"
-// "auto" "register" "static" "mutable" "_inline" "__inline" "virtual"
-// "explicit" "typename" "char" "wchar_t" "bool" "short" "int" "_int8"
-// "__int8" "int8_t" "_int16" "__int16" "int16_t" "_int32" "__int32" "int32_t"
-// "_int64" "__int64" "int64_t" "uint8_t" "uint16_t" "uint32_t" "uint64_t"
-// "_w64" "__w64" "long" "signed" "unsigned" "float" "double" "void" "_declspec"
-// "__declspec" "const" "__const" "volatile" "__volatile__" "public" "protected"
-// "private" "operator" "this" "true" "false" OCTALINT TILDE STAR AMPERSAND
-// "throw" "using" "case" "default" "if" "switch" "while" "do" "for" "goto"
-// "continue" "break" "return" "try" "asm" "_asm" "__asm" "__asm__" PLUS
-// MINUS PLUSPLUS MINUSMINUS "sizeof" "__alignof__" SCOPE "dynamic_cast"
-// "static_cast" "reinterpret_cast" "const_cast" "typeid" DECIMALINT
-// HEXADECIMALINT
-// CharLiteral WCharLiteral WStringLiteral FLOATONE FLOATTWO NOT "new"
-// "_cdecl" "__cdecl" "_near" "__near" "_far" "__far" "__interrupt" "pascal"
-// "_pascal" "__pascal" "delete"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_36(
- _tokenSet_36_data_, 12);
-const unsigned long CPPParser::_tokenSet_37_data_[] = {
- 4294180752UL, 4294967293UL, 1945960447UL, 1015775UL, 4291790336UL, 32767UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// "template" "typedef" SEMICOLON "enum" ID LCURLY "inline" "friend" "namespace"
-// "antlrTrace_on" "antlrTrace_off" RCURLY "extern" StringLiteral "struct"
-// "union" "class" "_stdcall" "__stdcall" "GFEXCLUDE" "GFINCLUDE" "GFID"
-// "GFUNREAD" "GFARRAYSIZE" LPAREN "GFARRAYSIZES" "GFARRAYELEMSIZE" "auto"
-// "register" "static" "mutable" "_inline" "__inline" "virtual" "explicit"
-// "typename" "char" "wchar_t" "bool" "short" "int" "_int8" "__int8" "int8_t"
-// "_int16" "__int16" "int16_t" "_int32" "__int32" "int32_t" "_int64" "__int64"
-// "int64_t" "uint8_t" "uint16_t" "uint32_t" "uint64_t" "_w64" "__w64"
-// "long" "signed" "unsigned" "float" "double" "void" "_declspec" "__declspec"
-// "const" "__const" "volatile" "__volatile__" "public" "protected" "private"
-// "operator" "this" "true" "false" OCTALINT TILDE STAR AMPERSAND "throw"
-// "using" "case" "default" "if" "switch" "while" "do" "for" "goto" "continue"
-// "break" "return" "try" "asm" "_asm" "__asm" "__asm__" PLUS MINUS PLUSPLUS
-// MINUSMINUS "sizeof" "__alignof__" SCOPE "dynamic_cast" "static_cast"
-// "reinterpret_cast" "const_cast" "typeid" DECIMALINT HEXADECIMALINT
-// CharLiteral
-// WCharLiteral WStringLiteral FLOATONE FLOATTWO NOT "new" "_cdecl" "__cdecl"
-// "_near" "__near" "_far" "__far" "__interrupt" "pascal" "_pascal" "__pascal"
-// "delete"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_37(
- _tokenSet_37_data_, 12);
-const unsigned long CPPParser::_tokenSet_38_data_[] = {
- 100664320UL, 1UL, 1642070016UL, 0UL, 524288UL, 16368UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// ID "_stdcall" "__stdcall" LPAREN "operator" "this" "true" "false" STAR
-// AMPERSAND SCOPE "_cdecl" "__cdecl" "_near" "__near" "_far" "__far"
-// "__interrupt"
-// "pascal" "_pascal" "__pascal"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_38(
- _tokenSet_38_data_, 12);
-const unsigned long CPPParser::_tokenSet_39_data_[] = {
- 100926560UL, 1UL, 1977806848UL, 3220176896UL, 2744319UL, 32764UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// LESSTHAN GREATERTHAN ID ASSIGNEQUAL "_stdcall" "__stdcall" LPAREN "const"
-// "__const" "volatile" "__volatile__" COMMA "operator" "this" "true" "false"
-// LSQUARE TILDE STAR AMPERSAND TIMESEQUAL DIVIDEEQUAL MINUSEQUAL PLUSEQUAL
-// MODEQUAL SHIFTLEFTEQUAL SHIFTRIGHTEQUAL BITWISEANDEQUAL BITWISEXOREQUAL
-// BITWISEOREQUAL OR AND BITWISEOR BITWISEXOR NOTEQUAL EQUAL LESSTHANOREQUALTO
-// GREATERTHANOREQUALTO SHIFTLEFT SHIFTRIGHT PLUS MINUS DIVIDE MOD POINTERTOMBR
-// PLUSPLUS MINUSMINUS SCOPE POINTERTO NOT "new" "_cdecl" "__cdecl" "_near"
-// "__near" "_far" "__far" "__interrupt" "pascal" "_pascal" "__pascal"
-// "delete"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_39(
- _tokenSet_39_data_, 12);
-const unsigned long CPPParser::_tokenSet_40_data_[] = {
- 4294180752UL, 4294967293UL, 1945960447UL, 1015807UL, 4291790336UL, 32767UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// "template" "typedef" SEMICOLON "enum" ID LCURLY "inline" "friend" "namespace"
-// "antlrTrace_on" "antlrTrace_off" RCURLY "extern" StringLiteral "struct"
-// "union" "class" "_stdcall" "__stdcall" "GFEXCLUDE" "GFINCLUDE" "GFID"
-// "GFUNREAD" "GFARRAYSIZE" LPAREN "GFARRAYSIZES" "GFARRAYELEMSIZE" "auto"
-// "register" "static" "mutable" "_inline" "__inline" "virtual" "explicit"
-// "typename" "char" "wchar_t" "bool" "short" "int" "_int8" "__int8" "int8_t"
-// "_int16" "__int16" "int16_t" "_int32" "__int32" "int32_t" "_int64" "__int64"
-// "int64_t" "uint8_t" "uint16_t" "uint32_t" "uint64_t" "_w64" "__w64"
-// "long" "signed" "unsigned" "float" "double" "void" "_declspec" "__declspec"
-// "const" "__const" "volatile" "__volatile__" "public" "protected" "private"
-// "operator" "this" "true" "false" OCTALINT TILDE STAR AMPERSAND "throw"
-// "using" "case" "default" "if" "else" "switch" "while" "do" "for" "goto"
-// "continue" "break" "return" "try" "asm" "_asm" "__asm" "__asm__" PLUS
-// MINUS PLUSPLUS MINUSMINUS "sizeof" "__alignof__" SCOPE "dynamic_cast"
-// "static_cast" "reinterpret_cast" "const_cast" "typeid" DECIMALINT
-// HEXADECIMALINT
-// CharLiteral WCharLiteral WStringLiteral FLOATONE FLOATTWO NOT "new"
-// "_cdecl" "__cdecl" "_near" "__near" "_far" "__far" "__interrupt" "pascal"
-// "_pascal" "__pascal" "delete"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_40(
- _tokenSet_40_data_, 12);
-const unsigned long CPPParser::_tokenSet_41_data_[] = {
- 101453120UL, 3UL, 4125229056UL, 0UL, 524288UL, 16368UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// GREATERTHAN SEMICOLON ID LCURLY ASSIGNEQUAL COLON "_stdcall" "__stdcall"
-// LPAREN RPAREN COMMA "operator" "this" "true" "false" LSQUARE TILDE STAR
-// AMPERSAND ELLIPSIS SCOPE "_cdecl" "__cdecl" "_near" "__near" "_far"
-// "__far" "__interrupt" "pascal" "_pascal" "__pascal"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_41(
- _tokenSet_41_data_, 12);
-const unsigned long CPPParser::_tokenSet_42_data_[] = {
- 5120UL, 1792UL, 268435456UL, 0UL, 524288UL, 0UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// ID "inline" "_inline" "__inline" "virtual" TILDE SCOPE
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_42(
- _tokenSet_42_data_, 12);
-const unsigned long CPPParser::_tokenSet_43_data_[] = {
- 4291835520UL, 4294967292UL, 2162687UL, 0UL, 524288UL, 0UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// "typedef" "enum" ID "inline" "friend" "extern" "struct" "union" "class"
-// "_stdcall" "__stdcall" "GFEXCLUDE" "GFINCLUDE" "GFID" "GFUNREAD"
-// "GFARRAYSIZE"
-// "GFARRAYSIZES" "GFARRAYELEMSIZE" "auto" "register" "static" "mutable"
-// "_inline" "__inline" "virtual" "explicit" "typename" "char" "wchar_t"
-// "bool" "short" "int" "_int8" "__int8" "int8_t" "_int16" "__int16" "int16_t"
-// "_int32" "__int32" "int32_t" "_int64" "__int64" "int64_t" "uint8_t"
-// "uint16_t" "uint32_t" "uint64_t" "_w64" "__w64" "long" "signed" "unsigned"
-// "float" "double" "void" "_declspec" "__declspec" "const" "__const" "volatile"
-// "__volatile__" "operator" SCOPE
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_43(
- _tokenSet_43_data_, 12);
-const unsigned long CPPParser::_tokenSet_44_data_[] = {
- 1024UL, 0UL, 31457280UL, 0UL, 524288UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// ID "operator" "this" "true" "false" SCOPE
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_44(
- _tokenSet_44_data_, 12);
-const unsigned long CPPParser::_tokenSet_45_data_[] = {
- 263520UL, 1UL, 1977745408UL, 3220176896UL, 2744319UL, 16396UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// LESSTHAN GREATERTHAN SEMICOLON ID ASSIGNEQUAL LPAREN COMMA "operator"
-// "this" "true" "false" LSQUARE TILDE STAR AMPERSAND TIMESEQUAL DIVIDEEQUAL
-// MINUSEQUAL PLUSEQUAL MODEQUAL SHIFTLEFTEQUAL SHIFTRIGHTEQUAL BITWISEANDEQUAL
-// BITWISEXOREQUAL BITWISEOREQUAL OR AND BITWISEOR BITWISEXOR NOTEQUAL
-// EQUAL LESSTHANOREQUALTO GREATERTHANOREQUALTO SHIFTLEFT SHIFTRIGHT PLUS
-// MINUS DIVIDE MOD POINTERTOMBR PLUSPLUS MINUSMINUS SCOPE POINTERTO NOT
-// "new" "delete"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_45(
- _tokenSet_45_data_, 12);
-const unsigned long CPPParser::_tokenSet_46_data_[] = {
- 100668416UL, 3841UL, 1642070016UL, 0UL, 524288UL, 16368UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// ID "inline" "_stdcall" "__stdcall" LPAREN "_inline" "__inline" "virtual"
-// "explicit" "operator" "this" "true" "false" STAR AMPERSAND SCOPE "_cdecl"
-// "__cdecl" "_near" "__near" "_far" "__far" "__interrupt" "pascal" "_pascal"
-// "__pascal"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_46(
- _tokenSet_46_data_, 12);
-const unsigned long CPPParser::_tokenSet_47_data_[] = {
- 100930656UL, 3841UL, 1977806848UL, 3220176896UL, 2744319UL, 32764UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// LESSTHAN GREATERTHAN ID "inline" ASSIGNEQUAL "_stdcall" "__stdcall"
-// LPAREN "_inline" "__inline" "virtual" "explicit" "const" "__const" "volatile"
-// "__volatile__" COMMA "operator" "this" "true" "false" LSQUARE TILDE
-// STAR AMPERSAND TIMESEQUAL DIVIDEEQUAL MINUSEQUAL PLUSEQUAL MODEQUAL
-// SHIFTLEFTEQUAL SHIFTRIGHTEQUAL BITWISEANDEQUAL BITWISEXOREQUAL BITWISEOREQUAL
-// OR AND BITWISEOR BITWISEXOR NOTEQUAL EQUAL LESSTHANOREQUALTO
-// GREATERTHANOREQUALTO
-// SHIFTLEFT SHIFTRIGHT PLUS MINUS DIVIDE MOD POINTERTOMBR PLUSPLUS MINUSMINUS
-// SCOPE POINTERTO NOT "new" "_cdecl" "__cdecl" "_near" "__near" "_far"
-// "__far" "__interrupt" "pascal" "_pascal" "__pascal" "delete"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_47(
- _tokenSet_47_data_, 12);
-const unsigned long CPPParser::_tokenSet_48_data_[] = {526592UL, 0UL, 0UL, 0UL,
- 0UL, 0UL, 0UL, 0UL};
-// SEMICOLON LCURLY COLON
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_48(
- _tokenSet_48_data_, 8);
-const unsigned long CPPParser::_tokenSet_49_data_[] = {
- 4294049680UL, 4294967293UL, 1945960447UL, 1015775UL, 4291790336UL, 32767UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// "template" "typedef" SEMICOLON "enum" ID LCURLY "inline" "friend" "namespace"
-// "antlrTrace_on" "antlrTrace_off" "extern" StringLiteral "struct" "union"
-// "class" "_stdcall" "__stdcall" "GFEXCLUDE" "GFINCLUDE" "GFID" "GFUNREAD"
-// "GFARRAYSIZE" LPAREN "GFARRAYSIZES" "GFARRAYELEMSIZE" "auto" "register"
-// "static" "mutable" "_inline" "__inline" "virtual" "explicit" "typename"
-// "char" "wchar_t" "bool" "short" "int" "_int8" "__int8" "int8_t" "_int16"
-// "__int16" "int16_t" "_int32" "__int32" "int32_t" "_int64" "__int64"
-// "int64_t" "uint8_t" "uint16_t" "uint32_t" "uint64_t" "_w64" "__w64"
-// "long" "signed" "unsigned" "float" "double" "void" "_declspec" "__declspec"
-// "const" "__const" "volatile" "__volatile__" "public" "protected" "private"
-// "operator" "this" "true" "false" OCTALINT TILDE STAR AMPERSAND "throw"
-// "using" "case" "default" "if" "switch" "while" "do" "for" "goto" "continue"
-// "break" "return" "try" "asm" "_asm" "__asm" "__asm__" PLUS MINUS PLUSPLUS
-// MINUSMINUS "sizeof" "__alignof__" SCOPE "dynamic_cast" "static_cast"
-// "reinterpret_cast" "const_cast" "typeid" DECIMALINT HEXADECIMALINT
-// CharLiteral
-// WCharLiteral WStringLiteral FLOATONE FLOATTWO NOT "new" "_cdecl" "__cdecl"
-// "_near" "__near" "_far" "__far" "__interrupt" "pascal" "_pascal" "__pascal"
-// "delete"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_49(
- _tokenSet_49_data_, 12);
-const unsigned long CPPParser::_tokenSet_50_data_[] = {
- 4294180754UL, 4294967293UL, 1945960447UL, 1048575UL, 4291790336UL, 32767UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// EOF "template" "typedef" SEMICOLON "enum" ID LCURLY "inline" "friend"
-// "namespace" "antlrTrace_on" "antlrTrace_off" RCURLY "extern" StringLiteral
-// "struct" "union" "class" "_stdcall" "__stdcall" "GFEXCLUDE" "GFINCLUDE"
-// "GFID" "GFUNREAD" "GFARRAYSIZE" LPAREN "GFARRAYSIZES" "GFARRAYELEMSIZE"
-// "auto" "register" "static" "mutable" "_inline" "__inline" "virtual"
-// "explicit" "typename" "char" "wchar_t" "bool" "short" "int" "_int8"
-// "__int8" "int8_t" "_int16" "__int16" "int16_t" "_int32" "__int32" "int32_t"
-// "_int64" "__int64" "int64_t" "uint8_t" "uint16_t" "uint32_t" "uint64_t"
-// "_w64" "__w64" "long" "signed" "unsigned" "float" "double" "void" "_declspec"
-// "__declspec" "const" "__const" "volatile" "__volatile__" "public" "protected"
-// "private" "operator" "this" "true" "false" OCTALINT TILDE STAR AMPERSAND
-// "throw" "using" "case" "default" "if" "else" "switch" "while" "do" "for"
-// "goto" "continue" "break" "return" "try" "catch" "asm" "_asm" "__asm"
-// "__asm__" PLUS MINUS PLUSPLUS MINUSMINUS "sizeof" "__alignof__" SCOPE
-// "dynamic_cast" "static_cast" "reinterpret_cast" "const_cast" "typeid"
-// DECIMALINT HEXADECIMALINT CharLiteral WCharLiteral WStringLiteral FLOATONE
-// FLOATTWO NOT "new" "_cdecl" "__cdecl" "_near" "__near" "_far" "__far"
-// "__interrupt" "pascal" "_pascal" "__pascal" "delete"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_50(
- _tokenSet_50_data_, 12);
-const unsigned long CPPParser::_tokenSet_51_data_[] = {
- 525312UL, 1024UL, 0UL, 0UL, 524288UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// ID COLON "virtual" SCOPE
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_51(
- _tokenSet_51_data_, 12);
-const unsigned long CPPParser::_tokenSet_52_data_[] = {64UL, 0UL, 0UL, 0UL,
- 0UL, 0UL, 0UL, 0UL};
-// GREATERTHAN
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_52(
- _tokenSet_52_data_, 8);
-const unsigned long CPPParser::_tokenSet_53_data_[] = {2048UL, 0UL, 0UL, 0UL,
- 0UL, 0UL, 0UL, 0UL};
-// LCURLY
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_53(
- _tokenSet_53_data_, 8);
-const unsigned long CPPParser::_tokenSet_54_data_[] = {
- 4292755424UL, 4294967295UL, 4259512319UL, 4293918723UL, 557055UL, 16368UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// LESSTHAN GREATERTHAN "typedef" SEMICOLON "enum" ID LCURLY "inline" "friend"
-// RCURLY ASSIGNEQUAL COLON "extern" "struct" "union" "class" "_stdcall"
-// "__stdcall" "GFEXCLUDE" "GFINCLUDE" "GFID" "GFUNREAD" "GFARRAYSIZE"
-// LPAREN RPAREN "GFARRAYSIZES" "GFARRAYELEMSIZE" "auto" "register" "static"
-// "mutable" "_inline" "__inline" "virtual" "explicit" "typename" "char"
-// "wchar_t" "bool" "short" "int" "_int8" "__int8" "int8_t" "_int16" "__int16"
-// "int16_t" "_int32" "__int32" "int32_t" "_int64" "__int64" "int64_t"
-// "uint8_t" "uint16_t" "uint32_t" "uint64_t" "_w64" "__w64" "long" "signed"
-// "unsigned" "float" "double" "void" "_declspec" "__declspec" "const"
-// "__const" "volatile" "__volatile__" COMMA "operator" "this" "true" "false"
-// LSQUARE RSQUARE TILDE STAR AMPERSAND ELLIPSIS "throw" "using" TIMESEQUAL
-// DIVIDEEQUAL MINUSEQUAL PLUSEQUAL MODEQUAL SHIFTLEFTEQUAL SHIFTRIGHTEQUAL
-// BITWISEANDEQUAL BITWISEXOREQUAL BITWISEOREQUAL QUESTIONMARK OR AND BITWISEOR
-// BITWISEXOR NOTEQUAL EQUAL LESSTHANOREQUALTO GREATERTHANOREQUALTO SHIFTLEFT
-// SHIFTRIGHT PLUS MINUS DIVIDE MOD DOTMBR POINTERTOMBR SCOPE "_cdecl"
-// "__cdecl" "_near" "__near" "_far" "__far" "__interrupt" "pascal" "_pascal"
-// "__pascal"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_54(
- _tokenSet_54_data_, 12);
-const unsigned long CPPParser::_tokenSet_55_data_[] = {
- 4293932672UL, 4294967293UL, 1944125439UL, 0UL, 4291790336UL, 16399UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// "typedef" "enum" ID "inline" "friend" "extern" StringLiteral "struct"
-// "union" "class" "_stdcall" "__stdcall" "GFEXCLUDE" "GFINCLUDE" "GFID"
-// "GFUNREAD" "GFARRAYSIZE" LPAREN "GFARRAYSIZES" "GFARRAYELEMSIZE" "auto"
-// "register" "static" "mutable" "_inline" "__inline" "virtual" "explicit"
-// "typename" "char" "wchar_t" "bool" "short" "int" "_int8" "__int8" "int8_t"
-// "_int16" "__int16" "int16_t" "_int32" "__int32" "int32_t" "_int64" "__int64"
-// "int64_t" "uint8_t" "uint16_t" "uint32_t" "uint64_t" "_w64" "__w64"
-// "long" "signed" "unsigned" "float" "double" "void" "_declspec" "__declspec"
-// "const" "__const" "volatile" "__volatile__" "operator" "this" "true"
-// "false" OCTALINT TILDE STAR AMPERSAND PLUS MINUS PLUSPLUS MINUSMINUS
-// "sizeof" "__alignof__" SCOPE "dynamic_cast" "static_cast" "reinterpret_cast"
-// "const_cast" "typeid" DECIMALINT HEXADECIMALINT CharLiteral WCharLiteral
-// WStringLiteral FLOATONE FLOATTWO NOT "new" "delete"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_55(
- _tokenSet_55_data_, 12);
-const unsigned long CPPParser::_tokenSet_56_data_[] = {
- 101584224UL, 3UL, 4259446784UL, 4293918720UL, 557055UL, 16368UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// LESSTHAN GREATERTHAN SEMICOLON ID LCURLY RCURLY ASSIGNEQUAL COLON "_stdcall"
-// "__stdcall" LPAREN RPAREN COMMA "operator" "this" "true" "false" LSQUARE
-// RSQUARE TILDE STAR AMPERSAND ELLIPSIS TIMESEQUAL DIVIDEEQUAL MINUSEQUAL
-// PLUSEQUAL MODEQUAL SHIFTLEFTEQUAL SHIFTRIGHTEQUAL BITWISEANDEQUAL
-// BITWISEXOREQUAL
-// BITWISEOREQUAL QUESTIONMARK OR AND BITWISEOR BITWISEXOR NOTEQUAL EQUAL
-// LESSTHANOREQUALTO GREATERTHANOREQUALTO SHIFTLEFT SHIFTRIGHT PLUS MINUS
-// DIVIDE MOD DOTMBR POINTERTOMBR SCOPE "_cdecl" "__cdecl" "_near" "__near"
-// "_far" "__far" "__interrupt" "pascal" "_pascal" "__pascal"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_56(
- _tokenSet_56_data_, 12);
-const unsigned long CPPParser::_tokenSet_57_data_[] = {
- 4294967282UL, 4294967295UL, 4294967295UL, 4294934527UL,
- 4294967295UL, 32767UL, 0UL, 0UL,
- 0UL, 0UL, 0UL, 0UL};
-// EOF "template" LESSTHAN GREATERTHAN "typedef" SEMICOLON "enum" ID LCURLY
-// "inline" "friend" "namespace" "antlrTrace_on" "antlrTrace_off" RCURLY
-// ASSIGNEQUAL COLON "extern" StringLiteral "struct" "union" "class" "_stdcall"
-// "__stdcall" "GFEXCLUDE" "GFINCLUDE" "GFID" "GFUNREAD" "GFARRAYSIZE"
-// LPAREN RPAREN "GFARRAYSIZES" "GFARRAYELEMSIZE" "auto" "register" "static"
-// "mutable" "_inline" "__inline" "virtual" "explicit" "typename" "char"
-// "wchar_t" "bool" "short" "int" "_int8" "__int8" "int8_t" "_int16" "__int16"
-// "int16_t" "_int32" "__int32" "int32_t" "_int64" "__int64" "int64_t"
-// "uint8_t" "uint16_t" "uint32_t" "uint64_t" "_w64" "__w64" "long" "signed"
-// "unsigned" "float" "double" "void" "_declspec" "__declspec" "const"
-// "__const" "volatile" "__volatile__" "GFIGNORE" COMMA "public" "protected"
-// "private" "operator" "this" "true" "false" OCTALINT LSQUARE RSQUARE
-// TILDE STAR AMPERSAND ELLIPSIS "throw" "using" "case" "default" "if"
-// "else" "switch" "while" "do" "for" "goto" "continue" "break" "return"
-// "try" "asm" "_asm" "__asm" "__asm__" TIMESEQUAL DIVIDEEQUAL MINUSEQUAL
-// PLUSEQUAL MODEQUAL SHIFTLEFTEQUAL SHIFTRIGHTEQUAL BITWISEANDEQUAL
-// BITWISEXOREQUAL
-// BITWISEOREQUAL QUESTIONMARK OR AND BITWISEOR BITWISEXOR NOTEQUAL EQUAL
-// LESSTHANOREQUALTO GREATERTHANOREQUALTO SHIFTLEFT SHIFTRIGHT PLUS MINUS
-// DIVIDE MOD DOTMBR POINTERTOMBR PLUSPLUS MINUSMINUS "sizeof" "__alignof__"
-// SCOPE DOT POINTERTO "dynamic_cast" "static_cast" "reinterpret_cast"
-// "const_cast" "typeid" DECIMALINT HEXADECIMALINT CharLiteral WCharLiteral
-// WStringLiteral FLOATONE FLOATTWO NOT "new" "_cdecl" "__cdecl" "_near"
-// "__near" "_far" "__far" "__interrupt" "pascal" "_pascal" "__pascal"
-// "delete"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_57(
- _tokenSet_57_data_, 12);
-const unsigned long CPPParser::_tokenSet_58_data_[] = {
- 3072UL, 0UL, 31522816UL, 0UL, 524288UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// ID LCURLY "GFIGNORE" "operator" "this" "true" "false" SCOPE
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_58(
- _tokenSet_58_data_, 12);
-const unsigned long CPPParser::_tokenSet_59_data_[] = {
- 524544UL, 2UL, 134217728UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// SEMICOLON COLON RPAREN RSQUARE
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_59(
- _tokenSet_59_data_, 8);
-const unsigned long CPPParser::_tokenSet_60_data_[] = {
- 2048UL, 0UL, 131072UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// LCURLY COMMA
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_60(
- _tokenSet_60_data_, 8);
-const unsigned long CPPParser::_tokenSet_61_data_[] = {131072UL, 0UL, 0UL, 0UL,
- 0UL, 0UL, 0UL, 0UL};
-// RCURLY
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_61(
- _tokenSet_61_data_, 8);
-const unsigned long CPPParser::_tokenSet_62_data_[] = {
- 131072UL, 0UL, 131072UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// RCURLY COMMA
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_62(
- _tokenSet_62_data_, 8);
-const unsigned long CPPParser::_tokenSet_63_data_[] = {
- 917760UL, 0UL, 134348800UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// SEMICOLON RCURLY ASSIGNEQUAL COLON COMMA RSQUARE
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_63(
- _tokenSet_63_data_, 8);
-const unsigned long CPPParser::_tokenSet_64_data_[] = {
- 101584224UL, 3UL, 4259446784UL, 4293918720UL, 3801087UL, 16368UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// LESSTHAN GREATERTHAN SEMICOLON ID LCURLY RCURLY ASSIGNEQUAL COLON "_stdcall"
-// "__stdcall" LPAREN RPAREN COMMA "operator" "this" "true" "false" LSQUARE
-// RSQUARE TILDE STAR AMPERSAND ELLIPSIS TIMESEQUAL DIVIDEEQUAL MINUSEQUAL
-// PLUSEQUAL MODEQUAL SHIFTLEFTEQUAL SHIFTRIGHTEQUAL BITWISEANDEQUAL
-// BITWISEXOREQUAL
-// BITWISEOREQUAL QUESTIONMARK OR AND BITWISEOR BITWISEXOR NOTEQUAL EQUAL
-// LESSTHANOREQUALTO GREATERTHANOREQUALTO SHIFTLEFT SHIFTRIGHT PLUS MINUS
-// DIVIDE MOD DOTMBR POINTERTOMBR PLUSPLUS MINUSMINUS SCOPE DOT POINTERTO
-// "_cdecl" "__cdecl" "_near" "__near" "_far" "__far" "__interrupt" "pascal"
-// "_pascal" "__pascal"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_64(
- _tokenSet_64_data_, 12);
-const unsigned long CPPParser::_tokenSet_65_data_[] = {
- 256UL, 0UL, 131072UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// SEMICOLON COMMA
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_65(
- _tokenSet_65_data_, 8);
-const unsigned long CPPParser::_tokenSet_66_data_[] = {
- 100664352UL, 1UL, 1910566912UL, 0UL, 524288UL, 16368UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// LESSTHAN ID "_stdcall" "__stdcall" LPAREN "const" "__const" "volatile"
-// "__volatile__" "operator" "this" "true" "false" TILDE STAR AMPERSAND
-// SCOPE "_cdecl" "__cdecl" "_near" "__near" "_far" "__far" "__interrupt"
-// "pascal" "_pascal" "__pascal"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_66(
- _tokenSet_66_data_, 12);
-const unsigned long CPPParser::_tokenSet_67_data_[] = {
- 1024UL, 1UL, 299892736UL, 0UL, 524288UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// ID LPAREN "operator" "this" "true" "false" TILDE SCOPE
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_67(
- _tokenSet_67_data_, 12);
-const unsigned long CPPParser::_tokenSet_68_data_[] = {
- 100926816UL, 3UL, 4125229056UL, 3220176896UL, 2744319UL, 32764UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// LESSTHAN GREATERTHAN SEMICOLON ID ASSIGNEQUAL "_stdcall" "__stdcall"
-// LPAREN RPAREN COMMA "operator" "this" "true" "false" LSQUARE TILDE STAR
-// AMPERSAND ELLIPSIS TIMESEQUAL DIVIDEEQUAL MINUSEQUAL PLUSEQUAL MODEQUAL
-// SHIFTLEFTEQUAL SHIFTRIGHTEQUAL BITWISEANDEQUAL BITWISEXOREQUAL BITWISEOREQUAL
-// OR AND BITWISEOR BITWISEXOR NOTEQUAL EQUAL LESSTHANOREQUALTO
-// GREATERTHANOREQUALTO
-// SHIFTLEFT SHIFTRIGHT PLUS MINUS DIVIDE MOD POINTERTOMBR PLUSPLUS MINUSMINUS
-// SCOPE POINTERTO NOT "new" "_cdecl" "__cdecl" "_near" "__near" "_far"
-// "__far" "__interrupt" "pascal" "_pascal" "__pascal" "delete"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_68(
- _tokenSet_68_data_, 12);
-const unsigned long CPPParser::_tokenSet_69_data_[] = {
- 262464UL, 3UL, 2147614720UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// GREATERTHAN SEMICOLON ASSIGNEQUAL LPAREN RPAREN COMMA ELLIPSIS
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_69(
- _tokenSet_69_data_, 8);
-const unsigned long CPPParser::_tokenSet_70_data_[] = {
- 131328UL, 0UL, 131072UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// SEMICOLON RCURLY COMMA
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_70(
- _tokenSet_70_data_, 8);
-const unsigned long CPPParser::_tokenSet_71_data_[] = {0UL, 2UL, 0UL, 0UL,
- 0UL, 0UL, 0UL, 0UL};
-// RPAREN
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_71(
- _tokenSet_71_data_, 8);
-const unsigned long CPPParser::_tokenSet_72_data_[] = {
- 2098176UL, 4294963201UL, 1944063999UL, 0UL, 4291790336UL, 16399UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// ID StringLiteral LPAREN "typename" "char" "wchar_t" "bool" "short" "int"
-// "_int8" "__int8" "int8_t" "_int16" "__int16" "int16_t" "_int32" "__int32"
-// "int32_t" "_int64" "__int64" "int64_t" "uint8_t" "uint16_t" "uint32_t"
-// "uint64_t" "_w64" "__w64" "long" "signed" "unsigned" "float" "double"
-// "void" "_declspec" "__declspec" "operator" "this" "true" "false" OCTALINT
-// TILDE STAR AMPERSAND PLUS MINUS PLUSPLUS MINUSMINUS "sizeof" "__alignof__"
-// SCOPE "dynamic_cast" "static_cast" "reinterpret_cast" "const_cast" "typeid"
-// DECIMALINT HEXADECIMALINT CharLiteral WCharLiteral WStringLiteral FLOATONE
-// FLOATTWO NOT "new" "delete"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_72(
- _tokenSet_72_data_, 12);
-const unsigned long CPPParser::_tokenSet_73_data_[] = {
- 4294850528UL, 4294967295UL, 4293066751UL, 4293918720UL,
- 4294967295UL, 16399UL, 0UL, 0UL,
- 0UL, 0UL, 0UL, 0UL};
-// LESSTHAN GREATERTHAN "typedef" SEMICOLON "enum" ID "inline" "friend"
-// RCURLY ASSIGNEQUAL COLON "extern" StringLiteral "struct" "union" "class"
-// "_stdcall" "__stdcall" "GFEXCLUDE" "GFINCLUDE" "GFID" "GFUNREAD"
-// "GFARRAYSIZE"
-// LPAREN RPAREN "GFARRAYSIZES" "GFARRAYELEMSIZE" "auto" "register" "static"
-// "mutable" "_inline" "__inline" "virtual" "explicit" "typename" "char"
-// "wchar_t" "bool" "short" "int" "_int8" "__int8" "int8_t" "_int16" "__int16"
-// "int16_t" "_int32" "__int32" "int32_t" "_int64" "__int64" "int64_t"
-// "uint8_t" "uint16_t" "uint32_t" "uint64_t" "_w64" "__w64" "long" "signed"
-// "unsigned" "float" "double" "void" "_declspec" "__declspec" "const"
-// "__const" "volatile" "__volatile__" COMMA "operator" "this" "true" "false"
-// OCTALINT LSQUARE RSQUARE TILDE STAR AMPERSAND ELLIPSIS TIMESEQUAL DIVIDEEQUAL
-// MINUSEQUAL PLUSEQUAL MODEQUAL SHIFTLEFTEQUAL SHIFTRIGHTEQUAL BITWISEANDEQUAL
-// BITWISEXOREQUAL BITWISEOREQUAL QUESTIONMARK OR AND BITWISEOR BITWISEXOR
-// NOTEQUAL EQUAL LESSTHANOREQUALTO GREATERTHANOREQUALTO SHIFTLEFT SHIFTRIGHT
-// PLUS MINUS DIVIDE MOD DOTMBR POINTERTOMBR PLUSPLUS MINUSMINUS "sizeof"
-// "__alignof__" SCOPE DOT POINTERTO "dynamic_cast" "static_cast"
-// "reinterpret_cast"
-// "const_cast" "typeid" DECIMALINT HEXADECIMALINT CharLiteral WCharLiteral
-// WStringLiteral FLOATONE FLOATTWO NOT "new" "delete"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_73(
- _tokenSet_73_data_, 12);
-const unsigned long CPPParser::_tokenSet_74_data_[] = {
- 655680UL, 2UL, 2281832448UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// GREATERTHAN SEMICOLON RCURLY COLON RPAREN COMMA RSQUARE ELLIPSIS
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_74(
- _tokenSet_74_data_, 8);
-const unsigned long CPPParser::_tokenSet_75_data_[] = {
- 2622464UL, 4294963201UL, 1944063999UL, 0UL, 4291790336UL, 16399UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// ID COLON StringLiteral LPAREN "typename" "char" "wchar_t" "bool" "short"
-// "int" "_int8" "__int8" "int8_t" "_int16" "__int16" "int16_t" "_int32"
-// "__int32" "int32_t" "_int64" "__int64" "int64_t" "uint8_t" "uint16_t"
-// "uint32_t" "uint64_t" "_w64" "__w64" "long" "signed" "unsigned" "float"
-// "double" "void" "_declspec" "__declspec" "operator" "this" "true" "false"
-// OCTALINT TILDE STAR AMPERSAND PLUS MINUS PLUSPLUS MINUSMINUS "sizeof"
-// "__alignof__" SCOPE "dynamic_cast" "static_cast" "reinterpret_cast"
-// "const_cast" "typeid" DECIMALINT HEXADECIMALINT CharLiteral WCharLiteral
-// WStringLiteral FLOATONE FLOATTWO NOT "new" "delete"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_75(
- _tokenSet_75_data_, 12);
-const unsigned long CPPParser::_tokenSet_76_data_[] = {
- 100664320UL, 1UL, 1910505472UL, 0UL, 524288UL, 16368UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// ID "_stdcall" "__stdcall" LPAREN "operator" "this" "true" "false" TILDE
-// STAR AMPERSAND SCOPE "_cdecl" "__cdecl" "_near" "__near" "_far" "__far"
-// "__interrupt" "pascal" "_pascal" "__pascal"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_76(
- _tokenSet_76_data_, 12);
-const unsigned long CPPParser::_tokenSet_77_data_[] = {
- 100926816UL, 1UL, 1977806848UL, 3220176896UL, 2744319UL, 32764UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// LESSTHAN GREATERTHAN SEMICOLON ID ASSIGNEQUAL "_stdcall" "__stdcall"
-// LPAREN "const" "__const" "volatile" "__volatile__" COMMA "operator"
-// "this" "true" "false" LSQUARE TILDE STAR AMPERSAND TIMESEQUAL DIVIDEEQUAL
-// MINUSEQUAL PLUSEQUAL MODEQUAL SHIFTLEFTEQUAL SHIFTRIGHTEQUAL BITWISEANDEQUAL
-// BITWISEXOREQUAL BITWISEOREQUAL OR AND BITWISEOR BITWISEXOR NOTEQUAL
-// EQUAL LESSTHANOREQUALTO GREATERTHANOREQUALTO SHIFTLEFT SHIFTRIGHT PLUS
-// MINUS DIVIDE MOD POINTERTOMBR PLUSPLUS MINUSMINUS SCOPE POINTERTO NOT
-// "new" "_cdecl" "__cdecl" "_near" "__near" "_far" "__far" "__interrupt"
-// "pascal" "_pascal" "__pascal" "delete"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_77(
- _tokenSet_77_data_, 12);
-const unsigned long CPPParser::_tokenSet_78_data_[] = {
- 262400UL, 0UL, 131072UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// SEMICOLON ASSIGNEQUAL COMMA
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_78(
- _tokenSet_78_data_, 8);
-const unsigned long CPPParser::_tokenSet_79_data_[] = {
- 4293932672UL, 4294967295UL, 4225826815UL, 0UL, 4291790336UL, 32767UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// "typedef" "enum" ID "inline" "friend" "extern" StringLiteral "struct"
-// "union" "class" "_stdcall" "__stdcall" "GFEXCLUDE" "GFINCLUDE" "GFID"
-// "GFUNREAD" "GFARRAYSIZE" LPAREN RPAREN "GFARRAYSIZES" "GFARRAYELEMSIZE"
-// "auto" "register" "static" "mutable" "_inline" "__inline" "virtual"
-// "explicit" "typename" "char" "wchar_t" "bool" "short" "int" "_int8"
-// "__int8" "int8_t" "_int16" "__int16" "int16_t" "_int32" "__int32" "int32_t"
-// "_int64" "__int64" "int64_t" "uint8_t" "uint16_t" "uint32_t" "uint64_t"
-// "_w64" "__w64" "long" "signed" "unsigned" "float" "double" "void" "_declspec"
-// "__declspec" "const" "__const" "volatile" "__volatile__" "operator"
-// "this" "true" "false" OCTALINT RSQUARE TILDE STAR AMPERSAND ELLIPSIS
-// PLUS MINUS PLUSPLUS MINUSMINUS "sizeof" "__alignof__" SCOPE "dynamic_cast"
-// "static_cast" "reinterpret_cast" "const_cast" "typeid" DECIMALINT
-// HEXADECIMALINT
-// CharLiteral WCharLiteral WStringLiteral FLOATONE FLOATTWO NOT "new"
-// "_cdecl" "__cdecl" "_near" "__near" "_far" "__far" "__interrupt" "pascal"
-// "_pascal" "__pascal" "delete"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_79(
- _tokenSet_79_data_, 12);
-const unsigned long CPPParser::_tokenSet_80_data_[] = {
- 4294967250UL, 4294967295UL, 4160684031UL, 1015807UL, 4291790336UL, 32767UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// EOF "template" GREATERTHAN "typedef" SEMICOLON "enum" ID LCURLY "inline"
-// "friend" "namespace" "antlrTrace_on" "antlrTrace_off" RCURLY ASSIGNEQUAL
-// COLON "extern" StringLiteral "struct" "union" "class" "_stdcall" "__stdcall"
-// "GFEXCLUDE" "GFINCLUDE" "GFID" "GFUNREAD" "GFARRAYSIZE" LPAREN RPAREN
-// "GFARRAYSIZES" "GFARRAYELEMSIZE" "auto" "register" "static" "mutable"
-// "_inline" "__inline" "virtual" "explicit" "typename" "char" "wchar_t"
-// "bool" "short" "int" "_int8" "__int8" "int8_t" "_int16" "__int16" "int16_t"
-// "_int32" "__int32" "int32_t" "_int64" "__int64" "int64_t" "uint8_t"
-// "uint16_t" "uint32_t" "uint64_t" "_w64" "__w64" "long" "signed" "unsigned"
-// "float" "double" "void" "_declspec" "__declspec" "const" "__const" "volatile"
-// "__volatile__" COMMA "public" "protected" "private" "operator" "this"
-// "true" "false" OCTALINT LSQUARE TILDE STAR AMPERSAND ELLIPSIS "throw"
-// "using" "case" "default" "if" "else" "switch" "while" "do" "for" "goto"
-// "continue" "break" "return" "try" "asm" "_asm" "__asm" "__asm__" PLUS
-// MINUS PLUSPLUS MINUSMINUS "sizeof" "__alignof__" SCOPE "dynamic_cast"
-// "static_cast" "reinterpret_cast" "const_cast" "typeid" DECIMALINT
-// HEXADECIMALINT
-// CharLiteral WCharLiteral WStringLiteral FLOATONE FLOATTWO NOT "new"
-// "_cdecl" "__cdecl" "_near" "__near" "_far" "__far" "__interrupt" "pascal"
-// "_pascal" "__pascal" "delete"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_80(
- _tokenSet_80_data_, 12);
-const unsigned long CPPParser::_tokenSet_81_data_[] = {
- 263520UL, 3UL, 4125229056UL, 3220176896UL, 2744319UL, 16396UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// LESSTHAN GREATERTHAN SEMICOLON ID ASSIGNEQUAL LPAREN RPAREN COMMA "operator"
-// "this" "true" "false" LSQUARE TILDE STAR AMPERSAND ELLIPSIS TIMESEQUAL
-// DIVIDEEQUAL MINUSEQUAL PLUSEQUAL MODEQUAL SHIFTLEFTEQUAL SHIFTRIGHTEQUAL
-// BITWISEANDEQUAL BITWISEXOREQUAL BITWISEOREQUAL OR AND BITWISEOR BITWISEXOR
-// NOTEQUAL EQUAL LESSTHANOREQUALTO GREATERTHANOREQUALTO SHIFTLEFT SHIFTRIGHT
-// PLUS MINUS DIVIDE MOD POINTERTOMBR PLUSPLUS MINUSMINUS SCOPE POINTERTO
-// NOT "new" "delete"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_81(
- _tokenSet_81_data_, 12);
-const unsigned long CPPParser::_tokenSet_82_data_[] = {
- 4292624320UL, 4294967295UL, 2147680255UL, 2UL, 524288UL, 0UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// GREATERTHAN "typedef" SEMICOLON "enum" ID LCURLY "inline" "friend"
-// ASSIGNEQUAL
-// COLON "extern" "struct" "union" "class" "_stdcall" "__stdcall" "GFEXCLUDE"
-// "GFINCLUDE" "GFID" "GFUNREAD" "GFARRAYSIZE" LPAREN RPAREN "GFARRAYSIZES"
-// "GFARRAYELEMSIZE" "auto" "register" "static" "mutable" "_inline" "__inline"
-// "virtual" "explicit" "typename" "char" "wchar_t" "bool" "short" "int"
-// "_int8" "__int8" "int8_t" "_int16" "__int16" "int16_t" "_int32" "__int32"
-// "int32_t" "_int64" "__int64" "int64_t" "uint8_t" "uint16_t" "uint32_t"
-// "uint64_t" "_w64" "__w64" "long" "signed" "unsigned" "float" "double"
-// "void" "_declspec" "__declspec" "const" "__const" "volatile" "__volatile__"
-// COMMA ELLIPSIS "using" SCOPE
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_82(
- _tokenSet_82_data_, 12);
-const unsigned long CPPParser::_tokenSet_83_data_[] = {
- 4292099968UL, 4294967292UL, 65535UL, 3UL, 524288UL, 0UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// "typedef" SEMICOLON "enum" ID LCURLY "inline" "friend" ASSIGNEQUAL "extern"
-// "struct" "union" "class" "_stdcall" "__stdcall" "GFEXCLUDE" "GFINCLUDE"
-// "GFID" "GFUNREAD" "GFARRAYSIZE" "GFARRAYSIZES" "GFARRAYELEMSIZE" "auto"
-// "register" "static" "mutable" "_inline" "__inline" "virtual" "explicit"
-// "typename" "char" "wchar_t" "bool" "short" "int" "_int8" "__int8" "int8_t"
-// "_int16" "__int16" "int16_t" "_int32" "__int32" "int32_t" "_int64" "__int64"
-// "int64_t" "uint8_t" "uint16_t" "uint32_t" "uint64_t" "_w64" "__w64"
-// "long" "signed" "unsigned" "float" "double" "void" "_declspec" "__declspec"
-// "const" "__const" "volatile" "__volatile__" "throw" "using" SCOPE
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_83(
- _tokenSet_83_data_, 12);
-const unsigned long CPPParser::_tokenSet_84_data_[] = {526336UL, 0UL, 0UL, 0UL,
- 0UL, 0UL, 0UL, 0UL};
-// LCURLY COLON
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_84(
- _tokenSet_84_data_, 8);
-const unsigned long CPPParser::_tokenSet_85_data_[] = {0UL, 1UL, 0UL, 0UL,
- 0UL, 0UL, 0UL, 0UL};
-// LPAREN
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_85(
- _tokenSet_85_data_, 8);
-const unsigned long CPPParser::_tokenSet_86_data_[] = {
- 1024UL, 0UL, 268435456UL, 0UL, 524288UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// ID TILDE SCOPE
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_86(
- _tokenSet_86_data_, 12);
-const unsigned long CPPParser::_tokenSet_87_data_[] = {
- 0UL, 2UL, 2147483648UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// RPAREN ELLIPSIS
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_87(
- _tokenSet_87_data_, 8);
-const unsigned long CPPParser::_tokenSet_88_data_[] = {
- 4292097760UL, 4294967295UL, 4125294591UL, 0UL, 524288UL, 16368UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// LESSTHAN GREATERTHAN "typedef" "enum" ID "inline" "friend" ASSIGNEQUAL
-// "extern" "struct" "union" "class" "_stdcall" "__stdcall" "GFEXCLUDE"
-// "GFINCLUDE" "GFID" "GFUNREAD" "GFARRAYSIZE" LPAREN RPAREN "GFARRAYSIZES"
-// "GFARRAYELEMSIZE" "auto" "register" "static" "mutable" "_inline" "__inline"
-// "virtual" "explicit" "typename" "char" "wchar_t" "bool" "short" "int"
-// "_int8" "__int8" "int8_t" "_int16" "__int16" "int16_t" "_int32" "__int32"
-// "int32_t" "_int64" "__int64" "int64_t" "uint8_t" "uint16_t" "uint32_t"
-// "uint64_t" "_w64" "__w64" "long" "signed" "unsigned" "float" "double"
-// "void" "_declspec" "__declspec" "const" "__const" "volatile" "__volatile__"
-// COMMA "operator" "this" "true" "false" LSQUARE TILDE STAR AMPERSAND
-// ELLIPSIS SCOPE "_cdecl" "__cdecl" "_near" "__near" "_far" "__far"
-// "__interrupt"
-// "pascal" "_pascal" "__pascal"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_88(
- _tokenSet_88_data_, 12);
-const unsigned long CPPParser::_tokenSet_89_data_[] = {
- 100926560UL, 3UL, 4125290496UL, 3220176896UL, 2744319UL, 32764UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// LESSTHAN GREATERTHAN ID ASSIGNEQUAL "_stdcall" "__stdcall" LPAREN RPAREN
-// "const" "__const" "volatile" "__volatile__" COMMA "operator" "this"
-// "true" "false" LSQUARE TILDE STAR AMPERSAND ELLIPSIS TIMESEQUAL DIVIDEEQUAL
-// MINUSEQUAL PLUSEQUAL MODEQUAL SHIFTLEFTEQUAL SHIFTRIGHTEQUAL BITWISEANDEQUAL
-// BITWISEXOREQUAL BITWISEOREQUAL OR AND BITWISEOR BITWISEXOR NOTEQUAL
-// EQUAL LESSTHANOREQUALTO GREATERTHANOREQUALTO SHIFTLEFT SHIFTRIGHT PLUS
-// MINUS DIVIDE MOD POINTERTOMBR PLUSPLUS MINUSMINUS SCOPE POINTERTO NOT
-// "new" "_cdecl" "__cdecl" "_near" "__near" "_far" "__far" "__interrupt"
-// "pascal" "_pascal" "__pascal" "delete"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_89(
- _tokenSet_89_data_, 12);
-const unsigned long CPPParser::_tokenSet_90_data_[] = {
- 100926528UL, 3UL, 3825336320UL, 0UL, 524288UL, 16368UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// GREATERTHAN ID ASSIGNEQUAL "_stdcall" "__stdcall" LPAREN RPAREN COMMA
-// LSQUARE STAR AMPERSAND ELLIPSIS SCOPE "_cdecl" "__cdecl" "_near" "__near"
-// "_far" "__far" "__interrupt" "pascal" "_pascal" "__pascal"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_90(
- _tokenSet_90_data_, 12);
-const unsigned long CPPParser::_tokenSet_91_data_[] = {
- 4294721520UL, 4294967295UL, 4293066751UL, 3UL, 4291790336UL, 32767UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// "template" LESSTHAN GREATERTHAN "typedef" SEMICOLON "enum" ID LCURLY
-// "inline" "friend" ASSIGNEQUAL COLON "extern" StringLiteral "struct"
-// "union" "class" "_stdcall" "__stdcall" "GFEXCLUDE" "GFINCLUDE" "GFID"
-// "GFUNREAD" "GFARRAYSIZE" LPAREN RPAREN "GFARRAYSIZES" "GFARRAYELEMSIZE"
-// "auto" "register" "static" "mutable" "_inline" "__inline" "virtual"
-// "explicit" "typename" "char" "wchar_t" "bool" "short" "int" "_int8"
-// "__int8" "int8_t" "_int16" "__int16" "int16_t" "_int32" "__int32" "int32_t"
-// "_int64" "__int64" "int64_t" "uint8_t" "uint16_t" "uint32_t" "uint64_t"
-// "_w64" "__w64" "long" "signed" "unsigned" "float" "double" "void" "_declspec"
-// "__declspec" "const" "__const" "volatile" "__volatile__" COMMA "operator"
-// "this" "true" "false" OCTALINT LSQUARE RSQUARE TILDE STAR AMPERSAND
-// ELLIPSIS "throw" "using" PLUS MINUS PLUSPLUS MINUSMINUS "sizeof"
-// "__alignof__"
-// SCOPE "dynamic_cast" "static_cast" "reinterpret_cast" "const_cast" "typeid"
-// DECIMALINT HEXADECIMALINT CharLiteral WCharLiteral WStringLiteral FLOATONE
-// FLOATTWO NOT "new" "_cdecl" "__cdecl" "_near" "__near" "_far" "__far"
-// "__interrupt" "pascal" "_pascal" "__pascal" "delete"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_91(
- _tokenSet_91_data_, 12);
-const unsigned long CPPParser::_tokenSet_92_data_[] = {
- 64UL, 2UL, 2147614720UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// GREATERTHAN RPAREN COMMA ELLIPSIS
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_92(
- _tokenSet_92_data_, 8);
-const unsigned long CPPParser::_tokenSet_93_data_[] = {
- 262208UL, 3UL, 2214723584UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// GREATERTHAN ASSIGNEQUAL LPAREN RPAREN COMMA LSQUARE ELLIPSIS
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_93(
- _tokenSet_93_data_, 8);
-const unsigned long CPPParser::_tokenSet_94_data_[] = {
- 4294852594UL, 4294967295UL, 4293066751UL, 4293918723UL,
- 4291821567UL, 32767UL, 0UL, 0UL,
- 0UL, 0UL, 0UL, 0UL};
-// EOF "template" LESSTHAN GREATERTHAN "typedef" SEMICOLON "enum" ID LCURLY
-// "inline" "friend" RCURLY ASSIGNEQUAL COLON "extern" StringLiteral "struct"
-// "union" "class" "_stdcall" "__stdcall" "GFEXCLUDE" "GFINCLUDE" "GFID"
-// "GFUNREAD" "GFARRAYSIZE" LPAREN RPAREN "GFARRAYSIZES" "GFARRAYELEMSIZE"
-// "auto" "register" "static" "mutable" "_inline" "__inline" "virtual"
-// "explicit" "typename" "char" "wchar_t" "bool" "short" "int" "_int8"
-// "__int8" "int8_t" "_int16" "__int16" "int16_t" "_int32" "__int32" "int32_t"
-// "_int64" "__int64" "int64_t" "uint8_t" "uint16_t" "uint32_t" "uint64_t"
-// "_w64" "__w64" "long" "signed" "unsigned" "float" "double" "void" "_declspec"
-// "__declspec" "const" "__const" "volatile" "__volatile__" COMMA "operator"
-// "this" "true" "false" OCTALINT LSQUARE RSQUARE TILDE STAR AMPERSAND
-// ELLIPSIS "throw" "using" TIMESEQUAL DIVIDEEQUAL MINUSEQUAL PLUSEQUAL
-// MODEQUAL SHIFTLEFTEQUAL SHIFTRIGHTEQUAL BITWISEANDEQUAL BITWISEXOREQUAL
-// BITWISEOREQUAL QUESTIONMARK OR AND BITWISEOR BITWISEXOR NOTEQUAL EQUAL
-// LESSTHANOREQUALTO GREATERTHANOREQUALTO SHIFTLEFT SHIFTRIGHT PLUS MINUS
-// DIVIDE MOD DOTMBR POINTERTOMBR PLUSPLUS MINUSMINUS "sizeof" "__alignof__"
-// SCOPE "dynamic_cast" "static_cast" "reinterpret_cast" "const_cast" "typeid"
-// DECIMALINT HEXADECIMALINT CharLiteral WCharLiteral WStringLiteral FLOATONE
-// FLOATTWO NOT "new" "_cdecl" "__cdecl" "_near" "__near" "_far" "__far"
-// "__interrupt" "pascal" "_pascal" "__pascal" "delete"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_94(
- _tokenSet_94_data_, 12);
-const unsigned long CPPParser::_tokenSet_95_data_[] = {
- 262208UL, 2UL, 2147614720UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// GREATERTHAN ASSIGNEQUAL RPAREN COMMA ELLIPSIS
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_95(
- _tokenSet_95_data_, 8);
-const unsigned long CPPParser::_tokenSet_96_data_[] = {
- 64UL, 2UL, 131072UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// GREATERTHAN RPAREN COMMA
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_96(
- _tokenSet_96_data_, 8);
-const unsigned long CPPParser::_tokenSet_97_data_[] = {
- 101582176UL, 3UL, 4259446784UL, 4293918721UL, 557055UL, 16368UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// LESSTHAN GREATERTHAN SEMICOLON ID RCURLY ASSIGNEQUAL COLON "_stdcall"
-// "__stdcall" LPAREN RPAREN COMMA "operator" "this" "true" "false" LSQUARE
-// RSQUARE TILDE STAR AMPERSAND ELLIPSIS "throw" TIMESEQUAL DIVIDEEQUAL
-// MINUSEQUAL PLUSEQUAL MODEQUAL SHIFTLEFTEQUAL SHIFTRIGHTEQUAL BITWISEANDEQUAL
-// BITWISEXOREQUAL BITWISEOREQUAL QUESTIONMARK OR AND BITWISEOR BITWISEXOR
-// NOTEQUAL EQUAL LESSTHANOREQUALTO GREATERTHANOREQUALTO SHIFTLEFT SHIFTRIGHT
-// PLUS MINUS DIVIDE MOD DOTMBR POINTERTOMBR SCOPE "_cdecl" "__cdecl" "_near"
-// "__near" "_far" "__far" "__interrupt" "pascal" "_pascal" "__pascal"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_97(
- _tokenSet_97_data_, 12);
-const unsigned long CPPParser::_tokenSet_98_data_[] = {
- 16777232UL, 4096UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// "template" "class" "typename"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_98(
- _tokenSet_98_data_, 8);
-const unsigned long CPPParser::_tokenSet_99_data_[] = {
- 1120UL, 0UL, 131072UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// LESSTHAN GREATERTHAN ID COMMA
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_99(
- _tokenSet_99_data_, 8);
-const unsigned long CPPParser::_tokenSet_100_data_[] = {
- 4291835520UL, 4294967293UL, 4058054655UL, 0UL, 524288UL, 16368UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// "typedef" "enum" ID "inline" "friend" "extern" "struct" "union" "class"
-// "_stdcall" "__stdcall" "GFEXCLUDE" "GFINCLUDE" "GFID" "GFUNREAD"
-// "GFARRAYSIZE"
-// LPAREN "GFARRAYSIZES" "GFARRAYELEMSIZE" "auto" "register" "static" "mutable"
-// "_inline" "__inline" "virtual" "explicit" "typename" "char" "wchar_t"
-// "bool" "short" "int" "_int8" "__int8" "int8_t" "_int16" "__int16" "int16_t"
-// "_int32" "__int32" "int32_t" "_int64" "__int64" "int64_t" "uint8_t"
-// "uint16_t" "uint32_t" "uint64_t" "_w64" "__w64" "long" "signed" "unsigned"
-// "float" "double" "void" "_declspec" "__declspec" "const" "__const" "volatile"
-// "__volatile__" "operator" "this" "true" "false" TILDE STAR AMPERSAND
-// ELLIPSIS SCOPE "_cdecl" "__cdecl" "_near" "__near" "_far" "__far"
-// "__interrupt"
-// "pascal" "_pascal" "__pascal"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_100(
- _tokenSet_100_data_, 12);
-const unsigned long CPPParser::_tokenSet_101_data_[] = {
- 64UL, 0UL, 131072UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// GREATERTHAN COMMA
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_101(
- _tokenSet_101_data_, 8);
-const unsigned long CPPParser::_tokenSet_102_data_[] = {
- 100664416UL, 1UL, 1677852672UL, 0UL, 524288UL, 16368UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// LESSTHAN GREATERTHAN ID "_stdcall" "__stdcall" LPAREN COMMA LSQUARE
-// STAR AMPERSAND SCOPE "_cdecl" "__cdecl" "_near" "__near" "_far" "__far"
-// "__interrupt" "pascal" "_pascal" "__pascal"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_102(
- _tokenSet_102_data_, 12);
-const unsigned long CPPParser::_tokenSet_103_data_[] = {
- 1024UL, 4294963200UL, 4095UL, 0UL, 524288UL, 0UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// ID "typename" "char" "wchar_t" "bool" "short" "int" "_int8" "__int8"
-// "int8_t" "_int16" "__int16" "int16_t" "_int32" "__int32" "int32_t" "_int64"
-// "__int64" "int64_t" "uint8_t" "uint16_t" "uint32_t" "uint64_t" "_w64"
-// "__w64" "long" "signed" "unsigned" "float" "double" "void" "_declspec"
-// "__declspec" SCOPE
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_103(
- _tokenSet_103_data_, 12);
-const unsigned long CPPParser::_tokenSet_104_data_[] = {
- 100664416UL, 4294959105UL, 1677856767UL, 0UL, 524288UL, 16368UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// LESSTHAN GREATERTHAN ID "_stdcall" "__stdcall" LPAREN "char" "wchar_t"
-// "bool" "short" "int" "_int8" "__int8" "int8_t" "_int16" "__int16" "int16_t"
-// "_int32" "__int32" "int32_t" "_int64" "__int64" "int64_t" "uint8_t"
-// "uint16_t" "uint32_t" "uint64_t" "_w64" "__w64" "long" "signed" "unsigned"
-// "float" "double" "void" "_declspec" "__declspec" COMMA LSQUARE STAR
-// AMPERSAND SCOPE "_cdecl" "__cdecl" "_near" "__near" "_far" "__far"
-// "__interrupt"
-// "pascal" "_pascal" "__pascal"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_104(
- _tokenSet_104_data_, 12);
-const unsigned long CPPParser::_tokenSet_105_data_[] = {
- 4291835616UL, 4294967293UL, 1677918207UL, 0UL, 524288UL, 16368UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// LESSTHAN GREATERTHAN "typedef" "enum" ID "inline" "friend" "extern"
-// "struct" "union" "class" "_stdcall" "__stdcall" "GFEXCLUDE" "GFINCLUDE"
-// "GFID" "GFUNREAD" "GFARRAYSIZE" LPAREN "GFARRAYSIZES" "GFARRAYELEMSIZE"
-// "auto" "register" "static" "mutable" "_inline" "__inline" "virtual"
-// "explicit" "typename" "char" "wchar_t" "bool" "short" "int" "_int8"
-// "__int8" "int8_t" "_int16" "__int16" "int16_t" "_int32" "__int32" "int32_t"
-// "_int64" "__int64" "int64_t" "uint8_t" "uint16_t" "uint32_t" "uint64_t"
-// "_w64" "__w64" "long" "signed" "unsigned" "float" "double" "void" "_declspec"
-// "__declspec" "const" "__const" "volatile" "__volatile__" COMMA LSQUARE
-// STAR AMPERSAND SCOPE "_cdecl" "__cdecl" "_near" "__near" "_far" "__far"
-// "__interrupt" "pascal" "_pascal" "__pascal"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_105(
- _tokenSet_105_data_, 12);
-const unsigned long CPPParser::_tokenSet_106_data_[] = {
- 4294194912UL, 4294967293UL, 2011365375UL, 3220176896UL,
- 4294967295UL, 16399UL, 0UL, 0UL,
- 0UL, 0UL, 0UL, 0UL};
-// LESSTHAN GREATERTHAN "typedef" "enum" ID "inline" "friend" ASSIGNEQUAL
-// "extern" StringLiteral "struct" "union" "class" "_stdcall" "__stdcall"
-// "GFEXCLUDE" "GFINCLUDE" "GFID" "GFUNREAD" "GFARRAYSIZE" LPAREN "GFARRAYSIZES"
-// "GFARRAYELEMSIZE" "auto" "register" "static" "mutable" "_inline" "__inline"
-// "virtual" "explicit" "typename" "char" "wchar_t" "bool" "short" "int"
-// "_int8" "__int8" "int8_t" "_int16" "__int16" "int16_t" "_int32" "__int32"
-// "int32_t" "_int64" "__int64" "int64_t" "uint8_t" "uint16_t" "uint32_t"
-// "uint64_t" "_w64" "__w64" "long" "signed" "unsigned" "float" "double"
-// "void" "_declspec" "__declspec" "const" "__const" "volatile" "__volatile__"
-// COMMA "operator" "this" "true" "false" OCTALINT LSQUARE TILDE STAR AMPERSAND
-// TIMESEQUAL DIVIDEEQUAL MINUSEQUAL PLUSEQUAL MODEQUAL SHIFTLEFTEQUAL
-// SHIFTRIGHTEQUAL BITWISEANDEQUAL BITWISEXOREQUAL BITWISEOREQUAL OR AND
-// BITWISEOR BITWISEXOR NOTEQUAL EQUAL LESSTHANOREQUALTO GREATERTHANOREQUALTO
-// SHIFTLEFT SHIFTRIGHT PLUS MINUS DIVIDE MOD DOTMBR POINTERTOMBR PLUSPLUS
-// MINUSMINUS "sizeof" "__alignof__" SCOPE DOT POINTERTO "dynamic_cast"
-// "static_cast" "reinterpret_cast" "const_cast" "typeid" DECIMALINT
-// HEXADECIMALINT
-// CharLiteral WCharLiteral WStringLiteral FLOATONE FLOATTWO NOT "new"
-// "delete"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_106(
- _tokenSet_106_data_, 12);
-const unsigned long CPPParser::_tokenSet_107_data_[] = {
- 917856UL, 2UL, 3355574272UL, 4293918720UL, 127UL, 0UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// LESSTHAN GREATERTHAN SEMICOLON RCURLY ASSIGNEQUAL COLON RPAREN COMMA
-// RSQUARE AMPERSAND ELLIPSIS TIMESEQUAL DIVIDEEQUAL MINUSEQUAL PLUSEQUAL
-// MODEQUAL SHIFTLEFTEQUAL SHIFTRIGHTEQUAL BITWISEANDEQUAL BITWISEXOREQUAL
-// BITWISEOREQUAL QUESTIONMARK OR AND BITWISEOR BITWISEXOR NOTEQUAL EQUAL
-// LESSTHANOREQUALTO GREATERTHANOREQUALTO
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_107(
- _tokenSet_107_data_, 12);
-const unsigned long CPPParser::_tokenSet_108_data_[] = {
- 4291851904UL, 4294967292UL, 65535UL, 983042UL, 524288UL, 0UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// "typedef" "enum" ID "inline" "friend" "namespace" "extern" "struct"
-// "union" "class" "_stdcall" "__stdcall" "GFEXCLUDE" "GFINCLUDE" "GFID"
-// "GFUNREAD" "GFARRAYSIZE" "GFARRAYSIZES" "GFARRAYELEMSIZE" "auto" "register"
-// "static" "mutable" "_inline" "__inline" "virtual" "explicit" "typename"
-// "char" "wchar_t" "bool" "short" "int" "_int8" "__int8" "int8_t" "_int16"
-// "__int16" "int16_t" "_int32" "__int32" "int32_t" "_int64" "__int64"
-// "int64_t" "uint8_t" "uint16_t" "uint32_t" "uint64_t" "_w64" "__w64"
-// "long" "signed" "unsigned" "float" "double" "void" "_declspec" "__declspec"
-// "const" "__const" "volatile" "__volatile__" "using" "asm" "_asm" "__asm"
-// "__asm__" SCOPE
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_108(
- _tokenSet_108_data_, 12);
-const unsigned long CPPParser::_tokenSet_109_data_[] = {
- 4291852192UL, 4294967293UL, 1910571007UL, 0UL, 524288UL, 16368UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// LESSTHAN "typedef" SEMICOLON "enum" ID "inline" "friend" "namespace"
-// "extern" "struct" "union" "class" "_stdcall" "__stdcall" "GFEXCLUDE"
-// "GFINCLUDE" "GFID" "GFUNREAD" "GFARRAYSIZE" LPAREN "GFARRAYSIZES"
-// "GFARRAYELEMSIZE"
-// "auto" "register" "static" "mutable" "_inline" "__inline" "virtual"
-// "explicit" "typename" "char" "wchar_t" "bool" "short" "int" "_int8"
-// "__int8" "int8_t" "_int16" "__int16" "int16_t" "_int32" "__int32" "int32_t"
-// "_int64" "__int64" "int64_t" "uint8_t" "uint16_t" "uint32_t" "uint64_t"
-// "_w64" "__w64" "long" "signed" "unsigned" "float" "double" "void" "_declspec"
-// "__declspec" "const" "__const" "volatile" "__volatile__" "operator"
-// "this" "true" "false" TILDE STAR AMPERSAND SCOPE "_cdecl" "__cdecl"
-// "_near" "__near" "_far" "__far" "__interrupt" "pascal" "_pascal" "__pascal"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_109(
- _tokenSet_109_data_, 12);
-const unsigned long CPPParser::_tokenSet_110_data_[] = {
- 4294967280UL, 4294967293UL, 2013265919UL, 3221192703UL,
- 4293910527UL, 32767UL, 0UL, 0UL,
- 0UL, 0UL, 0UL, 0UL};
-// "template" LESSTHAN GREATERTHAN "typedef" SEMICOLON "enum" ID LCURLY
-// "inline" "friend" "namespace" "antlrTrace_on" "antlrTrace_off" RCURLY
-// ASSIGNEQUAL COLON "extern" StringLiteral "struct" "union" "class" "_stdcall"
-// "__stdcall" "GFEXCLUDE" "GFINCLUDE" "GFID" "GFUNREAD" "GFARRAYSIZE"
-// LPAREN "GFARRAYSIZES" "GFARRAYELEMSIZE" "auto" "register" "static" "mutable"
-// "_inline" "__inline" "virtual" "explicit" "typename" "char" "wchar_t"
-// "bool" "short" "int" "_int8" "__int8" "int8_t" "_int16" "__int16" "int16_t"
-// "_int32" "__int32" "int32_t" "_int64" "__int64" "int64_t" "uint8_t"
-// "uint16_t" "uint32_t" "uint64_t" "_w64" "__w64" "long" "signed" "unsigned"
-// "float" "double" "void" "_declspec" "__declspec" "const" "__const" "volatile"
-// "__volatile__" "GFIGNORE" COMMA "public" "protected" "private" "operator"
-// "this" "true" "false" OCTALINT LSQUARE TILDE STAR AMPERSAND "throw"
-// "using" "case" "default" "if" "else" "switch" "while" "do" "for" "goto"
-// "continue" "break" "return" "try" "asm" "_asm" "__asm" "__asm__" TIMESEQUAL
-// DIVIDEEQUAL MINUSEQUAL PLUSEQUAL MODEQUAL SHIFTLEFTEQUAL SHIFTRIGHTEQUAL
-// BITWISEANDEQUAL BITWISEXOREQUAL BITWISEOREQUAL OR AND BITWISEOR BITWISEXOR
-// NOTEQUAL EQUAL LESSTHANOREQUALTO GREATERTHANOREQUALTO SHIFTLEFT SHIFTRIGHT
-// PLUS MINUS DIVIDE MOD POINTERTOMBR PLUSPLUS MINUSMINUS "sizeof" "__alignof__"
-// SCOPE POINTERTO "dynamic_cast" "static_cast" "reinterpret_cast" "const_cast"
-// "typeid" DECIMALINT HEXADECIMALINT CharLiteral WCharLiteral WStringLiteral
-// FLOATONE FLOATTWO NOT "new" "_cdecl" "__cdecl" "_near" "__near" "_far"
-// "__far" "__interrupt" "pascal" "_pascal" "__pascal" "delete"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_110(
- _tokenSet_110_data_, 12);
-const unsigned long CPPParser::_tokenSet_111_data_[] = {
- 1056UL, 0UL, 568389632UL, 0UL, 524288UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// LESSTHAN ID "const" "__const" "volatile" "__volatile__" "operator" "this"
-// "true" "false" STAR SCOPE
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_111(
- _tokenSet_111_data_, 12);
-const unsigned long CPPParser::_tokenSet_112_data_[] = {
- 4294195168UL, 4294967293UL, 2011365375UL, 4293918720UL,
- 4294967295UL, 16399UL, 0UL, 0UL,
- 0UL, 0UL, 0UL, 0UL};
-// LESSTHAN GREATERTHAN "typedef" SEMICOLON "enum" ID "inline" "friend"
-// ASSIGNEQUAL "extern" StringLiteral "struct" "union" "class" "_stdcall"
-// "__stdcall" "GFEXCLUDE" "GFINCLUDE" "GFID" "GFUNREAD" "GFARRAYSIZE"
-// LPAREN "GFARRAYSIZES" "GFARRAYELEMSIZE" "auto" "register" "static" "mutable"
-// "_inline" "__inline" "virtual" "explicit" "typename" "char" "wchar_t"
-// "bool" "short" "int" "_int8" "__int8" "int8_t" "_int16" "__int16" "int16_t"
-// "_int32" "__int32" "int32_t" "_int64" "__int64" "int64_t" "uint8_t"
-// "uint16_t" "uint32_t" "uint64_t" "_w64" "__w64" "long" "signed" "unsigned"
-// "float" "double" "void" "_declspec" "__declspec" "const" "__const" "volatile"
-// "__volatile__" COMMA "operator" "this" "true" "false" OCTALINT LSQUARE
-// TILDE STAR AMPERSAND TIMESEQUAL DIVIDEEQUAL MINUSEQUAL PLUSEQUAL MODEQUAL
-// SHIFTLEFTEQUAL SHIFTRIGHTEQUAL BITWISEANDEQUAL BITWISEXOREQUAL BITWISEOREQUAL
-// QUESTIONMARK OR AND BITWISEOR BITWISEXOR NOTEQUAL EQUAL LESSTHANOREQUALTO
-// GREATERTHANOREQUALTO SHIFTLEFT SHIFTRIGHT PLUS MINUS DIVIDE MOD DOTMBR
-// POINTERTOMBR PLUSPLUS MINUSMINUS "sizeof" "__alignof__" SCOPE DOT POINTERTO
-// "dynamic_cast" "static_cast" "reinterpret_cast" "const_cast" "typeid"
-// DECIMALINT HEXADECIMALINT CharLiteral WCharLiteral WStringLiteral FLOATONE
-// FLOATTWO NOT "new" "delete"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_112(
- _tokenSet_112_data_, 12);
-const unsigned long CPPParser::_tokenSet_113_data_[] = {
- 4294967282UL, 4294967293UL, 2013265919UL, 4294967295UL,
- 4294967295UL, 32767UL, 0UL, 0UL,
- 0UL, 0UL, 0UL, 0UL};
-// EOF "template" LESSTHAN GREATERTHAN "typedef" SEMICOLON "enum" ID LCURLY
-// "inline" "friend" "namespace" "antlrTrace_on" "antlrTrace_off" RCURLY
-// ASSIGNEQUAL COLON "extern" StringLiteral "struct" "union" "class" "_stdcall"
-// "__stdcall" "GFEXCLUDE" "GFINCLUDE" "GFID" "GFUNREAD" "GFARRAYSIZE"
-// LPAREN "GFARRAYSIZES" "GFARRAYELEMSIZE" "auto" "register" "static" "mutable"
-// "_inline" "__inline" "virtual" "explicit" "typename" "char" "wchar_t"
-// "bool" "short" "int" "_int8" "__int8" "int8_t" "_int16" "__int16" "int16_t"
-// "_int32" "__int32" "int32_t" "_int64" "__int64" "int64_t" "uint8_t"
-// "uint16_t" "uint32_t" "uint64_t" "_w64" "__w64" "long" "signed" "unsigned"
-// "float" "double" "void" "_declspec" "__declspec" "const" "__const" "volatile"
-// "__volatile__" "GFIGNORE" COMMA "public" "protected" "private" "operator"
-// "this" "true" "false" OCTALINT LSQUARE TILDE STAR AMPERSAND "throw"
-// "using" "case" "default" "if" "else" "switch" "while" "do" "for" "goto"
-// "continue" "break" "return" "try" "catch" "asm" "_asm" "__asm" "__asm__"
-// TIMESEQUAL DIVIDEEQUAL MINUSEQUAL PLUSEQUAL MODEQUAL SHIFTLEFTEQUAL
-// SHIFTRIGHTEQUAL BITWISEANDEQUAL BITWISEXOREQUAL BITWISEOREQUAL QUESTIONMARK
-// OR AND BITWISEOR BITWISEXOR NOTEQUAL EQUAL LESSTHANOREQUALTO
-// GREATERTHANOREQUALTO
-// SHIFTLEFT SHIFTRIGHT PLUS MINUS DIVIDE MOD DOTMBR POINTERTOMBR PLUSPLUS
-// MINUSMINUS "sizeof" "__alignof__" SCOPE DOT POINTERTO "dynamic_cast"
-// "static_cast" "reinterpret_cast" "const_cast" "typeid" DECIMALINT
-// HEXADECIMALINT
-// CharLiteral WCharLiteral WStringLiteral FLOATONE FLOATTWO NOT "new"
-// "_cdecl" "__cdecl" "_near" "__near" "_far" "__far" "__interrupt" "pascal"
-// "_pascal" "__pascal" "delete"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_113(
- _tokenSet_113_data_, 12);
-const unsigned long CPPParser::_tokenSet_114_data_[] = {
- 4294180752UL, 4294967293UL, 1945960447UL, 1048575UL, 4291790336UL, 32767UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// "template" "typedef" SEMICOLON "enum" ID LCURLY "inline" "friend" "namespace"
-// "antlrTrace_on" "antlrTrace_off" RCURLY "extern" StringLiteral "struct"
-// "union" "class" "_stdcall" "__stdcall" "GFEXCLUDE" "GFINCLUDE" "GFID"
-// "GFUNREAD" "GFARRAYSIZE" LPAREN "GFARRAYSIZES" "GFARRAYELEMSIZE" "auto"
-// "register" "static" "mutable" "_inline" "__inline" "virtual" "explicit"
-// "typename" "char" "wchar_t" "bool" "short" "int" "_int8" "__int8" "int8_t"
-// "_int16" "__int16" "int16_t" "_int32" "__int32" "int32_t" "_int64" "__int64"
-// "int64_t" "uint8_t" "uint16_t" "uint32_t" "uint64_t" "_w64" "__w64"
-// "long" "signed" "unsigned" "float" "double" "void" "_declspec" "__declspec"
-// "const" "__const" "volatile" "__volatile__" "public" "protected" "private"
-// "operator" "this" "true" "false" OCTALINT TILDE STAR AMPERSAND "throw"
-// "using" "case" "default" "if" "else" "switch" "while" "do" "for" "goto"
-// "continue" "break" "return" "try" "catch" "asm" "_asm" "__asm" "__asm__"
-// PLUS MINUS PLUSPLUS MINUSMINUS "sizeof" "__alignof__" SCOPE "dynamic_cast"
-// "static_cast" "reinterpret_cast" "const_cast" "typeid" DECIMALINT
-// HEXADECIMALINT
-// CharLiteral WCharLiteral WStringLiteral FLOATONE FLOATTWO NOT "new"
-// "_cdecl" "__cdecl" "_near" "__near" "_far" "__far" "__interrupt" "pascal"
-// "_pascal" "__pascal" "delete"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_114(
- _tokenSet_114_data_, 12);
-const unsigned long CPPParser::_tokenSet_115_data_[] = {
- 917824UL, 2UL, 2281832448UL, 1072693248UL, 0UL, 0UL, 0UL, 0UL};
-// GREATERTHAN SEMICOLON RCURLY ASSIGNEQUAL COLON RPAREN COMMA RSQUARE
-// ELLIPSIS TIMESEQUAL DIVIDEEQUAL MINUSEQUAL PLUSEQUAL MODEQUAL SHIFTLEFTEQUAL
-// SHIFTRIGHTEQUAL BITWISEANDEQUAL BITWISEXOREQUAL BITWISEOREQUAL
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_115(
- _tokenSet_115_data_, 8);
-const unsigned long CPPParser::_tokenSet_116_data_[] = {
- 917824UL, 2UL, 2281832448UL, 2146435072UL, 0UL, 0UL, 0UL, 0UL};
-// GREATERTHAN SEMICOLON RCURLY ASSIGNEQUAL COLON RPAREN COMMA RSQUARE
-// ELLIPSIS TIMESEQUAL DIVIDEEQUAL MINUSEQUAL PLUSEQUAL MODEQUAL SHIFTLEFTEQUAL
-// SHIFTRIGHTEQUAL BITWISEANDEQUAL BITWISEXOREQUAL BITWISEOREQUAL QUESTIONMARK
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_116(
- _tokenSet_116_data_, 8);
-const unsigned long CPPParser::_tokenSet_117_data_[] = {
- 917824UL, 2UL, 2281832448UL, 4293918720UL, 0UL, 0UL, 0UL, 0UL};
-// GREATERTHAN SEMICOLON RCURLY ASSIGNEQUAL COLON RPAREN COMMA RSQUARE
-// ELLIPSIS TIMESEQUAL DIVIDEEQUAL MINUSEQUAL PLUSEQUAL MODEQUAL SHIFTLEFTEQUAL
-// SHIFTRIGHTEQUAL BITWISEANDEQUAL BITWISEXOREQUAL BITWISEOREQUAL QUESTIONMARK
-// OR
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_117(
- _tokenSet_117_data_, 8);
-const unsigned long CPPParser::_tokenSet_118_data_[] = {
- 917824UL, 2UL, 2281832448UL, 4293918720UL, 1UL, 0UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// GREATERTHAN SEMICOLON RCURLY ASSIGNEQUAL COLON RPAREN COMMA RSQUARE
-// ELLIPSIS TIMESEQUAL DIVIDEEQUAL MINUSEQUAL PLUSEQUAL MODEQUAL SHIFTLEFTEQUAL
-// SHIFTRIGHTEQUAL BITWISEANDEQUAL BITWISEXOREQUAL BITWISEOREQUAL QUESTIONMARK
-// OR AND
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_118(
- _tokenSet_118_data_, 12);
-const unsigned long CPPParser::_tokenSet_119_data_[] = {
- 917824UL, 2UL, 2281832448UL, 4293918720UL, 3UL, 0UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// GREATERTHAN SEMICOLON RCURLY ASSIGNEQUAL COLON RPAREN COMMA RSQUARE
-// ELLIPSIS TIMESEQUAL DIVIDEEQUAL MINUSEQUAL PLUSEQUAL MODEQUAL SHIFTLEFTEQUAL
-// SHIFTRIGHTEQUAL BITWISEANDEQUAL BITWISEXOREQUAL BITWISEOREQUAL QUESTIONMARK
-// OR AND BITWISEOR
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_119(
- _tokenSet_119_data_, 12);
-const unsigned long CPPParser::_tokenSet_120_data_[] = {
- 917824UL, 2UL, 2281832448UL, 4293918720UL, 7UL, 0UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// GREATERTHAN SEMICOLON RCURLY ASSIGNEQUAL COLON RPAREN COMMA RSQUARE
-// ELLIPSIS TIMESEQUAL DIVIDEEQUAL MINUSEQUAL PLUSEQUAL MODEQUAL SHIFTLEFTEQUAL
-// SHIFTRIGHTEQUAL BITWISEANDEQUAL BITWISEXOREQUAL BITWISEOREQUAL QUESTIONMARK
-// OR AND BITWISEOR BITWISEXOR
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_120(
- _tokenSet_120_data_, 12);
-const unsigned long CPPParser::_tokenSet_121_data_[] = {
- 917824UL, 2UL, 3355574272UL, 4293918720UL, 7UL, 0UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// GREATERTHAN SEMICOLON RCURLY ASSIGNEQUAL COLON RPAREN COMMA RSQUARE
-// AMPERSAND ELLIPSIS TIMESEQUAL DIVIDEEQUAL MINUSEQUAL PLUSEQUAL MODEQUAL
-// SHIFTLEFTEQUAL SHIFTRIGHTEQUAL BITWISEANDEQUAL BITWISEXOREQUAL BITWISEOREQUAL
-// QUESTIONMARK OR AND BITWISEOR BITWISEXOR
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_121(
- _tokenSet_121_data_, 12);
-const unsigned long CPPParser::_tokenSet_122_data_[] = {
- 96UL, 0UL, 0UL, 0UL, 96UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// LESSTHAN GREATERTHAN LESSTHANOREQUALTO GREATERTHANOREQUALTO
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_122(
- _tokenSet_122_data_, 12);
-const unsigned long CPPParser::_tokenSet_123_data_[] = {
- 917824UL, 2UL, 3355574272UL, 4293918720UL, 31UL, 0UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// GREATERTHAN SEMICOLON RCURLY ASSIGNEQUAL COLON RPAREN COMMA RSQUARE
-// AMPERSAND ELLIPSIS TIMESEQUAL DIVIDEEQUAL MINUSEQUAL PLUSEQUAL MODEQUAL
-// SHIFTLEFTEQUAL SHIFTRIGHTEQUAL BITWISEANDEQUAL BITWISEXOREQUAL BITWISEOREQUAL
-// QUESTIONMARK OR AND BITWISEOR BITWISEXOR NOTEQUAL EQUAL
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_123(
- _tokenSet_123_data_, 12);
-const unsigned long CPPParser::_tokenSet_124_data_[] = {
- 917856UL, 2UL, 3355574272UL, 4293918720UL, 511UL, 0UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// LESSTHAN GREATERTHAN SEMICOLON RCURLY ASSIGNEQUAL COLON RPAREN COMMA
-// RSQUARE AMPERSAND ELLIPSIS TIMESEQUAL DIVIDEEQUAL MINUSEQUAL PLUSEQUAL
-// MODEQUAL SHIFTLEFTEQUAL SHIFTRIGHTEQUAL BITWISEANDEQUAL BITWISEXOREQUAL
-// BITWISEOREQUAL QUESTIONMARK OR AND BITWISEOR BITWISEXOR NOTEQUAL EQUAL
-// LESSTHANOREQUALTO GREATERTHANOREQUALTO SHIFTLEFT SHIFTRIGHT
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_124(
- _tokenSet_124_data_, 12);
-const unsigned long CPPParser::_tokenSet_125_data_[] = {
- 0UL, 0UL, 536870912UL, 0UL, 6144UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// STAR DIVIDE MOD
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_125(
- _tokenSet_125_data_, 12);
-const unsigned long CPPParser::_tokenSet_126_data_[] = {
- 917856UL, 2UL, 3355574272UL, 4293918720UL, 2047UL, 0UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// LESSTHAN GREATERTHAN SEMICOLON RCURLY ASSIGNEQUAL COLON RPAREN COMMA
-// RSQUARE AMPERSAND ELLIPSIS TIMESEQUAL DIVIDEEQUAL MINUSEQUAL PLUSEQUAL
-// MODEQUAL SHIFTLEFTEQUAL SHIFTRIGHTEQUAL BITWISEANDEQUAL BITWISEXOREQUAL
-// BITWISEOREQUAL QUESTIONMARK OR AND BITWISEOR BITWISEXOR NOTEQUAL EQUAL
-// LESSTHANOREQUALTO GREATERTHANOREQUALTO SHIFTLEFT SHIFTRIGHT PLUS MINUS
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_126(
- _tokenSet_126_data_, 12);
-const unsigned long CPPParser::_tokenSet_127_data_[] = {
- 917856UL, 2UL, 3892445184UL, 4293918720UL, 8191UL, 0UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// LESSTHAN GREATERTHAN SEMICOLON RCURLY ASSIGNEQUAL COLON RPAREN COMMA
-// RSQUARE STAR AMPERSAND ELLIPSIS TIMESEQUAL DIVIDEEQUAL MINUSEQUAL PLUSEQUAL
-// MODEQUAL SHIFTLEFTEQUAL SHIFTRIGHTEQUAL BITWISEANDEQUAL BITWISEXOREQUAL
-// BITWISEOREQUAL QUESTIONMARK OR AND BITWISEOR BITWISEXOR NOTEQUAL EQUAL
-// LESSTHANOREQUALTO GREATERTHANOREQUALTO SHIFTLEFT SHIFTRIGHT PLUS MINUS
-// DIVIDE MOD
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_127(
- _tokenSet_127_data_, 12);
-const unsigned long CPPParser::_tokenSet_128_data_[] = {
- 1024UL, 4294963200UL, 65535UL, 0UL, 524288UL, 0UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// ID "typename" "char" "wchar_t" "bool" "short" "int" "_int8" "__int8"
-// "int8_t" "_int16" "__int16" "int16_t" "_int32" "__int32" "int32_t" "_int64"
-// "__int64" "int64_t" "uint8_t" "uint16_t" "uint32_t" "uint64_t" "_w64"
-// "__w64" "long" "signed" "unsigned" "float" "double" "void" "_declspec"
-// "__declspec" "const" "__const" "volatile" "__volatile__" SCOPE
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_128(
- _tokenSet_128_data_, 12);
-const unsigned long CPPParser::_tokenSet_129_data_[] = {
- 917856UL, 2UL, 3892445184UL, 4293918720UL, 32767UL, 0UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// LESSTHAN GREATERTHAN SEMICOLON RCURLY ASSIGNEQUAL COLON RPAREN COMMA
-// RSQUARE STAR AMPERSAND ELLIPSIS TIMESEQUAL DIVIDEEQUAL MINUSEQUAL PLUSEQUAL
-// MODEQUAL SHIFTLEFTEQUAL SHIFTRIGHTEQUAL BITWISEANDEQUAL BITWISEXOREQUAL
-// BITWISEOREQUAL QUESTIONMARK OR AND BITWISEOR BITWISEXOR NOTEQUAL EQUAL
-// LESSTHANOREQUALTO GREATERTHANOREQUALTO SHIFTLEFT SHIFTRIGHT PLUS MINUS
-// DIVIDE MOD DOTMBR POINTERTOMBR
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_129(
- _tokenSet_129_data_, 12);
-const unsigned long CPPParser::_tokenSet_130_data_[] = {
- 2098176UL, 4294963201UL, 333451263UL, 0UL, 4291297280UL, 3UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// ID StringLiteral LPAREN "typename" "char" "wchar_t" "bool" "short" "int"
-// "_int8" "__int8" "int8_t" "_int16" "__int16" "int16_t" "_int32" "__int32"
-// "int32_t" "_int64" "__int64" "int64_t" "uint8_t" "uint16_t" "uint32_t"
-// "uint64_t" "_w64" "__w64" "long" "signed" "unsigned" "float" "double"
-// "void" "_declspec" "__declspec" "operator" "this" "true" "false" OCTALINT
-// TILDE SCOPE "dynamic_cast" "static_cast" "reinterpret_cast" "const_cast"
-// "typeid" DECIMALINT HEXADECIMALINT CharLiteral WCharLiteral WStringLiteral
-// FLOATONE FLOATTWO
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_130(
- _tokenSet_130_data_, 12);
-const unsigned long CPPParser::_tokenSet_131_data_[] = {
- 3016032UL, 4294963203UL, 4293005311UL, 4293918720UL, 4294967295UL, 16399UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// LESSTHAN GREATERTHAN SEMICOLON ID RCURLY ASSIGNEQUAL COLON StringLiteral
-// LPAREN RPAREN "typename" "char" "wchar_t" "bool" "short" "int" "_int8"
-// "__int8" "int8_t" "_int16" "__int16" "int16_t" "_int32" "__int32" "int32_t"
-// "_int64" "__int64" "int64_t" "uint8_t" "uint16_t" "uint32_t" "uint64_t"
-// "_w64" "__w64" "long" "signed" "unsigned" "float" "double" "void" "_declspec"
-// "__declspec" COMMA "operator" "this" "true" "false" OCTALINT LSQUARE
-// RSQUARE TILDE STAR AMPERSAND ELLIPSIS TIMESEQUAL DIVIDEEQUAL MINUSEQUAL
-// PLUSEQUAL MODEQUAL SHIFTLEFTEQUAL SHIFTRIGHTEQUAL BITWISEANDEQUAL
-// BITWISEXOREQUAL
-// BITWISEOREQUAL QUESTIONMARK OR AND BITWISEOR BITWISEXOR NOTEQUAL EQUAL
-// LESSTHANOREQUALTO GREATERTHANOREQUALTO SHIFTLEFT SHIFTRIGHT PLUS MINUS
-// DIVIDE MOD DOTMBR POINTERTOMBR PLUSPLUS MINUSMINUS "sizeof" "__alignof__"
-// SCOPE DOT POINTERTO "dynamic_cast" "static_cast" "reinterpret_cast"
-// "const_cast" "typeid" DECIMALINT HEXADECIMALINT CharLiteral WCharLiteral
-// WStringLiteral FLOATONE FLOATTWO NOT "new" "delete"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_131(
- _tokenSet_131_data_, 12);
-const unsigned long CPPParser::_tokenSet_132_data_[] = {
- 0UL, 0UL, 1879048192UL, 0UL, 1536UL, 4UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// TILDE STAR AMPERSAND PLUS MINUS NOT
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_132(
- _tokenSet_132_data_, 12);
-const unsigned long CPPParser::_tokenSet_133_data_[] = {
- 0UL, 0UL, 0UL, 0UL, 524288UL, 16392UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// SCOPE "new" "delete"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_133(
- _tokenSet_133_data_, 12);
-const unsigned long CPPParser::_tokenSet_134_data_[] = {
- 4293932672UL, 4294967293UL, 2011234303UL, 0UL, 4291790336UL, 16399UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// "typedef" "enum" ID "inline" "friend" "extern" StringLiteral "struct"
-// "union" "class" "_stdcall" "__stdcall" "GFEXCLUDE" "GFINCLUDE" "GFID"
-// "GFUNREAD" "GFARRAYSIZE" LPAREN "GFARRAYSIZES" "GFARRAYELEMSIZE" "auto"
-// "register" "static" "mutable" "_inline" "__inline" "virtual" "explicit"
-// "typename" "char" "wchar_t" "bool" "short" "int" "_int8" "__int8" "int8_t"
-// "_int16" "__int16" "int16_t" "_int32" "__int32" "int32_t" "_int64" "__int64"
-// "int64_t" "uint8_t" "uint16_t" "uint32_t" "uint64_t" "_w64" "__w64"
-// "long" "signed" "unsigned" "float" "double" "void" "_declspec" "__declspec"
-// "const" "__const" "volatile" "__volatile__" "operator" "this" "true"
-// "false" OCTALINT LSQUARE TILDE STAR AMPERSAND PLUS MINUS PLUSPLUS MINUSMINUS
-// "sizeof" "__alignof__" SCOPE "dynamic_cast" "static_cast" "reinterpret_cast"
-// "const_cast" "typeid" DECIMALINT HEXADECIMALINT CharLiteral WCharLiteral
-// WStringLiteral FLOATONE FLOATTWO NOT "new" "delete"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_134(
- _tokenSet_134_data_, 12);
-const unsigned long CPPParser::_tokenSet_135_data_[] = {
- 4291835552UL, 4294967295UL, 1677787135UL, 0UL, 524288UL, 16368UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// LESSTHAN "typedef" "enum" ID "inline" "friend" "extern" "struct" "union"
-// "class" "_stdcall" "__stdcall" "GFEXCLUDE" "GFINCLUDE" "GFID" "GFUNREAD"
-// "GFARRAYSIZE" LPAREN RPAREN "GFARRAYSIZES" "GFARRAYELEMSIZE" "auto"
-// "register" "static" "mutable" "_inline" "__inline" "virtual" "explicit"
-// "typename" "char" "wchar_t" "bool" "short" "int" "_int8" "__int8" "int8_t"
-// "_int16" "__int16" "int16_t" "_int32" "__int32" "int32_t" "_int64" "__int64"
-// "int64_t" "uint8_t" "uint16_t" "uint32_t" "uint64_t" "_w64" "__w64"
-// "long" "signed" "unsigned" "float" "double" "void" "_declspec" "__declspec"
-// "const" "__const" "volatile" "__volatile__" LSQUARE STAR AMPERSAND SCOPE
-// "_cdecl" "__cdecl" "_near" "__near" "_far" "__far" "__interrupt" "pascal"
-// "_pascal" "__pascal"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_135(
- _tokenSet_135_data_, 12);
-const unsigned long CPPParser::_tokenSet_136_data_[] = {
- 4294194912UL, 4294967295UL, 2011365375UL, 4293918720UL,
- 4294967295UL, 16399UL, 0UL, 0UL,
- 0UL, 0UL, 0UL, 0UL};
-// LESSTHAN GREATERTHAN "typedef" "enum" ID "inline" "friend" ASSIGNEQUAL
-// "extern" StringLiteral "struct" "union" "class" "_stdcall" "__stdcall"
-// "GFEXCLUDE" "GFINCLUDE" "GFID" "GFUNREAD" "GFARRAYSIZE" LPAREN RPAREN
-// "GFARRAYSIZES" "GFARRAYELEMSIZE" "auto" "register" "static" "mutable"
-// "_inline" "__inline" "virtual" "explicit" "typename" "char" "wchar_t"
-// "bool" "short" "int" "_int8" "__int8" "int8_t" "_int16" "__int16" "int16_t"
-// "_int32" "__int32" "int32_t" "_int64" "__int64" "int64_t" "uint8_t"
-// "uint16_t" "uint32_t" "uint64_t" "_w64" "__w64" "long" "signed" "unsigned"
-// "float" "double" "void" "_declspec" "__declspec" "const" "__const" "volatile"
-// "__volatile__" COMMA "operator" "this" "true" "false" OCTALINT LSQUARE
-// TILDE STAR AMPERSAND TIMESEQUAL DIVIDEEQUAL MINUSEQUAL PLUSEQUAL MODEQUAL
-// SHIFTLEFTEQUAL SHIFTRIGHTEQUAL BITWISEANDEQUAL BITWISEXOREQUAL BITWISEOREQUAL
-// QUESTIONMARK OR AND BITWISEOR BITWISEXOR NOTEQUAL EQUAL LESSTHANOREQUALTO
-// GREATERTHANOREQUALTO SHIFTLEFT SHIFTRIGHT PLUS MINUS DIVIDE MOD DOTMBR
-// POINTERTOMBR PLUSPLUS MINUSMINUS "sizeof" "__alignof__" SCOPE DOT POINTERTO
-// "dynamic_cast" "static_cast" "reinterpret_cast" "const_cast" "typeid"
-// DECIMALINT HEXADECIMALINT CharLiteral WCharLiteral WStringLiteral FLOATONE
-// FLOATTWO NOT "new" "delete"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_136(
- _tokenSet_136_data_, 12);
-const unsigned long CPPParser::_tokenSet_137_data_[] = {
- 1056UL, 4294959105UL, 4095UL, 0UL, 524288UL, 0UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// LESSTHAN ID LPAREN "char" "wchar_t" "bool" "short" "int" "_int8" "__int8"
-// "int8_t" "_int16" "__int16" "int16_t" "_int32" "__int32" "int32_t" "_int64"
-// "__int64" "int64_t" "uint8_t" "uint16_t" "uint32_t" "uint64_t" "_w64"
-// "__w64" "long" "signed" "unsigned" "float" "double" "void" "_declspec"
-// "__declspec" SCOPE
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_137(
- _tokenSet_137_data_, 12);
-const unsigned long CPPParser::_tokenSet_138_data_[] = {
- 2098176UL, 1UL, 333447168UL, 0UL, 4161273856UL, 3UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// ID StringLiteral LPAREN "operator" "this" "true" "false" OCTALINT TILDE
-// SCOPE DECIMALINT HEXADECIMALINT CharLiteral WCharLiteral WStringLiteral
-// FLOATONE FLOATTWO
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_138(
- _tokenSet_138_data_, 12);
-const unsigned long CPPParser::_tokenSet_139_data_[] = {
- 4291835520UL, 4294967293UL, 65535UL, 0UL, 524288UL, 0UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// "typedef" "enum" ID "inline" "friend" "extern" "struct" "union" "class"
-// "_stdcall" "__stdcall" "GFEXCLUDE" "GFINCLUDE" "GFID" "GFUNREAD"
-// "GFARRAYSIZE"
-// LPAREN "GFARRAYSIZES" "GFARRAYELEMSIZE" "auto" "register" "static" "mutable"
-// "_inline" "__inline" "virtual" "explicit" "typename" "char" "wchar_t"
-// "bool" "short" "int" "_int8" "__int8" "int8_t" "_int16" "__int16" "int16_t"
-// "_int32" "__int32" "int32_t" "_int64" "__int64" "int64_t" "uint8_t"
-// "uint16_t" "uint32_t" "uint64_t" "_w64" "__w64" "long" "signed" "unsigned"
-// "float" "double" "void" "_declspec" "__declspec" "const" "__const" "volatile"
-// "__volatile__" SCOPE
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_139(
- _tokenSet_139_data_, 12);
-const unsigned long CPPParser::_tokenSet_140_data_[] = {
- 4292753376UL, 4294967295UL, 3959619583UL, 4293918720UL, 557055UL, 16368UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// LESSTHAN GREATERTHAN "typedef" SEMICOLON "enum" ID "inline" "friend"
-// RCURLY ASSIGNEQUAL COLON "extern" "struct" "union" "class" "_stdcall"
-// "__stdcall" "GFEXCLUDE" "GFINCLUDE" "GFID" "GFUNREAD" "GFARRAYSIZE"
-// LPAREN RPAREN "GFARRAYSIZES" "GFARRAYELEMSIZE" "auto" "register" "static"
-// "mutable" "_inline" "__inline" "virtual" "explicit" "typename" "char"
-// "wchar_t" "bool" "short" "int" "_int8" "__int8" "int8_t" "_int16" "__int16"
-// "int16_t" "_int32" "__int32" "int32_t" "_int64" "__int64" "int64_t"
-// "uint8_t" "uint16_t" "uint32_t" "uint64_t" "_w64" "__w64" "long" "signed"
-// "unsigned" "float" "double" "void" "_declspec" "__declspec" "const"
-// "__const" "volatile" "__volatile__" COMMA LSQUARE RSQUARE STAR AMPERSAND
-// ELLIPSIS TIMESEQUAL DIVIDEEQUAL MINUSEQUAL PLUSEQUAL MODEQUAL SHIFTLEFTEQUAL
-// SHIFTRIGHTEQUAL BITWISEANDEQUAL BITWISEXOREQUAL BITWISEOREQUAL QUESTIONMARK
-// OR AND BITWISEOR BITWISEXOR NOTEQUAL EQUAL LESSTHANOREQUALTO
-// GREATERTHANOREQUALTO
-// SHIFTLEFT SHIFTRIGHT PLUS MINUS DIVIDE MOD DOTMBR POINTERTOMBR SCOPE
-// "_cdecl" "__cdecl" "_near" "__near" "_far" "__far" "__interrupt" "pascal"
-// "_pascal" "__pascal"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_140(
- _tokenSet_140_data_, 12);
-const unsigned long CPPParser::_tokenSet_141_data_[] = {
- 917856UL, 3UL, 3959554048UL, 4293918720UL, 3276799UL, 0UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// LESSTHAN GREATERTHAN SEMICOLON RCURLY ASSIGNEQUAL COLON LPAREN RPAREN
-// COMMA LSQUARE RSQUARE STAR AMPERSAND ELLIPSIS TIMESEQUAL DIVIDEEQUAL
-// MINUSEQUAL PLUSEQUAL MODEQUAL SHIFTLEFTEQUAL SHIFTRIGHTEQUAL BITWISEANDEQUAL
-// BITWISEXOREQUAL BITWISEOREQUAL QUESTIONMARK OR AND BITWISEOR BITWISEXOR
-// NOTEQUAL EQUAL LESSTHANOREQUALTO GREATERTHANOREQUALTO SHIFTLEFT SHIFTRIGHT
-// PLUS MINUS DIVIDE MOD DOTMBR POINTERTOMBR PLUSPLUS MINUSMINUS DOT POINTERTO
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_141(
- _tokenSet_141_data_, 12);
-const unsigned long CPPParser::_tokenSet_142_data_[] = {
- 100664320UL, 0UL, 1677721600UL, 0UL, 524288UL, 16368UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// ID "_stdcall" "__stdcall" LSQUARE STAR AMPERSAND SCOPE "_cdecl" "__cdecl"
-// "_near" "__near" "_far" "__far" "__interrupt" "pascal" "_pascal" "__pascal"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_142(
- _tokenSet_142_data_, 12);
-const unsigned long CPPParser::_tokenSet_143_data_[] = {
- 103679328UL, 4294963203UL, 4293066751UL, 4293918720UL,
- 4291821567UL, 32767UL, 0UL, 0UL,
- 0UL, 0UL, 0UL, 0UL};
-// LESSTHAN GREATERTHAN SEMICOLON ID RCURLY ASSIGNEQUAL COLON StringLiteral
-// "_stdcall" "__stdcall" LPAREN RPAREN "typename" "char" "wchar_t" "bool"
-// "short" "int" "_int8" "__int8" "int8_t" "_int16" "__int16" "int16_t"
-// "_int32" "__int32" "int32_t" "_int64" "__int64" "int64_t" "uint8_t"
-// "uint16_t" "uint32_t" "uint64_t" "_w64" "__w64" "long" "signed" "unsigned"
-// "float" "double" "void" "_declspec" "__declspec" "const" "__const" "volatile"
-// "__volatile__" COMMA "operator" "this" "true" "false" OCTALINT LSQUARE
-// RSQUARE TILDE STAR AMPERSAND ELLIPSIS TIMESEQUAL DIVIDEEQUAL MINUSEQUAL
-// PLUSEQUAL MODEQUAL SHIFTLEFTEQUAL SHIFTRIGHTEQUAL BITWISEANDEQUAL
-// BITWISEXOREQUAL
-// BITWISEOREQUAL QUESTIONMARK OR AND BITWISEOR BITWISEXOR NOTEQUAL EQUAL
-// LESSTHANOREQUALTO GREATERTHANOREQUALTO SHIFTLEFT SHIFTRIGHT PLUS MINUS
-// DIVIDE MOD DOTMBR POINTERTOMBR PLUSPLUS MINUSMINUS "sizeof" "__alignof__"
-// SCOPE "dynamic_cast" "static_cast" "reinterpret_cast" "const_cast" "typeid"
-// DECIMALINT HEXADECIMALINT CharLiteral WCharLiteral WStringLiteral FLOATONE
-// FLOATTWO NOT "new" "_cdecl" "__cdecl" "_near" "__near" "_far" "__far"
-// "__interrupt" "pascal" "_pascal" "__pascal" "delete"
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_143(
- _tokenSet_143_data_, 12);
-const unsigned long CPPParser::_tokenSet_144_data_[] = {
- 917856UL, 3UL, 3892445184UL, 4293918720UL, 32767UL, 0UL,
- 0UL, 0UL, 0UL, 0UL, 0UL, 0UL};
-// LESSTHAN GREATERTHAN SEMICOLON RCURLY ASSIGNEQUAL COLON LPAREN RPAREN
-// COMMA RSQUARE STAR AMPERSAND ELLIPSIS TIMESEQUAL DIVIDEEQUAL MINUSEQUAL
-// PLUSEQUAL MODEQUAL SHIFTLEFTEQUAL SHIFTRIGHTEQUAL BITWISEANDEQUAL
-// BITWISEXOREQUAL
-// BITWISEOREQUAL QUESTIONMARK OR AND BITWISEOR BITWISEXOR NOTEQUAL EQUAL
-// LESSTHANOREQUALTO GREATERTHANOREQUALTO SHIFTLEFT SHIFTRIGHT PLUS MINUS
-// DIVIDE MOD DOTMBR POINTERTOMBR
-const ANTLR_USE_NAMESPACE(antlr) BitSet CPPParser::_tokenSet_144(
- _tokenSet_144_data_, 12);
diff --git a/contrib/pdxautoserializer/src/impl/CPPParser/CPPParser.hpp b/contrib/pdxautoserializer/src/impl/CPPParser/CPPParser.hpp
deleted file mode 100644
index 2b74369..0000000
--- a/contrib/pdxautoserializer/src/impl/CPPParser/CPPParser.hpp
+++ /dev/null
@@ -1,920 +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.
- */
-#ifndef INC_CPPParser_hpp_
-#define INC_CPPParser_hpp_
-
-#include <antlr/config.hpp>
-/* $ANTLR 2.7.7 (20130409): "CPP_parser.g" -> "CPPParser.hpp"$ */
-#include <antlr/TokenStream.hpp>
-#include <antlr/TokenBuffer.hpp>
-#include "STDCTokenTypes.hpp"
-#include <antlr/LLkParser.hpp>
-
-#line 79 "CPP_parser.g"
-
-// File generated from CPP_parser.g
-// Version 3.1 November 2005
-// This file is best viewed in courier font with tabs set to 4 spaces
-//
-// The statements in this block appear in both CPPLexer.hpp and CPPParser.hpp
-#include <stdio.h>
-#include <string.h>
-#include "antlr/CharScanner.hpp"
-#include "CPPDictionary.hpp"
-
-// Defined in main.cpp
-extern void process_line_directive(const char *, const char *);
-
-// Declared in main.cpp
-extern int deferredLineCount;
-
-#line 30 "CPPParser.hpp"
-class CUSTOM_API CPPParser : public ANTLR_USE_NAMESPACE(antlr) LLkParser,
- public STDCTokenTypes {
-#line 191 "CPP_parser.g"
-
- public:
-#define CPPParser_MaxQualifiedItemSize 500
-
- // These codes are not stored with symbol names in CPPSymbol,
- // but they are available for development
- // Can't bitwise-OR enum elements together, this must be an int
- typedef unsigned long TypeSpecifier; // note: must be at least 16 bits
- typedef unsigned long TypeQualifier;
-
-#define tsInvalid 0x0
-#define tsVOID 0x1
-#define tsCHAR 0x2
-#define tsSHORT 0x4
-#define tsINT 0x8
-#define tsLONG 0x10
-#define tsFLOAT 0x20
-#define tsDOUBLE 0x40
-#define tsSIGNED 0x80
-#define tsUNSIGNED 0x100
-#define tsTYPEID 0x200
-#define tsSTRUCT 0x400
-#define tsENUM 0x800
-#define tsUNION 0x1000
-#define tsCLASS 0x2000
-#define tsWCHAR_T 0x4000
-#define tsBOOL 0x8000
-
-#define tqInvalid 0x0
-#define tqCONST 0x1
-#define tqVOLATILE 0x2
-#define tqGFEXCLUDE 0x4
-#define tqGFINCLUDE 0x8
-#define tqGFID 0x10
-#define tqGFUNREAD 0x20
-
- enum StorageClass {
- scInvalid = 0,
- scAUTO = 1,
- scREGISTER,
- scSTATIC,
- scEXTERN,
- scMUTABLE
- };
-
- enum FunctionSpecifier {
- fsInvalid = 0,
- fsVIRTUAL,
- fsINLINE,
- fsEXPLICIT,
- fsFRIEND
- };
-
- // JEL 3/26/96 changed to allow ORing of values
- // DW 10/04/05 These codes are stored with the item in CPPSymbol in the
- // dictionary See declaratorID
- typedef int QualifiedItem;
-#define qiInvalid 0x0
-#define qiType 0x1 // includes enum, class, typedefs, namespace
-#define qiDtor 0x2
-#define qiCtor 0x4
-#define qiOperator 0x8
-#define qiPtrMember 0x10
-#define qiVar 0x20
-#define qiFun 0x40
-#define qiNamespace 0x50
-
- protected:
- // Symbol table management stuff
- CPPDictionary *symbols;
- int templateParameterScope;
- int externalScope;
- int anyType;
- int anyNonType;
-
- bool _td; // For typedef
- bool _fd; // For friend
- StorageClass _sc; // For storage class
- TypeQualifier _tq; // For type qualifier
- TypeSpecifier _ts; // For type specifier
- FunctionSpecifier _fs; // For declaration specifier
-
- int functionDefinition; // 0 = Function definition not being parsed
- // 1 = Parsing function name
- // 2 = Parsing function parameter list
- // 3 = Parsing function block
-
- char qualifierPrefix[CPPParser_MaxQualifiedItemSize + 1];
- char *enclosingClass;
- int assign_stmt_RHS_found;
- bool in_parameter_list;
- bool K_and_R; // used to distinguish old K & R parameter definitions
- bool in_return;
- bool is_address;
- bool is_pointer;
-
- // Limit lookahead for qualifiedItemIs()
- enum { MaxTemplateTokenScan = 200 };
-
- public:
- void init();
-
- protected:
- // Semantic interface in Support.cpp;
- // You could subclass and redefine these functions
- // so you don't have to mess with the grammar itself.
-
- // Symbol stuff
- virtual int qualifiedItemIsOneOf(QualifiedItem qiFlags,
- int lookahead_offset = 0);
- virtual QualifiedItem qualifiedItemIs(int lookahead_offset = 0);
- virtual int skipTemplateQualifiers(int &kInOut);
- virtual int skipNestedParens(int &kInOut);
- virtual int scopedItem(int k = 1);
- virtual int finalQualifier(int k = 1);
- virtual int isTypeName(const char *s);
- virtual int isClassName(const char *s);
- virtual void end_of_stmt();
-
- // Scoping stuff
- virtual void enterNewLocalScope();
- virtual void exitLocalScope();
- virtual void enterExternalScope();
- virtual void exitExternalScope();
-
- // namespaceEnd stuff
- virtual void exitNamespaceScope();
-
- // Aggregate stuff
- virtual void classForwardDeclaration(TypeSpecifier, FunctionSpecifier,
- const char *);
- virtual void beginClassDefinition(TypeSpecifier, const char *);
- virtual void endClassDefinition();
- virtual void beginEnumDefinition(const char *);
- virtual void endEnumDefinition();
- virtual void enumElement(const char *);
-
- // Declaration and definition stuff
- virtual void declarationSpecifier(bool, bool, StorageClass, TypeQualifier,
- TypeSpecifier, FunctionSpecifier);
- virtual void beginDeclaration();
- virtual void endDeclaration();
- virtual void beginConstructorDeclaration(const char *);
- virtual void endConstructorDeclaration();
- virtual void beginDestructorDeclaration(const char *);
- virtual void endDestructorDeclaration();
- virtual void beginParameterDeclaration();
- virtual void beginFieldDeclaration();
- virtual void beginFunctionDefinition();
- virtual void endFunctionDefinition();
- virtual void functionParameterList();
- virtual void functionEndParameterList(int def);
- virtual void beginConstructorDefinition();
- virtual void endConstructorDefinition();
- virtual void beginDestructorDefinition();
- virtual void endDestructorDefinition();
-
- // Declarator stuff
- virtual void declaratorID(
- const char *, QualifiedItem); // This stores new symbol with its type.
- virtual void declaratorArray();
- virtual void declaratorParameterList(int def);
- virtual void declaratorEndParameterList(int def);
-
- // template stuff
- virtual void templateTypeParameter(const char *);
- virtual void beginTemplateDeclaration();
- virtual void endTemplateDeclaration();
- virtual void beginTemplateDefinition();
- virtual void endTemplateDefinition();
- virtual void beginTemplateParameterList();
- virtual void endTemplateParameterList();
-
- // exception stuff
- virtual void exceptionBeginHandler();
- virtual void exceptionEndHandler();
- virtual void panic(const char *);
-
- // myCode functions ready for overriding in MyCode subclass
- // Include application code functions here
- virtual void myCode_pre_processing(int, char *[]);
- virtual void myCode_post_processing();
- virtual void myCode_end_of_stmt();
- virtual void myCode_function_direct_declarator(const char *);
-
- // Auto-serializer specific stuff
- virtual void gfArraySize(const char *id) {}
- virtual void gfArrayElemSize(const char *id) {}
-#line 34 "CPPParser.hpp"
- public:
- void initializeASTFactory(ANTLR_USE_NAMESPACE(antlr) ASTFactory &factory);
-
- protected:
- CPPParser(ANTLR_USE_NAMESPACE(antlr) TokenBuffer &tokenBuf, int k);
-
- public:
- CPPParser(ANTLR_USE_NAMESPACE(antlr) TokenBuffer &tokenBuf);
-
- protected:
- CPPParser(ANTLR_USE_NAMESPACE(antlr) TokenStream &lexer, int k);
-
- public:
- CPPParser(ANTLR_USE_NAMESPACE(antlr) TokenStream &lexer);
- CPPParser(const ANTLR_USE_NAMESPACE(antlr) ParserSharedInputState &state);
- int getNumTokens() const { return CPPParser::NUM_TOKENS; }
- const char *getTokenName(int type) const {
- if (type > getNumTokens()) return 0;
- return CPPParser::tokenNames[type];
- }
- const char *const *getTokenNames() const { return CPPParser::tokenNames; }
-
- public:
- void translation_unit();
-
- public:
- void external_declaration();
-
- public:
- CPPParser::TypeSpecifier class_specifier();
-
- public:
- void class_decl_or_def(FunctionSpecifier fs);
-
- public:
- void init_declarator_list();
-
- public:
- void enum_specifier();
-
- public:
- void declaration_specifiers();
-
- public:
- void function_declarator(int definition);
-
- public:
- void declaration();
-
- public:
- void template_head();
-
- public:
- CPPParser::FunctionSpecifier function_specifier();
-
- public:
- void dtor_head(int definition);
-
- public:
- void dtor_body();
-
- public:
- void ctor_decl_spec();
-
- public:
- void ctor_definition();
-
- public:
- char *scope_override();
-
- public:
- void conversion_function_decl_or_def();
-
- public:
- void function_definition();
-
- public:
- void namespace_definition();
-
- public:
- void namespace_alias_definition();
-
- public:
- char *qualified_id();
-
- public:
- void member_declaration();
-
- public:
- void member_declarator_list();
-
- public:
- void ctor_declarator(int definition);
-
- public:
- void compound_statement();
-
- public:
- void class_head();
-
- public:
- void access_specifier();
-
- public:
- void linkage_specification();
-
- public:
- void using_statement();
-
- public:
- void template_argument_list();
-
- public:
- void base_clause();
-
- public:
- CPPParser::StorageClass storage_class_specifier();
-
- public:
- CPPParser::TypeQualifier type_qualifier();
-
- public:
- CPPParser::TypeSpecifier type_specifier();
-
- public:
- CPPParser::TypeSpecifier simple_type_specifier();
-
- public:
- char *qualified_type();
-
- public:
- void class_prefix();
-
- public:
- void expression();
-
- public:
- void base_specifier();
-
- public:
- void enumerator_list();
-
- public:
- void enumerator();
-
- public:
- void constant_expression();
-
- public:
- void optor();
-
- public:
- void typeID();
-
- public:
- void init_declarator();
-
- public:
- void declarator();
-
- public:
- void initializer();
-
- public:
- void expression_list();
-
- public:
- void remainder_expression();
-
- public:
- void member_declarator();
-
- public:
- void ptr_operator();
-
- public:
- void direct_declarator();
-
- public:
- void parameter_list();
-
- public:
- void exception_specification();
-
- public:
- void declarator_suffix();
-
- public:
- void template_parameter_list();
-
- public:
- void function_direct_declarator(int definition);
-
- public:
- void ctor_head();
-
- public:
- void ctor_body();
-
- public:
- char *qualified_ctor_id();
-
- public:
- void ctor_initializer();
-
- public:
- void superclass_init();
-
- public:
- void dtor_decl_spec();
-
- public:
- void dtor_declarator(int definition);
-
- public:
- void parameter_declaration_list();
-
- public:
- void parameter_declaration();
-
- public:
- void abstract_declarator();
-
- public:
- void type_id();
-
- public:
- void abstract_declarator_suffix();
-
- public:
- void cv_qualifier_seq();
-
- public:
- void template_parameter();
-
- public:
- void type_parameter();
-
- public:
- void assigned_type_name();
-
- public:
- void template_id();
-
- public:
- void template_argument();
-
- public:
- void shift_expression();
-
- public:
- void statement_list();
-
- public:
- void statement();
-
- public:
- void block_declaration();
-
- public:
- void labeled_statement();
-
- public:
- void case_statement();
-
- public:
- void default_statement();
-
- public:
- void selection_statement();
-
- public:
- void iteration_statement();
-
- public:
- void jump_statement();
-
- public:
- void try_block();
-
- public:
- void throw_statement();
-
- public:
- void simple_declaration();
-
- public:
- void asm_definition();
-
- public:
- void handler();
-
- public:
- void exception_declaration();
-
- public:
- void assignment_expression();
-
- public:
- void conditional_expression();
-
- public:
- void logical_or_expression();
-
- public:
- void logical_and_expression();
-
- public:
- void inclusive_or_expression();
-
- public:
- void exclusive_or_expression();
-
- public:
- void and_expression();
-
- public:
- void equality_expression();
-
- public:
- void relational_expression();
-
- public:
- void additive_expression();
-
- public:
- void multiplicative_expression();
-
- public:
- void pm_expression();
-
- public:
- void cast_expression();
-
- public:
- void unary_expression();
-
- public:
- void postfix_expression();
-
- public:
- void unary_operator();
-
- public:
- void new_expression();
-
- public:
- void delete_expression();
-
- public:
- void primary_expression();
-
- public:
- void id_expression();
-
- public:
- void constant();
-
- public:
- void new_type_id();
-
- public:
- void new_initializer();
-
- public:
- void new_declarator();
-
- public:
- void direct_new_declarator();
-
- public:
- void ptr_to_member();
-
- public:
- void optor_simple_tokclass();
-
- public:
- ANTLR_USE_NAMESPACE(antlr) RefAST getAST() { return returnAST; }
-
- protected:
- ANTLR_USE_NAMESPACE(antlr) RefAST returnAST;
-
- private:
- static const char *tokenNames[];
-#ifndef NO_STATIC_CONSTS
- static const int NUM_TOKENS = 193;
-#else
- enum { NUM_TOKENS = 193 };
-#endif
-
- static const unsigned long _tokenSet_0_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_0;
- static const unsigned long _tokenSet_1_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_1;
- static const unsigned long _tokenSet_2_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_2;
- static const unsigned long _tokenSet_3_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_3;
- static const unsigned long _tokenSet_4_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_4;
- static const unsigned long _tokenSet_5_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_5;
- static const unsigned long _tokenSet_6_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_6;
- static const unsigned long _tokenSet_7_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_7;
- static const unsigned long _tokenSet_8_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_8;
- static const unsigned long _tokenSet_9_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_9;
- static const unsigned long _tokenSet_10_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_10;
- static const unsigned long _tokenSet_11_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_11;
- static const unsigned long _tokenSet_12_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_12;
- static const unsigned long _tokenSet_13_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_13;
- static const unsigned long _tokenSet_14_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_14;
- static const unsigned long _tokenSet_15_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_15;
- static const unsigned long _tokenSet_16_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_16;
- static const unsigned long _tokenSet_17_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_17;
- static const unsigned long _tokenSet_18_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_18;
- static const unsigned long _tokenSet_19_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_19;
- static const unsigned long _tokenSet_20_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_20;
- static const unsigned long _tokenSet_21_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_21;
- static const unsigned long _tokenSet_22_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_22;
- static const unsigned long _tokenSet_23_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_23;
- static const unsigned long _tokenSet_24_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_24;
- static const unsigned long _tokenSet_25_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_25;
- static const unsigned long _tokenSet_26_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_26;
- static const unsigned long _tokenSet_27_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_27;
- static const unsigned long _tokenSet_28_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_28;
- static const unsigned long _tokenSet_29_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_29;
- static const unsigned long _tokenSet_30_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_30;
- static const unsigned long _tokenSet_31_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_31;
- static const unsigned long _tokenSet_32_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_32;
- static const unsigned long _tokenSet_33_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_33;
- static const unsigned long _tokenSet_34_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_34;
- static const unsigned long _tokenSet_35_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_35;
- static const unsigned long _tokenSet_36_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_36;
- static const unsigned long _tokenSet_37_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_37;
- static const unsigned long _tokenSet_38_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_38;
- static const unsigned long _tokenSet_39_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_39;
- static const unsigned long _tokenSet_40_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_40;
- static const unsigned long _tokenSet_41_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_41;
- static const unsigned long _tokenSet_42_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_42;
- static const unsigned long _tokenSet_43_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_43;
- static const unsigned long _tokenSet_44_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_44;
- static const unsigned long _tokenSet_45_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_45;
- static const unsigned long _tokenSet_46_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_46;
- static const unsigned long _tokenSet_47_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_47;
- static const unsigned long _tokenSet_48_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_48;
- static const unsigned long _tokenSet_49_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_49;
- static const unsigned long _tokenSet_50_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_50;
- static const unsigned long _tokenSet_51_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_51;
- static const unsigned long _tokenSet_52_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_52;
- static const unsigned long _tokenSet_53_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_53;
- static const unsigned long _tokenSet_54_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_54;
- static const unsigned long _tokenSet_55_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_55;
- static const unsigned long _tokenSet_56_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_56;
- static const unsigned long _tokenSet_57_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_57;
- static const unsigned long _tokenSet_58_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_58;
- static const unsigned long _tokenSet_59_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_59;
- static const unsigned long _tokenSet_60_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_60;
- static const unsigned long _tokenSet_61_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_61;
- static const unsigned long _tokenSet_62_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_62;
- static const unsigned long _tokenSet_63_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_63;
- static const unsigned long _tokenSet_64_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_64;
- static const unsigned long _tokenSet_65_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_65;
- static const unsigned long _tokenSet_66_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_66;
- static const unsigned long _tokenSet_67_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_67;
- static const unsigned long _tokenSet_68_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_68;
- static const unsigned long _tokenSet_69_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_69;
- static const unsigned long _tokenSet_70_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_70;
- static const unsigned long _tokenSet_71_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_71;
- static const unsigned long _tokenSet_72_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_72;
- static const unsigned long _tokenSet_73_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_73;
- static const unsigned long _tokenSet_74_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_74;
- static const unsigned long _tokenSet_75_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_75;
- static const unsigned long _tokenSet_76_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_76;
- static const unsigned long _tokenSet_77_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_77;
- static const unsigned long _tokenSet_78_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_78;
- static const unsigned long _tokenSet_79_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_79;
- static const unsigned long _tokenSet_80_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_80;
- static const unsigned long _tokenSet_81_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_81;
- static const unsigned long _tokenSet_82_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_82;
- static const unsigned long _tokenSet_83_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_83;
- static const unsigned long _tokenSet_84_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_84;
- static const unsigned long _tokenSet_85_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_85;
- static const unsigned long _tokenSet_86_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_86;
- static const unsigned long _tokenSet_87_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_87;
- static const unsigned long _tokenSet_88_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_88;
- static const unsigned long _tokenSet_89_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_89;
- static const unsigned long _tokenSet_90_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_90;
- static const unsigned long _tokenSet_91_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_91;
- static const unsigned long _tokenSet_92_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_92;
- static const unsigned long _tokenSet_93_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_93;
- static const unsigned long _tokenSet_94_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_94;
- static const unsigned long _tokenSet_95_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_95;
- static const unsigned long _tokenSet_96_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_96;
- static const unsigned long _tokenSet_97_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_97;
- static const unsigned long _tokenSet_98_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_98;
- static const unsigned long _tokenSet_99_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_99;
- static const unsigned long _tokenSet_100_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_100;
- static const unsigned long _tokenSet_101_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_101;
- static const unsigned long _tokenSet_102_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_102;
- static const unsigned long _tokenSet_103_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_103;
- static const unsigned long _tokenSet_104_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_104;
- static const unsigned long _tokenSet_105_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_105;
- static const unsigned long _tokenSet_106_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_106;
- static const unsigned long _tokenSet_107_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_107;
- static const unsigned long _tokenSet_108_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_108;
- static const unsigned long _tokenSet_109_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_109;
- static const unsigned long _tokenSet_110_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_110;
- static const unsigned long _tokenSet_111_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_111;
- static const unsigned long _tokenSet_112_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_112;
- static const unsigned long _tokenSet_113_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_113;
- static const unsigned long _tokenSet_114_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_114;
- static const unsigned long _tokenSet_115_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_115;
- static const unsigned long _tokenSet_116_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_116;
- static const unsigned long _tokenSet_117_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_117;
- static const unsigned long _tokenSet_118_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_118;
- static const unsigned long _tokenSet_119_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_119;
- static const unsigned long _tokenSet_120_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_120;
- static const unsigned long _tokenSet_121_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_121;
- static const unsigned long _tokenSet_122_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_122;
- static const unsigned long _tokenSet_123_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_123;
- static const unsigned long _tokenSet_124_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_124;
- static const unsigned long _tokenSet_125_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_125;
- static const unsigned long _tokenSet_126_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_126;
- static const unsigned long _tokenSet_127_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_127;
- static const unsigned long _tokenSet_128_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_128;
- static const unsigned long _tokenSet_129_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_129;
- static const unsigned long _tokenSet_130_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_130;
- static const unsigned long _tokenSet_131_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_131;
- static const unsigned long _tokenSet_132_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_132;
- static const unsigned long _tokenSet_133_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_133;
- static const unsigned long _tokenSet_134_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_134;
- static const unsigned long _tokenSet_135_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_135;
- static const unsigned long _tokenSet_136_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_136;
- static const unsigned long _tokenSet_137_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_137;
- static const unsigned long _tokenSet_138_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_138;
- static const unsigned long _tokenSet_139_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_139;
- static const unsigned long _tokenSet_140_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_140;
- static const unsigned long _tokenSet_141_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_141;
- static const unsigned long _tokenSet_142_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_142;
- static const unsigned long _tokenSet_143_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_143;
- static const unsigned long _tokenSet_144_data_[];
- static const ANTLR_USE_NAMESPACE(antlr) BitSet _tokenSet_144;
-};
-
-#endif /*INC_CPPParser_hpp_*/
diff --git a/contrib/pdxautoserializer/src/impl/CPPParser/CPPSymbol.hpp b/contrib/pdxautoserializer/src/impl/CPPParser/CPPSymbol.hpp
deleted file mode 100644
index 7611e11..0000000
--- a/contrib/pdxautoserializer/src/impl/CPPParser/CPPSymbol.hpp
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * PUBLIC DOMAIN PCCTS-BASED C++ GRAMMAR (cplusplus.g, stat.g, expr.g)
- *
- * Authors: Sumana Srinivasan, NeXT Inc.; sumana_srinivasan@next.com
- * Terence Parr, Parr Research Corporation; parrt@parr-research.com
- * Russell Quong, Purdue University; quong@ecn.purdue.edu
- *
- * SOFTWARE RIGHTS
- *
- * This file is a part of the ANTLR-based C++ grammar and is free
- * software. We do not reserve any LEGAL rights to its use or
- * distribution, but you may NOT claim ownership or authorship of this
- * grammar or support code. An individual or company may otherwise do
- * whatever they wish with the grammar distributed herewith including the
- * incorporation of the grammar or the output generated by ANTLR into
- * commerical software. You may redistribute in source or binary form
- * without payment of royalties to us as long as this header remains
- * in all source distributions.
- *
- * We encourage users to develop parsers/tools using this grammar.
- * In return, we ask that credit is given to us for developing this
- * grammar. By "credit", we mean that if you incorporate our grammar or
- * the generated code into one of your programs (commercial product,
- * research project, or otherwise) that you acknowledge this fact in the
- * documentation, research report, etc.... In addition, you should say nice
- * things about us at every opportunity.
- *
- * As long as these guidelines are kept, we expect to continue enhancing
- * this grammar. Feel free to send us enhancements, fixes, bug reports,
- * suggestions, or general words of encouragement at parrt@parr-research.com.
- *
- * NeXT Computer Inc.
- * 900 Chesapeake Dr.
- * Redwood City, CA 94555
- * 12/02/1994
- *
- * Restructured for public consumption by Terence Parr late February, 1995.
- *
- * Requires PCCTS 1.32b4 or higher to get past ANTLR.
- *
- * DISCLAIMER: we make no guarantees that this grammar works, makes sense,
- * or can be used to do anything useful.
- */
-/* 1999-2005 Version 3.1 November 2005
- * Modified by David Wigg at London South Bank University for CPP_parser.g
- *
- * See MyReadMe.txt for further information
- *
- * This file is best viewed in courier font with tabs set to 4 spaces
- */
-
-#ifndef CPPSymbol_hpp
-#define CPPSymbol_hpp
-
-#include "DictEntry.hpp"
-
-class CPPSymbol : public DictEntry {
- public:
- enum ObjectType {
- otInvalid = 0,
- otFunction = 1,
- otVariable,
- otTypedef,
- otStruct,
- otUnion,
- otEnum,
- otClass,
- otTypename = 10,
- otNonTypename = 11
- };
-
- enum ObjectFunction { ofNormal = 0, ofAddress = 1, ofPointer };
-
- protected:
- ObjectType type;
- ObjectFunction function; // Not fully used yet
-
- public:
- CPPSymbol() {}
- CPPSymbol(const char *k, ObjectType ot = otInvalid,
- ObjectFunction of = ofNormal)
- : DictEntry(k) {
- type = ot;
- function = of;
- }
-
- void setType(ObjectType t) { type = t; }
-
- ObjectType getType() { return type; }
-
- void setFunction(ObjectFunction f) { function = f; }
-
- ObjectFunction getFunction() { return function; }
-};
-
-#endif
diff --git a/contrib/pdxautoserializer/src/impl/CPPParser/CPP_parser.g b/contrib/pdxautoserializer/src/impl/CPPParser/CPP_parser.g
deleted file mode 100755
index a3ee7e8..0000000
--- a/contrib/pdxautoserializer/src/impl/CPPParser/CPP_parser.g
+++ /dev/null
@@ -1,2646 +0,0 @@
-/*
- * PUBLIC DOMAIN PCCTS-BASED C++ GRAMMAR (cplusplus.g, stat.g, expr.g)
- *
- * Authors: Sumana Srinivasan, NeXT Inc.; sumana_srinivasan@next.com
- * Terence Parr, Parr Research Corporation; parrt@parr-research.com
- * Russell Quong, Purdue University; quong@ecn.purdue.edu
- *
- * VERSION 1.2
- *
- * SOFTWARE RIGHTS
- *
- * This file is a part of the ANTLR-based C++ grammar and is free
- * software. We do not reserve any LEGAL rights to its use or
- * distribution, but you may NOT claim ownership or authorship of this
- * grammar or support code. An individual or company may otherwise do
- * whatever they wish with the grammar distributed herewith including the
- * incorporation of the grammar or the output generated by ANTLR into
- * commerical software. You may redistribute in source or binary form
- * without payment of royalties to us as long as this header remains
- * in all source distributions.
- *
- * We encourage users to develop parsers/tools using this grammar.
- * In return, we ask that credit is given to us for developing this
- * grammar. By "credit", we mean that if you incorporate our grammar or
- * the generated code into one of your programs (commercial product,
- * research project, or otherwise) that you acknowledge this fact in the
- * documentation, research report, etc.... In addition, you should say nice
- * things about us at every opportunity.
- *
- * As long as these guidelines are kept, we expect to continue enhancing
- * this grammar. Feel free to send us enhancements, fixes, bug reports,
- * suggestions, or general words of encouragement at parrt@parr-research.com.
- *
- * NeXT Computer Inc.
- * 900 Chesapeake Dr.
- * Redwood City, CA 94555
- * 12/02/1994
- *
- * Restructured for public consumption by Terence Parr late February, 1995.
- *
- * DISCLAIMER: we make no guarantees that this grammar works, makes sense,
- * or can be used to do anything useful.
- */
-/* 2001-2002
- * Version 1.0
- * This C++ grammar file has been converted from PCCTS to run under
- * ANTLR to generate lexer and parser in C++ code by
- * Jianguo Zuo and David Wigg at
- * The Centre for Systems and Software Engineering
- * London South Bank University
- * London, UK.
- *
- */
-/* 2003
- * Version 2.0 was published by David Wigg in September 2003
- */
-/* 2004
- * Version 3.0 July 2004
- * This is version 3.0 of the C++ grammar definition for ANTLR to
- * generate lexer and parser in C++ code updated by
- * David Wigg at
- * The Centre for Systems and Software Engineering
- * London South Bank University
- * London, UK.
- */
-/* 2005
- * Version 3.1 November 2005
- * Updated by David Wigg at London South Bank University
- *
- * wiggjd@bcs.ac.uk
- * blackse@lsbu.ac.uk
- *
- * See MyReadMe.txt for further information
- *
- * This file is best viewed in courier font with tabs set to 4 spaces
- */
-
-header
-{
- // File generated from CPP_parser.g
- // Version 3.1 November 2005
- // This file is best viewed in courier font with tabs set to 4 spaces
- //
- // The statements in this block appear in both CPPLexer.hpp and CPPParser.hpp
-#include <stdio.h>
-#include <string.h>
-#include "antlr/CharScanner.hpp"
-#include "CPPDictionary.hpp"
-
- // Defined in main.cpp
- extern void process_line_directive(const char *, const char *);
-
- // Declared in main.cpp
- extern int deferredLineCount;
-}
-
-options
-{
- language = "Cpp";
-}
-
-{
- // File generated from CPP_parser.g
- // Version 3.1 November 2005
- // This file is best viewed in courier font with tabs set to 4 spaces
- //
- // The statements in this block appear only in CPPParser.cpp and not in CPPLexer.cpp
-
- // These constants used in the previous version (3.0 July 2004) have now been replaced by the following,
- //ID_VAR_NAME is now CPPSymbol::otVariable
- //ID_FUN_NAME is now CPPSymbol::otFunction
- //ID_INPUT_PARAMETER is now not used
- //ID_CLASS_DEF is now CPPSymbol::otClass
- //ID_SYSTEM_FUNCTION is now not used
- //ID_CONST_DECL is now not used
- //ID_TYPEDEF_VAR is now CPPSymbol::otTypedef
-
- int statementTrace = 2; // Used to control selected (level) tracing (see support.cpp)
- // 1 Shows which external and member statements selected
- // 2 Shows above plus all declarations/definitions
- // 3 reserved for future use
- // 4 and above available for user
-
- void CPPParser::init()
- {
- antlrTrace(false); // This is a dynamic trace facility for use with -traceParser etc.
- // It requires modification in LLkParser.cpp and LLkParser.hpp
- // otherwise it should be commented out (see MyReadMe.txt)
- // true shows antlr trace (or can be set and reset during parsing)
- // false stops showing antlr trace
- // Provided the parser is always generated with -traceParser this
- // facility allows trace output to be turned on or off by changing
- // the setting here from false to true or vice versa and then
- // recompiling and linking CPPParser only thus avoiding the need
- // to use antlr.Tool to re-generate the lexer and parser again
- // with (or without) -traceParser.
- // Antlr trace can also be turned on and off dynamically using
- // antlrTrace_on or antlrTrace_off statements inserted into the
- // source code being parsed (See below).
-
- // Creates a dictionary to hold symbols with 4001 buckets, 200 scopes and 800,000 characters
- // These can be changed to suit the size of program(s) being parsed
- symbols = new CPPDictionary(4001, 200, 800000);
-
- // Set template parameter scope - Not used at present
- templateParameterScope = symbols->getCurrentScopeIndex(); // Set template parameter scope to 0
-
- symbols->saveScope(); // Advance currentScope from 0 to 1
- // Set "external" scope for all types
- externalScope = symbols->getCurrentScopeIndex(); // Set "external" scope to 1 for types
-
- // Declare predefined scope "std" in external scope
- CPPSymbol *a = new CPPSymbol("std", CPPSymbol::otTypedef);
- symbols->define("std", a);
-
- symbols->saveScope(); // Advance currentScope from 1 to 2 (and higher) for all other symbols
- // treated as locals
-
- // Global flags to allow for nested declarations
- _td = false; // For typedef
- _fd = false; // For friend
- _sc = scInvalid; // For StorageClass
- _tq = tqInvalid; // For TypeQualifier
- _ts = tsInvalid; // For TypeSpecifier
- _fs = fsInvalid; // For FunctionSpecifier
-
- functionDefinition = 0;
- qualifierPrefix[0] = '\0';
- enclosingClass = (char *) "";
- assign_stmt_RHS_found = 0;
- in_parameter_list = false;
- K_and_R = false; // used to distinguish old K & R parameter definitions
- in_return = false;
- is_address = false;
- is_pointer = false;
- }
-
-} // End of CPPParser.cpp block
-
-class CPPParser extends Parser;
-
-options
-{
- k = 2;
- exportVocab = STDC;
- buildAST =false;
- codeGenMakeSwitchThreshold = 2;
- codeGenBitsetTestThreshold = 3;
-}
-
-{
- public:
-#define CPPParser_MaxQualifiedItemSize 500
-
- // These codes are not stored with symbol names in CPPSymbol,
- // but they are available for development
- // Can't bitwise-OR enum elements together, this must be an int
- typedef unsigned long TypeSpecifier; // note: must be at least 16 bits
- typedef unsigned long TypeQualifier;
-
-#define tsInvalid 0x0
-#define tsVOID 0x1
-#define tsCHAR 0x2
-#define tsSHORT 0x4
-#define tsINT 0x8
-#define tsLONG 0x10
-#define tsFLOAT 0x20
-#define tsDOUBLE 0x40
-#define tsSIGNED 0x80
-#define tsUNSIGNED 0x100
-#define tsTYPEID 0x200
-#define tsSTRUCT 0x400
-#define tsENUM 0x800
-#define tsUNION 0x1000
-#define tsCLASS 0x2000
-#define tsWCHAR_T 0x4000
-#define tsBOOL 0x8000
-
-
-#define tqInvalid 0x0
-#define tqCONST 0x1
-#define tqVOLATILE 0x2
-#define tqGFEXCLUDE 0x4
-#define tqGFINCLUDE 0x8
-#define tqGFID 0x10
-#define tqGFUNREAD 0x20
-
- enum StorageClass
- {
- scInvalid=0, scAUTO=1, scREGISTER,
- scSTATIC, scEXTERN, scMUTABLE
- };
-
- enum FunctionSpecifier
- {
- fsInvalid=0,
- fsVIRTUAL, fsINLINE, fsEXPLICIT, fsFRIEND
- };
-
- // JEL 3/26/96 changed to allow ORing of values
- // DW 10/04/05 These codes are stored with the item in CPPSymbol in the dictionary See declaratorID
- typedef int QualifiedItem;
-#define qiInvalid 0x0
-#define qiType 0x1 // includes enum, class, typedefs, namespace
-#define qiDtor 0x2
-#define qiCtor 0x4
-#define qiOperator 0x8
-#define qiPtrMember 0x10
-#define qiVar 0x20
-#define qiFun 0x40
-#define qiNamespace 0x50
-
- protected:
- // Symbol table management stuff
- CPPDictionary *symbols;
- int templateParameterScope;
- int externalScope;
- int anyType;
- int anyNonType;
-
- bool _td; // For typedef
- bool _fd; // For friend
- StorageClass _sc; // For storage class
- TypeQualifier _tq; // For type qualifier
- TypeSpecifier _ts; // For type specifier
- FunctionSpecifier _fs; // For declaration specifier
-
- int functionDefinition; // 0 = Function definition not being parsed
- // 1 = Parsing function name
- // 2 = Parsing function parameter list
- // 3 = Parsing function block
-
- char qualifierPrefix[CPPParser_MaxQualifiedItemSize+1];
- char *enclosingClass;
- int assign_stmt_RHS_found;
- bool in_parameter_list;
- bool K_and_R; // used to distinguish old K & R parameter definitions
- bool in_return;
- bool is_address;
- bool is_pointer;
-
- // Limit lookahead for qualifiedItemIs()
- enum
- {
- MaxTemplateTokenScan = 200
- };
-
- public:
- void init();
-
- protected:
- // Semantic interface in Support.cpp;
- // You could subclass and redefine these functions
- // so you don't have to mess with the grammar itself.
-
- // Symbol stuff
- virtual int qualifiedItemIsOneOf(QualifiedItem qiFlags, int lookahead_offset=0);
- virtual QualifiedItem qualifiedItemIs(int lookahead_offset=0);
- virtual int skipTemplateQualifiers(int& kInOut);
- virtual int skipNestedParens(int& kInOut);
- virtual int scopedItem(int k=1);
- virtual int finalQualifier(int k=1);
- virtual int isTypeName(const char *s);
- virtual int isClassName(const char *s);
- virtual void end_of_stmt();
-
- // Scoping stuff
- virtual void enterNewLocalScope();
- virtual void exitLocalScope();
- virtual void enterExternalScope();
- virtual void exitExternalScope();
-
- // namespaceEnd stuff
- virtual void exitNamespaceScope();
-
- // Aggregate stuff
- virtual void classForwardDeclaration(TypeSpecifier, FunctionSpecifier,const char *);
- virtual void beginClassDefinition(TypeSpecifier,const char *);
- virtual void endClassDefinition();
- virtual void beginEnumDefinition(const char *);
- virtual void endEnumDefinition();
- virtual void enumElement(const char *);
-
- // Declaration and definition stuff
- virtual void declarationSpecifier(bool,bool,StorageClass,TypeQualifier,TypeSpecifier,FunctionSpecifier);
- virtual void beginDeclaration();
- virtual void endDeclaration();
- virtual void beginConstructorDeclaration(const char *);
- virtual void endConstructorDeclaration();
- virtual void beginDestructorDeclaration(const char *);
- virtual void endDestructorDeclaration();
- virtual void beginParameterDeclaration();
- virtual void beginFieldDeclaration();
- virtual void beginFunctionDefinition();
- virtual void endFunctionDefinition();
- virtual void functionParameterList();
- virtual void functionEndParameterList(int def);
- virtual void beginConstructorDefinition();
- virtual void endConstructorDefinition();
- virtual void beginDestructorDefinition();
- virtual void endDestructorDefinition();
-
- // Declarator stuff
- virtual void declaratorID(const char *, QualifiedItem); // This stores new symbol with its type.
- virtual void declaratorArray();
- virtual void declaratorParameterList(int def);
- virtual void declaratorEndParameterList(int def);
-
- // template stuff
- virtual void templateTypeParameter(const char *);
- virtual void beginTemplateDeclaration();
- virtual void endTemplateDeclaration();
- virtual void beginTemplateDefinition();
- virtual void endTemplateDefinition();
- virtual void beginTemplateParameterList();
- virtual void endTemplateParameterList();
-
- // exception stuff
- virtual void exceptionBeginHandler();
- virtual void exceptionEndHandler();
- virtual void panic(const char *);
-
- // myCode functions ready for overriding in MyCode subclass
- // Include application code functions here
- virtual void myCode_pre_processing(int, char *[]);
- virtual void myCode_post_processing();
- virtual void myCode_end_of_stmt();
- virtual void myCode_function_direct_declarator(const char *);
-
- // Auto-serializer specific stuff
- virtual void gfArraySize(const char* id) { }
- virtual void gfArrayElemSize(const char* id) { }
-}
-
-translation_unit
- : {enterExternalScope();}
- (external_declaration)+ EOF
- {exitExternalScope();}
- ;
-
-external_declaration
- {char *s;
- K_and_R = false;
- FunctionSpecifier fs = fsInvalid; // inline,virtual,explicit
- }
- :
- (
- // Template explicit specialisation
- ("template" LESSTHAN GREATERTHAN)=>
- {if(statementTrace>=1)
- printf("%d external_declaration template explicit-specialisation\n",LT(1)->getLine());
- }
- "template" LESSTHAN GREATERTHAN external_declaration
- |
- // All typedefs
- ("typedef")=>
- (
- ("typedef" class_specifier)=>
- {if(statementTrace>=1)
- printf("%d external_declaration Typedef class type\n",LT(1)->getLine());
- }
- "typedef" class_decl_or_def[fs] {_td = true;} (init_declarator_list)? SEMICOLON {end_of_stmt();}
- |
- ("typedef" "enum")=>
- {if(statementTrace>=1)
- printf("%d external_declaration Typedef enum type\n",LT(1)->getLine());
- }
- "typedef" enum_specifier {_td = true;} (init_declarator_list)? SEMICOLON {end_of_stmt();}
- |
- (declaration_specifiers function_declarator[0] SEMICOLON)=> // DW 11/02/05 This may not be possible
- {if(statementTrace>=1)
- printf("%d external_declaration Typedef function type\n",LT(1)->getLine());
- }
- declaration
- |
- {if(statementTrace>=1)
- printf("%d external_declaration Typedef variable type\n",LT(1)->getLine());
- }
- declaration
- )
- |
- // Class template declaration or definition
- (template_head (fs = function_specifier)* class_specifier)=>
- {if (statementTrace>=1)
- printf("%d external_declaration Templated class decl or def\n",LT(1)->getLine());
- }
- template_head (fs = function_specifier)* class_decl_or_def[fs] (init_declarator_list)? SEMICOLON {end_of_stmt();} // declaration
- |
- // Enum definition (don't want to backtrack over this in other alts)
- ("enum" (ID)? LCURLY)=>
- {if (statementTrace>=1)
- printf("%d external_declaration Enum definition\n",LT(1)->getLine());
- }
- enum_specifier (init_declarator_list)? SEMICOLON {end_of_stmt();}
- |
- // Destructor definition (templated or non-templated)
- ((template_head)? dtor_head[1] LCURLY)=>
- {if (statementTrace>=1)
- printf("%d external_declaration Destructor definition\n",LT(1)->getLine());
- }
- (template_head)? dtor_head[1] dtor_body
- |
- // Constructor definition (non-templated)
- // JEL 4/3/96 Added predicate that works, once the
- // restriction is added that ctor cannot be virtual
- // and ctor_declarator uses a more restrictive id
- ( (options {warnWhenFollowAmbig = false;}:
- ctor_decl_spec)?
- {qualifiedItemIsOneOf(qiCtor)}?
- )=>
- {if (statementTrace>=1)
- printf("%d external_declaration Constructor definition\n",LT(1)->getLine());
- }
- ctor_definition
- |
- // User-defined type cast
- (("inline")? scope_override conversion_function_decl_or_def)=>
- {if (statementTrace>=1)
- printf("%d external_declaration Operator function\n",LT(1)->getLine());
- }
- ("inline")? s = scope_override conversion_function_decl_or_def
- |
- // Function declaration
- (declaration_specifiers function_declarator[0] SEMICOLON)=>
- {if (statementTrace>=1)
- printf("%d external_declaration Function declaration\n",LT(1)->getLine());
- }
- declaration_specifiers function_declarator[0] SEMICOLON {end_of_stmt();}
- |
- // Function definition
- (declaration_specifiers function_declarator[1] LCURLY)=>
- {if (statementTrace>=1)
- printf("%d external_declaration Function definition\n",LT(1)->getLine());
- }
- function_definition
- |
- // K & R Function definition
- (declaration_specifiers function_declarator[1] declaration)=>
- {K_and_R = true;
- if (statementTrace>=1)
- printf("%d external_declaration K & R function definition\n",LT(1)->getLine());
- }
- function_definition
- |
- // K & R Function definition with int return assumed
- (function_declarator[1] declaration)=>
- {K_and_R = true;
- if (statementTrace>=1)
- printf("%d external_declaration K & R function definition without return type\n",LT(1)->getLine());
- }
- function_definition
- |
- // Class declaration or definition
- (("friend")? (fs = function_specifier)* class_specifier)=>
- {if (statementTrace>=1)
- printf("%d external_declaration Class decl or def\n",LT(1)->getLine());
- }
- ("friend")? (fs = function_specifier)* class_decl_or_def[fs] (init_declarator_list)? SEMICOLON {end_of_stmt();}
- |
- // Templated functions and constructors matched here.
- {beginTemplateDeclaration();}
- template_head
- (
- // templated forward class decl, init/decl of static member in template
- (declaration_specifiers (init_declarator_list)? SEMICOLON {end_of_stmt();})=>
- {if (statementTrace>=1)
- printf("%d external_declaration Templated class forward declaration\n",LT(1)->getLine());
- }
- declaration_specifiers (init_declarator_list)? SEMICOLON {end_of_stmt();}
- |
- // Templated function declaration
- (declaration_specifiers function_declarator[0] SEMICOLON)=>
- {if (statementTrace>=1)
- printf("%d external_declaration Templated function declaration\n",LT(1)->getLine());
- }
- declaration
- |
- // Templated function definition
- (declaration_specifiers function_declarator[1] LCURLY)=>
- {if (statementTrace>=1)
- printf("%d external_declaration_10c Templated function definition\n",LT(1)->getLine());
- }
- function_definition
- |
- // Templated constructor definition
- // JEL 4/3/96 Added predicate that works once the
- // restriction is added that ctor cannot be virtual
- ( ctor_decl_spec
- {qualifiedItemIsOneOf(qiCtor)}?
- )=>
- {if (statementTrace>=1)
- printf("%d external_declaration Templated constructor definition\n",LT(1)->getLine());
- }
- ctor_definition
- )
- {endTemplateDeclaration();}
- |
- // Namespace definition
- {if (statementTrace>=1)
- printf("%d external_declaration Namespace definition\n",LT(1)->getLine());
- }
- "namespace" namespace_definition
- |
- // Anything else
- {if (statementTrace>=1)
- printf("%d external_declaration Declaration\n",LT(1)->getLine());
- }
- declaration
- |
- // Semicolon
- {if (statementTrace>=1)
- printf("%d external_declaration Semicolon\n",LT(1)->getLine());
- }
- SEMICOLON {end_of_stmt();}
- |
- // The next two entries may be used for debugging
- // Use this statement in the source code to turn antlr trace on (See note above)
- "antlrTrace_on" {antlrTrace(true);}
- |
- // Use this statement in the source code to turn antlr trace off (See note above)
- "antlrTrace_off" {antlrTrace(false);}
- )
- ; // end of external_declaration
-
-//namespace_definition
-namespace_definition
- :
- (ns:ID{declaratorID((ns->getText()).data(),qiNamespace);})?
- LCURLY
- {enterNewLocalScope();}
- (external_declaration)*
- {exitNamespaceScope();exitLocalScope();}
- RCURLY
- ;
-
-//namespace_alias_definition
-namespace_alias_definition
- {char *qid;}
- :
- "namespace"
- ns2:ID {declaratorID((ns2->getText()).data(),qiNamespace);}
- ASSIGNEQUAL qid = qualified_id SEMICOLON {end_of_stmt();}
- ;
-
-member_declaration
- {char *q;
- FunctionSpecifier fs = fsInvalid; // inline,virtual,explicit
- }
- :
- (
- // Template explicit specialisation
- ("template" LESSTHAN GREATERTHAN)=>
- {if(statementTrace>=1)
- printf("%d member_declaration Template explicit-specialisation\n",LT(1)->getLine());
- }
- "template" LESSTHAN GREATERTHAN member_declaration
- |
- // All typedefs
- ("typedef")=>
- (
- ("typedef" class_specifier)=>
- {if(statementTrace>=1)
- printf("%d member_declaration Typedef class type\n",LT(1)->getLine());
- }
- "typedef" class_decl_or_def[fs] {_td = true;}(init_declarator_list)? SEMICOLON {end_of_stmt();}
- |
- ("typedef" "enum")=>
- {if(statementTrace>=1)
- printf("%d member_declaration Typedef enum type\n",LT(1)->getLine());
- }
- "typedef" enum_specifier {_td = true;} (init_declarator_list)? SEMICOLON {end_of_stmt();}
- |
- (declaration_specifiers function_declarator[0] SEMICOLON)=> // DW 11/02/05 This may not be possible member declaration
- {if(statementTrace>=1)
- printf("%d member_declaration Typedef function type\n",LT(1)->getLine());
- }
- declaration
- |
- {if(statementTrace>=1)
- printf("%d member_declaration Typedef variable type\n",LT(1)->getLine());
- }
- declaration
- )
- |
- // Templated class declaration or definition
- (template_head (fs = function_specifier)* class_specifier)=>
- {if (statementTrace>=1)
- printf("%d member_declaration Templated class decl or def\n",LT(1)->getLine());
- }
- template_head (fs = function_specifier)* class_decl_or_def[fs] (init_declarator_list)? SEMICOLON {end_of_stmt();} // declaration
- |
- // Enum definition (don't want to backtrack over this in other alts)
- ("enum" (ID)? LCURLY)=>
- {if (statementTrace>=1)
- printf("%d member_declaration Enum definition\n",LT(1)->getLine());
- }
- enum_specifier (member_declarator_list)? SEMICOLON {end_of_stmt();}
- |
- // Constructor declarator
- ( ctor_decl_spec
- {qualifiedItemIsOneOf(qiCtor)}?
- ctor_declarator[0] SEMICOLON
- )=>
- {if (statementTrace>=1)
- printf("%d member_declaration Constructor declarator\n",LT(1)->getLine());
- }
- ctor_decl_spec ctor_declarator[0] SEMICOLON {end_of_stmt();}
- |
- // JEL Predicate to distinguish ctor from function
- // This works now that ctor cannot have VIRTUAL
- // It unfortunately matches A::A where A is not enclosing
- // class -- this will have to be checked semantically
- // Constructor definition
- ( ctor_decl_spec
- {qualifiedItemIsOneOf(qiCtor)}?
- ctor_declarator[1]
- (COLON // DEFINITION :ctor_initializer
- |LCURLY // DEFINITION (compound Statement) ?
- )
- )=>
- {if (statementTrace>=1)
- printf("%d member_declaration Constructor definition\n",LT(1)->getLine());
- }
- ctor_definition
- |
- // No template_head allowed for dtor member
- // Backtrack if not a dtor (no TILDE)
- // Destructor declaration
- (dtor_head[0] SEMICOLON)=>
- {if (statementTrace>=1)
- printf("%d member_declaration Destructor declaration\n",LT(1)->getLine());
- }
- dtor_head[0] SEMICOLON {end_of_stmt();}
- |
- // No template_head allowed for dtor member
- // Backtrack if not a dtor (no TILDE)
- // Destructor definition
- (dtor_head[1] LCURLY)=>
- {if (statementTrace>=1)
- printf("%d member_declaration Destructor definition\n",LT(1)->getLine());
- }
- dtor_head[1] dtor_body
- |
- // Function declaration
- (declaration_specifiers function_declarator[0] SEMICOLON)=>
- {if (statementTrace>=1)
- printf("%d member_declaration Function declaration\n",LT(1)->getLine());
- }
- declaration_specifiers function_declarator[0] SEMICOLON {end_of_stmt();}
- |
- // Function definition
- (declaration_specifiers function_declarator[1] LCURLY)=>
- {beginFieldDeclaration();
- if (statementTrace>=1)
- printf("%d member_declaration Function definition\n",LT(1)->getLine());
- }
- function_definition
- |
- // User-defined type cast
- (("inline")? conversion_function_decl_or_def)=>
- {if (statementTrace>=1)
- printf("%d member_declaration Operator function\n",LT(1)->getLine());
- }
- ("inline")? conversion_function_decl_or_def
- |
- // Hack to handle decls like "superclass::member",
- // to redefine access to private base class public members
- // Qualified identifier
- (qualified_id SEMICOLON)=>
- {if (statementTrace>=1)
- printf("%d member_declaration Qualified ID\n",LT(1)->getLine());
- }
- q = qualified_id SEMICOLON {end_of_stmt();}
- |
- // Member with a type (or just a type def?)
- // A::T a(), ::T a, ::B a, void a, E a (where E is the enclosing class)
- (declaration_specifiers (init_declarator_list)? SEMICOLON)=>
- {beginFieldDeclaration();
- if (statementTrace>=1)
- printf("%d member_declaration Declaration\n",LT(1)->getLine());
- }
- declaration
- |
- // Class declaration or definition
- (("friend")? (fs = function_specifier)* class_specifier)=>
- {if (statementTrace>=1)
- printf("%d member_declaration Class decl or def\n",LT(1)->getLine());
- }
- ("friend")? (fs = function_specifier)* class_decl_or_def[fs] (init_declarator_list)? SEMICOLON {end_of_stmt();}
- |
- // Member without a type (I guess it can only be a function declaration or definition)
- ((fs = function_specifier)* function_declarator[0] SEMICOLON)=>
- {beginFieldDeclaration();
- fprintf(stderr,"%d warning Function declaration found without return type\n",LT(1)->getLine());
- if (statementTrace>=1)
- printf("%d member_declaration Function declaration\n",LT(1)->getLine());
- }
- (fs = function_specifier)* function_declarator[0] SEMICOLON {end_of_stmt();}
-
- |
- // Member without a type (I guess it can only be a function definition)
- {
- fprintf(stderr,"%d warning Function definition found without return type\n",LT(1)->getLine());
- if (statementTrace>=1)
- printf("%d member_declaration Function definition without return type\n",LT(1)->getLine());
- }
- function_declarator[1] compound_statement {endFunctionDefinition();}
- |
- // Templated functions and constructors matched here.
- {beginTemplateDeclaration();}
- template_head
- (
- // templated forward class decl, init/decl of static member in template
- (declaration_specifiers (init_declarator_list)? SEMICOLON)=>
- {if (statementTrace>=1)
- printf("%d member_declaration Templated forward declaration\n",LT(1)->getLine());
- }
- declaration_specifiers (init_declarator_list)? SEMICOLON {end_of_stmt();}
- |
- // Templated function declaration
- (declaration_specifiers function_declarator[0] SEMICOLON)=>
- {if (statementTrace>=1)
- printf("%d member_declaration Templated function declaration\n",LT(1)->getLine());
- }
- declaration
- |
- // Templated function definition
- (declaration_specifiers function_declarator[1] LCURLY)=>
- {if (statementTrace>=1)
- printf("%d member_declaration Templated function definition\n",LT(1)->getLine());
- }
- function_definition
- |
- // Templated constructor definition
- // JEL 4/3/96 Added predicate that works once the
- // restriction is added that ctor cannot be virtual
- (ctor_decl_spec {qualifiedItemIsOneOf(qiCtor)}?
- )=>
- {if (statementTrace>=1)
- printf("%d member_declaration Templated constructor definition\n",LT(1)->getLine());
- }
- ctor_definition
- |
- // Templated operator function
- {if (statementTrace>=1)
- printf("%d member_declaration Templated operator function\n",LT(1)->getLine());
- }
- conversion_function_decl_or_def
- |
- // Templated class definition
- {if (statementTrace>=1)
- printf("%d member_declaration Templated class definition\n",LT(1)->getLine());
- }
- class_head declaration_specifiers (init_declarator_list)? SEMICOLON {end_of_stmt();}
- )
- {endTemplateDeclaration();}
- |
- // Access specifier
- {if (statementTrace>=1)
- printf("%d member_declaration Access specifier\n",LT(1)->getLine());
- }
- access_specifier COLON
- |
- // Semicolon
- {if (statementTrace>=1)
- printf("%d member_declaration Semicolon\n",LT(1)->getLine());
- }
- SEMICOLON {end_of_stmt();}
- |
- // The next two entries may be used for debugging
- // Use this statement in the source code to turn antlr trace on (See note above)
- "antlrTrace_on" {antlrTrace(true);}
- |
- // Use this statement in the source code to turn antlr trace off (See note above)
- "antlrTrace_off" {antlrTrace(false);}
- )
- ; // end member_declaration
-
-//function_definition
-function_definition
- : // don't want next action as an init-action due to (...)=> caller
- {
- beginFunctionDefinition();
- }
- ( // Next line is equivalent to guarded predicate in PCCTS
- // (SCOPE | ID)? => <<qualifiedItemIsOneOf(qiType|qiCtor)>>?
- {( !(LA(1)==SCOPE||LA(1)==ID) || qualifiedItemIsOneOf(qiType|qiCtor) )}?
- declaration_specifiers function_declarator[1]
- ( options{warnWhenFollowAmbig = false;}:
- (declaration)* // Possible for K & R definition
- {in_parameter_list = false;}
- )?
- compound_statement
- | // Next line is equivalent to guarded predicate in PCCTS
- // (SCOPE | ID)? => <<qualifiedItemIsOneOf(qiPtrMember)>>?
- //{( !(LA(1)==SCOPE||LA(1)==ID) || (qualifiedItemIsOneOf(qiPtrMember)) )}?
- function_declarator[1]
- ( options{warnWhenFollowAmbig = false;}:
- (declaration)* // Possible for K & R definition
- {in_parameter_list = false;}
- )?
- compound_statement
- )
- {endFunctionDefinition();}
- ;
-
-//declaration
-declaration
- :
- ("extern" StringLiteral)=>
- linkage_specification
- |
- {beginDeclaration();}
- declaration_specifiers (init_declarator_list)? SEMICOLON {end_of_stmt();}
- {endDeclaration();}
- |
- using_statement
- ;
-
-//linkage_specification
-linkage_specification
- :
- "extern"
- StringLiteral
- (LCURLY (external_declaration)* RCURLY
- |declaration
- )
- ;
-
-//class_head
-class_head
- : // Used only by predicates
- ( "struct"
- | "union"
- | "class"
- )
- (ID
- (LESSTHAN template_argument_list GREATERTHAN)?
- (base_clause)?
- )?
- LCURLY
- ;
-
-//declaration_specifiers
-declaration_specifiers
- {// Locals
- bool td = false; // For typedef
- bool fd = false; // For friend
- StorageClass sc = scInvalid; // auto,register,static,extern,mutable
- TypeQualifier tq = tqInvalid; // const,volatile // aka cv_qualifier See type_qualifier
- TypeSpecifier ts = tsInvalid; // char,int,double, etc., class,struct,union
- FunctionSpecifier fs = fsInvalid; // inline,virtual,explicit
- }
- :
- {
- // Global flags to allow for nested declarations
- _td = false; // For typedef
- _fd = false; // For friend
- _sc = scInvalid; // For StorageClass // auto,register,static,extern,mutable
- _tq = tqInvalid; // For TypeQualifier // aka cv_qualifier See type_qualifier
- _ts = tsInvalid; // For TypeSpecifier
- _fs = fsInvalid; // For FunctionSpecifier // inline,virtual,explicit
-
- }
- ( (options {warnWhenFollowAmbig = false;}
- : "typedef" {td=true;}
- | "friend" {fd=true;}
- | sc = storage_class_specifier // auto,register,static,extern,mutable
- | tq = type_qualifier // const,volatile // aka cv_qualifier See type_qualifier
- | ts = class_specifier // Only here for disambiguation
- | "enum" // Only here for disambiguation
- | fs = function_specifier // inline,virtual,explicit
- | ("_stdcall"|"__stdcall")
- | "GFEXCLUDE" {tq |= tqGFEXCLUDE; _tq |= tqGFEXCLUDE;}
- | "GFINCLUDE" {tq |= tqGFINCLUDE; _tq |= tqGFINCLUDE;}
- | "GFID" {tq |= tqGFID; _tq |= tqGFID;}
- | "GFUNREAD" {tq |= tqGFUNREAD; _tq |= tqGFUNREAD;}
- | "GFARRAYSIZE" LPAREN gfArr:ID RPAREN {gfArraySize(gfArr->getText().data());}
- | "GFARRAYSIZES" LPAREN gfArrList:StringLiteral RPAREN {gfArraySize(gfArrList->getText().data());}
- | "GFARRAYELEMSIZE" LPAREN gfArrElem:ID RPAREN {gfArrayElemSize(gfArrElem->getText().data());}
- )*
- ts = type_specifier
- )
- {declarationSpecifier(td,fd,sc,tq,ts,fs);}
- ;
-
-//storage_class_specifier
-storage_class_specifier returns [CPPParser::StorageClass sc = scInvalid]
- : "auto" {sc = scAUTO;}
- | "register" {sc = scREGISTER;}
- | "static" {sc = scSTATIC;}
- | "extern" {sc = scEXTERN;}
- | "mutable" {sc = scMUTABLE;}
- ;
-
-//function_specifier
-function_specifier returns [CPPParser::FunctionSpecifier fs = fsInvalid]
- : ("inline"|"_inline"|"__inline") {fs = fsINLINE;}
- | "virtual" {fs = fsVIRTUAL;}
- | "explicit" {fs = fsEXPLICIT;}
- ;
-
-//type_specifier
-type_specifier returns [CPPParser::TypeSpecifier ts = tsInvalid]
- {
- TypeQualifier tq = tqInvalid;
- }
- :
- ts = simple_type_specifier
- ;
-
-//simple_type_specifier
-simple_type_specifier returns [CPPParser::TypeSpecifier ts = tsInvalid]
- {char *s;
- ts = tsInvalid;
- }
- : ( {qualifiedItemIsOneOf(qiType|qiCtor)}?
- s = qualified_type
- |
- "typename"
- s = qualified_type
- {declaratorID(s,qiType);} // This stores typename name in dictionary
- |
- ( "char" {ts |= tsCHAR;}
- | "wchar_t" {ts |= tsWCHAR_T;}
- | "bool" {ts |= tsBOOL;}
- | "short" {ts |= tsSHORT;}
- | "int" {ts |= tsINT;}
- | ("_int8"|"__int8"|"int8_t") {ts |= tsINT;}
- | ("_int16"|"__int16"|"int16_t") {ts |= tsINT;}
- | ("_int32"|"__int32"|"int32_t") {ts |= tsLONG;}
- | ("_int64"|"__int64"|"int64_t") {ts |= tsLONG;}
- | ("uint8_t") {ts |= (tsUNSIGNED | tsINT);}
- | ("uint16_t") {ts |= (tsUNSIGNED | tsINT);}
- | ("uint32_t") {ts |= (tsUNSIGNED | tsLONG);}
- | ("uint64_t") {ts |= (tsUNSIGNED | tsLONG);}
- | ("_w64"|"__w64") {ts |= tsLONG;}
- | "long" {ts |= tsLONG;}
- | "signed" {ts |= tsSIGNED;}
- | "unsigned" {ts |= tsUNSIGNED;}
- | "float" {ts |= tsFLOAT;}
- | "double" {ts |= tsDOUBLE;}
- | "void" {ts |= tsVOID;}
- | ("_declspec"|"__declspec") LPAREN ID RPAREN
- )+
- //|
- // Possible fix towards allowing us to parse *.cpp files directly
- //(qualified_type qualified_id)=> s = qualified_type {ts |= tsTYPEID;}
- //{printf("simple_type_specifier third option entered\n");}
- )
- ;
-
-//qualified_type
-qualified_type returns [char *q = NULL]
- {char *s; static char qitem[CPPParser_MaxQualifiedItemSize+1];}
- :
- // JEL 3/29/96 removed this predicate and moved it upwards to
- // simple_type_specifier. This was done to allow parsing of ~ID to
- // be a unary_expression, which was never reached with this
- // predicate on
- // {qualifiedItemIsOneOf(qiType|qiCtor)}?
-
- s = scope_override
- id:ID
- (options {warnWhenFollowAmbig = false;}:
- LESSTHAN template_argument_list GREATERTHAN
- )?
- {
- strcpy(qitem, s);
- strcat(qitem, (id->getText()).data());
- q = qitem;
- }
- ;
-
-//class_specifier
-class_specifier returns [CPPParser::TypeSpecifier ts = tsInvalid]
- :
- ( "class" {ts = tsCLASS;}
- | "struct" {ts = tsSTRUCT;}
- | "union" {ts = tsUNION;}
- )
- ;
-
-//type_qualifier
-type_qualifier returns [CPPParser::TypeQualifier tq = tqInvalid] // aka cv_qualifier
- :
- ( ("const"|"__const") {tq = tqCONST;}
- | ("volatile"|"__volatile__") {tq = tqVOLATILE;}
- )
- ;
-
-//class_prefix
-class_prefix
- :
- (("_declspec"!|"__declspec"!) LPAREN! expression RPAREN!)*
- {
- }
- ;
-
-
-//class_decl_or_def
-class_decl_or_def [FunctionSpecifier fs]
- {char *saveClass;
- char *id;
- TypeSpecifier ts = tsInvalid; // Available for use
- }
- :
- ( "class" {ts = tsCLASS;}
- | "struct" {ts = tsSTRUCT;}
- | "union" {ts = tsUNION;}
- )
- class_prefix // for decltypes
- ("GFIGNORE" LPAREN expression RPAREN {})*
- ( id = qualified_id
- (options{generateAmbigWarnings = false;}:
- (SEMICOLON)=>
- // Empty
- {classForwardDeclaration(ts, fs, id);}
- |
- {saveClass = enclosingClass;
- enclosingClass = symbols->strdup(id);
- }
- (base_clause)?
- LCURLY
- {beginClassDefinition(ts, id);} // This stores class name in dictionary
- (member_declaration)*
- {endClassDefinition();}
- RCURLY
- {enclosingClass = saveClass;}
- )
- |
- LCURLY
- {saveClass = enclosingClass; enclosingClass = (char *) "__anonymous";}
- {beginClassDefinition(ts, "anonymous");} // This stores "anonymous" name in dictionary
- (member_declaration)*
- {endClassDefinition();}
- RCURLY
- {enclosingClass = saveClass;}
- )
- ;
-
-//base_clause
-base_clause
- :
- COLON base_specifier (COMMA base_specifier)*
- ;
-
-//base_specifier
-base_specifier
- {char *qt;}
- :
- ( "virtual" (access_specifier)? qt = qualified_type
- | access_specifier ("virtual")? qt = qualified_type
- | qt = qualified_type
- )
- ;
-
-//access_specifier
-access_specifier
- :
- ( "public"
- | "protected"
- | "private"
- )
- ;
-
-//enum_specifier
-enum_specifier
- {char *id;}
- :
- "enum"
- (
- LCURLY enumerator_list RCURLY
- |
- id = qualified_id
- {beginEnumDefinition(id);} // This stores id name as an enum type in dictionary
- (LCURLY enumerator_list RCURLY)?
- {endEnumDefinition();}
- )
- ;
-
-//enumerator_list
-enumerator_list
- :
- enumerator (COMMA enumerator)*
- ;
-
-//enumerator
-enumerator
- :
- id:ID (ASSIGNEQUAL constant_expression)?
- {enumElement((id->getText()).data());}
- ;
-
-/* This matches a generic qualified identifier ::T::B::foo
- * (including OPERATOR).
- * It might be a good idea to put T::~dtor in here
- * as well, but id_expression in expr.g puts it in manually.
- * Maybe not, 'cause many people use this assuming only A::B.
- * How about a 'qualified_complex_id'?
- */
-//qualified_id
-qualified_id returns [char *q = NULL]
- {
- char *so = NULL;
- static char qitem[CPPParser_MaxQualifiedItemSize+1];
- }
- :
- so = scope_override
- {strcpy(qitem, so);}
- (
- id:ID
- (options{warnWhenFollowAmbig = false;}:
- LESSTHAN template_argument_list GREATERTHAN)?
- {strcat(qitem,(id->getText()).data());}
- |
- OPERATOR optor
- {strcat(qitem,"operator"); strcat(qitem,"NYI");}
- |
- "this" // DW 21/07/03 fix to pass test8.i
- |
- ("true"|"false") // DW 21/07/03 fix to pass test8.i
- )
- {q = qitem;}
- ;
-
-//typeID
-typeID
- :
- {isTypeName((LT(1)->getText()).data())}?
- ID
- ;
-
-//init_declarator_list
-init_declarator_list
- :
- init_declarator (COMMA init_declarator)*
- ;
-
-//init_declarator
-init_declarator
- :
- declarator
- (
- ASSIGNEQUAL
- initializer
- |
- LPAREN expression_list RPAREN
- )?
- ;
-
-//initializer
-initializer
- :
- remainder_expression // assignment_expression
- |
- LCURLY initializer (COMMA (initializer)? )* RCURLY // Allows comma at end of list
- ;
-
-//member_declarator_list
-member_declarator_list
- :
- member_declarator (ASSIGNEQUAL OCTALINT)? // The value must be 0 (pure virt.)
- (COMMA member_declarator (ASSIGNEQUAL OCTALINT)? )*
- ;
-
-//member_declarator
-member_declarator
- :
- ((ID)? COLON constant_expression)=>(ID)? COLON constant_expression
- |
- declarator
- ;
-
-//declarator
-declarator
- :
- (ptr_operator)=> ptr_operator // AMPERSAND or STAR etc.
- declarator
- |
- direct_declarator
- ;
-
-//direct_declarator
-direct_declarator
- {char *id;
- CPPParser::TypeQualifier tq;}
- :
- (qualified_id LPAREN (RPAREN|declaration_specifiers) )=> // Must be function declaration
- id = qualified_id
- {if (_td==true) // This statement is a typedef
- declaratorID(id,qiType);
- else
- declaratorID(id,qiFun);
- }
- LPAREN {declaratorParameterList(0);}
- (parameter_list)?
- RPAREN {declaratorEndParameterList(0);}
- (tq = type_qualifier)*
- (exception_specification)?
- |
- (qualified_id LPAREN qualified_id)=> // Must be class instantiation
- id = qualified_id
- {declaratorID(id,qiVar);}
- LPAREN
- expression_list
- RPAREN
- |
- (qualified_id LSQUARE)=> // Must be array declaration
- id = qualified_id
- {if (_td==true) // This statement is a typedef
- declaratorID(id,qiType); // This statement is a typedef
- else
- declaratorID(id,qiVar);
- is_address = false; is_pointer = false;
- }
- (options {warnWhenFollowAmbig = false;}:
- LSQUARE (constant_expression)? RSQUARE)+
- {declaratorArray();}
- |
- id = qualified_id
- {if (_td==true)
- declaratorID(id,qiType); // This statement is a typedef
- else
- declaratorID(id,qiVar);
- is_address = false; is_pointer = false;
- }
- |
- // DW 24/05/04 This block probably never entered as dtor selected out earlier
- // Note In fact no dictionary entries for ctor or dtor
- TILDE dtor:ID {declaratorID((dtor->getText()).data(),qiDtor);} // Note "class" not recorded in CPPSymbol
- {fprintf(stderr,"%d warning direct_declarator5 entered unexpectedly with %s\n",
- LT(1)->getLine(),(dtor->getText()).data());}
- LPAREN {declaratorParameterList(0);}
- (parameter_list)?
- RPAREN {declaratorEndParameterList(0);}
- |
- LPAREN declarator RPAREN
- (options {warnWhenFollowAmbig = false;}:
- declarator_suffix)? // DW 1/9/04 declarator_suffix made optional as failed on line 2956 in metrics.i
- ; // According to the grammar a declarator_suffix is not required here
-
-//declarator_suffix
-declarator_suffix // Note: Only used above in direct_declarator
- {CPPParser::TypeQualifier tq;}
- :
- (
- //(options {warnWhenFollowAmbig = false;}:
- (LSQUARE (constant_expression)? RSQUARE)+
- {declaratorArray();}
- |
- {(!((LA(1)==LPAREN)&&(LA(2)==ID))||(qualifiedItemIsOneOf(qiType|qiCtor,1)))}?
- LPAREN {declaratorParameterList(0);}
- (parameter_list)?
- RPAREN {declaratorEndParameterList(0);}
- (tq = type_qualifier)*
- (exception_specification)?
- )
- ;
-
-//conversion_function_decl_or_def
-conversion_function_decl_or_def
- {CPPParser::TypeQualifier tq;}
- :
- OPERATOR declaration_specifiers (STAR | AMPERSAND)? // DW 01/08/03 Use type_specifier here? see syntax
- (LESSTHAN template_parameter_list GREATERTHAN)?
- LPAREN (parameter_list)? RPAREN
- (tq = type_qualifier)* // DW 29/07/05 ? changed to *
- (exception_specification)?
- ( compound_statement
- | SEMICOLON {end_of_stmt();}
- )
- ;
-
- //function_declarator
-function_declarator [int definition]
- :
- (ptr_operator)=> ptr_operator function_declarator[definition]
- |
- function_direct_declarator[definition]
- ;
-
-//function_direct_declarator
-function_direct_declarator [int definition]
- {char *q;
- CPPParser::TypeQualifier tq;}
- :
- /* predicate indicate that plain ID is ok here; this counteracts any
- * other predicate that gets hoisted (along with this one) that
- * indicates that an ID is a type or whatever. E.g.,
- * another rule testing isTypeName() alone, implies that the
- * the ID *MUST* be a type name. Combining isTypeName() and
- * this predicate in an OR situation like this one:
- * ( declaration_specifiers ... | function_declarator ... )
- * would imply that ID can be a type name OR a plain ID.
- */
- ( // fix prompted by (isdigit)() in xlocnum
- LPAREN
- q = qualified_id
- {
- declaratorID(q,qiFun);
- }
- RPAREN
- |
- q = qualified_id
- {
- declaratorID(q,qiFun);
- }
- )
-
- {
-#ifdef MYCODE
- if (definition)
- myCode_function_direct_declarator(q);
-#endif //MYCODE
- }
-
- LPAREN
- {
- functionParameterList();
- if (K_and_R == false)
- in_parameter_list = true;
- }
- (parameter_list)?
- {
- if (K_and_R == false)
- in_parameter_list = false;
- else
- in_parameter_list = true;
- }
- RPAREN
- (options{warnWhenFollowAmbig = false;}:
- tq = type_qualifier)*
- (ASSIGNEQUAL OCTALINT)? // The value of the octal must be 0
- {functionEndParameterList(definition);}
- (exception_specification)?
- ;
-
-
-//ctor_definition
-ctor_definition
- :
- ctor_head
- ctor_body
- {endConstructorDefinition();}
- ;
-
-//ctor_head
-ctor_head
- :
- ctor_decl_spec
- ctor_declarator[1]
- ;
-
-//ctor_decl_spec
-ctor_decl_spec
- :
- (("inline"|"_inline"|"__inline")|"explicit")*
- ;
-
-//ctor_declarator
-ctor_declarator[int definition]
- {char *q;}
- :
- q = qualified_ctor_id
- {declaratorParameterList(definition);}
- LPAREN (parameter_list)? RPAREN
- {declaratorEndParameterList(definition);}
- (exception_specification)?
- ;
-
-// This matches a generic qualified identifier ::T::B::foo
-// that is satisfactory for a ctor (no operator, no trailing <>)
-qualified_ctor_id returns [char *q = NULL]
- {
- char *so;
- static char qitem[CPPParser_MaxQualifiedItemSize+1];
- }
- :
- so = scope_override
- {strcpy(qitem, so);}
- id:ID // DW 24/05/04 Note. Neither Ctor or Dtor recorded in dictionary
- {strcat(qitem,(id->getText()).data());
- q = qitem;}
- ;
-
-//ctor_body
-ctor_body
- :
- (ctor_initializer)?
- compound_statement
- ;
-
-//ctor_initializer
-ctor_initializer
- :
- COLON superclass_init (COMMA superclass_init)*
- ;
-
-//superclass_init
-superclass_init
- {char *q;}
- :
- q = qualified_id LPAREN (expression_list)? RPAREN
- ;
-
-//dtor_head
-dtor_head[int definition]
- :
- dtor_decl_spec
- dtor_declarator[definition]
- ;
-
-//dtor_decl_spec
-dtor_decl_spec
- :
- (("inline"|"_inline"|"__inline")|"virtual")*
- ;
-
-//dtor_declarator
-dtor_declarator[int definition]
- {char *s;}
- :
- s = scope_override
- TILDE ID
- {declaratorParameterList(definition);}
- LPAREN ("void")? RPAREN
- {declaratorEndParameterList(definition);}
- (exception_specification)?
- ;
-
-//dtor_body
-dtor_body
- :
- compound_statement
- {endDestructorDefinition();}
- ;
-
-//parameter_list
-parameter_list
- :
- parameter_declaration_list (ELLIPSIS)?
- ;
-
-//parameter_declaration_list
-parameter_declaration_list
- :
- (parameter_declaration (COMMA parameter_declaration)* )
- ;
-
-//parameter_declaration
-parameter_declaration
- :
- {beginParameterDeclaration();}
- (
- {!((LA(1)==SCOPE) && (LA(2)==STAR||LA(2)==OPERATOR)) &&
- (!(LA(1)==SCOPE||LA(1)==ID) || qualifiedItemIsOneOf(qiType|qiCtor) )}?
-
- declaration_specifiers // DW 24/3/98 Mods for K & R
- (
- (declarator)=> declarator // if arg name given
- |
- abstract_declarator // if arg name not given // can be empty
- )
- |
- (declarator)=> declarator // DW 24/3/98 Mods for K & R
- |
- ELLIPSIS
- )
- (ASSIGNEQUAL
- remainder_expression // DW 18/4/01 assignment_expression
- )?
- ;
-
-//type_id
-type_id
- :
- declaration_specifiers abstract_declarator
- ;
-
-/* This rule looks a bit weird because (...) can happen in two
- * places within the declaration such as "void (*)()" (ptr to
- * function returning nothing). However, the () of a function
- * can only occur after having seen either a (abstract_declarator)
- * and not after a [..] or simple '*'. These are the only two
- * valid () func-groups:
- * int (*)(); // ptr to func
- * int (*[])(); // array of ptr to func
- */
-//abstract_declarator
-abstract_declarator
- :
- ptr_operator abstract_declarator
- |
- (LPAREN (ptr_operator)+ RPAREN)=> LPAREN (ptr_operator)+ RPAREN
- (options {warnWhenFollowAmbig = false;}:
- abstract_declarator_suffix)?
- |
- // DW 13/06/05
- (options {warnWhenFollowAmbig = false;}:
- abstract_declarator_suffix)?
- ;
-
-//abstract_declarator_suffix
-abstract_declarator_suffix
- :
- (LSQUARE (constant_expression)? RSQUARE)+
- {declaratorArray();}
- |
- LPAREN
- {declaratorParameterList(0);}
- (parameter_list)?
- RPAREN
- {declaratorEndParameterList(0);}
- cv_qualifier_seq
- (exception_specification)?
- ;
-
-//exception_specification
-exception_specification
- {char *so;}
- :
- "throw"
- LPAREN
- ( (so = scope_override ID (COMMA so = scope_override ID)* )?
- | ELLIPSIS
- )
- RPAREN
- ;
-
-//template_head
-template_head
- :
- "template"
- LESSTHAN template_parameter_list GREATERTHAN
- ;
-
-//template_parameter_list
-template_parameter_list
- :
- {beginTemplateParameterList();}
- template_parameter (COMMA template_parameter)*
- {endTemplateParameterList();}
- ;
-
-/* Rule requires >2 lookahead tokens. The ambiguity is resolved
- * correctly, however. According to the manual "...A template argument
- * that can be interpreted either as a parameter-declaration or a
- * type-argument (because its identifier is the name of an
- * already existing class) is taken as type-argument."
- * Therefore, any "class ID" that is seen on the input, should
- * match the first alternative here (it should be a type-argument).
- */
-//template_parameter
-template_parameter
- :
- (options{generateAmbigWarnings = false;}:
- type_parameter
- |
- parameter_declaration
- )
- ;
-
-//type_parameter
-type_parameter
- :
- (
- ("class"|"typename")
- (id:ID
- {
- templateTypeParameter((id->getText()).data());
- }
- (ASSIGNEQUAL assigned_type_name)?
- )?
- |
- template_head "class"
- (id2:ID
- {
- templateTypeParameter((id2->getText()).data());
- }
- (ASSIGNEQUAL assigned_type_name)?
- )?
- )
- ;
-
-/* This is to allow an assigned type_name in a template parameter
- * list to be defined previously in the same parameter list,
- * as type setting is ineffective whilst guessing
- */
-//assigned_type_name
-assigned_type_name
- {char* qt; TypeSpecifier ts;}
- :
- (options{generateAmbigWarnings = false;}:
- qt = qualified_type abstract_declarator
- |
- ts = simple_type_specifier abstract_declarator
- )
- ;
-
-// This rule refers to an instance of a template class or function
-//template_id
-template_id // aka template_class_name
- :
- ID LESSTHAN template_argument_list GREATERTHAN
- ;
-
-//template_argument_list
-template_argument_list
- :
- template_argument (COMMA template_argument)*
- ;
-
-/* Here assignment_expression was changed to shift_expression to rule out
- * x< 1<2 > which causes ambiguities. As a result, these can be used only
- * by enclosing parentheses x<(1<2)>. This is true for x<1+2> ==> bad,
- * x<(1+2)> ==> ok.
- */
-//template_argument
-template_argument
- :
- // DW 07/04/05 This predicate only used here if next is SCOPE or ID
- {( !(LA(1)==SCOPE||LA(1)==ID) || qualifiedItemIsOneOf(qiType|qiCtor) )}?
- type_id
- |
- shift_expression // failed in iosfwd
- ;
-
-///////////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////
-////////////////////////////// STATEMENTS ////////////////////////////
-///////////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////
-
-statement_list
- :
- (statement)+
- ;
-
-statement
- {
- FunctionSpecifier fs = fsInvalid; // inline,virtual,explicit
- }
- :
- ( ("namespace"|"using")=>
- block_declaration
- | (("typedef")? class_specifier (qualified_id)? LCURLY)=>
- member_declaration
- | (declaration_specifiers LPAREN ptr_operator qualified_id RPAREN)=>
- member_declaration
- | (declaration_specifiers (ptr_operator ptr_operator) qualified_id)=>
- member_declaration
- | (declaration_specifiers ((ptr_operator)=>ptr_operator)? qualified_id)=>
- member_declaration
- | labeled_statement
- | case_statement
- | default_statement
- | expression SEMICOLON! {end_of_stmt();}
- | compound_statement
- | selection_statement
- | iteration_statement
- | jump_statement
- | SEMICOLON! {end_of_stmt();}
- | try_block
- | throw_statement
- // The next two entries may be used for debugging
- // Use this statement in the source code to turn antlr trace on (See note above)
- | "antlrTrace_on" {antlrTrace(true);}
- // Use this statement in the source code to turn antlr trace off (See note above)
- | "antlrTrace_off" {antlrTrace(false);}
- )
- ;
-
-//block_declaration
-block_declaration
- : simple_declaration
- | asm_definition
- | namespace_alias_definition
- | using_statement
- ;
-
-//simple_definition
-simple_declaration
- :
- declaration_specifiers (init_declarator_list)? SEMICOLON {end_of_stmt();}
- ;
-
-labeled_statement
- :
- ID COLON statement
- ;
-
-case_statement
- : "case"
- constant_expression COLON statement
- ;
-
-default_statement
- :
- "default" COLON statement
- ;
-
-compound_statement
- :
- LCURLY
- {end_of_stmt();
- enterNewLocalScope();
- }
- (statement_list)?
- RCURLY
- {exitLocalScope();}
- ;
-
-/* NOTE: cannot remove ELSE ambiguity, but it parses correctly.
- * The warning is removed with the options statement
- */
-selection_statement
- :
- "if" LPAREN
- expression RPAREN
- statement
- (options {warnWhenFollowAmbig = false;}:
- "else" statement)?
- |
- "switch" LPAREN expression RPAREN statement
- ;
-
-iteration_statement
- :
- "while"
- LPAREN expression RPAREN
- statement
- |
- "do"
- statement "while"
- LPAREN expression RPAREN
- SEMICOLON {end_of_stmt();}
- |
- "for" LPAREN
- ( (declaration)=> declaration
- | expression SEMICOLON {end_of_stmt();}
- | SEMICOLON {end_of_stmt();}
- )
- (expression)? SEMICOLON {end_of_stmt();}
- (expression)?
- RPAREN statement
- ;
-
-jump_statement
- :
- ( "goto" ID SEMICOLON {end_of_stmt();}
- | "continue" SEMICOLON {end_of_stmt();}
- | "break" SEMICOLON {end_of_stmt();}
- | // DW 16/05/03 May be problem here if return is followed by a cast expression
- "return" {in_return = true;}
- ( options{warnWhenFollowAmbig = false;}:
- (LPAREN {(qualifiedItemIsOneOf(qiType) )}? ID RPAREN)=>
- LPAREN ID RPAREN (expression)? // This is an unsatisfactory fix for problem in xstring re "return (allocator);"
- // and in xlocale re return (_E)(_Tolower((unsigned char)_C, &_Ctype));
- //{printf("%d CPP_parser.g jump_statement Return fix used\n",LT(1)->getLine());}
- | expression
- )? SEMICOLON {in_return = false,end_of_stmt();}
- )
- ;
-
-try_block
- :
- "try" compound_statement (handler)*
- ;
-
-handler
- :
- "catch"
- {exceptionBeginHandler();}
- {declaratorParameterList(1);}
- LPAREN exception_declaration RPAREN
- {declaratorEndParameterList(1);}
- compound_statement
- {exceptionEndHandler();}
- ;
-
-exception_declaration
- :
- parameter_declaration_list
- ;
-
-/* This is an expression of type void according to the ARM, which
- * to me means "statement"; it removes some ambiguity to put it in
- * as a statement also.
- */
-throw_statement
- :
- "throw" (assignment_expression) ? SEMICOLON { end_of_stmt();}
- ;
-
-using_statement
- {char *qid;}
- :
- "using"
- ("namespace" qid = qualified_id // Using-directive
- |("typename")? qid = qualified_id // Using-declaration
- )
- SEMICOLON {end_of_stmt();}
- ;
-
-asm_definition
- :
- ("asm"|"_asm"|"__asm"|"__asm__") LPAREN StringLiteral RPAREN SEMICOLON {end_of_stmt();}
- ;
-
-///////////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////
-////////////////////////////// EXPRESSIONS ///////////////////////////
-///////////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////
-
-expression
- :
- assignment_expression (COMMA assignment_expression)*
- ;
-
-// right-to-left for assignment op
-assignment_expression
- :
- conditional_expression
- (
- (ASSIGNEQUAL|TIMESEQUAL|DIVIDEEQUAL|MINUSEQUAL|PLUSEQUAL
- |MODEQUAL|SHIFTLEFTEQUAL|SHIFTRIGHTEQUAL|BITWISEANDEQUAL
- |BITWISEXOREQUAL|BITWISEOREQUAL
- )
- remainder_expression
- )?
- ;
-
-remainder_expression
- :
- (
- (conditional_expression (COMMA|SEMICOLON|RPAREN) )=>
- {assign_stmt_RHS_found += 1;}
- assignment_expression
- {
- if (assign_stmt_RHS_found > 0)
- assign_stmt_RHS_found -= 1;
- else
- {
- fprintf(stderr,"%d warning Error in assign_stmt_RHS_found = %d\n",
- LT(1)->getLine(),assign_stmt_RHS_found);
- fprintf(stderr,"Press return to continue\n");
- getchar();
- }
- }
- |
- assignment_expression
- )
- ;
-
-conditional_expression
- :
- logical_or_expression
- (QUESTIONMARK expression COLON conditional_expression)?
- ;
-
-constant_expression
- :
- conditional_expression
- ;
-
-logical_or_expression
- :
- logical_and_expression (OR logical_and_expression)*
- ;
-
-logical_and_expression
- :
- inclusive_or_expression (AND inclusive_or_expression)*
- ;
-
-inclusive_or_expression
- :
- exclusive_or_expression (BITWISEOR exclusive_or_expression)*
- ;
-
-exclusive_or_expression
- :
- and_expression (BITWISEXOR and_expression)*
- ;
-
-and_expression
- :
- equality_expression (AMPERSAND equality_expression)*
- ;
-
-equality_expression
- :
- relational_expression ( (NOTEQUAL|EQUAL) relational_expression)*
- ;
-
-relational_expression
- :
- shift_expression
- (options {warnWhenFollowAmbig = false;}:
- ( LESSTHAN
- | GREATERTHAN
- | LESSTHANOREQUALTO
- | GREATERTHANOREQUALTO
- )
- shift_expression
- )*
- ;
-
-shift_expression
- :
- additive_expression ((SHIFTLEFT | SHIFTRIGHT) additive_expression)*
- ;
-
-// See comment for multiplicative_expression regarding #pragma
-additive_expression
- :
- multiplicative_expression
- (options{warnWhenFollowAmbig = false;}:
- (PLUS | MINUS) multiplicative_expression
- )*
- ;
-
-// ANTLR has trouble dealing with the analysis of the confusing unary/binary
-// operators such as STAR, AMPERSAND, PLUS, etc...
-// With the #pragma (now "(options{warnWhenFollowAmbig = false;}:" etc.)
-// we simply tell ANTLR to use the "quick-to-analyze" approximate lookahead
-// as full LL(k) lookahead will not resolve the ambiguity anyway. Might
-// as well not bother. This has the side-benefit that ANTLR doesn't go
-// off to lunch here (take infinite time to read grammar).
-multiplicative_expression
- :
- pm_expression
- (options{warnWhenFollowAmbig = false;}:
- (STAR|DIVIDE|MOD) pm_expression
- )*
- ;
-
-pm_expression
- :
- cast_expression ( (DOTMBR|POINTERTOMBR) cast_expression)*
- ;
-
-/* The string "( ID" can be either the start of a cast or
- * the start of a unary_expression. However, the ID must
- * be a type name for it to be a cast. Since ANTLR can only hoist
- * semantic predicates that are visible without consuming a token,
- * the semantic predicate in rule type_name is not hoisted--hence, the
- * rule is reported to be ambiguous. I am manually putting in the
- * correctly hoisted predicate.
- *
- * Ack! Actually "( ID" might be the start of "(T(expr))" which makes
- * the first parens just an ordinary expression grouping. The solution
- * is to look at what follows the type, T. Note, this could be a
- * qualified type. Yucko. I believe that "(T(" can only imply
- * function-style type cast in an expression (...) grouping.
- *
- * We DO NOT handle the following situation correctly at the moment:
- * Suppose you have
- * struct rusage rusage;
- * return (rusage.fp);
- * return (rusage*)p;
- * Now essentially there is an ambiguity here. If rusage is followed by any
- * postix operators then it is an identifier else it is a type name. This
- * problem does not occur in C because, unless the tag struct is attached,
- * rusage is not a type name. However in C++ that restriction is removed.
- * No *real* programmer would do this, but it's in the C++ standard just for
- * fun..
- *
- * Another fun one (from an LL standpoint):
- *
- * (A::B::T *)v; // that's a cast of v to type A::B::T
- * (A::B::foo); // that's a simple member access
- *
- * The qualifiedItemIs(1) function scans ahead to what follows the
- * final "::" and returns qiType if the item is a type. The offset of
- * '1' makes it ignore the initial LPAREN; normally, the offset is 0.
- */
-
-cast_expression
- {TypeQualifier tq;
- TypeSpecifier ts;}
- :
- (LPAREN (type_qualifier)* simple_type_specifier (ptr_operator)* RPAREN unary_expression)=>
- LPAREN (tq = type_qualifier)* ts = simple_type_specifier (ptr_operator)* RPAREN unary_expression
- |
- (LPAREN (type_qualifier)* simple_type_specifier (ptr_operator)* RPAREN)=>
- // Believe it or not, you can get more than one cast expression in sequence
- LPAREN (tq = type_qualifier)* ts = simple_type_specifier (ptr_operator)* RPAREN cast_expression
- |
- unary_expression // handles outer (...) of "(T(expr))"
- ;
-
-unary_expression
- :
- (
- (postfix_expression)=>
- postfix_expression
- |
- PLUSPLUS unary_expression
- |
- MINUSMINUS unary_expression
- |
- unary_operator cast_expression
- |
- ( "sizeof"
- | "__alignof__" //Zhaojz 02/02/05 to fix bug 29 (GNU)
- )
- ( (unary_expression)=>
- unary_expression
- |
- LPAREN type_id RPAREN
- )
- |
- (SCOPE)?
- (new_expression
- |delete_expression
- )
- )
- ;
-
-postfix_expression
- {
- TypeSpecifier ts;
- }
- :
- (
- options {warnWhenFollowAmbig = false;}:
- // Function-style cast must have a leading type
- {!(LA(1)==LPAREN)}?
- (ts = simple_type_specifier LPAREN RPAREN LPAREN)=> // DW 01/08/03 To cope with problem in xtree (see test10.i)
- ts = simple_type_specifier LPAREN RPAREN LPAREN (expression_list)? RPAREN
- |
- {!(LA(1)==LPAREN)}?
- (ts = simple_type_specifier LPAREN)=>
- ts = simple_type_specifier LPAREN (expression_list)? RPAREN
- |
- primary_expression
- (options {warnWhenFollowAmbig = false;}:
- LSQUARE expression RSQUARE
- |
- LPAREN (expression_list)? RPAREN
- | (DOT|POINTERTO) ("template")? id_expression
- | PLUSPLUS
- | MINUSMINUS
- )*
- |
- ("dynamic_cast"|"static_cast"|"reinterpret_cast"|"const_cast")
- LESSTHAN ("const"|"__const")? ts = type_specifier (ptr_operator)? GREATERTHAN
- LPAREN expression RPAREN
- |
- "typeid"
- LPAREN ((type_id)=>type_id|expression) RPAREN
- )
- ;
-
-primary_expression
- : id_expression
- | constant
- | "this"
- | LPAREN expression RPAREN
- ;
-
-id_expression
- {char *s;}
- :
- s = scope_override
- ( ID
- | OPERATOR optor
- | TILDE (STAR)? ID // DW 29/07/03 STAR included to allow for *_S = ~*_S; seen in vector
- )
- ;
-
-constant
- : OCTALINT
- | DECIMALINT
- | HEXADECIMALINT
- | CharLiteral
- | WCharLiteral
- | (StringLiteral | WStringLiteral)+
- | FLOATONE
- | FLOATTWO
- | "true"
- | "false"
- ;
-
-unary_operator
- : AMPERSAND
- | STAR
- | PLUS
- | MINUS
- | TILDE
- | NOT
- ;
-
-/* JEL The first ()? is used to resolve "new (expr) (type)" because both
- * (expr) and (type) look identical until you've seen the whole thing.
- *
- * new_initializer appears to be conflicting with function arguments as
- * function arguments can follow a primary_expression. [This is a full
- * LL(k) versus LALL(k) problem. Enhancing context by duplication of
- * some rules might handle this.]
- */
-new_expression
- :
- (
- "new"
- ( (LPAREN expression_list RPAREN)=>
- LPAREN expression_list RPAREN)?
- (new_type_id|LPAREN type_id RPAREN)
- (options{warnWhenFollowAmbig = false;}:
- (new_initializer)=> new_initializer)?
- )
- ;
-
-new_initializer
- :
- LPAREN (expression_list)? RPAREN
- ;
-
-new_type_id
- :
- declaration_specifiers
- (options {warnWhenFollowAmbig = false;}:
- new_declarator
- )?
- ;
-
-new_declarator
- :
- ptr_operator
- (options {warnWhenFollowAmbig = false;}:
- new_declarator)?
- |
- direct_new_declarator
- ;
-
-/* The "[expression]" construct conflicts with the "new []" construct
- * (and possibly others). We used approximate lookahead for the "new []"
- * construct so that it would not try to compute full LL(2) lookahead.
- * Here, we use #pragma approx again because anytime we see a [ followed
- * by token that can begin an expression, we always want to loop.
- * Approximate lookahead handles this correctly. In fact, approximate
- * lookahead is the same as full lookahead when all but the last lookahead
- * depth are singleton sets; e.g., {"["} followed by FIRST(expression).
- */
-direct_new_declarator
- :
- (options {warnWhenFollowAmbig = false;}:
- LSQUARE expression RSQUARE
- )+
- ;
-
-//ptr_operator
-ptr_operator
- :
- ( AMPERSAND {is_address = true;}
- | ("_cdecl"|"__cdecl")
- | ("_near"|"__near")
- | ("_far"|"__far")
- | "__interrupt"
- | ("pascal"|"_pascal"|"__pascal")
- | ("_stdcall"|"__stdcall")
- | ptr_to_member // e.g. STAR
- )
- ;
-
-// Match A::B::*
-//ptr_to_member
-ptr_to_member // Part of ptr_operator in grammar.txt
- {char *s;}
- :
- s = scope_override STAR {is_pointer = true;} cv_qualifier_seq
- ;
-
-// JEL note: does not use (const|volatile)* to avoid lookahead problems
-cv_qualifier_seq
- {CPPParser::TypeQualifier tq;}
- :
- (tq = type_qualifier)*
- ;
-
-//scope_override
-// Match the A::B::C:: or nothing
-scope_override returns [char *s = NULL]
- {
- static char sitem[CPPParser_MaxQualifiedItemSize+1];
- sitem[0]='\0';
- }
- :
- (SCOPE {strcat(sitem,"::");} )?
- ( options {warnWhenFollowAmbig = false;}:
- {scopedItem()}?
- id:ID (LESSTHAN template_argument_list GREATERTHAN)?
- SCOPE
- ("template")? // DW 04/06/05 See _Alloc::template in testMbanefo.i
- {
- CPPSymbol *cs = (CPPSymbol *) symbols->lookup((id->getText()).data());
- strcat(sitem,(id->getText()).data());
- strcat(sitem,"::");
- }
- )*
- {s = sitem;}
- ;
-
-delete_expression
- :
- "delete" (LSQUARE RSQUARE)? cast_expression
- ;
-
-expression_list
- :
- assignment_expression (COMMA assignment_expression)*
- ;
-
-optor
- :
- "new"
- (options {warnWhenFollowAmbig = false;}:
- LSQUARE RSQUARE | ) // check syntax
- |
- "delete"
- (options {warnWhenFollowAmbig = false;}:
- LSQUARE RSQUARE | ) // check syntax
- |
- LPAREN RPAREN
- |
- LSQUARE RSQUARE
- |
- optor_simple_tokclass //OPTOR_SIMPLE_TOKCLASS
- ;
-
-//Zuo 5/11/2001
-// This is the equivalent to "#tokclass OPTOR_SIMPLE_TOKCLASS" in cplusplus.g
-
-optor_simple_tokclass
- :
- (PLUS|MINUS|STAR|DIVIDE|MOD|BITWISEXOR|AMPERSAND|BITWISEOR|TILDE|NOT|
- SHIFTLEFT|SHIFTRIGHT|
- ASSIGNEQUAL|TIMESEQUAL|DIVIDEEQUAL|MODEQUAL|PLUSEQUAL|MINUSEQUAL|
- SHIFTLEFTEQUAL|SHIFTRIGHTEQUAL|BITWISEANDEQUAL|BITWISEXOREQUAL|BITWISEOREQUAL|
- EQUAL|NOTEQUAL|LESSTHAN|GREATERTHAN|LESSTHANOREQUALTO|GREATERTHANOREQUALTO|OR|AND|
- PLUSPLUS|MINUSMINUS|COMMA|POINTERTO|POINTERTOMBR
- )
- ;
-
-class CPPLexer extends Lexer;
-
-options
- {
- k = 3;
- exportVocab = STDC;
- testLiterals = true;
- }
-
-// DW 4/11/02 put in to support manual hoisting
-tokens
- {
- OPERATOR = "operator";
- }
-
-{
-void deferredNewline()
- {
- deferredLineCount++; // Declared and initialised in main.cpp
- }
-
-void newline()
- {
- for (;deferredLineCount>0;deferredLineCount--)
- {
- CharScanner::newline();
- }
- CharScanner::newline();
- }
-}
-
-// Operators:
-
-ASSIGNEQUAL : '=' ;
-COLON : ':' ;
-COMMA : ',' ;
-QUESTIONMARK : '?' ;
-SEMICOLON : ';' ;
-POINTERTO : "->" ;
-
-// DOT & ELLIPSIS are commented out since they are generated as part of
-// the Number rule below due to some bizarre lexical ambiguity shme.
-// DOT : '.' ;
-// ELLIPSIS : "..." ;
-
-LPAREN : '(' ;
-RPAREN : ')' ;
-LSQUARE : '[' ;
-RSQUARE : ']' ;
-LCURLY : '{' ;
-RCURLY : '}' ;
-
-EQUAL : "==" ;
-NOTEQUAL : "!=" ;
-LESSTHANOREQUALTO : "<=" ;
-LESSTHAN : "<" ;
-GREATERTHANOREQUALTO : ">=" ;
-GREATERTHAN : ">" ;
-
-DIVIDE : '/' ;
-DIVIDEEQUAL : "/=" ;
-PLUS : '+' ;
-PLUSEQUAL : "+=" ;
-PLUSPLUS : "++" ;
-MINUS : '-' ;
-MINUSEQUAL : "-=" ;
-MINUSMINUS : "--" ;
-STAR : '*' ;
-TIMESEQUAL : "*=" ;
-MOD : '%' ;
-MODEQUAL : "%=" ;
-SHIFTRIGHT : ">>" ;
-SHIFTRIGHTEQUAL : ">>=" ;
-SHIFTLEFT : "<<" ;
-SHIFTLEFTEQUAL : "<<=" ;
-
-AND : "&&" ;
-NOT : '!' ;
-OR : "||" ;
-
-AMPERSAND : '&' ;
-BITWISEANDEQUAL : "&=" ;
-TILDE : '~' ;
-BITWISEOR : '|' ;
-BITWISEOREQUAL : "|=" ;
-BITWISEXOR : '^' ;
-BITWISEXOREQUAL : "^=" ;
-
-//Zuo: the following tokens are come from cplusplus.g
-
-POINTERTOMBR : "->*" ;
-DOTMBR : ".*" ;
-
-SCOPE : "::" ;
-
-Whitespace
- :
- ( // whitespace ignored
- (' ' |'\t' | '\f')
- | // handle newlines
- ( '\r' '\n' // MS
- | '\r' // Mac
- | '\n' // Unix
- ) { newline(); }
- | // handle continuation lines
- ( '\\' '\r' '\n' // MS
- | '\\' '\r' // Mac
- | '\\' '\n' // Unix
- ) {printf("CPP_parser.g continuation line detected\n");
- deferredNewline();}
- )
- {_ttype = ANTLR_USE_NAMESPACE(antlr)Token::SKIP;}
- ;
-
-Comment
- :
- "/*"
- ( {LA(2) != '/'}? '*'
- | EndOfLine {deferredNewline();}
- | ~('*'| '\r' | '\n')
- )*
- "*/" {_ttype = ANTLR_USE_NAMESPACE(antlr)Token::SKIP;}
- ;
-
-CPPComment
- :
- "//" (~('\n' | '\r'))* EndOfLine
- {_ttype = ANTLR_USE_NAMESPACE(antlr)Token::SKIP; newline();}
- ;
-
-PREPROC_DIRECTIVE
- options{paraphrase = "a preprocessor directive";}
- :
- ('#' (~('\r' | '\n'))* EndOfLine)
- {_ttype = ANTLR_USE_NAMESPACE(antlr)Token::SKIP; newline();}
- ;
-
-protected
-LineDirective
- :
- ("line")? // this would be for if the directive started "#line"
- (Space)+
- n:Decimal
- (Space)+
- (sl:StringLiteral)
- ((Space)+ Decimal)* // To support cpp flags (GNU)
- {
- process_line_directive((sl->getText()).data(), (n->getText()).data()); // see main()
- }
- EndOfLine
- ;
-
-protected
-Space
- :
- (' '|'\t'|'\f')
- ;
-
-
-protected
-Pragma
- :
- ('#' "pragma" (~('\r' | '\n'))* EndOfLine)
- {_ttype = ANTLR_USE_NAMESPACE(antlr)Token::SKIP; newline();}
- ;
-
-protected
-Error
- :
- ('#' "error" (~('\r' | '\n'))* EndOfLine)
- {_ttype = ANTLR_USE_NAMESPACE(antlr)Token::SKIP; newline();}
- ;
-
-
-// Literals:
-
-/*
- * Note that we do NOT handle tri-graphs nor multi-byte sequences.
- */
-
-/*
- * Note that we can't have empty character constants (even though we
- * can have empty strings :-).
- */
-CharLiteral
- :
- '\'' (Escape | ~('\'')) '\''
- ;
-
-WCharLiteral
- :
- 'L' CharLiteral
- ;
-
-
-/*
- * Can't have raw imbedded newlines in string constants. Strict reading of
- * the standard gives odd dichotomy between newlines & carriage returns.
- * Go figure.
- */
-StringLiteral
- :
- '"'
- ( Escape
- |
- ( "\\\r\n" // MS
- | "\\\r" // MAC
- | "\\\n" // Unix
- ) {deferredNewline();}
- |
- ~('"'|'\r'|'\n'|'\\')
- )*
- '"'
- ;
-
-WStringLiteral
- :
- 'L' StringLiteral
- ;
-
-protected
-EndOfLine
- :
- ( options{generateAmbigWarnings = false;}:
- "\r\n" // MS
- | '\r' // Mac
- | '\n' // Unix
- )
- ;
-
-/*
- * Handle the various escape sequences.
- *
- * Note carefully that these numeric escape *sequences* are *not* of the
- * same form as the C language numeric *constants*.
- *
- * There is no such thing as a binary numeric escape sequence.
- *
- * Octal escape sequences are either 1, 2, or 3 octal digits exactly.
- *
- * There is no such thing as a decimal escape sequence.
- *
- * Hexadecimal escape sequences are begun with a leading \x and continue
- * until a non-hexadecimal character is found.
- *
- * No real handling of tri-graph sequences, yet.
- */
-
-protected
-Escape
- :
- '\\'
- ( options{warnWhenFollowAmbig=false;}:
- 'a'
- | 'b'
- | 'f'
- | 'n'
- | 'r'
- | 't'
- | 'v'
- | '"'
- | '\''
- | '\\'
- | '?'
- | ('0'..'3') (options{warnWhenFollowAmbig=false;}: Digit (options{warnWhenFollowAmbig=false;}: Digit)? )?
- | ('4'..'7') (options{warnWhenFollowAmbig=false;}: Digit)?
- | 'x' (options{warnWhenFollowAmbig=false;}: Digit | 'a'..'f' | 'A'..'F')+
- )
- ;
-
-// Numeric Constants:
-
-protected
-Digit
- :
- '0'..'9'
- ;
-
-protected
-Decimal
- :
- ('0'..'9')+
- ;
-
-protected
-LongSuffix
- : 'l'
- | 'L'
- ;
-
-protected
-UnsignedSuffix
- : 'u'
- | 'U'
- ;
-
-protected
-FloatSuffix
- : 'f'
- | 'F'
- ;
-
-protected
-Exponent
- :
- ('e'|'E') ('+'|'-')? (Digit)+
- ;
-
-protected
-Vocabulary
- :
- '\3'..'\377'
- ;
-
-Number
- :
- ( (Digit)+ ('.' | 'e' | 'E') )=>
- (Digit)+
- ( '.' (Digit)* (Exponent)? {_ttype = FLOATONE;} //Zuo 3/12/01
- | Exponent {_ttype = FLOATTWO;} //Zuo 3/12/01
- ) //{_ttype = DoubleDoubleConst;}
- (FloatSuffix //{_ttype = FloatDoubleConst;}
- |LongSuffix //{_ttype = LongDoubleConst;}
- )?
- |
- ("...")=> "..." {_ttype = ELLIPSIS;}
- |
- '.' {_ttype = DOT;}
- ( (Digit)+ (Exponent)? {_ttype = FLOATONE;} //Zuo 3/12/01
- //{_ttype = DoubleDoubleConst;}
- (FloatSuffix //{_ttype = FloatDoubleConst;}
- |LongSuffix //{_ttype = LongDoubleConst;}
- )?
- )?
- |
- '0' ('0'..'7')* //{_ttype = IntOctalConst;}
- (LongSuffix //{_ttype = LongOctalConst;}
- |UnsignedSuffix //{_ttype = UnsignedOctalConst;}
- )* {_ttype = OCTALINT;}
- |
- '1'..'9' (Digit)* //{_ttype = IntIntConst;}
- (LongSuffix //{_ttype = LongIntConst;}
- |UnsignedSuffix //{_ttype = UnsignedIntConst;}
- )* {_ttype = DECIMALINT;}
- |
- '0' ('x' | 'X') ('a'..'f' | 'A'..'F' | Digit)+
- //{_ttype = IntHexConst;}
- (LongSuffix //{_ttype = LongHexConst;}
- |UnsignedSuffix //{_ttype = UnsignedHexConst;}
- )* {_ttype = HEXADECIMALINT;}
- ;
-
-ID
- options {testLiterals = true;}
- :
- ('a'..'z'|'A'..'Z'|'_')
- ('a'..'z'|'A'..'Z'|'_'|'0'..'9')*
- ;
-
diff --git a/contrib/pdxautoserializer/src/impl/CPPParser/DictEntry.hpp b/contrib/pdxautoserializer/src/impl/CPPParser/DictEntry.hpp
deleted file mode 100644
index 16f5594..0000000
--- a/contrib/pdxautoserializer/src/impl/CPPParser/DictEntry.hpp
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * PUBLIC DOMAIN PCCTS-BASED C++ GRAMMAR (cplusplus.g, stat.g, expr.g)
- *
- * Authors: Sumana Srinivasan, NeXT Inc.; sumana_srinivasan@next.com
- * Terence Parr, Parr Research Corporation; parrt@parr-research.com
- * Russell Quong, Purdue University; quong@ecn.purdue.edu
- *
- * SOFTWARE RIGHTS
- *
- * This file is a part of the ANTLR-based C++ grammar and is free
- * software. We do not reserve any LEGAL rights to its use or
- * distribution, but you may NOT claim ownership or authorship of this
- * grammar or support code. An individual or company may otherwise do
- * whatever they wish with the grammar distributed herewith including the
- * incorporation of the grammar or the output generated by ANTLR into
- * commerical software. You may redistribute in source or binary form
- * without payment of royalties to us as long as this header remains
- * in all source distributions.
- *
- * We encourage users to develop parsers/tools using this grammar.
- * In return, we ask that credit is given to us for developing this
- * grammar. By "credit", we mean that if you incorporate our grammar or
- * the generated code into one of your programs (commercial product,
- * research project, or otherwise) that you acknowledge this fact in the
- * documentation, research report, etc.... In addition, you should say nice
- * things about us at every opportunity.
- *
- * As long as these guidelines are kept, we expect to continue enhancing
- * this grammar. Feel free to send us enhancements, fixes, bug reports,
- * suggestions, or general words of encouragement at parrt@parr-research.com.
- *
- * NeXT Computer Inc.
- * 900 Chesapeake Dr.
- * Redwood City, CA 94555
- * 12/02/1994
- *
- * Restructured for public consumption by Terence Parr late February, 1995.
- *
- * Requires PCCTS 1.32b4 or higher to get past ANTLR.
- *
- * DISCLAIMER: we make no guarantees that this grammar works, makes sense,
- * or can be used to do anything useful.
- */
-/* 1999-2005 Version 3.1 November 2005
- * Modified by David Wigg at London South Bank University for CPP_parser.g
- *
- * See MyReadMe.txt for further information
- *
- * This file is best viewed in courier font with tabs set to 4 spaces
- */
-
-#ifndef DictEntry_hpp
-#define DictEntry_hpp
-
-class DictEntry {
- protected:
- const char *key;
- int hashCode;
- DictEntry *next; // next element in the bucket
- DictEntry *scope; // next element in the scope
-
- public:
- int this_scope; // 4/2/96 LL - added to store scope
-
- DictEntry() {
- key = NULL;
- hashCode = -1;
- next = scope = NULL;
- }
- DictEntry(const char *k, int h = -1) {
- key = k;
- hashCode = h;
- next = scope = NULL;
- }
- virtual ~DictEntry() {
- key = NULL;
- hashCode = -1;
- next = scope = NULL;
- }
-
- void setKey(char *k) { key = k; }
-
- const char *getKey() { return key; }
-
- void setHashCode(int h) { hashCode = h; }
-
- int getHashCode() { return hashCode; }
-
- void setNext(DictEntry *n) { next = n; }
-
- DictEntry *getNext() { return next; }
-
- void setScope(DictEntry *s) { scope = s; }
-
- DictEntry *getNextInScope() { return scope; }
-};
-
-#endif
diff --git a/contrib/pdxautoserializer/src/impl/CPPParser/Dictionary.cpp b/contrib/pdxautoserializer/src/impl/CPPParser/Dictionary.cpp
deleted file mode 100644
index ea78a3c..0000000
--- a/contrib/pdxautoserializer/src/impl/CPPParser/Dictionary.cpp
+++ /dev/null
@@ -1,400 +0,0 @@
-/*
- * PUBLIC DOMAIN PCCTS-BASED C++ GRAMMAR (cplusplus.g, stat.g, expr.g)
- *
- * Authors: Sumana Srinivasan, NeXT Inc.; sumana_srinivasan@next.com
- * Terence Parr, Parr Research Corporation; parrt@parr-research.com
- * Russell Quong, Purdue University; quong@ecn.purdue.edu
- *
- * VERSION 1.1
- *
- * SOFTWARE RIGHTS
- *
- * This file is a part of the ANTLR-based C++ grammar and is free
- * software. We do not reserve any LEGAL rights to its use or
- * distribution, but you may NOT claim ownership or authorship of this
- * grammar or support code. An individual or company may otherwise do
- * whatever they wish with the grammar distributed herewith including the
- * incorporation of the grammar or the output generated by ANTLR into
- * commerical software. You may redistribute in source or binary form
- * without payment of royalties to us as long as this header remains
- * in all source distributions.
- *
- * We encourage users to develop parsers/tools using this grammar.
- * In return, we ask that credit is given to us for developing this
- * grammar. By "credit", we mean that if you incorporate our grammar or
- * the generated code into one of your programs (commercial product,
- * research project, or otherwise) that you acknowledge this fact in the
- * documentation, research report, etc.... In addition, you should say nice
- * things about us at every opportunity.
- *
- * As long as these guidelines are kept, we expect to continue enhancing
- * this grammar. Feel free to send us enhancements, fixes, bug reports,
- * suggestions, or general words of encouragement at parrt@parr-research.com.
- *
- * NeXT Computer Inc.
- * 900 Chesapeake Dr.
- * Redwood City, CA 94555
- * 12/02/1994
- *
- * Restructured for public consumption by Terence Parr late February, 1995.
- *
- * Requires PCCTS 1.32b4 or higher to get past ANTLR.
- *
- * DISCLAIMER: we make no guarantees that this grammar works, makes sense,
- * or can be used to do anything useful.
- */
-/* 1999-2004 Version 3.0 July 2004
- * Modified by David Wigg at London South Bank University for CPP_parser.g
- */
-/* 2004-2005 Version 3.1 November 2005
- * Modified by David Wigg at London South Bank University for CPP_parser.g
- *
- * See MyReadMe.txt for further information
- *
- * This file is best viewed in courier font with tabs set to 4 spaces
- *
- * See NotesScopes.txt for information about storing symbol names within scope
- *levels
- *
- * Symbols names are stored in lists selected by hashing
- *
- * Symbols are also chained in lists for each scope level,
- * [0] = template scope Note: Not used at present
- * [1] = external scope Note: These symbols (types) are never deleted.
- *"std" is allocated this scope in CPPParser::init()
- * [2+]= function/variable scopes Note: These symbol references are
- *deleted when they go out of scope.
- */
-
-extern "C" {
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-}
-#include "Dictionary.hpp"
-
-/* Hashing function described in */
-/* "Fast Hashing of Variable-Length Text Strings," */
-/* by Peter K. Pearson, CACM, June 1990. */
-/* Table from p. 678.*/
-/* Pseudorandom Permutation of the Integers 0 through 255: */
-unsigned char Dictionary::randomNumbers[] = {
- 1, 14, 110, 25, 97, 174, 132, 119, 138, 170, 125, 118, 27, 233, 140,
- 51, 87, 197, 177, 107, 234, 169, 56, 68, 30, 7, 173, 73, 188, 40,
- 36, 65, 49, 213, 104, 190, 57, 211, 148, 223, 48, 115, 15, 2, 67,
- 186, 210, 28, 12, 181, 103, 70, 22, 58, 75, 78, 183, 167, 238, 157,
- 124, 147, 172, 144, 176, 161, 141, 86, 60, 66, 128, 83, 156, 241, 79,
- 46, 168, 198, 41, 254, 178, 85, 253, 237, 250, 154, 133, 88, 35, 206,
- 95, 116, 252, 192, 54, 221, 102, 218, 255, 240, 82, 106, 158, 201, 61,
- 3, 89, 9, 42, 155, 159, 93, 166, 80, 50, 34, 175, 195, 100, 99,
- 26, 150, 16, 145, 4, 33, 8, 189, 121, 64, 77, 72, 208, 245, 130,
- 122, 143, 55, 105, 134, 29, 164, 185, 194, 193, 239, 101, 242, 5, 171,
- 126, 11, 74, 59, 137, 228, 108, 191, 232, 139, 6, 24, 81, 20, 127,
- 17, 91, 92, 251, 151, 225, 207, 21, 98, 113, 112, 84, 226, 18, 214,
- 199, 187, 13, 32, 94, 220, 224, 212, 247, 204, 196, 43, 249, 236, 45,
- 244, 111, 182, 153, 136, 129, 90, 217, 202, 19, 165, 231, 71, 230, 142,
- 96, 227, 62, 179, 246, 114, 162, 53, 160, 215, 205, 180, 47, 109, 44,
- 38, 31, 149, 135, 0, 216, 52, 63, 23, 37, 69, 39, 117, 146, 184,
- 163, 200, 222, 235, 248, 243, 219, 10, 152, 131, 123, 229, 203, 76, 120,
- 209};
-
-char *Dictionary::strings = NULL;
-char *Dictionary::strp = NULL;
-unsigned Dictionary::strsize = 0;
-
-Dictionary::Dictionary(int nb, int ns, int nc) {
- int i;
-
- // allocate buckets for names
- bucket = new DictEntry *[nb];
- if (bucket == NULL) panic((const char *)"can't alloc buckets");
-
- // Initialize buckets for names
- nbuckets = nb;
- for (i = 0; i < nb; i++) bucket[i] = NULL;
-
- // allocate a scope list for the start of each scope list
- scope = new DictEntry *[ns];
- if (scope == NULL) panic("can't alloc scopes");
-
- // allocate an endScope list for the end of each scope list
- endScope = new DictEntry *[ns];
- if (endScope == NULL) panic("can't alloc endScope");
-
- // Initialize scopes and endscopes
- nscopes = ns;
- for (i = 0; i < ns; i++) {
- scope[i] = NULL;
- endScope[i] = NULL;
- }
-
- currentScope = 0;
-
- strsize = nc;
- strings = new char[nc];
- strp = strings;
-}
-
-Dictionary::~Dictionary() {
- delete[] bucket;
- delete[] scope;
- delete[] endScope;
- nbuckets = nscopes = 0;
- currentScope = -1;
-}
-
-/* Hashing function described in */
-/* "Fast Hashing of Variable-Length Text Strings," */
-/* by Peter K. Pearson, CACM, June 1990. */
-int Dictionary::hash(const char *string) {
- int hash1 = 0;
- int hash2 = 0;
- int length = 0;
- int r = 0;
-
- while (*string != 0) {
- length++;
- /* Hash function is XOR of successive characters randomized by
- * the hash table.
- */
- hash1 ^= randomNumbers[static_cast<int>(*string++)];
- if (*string != 0) hash2 ^= randomNumbers[static_cast<int>(*string++)];
- }
- r = (hash1 << 8) | hash2;
- return r;
-}
-
-/* Return ptr to 1st entry found in table under key
- * (return NULL if none found).
- */
-DictEntry *Dictionary::lookup(const char *key, CPPSymbol::ObjectType tp) {
- // tp is type to be looked for
- // Default, 0, is to look for any symbol irrespective of type
- // Each new DictEntry is stored at start of its list so most
- // recent additions are reached first
- // DictEntry *q;
- CPPSymbol *q;
- // int scope = getCurrentScopeIndex();
- // if(sc != -1)
- // scope = sc;
-
- int h = hash(key) % nbuckets;
- q = (CPPSymbol *)bucket[h];
-
- for (; q != NULL; q = (CPPSymbol *)q->getNext()) {
- // printf("Dictionary.cpp lookup symbol %s in scope %d current scope %d\n",
- // q->getKey(),q->this_scope,getCurrentScopeIndex());
- if (h != q->getHashCode()) {
- fprintf(stderr,
- "dictionary.cpp lookup, h not equal to q->getHashCode() for %s\n",
- key);
- }
-
- if (h == q->getHashCode() && strcmp(key, q->getKey()) == 0) {
- if (tp == 0) { // Search for first matching symbol
- return q;
- } else {
- CPPSymbol::ObjectType type = q->getType();
- if (tp == CPPSymbol::otTypename) // Search for first type name
- {
- if (type == CPPSymbol::otTypedef || type == CPPSymbol::otEnum ||
- type == CPPSymbol::otClass || type == CPPSymbol::otStruct ||
- type == CPPSymbol::otUnion) {
- return q;
- }
- } else if (tp ==
- CPPSymbol::otNonTypename) // Search for first non type name
- {
- if (type == CPPSymbol::otVariable || type == CPPSymbol::otFunction) {
- return q;
- }
- } else if (type == tp) { // Search for first symbol with specific type
- return q;
- } else {
- return NULL;
- }
- }
- }
- }
- return NULL;
-}
-
-void Dictionary::define(const char *key, DictEntry *entry) {
- defineInScope(key, entry, currentScope);
-}
-
-void Dictionary::defineInScope(const char *key, DictEntry *entry, int sc) {
- int h = hash(key) % nbuckets; // July 2005, nbuckets = 4001 See CPP_parser.g
- // printf("Dictionary.cpp defineInScope key %s hash(key) %d bucket %d scope
- // %d\n",
- // key,hash(key),h,sc);
- entry->this_scope = sc;
- entry->setKey(strdup(key)); // Make a local copy of key
- entry->setHashCode(h);
- entry->setNext(bucket[h]); // Set next pointer to current entry in bucket
- bucket[h] = entry; // Replace current entry in bucket
- if (endScope[sc] == NULL) {
- scope[sc] = endScope[sc] = entry;
- } else {
- endScope[sc]->setScope(entry);
- endScope[sc] = entry;
- }
-}
-
-int Dictionary::getCurrentScopeIndex() { return currentScope; }
-
-DictEntry *Dictionary::getCurrentScope() {
- if (currentScope < 0 || currentScope > nscopes) {
- panic("getCurrentScope: no scope");
- }
- return scope[currentScope];
-}
-
-void Dictionary::saveScope() {
- // Advance scope number (for included scope)
- if (currentScope < nscopes) currentScope++;
- /*
- if ( currentScope>=nscopes )
- panic( "saveScope: overflow" );
- */
- // printf("Dictionary saveScope entered. Scope now %d\n",currentScope);
-}
-
-void Dictionary::restoreScope() {
- // Reduce scope number for next highest scope
- // if ( currentScope==0 )
- // panic( "restoreScope: underflow" );
- if (currentScope > 0) currentScope--;
- // printf("Dictionary restoreScope entered. Scope now %d\n",currentScope);
-}
-
-/* This unlinks all entries from the Dictionary that are members
- * of the current scope. The scope level is not restored to the previous
- * scope however. This requires use of restoreScope() above
- */
-DictEntry *Dictionary::removeScope(int sc) {
- DictEntry *de, *r;
- if (sc == -1) { // removeScope() without parameter value defaults sc to -1
- sc = currentScope;
- }
- for (de = scope[sc]; de != NULL; de = de->getNextInScope()) {
- remove(de);
- }
- r = scope[sc];
- scope[sc] = endScope[sc] = NULL;
- return r;
-}
-
-// Remove this dictEntry from its bucket by unlinking it
-DictEntry *Dictionary::remove(DictEntry *de) {
- DictEntry *prev, *curr;
- if (de == NULL) panic("Dictionary.cpp remove: NULL ptr");
- int h = hash(de->getKey()) % nbuckets; // Find pointer to bucket
- for (prev = NULL, curr = bucket[h]; curr != NULL;
- prev = curr, curr = curr->getNext()) {
- if (de == curr) {
- if (prev == NULL) {
- bucket[h] = de->getNext();
- } else {
- prev->setNext(de->getNext());
- }
- de->setNext(NULL);
- return de;
- }
- }
- return NULL; // should never get here...
-}
-
-/* Lookup the object referred to by 'key' and then physically remove
- * it from the Dictionary. Return the object referred to by the key.
- * If more than one definition is found for 'key', then only the
- * first one is removed. Return NULL if not found.
- * Note: DW 12/06/03 Probably not used
- */
-DictEntry *Dictionary::remove(char *key) {
- DictEntry *q, *prev;
-
- int h = hash(key) % nbuckets;
- for (prev = NULL, q = bucket[h]; q != NULL; prev = q, q = q->getNext()) {
- if (h == q->getHashCode() && strcmp(key, q->getKey()) == 0) {
- if (prev == NULL) {
- bucket[h] = q->getNext();
- } else {
- prev->setNext(q->getNext());
- }
- q->setNext(NULL);
- return q;
- }
- }
- return NULL; // should never get here, but make compiler happy
-}
-
-void Dictionary::dumpScope(FILE *f, int sc) {
- DictEntry *s;
-
- if (sc == -1) { // dumpScope() without parameter value defaults sc to -1
- sc = currentScope;
- }
- for (s = scope[sc]; s != NULL; s = s->getNextInScope()) {
- dumpSymbol(f, s);
- }
-}
-
-// This is overridden in CPPDictionary.hpp
-void Dictionary::dumpSymbol(FILE *f, DictEntry *de) {
- fprintf(f, "%s\n", de->getKey());
-}
-
-// Diagnostic function
-// Contents of first 10 scopes printed
-void Dictionary::dumpScopes() {
- DictEntry *dictEntry;
- int i;
-
- printf("Scopes");
- for (i = 0; i < 10; i++) {
- printf(" %d ", i);
- }
- printf("\n");
- printf(" first");
- for (i = 0; i < 10; i++) {
- if (scope[i] != NULL) {
- dictEntry = scope[i];
- printf("%10s ", dictEntry->getKey());
- } else {
- printf(" ");
- }
- }
- printf("\n");
- printf(" last ");
- for (i = 0; i < 10; i++) {
- if (endScope[i] != NULL) {
- dictEntry = endScope[i];
- printf("%10s ", dictEntry->getKey());
- } else {
- printf(" ");
- }
- }
- printf("\n");
-}
-
-/* Add a string to the string table and return a pointer to it.
- * Bump the pointer into the string table to next avail position.
- */
-char *Dictionary::strdup(const char *s) {
- char *start = strp;
- if (s == NULL) panic("strdup: NULL string");
- if (start + strlen(s) + 1 > &(strings[strsize - 2])) {
- panic("string table overflow");
- }
- while (*s != '\0') {
- *strp++ = *s++;
- }
- *strp++ = '\0';
- return start;
-}
-
-void Dictionary::panic(const char *err) {
- fprintf(stdout, "Dictionary panic: %s\n", err);
- exit(-1);
-}
diff --git a/contrib/pdxautoserializer/src/impl/CPPParser/Dictionary.hpp b/contrib/pdxautoserializer/src/impl/CPPParser/Dictionary.hpp
deleted file mode 100644
index d5b6c40..0000000
--- a/contrib/pdxautoserializer/src/impl/CPPParser/Dictionary.hpp
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * PUBLIC DOMAIN PCCTS-BASED C++ GRAMMAR (cplusplus.g, stat.g, expr.g)
- *
- * Authors: Sumana Srinivasan, NeXT Inc.; sumana_srinivasan@next.com
- * Terence Parr, Parr Research Corporation; parrt@parr-research.com
- * Russell Quong, Purdue University; quong@ecn.purdue.edu
- *
- * SOFTWARE RIGHTS
- *
- * This file is a part of the ANTLR-based C++ grammar and is free
- * software. We do not reserve any LEGAL rights to its use or
- * distribution, but you may NOT claim ownership or authorship of this
- * grammar or support code. An individual or company may otherwise do
- * whatever they wish with the grammar distributed herewith including the
- * incorporation of the grammar or the output generated by ANTLR into
- * commerical software. You may redistribute in source or binary form
- * without payment of royalties to us as long as this header remains
- * in all source distributions.
- *
- * We encourage users to develop parsers/tools using this grammar.
- * In return, we ask that credit is given to us for developing this
- * grammar. By "credit", we mean that if you incorporate our grammar or
- * the generated code into one of your programs (commercial product,
- * research project, or otherwise) that you acknowledge this fact in the
- * documentation, research report, etc.... In addition, you should say nice
- * things about us at every opportunity.
- *
- * As long as these guidelines are kept, we expect to continue enhancing
- * this grammar. Feel free to send us enhancements, fixes, bug reports,
- * suggestions, or general words of encouragement at parrt@parr-research.com.
- *
- * NeXT Computer Inc.
- * 900 Chesapeake Dr.
- * Redwood City, CA 94555
- * 12/02/1994
- *
- * Restructured for public consumption by Terence Parr late February, 1995.
- *
- * Requires PCCTS 1.32b4 or higher to get past ANTLR.
- *
- * DISCLAIMER: we make no guarantees that this grammar works, makes sense,
- * or can be used to do anything useful.
- */
-/*
- * Dictionary.h -- A cool hash table
- *
- * Terence Parr
- * Parr Research Corporation
- * January 1995
- */
-/* 1999-2005 Version 3.1 November 2005
- * Modified by David Wigg at London South Bank University for CPP_parser.g
- *
- * See MyReadMe.txt for further information
- *
- * This file is best viewed in courier font with tabs set to 4 spaces
- */
-
-#ifndef Dictionary_hpp
-#define Dictionary_hpp
-
-#include <iostream>
-#include "DictEntry.hpp"
-#include "CPPSymbol.hpp"
-
-class Dictionary {
- protected:
- DictEntry **scope, **endScope;
- int nscopes, currentScope;
- DictEntry **bucket;
- int nbuckets;
- static unsigned char randomNumbers[];
- static char *strings;
- static char *strp;
- static unsigned strsize;
-
- virtual void dumpSymbol(FILE *, DictEntry *);
-
- public:
- Dictionary(int nb = 43, int ns = 60, int nc = 30000);
- virtual ~Dictionary();
- virtual int hash(const char *s);
- DictEntry *lookup(const char *,
- CPPSymbol::ObjectType type = CPPSymbol::otInvalid);
- void define(const char *, DictEntry *);
- void defineInScope(const char *, DictEntry *, int);
- void saveScope();
- void restoreScope();
- DictEntry *getCurrentScope();
- int getCurrentScopeIndex();
- DictEntry *removeScope(int scope = -1);
- DictEntry *remove(char *);
- DictEntry *remove(DictEntry *);
-
- void dumpScope(FILE *, int scope = -1);
- void dumpScopes();
- char *strdup(const char *);
-
- virtual void panic(const char *);
-};
-
-#endif
diff --git a/contrib/pdxautoserializer/src/impl/CPPParser/STDCTokenTypes.hpp b/contrib/pdxautoserializer/src/impl/CPPParser/STDCTokenTypes.hpp
deleted file mode 100644
index e59b6c5..0000000
--- a/contrib/pdxautoserializer/src/impl/CPPParser/STDCTokenTypes.hpp
+++ /dev/null
@@ -1,225 +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.
- */
-#ifndef INC_STDCTokenTypes_hpp_
-#define INC_STDCTokenTypes_hpp_
-
-/* $ANTLR 2.7.7 (20130409): "CPP_parser.g" -> "STDCTokenTypes.hpp"$ */
-
-#ifndef CUSTOM_API
-#define CUSTOM_API
-#endif
-
-#ifdef __cplusplus
-struct CUSTOM_API STDCTokenTypes {
-#endif
- enum {
- EOF_ = 1,
- LITERAL_template = 4,
- LESSTHAN = 5,
- GREATERTHAN = 6,
- LITERAL_typedef = 7,
- SEMICOLON = 8,
- LITERAL_enum = 9,
- ID = 10,
- LCURLY = 11,
- LITERAL_inline = 12,
- LITERAL_friend = 13,
- LITERAL_namespace = 14,
- LITERAL_antlrTrace_on = 15,
- LITERAL_antlrTrace_off = 16,
- RCURLY = 17,
- ASSIGNEQUAL = 18,
- COLON = 19,
- LITERAL_extern = 20,
- StringLiteral = 21,
- LITERAL_struct = 22,
- LITERAL_union = 23,
- LITERAL_class = 24,
- LITERAL__stdcall = 25,
- LITERAL___stdcall = 26,
- LITERAL_GFEXCLUDE = 27,
- LITERAL_GFINCLUDE = 28,
- LITERAL_GFID = 29,
- LITERAL_GFUNREAD = 30,
- LITERAL_GFARRAYSIZE = 31,
- LPAREN = 32,
- RPAREN = 33,
- LITERAL_GFARRAYSIZES = 34,
- LITERAL_GFARRAYELEMSIZE = 35,
- LITERAL_auto = 36,
- LITERAL_register = 37,
- LITERAL_static = 38,
- LITERAL_mutable = 39,
- LITERAL__inline = 40,
- LITERAL___inline = 41,
- LITERAL_virtual = 42,
- LITERAL_explicit = 43,
- LITERAL_typename = 44,
- LITERAL_char = 45,
- LITERAL_wchar_t = 46,
- LITERAL_bool = 47,
- LITERAL_short = 48,
- LITERAL_int = 49,
- // "_int8" = 50
- // "__int8" = 51
- // "int8_t" = 52
- // "_int16" = 53
- // "__int16" = 54
- // "int16_t" = 55
- // "_int32" = 56
- // "__int32" = 57
- // "int32_t" = 58
- // "_int64" = 59
- // "__int64" = 60
- // "int64_t" = 61
- // "uint8_t" = 62
- // "uint16_t" = 63
- // "uint32_t" = 64
- // "uint64_t" = 65
- // "_w64" = 66
- // "__w64" = 67
- LITERAL_long = 68,
- LITERAL_signed = 69,
- LITERAL_unsigned = 70,
- LITERAL_float = 71,
- LITERAL_double = 72,
- LITERAL_void = 73,
- LITERAL__declspec = 74,
- LITERAL___declspec = 75,
- LITERAL_const = 76,
- LITERAL___const = 77,
- LITERAL_volatile = 78,
- LITERAL___volatile__ = 79,
- LITERAL_GFIGNORE = 80,
- COMMA = 81,
- LITERAL_public = 82,
- LITERAL_protected = 83,
- LITERAL_private = 84,
- OPERATOR = 85,
- LITERAL_this = 86,
- LITERAL_true = 87,
- LITERAL_false = 88,
- OCTALINT = 89,
- LSQUARE = 90,
- RSQUARE = 91,
- TILDE = 92,
- STAR = 93,
- AMPERSAND = 94,
- ELLIPSIS = 95,
- LITERAL_throw = 96,
- LITERAL_using = 97,
- LITERAL_case = 98,
- LITERAL_default = 99,
- LITERAL_if = 100,
- LITERAL_else = 101,
- LITERAL_switch = 102,
- LITERAL_while = 103,
- LITERAL_do = 104,
- LITERAL_for = 105,
- LITERAL_goto = 106,
- LITERAL_continue = 107,
- LITERAL_break = 108,
- LITERAL_return = 109,
- LITERAL_try = 110,
- LITERAL_catch = 111,
- LITERAL_asm = 112,
- LITERAL__asm = 113,
- LITERAL___asm = 114,
- LITERAL___asm__ = 115,
- TIMESEQUAL = 116,
- DIVIDEEQUAL = 117,
- MINUSEQUAL = 118,
- PLUSEQUAL = 119,
- MODEQUAL = 120,
- SHIFTLEFTEQUAL = 121,
- SHIFTRIGHTEQUAL = 122,
- BITWISEANDEQUAL = 123,
- BITWISEXOREQUAL = 124,
- BITWISEOREQUAL = 125,
- QUESTIONMARK = 126,
- OR = 127,
- AND = 128,
- BITWISEOR = 129,
- BITWISEXOR = 130,
- NOTEQUAL = 131,
- EQUAL = 132,
- LESSTHANOREQUALTO = 133,
- GREATERTHANOREQUALTO = 134,
- SHIFTLEFT = 135,
- SHIFTRIGHT = 136,
- PLUS = 137,
- MINUS = 138,
- DIVIDE = 139,
- MOD = 140,
- DOTMBR = 141,
- POINTERTOMBR = 142,
- PLUSPLUS = 143,
- MINUSMINUS = 144,
- LITERAL_sizeof = 145,
- LITERAL___alignof__ = 146,
- SCOPE = 147,
- DOT = 148,
- POINTERTO = 149,
- LITERAL_dynamic_cast = 150,
- LITERAL_static_cast = 151,
- LITERAL_reinterpret_cast = 152,
- LITERAL_const_cast = 153,
- LITERAL_typeid = 154,
- DECIMALINT = 155,
- HEXADECIMALINT = 156,
- CharLiteral = 157,
- WCharLiteral = 158,
- WStringLiteral = 159,
- FLOATONE = 160,
- FLOATTWO = 161,
- NOT = 162,
- LITERAL_new = 163,
- LITERAL__cdecl = 164,
- LITERAL___cdecl = 165,
- LITERAL__near = 166,
- LITERAL___near = 167,
- LITERAL__far = 168,
- LITERAL___far = 169,
- LITERAL___interrupt = 170,
- LITERAL_pascal = 171,
- LITERAL__pascal = 172,
- LITERAL___pascal = 173,
- LITERAL_delete = 174,
- Whitespace = 175,
- Comment = 176,
- CPPComment = 177,
- PREPROC_DIRECTIVE = 178,
- LineDirective = 179,
- Space = 180,
- Pragma = 181,
- Error = 182,
- EndOfLine = 183,
- Escape = 184,
- Digit = 185,
- Decimal = 186,
- LongSuffix = 187,
- UnsignedSuffix = 188,
- FloatSuffix = 189,
- Exponent = 190,
- Vocabulary = 191,
- Number = 192,
- NULL_TREE_LOOKAHEAD = 3
- };
-#ifdef __cplusplus
-};
-#endif
-#endif /*INC_STDCTokenTypes_hpp_*/
diff --git a/contrib/pdxautoserializer/src/impl/CPPParser/STDCTokenTypes.txt b/contrib/pdxautoserializer/src/impl/CPPParser/STDCTokenTypes.txt
deleted file mode 100755
index fd6567a..0000000
--- a/contrib/pdxautoserializer/src/impl/CPPParser/STDCTokenTypes.txt
+++ /dev/null
@@ -1,191 +0,0 @@
-// $ANTLR 2.7.7 (20130409): CPP_parser.g -> STDCTokenTypes.txt$
-STDC // output token vocab name
-LITERAL_template="template"=4
-LESSTHAN=5
-GREATERTHAN=6
-LITERAL_typedef="typedef"=7
-SEMICOLON=8
-LITERAL_enum="enum"=9
-ID=10
-LCURLY=11
-LITERAL_inline="inline"=12
-LITERAL_friend="friend"=13
-LITERAL_namespace="namespace"=14
-LITERAL_antlrTrace_on="antlrTrace_on"=15
-LITERAL_antlrTrace_off="antlrTrace_off"=16
-RCURLY=17
-ASSIGNEQUAL=18
-COLON=19
-LITERAL_extern="extern"=20
-StringLiteral=21
-LITERAL_struct="struct"=22
-LITERAL_union="union"=23
-LITERAL_class="class"=24
-LITERAL__stdcall="_stdcall"=25
-LITERAL___stdcall="__stdcall"=26
-LITERAL_GFEXCLUDE="GFEXCLUDE"=27
-LITERAL_GFINCLUDE="GFINCLUDE"=28
-LITERAL_GFID="GFID"=29
-LITERAL_GFUNREAD="GFUNREAD"=30
-LITERAL_GFARRAYSIZE="GFARRAYSIZE"=31
-LPAREN=32
-RPAREN=33
-LITERAL_GFARRAYSIZES="GFARRAYSIZES"=34
-LITERAL_GFARRAYELEMSIZE="GFARRAYELEMSIZE"=35
-LITERAL_auto="auto"=36
-LITERAL_register="register"=37
-LITERAL_static="static"=38
-LITERAL_mutable="mutable"=39
-LITERAL__inline="_inline"=40
-LITERAL___inline="__inline"=41
-LITERAL_virtual="virtual"=42
-LITERAL_explicit="explicit"=43
-LITERAL_typename="typename"=44
-LITERAL_char="char"=45
-LITERAL_wchar_t="wchar_t"=46
-LITERAL_bool="bool"=47
-LITERAL_short="short"=48
-LITERAL_int="int"=49
-"_int8"=50
-"__int8"=51
-"int8_t"=52
-"_int16"=53
-"__int16"=54
-"int16_t"=55
-"_int32"=56
-"__int32"=57
-"int32_t"=58
-"_int64"=59
-"__int64"=60
-"int64_t"=61
-"uint8_t"=62
-"uint16_t"=63
-"uint32_t"=64
-"uint64_t"=65
-"_w64"=66
-"__w64"=67
-LITERAL_long="long"=68
-LITERAL_signed="signed"=69
-LITERAL_unsigned="unsigned"=70
-LITERAL_float="float"=71
-LITERAL_double="double"=72
-LITERAL_void="void"=73
-LITERAL__declspec="_declspec"=74
-LITERAL___declspec="__declspec"=75
-LITERAL_const="const"=76
-LITERAL___const="__const"=77
-LITERAL_volatile="volatile"=78
-LITERAL___volatile__="__volatile__"=79
-LITERAL_GFIGNORE="GFIGNORE"=80
-COMMA=81
-LITERAL_public="public"=82
-LITERAL_protected="protected"=83
-LITERAL_private="private"=84
-OPERATOR="operator"=85
-LITERAL_this="this"=86
-LITERAL_true="true"=87
-LITERAL_false="false"=88
-OCTALINT=89
-LSQUARE=90
-RSQUARE=91
-TILDE=92
-STAR=93
-AMPERSAND=94
-ELLIPSIS=95
-LITERAL_throw="throw"=96
-LITERAL_using="using"=97
-LITERAL_case="case"=98
-LITERAL_default="default"=99
-LITERAL_if="if"=100
-LITERAL_else="else"=101
-LITERAL_switch="switch"=102
-LITERAL_while="while"=103
-LITERAL_do="do"=104
-LITERAL_for="for"=105
-LITERAL_goto="goto"=106
-LITERAL_continue="continue"=107
-LITERAL_break="break"=108
-LITERAL_return="return"=109
-LITERAL_try="try"=110
-LITERAL_catch="catch"=111
-LITERAL_asm="asm"=112
-LITERAL__asm="_asm"=113
-LITERAL___asm="__asm"=114
-LITERAL___asm__="__asm__"=115
-TIMESEQUAL=116
-DIVIDEEQUAL=117
-MINUSEQUAL=118
-PLUSEQUAL=119
-MODEQUAL=120
-SHIFTLEFTEQUAL=121
-SHIFTRIGHTEQUAL=122
-BITWISEANDEQUAL=123
-BITWISEXOREQUAL=124
-BITWISEOREQUAL=125
-QUESTIONMARK=126
-OR=127
-AND=128
-BITWISEOR=129
-BITWISEXOR=130
-NOTEQUAL=131
-EQUAL=132
-LESSTHANOREQUALTO=133
-GREATERTHANOREQUALTO=134
-SHIFTLEFT=135
-SHIFTRIGHT=136
-PLUS=137
-MINUS=138
-DIVIDE=139
-MOD=140
-DOTMBR=141
-POINTERTOMBR=142
-PLUSPLUS=143
-MINUSMINUS=144
-LITERAL_sizeof="sizeof"=145
-LITERAL___alignof__="__alignof__"=146
-SCOPE=147
-DOT=148
-POINTERTO=149
-LITERAL_dynamic_cast="dynamic_cast"=150
-LITERAL_static_cast="static_cast"=151
-LITERAL_reinterpret_cast="reinterpret_cast"=152
-LITERAL_const_cast="const_cast"=153
-LITERAL_typeid="typeid"=154
-DECIMALINT=155
-HEXADECIMALINT=156
-CharLiteral=157
-WCharLiteral=158
-WStringLiteral=159
-FLOATONE=160
-FLOATTWO=161
-NOT=162
-LITERAL_new="new"=163
-LITERAL__cdecl="_cdecl"=164
-LITERAL___cdecl="__cdecl"=165
-LITERAL__near="_near"=166
-LITERAL___near="__near"=167
-LITERAL__far="_far"=168
-LITERAL___far="__far"=169
-LITERAL___interrupt="__interrupt"=170
-LITERAL_pascal="pascal"=171
-LITERAL__pascal="_pascal"=172
-LITERAL___pascal="__pascal"=173
-LITERAL_delete="delete"=174
-Whitespace=175
-Comment=176
-CPPComment=177
-PREPROC_DIRECTIVE("a preprocessor directive")=178
-LineDirective=179
-Space=180
-Pragma=181
-Error=182
-EndOfLine=183
-Escape=184
-Digit=185
-Decimal=186
-LongSuffix=187
-UnsignedSuffix=188
-FloatSuffix=189
-Exponent=190
-Vocabulary=191
-Number=192
diff --git a/contrib/pdxautoserializer/src/impl/CPPParser/Support.cpp b/contrib/pdxautoserializer/src/impl/CPPParser/Support.cpp
deleted file mode 100644
index 9ba33b3..0000000
--- a/contrib/pdxautoserializer/src/impl/CPPParser/Support.cpp
+++ /dev/null
@@ -1,894 +0,0 @@
-/*
- * PUBLIC DOMAIN PCCTS-BASED C++ GRAMMAR (cplusplus.g, stat.g, expr.g)
- *
- * Authors: Sumana Srinivasan, NeXT Inc.; sumana_srinivasan@next.com
- * Terence Parr, Parr Research Corporation; parrt@parr-research.com
- * Russell Quong, Purdue University; quong@ecn.purdue.edu
- *
- * VERSION 1.1
- *
- * SOFTWARE RIGHTS
- *
- * This file is a part of the ANTLR-based C++ grammar and is free
- * software. We do not reserve any LEGAL rights to its use or
- * distribution, but you may NOT claim ownership or authorship of this
- * grammar or support code. An individual or company may otherwise do
- * whatever they wish with the grammar distributed herewith including the
- * incorporation of the grammar or the output generated by ANTLR into
- * commerical software. You may redistribute in source or binary form
- * without payment of royalties to us as long as this header remains
- * in all source distributions.
- *
- * We encourage users to develop parsers/tools using this grammar.
- * In return, we ask that credit is given to us for developing this
- * grammar. By "credit", we mean that if you incorporate our grammar or
- * the generated code into one of your programs (commercial product,
- * research project, or otherwise) that you acknowledge this fact in the
- * documentation, research report, etc.... In addition, you should say nice
- * things about us at every opportunity.
- *
- * As long as these guidelines are kept, we expect to continue enhancing
- * this grammar. Feel free to send us enhancements, fixes, bug reports,
- * suggestions, or general words of encouragement at parrt@parr-research.com.
- *
- * NeXT Computer Inc.
- * 900 Chesapeake Dr.
- * Redwood City, CA 94555
- * 12/02/1994
- *
- * Restructured for public consumption by Terence Parr late February, 1995.
- *
- * DISCLAIMER: we make no guarantees that this grammar works, makes sense,
- * or can be used to do anything useful.
- */
-/*
- * 2001-2003 Version 2.0 September 2003
- *
- * Some modifications were made to this file to support a project by
- * Jianguo Zuo and David Wigg at
- * The Centre for Systems and Software Engineering
- * South Bank University
- * London, UK.
- * wiggjd@bcs.ac.uk
- * blackse@lsbu.ac.uk
- *
- * These C++ functions are required to support the correct functioning of
- * the CPP_parser.g definition of the C++ language.
-*/
-/* 2003-2004 Version 3.0 July 2004
- * Modified by David Wigg at London South Bank University for CPP_parser.g
- */
-/* 2004-1005 Version 3.1 November 2005
- * Modified by David Wigg at London South Bank University for CPP_parser.g
- *
- * See MyReadMe.txt for further information
- *
- * This file is best viewed in courier font with tabs set to 4 spaces
- */
-
-extern "C" {
-#ifndef WIN32
-#include <unistd.h>
-#endif
-}
-
-#include <iostream>
-#include <stdio.h>
-#include <string.h>
-#include "../CPPParser/CPPParser.hpp"
-
-extern int
- statementTrace; // Used to control selected tracing at statement level
-// for testing and program verification purposes
-
-// Shorthand for a string of (qualifiedItemIs()==xxx||...)
-int CPPParser::qualifiedItemIsOneOf(
- QualifiedItem qiFlags, // Ored combination of flags
- int lookahead_offset) {
- QualifiedItem qi = qualifiedItemIs(lookahead_offset);
- return (qi & qiFlags) != 0;
-}
-
-// This is an important function, but will be replaced with
-// an enhanced predicate in the future, once predicates
-// and/or predicate guards can contain loops.
-//
-// Scan past the ::T::B:: to see what lies beyond.
-// Return qiType if the qualified item can pose as type name.
-// Note that T::T is NOT a type; it is a constructor. Also,
-// class T { ... T...} yields the enclosed T as a ctor. This
-// is probably a type as I separate out the constructor defs/decls,
-// I want it consistent with T::T.
-//
-// In the below examples, I use A,B,T and example types, and
-// a,b as example ids.
-// In the below examples, any A or B may be a
-// qualified template, i.e., A<...>
-//
-// T::T outside of class T yields qiCtor.
-// T<...>::T outside of class T yields qiCtor.
-// T inside of class T {...} yields qiCtor.
-// T, ::T, A::T outside of class T yields qiType.
-// a, ::a, A::B::a yields qiId
-// a::b yields qiInvalid
-// ::operator, operator, A::B::operator yield qiOPerator
-// A::*, A::B::* yield qiPtrMember
-// ::*, * yields qiInvalid
-// ::~T, ~T, A::~T yield qiDtor
-// ~a, ~A::a, A::~T::, ~T:: yield qiInvalid
-
-CPPParser::QualifiedItem CPPParser::qualifiedItemIs(int lookahead_offset) {
- int offset = lookahead_offset + 1;
- int final_type_idx = 0;
- // Skip leading "::"
- if (LT(offset)->getType() == SCOPE) {
- offset++;
- }
- // Skip sequences of T:: or T<...>::
- // DW 11/02/05 Note that LT(offset)->getType() is not a "type" but a type of
- // token, eg. ID
- // printf("support.cpp qualifiedItemIs while reached offset %d %s type %d
- // isType %d, isClass %d, guessing %d\n",
- // offset,(LT(offset)->getText()).data(),LT(offset)->getType(),isTypeName((LT(offset)->getText()).data()),isClassName((LT(offset)->getText()).data()),inputState->guessing);
- while (LT(offset)->getType() == ID &&
- isTypeName((LT(offset)->getText()).data())) { // If this type is the
- // same as the last
- // type, then ctor
- if (final_type_idx != 0 &&
- strcmp((LT(final_type_idx)->getText()).data(),
- (LT(offset)->getText()).data()) == 0) { // Like T::T
- // As an extra check, do not allow T::T::
- if (LT(offset + 1)->getType() == SCOPE) { // printf("support.cpp
- // qualifiedItemIs qiInvalid
- // returned\n");
- return qiInvalid;
- } else { // printf("support.cpp qualifiedItemIs qiCtor_1 returned %s %s
- // %s \n",
- // enclosingClass,(LT(lookahead_offset+1)->getText()).data(),
- //(LT(final_type_idx)->getText()).data());
- return qiCtor;
- }
- }
-
- // Record this as the most recent type seen in the series
- final_type_idx = offset;
-
- // Skip this token
- offset++;
-
- // Skip over any template qualifiers <...>
- // I believe that "T<..." cannot be anything valid but a template
- if (LT(offset)->getType() == LESSTHAN) {
- if (!skipTemplateQualifiers(offset)) { // printf("support.cpp
- // qualifiedItemIs qiInvalid_2
- // returned\n");
- return qiInvalid;
- }
- // printf("support.cpp qualifiedItemIs template skipped, offset
- // %d\n",offset);
- // offset has been updated to token following <...>
- }
-
- // Skip any "::" and keep going
- if (LT(offset)->getType() == SCOPE) {
- offset++;
- }
- // Otherwise series terminated -- last ID in the sequence was a type
- else {
- // Return ctor if last type is in containing class
- // We already checked for T::T inside loop
- if (strcmp(enclosingClass, (LT(final_type_idx)->getText()).data()) ==
- 0) { // Like class T T()
- // printf("support.cpp qualifiedItemIs qiCtor_2 returned %s %s %s\n",
- // enclosingClass,(LT(lookahead_offset+1)->getText()).data(),
- // (LT(final_type_idx)->getText()).data());
- return qiCtor;
- } else { // printf("support.cpp qualifiedItemIs qiType returned\n");
- return qiType;
- }
- }
- }
-
- // LT(offset) is not an ID, or it is an ID but not a typename.
- // printf("support.cpp qualifiedItemIs second switch reached with type
- // %d\n",LT(offset)->getType());
- switch (LT(offset)->getType()) {
- case ID:
- // ID but not a typename
- // Do not allow id::
- if (LT(offset + 1)->getType() == SCOPE) {
- // printf("support.cpp qualifiedItemIs qiInvalid_3 returned\n");
- return qiInvalid;
- }
- if (strcmp(enclosingClass, (LT(offset)->getText()).data()) ==
- 0) { // Like class T T()
- // printf("support.cpp qualifiedItemIs qiCtor_3 returned
- // %s\n",enclosingClass);
- return qiCtor;
- } else {
- if (isTypeName((LT(offset)->getText()).data())) {
- return qiType;
- } else {
- // printf("support.cpp qualifiedItemIs qiVar returned\n");
- return qiVar; // DW 19/03/04 was qiVar Could be function, qiFun?
- }
- }
- case TILDE:
- // check for dtor
- if (LT(offset + 1)->getType() == ID &&
- isTypeName((LT(offset + 1)->getText()).data()) &&
- LT(offset + 2)->getType() != SCOPE) { // Like ~B or A::B::~B
- // Also (incorrectly?) matches ::~A.
- // printf("support.cpp qualifiedItemIs qiDtor returned\n");
- return qiDtor;
- } else { // ~a or ~A::a is qiInvalid
- // printf("support.cpp qualifiedItemIs qiInvalid_4 returned\n");
- return qiInvalid;
- }
- break;
- case STAR:
- // Like A::*
- // Do not allow * or ::*
- if (final_type_idx == 0) { // Haven't seen a type yet
- // printf("support.cpp qualifiedItemIs qiInvalid_5 returned\n");
- return qiInvalid;
- } else { // printf("support.cpp qualifiedItemIs qiPtrMember returned\n");
- return qiPtrMember;
- }
- case OPERATOR:
- // Like A::operator, ::operator, or operator
- // printf("support.cpp qualifiedItemIs qiOperator returned\n");
- return qiOperator;
- default:
- // Something that neither starts with :: or ID, or
- // a :: not followed by ID, operator, ~, or *
- // printf("support.cpp qualifiedItemIs qiInvalid_6 returned\n");
- return qiInvalid;
- }
-}
-
-// Skip over <...>. This correctly handles nested <> and (), e.g:
-// <T>
-// < (i>3) >
-// < T2<...> >
-// but not
-// < i>3 >
-//
-// On input, kInOut is the index of the "<"
-// On output, if the return is true, then
-// kInOut is the index of the token after ">"
-// else
-// kInOut is unchanged
-int CPPParser::skipTemplateQualifiers(int &kInOut) { // Start after "<"
- int offset = kInOut + 1;
-
- while (LT(offset)->getType() != GREATERTHAN) // scan to end of <...>
- {
- switch (LT(offset)->getType()) {
- case EOF:
- return 0;
- case LESSTHAN:
- if (!skipTemplateQualifiers(offset)) {
- return 0;
- }
- break;
- case LPAREN:
- if (!skipNestedParens(offset)) {
- return 0;
- }
- break;
- default:
- offset++; // skip everything else
- break;
- }
- if (offset > MaxTemplateTokenScan) {
- return 0;
- }
- }
-
- // Update output argument to point past ">"
- kInOut = offset + 1;
- return 1;
-}
-
-// Skip over (...). This correctly handles nested (), e.g:
-// (i>3, (i>5))
-//
-// On input, kInOut is the index of the "("
-// On output, if the return is true, then
-// kInOut is the index of the token after ")"
-// else
-// kInOut is unchanged
-int CPPParser::skipNestedParens(int &kInOut) { // Start after "("
- int offset = kInOut + 1;
-
- while (LT(offset)->getType() != RPAREN) // scan to end of (...)
- {
- switch (LT(offset)->getType()) {
- case EOF:
- return 0;
- case LPAREN:
- if (!skipNestedParens(offset)) {
- return 0;
- }
- break;
- default:
- offset++; // skip everything else
- break;
- }
- if (offset > MaxTemplateTokenScan) {
- return 0;
- }
- }
-
- // Update output argument to point past ")"
- kInOut = offset + 1;
- return 1;
-}
-
-// Return true if "::blah" or "foo::bar<args>::..." found.
-int CPPParser::scopedItem(int k) {
- // printf("support.cpp scopedItem k %d\n",k);
- return (LT(k)->getType() == SCOPE ||
- (LT(k)->getType() == ID && !finalQualifier(k)));
-}
-
-// Return true if ID<...> or ID is last item in qualified item list.
-// Return false if LT(k) is not an ID.
-// ID must be a type to check for ID<...>,
-// or else we would get confused by "i<3"
-int CPPParser::finalQualifier(int k) {
- if (LT(k)->getType() == ID) {
- if (isTypeName((LT(k)->getText()).data()) &&
- LT(k + 1)->getType() == LESSTHAN) { // Starts with "T<". Skip <...>
- k++;
- skipTemplateQualifiers(k);
- } else { // skip ID;
- k++;
- }
- return (LT(k)->getType() != SCOPE);
- } else { // not an ID
- return 0;
- }
-}
-
-/*
- * Return true if 's' can pose as a type name
- */
-int CPPParser::isTypeName(
- const char *s) { // printf("isTypeName entered with %s\n",s);
- // To look for any type name only
- return 1;
- /*
- CPPSymbol *cs = ( CPPSymbol * ) symbols->lookup( s,CPPSymbol::otTypename );
-
- if ( cs==NULL )
- {
- printf("support.cpp isTypeName %s not found\n",s);
- return 0;
- }
-
- // This should now be redundant
- if ( cs->getType()==CPPSymbol::otTypedef||
- cs->getType()==CPPSymbol::otEnum||
- cs->getType()==CPPSymbol::otClass||
- cs->getType()==CPPSymbol::otStruct||
- cs->getType()==CPPSymbol::otUnion )
- {
- return 1;
- }
-
- return 0;
- */
-}
-
-/*
- * Return true if 's' is a class name (or a struct which is a class
- * with all members public).
- */
-int CPPParser::isClassName(const char *s) {
- return 1;
- /*
- // To look for any type name omly
- CPPSymbol *cs = ( CPPSymbol * ) symbols->lookup( s,CPPSymbol::otTypename );
-
- if ( cs==NULL )
- {
- printf("support.cpp isClassName %s not found\n",s);
- return 0;
- }
-
- if ( cs->getType()==CPPSymbol::otClass||
- cs->getType()==CPPSymbol::otStruct||
- cs->getType()==CPPSymbol::otUnion )
- {
- return 1;
- }
-
- return 0;
- */
-}
-
-void CPPParser::beginDeclaration() {}
-
-void CPPParser::endDeclaration() {}
-
-void CPPParser::beginFunctionDefinition() { functionDefinition = 1; }
-
-void CPPParser::endFunctionDefinition() {
- // Remove parameter scope
- symbols->dumpScope(stdout); // Diagnostic - See CPPDictionary.hpp
- // printf("endFunctionDefinition remove parameter
- // scope(%d):\n",symbols->getCurrentScopeIndex());
- symbols->removeScope(); // Remove symbols stored in current scope
- symbols->restoreScope(); // Reduce currentScope (higher level)
- // printf("endFunctionDefinition restoreScope() now
- // %d\n",symbols->getCurrentScopeIndex());
- functionDefinition = 0;
-}
-
-void CPPParser::beginConstructorDefinition() { functionDefinition = 1; }
-
-void CPPParser::endConstructorDefinition() {
- symbols->dumpScope(stdout); // Diagnostic - See CPPDictionary.hpp
- symbols->removeScope(); // Remove symbols stored in current scope
- symbols->restoreScope(); // Reduce currentScope (higher level)
- // printf("endConstructorDefinition restoreScope() now
- // %d\n",symbols->getCurrentScopeIndex());
- functionDefinition = 0;
-}
-
-void CPPParser::beginConstructorDeclaration(const char *ctor) {}
-
-void CPPParser::endConstructorDeclaration() {}
-
-void CPPParser::beginDestructorDefinition() { functionDefinition = 1; }
-
-void CPPParser::endDestructorDefinition() {
- symbols->dumpScope(stdout); // Diagnostic - See CPPDictionary.hpp
- symbols->removeScope(); // Remove symbols stored in current scope
- symbols->restoreScope(); // Reduce currentScope (higher level)
- // printf("endDestructorDefinition restoreScope() now
- // %d\n",symbols->getCurrentScopeIndex());
- functionDefinition = 0;
-}
-
-void CPPParser::beginDestructorDeclaration(const char *dtor) {}
-
-void CPPParser::endDestructorDeclaration() {}
-
-void CPPParser::beginParameterDeclaration() {}
-
-void CPPParser::beginFieldDeclaration() {}
-
-void CPPParser::declarationSpecifier(bool td, bool fd, StorageClass sc,
- TypeQualifier tq, TypeSpecifier ts,
- FunctionSpecifier fs) {
- // printf("support.cpp declarationSpecifier td %d, fd %d, sc %d, tq %d, ts %d,
- // fs %d\n",
- // td,fd,sc,tq,ts,fs);
- _td = td; // For typedef
- _fd = fd; // For friend
- _sc = sc;
- _tq = tq;
- _ts = ts;
- _fs = fs;
-}
-
-/* Symbols from declarators are added to the symbol table here.
- * The symbol is added to external scope or whatever the current scope is, in
- * the symbol table.
- * See list of object types below.
- */
-void CPPParser::declaratorID(const char *id, QualifiedItem qi) {
- // printf("declaratorID entered for %s\n",id);
- CPPSymbol *c;
- // printf("support.cpp declaratorID line %d %s found, _ts = %d, _td = %d, qi =
- // %d\n",
- // LT(1)->getLine(),id,_ts,_td,qi);
- if (qi == qiType || qi == qiNamespace) // Check for type declaration
- {
- c = new CPPSymbol(id, CPPSymbol::otTypedef);
- if (c == NULL) panic("can't alloc CPPSymbol");
- symbols->defineInScope(id, c, externalScope);
- if (statementTrace >= 2) {
- printf(
- "%d support.cpp declaratorID declare %s in external scope 1, "
- "ObjectType %d\n",
- LT(1)->getLine(), id, c->getType());
- }
- // DW 04/08/03 Scoping not fully implemented
- // Typedefs all recorded in 'external' scope and therefor never removed
- } else if (qi == qiFun) // Check for function declaration
- {
- c = new CPPSymbol(id, CPPSymbol::otFunction);
- if (c == NULL) panic("can't alloc CPPSymbol");
- symbols->define(id, c); // Add to current scope
- if (statementTrace >= 2) {
- printf(
- "%d support.cpp declaratorID declare %s in current scope %d, "
- "ObjectType %d\n",
- LT(1)->getLine(), id, symbols->getCurrentScopeIndex(), c->getType());
- }
- } else {
- if (qi != qiVar) {
- fprintf(
- stderr,
- "%d support.cpp declaratorID warning qi (%d) not qiVar (%d) for %s\n",
- LT(1)->getLine(), qi, qiVar, id);
- }
-
- c = new CPPSymbol(id, CPPSymbol::otVariable);
- if (c == NULL) panic("can't alloc CPPSymbol");
- symbols->define(id, c); // Add to current scope
- if (statementTrace >= 2) {
- printf(
- "%d support.cpp declaratorID declare %s in current scope %d, "
- "ObjectType %d\n",
- LT(1)->getLine(), id, symbols->getCurrentScopeIndex(), c->getType());
- }
- }
-}
-/* These are the object types
- 0 = otInvalid
- 1 = otFunction
- 2 = otVariable
- 3 = otTypedef Note. 3-7 are type names
- 4 = otStruct Note. 4, 5 & 7 are class names
- 5 = otUnion
- 6 = otEnum
- 7 = otClass
- 10 = otTypename
- 11 = otNonTypename
-*/
-
-void CPPParser::declaratorArray() {}
-
-void CPPParser::declaratorParameterList(int def) {
- symbols->saveScope(); // Advance currentScope (lower level)
- // printf("declaratorParameterList saveScope() now
- // %d\n",symbols->getCurrentScopeIndex());
-}
-
-void CPPParser::declaratorEndParameterList(int def) {
- if (!def) {
- symbols->dumpScope(stdout); // Diagnostic - See CPPDictionary.hpp
- symbols->removeScope(); // Remove symbols stored in current scope
- symbols->restoreScope(); // Reduce currentScope (higher level)
- // printf("declaratorEndParameterList restoreScope() now
- // %d\n",symbols->getCurrentScopeIndex());
- }
-}
-
-void CPPParser::functionParameterList() {
- symbols->saveScope(); // Advance currentScope (lower level)
- // printf("functionParameterList saveScope() now
- // %d\n",symbols->getCurrentScopeIndex());
- // DW 25/3/97 change flag from function to parameter list
- functionDefinition = 2;
-}
-
-void CPPParser::functionEndParameterList(int def) {
- // If this parameter list is not in a definition then this
- if (!def) {
- symbols->dumpScope(stdout); // Diagnostic - See CPPDictionary.hpp
- symbols->removeScope(); // Remove symbols stored in current scope
- symbols->restoreScope(); // Reduce currentScope (higher level)
- // printf("functionEndParameterList restoreScope() now
- // %d\n",symbols->getCurrentScopeIndex());
- } else {
- // Change flag from parameter list to body of definition
- functionDefinition = 3;
- }
- // Otherwise endFunctionDefinition removes the parameters from scope
-}
-
-void CPPParser::enterNewLocalScope() {
- symbols->saveScope(); // Advance currentScope (lower level)
- // printf("enterNewLocalScope saveScope() now
- // %d\n",symbols->getCurrentScopeIndex());
-}
-
-void CPPParser::exitLocalScope() {
- symbols->dumpScope(stdout); // Diagnostic - See CPPDictionary.hpp
- symbols->removeScope(); // Remove symbols stored in current scope
- symbols->restoreScope(); // Reduce currentScope (higher level)
- // printf("exitLocalScope restoreScope() now
- // %d\n",symbols->getCurrentScopeIndex());
-}
-
-void CPPParser::enterExternalScope() { // Scope has been initialised to 1 in
- // CPPParser.init() in CPPParser.hpp
- functionDefinition = 0;
-}
-
-void CPPParser::exitExternalScope() {
- symbols->dumpScope(stdout); // Diagnostic - See CPPDictionary.hpp
- symbols->removeScope(); // Remove symbols stored in current scope s/b 2
- symbols->restoreScope(); // Reduce currentScope (higher level)
-
- symbols->dumpScope(stdout); // Diagnostic - See CPPDictionary.hpp
- symbols->removeScope(); // Remove symbols stored in current scope s/b 1
- symbols->restoreScope(); // Reduce currentScope (higher level)
-
- if (symbols->getCurrentScopeIndex() == 0) {
- if (statementTrace >= 2) {
- fprintf(stdout, "\nSupport exitExternalScope, scope now %d as required\n",
- symbols->getCurrentScopeIndex());
- }
- } else {
- fprintf(stderr, "\nSupport exitExternalScope, scope now %d, should be 0\n",
- symbols->getCurrentScopeIndex());
- }
-}
-
-void CPPParser::classForwardDeclaration(TypeSpecifier ts, FunctionSpecifier fs,
- const char *tag)
-// classForwardDeclaration(const char *tag, TypeSpecifier ts, FunctionSpecifier
-// fs)
-{
- CPPSymbol *c = NULL;
-
- // if already in symbol table as a class, don't add
- // of course, this is incorrect as you can rename
- // classes by entering a new scope, but our limited
- // example basically keeps all types globally visible.
- if (symbols->lookup(tag, CPPSymbol::otTypename) != NULL) {
- CPPSymbol *cs = (CPPSymbol *)symbols->lookup(tag, CPPSymbol::otTypename);
- if (statementTrace >= 2) {
- printf(
- "%d support.cpp classForwardDeclaration %s already stored in "
- "dictionary, ObjectType %d\n",
- LT(1)->getLine(), tag, cs->getType());
- }
- return;
- }
-
- switch (ts) {
- case tsSTRUCT:
- c = new CPPSymbol(tag, CPPSymbol::otStruct);
- break;
- case tsUNION:
- c = new CPPSymbol(tag, CPPSymbol::otUnion);
- break;
- case tsCLASS:
- c = new CPPSymbol(tag, CPPSymbol::otClass);
- break;
- }
-
- if (c == NULL) panic("can't alloc CPPSymbol");
-
- symbols->defineInScope(tag, c, externalScope);
- if (statementTrace >= 2) {
- printf(
- "%d support.cpp classForwardDeclaration declare %s in external scope, "
- "ObjectType %d\n",
- LT(1)->getLine(), tag, c->getType());
- }
-
- // If it's a friend class forward decl, put in global scope also.
- // DW 04/07/03 No need if already in external scope. See above.
- // if ( ds==dsFRIEND )
- // {
- // CPPSymbol *ext_c = new CPPSymbol(tag, CPPSymbol::otClass);
- // if ( ext_c==NULL ) panic("can't alloc CPPSymbol");
- // if ( symbols->getCurrentScopeIndex()!=externalScope ) // DW 04/07/03
- // Not sure this test is really necessary
- // {
- // printf("classForwardDeclaration
- // defineInScope(externalScope)\n");
- // symbols->defineInScope(tag, ext_c, externalScope);
- // }
- // }
-}
-
-void CPPParser::exitNamespaceScope() {}
-
-void CPPParser::beginClassDefinition(TypeSpecifier ts, const char *tag) {
- CPPSymbol *c = NULL;
-
- // if already in symbol table as a class, don't add
- // of course, this is incorrect as you can rename
- // classes by entering a new scope, but our limited
- // example basically keeps all types globally visible.
- if (symbols->lookup(tag, CPPSymbol::otTypename) != NULL) {
- symbols->saveScope(); // still have to use scope to collect members
- // printf("support.cpp beginClassDefinition_1 saveScope() now
- // %d\n",symbols->getCurrentScopeIndex());
- if (statementTrace >= 2) {
- printf(
- "%d support.cpp beginClassDefinition classname %s already in "
- "dictionary\n",
- LT(1)->getLine(), tag);
- }
- return;
- }
-
- switch (ts) {
- case tsSTRUCT:
- c = new CPPSymbol(tag, CPPSymbol::otStruct);
- break;
- case tsUNION:
- c = new CPPSymbol(tag, CPPSymbol::otUnion);
- break;
- case tsCLASS:
- c = new CPPSymbol(tag, CPPSymbol::otClass);
- break;
- }
- if (c == NULL) panic("can't alloc CPPSymbol");
-
- symbols->defineInScope(tag, c, externalScope);
-
- if (statementTrace >= 2) {
- printf(
- "%d support.cpp beginClassDefinition define %s in external scope (1), "
- "ObjectType %d\n",
- LT(1)->getLine(), tag, c->getType());
- }
-
- strcat(qualifierPrefix, tag);
- strcat(qualifierPrefix, "::");
-
- // add all member type symbols into the global scope (not correct, but
- // will work for most code).
- // This symbol lives until the end of the file
- symbols->saveScope(); // Advance currentScope (lower level)
-}
-
-void CPPParser::endClassDefinition() {
- symbols->dumpScope(stdout); // Diagnostic - See CPPDictionary.hpp
- symbols->removeScope(); // Remove symbols stored in current scope
- symbols->restoreScope(); // Reduce currentScope (higher level)
- // remove final T:: from A::B::C::T::
- // upon backing out of last class, qualifierPrefix is set to ""
- char *p = &(qualifierPrefix[strlen(qualifierPrefix) - 3]);
- while (p > &(qualifierPrefix[0]) && *p != ':') {
- p--;
- }
- if (p > &(qualifierPrefix[0])) p++;
- *p = '\0';
-}
-
-void CPPParser::enumElement(const char *e) {}
-
-void CPPParser::beginEnumDefinition(
- const char *e) { // DW 26/3/97 Set flag for new class
-
- // add all enum tags into the global scope (not correct, but
- // will work for most code).
- // This symbol lives until the end of the file
- CPPSymbol *c = new CPPSymbol(e, CPPSymbol::otEnum);
- symbols->defineInScope(e, c, externalScope);
- if (statementTrace >= 2) {
- printf(
- "%d support.cpp beginEnumDefinition %s define in external scope, "
- "ObjectType %d\n",
- LT(1)->getLine(), e, c->getType());
- }
-}
-
-void CPPParser::endEnumDefinition() {}
-
-void CPPParser::templateTypeParameter(const char *t) {
- // DW 11/06/03 Symbol saved in templateParameterScope (0)
- // as a temporary measure until scope is implemented fully
- // This symbol lives until the end of the file
- CPPSymbol *e = new CPPSymbol(t, CPPSymbol::otTypedef); // DW 22/03/05
- // CPPSymbol *e = new CPPSymbol(t, CPPSymbol::otClass);
- if (e == NULL) panic("can't alloc CPPSymbol");
- // symbols->defineInScope(t, e, templateParameterScope); // DW 22/03/05
- // DW 10/08/05 Replaced to make template parameters local
- symbols->defineInScope(t, e, externalScope);
- // symbols->define(t,e); // Save template parameter in local scope
- if (statementTrace >= 2) {
- // printf("%d support.cpp templateTypeParameter declare %s in
- // parameter
- // scope (0), ObjectType %d\n",
- printf(
- "%d support.cpp templateTypeParameter declare %s in external scope "
- "(1), ObjectType %d\n",
- LT(1)->getLine(), t, e->getType());
- }
- // printf("%d support.cpp templateTypeParameter declare %s in
- // current
- // scope %d, ObjectType %d\n",
- // LT(1)->getLine(),t,symbols->getCurrentScopeIndex(),e->getType());
-}
-
-void CPPParser::beginTemplateDeclaration() {
- symbols->saveScope(); // Advance currentScope (lower level)
- // printf("Support beginTemplateDeclaration, Scope now
- // %d\n",symbols->getCurrentScopeIndex());
-}
-
-void CPPParser::endTemplateDeclaration() {
- symbols->dumpScope(stdout); // Diagnostic - See CPPDictionary.hpp
- symbols->removeScope(); // Remove symbols stored in current scope
- symbols->restoreScope(); // Reduce currentScope (higher level)
- // printf("Support endTemplateDeclaration, Scope now
- // %d\n",symbols->getCurrentScopeIndex());
-}
-
-void CPPParser::beginTemplateDefinition() {}
-
-void CPPParser::endTemplateDefinition() {}
-
-void CPPParser::beginTemplateParameterList() {
- // DW 26/05/03 To scope template parameters
- symbols->saveScope(); // Advance currentScope (lower level)
-}
-
-void CPPParser::endTemplateParameterList() {
- // DW 26/05/03 To end scope template parameters
- symbols->restoreScope(); // Reduce currentScope (higher level)
-}
-
-void CPPParser::exceptionBeginHandler() {}
-
-void CPPParser::exceptionEndHandler() { // remove parm elements from the
- // handler scope
- symbols->dumpScope(stdout); // Diagnostic - See CPPDictionary.hpp
- symbols->removeScope(); // Remove symbols stored in current scope
- symbols->restoreScope(); // Reduce currentScope (higher level)
-}
-
-void CPPParser::end_of_stmt() {
-#ifdef MYCODE
- myCode_end_of_stmt();
-#endif // MYCODE
-}
-
-void CPPParser::panic(const char *err) {
- fprintf(stdout, "CPPParser: %s\n", err);
- _exit(-1);
-}
-
-/* DW 090204 leave out of support.cpp for the time being
-// want to see how supplied routine in LLkParser works first
-void CPPParser::
-tracein(char *r)
-{
-// testing
- printf("support tracein entered\n");
- getchar();
- if ( !doTracing ) return;
- for (int i=1; i<=traceIndentLevel; i++)
- fprintf(stdout, " ");
- traceIndentLevel++;
- fprintf(stdout, "enter %s('%s %s')%s\n",
- r,
- (LT(1)->getText()).data(),
- (LT(2)->getText()).data(),
- inputState->guessing?" [guessing]":""
- );
- fflush(stdout);
-}
-
-void CPPParser::
-traceout(char *r)
-{
- if ( !doTracing ) return;
- traceIndentLevel--;
- for (int i=1; i<=traceIndentLevel; i++)
- fprintf(stdout, " ");
- fprintf(stdout, "exit %s('%s %s')%s\n",
- r,
- (LT(1)->getText()).data(),
- (LT(2)->getText()).data(),
- inputState->guessing?" [guessing]":""
- );
- fflush(stdout);
-}
-*/
-
-// Functions which may be overridden by MyCode subclass
-
-void CPPParser::myCode_pre_processing(int argc, char *argv[]) {}
-
-void CPPParser::myCode_post_processing() {}
-
-void CPPParser::myCode_end_of_stmt() {}
-
-void CPPParser::myCode_function_direct_declarator(const char *id) {
- // printf("support myCode_function_direct_declarator entered for %s\n",id);
-}
diff --git a/contrib/pdxautoserializer/src/impl/Helper.cpp b/contrib/pdxautoserializer/src/impl/Helper.cpp
deleted file mode 100644
index edbea45..0000000
--- a/contrib/pdxautoserializer/src/impl/Helper.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "../base_types.hpp"
-#include "Helper.hpp"
-
-namespace apache {
-namespace geode {
-namespace client {
-namespace pdx_auto_serializer {
-void Helper::splitString(const std::string& str, const std::string& delim,
- StringVector& splitStr) {
- std::string::size_type offset = 0;
- std::string::size_type delimIndex;
-
- while ((delimIndex = str.find(delim, offset)) != std::string::npos) {
- splitStr.push_back(str.substr(offset, delimIndex - offset));
- offset += delimIndex - offset + delim.length();
- }
- splitStr.push_back(str.substr(offset));
-}
-
-std::string Helper::stringReplace(const std::string& source,
- const std::string& findStr,
- const std::string& replaceStr) {
- std::string resultStr;
- std::string::const_iterator srcIterator = source.begin();
- while (srcIterator != source.end()) {
- bool matchFound = true;
- std::string::const_iterator matchIterator = srcIterator;
- std::string::const_iterator findIterator = findStr.begin();
- while (findIterator != findStr.end()) {
- if (matchIterator == source.end() ||
- *matchIterator++ != *findIterator++) {
- matchFound = false;
- break;
- }
- }
- if (matchFound) {
- resultStr += replaceStr;
- srcIterator = matchIterator;
- } else {
- resultStr += *srcIterator;
- ++srcIterator;
- }
- }
- return resultStr;
-}
-
-bool Helper::getSingleProperty(PropertyMap& properties, const std::string& name,
- std::string& value) {
- PropertyMap::iterator propertyFind = properties.find(name);
- if (propertyFind != properties.end()) {
- if (propertyFind->second.size() == 1) {
- value = propertyFind->second[0];
- }
- properties.erase(propertyFind);
- return true;
- }
- return false;
-}
-
-bool Helper::getMultiProperty(PropertyMap& properties, const std::string& name,
- StringVector& value) {
- PropertyMap::iterator propertyFind = properties.find(name);
- if (propertyFind != properties.end()) {
- value = propertyFind->second;
- properties.erase(propertyFind);
- return true;
- }
- return false;
-}
-
-void Helper::deleteASClasses(ASClassVector& classes) {
- for (ASClassVector::const_iterator classIterator = classes.begin();
- classIterator != classes.end(); ++classIterator) {
- delete *classIterator;
- }
- classes.clear();
-}
-} // namespace pdx_auto_serializer
-} // namespace client
-} // namespace geode
-} // namespace apache
diff --git a/contrib/pdxautoserializer/src/impl/Helper.hpp b/contrib/pdxautoserializer/src/impl/Helper.hpp
deleted file mode 100644
index a25ac06..0000000
--- a/contrib/pdxautoserializer/src/impl/Helper.hpp
+++ /dev/null
@@ -1,191 +0,0 @@
-#pragma once
-
-#ifndef GEODE_PDXAUTOSERIALIZER_IMPL_HELPER_H_
-#define GEODE_PDXAUTOSERIALIZER_IMPL_HELPER_H_
-
-/*
- * 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 "../InputParser.hpp"
-#include <algorithm>
-#include <cctype>
-#include <sstream>
-
-// TODO cmake what is the purpose of only doing this on GNU? #ifdef __GNUC__
-#if !defined(_WIN32)
-extern "C" {
-#include <cxxabi.h>
-#include <stdlib.h>
-#include <string.h>
-}
-#endif
-
-namespace apache {
-namespace geode {
-namespace client {
-namespace pdx_auto_serializer {
-/**
- * Class containing some static utility methods.
- */
-class Helper {
- public:
- /**
- * Set the various fields for a <code>TypeInfo</code> object.
- *
- * @param type Pointer to the type whose fields have to be set.
- * @param kind The kind (using the constants defined in
- * <code>TypeKind</code>) for the type.
- * @param modified The modifier (using the constants defined in
- * <code>TypeModifier</code> for the type.
- * @param nameOrSize The name or size of this type.
- * @param child Child type of this, if any.
- */
- inline static void setTypeInfo(TypeInfo* type, const int kind,
- const int modifier,
- const std::string& nameOrSize,
- const std::string& nameOfArrayElemSize,
- TypeInfo* children, int numChildren) {
- type->m_kind = kind;
- type->m_modifier = modifier;
- type->m_nameOrSize = nameOrSize;
- type->m_nameOfArrayElemSize = nameOfArrayElemSize;
- type->m_children = children;
- type->m_numChildren = numChildren;
- }
-
- /**
- * Convert a given string to lower-case.
- *
- * @param str The string to be converted.
- * @return The string converted to lower-case.
- */
- inline static std::string toLower(const std::string& str) {
- std::string strLower = str;
- std::transform(strLower.begin(), strLower.end(), strLower.begin(),
- (int (*)(int))std::tolower);
- return strLower;
- }
-
- /**
- * Convenience function to split a given string on the given delimiter.
- *
- * @param str The string to be split.
- * @param delim The delimiter to be used for splitting the string.
- * @param splitStr The vector containing the split portions of string.
- */
- static void splitString(const std::string& str, const std::string& delim,
- StringVector& splitStr);
-
- /**
- * Replace all the occurances of a sequence with a given string.
- * Right now uses a simple sliding window algorithm.
- *
- * @param source The string to search in.
- * @param findStr The sequence to search for in <code>source</code>.
- * @param replaceStr The replacement string.
- * @return The result string after replacing all occurances of
- * <code>findStr</code> with <code>replaceStr</code> in
- * <code>source</code>.
- */
- static std::string stringReplace(const std::string& source,
- const std::string& findStr,
- const std::string& replaceStr);
-
- /**
- * Template function to convert between different types when possible.
- * Tries to emulate the function of same name provided by the boost
- * library.
- *
- * @param val The source to be converted.
- * @param dest The destination that shall contain the conversion.
- */
- template <typename TDest, class TSrc>
- inline static void lexical_cast(const TSrc& src, TDest& dest) {
- std::stringstream ss;
- if (!(ss << src && ss >> dest && ss >> std::ws && ss.eof())) {
- throw std::invalid_argument("Conversion failed.");
- }
- }
-
- /**
- * Get a property with single value and erase from the property map.
- *
- * @param properties The property map. If the property is found in
- * the map then it is erased.
- * @param name The name of the property to obtain.
- * @param value The value of the property. It should have a single
- * value else this is not filled in.
- * @return True if the property was found in the map.
- */
- static bool getSingleProperty(PropertyMap& properties,
- const std::string& name, std::string& value);
-
- /**
- * Get a property with multiple values and erase from the property map.
- *
- * @param properties The property map. If the property is found in
- * the map then it is erased.
- * @param name The name of the property to obtain.
- * @param value The value vector for the property.
- * @return True if the property was found in the map.
- */
- static bool getMultiProperty(PropertyMap& properties, const std::string& name,
- StringVector& value);
-
- /**
- * Cleanup the vector of allocated <code>ClassInfo</code> objects.
- *
- * @param classes The vector of <code>ClassInfo</code>es.
- */
- static void deleteASClasses(ASClassVector& classes);
-
- /**
- * Get the typename after demangling (if required) the name returned
- * by <code>typeid</code> for a given object.
- *
- * @param obj The object whose type name is required.
- * @return The type name of the given object.
- */
- template <typename T>
- static std::string typeName(const T& obj) {
- const char* typeidName = typeid(obj).name();
- std::string typeName;
-#ifdef __GNUC__
- int status;
- char* demangledName = abi::__cxa_demangle(typeidName, NULL, NULL, &status);
- if (status == 0 && demangledName != NULL) {
- typeName = demangledName;
- free(demangledName);
- }
-#endif
- if (typeName.length() == 0) {
- typeName = typeidName;
- }
- const char* classPrefix = "class ";
- size_t classPrefixLen = ::strlen(classPrefix);
- if (typeName.substr(0, classPrefixLen) == classPrefix) {
- typeName = typeName.substr(classPrefixLen);
- }
- return typeName;
- }
-};
-} // namespace pdx_auto_serializer
-} // namespace client
-} // namespace geode
-} // namespace apache
-
-#endif // GEODE_PDXAUTOSERIALIZER_IMPL_HELPER_H_
diff --git a/contrib/pdxautoserializer/src/impl/Log.cpp b/contrib/pdxautoserializer/src/impl/Log.cpp
deleted file mode 100644
index ade30cb..0000000
--- a/contrib/pdxautoserializer/src/impl/Log.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "Log.hpp"
-#include <iostream>
-#include <stdexcept>
-
-namespace apache {
-namespace geode {
-namespace client {
-namespace pdx_auto_serializer {
-static std::ostream* g_outStream = &std::cout;
-static std::ostream* g_errStream = &std::cerr;
-
-void Log::init(std::ostream* outStream, std::ostream* errStream) {
- g_outStream = outStream;
- g_errStream = errStream;
-}
-
-void Log::info(const std::string& moduleName, const std::string& message) {
- *g_outStream << moduleName << ":: " << message << std::endl;
-}
-
-void Log::warn(const std::string& moduleName, const std::string& message) {
- *g_errStream << moduleName << ":: Warning: " << message << std::endl;
-}
-
-void Log::fatal(const std::string& moduleName, const std::string& message) {
- throw std::invalid_argument(moduleName + ":: FATAL: " + message);
-}
-
-void Log::debug(const std::string& moduleName, const std::string& message) {
-#ifdef _DEBUG
- *g_outStream << moduleName << ":: DEBUG: " << message << std::endl;
-#endif
-}
-} // namespace pdx_auto_serializer
-} // namespace client
-} // namespace geode
-} // namespace apache
diff --git a/contrib/pdxautoserializer/src/impl/Log.hpp b/contrib/pdxautoserializer/src/impl/Log.hpp
deleted file mode 100644
index e2e9a16..0000000
--- a/contrib/pdxautoserializer/src/impl/Log.hpp
+++ /dev/null
@@ -1,93 +0,0 @@
-#pragma once
-
-#ifndef GEODE_PDXAUTOSERIALIZER_IMPL_LOG_H_
-#define GEODE_PDXAUTOSERIALIZER_IMPL_LOG_H_
-
-/*
- * 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 <string>
-#include <iosfwd>
-
-namespace apache {
-namespace geode {
-namespace client {
-namespace pdx_auto_serializer {
-/**
- * This class provides simple static functions to print messages on the
- * console in a uniform manner, or to throw exceptions on fatal conditions.
- */
-class Log {
- public:
- /**
- * Initialize the log with the given output and error streams. The
- * default is to use <code>std::cout</code> and <code>std::cerr</code>
- * for them respectively.
- *
- * @param outStream The output stream to use for logging of
- * <code>Log::info</code> and <code>Log::debug</code>
- * level messages below.
- * @param errStream The output stream to use for logging of
- * <code>Log::warn</code> level messages.
- */
- static void init(std::ostream* outStream, std::ostream* errStream);
-
- /**
- * Write info level message on the console.
- *
- * @param moduleName The module which needs to print the message.
- * @param message The message to be printed.
- */
- static void info(const std::string& moduleName, const std::string& message);
-
- /**
- * Write a warning message on the console.
- *
- * @param moduleName The module which needs to print the message.
- * @param message The message to be printed.
- */
- static void warn(const std::string& moduleName, const std::string& message);
-
- /**
- * Throw a fatal exception -- for now this uses
- * <code>std::invalid_argument</code> exception.
- *
- * @param moduleName The module which needs to print the message.
- * @param message The message to be printed.
- */
- static void fatal(const std::string& moduleName, const std::string& message);
-
- /**
- * Write debug level message on the console. This is only enabled in the
- * debug build when _DEBUG macro is set.
- *
- * @param moduleName The module which needs to print the message.
- * @param message The message to be printed.
- */
- static void debug(const std::string& moduleName, const std::string& message);
-
- private:
- // The default and copy constructors are never defined.
- Log();
- Log(const Log&);
-};
-} // namespace pdx_auto_serializer
-} // namespace client
-} // namespace geode
-} // namespace apache
-
-#endif // GEODE_PDXAUTOSERIALIZER_IMPL_LOG_H_
diff --git a/contrib/pdxautoserializer/src/impl/Main.cpp b/contrib/pdxautoserializer/src/impl/Main.cpp
deleted file mode 100644
index 42e651f..0000000
--- a/contrib/pdxautoserializer/src/impl/Main.cpp
+++ /dev/null
@@ -1,462 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "../base_types.hpp"
-#include "../InputParserFactory.hpp"
-#include "../CodeGeneratorFactory.hpp"
-#include "../CodeGenerator.hpp"
-#include "Log.hpp"
-#include "Helper.hpp"
-#include <iostream>
-
-/**
-* @namespace apache::geode::client::pdx_auto_serializer The namespace containing
-* the
-* auto-serializer classes.
-*/
-using namespace apache::geode::client::pdx_auto_serializer;
-
-/** The name used for invocation of the program on command-line. */
-std::string progName;
-/** The parser factory object. */
-InputParserFactory parserFactory;
-/** The code generator factory object. */
-CodeGeneratorFactory generatorFactory;
-/** The parser returned by the parser factory. */
-InputParser* parser = NULL;
-/** The list of classes given by the parser. */
-ASClassVector classes;
-/** The <code>CodeGenerator</code> object returned by the factory. */
-CodeGenerator* codeGenerator = NULL;
-/**
-* The options with their usage for the tool with current parser and
-* code generator.
-*/
-OptionMap toolOptions;
-
-/** Name of this module. */
-static std::string ModuleName = "PdxAutoSerializer";
-
-/**
-* The option used to specify the language of the code to be auto-serialized.
-*/
-static const std::string LanguageOption = "language";
-
-/**
-* The option used to specify the language in which the auto-serialized code
-* is to be generated.
-*/
-static const std::string GeneratorOption = "generator";
-
-/** The option name for class name. */
-static const std::string ClassNameOption = "className";
-
-/** The option name for class name String */
-static const std::string getClassNameOption = "classNameStr";
-
-/** The option used to obtain usage information. */
-static const std::string UsageOption = "usage";
-
-/** The option for help -- gives same output as usage for now. */
-static const std::string HelpOption = "help";
-
-/** the option for directory to generate auto-generated files */
-static const std::string outDirectoryOption = "outDir";
-
-/** Fill in the default top-level options required for the tool. */
-void addMainOptions();
-
-/**
-* Parse the command-line and get the resource names and the properties.
-*
-* @param argc The number of command-line arguments.
-* @param argv The string array containing the command-line arguments.
-* @param resources The names of the resources.
-* @param properties Output parameter containing the properties as a map.
-*/
-void parseCommandLine(int argc, char** argv, StringVector& resources,
- PropertyMap& properties);
-
-/**
-* Show the program usage. If any language/generator has been selected then
-* its options are also shown.
-*/
-void showUsage();
-
-/** Cleanly destroy all the global objects. */
-void cleanupObjects();
-
-/** Cleanup any files or other artifacts in case of abnormal exit. */
-void cleanup();
-
-/**
-* The main entry point of the tool.
-*
-* @param argc The number of command-line arguments.
-* @param argv The string array containing the command-line arguments.
-*/
-
-static void Tokenize(const std::string& str, std::vector<std::string>& tokens,
- const std::string& delimiters = " ") {
- std::string::size_type lastPos = str.find_first_not_of(delimiters, 0);
- std::string::size_type pos = str.find_first_of(delimiters, lastPos);
- while (std::string::npos != pos || std::string::npos != lastPos) {
- tokens.push_back(str.substr(lastPos, pos - lastPos));
- lastPos = str.find_first_not_of(delimiters, pos);
- pos = str.find_first_of(delimiters, lastPos);
- }
-}
-int main(int argc, char** argv) {
- bool success = false;
- struct CleanUp {
- private:
- bool& m_success;
-
- public:
- explicit CleanUp(bool& success) : m_success(success) {}
- ~CleanUp() {
- if (m_success) {
- cleanupObjects();
- } else {
- cleanup();
- }
- }
- } cleanOnExit(success);
-
- try {
- StringVector resources;
- PropertyMap properties;
- const std::string languageString = "C++";
- const std::string generatorString = "C++";
- StringVector classNames;
-
- progName = argv[0];
- std::string::size_type baseIndex = progName.find_last_of("/\\");
- if (baseIndex != std::string::npos) {
- progName = progName.substr(baseIndex + 1);
- }
- addMainOptions();
- parseCommandLine(argc, argv, resources, properties);
- std::map<std::string, std::string> classNameStringMap;
-
- try {
- if (languageString.length() > 0 &&
- (parser = parserFactory.getInstance(languageString)) == NULL) {
- throw std::invalid_argument("No such language: " + languageString);
- }
-
- if (generatorString.length() > 0 &&
- (codeGenerator = generatorFactory.getInstance(generatorString)) ==
- NULL) {
- throw std::invalid_argument("No such code generator: " +
- generatorString);
- }
-
- if (parser != NULL) {
- parser->getOptions(toolOptions);
- }
- if (codeGenerator != NULL) {
- codeGenerator->getOptions(toolOptions);
- }
-
- std::string usageString;
- if (Helper::getSingleProperty(properties, UsageOption, usageString) ||
- Helper::getSingleProperty(properties, HelpOption, usageString)) {
- showUsage();
- return 0;
- }
-
- if (parser == NULL) {
- throw std::invalid_argument("No input language specified.");
- }
- if (codeGenerator == NULL) {
- throw std::invalid_argument("No output language specified.");
- }
- if (resources.size() == 0) {
- throw std::invalid_argument("No input resources specified.");
- }
-
- if (!Helper::getMultiProperty(properties, ClassNameOption, classNames) ||
- classNames.size() == 0) {
- Log::warn(ModuleName,
- "No class name specified; "
- "will serialize all classes.");
- }
-
- std::string classNameString;
-
- std::vector<std::string> classNameStringVector;
-
- Helper::getMultiProperty(properties, getClassNameOption,
- classNameStringVector);
- for (std::vector<std::string>::iterator itr =
- classNameStringVector.begin();
- itr != classNameStringVector.end(); ++itr) {
- std::vector<std::string> eachClassNameVector;
- Tokenize(*itr, eachClassNameVector, ":");
- if (eachClassNameVector.size() == 2) {
- classNameStringMap.insert(std::pair<std::string, std::string>(
- eachClassNameVector[0], eachClassNameVector[1]));
- } else {
- throw std::invalid_argument("No input class name string specified.");
- }
- }
-
- parser->init(properties);
- parser->selectClasses(resources, classNames);
- parser->getSelectedClasses(classes);
-
- codeGenerator->init(properties);
-
- } catch (const std::exception& ex) {
- std::cerr << Helper::typeName(ex) << ": " << ex.what() << std::endl;
- std::cerr << "Use --help or --usage option for help" << std::endl;
- return 1;
- }
-
- if (properties.size() > 0) {
- showUsage();
- return 1;
- }
-
- Log::info(ModuleName, "Classes being serialized:");
- for (ASClassVector::const_iterator classIterator = classes.begin();
- classIterator != classes.end(); ++classIterator) {
- Log::info(ModuleName, '\t' + (*classIterator)->getName());
- }
-
- for (ASClassVector::const_iterator classIterator = classes.begin();
- classIterator != classes.end(); ++classIterator) {
- ReferenceVector references;
- TypeInfo classInfo;
- VariableVector members;
- std::string varName = "__var";
-
- const ClassInfo* currentClass = *classIterator;
-
- try {
- currentClass->getTypeInfo(classInfo);
- codeGenerator->initClass(classInfo);
- } catch (const std::exception& ex) {
- std::cerr << Helper::typeName(ex) << ": " << ex.what() << std::endl;
- std::cerr << "Use --help or --usage option for help" << std::endl;
- return 1;
- }
-
- currentClass->getReferences(references);
- currentClass->getMembers(members);
-
- codeGenerator->addFileHeader(argc, argv);
- codeGenerator->addReferences(references);
- codeGenerator->startClass(members);
-
- std::vector<CodeGenerator::Method::Type> methods;
- methods.push_back(CodeGenerator::Method::TODATA);
- methods.push_back(CodeGenerator::Method::FROMDATA);
- for (size_t index = 0; index < methods.size(); ++index) {
- CodeGenerator::Method::Type method = methods[index];
- codeGenerator->startMethod(method, varName,
- currentClass->getMethodPrefix());
- // Adding try block
- // Ticket #905 Changes starts here
- codeGenerator->addTryBlockStart(method);
- // Ticket #905 Changes ends here
- for (VariableVectorIterator memberIterator = members.begin();
- memberIterator != members.end(); ++memberIterator) {
- codeGenerator->genMethod(method, varName, *memberIterator);
- }
- // Finish try block
- // Ticket #905 Changes starts here
- codeGenerator->finishTryBlock(method);
- // Ticket #905 Changes ends here
- codeGenerator->endMethod(method, varName);
- }
- codeGenerator->genClassNameMethod(classNameStringMap,
- currentClass->getMethodPrefix());
- codeGenerator->genCreateDeserializable(currentClass->getMethodPrefix());
- codeGenerator->genTypeId(currentClass->getMethodPrefix());
- codeGenerator->endClass();
- }
- } catch (const std::invalid_argument& ex) {
- std::cerr << "Use --help or --usage option for help" << std::endl;
- return 1;
- } catch (const std::exception& ex) {
- std::cerr << Helper::typeName(ex) << ": " << ex.what() << std::endl;
- return 1;
- } catch (...) {
- std::cerr << "Caught an unknown exception." << std::endl;
- return 1;
- }
- success = true;
- return 0;
-}
-
-void addMainOptions() {
- std::pair<bool, std::string> optionPair;
- // std::string languageStr;
- // StringVector languages = parserFactory.getParsers();
- // assert(languages.size() > 0);
- // StringVectorIterator languageIterator = languages.begin();
- // languageStr = *languageIterator;
- // while (++languageIterator != languages.end()) {
- // languageStr += ',' + *languageIterator;
- //}
- // optionPair.first = true;
- ///*optionPair.second = "Generate code for the given language "
- // "-- one of " + languageStr + " (SINGLE)";
- // toolOptions[LanguageOption] = optionPair;*/
-
- // std::string generatorStr;
- // StringVector generators = generatorFactory.getGenerators();
- // assert(generators.size() > 0);
- // StringVectorIterator generatorIterator = generators.begin();
- // generatorStr = *generatorIterator;
- // while (++generatorIterator != generators.end()) {
- // generatorStr += ',' + *generatorIterator;
- //}
- /*optionPair.second = "Generate code in the given generator "
- "-- one of " + generatorStr + " (SINGLE)";
- toolOptions[GeneratorOption] = optionPair;*/
-
- optionPair.first = true;
- optionPair.second =
- "Name of the class for which to generate "
- "auto-serialization code (MULTIPLE,OPTIONAL)";
- toolOptions[ClassNameOption] = optionPair;
-
- optionPair.first = false;
- optionPair.second = (std::string) "\t\tThis usage message.";
- toolOptions[UsageOption] = optionPair;
-
- optionPair.first = false;
- optionPair.second = (std::string) "\t\tThis help message.";
- toolOptions[HelpOption] = optionPair;
-
- optionPair.first = true;
- optionPair.second = (std::string) "Name of the class in string representation"
- "(MULTIPLE,OPTIONAL)";
- toolOptions[getClassNameOption] = optionPair;
-
- optionPair.first = false;
- optionPair.second = (std::string) "\tName of the directory where auto-generated"
- "files will be written, default is current working directory";
- toolOptions[outDirectoryOption] = optionPair;
-}
-
-void parseCommandLine(int argc, char** argv, StringVector& resources,
- PropertyMap& properties) {
- if (argc < 2) {
- throw std::invalid_argument("");
- }
- for (int propertyIndex = 1; propertyIndex < argc; propertyIndex++) {
- char* arg = argv[propertyIndex];
- if (arg[0] == '-' && arg[1] == '-') {
- // Is a property value option.
- std::string prop = arg + 2;
- std::string propertyName;
- std::string propertyValue;
- std::string::size_type valPos;
- if ((valPos = prop.find('=')) != std::string::npos) {
- propertyName = prop.substr(0, valPos);
- propertyValue = prop.substr(valPos + 1);
- } else {
- propertyName = prop;
- }
- PropertyMap::iterator propertyFind = properties.find(propertyName);
- if (propertyFind == properties.end()) {
- StringVector propertyValues;
- if (propertyValue.length() > 0) {
- propertyValues.push_back(propertyValue);
- }
- properties[propertyName] = propertyValues;
- } else if (propertyValue.length() > 0) {
- propertyFind->second.push_back(propertyValue);
- }
- } else {
- resources.push_back(arg);
- }
- }
-}
-
-void showUsage() {
- std::cout << "Usage: " << progName << " [OPTIONS] <resources e.g. "
- "header> ...\n\n";
-
- std::cout << "Resource name should be the path to the header "
- "containing the classes to be auto-serialized.\n\n";
- std::cout
- << "Options may be one of those given below.\nSINGLE denotes "
- "that the option should be specified only once.\nMULTIPLE denotes "
- "that the "
- "option can be specified more than once.\nOPTIONAL denotes that the "
- "option may be skipped in which case the default for that shall be "
- "chosen.";
- std::cout << '\n' << std::endl;
- for (OptionMap::const_iterator optionIterator = toolOptions.begin();
- optionIterator != toolOptions.end(); ++optionIterator) {
- std::cout << "--" << optionIterator->first;
- if (optionIterator->second.first) {
- std::cout << "=VALUE";
- }
- std::cout << '\t' << optionIterator->second.second << '\n';
- }
- std::cout << std::endl;
-
- std::cout << "Examples:" << std::endl;
- std::cout << "\t pdxautoserializer -outDir=<DIR NAME> <RESOURCE>"
- << std::endl;
- std::cout
- << "\t pdxautoserializer -outDir=<DIR NAME> --className=<CLASSNAME1> ";
- std::cout << "--className=<CLASSNAME2> <RESOURCE>" << std::endl;
- std::cout << "\t pdxautoserializer -outDir=<DIR NAME> "
- "--classNameStr=<CLASSNAME1:User defined String> ";
- std::cout << "--classNameStr=<CLASSNAME:User defined String> <RESOURCE>"
- << std::endl
- << std::endl;
- std::cout << "Helper Macros to be defined in Input Header File : "
- << std::endl;
- std::cout << "GFINCLUDE\t for including a specific member for serialization"
- << std::endl;
- std::cout << "GFEXCLUDE\t for excluding a specific member for serialization"
- << std::endl;
- std::cout << "GFID\t\t for considering a member as Identify Field"
- << std::endl;
- std::cout << "GFARRAYSIZE\t for specifying a array length member"
- << std::endl;
- std::cout << "GFIGNORE\t for ignoring certain keywords" << std::endl;
- std::cout << "For more details refer to documentation on this utility."
- << std::endl;
-}
-
-void cleanupObjects() {
- Helper::deleteASClasses(classes);
- if (parser != NULL) {
- delete parser;
- parser = NULL;
- }
- if (codeGenerator != NULL) {
- delete codeGenerator;
- codeGenerator = NULL;
- }
-}
-
-void cleanup() {
- if (codeGenerator != NULL) {
- codeGenerator->cleanup();
- }
- cleanupObjects();
-}
diff --git a/cppcache/CMakeLists.txt b/cppcache/CMakeLists.txt
index 5182494..524e52a 100644
--- a/cppcache/CMakeLists.txt
+++ b/cppcache/CMakeLists.txt
@@ -13,9 +13,17 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-cmake_minimum_required(VERSION 3.10)
project(cppcache LANGUAGES CXX)
+include(CheckIncludeFile)
+include(CheckFunctionExists)
+
+find_package(Threads)
+if (CMAKE_USE_PTHREADS_INIT)
+ check_include_file("pthread.h" HAVE_PTHREAD_H)
+ check_function_exists("pthread_setname_np" HAVE_pthread_setname_np)
+endif()
+
set(COMMON_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
set(COMMON_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
@@ -86,9 +94,11 @@
endif()
target_link_libraries(_apache-geode INTERFACE
- ACE
- boost
- libxml2
+ ACE::ACE
+ Boost::boost
+ Boost::filesystem
+ Boost::thread
+ LibXml2::LibXml2
)
if (USE_PCH)
@@ -118,5 +128,9 @@
add_subdirectory(static)
add_subdirectory(test)
add_subdirectory(internal)
+add_subdirectory(integration)
add_subdirectory(integration-test)
-add_subdirectory(integration-test-2)
+
+if (BUILD_BENCHMARKS)
+ add_subdirectory(benchmark)
+endif()
\ No newline at end of file
diff --git a/cppcache/README.md b/cppcache/README.md
new file mode 100644
index 0000000..e947804
--- /dev/null
+++ b/cppcache/README.md
@@ -0,0 +1,37 @@
+Contents
+========
+
+
+## Main sources
+
+# include/
+Public include header files for C++ library.
+
+# src/
+Sources for both static and shared C++ library.
+
+# shared/
+Shared library definition only. Should not contain any sources.
+
+# static/
+Static library definition only. Should not contain any sources.
+
+
+## Test and Benchmark sources
+
+# integration/
+Integration syle tests, benchmarks, and common sources. These are all "modern"
+single process style and shoult not use any of the "legacy" multiple process
+framework.
+
+## integrtion-test/
+Legacy integration tests written in the multiple process framework. No new tests
+should be added to this collections. Fixes and rewrites should be migrated to
+the new framework in the _integration/test_ directory metioned above.
+
+## test/
+Unit style tests.
+
+## benchmark/
+Unit style or micro benchmark tests.
+
diff --git a/contrib/pdxautoserializer/src/CMakeLists.txt b/cppcache/benchmark/CMakeLists.txt
similarity index 70%
rename from contrib/pdxautoserializer/src/CMakeLists.txt
rename to cppcache/benchmark/CMakeLists.txt
index 895cd74..5461abe 100644
--- a/contrib/pdxautoserializer/src/CMakeLists.txt
+++ b/cppcache/benchmark/CMakeLists.txt
@@ -4,24 +4,31 @@
# 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.
-cmake_minimum_required(VERSION 3.4)
-project(pdxautoserializer)
-file(GLOB_RECURSE SOURCES "*.cpp")
+add_executable(cpp-benchmark
+ main.cpp
+ GeodeHashBM.cpp
+ )
-add_executable(pdxautoserializer ${SOURCES})
-target_link_libraries(pdxautoserializer
+target_link_libraries(cpp-benchmark
+ PUBLIC
+ apache-geode-static
+ benchmark::benchmark
PRIVATE
- antlr
-)
+ _WarningsAsError
+ )
-install(TARGETS pdxautoserializer DESTINATION bin)
-include_directories(${CMAKE_SOURCE_DIR}/../../src/cppcache/include)
+target_include_directories(cpp-benchmark
+ PRIVATE
+ $<TARGET_PROPERTY:apache-geode-static,SOURCE_DIR>/../src
+ )
+
+add_clangformat(cpp-benchmark)
diff --git a/cppcache/benchmark/GeodeHashBM.cpp b/cppcache/benchmark/GeodeHashBM.cpp
new file mode 100644
index 0000000..2aa8c9d
--- /dev/null
+++ b/cppcache/benchmark/GeodeHashBM.cpp
@@ -0,0 +1,72 @@
+/*
+ * 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 <benchmark/benchmark.h>
+
+#include <geode/CacheableString.hpp>
+
+#include "util/string.hpp"
+
+using apache::geode::client::to_utf16;
+using apache::geode::client::to_utf8;
+using apache::geode::client::internal::geode_hash;
+
+template <class ToString, class FromString>
+ToString convert(const FromString& from);
+
+template <>
+std::string convert(const std::u32string& from) {
+ return to_utf8(from);
+}
+
+template <>
+std::u16string convert(const std::u32string& from) {
+ return to_utf16(from);
+}
+
+template <class String, char32_t UnicodeChar>
+void GeodeHashBM(benchmark::State& state) {
+ const std::u32string u32String(state.range(0), UnicodeChar);
+ const String string = convert<String>(u32String);
+
+ for (auto _ : state) {
+ int hashcode;
+ benchmark::DoNotOptimize(hashcode = geode_hash<String>{}(string));
+ }
+}
+
+constexpr char32_t LATIN_CAPITAL_LETTER_C = U'\U00000043';
+constexpr char32_t INVERTED_EXCLAMATION_MARK = U'\U000000A1';
+constexpr char32_t SAMARITAN_PUNCTUATION_ZIQAA = U'\U00000838';
+constexpr char32_t LINEAR_B_SYLLABLE_B008_A = U'\U00010000';
+
+BENCHMARK_TEMPLATE(GeodeHashBM, std::string, LATIN_CAPITAL_LETTER_C)
+ ->Range(8, 8 << 10);
+BENCHMARK_TEMPLATE(GeodeHashBM, std::u16string, LATIN_CAPITAL_LETTER_C)
+ ->Range(8, 8 << 10);
+BENCHMARK_TEMPLATE(GeodeHashBM, std::string, INVERTED_EXCLAMATION_MARK)
+ ->Range(8, 8 << 10);
+BENCHMARK_TEMPLATE(GeodeHashBM, std::u16string, INVERTED_EXCLAMATION_MARK)
+ ->Range(8, 8 << 10);
+BENCHMARK_TEMPLATE(GeodeHashBM, std::string, SAMARITAN_PUNCTUATION_ZIQAA)
+ ->Range(8, 8 << 10);
+BENCHMARK_TEMPLATE(GeodeHashBM, std::u16string, SAMARITAN_PUNCTUATION_ZIQAA)
+ ->Range(8, 8 << 10);
+BENCHMARK_TEMPLATE(GeodeHashBM, std::string, LINEAR_B_SYLLABLE_B008_A)
+ ->Range(8, 8 << 10);
+BENCHMARK_TEMPLATE(GeodeHashBM, std::u16string, LINEAR_B_SYLLABLE_B008_A)
+ ->Range(8, 8 << 10);
diff --git a/cppcache/integration-test-2/framework/Framework.cpp b/cppcache/benchmark/main.cpp
similarity index 93%
rename from cppcache/integration-test-2/framework/Framework.cpp
rename to cppcache/benchmark/main.cpp
index fe6942a..782f521 100644
--- a/cppcache/integration-test-2/framework/Framework.cpp
+++ b/cppcache/benchmark/main.cpp
@@ -15,4 +15,6 @@
* limitations under the License.
*/
-#include "Framework.h"
+#include <benchmark/benchmark.h>
+
+BENCHMARK_MAIN();
diff --git a/cppcache/include/geode/Exception.hpp b/cppcache/include/geode/Exception.hpp
index 2df6d3f..8bde954 100644
--- a/cppcache/include/geode/Exception.hpp
+++ b/cppcache/include/geode/Exception.hpp
@@ -33,9 +33,11 @@
class StackTrace;
+#if defined(_MSC_VER)
// Ignore C4275 - This class extends std C++ class
#pragma warning(push)
#pragma warning(disable : 4275)
+#endif
/**
* A description of an exception that occurred during a cache operation.
@@ -73,7 +75,9 @@
std::shared_ptr<StackTrace> stack_;
};
+#if defined(_MSC_VER)
#pragma warning(pop)
+#endif
} // namespace client
} // namespace geode
diff --git a/cppcache/src/util/functional.cpp b/cppcache/include/geode/HashMapOfPools.hpp
similarity index 73%
rename from cppcache/src/util/functional.cpp
rename to cppcache/include/geode/HashMapOfPools.hpp
index c526eaf..75cd5ab 100644
--- a/cppcache/src/util/functional.cpp
+++ b/cppcache/include/geode/HashMapOfPools.hpp
@@ -15,25 +15,18 @@
* limitations under the License.
*/
-#include <codecvt>
-#include <locale>
+#pragma once
+
+#include <memory>
#include <string>
-
-#include <geode/internal/functional.hpp>
-
-#include "string.hpp"
+#include <unordered_map>
namespace apache {
namespace geode {
namespace client {
-namespace internal {
+class Pool;
-int32_t geode_hash<std::string>::operator()(const std::string& val) {
- // TODO string optimize without conversion to UTF-16
- return geode_hash<std::u16string>{}(to_utf16(val));
-}
-
-} // namespace internal
+using HashMapOfPools = std::unordered_map<std::string, std::shared_ptr<Pool>>;
} // namespace client
} // namespace geode
} // namespace apache
diff --git a/cppcache/include/geode/PoolManager.hpp b/cppcache/include/geode/PoolManager.hpp
index fe57e04..058a9bb 100644
--- a/cppcache/include/geode/PoolManager.hpp
+++ b/cppcache/include/geode/PoolManager.hpp
@@ -29,6 +29,7 @@
#include "Pool.hpp"
#include "PoolFactory.hpp"
#include "Region.hpp"
+#include "geode/HashMapOfPools.hpp"
#include "internal/geode_base.hpp"
#include "internal/geode_globals.hpp"
@@ -46,8 +47,6 @@
class Region;
class RegionFactory;
-typedef std::unordered_map<std::string, std::shared_ptr<Pool>> HashMapOfPools;
-
/**
* Manages creation and access to {@link Pool connection pools} for clients.
* <p>
diff --git a/cppcache/include/geode/SystemProperties.hpp b/cppcache/include/geode/SystemProperties.hpp
index ef2f35d..2f22c2b 100644
--- a/cppcache/include/geode/SystemProperties.hpp
+++ b/cppcache/include/geode/SystemProperties.hpp
@@ -314,23 +314,6 @@
bool isDhOn() const { return !m_securityClientDhAlgo.empty(); }
/**
- * Checks to see if this native client is being invoked as part of small
- * grid jobs; use this setting to disable some creation of threads and
- * reduce start/stop time. Note that this setting can cause improper
- * behavior in some cases like:
- * 1) client that is setup in listening mode and a server failure may not
- * lead to failover by client
- * 2) while shutting down the client will not send a proper CLOSE_CONNECTION
- * message so server will report EOF exceptions and may detect client
- * disconnect after quite some time
- * Also note that there may be some performance loss in queries and
- * Region::getAll due to unavailability of parallel processing threads.
- *
- * @return true if the "grid-client" property is set
- */
- inline bool isGridClient() const { return m_gridClient; }
-
- /**
* Whether a non durable client starts to receive and process
* subscription events automatically.
* If set to false then a non-durable client should call the
@@ -403,8 +386,6 @@
std::chrono::milliseconds m_connectWaitTimeout;
std::chrono::milliseconds m_bucketWaitTimeout;
- bool m_gridClient;
-
bool m_autoReadyForEvents;
bool m_sslEnabled;
diff --git a/cppcache/include/geode/internal/functional.hpp b/cppcache/include/geode/internal/functional.hpp
index 7cb4377..6fde1d6 100644
--- a/cppcache/include/geode/internal/functional.hpp
+++ b/cppcache/include/geode/internal/functional.hpp
@@ -104,7 +104,48 @@
*/
template <>
struct geode_hash<std::string> {
- int32_t operator()(const std::string& val);
+ inline int32_t operator()(const std::string& val) {
+ int32_t hash = 0;
+
+ for (auto&& it = val.cbegin(); it < val.cend(); it++) {
+ auto cp = static_cast<uint32_t>(0xff & *it);
+ if (cp < 0x80) {
+ // 1 byte
+ } else if ((cp >> 5) == 0x6) {
+ // 2 bytes
+ ++it;
+ cp = ((cp << 6) & 0x7ff) + ((*it) & 0x3f);
+ } else if ((cp >> 4) == 0xe) {
+ // 3 bytes
+ ++it;
+ cp = ((cp << 12) & 0xffff) + (((0xff & *it) << 6) & 0xfff);
+ ++it;
+ cp += (*it) & 0x3f;
+ } else if ((cp >> 3) == 0x1e) {
+ // 4 bytes
+ ++it;
+ cp = ((cp << 18) & 0x1fffff) + (((0xff & *it) << 12) & 0x3ffff);
+ ++it;
+ cp += ((0xff & *it) << 6) & 0xfff;
+ ++it;
+ cp += (*it) & 0x3f;
+ } else {
+ // TODO throw exception
+ }
+
+ if (cp > 0xffff) {
+ // surrogate pair
+ hash = 31 * hash +
+ static_cast<uint16_t>((cp >> 10) + (0xD800 - (0x10000 >> 10)));
+ hash = 31 * hash + static_cast<uint16_t>((cp & 0x3ff) + 0xdc00u);
+ } else {
+ // single code unit
+ hash = 31 * hash + cp;
+ }
+ }
+
+ return hash;
+ }
};
} // namespace internal
diff --git a/cppcache/integration-test/CMakeLists.txt b/cppcache/integration-test/CMakeLists.txt
index fc52ad6..0daaeb9 100644
--- a/cppcache/integration-test/CMakeLists.txt
+++ b/cppcache/integration-test/CMakeLists.txt
@@ -22,20 +22,19 @@
CacheHelper.cpp
CacheableWrapper.cpp
)
-
target_link_libraries(test-cppcache-utils
PRIVATE
- ACE
+ ACE::ACE
_WarningsAsError
PUBLIC
apache-geode
framework
)
-
set_target_properties(test-cppcache-utils PROPERTIES
+ CXX_VISIBILITY_PRESET hidden
+ VISIBILITY_INLINES_HIDDEN ON
FOLDER cpp/test/integration
)
-
target_compile_definitions(test-cppcache-utils
PRIVATE
$<MAKE_C_IDENTIFIER:test-cppcache-utils>_static=1
@@ -50,7 +49,7 @@
add_library(unit_test_callbacks SHARED LibraryCallbacks.cpp)
target_link_libraries(unit_test_callbacks
PRIVATE
- ACE
+ ACE::ACE
_WarningsAsError
PUBLIC
apache-geode
@@ -77,7 +76,7 @@
endmacro()
# Add lazy loaded shared library paths to test environment
-foreach( lib ssl sqlite )
+foreach( lib OpenSSL::SSL SQLite::sqlite3 )
get_target_property(library_path ${lib} INTERFACE_LIBRARY_DIR)
set(LD_LIBRARY_PATH ${LD_LIBRARY_PATH} ${library_path})
get_target_property(runtime_path ${lib} INTERFACE_RUNTIME_DIR)
@@ -100,7 +99,7 @@
target_link_libraries(${TEST}
PRIVATE
- ACE
+ ACE::ACE
test-cppcache-utils
_WarningsAsError
_CppCodeCoverage
@@ -165,7 +164,6 @@
set_property(TEST testLRUList PROPERTY LABELS STABLE QUICK)
set_property(TEST testSystemProperties PROPERTY LABELS STABLE QUICK)
set_property(TEST testLogger PROPERTY LABELS STABLE QUICK)
-set_property(TEST testCache PROPERTY LABELS STABLE QUICK)
set_property(TEST testLinkage PROPERTY LABELS STABLE QUICK)
set_property(TEST testRegionTemplateArgs PROPERTY LABELS STABLE QUICK)
set_property(TEST testRegionMap PROPERTY LABELS STABLE QUICK)
@@ -174,8 +172,8 @@
set_property(TEST testXmlCacheCreationWithOverFlow PROPERTY LABELS STABLE QUICK)
set_property(TEST testThinClientRemoveAllLocal PROPERTY LABELS STABLE QUICK)
set_property(TEST testDunit PROPERTY LABELS STABLE QUICK)
-set_property(TEST testAttributesMutator PROPERTY LABELS STABLE QUICK)
set_property(TEST testSpinLock PROPERTY LABELS STABLE QUICK)
+set_property(TEST testSubRegions PROPERTY LABELS STABLE QUICK)
set_property(TEST testThinClientSSLAuthFail PROPERTY LABELS STABLE QUICK)
set_property(TEST testThinClientSSLAuthCorrupt PROPERTY LABELS STABLE QUICK)
set_property(TEST testThinClientSSLAuthUntrusted PROPERTY LABELS STABLE QUICK)
diff --git a/cppcache/integration-test/CacheHelper.cpp b/cppcache/integration-test/CacheHelper.cpp
index 182af52..6347d4f 100644
--- a/cppcache/integration-test/CacheHelper.cpp
+++ b/cppcache/integration-test/CacheHelper.cpp
@@ -1700,6 +1700,8 @@
break;
}
+ int jmxManagerPort = CacheHelper::staticJmxManagerPort;
+
currDir += locDirname;
ACE_OS::mkdir(locDirname.c_str());
@@ -1720,9 +1722,10 @@
: std::string("--properties-file=") + geodeFile;
sprintf(cmd,
"%s/bin/%s start locator --name=%s --port=%d --dir=%s "
- "%s --http-service-port=0 --classpath=%s",
+ "%s --http-service-port=0 --classpath=%s "
+ "--J=-Dgemfire.jmx-manager-port=%d",
gfjavaenv, GFSH, locDirname.c_str(), portnum, currDir.c_str(),
- propertiesFile.c_str(), classpath);
+ propertiesFile.c_str(), classpath, jmxManagerPort);
LOG(cmd);
ACE_OS::system(cmd);
diff --git a/cppcache/integration-test/CacheHelper.hpp b/cppcache/integration-test/CacheHelper.hpp
index 8bbaac4..71ba2ed 100644
--- a/cppcache/integration-test/CacheHelper.hpp
+++ b/cppcache/integration-test/CacheHelper.hpp
@@ -288,6 +288,9 @@
static int staticLocatorHostPort1;
static int staticLocatorHostPort2;
static int staticLocatorHostPort3;
+
+ static int staticJmxManagerPort;
+
static const char* getstaticLocatorHostPort1();
static const char* getstaticLocatorHostPort2();
@@ -393,6 +396,9 @@
int CacheHelper::staticLocatorHostPort1 = CacheHelper::getRandomAvailablePort();
int CacheHelper::staticLocatorHostPort2 = CacheHelper::getRandomAvailablePort();
int CacheHelper::staticLocatorHostPort3 = CacheHelper::getRandomAvailablePort();
+
+int CacheHelper::staticJmxManagerPort = CacheHelper::getRandomAvailablePort();
+
#endif
} // namespace client
diff --git a/cppcache/integration-test/DeltaEx.hpp b/cppcache/integration-test/DeltaEx.hpp
index 931456c..f1f4de2 100644
--- a/cppcache/integration-test/DeltaEx.hpp
+++ b/cppcache/integration-test/DeltaEx.hpp
@@ -27,10 +27,11 @@
#include <geode/PdxWriter.hpp>
#include <geode/PdxReader.hpp>
#include <geode/Delta.hpp>
+#include <geode/DataSerializable.hpp>
#include "CacheHelper.hpp"
-namespace { // NOLINT(google-build-namespaces)
+namespace { // NOLINT(google-build-namespaces)
using apache::geode::client::DataInput;
using apache::geode::client::DataOutput;
diff --git a/cppcache/integration-test/ThinClientDistOps.hpp b/cppcache/integration-test/ThinClientDistOps.hpp
index 406d576..fa73eb9 100644
--- a/cppcache/integration-test/ThinClientDistOps.hpp
+++ b/cppcache/integration-test/ThinClientDistOps.hpp
@@ -59,22 +59,9 @@
const char* locatorsG =
CacheHelper::getLocatorHostPort(isLocator, isLocalServer, numberOfLocators);
-bool g_isGridClient = false;
-
-DUNIT_TASK_DEFINITION(CLIENT1, Alter_Client_Grid_Property_1)
- { g_isGridClient = !g_isGridClient; }
-END_TASK_DEFINITION
-
-DUNIT_TASK_DEFINITION(CLIENT2, Alter_Client_Grid_Property_2)
- { g_isGridClient = !g_isGridClient; }
-END_TASK_DEFINITION
-
void initClient(const bool isthinClient, const bool redirectLog) {
if (cacheHelper == nullptr) {
auto config = Properties::create();
- if (g_isGridClient) {
- config->insert("grid-client", "true");
- }
config->insert("log-level", "finer");
if (redirectLog) {
@@ -819,9 +806,6 @@
END_TASK_DEFINITION
void runDistOpsNotSticky() {
- CALL_TASK(Alter_Client_Grid_Property_1);
- CALL_TASK(Alter_Client_Grid_Property_2);
-
CALL_TASK(CreateLocator1);
CALL_TASK(CreateServer1_With_Locator)
@@ -846,9 +830,6 @@
}
void runDistOpsSticky() {
- CALL_TASK(Alter_Client_Grid_Property_1);
- CALL_TASK(Alter_Client_Grid_Property_2);
-
CALL_TASK(CreateLocator1);
CALL_TASK(CreateServer1_With_Locator)
diff --git a/cppcache/integration-test/ThinClientHelper.hpp b/cppcache/integration-test/ThinClientHelper.hpp
index 56736aa..74e5a67 100644
--- a/cppcache/integration-test/ThinClientHelper.hpp
+++ b/cppcache/integration-test/ThinClientHelper.hpp
@@ -57,22 +57,6 @@
CacheHelper* cacheHelper = nullptr;
-void initGridClient(const bool isthinClient,
- const std::shared_ptr<Properties>& configPtr = nullptr) {
- static bool s_isGridClient = true;
-
- s_isGridClient = !s_isGridClient;
- if (cacheHelper == nullptr) {
- auto config = configPtr;
- if (config == nullptr) {
- config = Properties::create();
- }
- config->insert("grid-client", s_isGridClient ? "true" : "false");
- cacheHelper = new CacheHelper(isthinClient, config);
- }
- ASSERT(cacheHelper, "Failed to create a CacheHelper client instance.");
-}
-
void initClient(const bool isthinClient,
const std::shared_ptr<Properties>& configPtr = nullptr) {
if (cacheHelper == nullptr) {
@@ -110,22 +94,6 @@
ASSERT(cacheHelper, "Failed to create a CacheHelper client instance.");
}
-void initGridClient(int redundancyLevel,
- const std::shared_ptr<Properties>& configPtr = nullptr) {
- static bool s_isGridClient = true;
-
- s_isGridClient = !s_isGridClient;
- if (cacheHelper == nullptr) {
- auto config = configPtr;
- if (config == nullptr) {
- config = Properties::create();
- }
- config->insert("grid-client", s_isGridClient ? "true" : "false");
- cacheHelper = new CacheHelper(redundancyLevel, config);
- }
- ASSERT(cacheHelper, "Failed to create a CacheHelper client instance.");
-}
-
void cleanProc() {
if (cacheHelper != nullptr) {
delete cacheHelper;
diff --git a/cppcache/integration-test/ThinClientTransactions.hpp b/cppcache/integration-test/ThinClientTransactions.hpp
index c770f44..2c59300 100644
--- a/cppcache/integration-test/ThinClientTransactions.hpp
+++ b/cppcache/integration-test/ThinClientTransactions.hpp
@@ -61,22 +61,9 @@
const char* locatorsG =
CacheHelper::getLocatorHostPort(isLocator, isLocalServer, numberOfLocators);
-bool g_isGridClient = false;
-
-DUNIT_TASK_DEFINITION(CLIENT1, Alter_Client_Grid_Property_1)
- { g_isGridClient = !g_isGridClient; }
-END_TASK_DEFINITION
-
-DUNIT_TASK_DEFINITION(CLIENT2, Alter_Client_Grid_Property_2)
- { g_isGridClient = !g_isGridClient; }
-END_TASK_DEFINITION
-
void initClient(const bool isthinClient) {
if (cacheHelper == nullptr) {
auto config = Properties::create();
- if (g_isGridClient) {
- config->insert("grid-client", "true");
- }
config->insert("suspended-tx-timeout", std::chrono::minutes(1));
cacheHelper = new CacheHelper(isthinClient, config);
}
diff --git a/cppcache/integration-test/ThinClientTransactionsXA.hpp b/cppcache/integration-test/ThinClientTransactionsXA.hpp
index bfdda2a..3d50393 100644
--- a/cppcache/integration-test/ThinClientTransactionsXA.hpp
+++ b/cppcache/integration-test/ThinClientTransactionsXA.hpp
@@ -62,22 +62,9 @@
const char* locatorsG =
CacheHelper::getLocatorHostPort(isLocator, isLocalServer, numberOfLocators);
-bool g_isGridClient = false;
-
-DUNIT_TASK_DEFINITION(CLIENT1, Alter_Client_Grid_Property_1)
- { g_isGridClient = !g_isGridClient; }
-END_TASK_DEFINITION
-
-DUNIT_TASK_DEFINITION(CLIENT2, Alter_Client_Grid_Property_2)
- { g_isGridClient = !g_isGridClient; }
-END_TASK_DEFINITION
-
void initClient(const bool isthinClient) {
if (cacheHelper == nullptr) {
auto config = Properties::create();
- if (g_isGridClient) {
- config->insert("grid-client", "true");
- }
config->insert("suspended-tx-timeout", std::chrono::seconds(1));
cacheHelper = new CacheHelper(isthinClient, config);
}
@@ -1131,9 +1118,6 @@
END_TASK_DEFINITION
void runTransactionOps(bool isSticky = false) {
- CALL_TASK(Alter_Client_Grid_Property_1);
- CALL_TASK(Alter_Client_Grid_Property_2);
-
CALL_TASK(CreateLocator1);
CALL_TASK(CreateServer1_With_Locator)
diff --git a/cppcache/integration-test/fw_spawn.hpp b/cppcache/integration-test/fw_spawn.hpp
index 0411a63..e49da7d 100644
--- a/cppcache/integration-test/fw_spawn.hpp
+++ b/cppcache/integration-test/fw_spawn.hpp
@@ -22,13 +22,13 @@
// Spawn.cpp,v 1.4 2004/01/07 22:40:16 shuston Exp
// @TODO, this out this include list..
-#include "ace/OS_NS_stdio.h"
-#include "ace/OS_NS_fcntl.h"
-#include "ace/OS_NS_pwd.h"
-#include "ace/os_include/os_pwd.h"
-#include "ace/OS_NS_stdlib.h"
-#include "ace/OS_NS_string.h"
-#include "ace/OS_NS_unistd.h"
+#include <ace/OS_NS_stdio.h>
+#include <ace/OS_NS_fcntl.h>
+#include <ace/OS_NS_pwd.h>
+#include <ace/os_include/os_pwd.h>
+#include <ace/OS_NS_stdlib.h>
+#include <ace/OS_NS_string.h>
+#include <ace/OS_NS_unistd.h>
#if defined(_WIN32)
#if (FD_SETSIZE != 1024)
@@ -36,8 +36,8 @@
#endif
#endif
-#include "ace/Process.h"
-#include "ace/Log_Msg.h"
+#include <ace/Process.h>
+#include <ace/Log_Msg.h>
namespace dunit {
diff --git a/cppcache/integration-test/testAttributesMutator.cpp b/cppcache/integration-test/testAttributesMutator.cpp
deleted file mode 100644
index ec6fd26..0000000
--- a/cppcache/integration-test/testAttributesMutator.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <geode/CacheFactory.hpp>
-#include <geode/Region.hpp>
-#include <geode/RegionAttributesFactory.hpp>
-
-#include "CacheImpl.hpp"
-#include "CacheRegionHelper.hpp"
-
-#include "fw_dunit.hpp"
-
-using apache::geode::client::Cache;
-using apache::geode::client::CacheableInt32;
-using apache::geode::client::CacheFactory;
-using apache::geode::client::CacheRegionHelper;
-using apache::geode::client::ExpirationAction;
-using apache::geode::client::Region;
-using apache::geode::client::RegionAttributesFactory;
-
-class TestData {
- public:
- std::shared_ptr<Region> m_region;
- std::shared_ptr<Cache> m_cache;
-
-} Test;
-
-#define A s1p1
-
-/* setup recipient */
-DUNIT_TASK(A, Init)
- {
- auto cacheFactory = CacheFactory();
- Test.m_cache = std::make_shared<Cache>(cacheFactory.create());
-
- RegionAttributesFactory regionAttributesFactory;
- regionAttributesFactory.setEntryTimeToLive(
- ExpirationAction::LOCAL_INVALIDATE, std::chrono::seconds(5));
- auto regionAttributes = regionAttributesFactory.create();
-
- auto &&cacheImpl = CacheRegionHelper::getCacheImpl(Test.m_cache.get());
- cacheImpl->createRegion("Local_ETTL_LI", regionAttributes, Test.m_region);
- }
-ENDTASK
-
-DUNIT_TASK(A, CreateAndVerifyExpiry)
- {
- auto value = CacheableInt32::create(1);
- LOGDEBUG("### About to put of :one:1: ###");
- Test.m_region->put("one", value);
- LOGDEBUG("### Finished put of :one:1: ###");
-
- // countdown begins... it is ttl so access should not play into it..
- SLEEP(3000); // sleep for a second, expect value to still be there.
- auto res =
- std::dynamic_pointer_cast<CacheableInt32>(Test.m_region->get("one"));
- ASSERT(res->value() == 1, "Expected to find value 1.");
- fflush(stdout);
- SLEEP(5000); // sleep for 5 more seconds, expect value to be invalid.
- fflush(stdout);
- res = nullptr;
- ASSERT(Test.m_region->containsValueForKey("one") == false,
- "should not contain value.");
- }
-ENDTASK
-
-/* Test value sizes up to 1meg */
-DUNIT_TASK(A, Close)
- {
- Test.m_region->destroyRegion();
- Test.m_cache->close();
- Test.m_cache = nullptr;
- Test.m_region = nullptr;
- }
-ENDTASK
diff --git a/cppcache/integration-test/testSpinLock.cpp b/cppcache/integration-test/testSpinLock.cpp
index 348add1..ec93060 100644
--- a/cppcache/integration-test/testSpinLock.cpp
+++ b/cppcache/integration-test/testSpinLock.cpp
@@ -20,8 +20,6 @@
#include <mutex>
#include <util/concurrent/spinlock_mutex.hpp>
-#include <Condition.hpp>
-
#include <ace/Task.h>
#include <ace/Time_Value.h>
#include <ace/Guard_T.h>
@@ -117,38 +115,4 @@
}
END_TASK(TwoThreads)
-DUNIT_TASK(s1p1, Cond)
- {
- // Test that the Condtion wrapper times out properly.
- // Does not test signal..
- ACE_Time_Value stopAt = ACE_OS::gettimeofday();
- stopAt -= 10; // Make sure it is in the past.
-
- ACE_Recursive_Thread_Mutex mutex;
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(mutex);
- apache::geode::client::Condition cond(mutex);
- LOG("About to wait on Condition with past time.");
- if (cond.waitUntil(&stopAt) != false) {
- FAIL("Should have timed out immediately.");
- }
-
- stopAt = ACE_OS::gettimeofday();
- LOG("About to wait on Condition with present time.");
- if (cond.waitUntil(&stopAt) != false) {
- FAIL("Should have timed out immediately.");
- }
-
- ACE_Time_Value begin = ACE_OS::gettimeofday();
- stopAt = begin;
- ACE_Time_Value delay(5);
- stopAt += delay;
- if (cond.waitUntil(&stopAt) != false) {
- FAIL("Should have timed out immediately.");
- }
- ACE_Time_Value delta = ACE_OS::gettimeofday();
- delta -= begin;
- printf("delta is %lu, delay is %lu", delta.msec(), delay.msec());
- XASSERT(delta.msec() >= (delay.msec() - 50));
- }
-ENDTASK
} // namespace
diff --git a/cppcache/integration-test/testCache.cpp b/cppcache/integration-test/testSubRegions.cpp
similarity index 100%
rename from cppcache/integration-test/testCache.cpp
rename to cppcache/integration-test/testSubRegions.cpp
diff --git a/cppcache/integration-test/testThinClientRemoteQuerySS.cpp b/cppcache/integration-test/testThinClientRemoteQuerySS.cpp
index d7ae849..789647a 100644
--- a/cppcache/integration-test/testThinClientRemoteQuerySS.cpp
+++ b/cppcache/integration-test/testThinClientRemoteQuerySS.cpp
@@ -226,7 +226,7 @@
}
void stepOne() {
- initGridClient(true);
+ initClient(true);
try {
auto serializationRegistry =
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
@@ -243,6 +243,8 @@
PortfolioPdx::createDeserializable);
} catch (const IllegalStateException &) {
// ignore exception
+ LOG("testThinClientRemoteQuerySS stepOne caught exception using "
+ "serializationRegistry");
}
isPoolConfig = true;
diff --git a/cppcache/integration-test/testThinClientRemoveOps.cpp b/cppcache/integration-test/testThinClientRemoveOps.cpp
index c35fa48..c08f8da 100644
--- a/cppcache/integration-test/testThinClientRemoveOps.cpp
+++ b/cppcache/integration-test/testThinClientRemoveOps.cpp
@@ -54,22 +54,9 @@
const char *locatorsG =
CacheHelper::getLocatorHostPort(isLocator, isLocalServer, numberOfLocators);
-bool g_isGridClient = false;
-
-DUNIT_TASK_DEFINITION(CLIENT1, Alter_Client_Grid_Property_1)
- { g_isGridClient = !g_isGridClient; }
-END_TASK_DEFINITION
-
-DUNIT_TASK_DEFINITION(CLIENT2, Alter_Client_Grid_Property_2)
- { g_isGridClient = !g_isGridClient; }
-END_TASK_DEFINITION
-
void initClient(const bool isthinClient) {
if (cacheHelper == nullptr) {
auto config = Properties::create();
- if (g_isGridClient) {
- config->insert("grid-client", "true");
- }
cacheHelper = new CacheHelper(isthinClient, config);
}
ASSERT(cacheHelper, "Failed to create a CacheHelper client instance.");
diff --git a/cppcache/integration-test/testThinClientSSLWithSecurityAuthz.cpp b/cppcache/integration-test/testThinClientSSLWithSecurityAuthz.cpp
index 81d7cf0..0b68be8 100644
--- a/cppcache/integration-test/testThinClientSSLWithSecurityAuthz.cpp
+++ b/cppcache/integration-test/testThinClientSSLWithSecurityAuthz.cpp
@@ -24,7 +24,7 @@
#include "CacheHelper.hpp"
#include "ThinClientHelper.hpp"
-#include "ace/Process.h"
+#include <ace/Process.h>
#include "ThinClientSecurity.hpp"
diff --git a/cppcache/integration-test/testThinClientSecurityAuthorization.cpp b/cppcache/integration-test/testThinClientSecurityAuthorization.cpp
index 450e840..cc1c8ea 100644
--- a/cppcache/integration-test/testThinClientSecurityAuthorization.cpp
+++ b/cppcache/integration-test/testThinClientSecurityAuthorization.cpp
@@ -23,7 +23,7 @@
#include "CacheHelper.hpp"
#include "ThinClientHelper.hpp"
-#include "ace/Process.h"
+#include <ace/Process.h>
#include "ThinClientSecurity.hpp"
diff --git a/cppcache/integration-test/testThinClientSecurityAuthorizationMU.cpp b/cppcache/integration-test/testThinClientSecurityAuthorizationMU.cpp
index c20ffd1..5d2d05c 100644
--- a/cppcache/integration-test/testThinClientSecurityAuthorizationMU.cpp
+++ b/cppcache/integration-test/testThinClientSecurityAuthorizationMU.cpp
@@ -26,7 +26,7 @@
#include "CacheHelper.hpp"
#include "ThinClientHelper.hpp"
-#include "ace/Process.h"
+#include <ace/Process.h>
#include "ThinClientSecurity.hpp"
diff --git a/cppcache/integration-test/testThinClientSecurityCQAuthorizationMU.cpp b/cppcache/integration-test/testThinClientSecurityCQAuthorizationMU.cpp
index e29691b..e1fef02 100644
--- a/cppcache/integration-test/testThinClientSecurityCQAuthorizationMU.cpp
+++ b/cppcache/integration-test/testThinClientSecurityCQAuthorizationMU.cpp
@@ -40,7 +40,7 @@
#include "CacheHelper.hpp"
#include "ThinClientHelper.hpp"
-#include "ace/Process.h"
+#include <ace/Process.h>
using apache::geode::client::testframework::security::CredentialGenerator;
diff --git a/cppcache/integration-test/testThinClientSecurityDurableCQAuthorizationMU.cpp b/cppcache/integration-test/testThinClientSecurityDurableCQAuthorizationMU.cpp
index 8754d34..9fa35ab 100644
--- a/cppcache/integration-test/testThinClientSecurityDurableCQAuthorizationMU.cpp
+++ b/cppcache/integration-test/testThinClientSecurityDurableCQAuthorizationMU.cpp
@@ -40,7 +40,7 @@
#include "CacheHelper.hpp"
#include "ThinClientHelper.hpp"
-#include "ace/Process.h"
+#include <ace/Process.h>
using apache::geode::client::AuthenticatedView;
using apache::geode::client::CqAttributesFactory;
diff --git a/cppcache/integration-test/testThinClientTransactionsWithSticky.cpp b/cppcache/integration-test/testThinClientTransactionsWithSticky.cpp
index f24a16f..d27131d 100644
--- a/cppcache/integration-test/testThinClientTransactionsWithSticky.cpp
+++ b/cppcache/integration-test/testThinClientTransactionsWithSticky.cpp
@@ -19,9 +19,6 @@
DUNIT_MAIN
{
- CALL_TASK(Alter_Client_Grid_Property_1);
- CALL_TASK(Alter_Client_Grid_Property_2);
-
CALL_TASK(CreateLocator1);
CALL_TASK(CreateServer1_With_Locator)
diff --git a/cppcache/integration-test/testThinClientTransactionsWithoutSticky.cpp b/cppcache/integration-test/testThinClientTransactionsWithoutSticky.cpp
index f87a922..e3d2351 100644
--- a/cppcache/integration-test/testThinClientTransactionsWithoutSticky.cpp
+++ b/cppcache/integration-test/testThinClientTransactionsWithoutSticky.cpp
@@ -19,9 +19,6 @@
DUNIT_MAIN
{
- CALL_TASK(Alter_Client_Grid_Property_1);
- CALL_TASK(Alter_Client_Grid_Property_2);
-
CALL_TASK(CreateLocator1);
CALL_TASK(CreateServer1_With_Locator)
diff --git a/cppcache/integration-test/testThinClientWriterException.cpp b/cppcache/integration-test/testThinClientWriterException.cpp
index 0e8df9c..ea54f5f 100644
--- a/cppcache/integration-test/testThinClientWriterException.cpp
+++ b/cppcache/integration-test/testThinClientWriterException.cpp
@@ -16,7 +16,7 @@
*/
#include "fw_dunit.hpp"
#include "ThinClientHelper.hpp"
-#include "ace/Process.h"
+#include <ace/Process.h>
#include "TallyListener.hpp"
#include "TallyWriter.hpp"
diff --git a/cppcache/integration-test/testXmlCacheCreationWithOverFlow.cpp b/cppcache/integration-test/testXmlCacheCreationWithOverFlow.cpp
index d882422..ea9a1b9 100644
--- a/cppcache/integration-test/testXmlCacheCreationWithOverFlow.cpp
+++ b/cppcache/integration-test/testXmlCacheCreationWithOverFlow.cpp
@@ -95,13 +95,13 @@
std::cout << "vc[" << i << "].m_reaPtr=" << vrp.at(i).get() << std::endl;
std::cout << "vc[" << i << "]=" << vrp.at(i)->getName() << std::endl;
}
- auto regPtr1 = vrp.at(0);
+ auto regPtr1 = cptr->getRegion("Root1");
std::cout
<< "Test if the number of sub regions with the root region Root1 are "
"correct"
<< std::endl;
- std::vector<std::shared_ptr<Region>> vr = regPtr1->subregions(true);
+ auto vr = regPtr1->subregions(true);
std::cout << " vr.size=" << vr.size() << std::endl;
if (vr.size() != totalSubRegionsRoot1) {
std::cout << "Number of Subregions does not match" << std::endl;
@@ -116,7 +116,7 @@
}
std::cout << "Test if the nesting of regions is correct" << std::endl;
- auto regPtr2 = vrp.at(1);
+ auto regPtr2 = cptr->getRegion("Root2");
auto &&vsr = regPtr2->subregions(true);
for (auto &®Ptr : vsr) {
auto &&childName = regPtr->getName();
diff --git a/cppcache/integration-test/testXmlCacheCreationWithPools.cpp b/cppcache/integration-test/testXmlCacheCreationWithPools.cpp
index a207e69..81329a5 100644
--- a/cppcache/integration-test/testXmlCacheCreationWithPools.cpp
+++ b/cppcache/integration-test/testXmlCacheCreationWithPools.cpp
@@ -311,7 +311,7 @@
std::cout << "vc[" << i << "].m_regionPtr=" << vrp.at(i).get() << std::endl;
std::cout << "vc[" << i << "]=" << vrp.at(i)->getName() << std::endl;
}
- auto regPtr1 = vrp.at(0);
+ auto regPtr1 = cptr->getRegion("Root1");
auto &&vr = regPtr1->subregions(true);
std::cout << "Test if the number of sub regions with the root region Root1 "
@@ -335,7 +335,7 @@
// pools. Check if this assumption is valid and if so then break up this test.
auto subRegPtr = vr.at(0);
- auto regPtr2 = vrp.at(1);
+ auto regPtr2 = cptr->getRegion("Root2");
std::cout << "Test if the number of sub regions with the root region Root2 "
"are correct"
diff --git a/contrib/pdxautoserializer/CMakeLists.txt b/cppcache/integration/CMakeLists.txt
similarity index 86%
copy from contrib/pdxautoserializer/CMakeLists.txt
copy to cppcache/integration/CMakeLists.txt
index b817deb..c7e76eb 100644
--- a/contrib/pdxautoserializer/CMakeLists.txt
+++ b/cppcache/integration/CMakeLists.txt
@@ -4,16 +4,18 @@
# 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.
-cmake_minimum_required(VERSION 3.4)
-project(geode-native-tools)
-add_subdirectory(dependencies)
-add_subdirectory(src)
+add_subdirectory(framework)
+add_subdirectory(test)
+
+if (BUILD_BENCHMARKS)
+ add_subdirectory(benchmark)
+endif()
diff --git a/contrib/pdxautoserializer/CMakeLists.txt b/cppcache/integration/benchmark/CMakeLists.txt
similarity index 73%
copy from contrib/pdxautoserializer/CMakeLists.txt
copy to cppcache/integration/benchmark/CMakeLists.txt
index b817deb..c15ffeb 100644
--- a/contrib/pdxautoserializer/CMakeLists.txt
+++ b/cppcache/integration/benchmark/CMakeLists.txt
@@ -4,16 +4,27 @@
# 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.
-cmake_minimum_required(VERSION 3.4)
-project(geode-native-tools)
-add_subdirectory(dependencies)
-add_subdirectory(src)
+add_executable(cpp-integration-benchmark
+ main.cpp
+ RegionBM.cpp
+ )
+
+target_link_libraries(cpp-integration-benchmark
+ PUBLIC
+ apache-geode
+ benchmark::benchmark
+ integration-framework
+ PRIVATE
+ _WarningsAsError
+ )
+
+add_clangformat(cpp-integration-benchmark)
diff --git a/cppcache/integration/benchmark/RegionBM.cpp b/cppcache/integration/benchmark/RegionBM.cpp
new file mode 100644
index 0000000..8ca972f
--- /dev/null
+++ b/cppcache/integration/benchmark/RegionBM.cpp
@@ -0,0 +1,130 @@
+/*
+ * 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 <benchmark/benchmark.h>
+#include <framework/Cluster.h>
+#include <framework/Gfsh.h>
+
+#include <boost/log/core.hpp>
+#include <boost/log/expressions.hpp>
+#include <boost/log/trivial.hpp>
+
+#include <geode/Cache.hpp>
+#include <geode/CacheableString.hpp>
+#include <geode/PoolManager.hpp>
+#include <geode/RegionFactory.hpp>
+#include <geode/RegionShortcut.hpp>
+
+using apache::geode::client::Cache;
+using apache::geode::client::CacheableInt32;
+using apache::geode::client::CacheableString;
+using apache::geode::client::Region;
+using apache::geode::client::RegionShortcut;
+
+namespace {
+
+class RegionBM : public benchmark::Fixture {
+ public:
+ RegionBM() {
+ boost::log::core::get()->set_filter(boost::log::trivial::severity >=
+ boost::log::trivial::warning);
+ }
+
+ using benchmark::Fixture::SetUp;
+ void SetUp(benchmark::State&) override {
+ if (!cluster) {
+ cluster = std::unique_ptr<Cluster>(
+ new Cluster(Name{name_}, LocatorCount{1}, ServerCount{1}));
+ cluster->getGfsh()
+ .create()
+ .region()
+ .withName("region")
+ .withType("REPLICATE")
+ .execute();
+
+ cache = std::unique_ptr<Cache>(new Cache(cluster->createCache()));
+ region = cache->createRegionFactory(RegionShortcut::PROXY)
+ .setPoolName("default")
+ .create("region");
+ }
+ }
+
+ using benchmark::Fixture::TearDown;
+ void TearDown(benchmark::State&) override {
+ if (cluster) {
+ region = nullptr;
+ cache = nullptr;
+ cluster = nullptr;
+ }
+ }
+
+ protected:
+ void SetName(const char* name) {
+ name_ = name;
+
+ Benchmark::SetName(name);
+ }
+
+ std::unique_ptr<Cluster> cluster;
+ std::unique_ptr<Cache> cache;
+ std::shared_ptr<Region> region;
+
+ private:
+ std::string name_;
+};
+
+BENCHMARK_F(RegionBM, put_string)(benchmark::State& state) {
+ auto key = CacheableString::create("key");
+ auto value = CacheableString::create("value");
+
+ for (auto _ : state) {
+ region->put(key, value);
+ }
+}
+
+BENCHMARK_F(RegionBM, put_int)(benchmark::State& state) {
+ auto key = CacheableInt32::create(1);
+ auto value = CacheableInt32::create(1);
+
+ for (auto _ : state) {
+ region->put(key, value);
+ }
+}
+
+BENCHMARK_F(RegionBM, get_string)(benchmark::State& state) {
+ auto key = CacheableString::create("key");
+ auto value = CacheableString::create("value");
+
+ region->put(key, value);
+
+ for (auto _ : state) {
+ region->get(key);
+ }
+}
+
+BENCHMARK_F(RegionBM, get_int)(benchmark::State& state) {
+ auto key = CacheableInt32::create(1);
+ auto value = CacheableInt32::create(1);
+
+ region->put(key, value);
+
+ for (auto _ : state) {
+ region->get(key);
+ }
+}
+
+} // namespace
diff --git a/cppcache/integration-test-2/framework/Framework.cpp b/cppcache/integration/benchmark/main.cpp
similarity index 93%
copy from cppcache/integration-test-2/framework/Framework.cpp
copy to cppcache/integration/benchmark/main.cpp
index fe6942a..782f521 100644
--- a/cppcache/integration-test-2/framework/Framework.cpp
+++ b/cppcache/integration/benchmark/main.cpp
@@ -15,4 +15,6 @@
* limitations under the License.
*/
-#include "Framework.h"
+#include <benchmark/benchmark.h>
+
+BENCHMARK_MAIN();
diff --git a/cppcache/integration-test-2/framework/.clang-tidy b/cppcache/integration/framework/.clang-tidy
similarity index 100%
rename from cppcache/integration-test-2/framework/.clang-tidy
rename to cppcache/integration/framework/.clang-tidy
diff --git a/cppcache/integration/framework/CMakeLists.txt b/cppcache/integration/framework/CMakeLists.txt
new file mode 100644
index 0000000..8aa234c
--- /dev/null
+++ b/cppcache/integration/framework/CMakeLists.txt
@@ -0,0 +1,61 @@
+# 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.
+
+configure_file(config.h.in config.h)
+
+add_library(integration-framework STATIC
+ Gfsh.cpp
+ Gfsh.h
+ Framework.cpp
+ Framework.h
+ Cluster.cpp
+ Cluster.h
+ GfshExecute.cpp
+ GfshExecute.h
+ )
+
+target_compile_definitions(integration-framework
+ PUBLIC
+ BOOST_ASIO_HAS_MOVE
+)
+
+target_include_directories(integration-framework
+ PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/..
+ PRIVATE
+ ${CMAKE_CURRENT_BINARY_DIR}
+
+)
+
+target_link_libraries(integration-framework
+ PUBLIC
+ apache-geode
+ GTest::gtest
+ Boost::boost
+ Boost::system
+ Boost::log
+ Boost::filesystem
+ PRIVATE
+ _WarningsAsError
+ internal
+)
+
+if(WIN32)
+ target_compile_definitions(integration-framework
+ PUBLIC
+ # Required for Boost.WinAPI
+ _WIN32_WINNT=0x06020000
+ )
+endif()
diff --git a/cppcache/integration-test-2/framework/Cluster.cpp b/cppcache/integration/framework/Cluster.cpp
similarity index 100%
rename from cppcache/integration-test-2/framework/Cluster.cpp
rename to cppcache/integration/framework/Cluster.cpp
diff --git a/cppcache/integration-test-2/framework/Cluster.h b/cppcache/integration/framework/Cluster.h
similarity index 99%
rename from cppcache/integration-test-2/framework/Cluster.h
rename to cppcache/integration/framework/Cluster.h
index a8aefad..06a8a84 100644
--- a/cppcache/integration-test-2/framework/Cluster.h
+++ b/cppcache/integration/framework/Cluster.h
@@ -23,7 +23,7 @@
#include <cstdint>
#include <string>
-#include <gtest/gtest.h>
+#include "gtest/gtest.h"
#include <geode/Cache.hpp>
#include <geode/PoolManager.hpp>
diff --git a/cppcache/integration-test-2/framework/Framework.cpp b/cppcache/integration/framework/Framework.cpp
similarity index 70%
copy from cppcache/integration-test-2/framework/Framework.cpp
copy to cppcache/integration/framework/Framework.cpp
index fe6942a..4454ffc 100644
--- a/cppcache/integration-test-2/framework/Framework.cpp
+++ b/cppcache/integration/framework/Framework.cpp
@@ -16,3 +16,19 @@
*/
#include "Framework.h"
+
+#include <boost/asio.hpp>
+
+uint16_t Framework::getAvailablePort() {
+ using boost::asio::io_service;
+ using boost::asio::ip::tcp;
+
+ io_service service;
+ tcp::socket socket{service};
+ socket.open(tcp::v4());
+ socket.bind(tcp::endpoint{tcp::v4(), 0});
+ auto port = socket.local_endpoint().port();
+ socket.close();
+
+ return port;
+}
diff --git a/cppcache/integration-test-2/framework/Framework.h b/cppcache/integration/framework/Framework.h
similarity index 78%
rename from cppcache/integration-test-2/framework/Framework.h
rename to cppcache/integration/framework/Framework.h
index ea98760..aaaca36 100644
--- a/cppcache/integration-test-2/framework/Framework.h
+++ b/cppcache/integration/framework/Framework.h
@@ -21,19 +21,10 @@
#define INTEGRATION_TEST_FRAMEWORK_FRAMEWORK_H
#include <chrono>
-#include <cstdint>
-#include <random>
class Framework {
public:
- static uint16_t getAvailablePort() {
- // TODO boost open ephemeral port.
- std::random_device randomDevice;
- std::default_random_engine randomEngine(randomDevice());
- std::uniform_int_distribution<uint16_t> uniformDist;
- auto port = uniformDist(randomEngine);
- return port;
- }
+ static uint16_t getAvailablePort();
};
template <class _Rep, class _Period>
diff --git a/cppcache/integration-test-2/framework/Gfsh.cpp b/cppcache/integration/framework/Gfsh.cpp
similarity index 100%
rename from cppcache/integration-test-2/framework/Gfsh.cpp
rename to cppcache/integration/framework/Gfsh.cpp
diff --git a/cppcache/integration-test-2/framework/Gfsh.h b/cppcache/integration/framework/Gfsh.h
similarity index 100%
rename from cppcache/integration-test-2/framework/Gfsh.h
rename to cppcache/integration/framework/Gfsh.h
diff --git a/cppcache/integration-test-2/framework/GfshExecute.cpp b/cppcache/integration/framework/GfshExecute.cpp
similarity index 97%
rename from cppcache/integration-test-2/framework/GfshExecute.cpp
rename to cppcache/integration/framework/GfshExecute.cpp
index b9d8f69..5ae9023 100644
--- a/cppcache/integration-test-2/framework/GfshExecute.cpp
+++ b/cppcache/integration/framework/GfshExecute.cpp
@@ -55,11 +55,11 @@
std::string line;
while (outStream && std::getline(outStream, line)) {
- BOOST_LOG_TRIVIAL(debug) << "Gfsh::execute: " << line;
+ BOOST_LOG_TRIVIAL(trace) << "Gfsh::execute: " << line;
}
while (errStream && std::getline(errStream, line)) {
- BOOST_LOG_TRIVIAL(error) << "Gfsh::execute: " << line;
+ BOOST_LOG_TRIVIAL(debug) << "Gfsh::execute: " << line;
}
gfsh.wait();
diff --git a/cppcache/integration-test-2/framework/GfshExecute.h b/cppcache/integration/framework/GfshExecute.h
similarity index 100%
rename from cppcache/integration-test-2/framework/GfshExecute.h
rename to cppcache/integration/framework/GfshExecute.h
diff --git a/cppcache/integration-test-2/framework/config.h.in b/cppcache/integration/framework/config.h.in
similarity index 100%
rename from cppcache/integration-test-2/framework/config.h.in
rename to cppcache/integration/framework/config.h.in
diff --git a/cppcache/integration-test-2/CMakeLists.txt b/cppcache/integration/test/CMakeLists.txt
similarity index 66%
rename from cppcache/integration-test-2/CMakeLists.txt
rename to cppcache/integration/test/CMakeLists.txt
index 322550c..f38a5b0 100644
--- a/cppcache/integration-test-2/CMakeLists.txt
+++ b/cppcache/integration/test/CMakeLists.txt
@@ -13,76 +13,70 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-configure_file(framework/config.h.in config.h)
-
-add_executable(integration-test-2
+add_executable(cpp-integration-test
+ ChunkedHeaderTest.cpp
+ DataSerializableTest.cpp
+ EnableChunkHandlerThreadTest.cpp
ExampleTest.cpp
- framework/Gfsh.cpp
- framework/Gfsh.h
- framework/Framework.cpp
- framework/Framework.h
- framework/Cluster.cpp
- framework/Cluster.h
- framework/GfshExecute.cpp
- framework/GfshExecute.h
- RegionPutGetAllTest.cpp
+ ExpirationTest.cpp
+ FunctionExecutionTest.cpp
PdxInstanceTest.cpp
+ RegionPutGetAllTest.cpp
RegisterKeysTest.cpp
StructTest.cpp
- EnableChunkHandlerThreadTest.cpp
- DataSerializableTest.cpp
)
-target_compile_definitions(integration-test-2
+target_compile_definitions(cpp-integration-test
PUBLIC
BOOST_ASIO_HAS_MOVE
GTEST_ELLIPSIS_NEEDS_POD_
)
-target_include_directories(integration-test-2
+target_include_directories(cpp-integration-test
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}
)
-target_link_libraries(integration-test-2
+target_link_libraries(cpp-integration-test
PUBLIC
apache-geode
+ integration-framework
testobject
- ACE
- GTest::GTest
- GTest::Main
+ ACE::ACE
+ GTest::gtest
+ GTest::gtest_main
Boost::boost
Boost::system
Boost::log
Boost::filesystem
- PRIVATE
+ PRIVATE
_WarningsAsError
- internal
+ internal
)
if(WIN32)
- target_compile_definitions(integration-test-2
+ target_compile_definitions(cpp-integration-test
PUBLIC
# Required for Boost.WinAPI
_WIN32_WINNT=0x06020000
)
foreach (_target apache-geode testobject)
- add_custom_command(TARGET integration-test-2 POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different
+ add_custom_command(TARGET cpp-integration-test POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different
"$<TARGET_FILE:${_target}>"
"$<$<CONFIG:Debug>:$<TARGET_PDB_FILE:${_target}>>"
- "$<TARGET_FILE_DIR:integration-test-2>")
+ "$<TARGET_FILE_DIR:cpp-integration-test>")
endforeach()
endif()
-set_target_properties(integration-test-2 PROPERTIES
+set_target_properties(cpp-integration-test PROPERTIES
CXX_VISIBILITY_PRESET hidden
VISIBILITY_INLINES_HIDDEN ON
FOLDER cpp/test/integration
)
-add_clangformat(integration-test-2)
+add_clangformat(cpp-integration-test)
enable_testing()
include(GoogleTest)
-gtest_discover_tests(integration-test-2)
\ No newline at end of file
+gtest_discover_tests(cpp-integration-test)
diff --git a/cppcache/integration/test/ChunkedHeaderTest.cpp b/cppcache/integration/test/ChunkedHeaderTest.cpp
new file mode 100644
index 0000000..767c8fc
--- /dev/null
+++ b/cppcache/integration/test/ChunkedHeaderTest.cpp
@@ -0,0 +1,73 @@
+/*
+ * 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 <DataInputInternal.hpp>
+#include <TcrMessage.hpp>
+
+#include <gtest/gtest.h>
+
+using apache::geode::client::DataInput;
+using apache::geode::client::DataInputInternal;
+using apache::geode::client::DSCode;
+using apache::geode::client::MessageException;
+using apache::geode::client::Region;
+using apache::geode::client::Serializable;
+using apache::geode::client::TcrMessage;
+using apache::geode::client::TcrMessageHelper;
+using apache::geode::client::ThinClientBaseDM;
+
+namespace {
+class TcrMessageTestFixture : public TcrMessage {
+ public:
+ TcrMessageTestFixture() : TcrMessage() {}
+ virtual ~TcrMessageTestFixture() {}
+};
+} // namespace
+
+TEST(TcrMessageHelperTest, readChunkPartHeaderExpectsAnObject) {
+ TcrMessageTestFixture msg;
+
+ uint8_t fakeBuffer[5] = {0, 0, 0, 1};
+
+ auto input = DataInputInternal(fakeBuffer, sizeof(fakeBuffer));
+
+ uint32_t partLength;
+
+ EXPECT_THROW(TcrMessageHelper::readChunkPartHeader(
+ msg, input,
+ "TcrMessageHelperTest, readChunkPartHeaderExpectsAnObject",
+ partLength, 0),
+ MessageException);
+}
+
+TEST(TcrMessageHelperTest, readChunkPartHeaderExceptionChunkHack) {
+ TcrMessageTestFixture msg;
+
+ uint8_t fakeBuffer[] = {
+ 0, 0, 0, 1, 1, static_cast<uint8_t>(DSCode::JavaSerializable),
+ 0, 0, 0, 0, 0};
+
+ auto input = DataInputInternal(fakeBuffer, sizeof(fakeBuffer));
+
+ uint32_t partLength;
+
+ EXPECT_EQ(TcrMessageHelper::readChunkPartHeader(
+ msg, input,
+ "TcrMessageHelperTest, readChunkPartHeaderExceptionChunkHack",
+ partLength, 64),
+ TcrMessageHelper::ChunkObjectType::EXCEPTION);
+}
diff --git a/cppcache/integration-test-2/DataSerializableTest.cpp b/cppcache/integration/test/DataSerializableTest.cpp
similarity index 100%
rename from cppcache/integration-test-2/DataSerializableTest.cpp
rename to cppcache/integration/test/DataSerializableTest.cpp
diff --git a/cppcache/integration-test-2/EnableChunkHandlerThreadTest.cpp b/cppcache/integration/test/EnableChunkHandlerThreadTest.cpp
similarity index 100%
rename from cppcache/integration-test-2/EnableChunkHandlerThreadTest.cpp
rename to cppcache/integration/test/EnableChunkHandlerThreadTest.cpp
diff --git a/cppcache/integration-test-2/ExampleTest.cpp b/cppcache/integration/test/ExampleTest.cpp
similarity index 97%
rename from cppcache/integration-test-2/ExampleTest.cpp
rename to cppcache/integration/test/ExampleTest.cpp
index 6458ac1..bd96453 100644
--- a/cppcache/integration-test-2/ExampleTest.cpp
+++ b/cppcache/integration/test/ExampleTest.cpp
@@ -15,6 +15,10 @@
* limitations under the License.
*/
+#include <framework/Cluster.h>
+#include <framework/Framework.h>
+#include <framework/Gfsh.h>
+
#include <future>
#include <iostream>
#include <random>
@@ -27,10 +31,6 @@
#include <geode/RegionFactory.hpp>
#include <geode/RegionShortcut.hpp>
-#include "framework/Cluster.h"
-#include "framework/Framework.h"
-#include "framework/Gfsh.h"
-
namespace {
using apache::geode::client::Cache;
diff --git a/cppcache/integration/test/ExpirationTest.cpp b/cppcache/integration/test/ExpirationTest.cpp
new file mode 100644
index 0000000..fddf72d
--- /dev/null
+++ b/cppcache/integration/test/ExpirationTest.cpp
@@ -0,0 +1,84 @@
+/*
+ * 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 <future>
+#include <iostream>
+#include <random>
+#include <thread>
+
+#include <gtest/gtest.h>
+
+#include <geode/Cache.hpp>
+#include <geode/CacheableBuiltins.hpp>
+#include <geode/PoolManager.hpp>
+#include <geode/RegionFactory.hpp>
+#include <geode/RegionShortcut.hpp>
+
+#include "framework/Cluster.h"
+#include "framework/Framework.h"
+#include "framework/Gfsh.h"
+
+namespace {
+
+using apache::geode::client::Cache;
+using apache::geode::client::CacheableInt32;
+using apache::geode::client::CacheableString;
+using apache::geode::client::ExpirationAction;
+using apache::geode::client::Pool;
+using apache::geode::client::Region;
+using apache::geode::client::RegionShortcut;
+
+using std::chrono::minutes;
+
+const int TEST_TTL_ENTRY_TIMEOUT = 5;
+
+Cache createCache() {
+ using apache::geode::client::CacheFactory;
+
+ auto cache = CacheFactory()
+ .set("log-level", "none")
+ .set("statistic-sampling-enabled", "false")
+ .create();
+
+ return cache;
+}
+
+std::shared_ptr<Region> setupRegion(Cache& cache) {
+ auto region = cache.createRegionFactory(RegionShortcut::LOCAL)
+ .setEntryTimeToLive(ExpirationAction::LOCAL_INVALIDATE,
+ std::chrono::seconds(5))
+ .create("region");
+
+ return region;
+}
+
+TEST(ExpirationTest, verifyExpiration) {
+ auto cache = createCache();
+ auto region = setupRegion(cache);
+
+ region->put(1, "one");
+ std::this_thread::sleep_for(std::chrono::seconds(3));
+ ASSERT_TRUE(region->containsValueForKey(1));
+ auto result = std::dynamic_pointer_cast<CacheableString>(region->get(1));
+ ASSERT_NE(result, nullptr);
+ ASSERT_EQ(result->value(), "one");
+
+ std::this_thread::sleep_for(std::chrono::seconds(5));
+ ASSERT_FALSE(region->containsValueForKey(1));
+}
+
+} // namespace
diff --git a/cppcache/integration/test/FunctionExecutionTest.cpp b/cppcache/integration/test/FunctionExecutionTest.cpp
new file mode 100644
index 0000000..06b9e02
--- /dev/null
+++ b/cppcache/integration/test/FunctionExecutionTest.cpp
@@ -0,0 +1,127 @@
+/*
+ * 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 <gtest/gtest.h>
+
+#include <geode/Cache.hpp>
+#include <geode/ExceptionTypes.hpp>
+#include <geode/FunctionService.hpp>
+#include <geode/PoolManager.hpp>
+#include <geode/RegionFactory.hpp>
+#include <geode/RegionShortcut.hpp>
+
+#include "framework/Cluster.h"
+#include "framework/Gfsh.h"
+
+using apache::geode::client::Cache;
+using apache::geode::client::Cacheable;
+using apache::geode::client::CacheableVector;
+using apache::geode::client::FunctionExecutionException;
+using apache::geode::client::FunctionService;
+using apache::geode::client::Region;
+using apache::geode::client::RegionShortcut;
+using apache::geode::client::ResultCollector;
+
+std::shared_ptr<Region> setupRegion(Cache &cache) {
+ auto region = cache.createRegionFactory(RegionShortcut::PROXY)
+ .setPoolName("default")
+ .create("region");
+
+ return region;
+}
+
+TEST(FunctionExecutionTest, UnknownFunctionOnServer) {
+ Cluster cluster{LocatorCount{1}, ServerCount{1}};
+ cluster.getGfsh()
+ .create()
+ .region()
+ .withName("region")
+ .withType("REPLICATE")
+ .execute();
+
+ auto cache = cluster.createCache();
+ auto region = setupRegion(cache);
+
+ ASSERT_THROW(FunctionService::onServer(region->getRegionService())
+ .execute("I_Don_t_Exist"),
+ FunctionExecutionException);
+}
+
+TEST(FunctionExecutionTest, UnknownFunctionOnRegion) {
+ Cluster cluster{LocatorCount{1}, ServerCount{1}};
+ cluster.getGfsh()
+ .create()
+ .region()
+ .withName("region")
+ .withType("REPLICATE")
+ .execute();
+
+ auto cache = cluster.createCache();
+ auto region = setupRegion(cache);
+
+ ASSERT_THROW(FunctionService::onRegion(region).execute("I_Don_t_Exist"),
+ FunctionExecutionException);
+}
+
+class TestResultCollector : public ResultCollector {
+ virtual std::shared_ptr<CacheableVector> getResult(
+ std::chrono::milliseconds) override {
+ return std::shared_ptr<CacheableVector>();
+ }
+
+ virtual void addResult(const std::shared_ptr<Cacheable> &) override {}
+
+ virtual void endResults() override {}
+
+ virtual void clearResults() override {}
+};
+
+TEST(FunctionExecutionTest, UnknownFunctionAsyncOnServer) {
+ Cluster cluster{LocatorCount{1}, ServerCount{1}};
+ cluster.getGfsh()
+ .create()
+ .region()
+ .withName("region")
+ .withType("REPLICATE")
+ .execute();
+
+ auto cache = cluster.createCache();
+ auto region = setupRegion(cache);
+
+ ASSERT_THROW(FunctionService::onServer(region->getRegionService())
+ .withCollector(std::make_shared<TestResultCollector>())
+ .execute("I_Don_t_Exist"),
+ FunctionExecutionException);
+}
+
+TEST(FunctionExecutionTest, UnknownFunctionAsyncOnRegion) {
+ Cluster cluster{LocatorCount{1}, ServerCount{1}};
+ cluster.getGfsh()
+ .create()
+ .region()
+ .withName("region")
+ .withType("REPLICATE")
+ .execute();
+
+ auto cache = cluster.createCache();
+ auto region = setupRegion(cache);
+
+ ASSERT_THROW(FunctionService::onRegion(region)
+ .withCollector(std::make_shared<TestResultCollector>())
+ .execute("I_Don_t_Exist"),
+ FunctionExecutionException);
+}
diff --git a/cppcache/integration-test-2/PdxInstanceTest.cpp b/cppcache/integration/test/PdxInstanceTest.cpp
similarity index 99%
rename from cppcache/integration-test-2/PdxInstanceTest.cpp
rename to cppcache/integration/test/PdxInstanceTest.cpp
index dadbe32..b68a1a5 100644
--- a/cppcache/integration-test-2/PdxInstanceTest.cpp
+++ b/cppcache/integration/test/PdxInstanceTest.cpp
@@ -15,6 +15,9 @@
* limitations under the License.
*/
+#include <framework/Cluster.h>
+#include <framework/Gfsh.h>
+
#include <future>
#include <initializer_list>
#include <iostream>
@@ -33,8 +36,6 @@
#include "LocalRegion.hpp"
#include "NestedPdxObject.hpp"
#include "PdxType.hpp"
-#include "framework/Cluster.h"
-#include "framework/Gfsh.h"
namespace {
diff --git a/cppcache/integration/test/RegionGetAllTest.cpp b/cppcache/integration/test/RegionGetAllTest.cpp
new file mode 100644
index 0000000..b032f96
--- /dev/null
+++ b/cppcache/integration/test/RegionGetAllTest.cpp
@@ -0,0 +1,94 @@
+/*
+ * 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 <future>
+#include <iostream>
+#include <random>
+#include <thread>
+
+#include <gtest/gtest.h>
+
+#include <geode/Cache.hpp>
+#include <geode/PoolManager.hpp>
+#include <geode/RegionFactory.hpp>
+#include <geode/RegionShortcut.hpp>
+
+#include "framework/Cluster.h"
+#include "framework/Framework.h"
+#include "framework/Gfsh.h"
+
+namespace {
+
+using apache::geode::client::Cache;
+using apache::geode::client::CacheableString;
+using apache::geode::client::Pool;
+using apache::geode::client::Region;
+using apache::geode::client::RegionShortcut;
+
+using std::chrono::minutes;
+
+Cache createCache() {
+ using apache::geode::client::CacheFactory;
+
+ auto cache = CacheFactory()
+ .set("log-level", "none")
+ .set("statistic-sampling-enabled", "false")
+ .create();
+
+ return cache;
+}
+
+std::shared_ptr<Pool> createPool(Cluster& cluster, Cache& cache) {
+ auto poolFactory = cache.getPoolManager().createFactory();
+ cluster.applyLocators(poolFactory);
+ poolFactory.setPRSingleHopEnabled(true);
+ return poolFactory.create("default");
+}
+
+std::shared_ptr<Region> setupRegion(Cache& cache,
+ const std::shared_ptr<Pool>& pool) {
+ auto region = cache.createRegionFactory(RegionShortcut::PROXY)
+ .setPoolName(pool->getName())
+ .create("region");
+
+ return region;
+}
+
+TEST(RegionGetAllTest, getAllFromPartitionedRegion) {
+ Cluster cluster{LocatorCount{1}, ServerCount{2}};
+ cluster.getGfsh()
+ .create()
+ .region()
+ .withName("region")
+ .withType("PARTITION")
+ .execute();
+
+ auto cache = createCache();
+ auto pool = createPool(cluster, cache);
+ auto region = setupRegion(cache, pool);
+
+ region->put(1, "one");
+ region->put(2, "two");
+
+ auto keys = region->serverKeys();
+
+ for (int i = 0; i < 100; i++) {
+ auto all = region->getAll(keys);
+ }
+}
+
+} // namespace
diff --git a/cppcache/integration/test/RegionPutAllTest.cpp b/cppcache/integration/test/RegionPutAllTest.cpp
new file mode 100644
index 0000000..03bd31f
--- /dev/null
+++ b/cppcache/integration/test/RegionPutAllTest.cpp
@@ -0,0 +1,102 @@
+/*
+ * 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 <chrono>
+#include <future>
+#include <iostream>
+#include <random>
+#include <thread>
+
+#include <gtest/gtest.h>
+
+#include <geode/Cache.hpp>
+#include <geode/PoolManager.hpp>
+#include <geode/RegionFactory.hpp>
+#include <geode/RegionShortcut.hpp>
+
+#include "CacheRegionHelper.hpp"
+#include "framework/Cluster.h"
+#include "framework/Framework.h"
+#include "framework/Gfsh.h"
+
+namespace {
+
+using apache::geode::client::Cache;
+using apache::geode::client::Cacheable;
+using apache::geode::client::CacheableKey;
+using apache::geode::client::CacheableString;
+using apache::geode::client::HashMapOfCacheable;
+using apache::geode::client::Pool;
+using apache::geode::client::Region;
+using apache::geode::client::RegionShortcut;
+
+using std::chrono::minutes;
+
+Cache createCache() {
+ using apache::geode::client::CacheFactory;
+
+ auto cache = CacheFactory()
+ .set("log-level", "debug")
+ .set("statistic-sampling-enabled", "false")
+ .create();
+
+ return cache;
+}
+
+std::shared_ptr<Pool> createPool(Cluster& cluster, Cache& cache) {
+ auto poolFactory = cache.getPoolManager().createFactory();
+ cluster.applyLocators(poolFactory);
+ poolFactory.setPRSingleHopEnabled(true);
+ return poolFactory.create("default");
+}
+
+std::shared_ptr<Region> setupRegion(Cache& cache,
+ const std::shared_ptr<Pool>& pool) {
+ auto region = cache.createRegionFactory(RegionShortcut::PROXY)
+ .setPoolName(pool->getName())
+ .create("region");
+
+ return region;
+}
+
+TEST(RegionPutAllTest, putAllToPartitionedRegion) {
+ Cluster cluster{LocatorCount{1}, ServerCount{2}};
+ cluster.getGfsh()
+ .create()
+ .region()
+ .withName("region")
+ .withType("PARTITION")
+ .execute();
+
+ auto cache = createCache();
+ auto pool = createPool(cluster, cache);
+ auto region = setupRegion(cache, pool);
+
+ HashMapOfCacheable all;
+ for (int i = 0; i < 100; i++) {
+ region->put(CacheableKey::create(i), Cacheable::create(std::to_string(i)));
+ all.emplace(CacheableKey::create(i), Cacheable::create(std::to_string(i)));
+ }
+
+ for (int i = 0; i < 100; i++) {
+ // TODO some way force synchronous client metadata update first.
+ region->putAll(all);
+ std::this_thread::sleep_for(std::chrono::seconds(1));
+ }
+}
+
+} // namespace
diff --git a/cppcache/integration-test-2/RegionPutGetAllTest.cpp b/cppcache/integration/test/RegionPutGetAllTest.cpp
similarity index 90%
rename from cppcache/integration-test-2/RegionPutGetAllTest.cpp
rename to cppcache/integration/test/RegionPutGetAllTest.cpp
index 4b5633f..910566d 100644
--- a/cppcache/integration-test-2/RegionPutGetAllTest.cpp
+++ b/cppcache/integration/test/RegionPutGetAllTest.cpp
@@ -15,6 +15,10 @@
* limitations under the License.
*/
+#include <framework/Cluster.h>
+#include <framework/Gfsh.h>
+
+#include <VariousPdxTypes.hpp>
#include <future>
#include <initializer_list>
#include <iostream>
@@ -29,14 +33,11 @@
#include <geode/RegionShortcut.hpp>
#include <geode/TypeRegistry.hpp>
-#include "VariousPdxTypes.hpp"
-#include "framework/Cluster.h"
-#include "framework/Gfsh.h"
-
namespace {
using apache::geode::client::Cache;
using apache::geode::client::CacheableInt32;
+using apache::geode::client::CacheServerException;
using apache::geode::client::HashMapOfCacheable;
using apache::geode::client::Region;
using apache::geode::client::RegionShortcut;
@@ -198,4 +199,29 @@
assert_eq(putAllMap, getAllMap);
}
+TEST(RegionPutGetAllTest, nullValue) {
+ Cluster cluster{LocatorCount{1}, ServerCount{2}};
+ cluster.getGfsh()
+ .create()
+ .region()
+ .withName("region")
+ .withType("REPLICATE")
+ .execute();
+
+ auto cache = cluster.createCache();
+ auto region = setupRegion(cache);
+
+ setupPdxTypes(cache);
+
+ HashMapOfCacheable map;
+
+ // Add a null value
+ map.emplace(CacheableInt32::create(PdxTypesHelper1::index),
+ std::shared_ptr<PdxTypesHelper1::type>());
+
+ auto keys = to_keys(map);
+
+ ASSERT_THROW(region->putAll(map), CacheServerException);
+}
+
} // namespace
diff --git a/cppcache/integration-test-2/RegisterKeysTest.cpp b/cppcache/integration/test/RegisterKeysTest.cpp
similarity index 100%
rename from cppcache/integration-test-2/RegisterKeysTest.cpp
rename to cppcache/integration/test/RegisterKeysTest.cpp
diff --git a/cppcache/integration-test-2/StructTest.cpp b/cppcache/integration/test/StructTest.cpp
similarity index 96%
rename from cppcache/integration-test-2/StructTest.cpp
rename to cppcache/integration/test/StructTest.cpp
index 6f5d0d0..b65c6d7 100644
--- a/cppcache/integration-test-2/StructTest.cpp
+++ b/cppcache/integration/test/StructTest.cpp
@@ -15,6 +15,9 @@
* limitations under the License.
*/
+#include <framework/Cluster.h>
+#include <framework/Framework.h>
+#include <framework/Gfsh.h>
#include <hacks/range.h>
#include <iostream>
@@ -29,10 +32,6 @@
#include <geode/RegionShortcut.hpp>
#include <geode/Struct.hpp>
-#include "framework/Cluster.h"
-#include "framework/Framework.h"
-#include "framework/Gfsh.h"
-
namespace {
using apache::geode::client::Cache;
diff --git a/cppcache/shared/CMakeLists.txt b/cppcache/shared/CMakeLists.txt
index 09c11ec..e8803a0 100644
--- a/cppcache/shared/CMakeLists.txt
+++ b/cppcache/shared/CMakeLists.txt
@@ -13,7 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-cmake_minimum_required(VERSION 3.4)
project(apache-geode LANGUAGES CXX)
add_library(apache-geode SHARED ${SOURCES_ALL} ${RESOURCES})
@@ -24,6 +23,11 @@
#define APACHE_GEODE_EXTERN_TEMPLATE_EXPORT
")
+
+ target_compile_options(apache-geode
+ PRIVATE
+ /bigobj # C1128 - large number of templates causes too many section.
+ )
else()
set(EXPORT_HEADER_CUSTOM_CONTENT "
#define APACHE_GEODE_EXPLICIT_TEMPLATE_EXPORT
diff --git a/cppcache/src/AdminRegion.cpp b/cppcache/src/AdminRegion.cpp
index 5a93743..e08c734 100644
--- a/cppcache/src/AdminRegion.cpp
+++ b/cppcache/src/AdminRegion.cpp
@@ -20,6 +20,7 @@
#include <geode/SystemProperties.hpp>
#include "CacheImpl.hpp"
+#include "TcrConnectionManager.hpp"
#include "ThinClientPoolDM.hpp"
#include "ThinClientRegion.hpp"
#include "statistics/StatisticsManager.hpp"
diff --git a/cppcache/src/CacheFactory.cpp b/cppcache/src/CacheFactory.cpp
index 3f368fe..72e63dd 100644
--- a/cppcache/src/CacheFactory.cpp
+++ b/cppcache/src/CacheFactory.cpp
@@ -19,9 +19,6 @@
#include <map>
#include <string>
-#include <ace/Guard_T.h>
-#include <ace/Recursive_Thread_Mutex.h>
-
#include <geode/Cache.hpp>
#include <geode/CacheFactory.hpp>
#include <geode/PoolManager.hpp>
@@ -111,9 +108,8 @@
std::bind(VersionTag::createDeserializable, memberListForVersionStamp));
serializationRegistry->addDataSerializableFixedIdType(
- static_cast<int64_t>(DSFid::DiskVersionTag),
- std::bind(DiskVersionTag::createDeserializable,
- memberListForVersionStamp));
+ DSFid::DiskVersionTag, std::bind(DiskVersionTag::createDeserializable,
+ memberListForVersionStamp));
serializationRegistry->setPdxTypeHandler(new PdxTypeHandler());
serializationRegistry->setDataSerializableHandler(
diff --git a/cppcache/src/CacheImpl.cpp b/cppcache/src/CacheImpl.cpp
index f18c67d..87e0c61 100644
--- a/cppcache/src/CacheImpl.cpp
+++ b/cppcache/src/CacheImpl.cpp
@@ -14,12 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
#include "CacheImpl.hpp"
#include <string>
-#include <ace/OS.h>
-
#include <geode/CacheStatistics.hpp>
#include <geode/PersistenceManager.hpp>
#include <geode/PoolManager.hpp>
@@ -30,12 +29,14 @@
#include "AutoDelete.hpp"
#include "CacheXmlParser.hpp"
#include "ClientProxyMembershipID.hpp"
+#include "EvictionController.hpp"
#include "ExpiryTaskManager.hpp"
#include "InternalCacheTransactionManager2PCImpl.hpp"
#include "LocalRegion.hpp"
#include "PdxTypeRegistry.hpp"
#include "RegionExpiryHandler.hpp"
#include "SerializationRegistry.hpp"
+#include "TcrConnectionManager.hpp"
#include "TcrMessage.hpp"
#include "ThinClientHARegion.hpp"
#include "ThinClientPoolDM.hpp"
@@ -65,9 +66,7 @@
m_distributedSystem(DistributedSystem::create(DEFAULT_DS_NAME, dsProps)),
m_clientProxyMembershipIDFactory(m_distributedSystem.getName()),
m_cache(c),
- m_cond(m_mutex),
m_attributes(nullptr),
- m_evictionControllerPtr(nullptr),
m_tcrConnectionManager(nullptr),
m_remoteQueryServicePtr(nullptr),
m_destroyPending(false),
@@ -77,20 +76,18 @@
*(std::make_shared<MemberListForVersionStamp>())),
m_serializationRegistry(std::make_shared<SerializationRegistry>()),
m_pdxTypeRegistry(nullptr),
- m_threadPool(new ThreadPool(
- m_distributedSystem.getSystemProperties().threadPoolSize())),
+ m_threadPool(m_distributedSystem.getSystemProperties().threadPoolSize()),
m_authInitialize(authInitialize) {
using apache::geode::statistics::StatisticsManager;
m_cacheTXManager = std::shared_ptr<InternalCacheTransactionManager2PC>(
new InternalCacheTransactionManager2PCImpl(this));
- m_regions = new MapOfRegionWithLock();
auto& prop = m_distributedSystem.getSystemProperties();
if (prop.heapLRULimitEnabled()) {
- m_evictionControllerPtr =
- new EvictionController(prop.heapLRULimit(), prop.heapLRUDelta(), this);
- m_evictionControllerPtr->start();
+ m_evictionController = std::unique_ptr<EvictionController>(
+ new EvictionController(prop.heapLRULimit(), prop.heapLRUDelta(), this));
+ m_evictionController->start();
LOGINFO("Heap LRU eviction controller thread started");
}
@@ -186,14 +183,11 @@
return regionKind;
}
-int CacheImpl::removeRegion(const char* name) {
+void CacheImpl::removeRegion(const std::string& name) {
TryReadGuard guardCacheDestroy(m_destroyCacheMutex, m_destroyPending);
- if (m_destroyPending) {
- return 0;
+ if (!m_destroyPending) {
+ m_regions.erase(name);
}
-
- MapOfRegionGuard guard(m_regions->mutex());
- return m_regions->unbind(name);
}
std::shared_ptr<QueryService> CacheImpl::getQueryService(bool noInit) {
@@ -234,10 +228,6 @@
if (!m_closed) {
close();
}
-
- if (m_regions != nullptr) {
- delete m_regions;
- }
}
const std::string& CacheImpl::getName() const {
@@ -310,24 +300,22 @@
m_tcrConnectionManager->close();
}
- MapOfRegionWithLock regions;
+ std::unordered_map<std::string, std::shared_ptr<Region>> regions;
getSubRegions(regions);
- for (MapOfRegionWithLock::iterator q = regions.begin(); q != regions.end();
- ++q) {
+ for (const auto& kv : regions) {
// TODO: remove dynamic_cast here by having RegionInternal in the regions
// map
- auto rImpl = std::dynamic_pointer_cast<RegionInternal>((*q).int_id_);
- if (rImpl != nullptr) {
+ auto rImpl = std::dynamic_pointer_cast<RegionInternal>(kv.second);
+ if (rImpl) {
rImpl->destroyRegionNoThrow(
nullptr, false,
CacheEventFlags::LOCAL | CacheEventFlags::CACHE_CLOSE);
}
}
- if (m_evictionControllerPtr != nullptr) {
- m_evictionControllerPtr->stop();
- _GEODE_SAFE_DELETE(m_evictionControllerPtr);
+ if (m_evictionController) {
+ m_evictionController->stop();
}
// Close CachePef Stats
@@ -345,7 +333,7 @@
_GEODE_SAFE_DELETE(m_cacheStats);
}
- m_regions->unbind_all();
+ m_regions.clear();
LOGDEBUG("CacheImpl::close( ): destroyed regions.");
_GEODE_SAFE_DELETE(m_tcrConnectionManager);
@@ -384,7 +372,7 @@
RegionAttributes regionAttributes,
std::shared_ptr<Region>& regionPtr) {
{
- ACE_Guard<ACE_Thread_Mutex> _guard(m_initDoneLock);
+ std::lock_guard<decltype(m_initDoneLock)> _guard(m_initDoneLock);
if (!m_initDone) {
if (regionAttributes.getPoolName().empty()) {
m_tcrConnectionManager->init();
@@ -408,12 +396,9 @@
validateRegionAttributes(name, regionAttributes);
std::shared_ptr<RegionInternal> rpImpl = nullptr;
{
- // For multi threading and the operations between bind and find seems to be
- // hard to be atomic since a regionImpl needs to be valid before it can be
- // bound
- MapOfRegionGuard guard1(m_regions->mutex());
- std::shared_ptr<Region> tmp;
- if (0 == m_regions->find(name, tmp)) {
+ auto&& lock = m_regions.make_lock();
+
+ if (m_regions.find(name) != m_regions.end()) {
throw RegionExistsException("Cache::createRegion: \"" + name +
"\" region exists in local cache");
}
@@ -457,27 +442,22 @@
}
rpImpl->acquireReadLock();
- m_regions->bind(regionPtr->getName(), regionPtr);
+ m_regions.emplace(regionPtr->getName(), regionPtr);
+ }
- // When region is created, added that region name in client meta data
- // service to fetch its
- // metadata for single hop.
- auto& props = m_distributedSystem.getSystemProperties();
- if (!props.isGridClient()) {
- const auto& poolName = regionAttributes.getPoolName();
- if (!poolName.empty()) {
- auto pool = getPoolManager().find(poolName);
- if (pool != nullptr && !pool->isDestroyed() &&
- pool->getPRSingleHopEnabled()) {
- ThinClientPoolDM* poolDM =
- dynamic_cast<ThinClientPoolDM*>(pool.get());
- if ((poolDM != nullptr) &&
- (poolDM->getClientMetaDataService() != nullptr)) {
- LOGFINE("enqueued region " + name +
- " for initial metadata refresh for singlehop ");
- poolDM->getClientMetaDataService()->enqueueForMetadataRefresh(
- regionPtr->getFullPath(), 0);
- }
+ // When region is created, added that region name in client meta data
+ // service to fetch its metadata for single hop.
+ const auto& poolName = regionAttributes.getPoolName();
+ if (!poolName.empty()) {
+ const auto& pool = getPoolManager().find(poolName);
+ if (pool && !pool->isDestroyed() && pool->getPRSingleHopEnabled()) {
+ if (const auto& poolDM =
+ std::dynamic_pointer_cast<ThinClientPoolDM>(pool)) {
+ if (auto clientMetaDataService = poolDM->getClientMetaDataService()) {
+ LOGFINE("enqueued region " + name +
+ " for initial metadata refresh for singlehop ");
+ poolDM->getClientMetaDataService()->enqueueForMetadataRefresh(
+ regionPtr->getFullPath(), 0);
}
}
}
@@ -488,6 +468,15 @@
rpImpl->releaseReadLock();
}
+std::shared_ptr<Region> CacheImpl::findRegion(const std::string& name) {
+ auto&& lock = m_regions.make_lock<std::lock_guard>();
+ const auto& find = m_regions.find(name);
+ if (find != m_regions.end()) {
+ return find->second;
+ }
+ return nullptr;
+}
+
std::shared_ptr<Region> CacheImpl::getRegion(const std::string& path) {
LOGDEBUG("Cache::getRegion " + path);
@@ -499,34 +488,30 @@
return nullptr;
}
- MapOfRegionGuard guard(m_regions->mutex());
static const std::string slash("/");
if (path == slash || path.length() < 1) {
LOGERROR("Cache::getRegion: path [" + path + "] is not valid.");
throw IllegalArgumentException("Cache::getRegion: path is empty or a /");
}
+
auto fullname = path;
if (fullname.substr(0, 1) == slash) {
fullname = path.substr(1);
}
// find second separator
- auto idx = static_cast<uint32_t>(fullname.find('/'));
+ auto idx = fullname.find('/');
auto stepname = fullname.substr(0, idx);
- std::shared_ptr<Region> region = nullptr;
-
- if (0 == m_regions->find(stepname, region)) {
+ auto region = findRegion(stepname);
+ if (region) {
if (stepname != fullname) {
auto remainder = fullname.substr(stepname.length() + 1);
-
- if (region != nullptr) {
- region = region->getSubregion(remainder.c_str());
- }
+ region = region->getSubregion(remainder);
}
}
- if (region != nullptr && isPoolInMultiuserMode(region)) {
+ if (region && isPoolInMultiuserMode(region)) {
LOGWARN("Pool " + region->getAttributes().getPoolName() +
" attached with region " + region->getFullPath() +
" is in multiuser authentication mode. Operations may fail as "
@@ -607,15 +592,14 @@
std::vector<std::shared_ptr<Region>> regions;
- MapOfRegionGuard guard(m_regions->mutex());
+ auto&& lock = m_regions.make_lock();
- if (m_regions->current_size() != 0) {
- regions.reserve(static_cast<int32_t>(m_regions->current_size()));
+ if (!m_regions.empty()) {
+ regions.reserve(m_regions.size());
- for (MapOfRegionWithLock::iterator q = m_regions->begin();
- q != m_regions->end(); ++q) {
- if (!(*q).int_id_->isDestroyed()) {
- regions.push_back((*q).int_id_);
+ for (const auto& kv : m_regions) {
+ if (!kv.second->isDestroyed()) {
+ regions.push_back(kv.second);
}
}
}
@@ -634,7 +618,7 @@
}
EvictionController* CacheImpl::getEvictionController() {
- return m_evictionControllerPtr;
+ return m_evictionController.get();
}
void CacheImpl::readyForEvents() {
@@ -706,9 +690,10 @@
const auto firstPool =
std::static_pointer_cast<ThinClientPoolDM>(pools.begin()->second);
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(firstPool->m_endpointsLock);
+ auto& mutex = firstPool->m_endpointsLock;
+ std::lock_guard<decltype(mutex)> guard(mutex);
for (const auto& itr : firstPool->m_endpoints) {
- const auto& ep = itr.int_id_;
+ auto ep = itr.second;
if (ep->name().find(fullName) != std::string::npos) {
return ep->getServerQueueStatusTEST();
}
@@ -722,12 +707,12 @@
return;
}
- MapOfRegionGuard guard(m_regions->mutex());
+ auto&& lock = m_regions.make_lock();
- for (const auto& q : *m_regions) {
- if (!q.int_id_->isDestroyed()) {
+ for (const auto& kv : m_regions) {
+ if (!kv.second->isDestroyed()) {
if (const auto tcrHARegion =
- std::dynamic_pointer_cast<ThinClientHARegion>(q.int_id_)) {
+ std::dynamic_pointer_cast<ThinClientHARegion>(kv.second)) {
auto regionMsg = new TcrMessageClientMarker(
new DataOutput(createDataOutput()), true);
tcrHARegion->receiveNotification(regionMsg);
@@ -801,7 +786,8 @@
return m_serializationRegistry;
}
-ThreadPool* CacheImpl::getThreadPool() { return m_threadPool; }
+ThreadPool& CacheImpl::getThreadPool() { return m_threadPool; }
+
std::shared_ptr<CacheTransactionManager>
CacheImpl::getCacheTransactionManager() {
this->throwIfClosed();
@@ -888,6 +874,11 @@
}
void CacheImpl::setCache(Cache* cache) { m_cache = cache; }
+
+void CacheImpl::setClientCrashTEST() {
+ m_tcrConnectionManager->setClientCrashTEST();
+}
+
} // namespace client
} // namespace geode
} // namespace apache
diff --git a/cppcache/src/CacheImpl.hpp b/cppcache/src/CacheImpl.hpp
index f0f6908..3ab93ad 100644
--- a/cppcache/src/CacheImpl.hpp
+++ b/cppcache/src/CacheImpl.hpp
@@ -22,11 +22,9 @@
#include <atomic>
#include <memory>
+#include <mutex>
-#include <ace/ACE.h>
-#include <ace/Guard_T.h>
-#include <ace/Recursive_Thread_Mutex.h>
-#include <ace/Time_Value.h>
+#include <ace/RW_Thread_Mutex.h>
#include <geode/Cache.hpp>
#include <geode/CacheAttributes.hpp>
@@ -37,15 +35,13 @@
#include "AdminRegion.hpp"
#include "CachePerfStats.hpp"
#include "ClientProxyMembershipIDFactory.hpp"
-#include "Condition.hpp"
#include "DistributedSystem.hpp"
-#include "EvictionController.hpp"
-#include "MapWithLock.hpp"
#include "MemberListForVersionStamp.hpp"
#include "NonCopyable.hpp"
#include "PdxTypeRegistry.hpp"
#include "RemoteQueryService.hpp"
-#include "TcrConnectionManager.hpp"
+#include "ThreadPool.hpp"
+#include "util/synchronized_map.hpp"
#define DEFAULT_LRU_MAXIMUM_ENTRIES 100000
/** @todo period '.' consistency */
@@ -67,6 +63,8 @@
class RegionAttributes;
class SerializationRegistry;
class ThreadPool;
+class EvictionController;
+class TcrConnectionManager;
/**
* @class Cache Cache.hpp
@@ -97,7 +95,7 @@
// drop
void netDown();
void revive();
- void setClientCrashTEST() { m_tcrConnectionManager->setClientCrashTEST(); }
+ void setClientCrashTEST();
// For PrSingleHop C++unit testing.
void setNetworkHopFlag(bool networkhopflag) {
@@ -239,7 +237,7 @@
return *m_tcrConnectionManager;
}
- int removeRegion(const char* name);
+ void removeRegion(const std::string& name);
std::shared_ptr<QueryService> getQueryService(bool noInit = false);
@@ -311,7 +309,7 @@
return m_distributedSystem.getSystemProperties();
}
- ThreadPool* getThreadPool();
+ ThreadPool& getThreadPool();
inline const std::shared_ptr<AuthInitialize>& getAuthInitialize() {
return m_authInitialize;
@@ -366,15 +364,15 @@
void validateRegionAttributes(const std::string& name,
const RegionAttributes attrs) const;
- inline void getSubRegions(MapOfRegionWithLock& srm) {
- MapOfRegionGuard guard(m_regions->mutex());
- if (m_regions->current_size() == 0) return;
- for (MapOfRegionWithLock::iterator p = m_regions->begin();
- p != m_regions->end(); ++p) {
- srm.bind((*p).ext_id_, (*p).int_id_);
- }
+ inline void getSubRegions(
+ std::unordered_map<std::string, std::shared_ptr<Region>>& srm) {
+ auto&& lock = m_regions.make_lock<std::lock_guard>();
+ if (m_regions.empty()) return;
+ srm.insert(m_regions.begin(), m_regions.end());
}
+ std::shared_ptr<Region> findRegion(const std::string& name);
+
void setCache(Cache* cache);
bool m_closed;
@@ -382,25 +380,25 @@
DistributedSystem m_distributedSystem;
ClientProxyMembershipIDFactory m_clientProxyMembershipIDFactory;
- MapOfRegionWithLock* m_regions;
+ synchronized_map<std::unordered_map<std::string, std::shared_ptr<Region>>,
+ std::recursive_mutex>
+ m_regions;
Cache* m_cache;
- ACE_Recursive_Thread_Mutex m_mutex;
- Condition m_cond;
std::shared_ptr<CacheAttributes> m_attributes;
- EvictionController* m_evictionControllerPtr;
+ std::unique_ptr<EvictionController> m_evictionController;
TcrConnectionManager* m_tcrConnectionManager;
std::shared_ptr<RemoteQueryService> m_remoteQueryServicePtr;
ACE_RW_Thread_Mutex m_destroyCacheMutex;
volatile bool m_destroyPending;
volatile bool m_initDone;
- ACE_Thread_Mutex m_initDoneLock;
+ std::mutex m_initDoneLock;
std::shared_ptr<AdminRegion> m_adminRegion;
std::shared_ptr<CacheTransactionManager> m_cacheTXManager;
MemberListForVersionStamp& m_memberListForVersionStamp;
std::shared_ptr<SerializationRegistry> m_serializationRegistry;
std::shared_ptr<PdxTypeRegistry> m_pdxTypeRegistry;
- ThreadPool* m_threadPool;
+ ThreadPool m_threadPool;
const std::shared_ptr<AuthInitialize> m_authInitialize;
std::unique_ptr<TypeRegistry> m_typeRegistry;
diff --git a/cppcache/src/CacheTransactionManagerImpl.cpp b/cppcache/src/CacheTransactionManagerImpl.cpp
index 27a5e96..8462736 100644
--- a/cppcache/src/CacheTransactionManagerImpl.cpp
+++ b/cppcache/src/CacheTransactionManagerImpl.cpp
@@ -36,17 +36,17 @@
namespace client {
CacheTransactionManagerImpl::CacheTransactionManagerImpl(CacheImpl* cache)
- : m_cache(cache), m_txCond(m_suspendedTxLock) {}
+ : m_cache(cache) {}
CacheTransactionManagerImpl::~CacheTransactionManagerImpl() {}
void CacheTransactionManagerImpl::begin() {
- if (TSSTXStateWrapper::s_geodeTSSTXState->getTXState() != nullptr) {
+ if (TSSTXStateWrapper::get().getTXState() != nullptr) {
GfErrTypeThrowException("Transaction already in progress",
GF_CACHE_ILLEGAL_STATE_EXCEPTION);
}
auto txState = new TXState(m_cache);
- TSSTXStateWrapper::s_geodeTSSTXState->setTXState(txState);
+ TSSTXStateWrapper::get().setTXState(txState);
addTx(txState->getTransactionId().getId());
}
@@ -111,140 +111,6 @@
auto commit = std::dynamic_pointer_cast<TXCommitMessage>(reply.getValue());
txCleaner.clean();
commit->apply(m_cache->getCache());
-
- /*
- if(m_writer != nullptr)
- {
- try
- {
- std::shared_ptr<TransactionEvent> event(new
- TransactionEvent(txState->getTransactionId(),
- std::shared_ptr<Cache>(m_cache), commit->getEvents(m_cache)));
- m_writer->beforeCommit(event);
- } catch(const TransactionWriterException& ex)
- {
- noteCommitFailure(txState, commit);
- GfErrTypeThrowException(ex.what(),
- GF_COMMIT_CONFLICT_EXCEPTION);
- }
- catch (const Exception& ex)
- {
- noteCommitFailure(txState, commit);
- LOGERROR("Unexpected exception during writer callback
- %s", ex.what());
- throw ex;
- }
- catch (...)
- {
- noteCommitFailure(txState, commit);
- LOGERROR("Unexpected exception during writer
- callback");
- throw;
- }
- }
- */
-
- /*try
- {
- TcrMessage requestCommitBefore(TcrMessage::TX_SYNCHRONIZATION,
-BEFORE_COMMIT, txState->getTransactionId()->getId(), STATUS_COMMITTED);
- TcrMessage replyCommitBefore;
- err = tcr_dm->sendSyncRequest(requestCommitBefore, replyCommitBefore);
- if(err != GF_NOERR)
- {
- GfErrTypeThrowException("Error while committing", err);
- } else {
- switch (replyCommitBefore.getMessageType()) {
- case TcrMessage::REPLY: {
- break;
- }
- case TcrMessage::EXCEPTION: {
- const char* exceptionMsg =
-replyCommitBefore.getException();
- err =
-ThinClientRegion::handleServerException("CacheTransactionManager::commit",
- exceptionMsg);
- GfErrTypeThrowException("Commit
-Failed", err);
- break;
- }
- case TcrMessage::REQUEST_DATA_ERROR: {
- GfErrTypeThrowException("Commit Failed",
-GF_COMMIT_CONFLICT_EXCEPTION);
- break;
- }
- default: {
- LOGERROR("Unknown message type in commit reply %d",
-reply.getMessageType());
- GfErrTypeThrowException("Commit
-Failed", GF_MSG);
- break;
- }
- }
- }
- }
- catch (const Exception& ex)
- {
-// noteCommitFailure(txState, commit);
- LOGERROR("Unexpected exception during commit %s", ex.what());
- throw ex;
- }
- catch (...)
- {
-// noteCommitFailure(txState, commit);
- LOGERROR("Unexpected exception during writer callback");
- throw;
- }
-
- try{
- TcrMessage requestCommitAfter(TcrMessage::TX_SYNCHRONIZATION,
-AFTER_COMMIT, txState->getTransactionId()->getId(), STATUS_COMMITTED);
- TcrMessage replyCommitAfter;
- txCleaner.clean();
- commit->apply(m_cache);
- err = tcr_dm->sendSyncRequest(requestCommitAfter, replyCommitAfter);
-
- if(err != GF_NOERR)
- {
- GfErrTypeThrowException("Error while committing", err);
- } else {
- switch (replyCommitAfter.getMessageType()) {
- case TcrMessage::RESPONSE: {
- //commit = replyCommitAfter.getValue();
- break;
- }
- case TcrMessage::EXCEPTION: {
- const char* exceptionMsg =
-replyCommitAfter.getException();
- err = ThinClientRegion::handleServerException("CacheTransactionManager::commit",
- exceptionMsg);
- GfErrTypeThrowException("Commit Failed", err);
- break;
- }
- case TcrMessage::REQUEST_DATA_ERROR: {
- GfErrTypeThrowException("Commit Failed",
-GF_COMMIT_CONFLICT_EXCEPTION);
- break;
- }
- default: {
- GfErrTypeThrowException("Commit Failed", GF_MSG);
- break;
- }
- }
- }
- }
- catch (const Exception& ex)
- {
-// noteCommitFailure(txState, commit);
- throw ex;
- }
- catch (...)
- {
-// noteCommitFailure(txState, commit);
- throw;
- }*/
-
- // noteCommitSuccess(txState, commit);
}
void CacheTransactionManagerImpl::rollback() {
@@ -309,10 +175,9 @@
}
ThinClientPoolDM* CacheTransactionManagerImpl::getDM() {
- TcrConnection* conn =
- (*TssConnectionWrapper::s_geodeTSSConn)->getConnection();
+ auto conn = (*TssConnectionWrapper::s_geodeTSSConn)->getConnection();
if (conn != nullptr) {
- ThinClientPoolDM* dm = conn->getEndpointObject()->getPoolHADM();
+ auto dm = conn->getEndpointObject()->getPoolHADM();
if (dm != nullptr) {
return dm;
}
@@ -323,15 +188,14 @@
Cache* CacheTransactionManagerImpl::getCache() { return m_cache->getCache(); }
TransactionId& CacheTransactionManagerImpl::suspend() {
// get the current state of the thread
- TXState* txState = TSSTXStateWrapper::s_geodeTSSTXState->getTXState();
+ auto txState = TSSTXStateWrapper::get().getTXState();
if (txState == nullptr) {
LOGFINE("Transaction not in progress. Returning nullptr transaction Id.");
throw TransactionException("Transaction not in progress.");
}
// get the current connection that this transaction is using
- TcrConnection* conn =
- (*TssConnectionWrapper::s_geodeTSSConn)->getConnection();
+ auto conn = (*TssConnectionWrapper::s_geodeTSSConn)->getConnection();
if (conn == nullptr) {
LOGFINE(
"Thread local connection is null. Returning nullptr transaction Id.");
@@ -366,7 +230,7 @@
addSuspendedTx(txState->getTransactionId().getId(), txState);
// set the current transaction state as null
- TSSTXStateWrapper::s_geodeTSSTXState->setTXState(nullptr);
+ TSSTXStateWrapper::get().setTXState(nullptr);
// return the transaction ID
return static_cast<TransactionId&>(txState->getTransactionId());
@@ -374,7 +238,7 @@
void CacheTransactionManagerImpl::resume(TransactionId& transactionId) {
// get the current state of the thread
- if (TSSTXStateWrapper::s_geodeTSSTXState->getTXState() != nullptr) {
+ if (TSSTXStateWrapper::get().getTXState() != nullptr) {
GfErrTypeThrowException("A transaction is already in progress",
GF_CACHE_ILLEGAL_STATE_EXCEPTION);
}
@@ -400,7 +264,7 @@
bool CacheTransactionManagerImpl::tryResume(TransactionId& transactionId,
bool cancelExpiryTask) {
// get the current state of the thread
- if (TSSTXStateWrapper::s_geodeTSSTXState->getTXState() != nullptr) {
+ if (TSSTXStateWrapper::get().getTXState() != nullptr) {
LOGFINE("A transaction is already in progress. Cannot resume transaction.");
return false;
}
@@ -417,7 +281,7 @@
bool CacheTransactionManagerImpl::tryResume(
TransactionId& transactionId, std::chrono::milliseconds waitTime) {
// get the current state of the thread
- if (TSSTXStateWrapper::s_geodeTSSTXState->getTXState() != nullptr) {
+ if (TSSTXStateWrapper::get().getTXState() != nullptr) {
LOGFINE("A transaction is already in progress. Cannot resume transaction.");
return false;
}
@@ -452,7 +316,7 @@
}
// set the current state as the state of the suspended transaction
- TSSTXStateWrapper::s_geodeTSSTXState->setTXState(txState);
+ TSSTXStateWrapper::get().setTXState(txState);
LOGFINE("Get connection for transaction id %d",
txState->getTransactionId().getId());
@@ -462,7 +326,7 @@
if (conn == nullptr || error != GF_NOERR) {
// throw an exception and set the current state as nullptr because
// the transaction cannot be resumed
- TSSTXStateWrapper::s_geodeTSSTXState->setTXState(nullptr);
+ TSSTXStateWrapper::get().setTXState(nullptr);
GfErrTypeThrowException(
"Could not get a connection for the transaction id.",
GF_CACHE_ILLEGAL_STATE_EXCEPTION);
@@ -478,83 +342,65 @@
}
bool CacheTransactionManagerImpl::exists() {
- return TSSTXStateWrapper::s_geodeTSSTXState->getTXState() != nullptr;
+ return TSSTXStateWrapper::get().getTXState() != nullptr;
}
void CacheTransactionManagerImpl::addTx(int32_t txId) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_txLock);
+ std::unique_lock<decltype(m_txLock)> _guard(m_txLock);
m_TXs.push_back(txId);
}
-bool CacheTransactionManagerImpl::removeTx(int32_t txId) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_txLock);
-
- for (std::vector<int32_t>::iterator iter = m_TXs.begin(); iter != m_TXs.end();
- ++iter) {
- if (*iter == txId) {
- m_TXs.erase(iter);
- return true;
- }
- }
- return false;
+void CacheTransactionManagerImpl::removeTx(int32_t txId) {
+ std::unique_lock<decltype(m_txLock)> _guard(m_txLock);
+ m_TXs.erase(std::remove(m_TXs.begin(), m_TXs.end(), txId), m_TXs.end());
}
bool CacheTransactionManagerImpl::findTx(int32_t txId) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_txLock);
-
- for (std::vector<int32_t>::iterator iter = m_TXs.begin(); iter != m_TXs.end();
- ++iter) {
- if (*iter == txId) return true;
- }
- return false;
+ std::unique_lock<decltype(m_txLock)> _guard(m_txLock);
+ return std::find(m_TXs.begin(), m_TXs.end(), txId) != m_TXs.end();
}
void CacheTransactionManagerImpl::addSuspendedTx(int32_t txId,
TXState* txState) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_suspendedTxLock);
+ std::unique_lock<decltype(m_suspendedTxLock)> _guard(m_suspendedTxLock);
m_suspendedTXs[txId] = txState;
- // signal if some thread is waiting for this transaction to suspend
- m_txCond.broadcast();
+ m_txCond.notify_all();
}
TXState* CacheTransactionManagerImpl::getSuspendedTx(int32_t txId) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_suspendedTxLock);
- std::map<int32_t, TXState*>::iterator it = m_suspendedTXs.find(txId);
+ std::unique_lock<decltype(m_suspendedTxLock)> _guard(m_suspendedTxLock);
+ auto&& it = m_suspendedTXs.find(txId);
if (it == m_suspendedTXs.end()) return nullptr;
- TXState* rettxState = (*it).second;
+ auto rettxState = (*it).second;
return rettxState;
}
TXState* CacheTransactionManagerImpl::removeSuspendedTx(int32_t txId) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_suspendedTxLock);
- std::map<int32_t, TXState*>::iterator it = m_suspendedTXs.find(txId);
+ std::unique_lock<decltype(m_suspendedTxLock)> _guard(m_suspendedTxLock);
+ auto&& it = m_suspendedTXs.find(txId);
if (it == m_suspendedTXs.end()) return nullptr;
- TXState* rettxState = (*it).second;
+ auto rettxState = (*it).second;
m_suspendedTXs.erase(it);
return rettxState;
}
+
TXState* CacheTransactionManagerImpl::removeSuspendedTx(
int32_t txId, std::chrono::milliseconds waitTime) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_suspendedTxLock);
- TXState* txState = nullptr;
- ACE_Time_Value currTime(ACE_OS::gettimeofday());
- ACE_Time_Value stopAt(currTime);
- stopAt += waitTime;
+ std::unique_lock<decltype(m_suspendedTxLock)> _guard(m_suspendedTxLock);
- do {
- txState = removeSuspendedTx(txId);
- if (txState == nullptr) {
- LOGFINE("Wait for the connection to get suspended, Tid: %d", txId);
- m_txCond.wait(&stopAt);
- }
+ auto txState = removeSuspendedTx(txId);
+ if (txState == nullptr) {
+ LOGFINE("Wait for the connection to get suspended, Tid: %d", txId);
+ m_txCond.wait_for(_guard, waitTime, [this, txId, &txState] {
+ return nullptr != (txState = removeSuspendedTx(txId));
+ });
+ }
- } while (txState == nullptr && findTx(txId) &&
- (currTime = ACE_OS::gettimeofday()) < stopAt);
return txState;
}
bool CacheTransactionManagerImpl::isSuspendedTx(int32_t txId) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_suspendedTxLock);
- std::map<int32_t, TXState*>::iterator it = m_suspendedTXs.find(txId);
+ std::unique_lock<decltype(m_suspendedTxLock)> _guard(m_suspendedTxLock);
+ auto&& it = m_suspendedTXs.find(txId);
if (it == m_suspendedTXs.end()) {
return false;
} else {
@@ -563,114 +409,10 @@
}
TransactionId& CacheTransactionManagerImpl::getTransactionId() {
- TXState* txState = TSSTXStateWrapper::s_geodeTSSTXState->getTXState();
+ auto txState = TSSTXStateWrapper::get().getTXState();
return txState->getTransactionId();
}
-/*
-void CacheTransactionManagerImpl::setWriter(std::shared_ptr<TransactionWriter>
-writer)
-{
- m_writer = writer;
-}
- std::shared_ptr<TransactionWriter> CacheTransactionManagerImpl::getWriter()
-{
- return m_writer;
-}
-
-void
-CacheTransactionManagerImpl::addListener(std::shared_ptr<TransactionListener>
-aListener)
-{
- if(aListener == nullptr)
- {
- GfErrTypeThrowException("Trying to add null listener.",
-GF_CACHE_ILLEGAL_ARGUMENT_EXCEPTION);
- }
- if(!m_listeners.contains(aListener))
- {
- m_listeners.insert(aListener);
- }
-}
-
-void
-CacheTransactionManagerImpl::removeListener(std::shared_ptr<TransactionListener>
-aListener)
-{
- if(aListener == nullptr)
- {
- GfErrTypeThrowException("Trying to remove null listener.",
-GF_CACHE_ILLEGAL_ARGUMENT_EXCEPTION);
- }
- if(m_listeners.erase(aListener))
- {
- aListener->close();
- }
-}
-
-void CacheTransactionManagerImpl::noteCommitFailure(TXState* txState, const
-std::shared_ptr<TXCommitMessage>& commitMessage)
-{
- VectorOfEntryEvent events;
- if(commitMessage!= nullptr)
- {
- events = commitMessage->getEvents(m_cache);
- }
- std::shared_ptr<TransactionEvent> event(new
-TransactionEvent(txState->getTransactionId(), std::shared_ptr<Cache>(m_cache),
-events));
-
- for(HashSetOfSharedBase::Iterator iter = m_listeners.begin();
-m_listeners.end() != iter; iter++)
- {
- auto listener =
-std::static_pointer_cast<TransactionListener>(*iter);
- listener->afterFailedCommit(event);
- }
-}
-
-void CacheTransactionManagerImpl::noteCommitSuccess(TXState* txState, const
-std::shared_ptr<TXCommitMessage>& commitMessage)
-{
- VectorOfEntryEvent events;
- if(commitMessage!= nullptr)
- {
- events = commitMessage->getEvents(m_cache);
- }
- std::shared_ptr<TransactionEvent> event(new
-TransactionEvent(txState->getTransactionId(), std::shared_ptr<Cache>(m_cache),
-events));
-
- for(HashSetOfSharedBase::Iterator iter = m_listeners.begin();
-m_listeners.end() != iter; iter++)
- {
- auto listener =
-std::static_pointer_cast<std::shared_ptr<TransactionListener>>(*iter);
- listener->afterCommit(event);
- }
-}
-
-void CacheTransactionManagerImpl::noteRollbackSuccess(TXState* txState, const
-std::shared_ptr<TXCommitMessage>& commitMessage)
-{
- VectorOfEntryEvent events;
- if(commitMessage!= nullptr)
- {
- events = commitMessage->getEvents(m_cache);
- }
- std::shared_ptr<TransactionEvent> event(new
-TransactionEvent(txState->getTransactionId(), std::shared_ptr<Cache>(m_cache),
-events));
-
- for(HashSetOfSharedBase::Iterator iter = m_listeners.begin();
-m_listeners.end() != iter; iter++)
- {
- auto listener =
-std::static_pointer_cast<TransactionListener>(*iter);
- listener->afterRollback(event);
- }
-}
-*/
} // namespace client
} // namespace geode
} // namespace apache
diff --git a/cppcache/src/CacheTransactionManagerImpl.hpp b/cppcache/src/CacheTransactionManagerImpl.hpp
index 24f1569..e82edd1 100644
--- a/cppcache/src/CacheTransactionManagerImpl.hpp
+++ b/cppcache/src/CacheTransactionManagerImpl.hpp
@@ -20,6 +20,9 @@
#ifndef GEODE_CACHETRANSACTIONMANAGERIMPL_H_
#define GEODE_CACHETRANSACTIONMANAGERIMPL_H_
+#include <condition_variable>
+#include <mutex>
+
#include <geode/CacheTransactionManager.hpp>
#include "SuspendedTxExpiryHandler.hpp"
@@ -69,14 +72,14 @@
TXState* removeSuspendedTx(int32_t txId, std::chrono::milliseconds waitTime);
bool isSuspendedTx(int32_t txId);
void addTx(int32_t txId);
- bool removeTx(int32_t txId);
+ void removeTx(int32_t txId);
bool findTx(int32_t txId);
std::map<int32_t, TXState*> m_suspendedTXs;
- ACE_Recursive_Thread_Mutex m_suspendedTxLock;
+ std::recursive_mutex m_suspendedTxLock;
std::vector<int32_t> m_TXs;
- ACE_Recursive_Thread_Mutex m_txLock;
- ACE_Condition<ACE_Recursive_Thread_Mutex> m_txCond;
+ std::recursive_mutex m_txLock;
+ std::condition_variable_any m_txCond;
friend class TXCleaner;
};
diff --git a/cppcache/src/CacheXmlParser.cpp b/cppcache/src/CacheXmlParser.cpp
index 81d10b2..1494b53 100644
--- a/cppcache/src/CacheXmlParser.cpp
+++ b/cppcache/src/CacheXmlParser.cpp
@@ -26,6 +26,7 @@
#include "AutoDelete.hpp"
#include "CacheImpl.hpp"
#include "CacheRegionHelper.hpp"
+#include "util/string.hpp"
#if defined(_WIN32)
#include <windows.h>
@@ -347,11 +348,7 @@
void CacheXmlParser::handleParserErrors(int res) {
if (res != 0) // xml file is not well-formed
{
- char buf[256];
- ACE_OS::snprintf(buf, 256, "Error code returned by xml parser is : %d ",
- res);
- Log::error(buf);
-
+ Log::error("Error code returned by xml parser is : " + std::to_string(res));
throw CacheXmlException("Xml file is not well formed. Error _stack: \n" +
std::string(this->m_parserMessage));
}
@@ -633,13 +630,14 @@
void CacheXmlParser::setPoolInfo(PoolFactory* factory, const char* name,
const char* value) {
+ using apache::geode::client::equal_ignore_case;
using apache::geode::internal::chrono::duration::from_string;
if (strcmp(name, FREE_CONNECTION_TIMEOUT) == 0) {
factory->setFreeConnectionTimeout(
from_string<std::chrono::milliseconds>(std::string(value)));
} else if (strcmp(name, MULTIUSER_SECURE_MODE) == 0) {
- if (ACE_OS::strcasecmp(value, "true") == 0) {
+ if (equal_ignore_case(value, "true")) {
factory->setMultiuserAuthentication(true);
} else {
factory->setMultiuserAuthentication(false);
@@ -676,7 +674,7 @@
factory->setSubscriptionAckInterval(
from_string<std::chrono::milliseconds>(std::string(value)));
} else if (strcmp(name, SUBSCRIPTION_ENABLED) == 0) {
- if (ACE_OS::strcasecmp(value, "true") == 0) {
+ if (equal_ignore_case(value, "true")) {
factory->setSubscriptionEnabled(true);
} else {
factory->setSubscriptionEnabled(false);
@@ -687,13 +685,13 @@
} else if (strcmp(name, SUBSCRIPTION_REDUNDANCY) == 0) {
factory->setSubscriptionRedundancy(atoi(value));
} else if (strcmp(name, THREAD_LOCAL_CONNECTIONS) == 0) {
- if (ACE_OS::strcasecmp(value, "true") == 0) {
+ if (equal_ignore_case(value, "true")) {
factory->setThreadLocalConnections(true);
} else {
factory->setThreadLocalConnections(false);
}
} else if (strcmp(name, PR_SINGLE_HOP_ENABLED) == 0) {
- if (ACE_OS::strcasecmp(value, "true") == 0) {
+ if (equal_ignore_case(value, "true")) {
factory->setPRSingleHopEnabled(true);
} else {
factory->setPRSingleHopEnabled(false);
diff --git a/cppcache/src/CacheableDate.cpp b/cppcache/src/CacheableDate.cpp
index cd0d481..0105b04 100644
--- a/cppcache/src/CacheableDate.cpp
+++ b/cppcache/src/CacheableDate.cpp
@@ -19,8 +19,6 @@
#include <ctime>
#include <cwchar>
-#include <ace/OS.h>
-
#include <geode/CacheableDate.hpp>
#include <geode/DataInput.hpp>
#include <geode/DataOutput.hpp>
@@ -28,6 +26,7 @@
#include <geode/internal/CacheableKeys.hpp>
#include "config.h"
+#include "util/chrono/time_point.hpp"
namespace apache {
namespace geode {
@@ -81,14 +80,7 @@
}
std::string CacheableDate::toString() const {
- char buffer[25];
- struct tm date = {};
- time_t sec = m_timevalue / 1000;
- ACE_OS::localtime_r(&sec, &date);
- ACE_OS::snprintf(buffer, 24, "%d/%d/%d %d:%d:%d", date.tm_mon + 1,
- date.tm_mday, date.tm_year + 1900, date.tm_hour, date.tm_min,
- date.tm_sec);
- return std::string(buffer);
+ return apache::geode::util::chrono::to_string(static_cast<time_t>(*this));
}
} // namespace client
diff --git a/cppcache/src/CacheableFileName.cpp b/cppcache/src/CacheableFileName.cpp
index 12afd25..bd1cf99 100644
--- a/cppcache/src/CacheableFileName.cpp
+++ b/cppcache/src/CacheableFileName.cpp
@@ -14,8 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#include <ace/ACE.h>
-#include <ace/OS.h>
#include <geode/CacheableFileName.hpp>
#include <geode/DataInput.hpp>
diff --git a/cppcache/src/CacheableString.cpp b/cppcache/src/CacheableString.cpp
index 6c6d54b..466566e 100644
--- a/cppcache/src/CacheableString.cpp
+++ b/cppcache/src/CacheableString.cpp
@@ -20,9 +20,6 @@
#include <cwchar>
#include <locale>
-#include <ace/ACE.h>
-#include <ace/OS.h>
-
#include <geode/CacheableString.hpp>
#include <geode/DataInput.hpp>
#include <geode/DataOutput.hpp>
diff --git a/cppcache/src/ClientConnectionRequest.cpp b/cppcache/src/ClientConnectionRequest.cpp
index 8b9dd78..6c4c0be 100644
--- a/cppcache/src/ClientConnectionRequest.cpp
+++ b/cppcache/src/ClientConnectionRequest.cpp
@@ -29,8 +29,8 @@
writeSetOfServerLocation(output);
}
-DSFid ClientConnectionRequest::getDSFID() const {
- return DSFid::ClientConnectionRequest;
+internal::DSFid ClientConnectionRequest::getDSFID() const {
+ return internal::DSFid::ClientConnectionRequest;
}
void ClientConnectionRequest::writeSetOfServerLocation(
diff --git a/cppcache/src/ClientConnectionRequest.hpp b/cppcache/src/ClientConnectionRequest.hpp
index 4327e1a..f1bf1f2 100644
--- a/cppcache/src/ClientConnectionRequest.hpp
+++ b/cppcache/src/ClientConnectionRequest.hpp
@@ -23,9 +23,10 @@
#include <set>
#include <string>
+#include <geode/internal/DataSerializableFixedId.hpp>
+
#include "ServerLocation.hpp"
#include "ServerLocationRequest.hpp"
-#include "TcrEndpoint.hpp"
namespace apache {
namespace geode {
@@ -40,7 +41,7 @@
m_servergroup(servergroup),
m_excludeServergroup_serverLocation(excludeServergroup) {}
void toData(DataOutput& output) const override;
- DSFid getDSFID() const override;
+ internal::DSFid getDSFID() const override;
std::string getServerGroup() const { return m_servergroup; }
const std::set<ServerLocation>& getExcludedServerGroup() const {
return m_excludeServergroup_serverLocation;
diff --git a/cppcache/src/ClientHealthStats.cpp b/cppcache/src/ClientHealthStats.cpp
index 11b9262..e2c026c 100644
--- a/cppcache/src/ClientHealthStats.cpp
+++ b/cppcache/src/ClientHealthStats.cpp
@@ -56,7 +56,7 @@
m_numThread(0),
m_processCpuTime(0),
m_cpus(0) {
- m_updateTime = CacheableDate::create(ACE_OS::time(nullptr));
+ m_updateTime = CacheableDate::create();
}
ClientHealthStats::ClientHealthStats(int gets, int puts, int misses,
@@ -69,7 +69,7 @@
m_numThread(numThreads),
m_processCpuTime(cpuTime),
m_cpus(cpus) {
- m_updateTime = CacheableDate::create(ACE_OS::time(nullptr));
+ m_updateTime = CacheableDate::create();
}
} // namespace client
diff --git a/cppcache/src/ClientMetadata.cpp b/cppcache/src/ClientMetadata.cpp
index 2050fc3..2754190 100644
--- a/cppcache/src/ClientMetadata.cpp
+++ b/cppcache/src/ClientMetadata.cpp
@@ -14,13 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
#include "ClientMetadata.hpp"
#include <climits>
#include <cstdlib>
-#include <ace/OS.h>
-
#include "ThinClientPoolDM.hpp"
#include "Utils.hpp"
@@ -291,17 +290,6 @@
}
}
-void ClientMetadata::removeBucketServerLocation(BucketServerLocation) {}
-
-void ClientMetadata::populateDummyServers(int bucketId,
- BucketServerLocationsType locations) {
- // WriteGuard guard( m_readWriteLock );
-
- checkBucketId(bucketId);
-
- m_bucketServerLocationsList[bucketId] = locations;
-}
-
int ClientMetadata::assignFixedBucketId(
const char* partitionName, std::shared_ptr<CacheableKey> resolvekey) {
LOGDEBUG(
diff --git a/cppcache/src/ClientMetadata.hpp b/cppcache/src/ClientMetadata.hpp
index 5523827..24a9a7c 100644
--- a/cppcache/src/ClientMetadata.hpp
+++ b/cppcache/src/ClientMetadata.hpp
@@ -23,9 +23,6 @@
#include <map>
#include <vector>
-#include <ace/ACE.h>
-#include <ace/Recursive_Thread_Mutex.h>
-
#include <geode/PartitionResolver.hpp>
#include "BucketServerLocation.hpp"
@@ -61,7 +58,6 @@
int m_totalNumBuckets;
// std::shared_ptr<PartitionResolver> m_partitionResolver;
std::string m_colocatedWith;
- // ACE_RW_Thread_Mutex m_readWriteLock;
ThinClientPoolDM* m_tcrdm;
FixedMapType m_fpaMap;
inline void checkBucketId(size_t bucketId) {
@@ -88,11 +84,9 @@
// ServerLocation getPrimaryServerLocation(int bucketId);
void updateBucketServerLocations(
int bucketId, BucketServerLocationsType bucketServerLocations);
- void removeBucketServerLocation(BucketServerLocation serverLocation);
int getTotalNumBuckets();
// std::shared_ptr<PartitionResolver> getPartitionResolver();
const std::string& getColocatedWith();
- void populateDummyServers(int bucketId, BucketServerLocationsType serverlist);
int assignFixedBucketId(const char* partitionName,
std::shared_ptr<CacheableKey> resolvekey);
std::shared_ptr<CacheableHashSet>& getFixedPartitionNames() {
diff --git a/cppcache/src/ClientMetadataService.cpp b/cppcache/src/ClientMetadataService.cpp
index d5f1c9f..d6f975c 100644
--- a/cppcache/src/ClientMetadataService.cpp
+++ b/cppcache/src/ClientMetadataService.cpp
@@ -19,94 +19,77 @@
#include <climits>
#include <cstdlib>
-#include <iterator>
-#include <unordered_set>
+
+#include <boost/thread/lock_types.hpp>
#include <geode/FixedPartitionResolver.hpp>
+#include "ClientMetadata.hpp"
+#include "TcrConnectionManager.hpp"
#include "TcrMessage.hpp"
#include "ThinClientPoolDM.hpp"
+#include "util/queue.hpp"
namespace apache {
namespace geode {
namespace client {
+const BucketStatus::clock::time_point BucketStatus::m_noTimeout{};
+
const char* ClientMetadataService::NC_CMDSvcThread = "NC CMDSvcThread";
-ClientMetadataService::~ClientMetadataService() {
- if (m_bucketWaitTimeout > std::chrono::milliseconds::zero()) {
- try {
- std::map<std::string, PRbuckets*>::iterator bi;
- for (bi = m_bucketStatus.begin(); bi != m_bucketStatus.end(); ++bi) {
- delete bi->second;
- }
-
- } catch (...) {
- LOGINFO("Exception in ClientMetadataService destructor");
- }
- }
-}
-
-ClientMetadataService::ClientMetadataService(Pool* pool)
+ClientMetadataService::ClientMetadataService(ThinClientPoolDM* pool)
: m_run(false),
m_pool(pool),
- m_regionQueue(false)
+ m_cache(m_pool->getConnectionManager().getCacheImpl()),
+ m_regionQueue(false),
+ m_bucketWaitTimeout(m_cache->getDistributedSystem()
+ .getSystemProperties()
+ .bucketWaitTimeout())
-{
- auto tcrdm = dynamic_cast<ThinClientPoolDM*>(m_pool);
- auto cacheImpl = tcrdm->getConnectionManager().getCacheImpl();
- m_bucketWaitTimeout = cacheImpl->getDistributedSystem()
- .getSystemProperties()
- .bucketWaitTimeout();
+{}
+
+void ClientMetadataService::start() {
+ m_run = true;
+ m_thread = std::thread(&ClientMetadataService::svc, this);
}
-int ClientMetadataService::svc() {
+void ClientMetadataService::stop() {
+ m_run = false;
+ m_regionQueueCondition.notify_one();
+ m_thread.join();
+}
+
+void ClientMetadataService::svc() {
DistributedSystemImpl::setThreadName(NC_CMDSvcThread);
+
LOGINFO("ClientMetadataService started for pool " + m_pool->getName());
+
while (m_run) {
- m_regionQueueSema.acquire();
- auto tcrdm = dynamic_cast<ThinClientPoolDM*>(m_pool);
- auto&& cache = tcrdm->getConnectionManager().getCacheImpl();
- while (true) {
- auto&& regionFullPath = m_regionQueue.get();
-
- if (regionFullPath) {
- while (true) {
- if (m_regionQueue.size() > 0) {
- auto&& nextRegionFullPath = m_regionQueue.get();
- if (nextRegionFullPath != nullptr &&
- nextRegionFullPath->c_str() != nullptr &&
- regionFullPath->compare(nextRegionFullPath->c_str()) == 0) {
- } else {
- // different region; put it back
- m_regionQueue.put(nextRegionFullPath);
- break;
- }
- } else {
- break;
- }
- }
- }
-
- if (!cache->isCacheDestroyPending() && regionFullPath) {
- getClientPRMetadata(regionFullPath->c_str());
- } else {
- break;
- }
+ std::unique_lock<std::mutex> lock(m_regionQueueMutex);
+ m_regionQueueCondition.wait(
+ lock, [this] { return !m_run || !m_regionQueue.empty(); });
+ if (!m_run) {
+ break;
}
- // while(m_regionQueueSema.tryacquire( ) != -1); // release all
+
+ auto regionFullPath = std::move(m_regionQueue.front());
+ m_regionQueue.pop_front();
+ queue::coalesce(m_regionQueue, regionFullPath);
+
+ if (!m_cache->isCacheDestroyPending()) {
+ lock.unlock();
+ getClientPRMetadata(regionFullPath.c_str());
+ } else {
+ break;
+ }
}
+
LOGINFO("ClientMetadataService stopped for pool " + m_pool->getName());
- return 0;
}
void ClientMetadataService::getClientPRMetadata(const char* regionFullPath) {
if (regionFullPath == nullptr) return;
- ThinClientPoolDM* tcrdm = dynamic_cast<ThinClientPoolDM*>(m_pool);
- if (tcrdm == nullptr) {
- throw IllegalArgumentException(
- "ClientMetaData: pool cast to ThinClientPoolDM failed");
- }
// That means metadata for the region not found, So only for the first time
// for a particular region use GetClientPartitionAttributesOp
// TcrMessage to fetch the metadata and put it into map for later use.send
@@ -115,8 +98,9 @@
std::string path(regionFullPath);
std::shared_ptr<ClientMetadata> cptr = nullptr;
{
- ReadGuard guard(m_regionMetadataLock);
- RegionMetadataMapType::iterator itr = m_regionMetaDataMap.find(path);
+ boost::shared_lock<decltype(m_regionMetadataLock)> lock(
+ m_regionMetadataLock);
+ const auto& itr = m_regionMetaDataMap.find(path);
if (itr != m_regionMetaDataMap.end()) {
cptr = itr->second;
}
@@ -125,22 +109,20 @@
if (cptr == nullptr) {
TcrMessageGetClientPartitionAttributes request(
- new DataOutput(tcrdm->getConnectionManager()
- .getCacheImpl()
- ->getCache()
- ->createDataOutput()),
- regionFullPath);
- GfErrType err = tcrdm->sendSyncRequest(request, reply);
+ new DataOutput(m_cache->createDataOutput(m_pool)), regionFullPath);
+ GfErrType err = m_pool->sendSyncRequest(request, reply);
if (err == GF_NOERR &&
reply.getMessageType() ==
TcrMessage::RESPONSE_CLIENT_PARTITION_ATTRIBUTES) {
cptr = std::make_shared<ClientMetadata>(reply.getNumBuckets(),
- reply.getColocatedWith(), tcrdm,
+ reply.getColocatedWith(), m_pool,
reply.getFpaSet());
if (m_bucketWaitTimeout > std::chrono::milliseconds::zero() &&
reply.getNumBuckets() > 0) {
- WriteGuard guard(m_PRbucketStatusLock);
- m_bucketStatus[regionFullPath] = new PRbuckets(reply.getNumBuckets());
+ boost::unique_lock<decltype(m_PRbucketStatusLock)> lock(
+ m_PRbucketStatusLock);
+ m_bucketStatus[regionFullPath] =
+ std::unique_ptr<PRbuckets>(new PRbuckets(reply.getNumBuckets()));
}
LOGDEBUG("ClientMetadata buckets %d ", reply.getNumBuckets());
}
@@ -157,7 +139,8 @@
if (newCptr != nullptr) {
cptr->setPreviousone(nullptr);
newCptr->setPreviousone(cptr);
- WriteGuard guard(m_regionMetadataLock);
+ boost::unique_lock<decltype(m_regionMetadataLock)> lock(
+ m_regionMetadataLock);
m_regionMetaDataMap[path] = newCptr;
LOGINFO("Updated client meta data");
}
@@ -168,51 +151,43 @@
cptr->setPreviousone(nullptr);
newCptr->setPreviousone(cptr);
// now we will get new instance so assign it again
- WriteGuard guard(m_regionMetadataLock);
+ boost::unique_lock<decltype(m_regionMetadataLock)> lock(
+ m_regionMetadataLock);
m_regionMetaDataMap[colocatedWith.c_str()] = newCptr;
m_regionMetaDataMap[path] = newCptr;
LOGINFO("Updated client meta data");
}
}
}
+
std::shared_ptr<ClientMetadata> ClientMetadataService::SendClientPRMetadata(
const char* regionPath, std::shared_ptr<ClientMetadata> cptr) {
- ThinClientPoolDM* tcrdm = dynamic_cast<ThinClientPoolDM*>(m_pool);
- if (tcrdm == nullptr) {
- throw IllegalArgumentException(
- "ClientMetaData: pool cast to ThinClientPoolDM failed");
- }
TcrMessageGetClientPrMetadata request(
- new DataOutput(
- tcrdm->getConnectionManager().getCacheImpl()->createDataOutput()),
- regionPath);
+ new DataOutput(m_cache->createDataOutput(m_pool)), regionPath);
TcrMessageReply reply(true, nullptr);
// send this message to server and get metadata from server.
LOGFINE("Now sending GET_CLIENT_PR_METADATA for getting from server: %s",
regionPath);
std::shared_ptr<Region> region = nullptr;
- GfErrType err = tcrdm->sendSyncRequest(request, reply);
+ GfErrType err = m_pool->sendSyncRequest(request, reply);
if (err == GF_NOERR &&
reply.getMessageType() == TcrMessage::RESPONSE_CLIENT_PR_METADATA) {
- region =
- tcrdm->getConnectionManager().getCacheImpl()->getRegion(regionPath);
+ region = m_cache->getRegion(regionPath);
if (region != nullptr) {
- LocalRegion* lregion = dynamic_cast<LocalRegion*>(region.get());
- lregion->getRegionStats()->incMetaDataRefreshCount();
+ if (auto lregion = std::dynamic_pointer_cast<LocalRegion>(region)) {
+ lregion->getRegionStats()->incMetaDataRefreshCount();
+ }
}
- std::vector<BucketServerLocationsType>* metadata = reply.getMetadata();
+ auto metadata = reply.getMetadata();
if (metadata == nullptr) return nullptr;
if (metadata->empty()) {
delete metadata;
return nullptr;
}
auto newCptr = std::make_shared<ClientMetadata>(*cptr);
- for (std::vector<BucketServerLocationsType>::iterator iter =
- metadata->begin();
- iter != metadata->end(); ++iter) {
- if (!(*iter).empty()) {
- newCptr->updateBucketServerLocations((*iter).at(0)->getBucketId(),
- (*iter));
+ for (const auto& v : *metadata) {
+ if (!v.empty()) {
+ newCptr->updateBucketServerLocations(v.at(0)->getBucketId(), v);
}
}
delete metadata;
@@ -227,9 +202,9 @@
const std::shared_ptr<Cacheable>& value,
const std::shared_ptr<Serializable>& aCallbackArgument, bool isPrimary,
std::shared_ptr<BucketServerLocation>& serverLocation, int8_t& version) {
- // ACE_Guard< ACE_Recursive_Thread_Mutex > guard( m_regionMetadataLock );
if (region != nullptr) {
- ReadGuard guard(m_regionMetadataLock);
+ boost::shared_lock<decltype(m_regionMetadataLock)> lock(
+ m_regionMetadataLock);
LOGDEBUG(
"ClientMetadataService::getBucketServerLocation m_regionMetaDataMap "
"size is %d",
@@ -276,35 +251,28 @@
std::shared_ptr<ClientMetadata> ClientMetadataService::getClientMetadata(
const std::string& regionFullPath) {
- ReadGuard guard(m_regionMetadataLock);
- RegionMetadataMapType::iterator regionMetadataIter =
- m_regionMetaDataMap.find(regionFullPath);
- if (regionMetadataIter != m_regionMetaDataMap.end()) {
- return (*regionMetadataIter).second;
+ boost::shared_lock<decltype(m_regionMetadataLock)> lock(m_regionMetadataLock);
+
+ const auto& entry = m_regionMetaDataMap.find(regionFullPath);
+ if (entry == m_regionMetaDataMap.end()) {
+ return nullptr;
}
- return nullptr;
+
+ return entry->second;
}
-void ClientMetadataService::populateDummyServers(
- const char* regionName, std::shared_ptr<ClientMetadata> cptr) {
- WriteGuard guard(m_regionMetadataLock);
- m_regionMetaDataMap[regionName] = cptr;
+std::shared_ptr<ClientMetadata> ClientMetadataService::getClientMetadata(
+ const std::shared_ptr<Region>& region) {
+ return getClientMetadata(region->getFullPath());
}
void ClientMetadataService::enqueueForMetadataRefresh(
const std::string& regionFullPath, int8_t serverGroupFlag) {
- ThinClientPoolDM* tcrdm = dynamic_cast<ThinClientPoolDM*>(m_pool);
- if (tcrdm == nullptr) {
- throw IllegalArgumentException(
- "ClientMetaData: pool cast to ThinClientPoolDM failed");
- }
+ auto region = m_cache->getRegion(regionFullPath);
- auto cache = tcrdm->getConnectionManager().getCacheImpl();
- auto region = cache->getRegion(regionFullPath);
-
- std::string serverGroup = tcrdm->getServerGroup();
+ std::string serverGroup = m_pool->getServerGroup();
if (serverGroup.length() != 0) {
- cache->setServerGroupFlag(serverGroupFlag);
+ m_cache->setServerGroupFlag(serverGroupFlag);
if (serverGroupFlag == 2) {
LOGFINER(
"Network hop but, from within same server-group, so no metadata "
@@ -314,7 +282,7 @@
}
if (region != nullptr) {
- ThinClientRegion* tcrRegion = dynamic_cast<ThinClientRegion*>(region.get());
+ auto tcrRegion = dynamic_cast<ThinClientRegion*>(region.get());
{
TryWriteGuard guardRegionMetaDataRefresh(
tcrRegion->getMataDataMutex(), tcrRegion->getMetaDataRefreshed());
@@ -322,26 +290,16 @@
return;
}
LOGFINE("Network hop so fetching single hop metadata from the server");
- cache->setNetworkHopFlag(true);
+ m_cache->setNetworkHopFlag(true);
tcrRegion->setMetaDataRefreshed(true);
- auto tempRegionPath = std::make_shared<std::string>(regionFullPath);
- m_regionQueue.put(tempRegionPath);
- m_regionQueueSema.release();
+ {
+ std::lock_guard<decltype(m_regionQueueMutex)> lock(m_regionQueueMutex);
+ m_regionQueue.push_back(regionFullPath);
+ }
+ m_regionQueueCondition.notify_one();
}
}
}
-std::shared_ptr<ClientMetadata> ClientMetadataService::getClientMetadata(
- const std::shared_ptr<Region>& region) {
- ReadGuard guard(m_regionMetadataLock);
-
- const auto& entry = m_regionMetaDataMap.find(region->getFullPath());
-
- if (entry == m_regionMetaDataMap.end()) {
- return nullptr;
- }
-
- return entry->second;
-}
std::shared_ptr<ClientMetadataService::ServerToFilterMap>
ClientMetadataService::getServerToFilterMap(
@@ -409,25 +367,25 @@
keyList->push_back(key);
}
- if (keysWhichLeft.size() > 0 &&
- serverToFilterMap->size() > 0) { // add left keys in result
+ if (!keysWhichLeft.empty() && !serverToFilterMap->empty()) {
+ // add left keys in result
auto keyLefts = keysWhichLeft.size();
auto totalServers = serverToFilterMap->size();
auto perServer = keyLefts / totalServers + 1;
size_t keyIdx = 0;
for (const auto& locationIter : *serverToFilterMap) {
- const auto keys = locationIter.second;
+ const auto values = locationIter.second;
for (size_t i = 0; i < perServer; i++) {
if (keyIdx < keyLefts) {
- keys->push_back(keysWhichLeft.at(keyIdx++));
+ values->push_back(keysWhichLeft.at(keyIdx++));
} else {
break;
}
}
if (keyIdx >= keyLefts) break; // done
}
- } else if (serverToFilterMap->size() == 0) { // not be able to map any key
+ } else if (serverToFilterMap->empty()) { // not be able to map any key
return nullptr; // it will force all keys to send to one server
}
@@ -442,7 +400,7 @@
std::shared_ptr<BucketServerLocation>& serverLocation, int8_t& version) {
if (m_bucketWaitTimeout == std::chrono::milliseconds::zero()) return;
- WriteGuard guard(m_PRbucketStatusLock);
+ boost::unique_lock<decltype(m_PRbucketStatusLock)> lock(m_PRbucketStatusLock);
getBucketServerLocation(region, key, value, aCallbackArgument,
false /*look for secondary host*/, serverLocation,
@@ -454,8 +412,7 @@
serverLocation->getPort());
int32_t bId = serverLocation->getBucketId();
- std::map<std::string, PRbuckets*>::iterator bs =
- m_bucketStatus.find(region->getFullPath());
+ const auto& bs = m_bucketStatus.find(region->getFullPath());
if (bs != m_bucketStatus.end()) {
bs->second->setBucketTimeout(bId);
@@ -787,14 +744,12 @@
std::shared_ptr<BucketServerLocation>& serverLocation, int8_t& version) {
if (m_bucketWaitTimeout == std::chrono::milliseconds::zero()) return;
- WriteGuard guard(m_PRbucketStatusLock);
-
- std::map<std::string, PRbuckets*>::iterator bs =
- m_bucketStatus.find(region->getFullPath());
+ boost::unique_lock<decltype(m_PRbucketStatusLock)> lock(m_PRbucketStatusLock);
PRbuckets* prBuckets = nullptr;
+ const auto& bs = m_bucketStatus.find(region->getFullPath());
if (bs != m_bucketStatus.end()) {
- prBuckets = bs->second;
+ prBuckets = bs->second.get();
}
if (prBuckets == nullptr) return;
@@ -804,10 +759,10 @@
std::shared_ptr<ClientMetadata> cptr = nullptr;
{
- ReadGuard guard(m_regionMetadataLock);
- RegionMetadataMapType::iterator cptrIter =
- m_regionMetaDataMap.find(region->getFullPath());
+ boost::shared_lock<decltype(m_regionMetadataLock)> lock(
+ m_regionMetadataLock);
+ const auto& cptrIter = m_regionMetaDataMap.find(region->getFullPath());
if (cptrIter != m_regionMetaDataMap.end()) {
cptr = cptrIter->second;
}
@@ -819,9 +774,9 @@
LOGFINE("Setting in markPrimaryBucketForTimeoutButLookSecondaryBucket");
- int32_t totalBuckets = cptr->getTotalNumBuckets();
+ auto totalBuckets = cptr->getTotalNumBuckets();
- for (int32_t i = 0; i < totalBuckets; i++) {
+ for (decltype(totalBuckets) i = 0; i < totalBuckets; i++) {
int8_t version;
std::shared_ptr<BucketServerLocation> bsl;
cptr->getServerLocation(i, false, bsl, version);
@@ -839,15 +794,13 @@
int32_t bucketid) {
if (m_bucketWaitTimeout == std::chrono::milliseconds::zero()) return false;
- ReadGuard guard(m_PRbucketStatusLock);
+ boost::shared_lock<decltype(m_PRbucketStatusLock)> lock(m_PRbucketStatusLock);
const auto& bs = m_bucketStatus.find(regionFullPath);
if (bs != m_bucketStatus.end()) {
bool m = bs->second->isBucketTimedOut(bucketid, m_bucketWaitTimeout);
if (m) {
- ThinClientPoolDM* tcrdm = dynamic_cast<ThinClientPoolDM*>(m_pool);
- CacheImpl* cache = tcrdm->getConnectionManager().getCacheImpl();
- cache->incBlackListBucketTimeouts();
+ m_cache->incBlackListBucketTimeouts();
}
LOGFINE("isBucketMarkedForTimeout:: for bucket %d returning = %d", bucketid,
m);
diff --git a/cppcache/src/ClientMetadataService.hpp b/cppcache/src/ClientMetadataService.hpp
index e6c91e9..5de4379 100644
--- a/cppcache/src/ClientMetadataService.hpp
+++ b/cppcache/src/ClientMetadataService.hpp
@@ -20,12 +20,17 @@
#ifndef GEODE_CLIENTMETADATASERVICE_H_
#define GEODE_CLIENTMETADATASERVICE_H_
+#include <atomic>
+#include <chrono>
+#include <condition_variable>
+#include <deque>
#include <memory>
+#include <mutex>
#include <string>
+#include <thread>
#include <unordered_map>
-#include <ace/Semaphore.h>
-#include <ace/Task.h>
+#include <boost/thread/shared_mutex.hpp>
#include <geode/CacheableKey.hpp>
#include <geode/Region.hpp>
@@ -33,46 +38,45 @@
#include <geode/internal/functional.hpp>
#include "BucketServerLocation.hpp"
-#include "ClientMetadata.hpp"
-#include "DistributedSystemImpl.hpp"
#include "NonCopyable.hpp"
-#include "Queue.hpp"
#include "ServerLocation.hpp"
namespace apache {
namespace geode {
namespace client {
-class ClienMetadata;
+class ClientMetadata;
+class ThinClientPoolDM;
typedef std::map<std::string, std::shared_ptr<ClientMetadata>>
RegionMetadataMapType;
class BucketStatus {
private:
- ACE_Time_Value m_lastTimeout;
+ using clock = std::chrono::steady_clock;
+ const static clock::time_point m_noTimeout;
+ clock::time_point m_lastTimeout;
public:
- BucketStatus() : m_lastTimeout(ACE_Time_Value::zero) {}
+ BucketStatus() = default;
bool isTimedoutAndReset(std::chrono::milliseconds millis) {
- if (m_lastTimeout == ACE_Time_Value::zero) {
+ if (m_lastTimeout == m_noTimeout) {
return false;
} else {
- ACE_Time_Value to(millis);
- to += m_lastTimeout;
- if (to > ACE_OS::gettimeofday()) {
+ auto timeout = m_lastTimeout + millis;
+ if (timeout > clock::now()) {
return true; // timeout as buckste not recovered yet
} else {
// reset to zero as we waited enough to recover bucket
- m_lastTimeout = ACE_Time_Value::zero;
+ m_lastTimeout = m_noTimeout;
return false;
}
}
}
void setTimeout() {
- if (m_lastTimeout == ACE_Time_Value::zero) {
- m_lastTimeout = ACE_OS::gettimeofday(); // set once only for timeout
+ if (m_lastTimeout == m_noTimeout) {
+ m_lastTimeout = clock::now(); // set once only for timeout
}
}
};
@@ -94,25 +98,17 @@
void setBucketTimeout(int32_t bucketId) { m_buckets[bucketId].setTimeout(); }
};
-class ClientMetadataService : public ACE_Task_Base,
- private NonCopyable,
- private NonAssignable {
+class ClientMetadataService : private NonCopyable, private NonAssignable {
public:
- ~ClientMetadataService();
- explicit ClientMetadataService(Pool* pool);
+ ClientMetadataService() = delete;
+ explicit ClientMetadataService(ThinClientPoolDM* pool);
+ inline ~ClientMetadataService() noexcept = default;
- inline void start() {
- m_run = true;
- this->activate();
- }
+ void start();
- inline void stop() {
- m_run = false;
- m_regionQueueSema.release();
- this->wait();
- }
+ void stop();
- int svc(void);
+ void svc(void);
void getClientPRMetadata(const char* regionFullPath);
@@ -123,14 +119,9 @@
const std::shared_ptr<Serializable>& aCallbackArgument, bool isPrimary,
std::shared_ptr<BucketServerLocation>& serverLocation, int8_t& version);
- void removeBucketServerLocation(BucketServerLocation serverLocation);
-
std::shared_ptr<ClientMetadata> getClientMetadata(
const std::string& regionFullPath);
- void populateDummyServers(const char* regionName,
- std::shared_ptr<ClientMetadata> clientmetadata);
-
void enqueueForMetadataRefresh(const std::string& regionFullPath,
int8_t serverGroupFlag);
@@ -166,8 +157,6 @@
dereference_hash<std::shared_ptr<BucketServerLocation>>,
dereference_equal_to<std::shared_ptr<BucketServerLocation>>>
ServerToBucketsMap;
- // bool AreBucketSetsEqual(const BucketSet& currentBucketSet,
- // const BucketSet& bucketSet);
std::shared_ptr<BucketServerLocation> findNextServer(
const ServerToBucketsMap& serverToBucketsMap,
@@ -202,13 +191,6 @@
const BucketSet& buckets);
private:
- // const std::shared_ptr<PartitionResolver>& getResolver(const
- // std::shared_ptr<Region>& region, const std::shared_ptr<CacheableKey>& key,
- // const std::shared_ptr<Serializable>& aCallbackArgument);
-
- // BucketServerLocation getServerLocation(std::shared_ptr<ClientMetadata>
- // cptr, int bucketId, bool isPrimary);
-
std::shared_ptr<ClientMetadata> SendClientPRMetadata(
const char* regionPath, std::shared_ptr<ClientMetadata> cptr);
@@ -216,17 +198,17 @@
const std::shared_ptr<Region>& region);
private:
- // ACE_Recursive_Thread_Mutex m_regionMetadataLock;
- ACE_RW_Thread_Mutex m_regionMetadataLock;
- ClientMetadataService();
- ACE_Semaphore m_regionQueueSema;
+ std::thread m_thread;
+ boost::shared_mutex m_regionMetadataLock;
RegionMetadataMapType m_regionMetaDataMap;
- volatile bool m_run;
- Pool* m_pool;
- Queue<std::shared_ptr<std::string>> m_regionQueue;
-
- ACE_RW_Thread_Mutex m_PRbucketStatusLock;
- std::map<std::string, PRbuckets*> m_bucketStatus;
+ std::atomic<bool> m_run;
+ ThinClientPoolDM* m_pool;
+ CacheImpl* m_cache;
+ std::deque<std::string> m_regionQueue;
+ std::mutex m_regionQueueMutex;
+ std::condition_variable m_regionQueueCondition;
+ boost::shared_mutex m_PRbucketStatusLock;
+ std::map<std::string, std::unique_ptr<PRbuckets>> m_bucketStatus;
std::chrono::milliseconds m_bucketWaitTimeout;
static const char* NC_CMDSvcThread;
};
diff --git a/cppcache/src/ClientProxyMembershipID.cpp b/cppcache/src/ClientProxyMembershipID.cpp
index 54adfa9..8a0ee62 100644
--- a/cppcache/src/ClientProxyMembershipID.cpp
+++ b/cppcache/src/ClientProxyMembershipID.cpp
@@ -22,7 +22,7 @@
#include <memory>
#include <string>
-#include <ace/OS.h>
+#include <boost/process/environment.hpp>
#include <geode/CacheableBuiltins.hpp>
@@ -34,38 +34,19 @@
#define DCPORT 12334
#define VMKIND 13
#define ROLEARRLENGTH 0
-static int synch_counter = 2;
+
namespace apache {
namespace geode {
namespace client {
-namespace {
-static class RandomInitializer {
- public:
- RandomInitializer() {
- // using current time and
- // processor time would be good enough for our purpose
- auto seed = ACE_OS::getpid() + ACE_OS::gettimeofday().msec() + clock();
- seed += ACE_OS::gettimeofday().usec();
- // LOGINFO("PID %ld seed %ld ACE_OS::gettimeofday().usec() = %ld clock =
- // %ld ACE_OS::gettimeofday().msec() = %ld", pid, seed ,
- // ACE_OS::gettimeofday().usec() , clock(),
- // ACE_OS::gettimeofday().msec());
- ACE_OS::srand(seed);
- }
-} oneTimeRandomInitializer;
-} // namespace
+static int synch_counter = 2;
const int ClientProxyMembershipID::VERSION_MASK = 0x8;
const int8_t ClientProxyMembershipID::TOKEN_ORDINAL = -1;
ClientProxyMembershipID::ClientProxyMembershipID()
: m_hostPort(0),
- m_hostAddr(nullptr)
- /* adongre - Coverity II
- * CID 29278: Uninitialized scalar field (UNINIT_CTOR)
- */
- ,
+ m_hostAddr(nullptr),
m_hostAddrLen(0),
m_hostAddrLocalMem(false),
m_vmViewId(0) {}
@@ -79,7 +60,7 @@
uint32_t hostAddr, uint32_t hostPort, const char* durableClientId,
const std::chrono::seconds durableClntTimeOut)
: m_hostAddrAsUInt32(hostAddr) {
- int32_t vmPID = ACE_OS::getpid();
+ auto vmPID = boost::this_process::get_id();
initObjectVars(hostname, reinterpret_cast<uint8_t*>(&m_hostAddrAsUInt32), 4,
false, hostPort, durableClientId, durableClntTimeOut, DCPORT,
vmPID, VMKIND, 0, dsName.c_str(), randString.c_str(), 0);
@@ -90,7 +71,7 @@
ClientProxyMembershipID::ClientProxyMembershipID(
uint8_t* hostAddr, uint32_t hostAddrLen, uint32_t hostPort,
const char* dsname, const char* uniqueTag, uint32_t vmViewId) {
- int32_t vmPID = ACE_OS::getpid();
+ auto vmPID = boost::this_process::get_id();
initObjectVars("localhost", hostAddr, hostAddrLen, false, hostPort, "",
std::chrono::seconds::zero(), DCPORT, vmPID, VMKIND, 0, dsname,
uniqueTag, vmViewId);
@@ -152,15 +133,11 @@
reinterpret_cast<char*>(const_cast<uint8_t*>(m_memID.getBuffer(&len)));
m_memIDStr.append(buf, len);
- char PID[15] = {0};
- char Synch_Counter[15] = {0};
- ACE_OS::itoa(vPID, PID, 10);
- ACE_OS::itoa(synch_counter, Synch_Counter, 10);
clientID.append(hostname);
clientID.append("(");
- clientID.append(PID);
+ clientID.append(std::to_string(vPID));
clientID.append(":loner):");
- clientID.append(Synch_Counter);
+ clientID.append(std::to_string(synch_counter));
clientID.append(":");
clientID.append(getUniqueTag());
clientID.append(":");
@@ -169,19 +146,11 @@
// int offset = 0;
for (uint32_t i = 0; i < getHostAddrLen(); i++) {
- char hostInfo[16] = {0};
- // offset += ACE_OS::snprintf(hostInfo + offset , 255 - offset, ":%x",
- // m_hostAddr[i]);
- ACE_OS::itoa(m_hostAddr[i], hostInfo, 16);
m_hashKey.append(":");
- m_hashKey.append(hostInfo);
+ m_hashKey.append(std::to_string(m_hostAddr[i]));
}
m_hashKey.append(":");
- char hostInfoPort[16] = {0};
- ACE_OS::itoa(getHostPort(), hostInfoPort, 10);
- // offset += ACE_OS::snprintf(hostInfo + offset, 255 - offset , ":%d",
- // getHostPort());
- m_hashKey.append(hostInfoPort);
+ m_hashKey.append(std::to_string(getHostPort()));
m_hashKey.append(":");
m_hashKey.append(getDSName());
m_hashKey.append(":");
@@ -189,11 +158,7 @@
m_hashKey.append(getUniqueTag());
} else {
m_hashKey.append(":");
- char viewid[16] = {0};
- ACE_OS::itoa(m_vmViewId, viewid, 10);
- // offset += ACE_OS::snprintf(hostInfo + offset , 255 - offset , ":%d",
- // m_vmViewId);
- m_hashKey.append(viewid);
+ m_hashKey.append(std::to_string(m_vmViewId));
}
LOGDEBUG("GethashKey %s client id: %s ", m_hashKey.c_str(), clientID.c_str());
}
diff --git a/cppcache/src/ClientProxyMembershipID.hpp b/cppcache/src/ClientProxyMembershipID.hpp
index 55080c0..6d9a659 100644
--- a/cppcache/src/ClientProxyMembershipID.hpp
+++ b/cppcache/src/ClientProxyMembershipID.hpp
@@ -22,8 +22,6 @@
#include <string>
-#include <ace/OS.h>
-
#include <geode/DataOutput.hpp>
#include <geode/internal/functional.hpp>
#include <geode/internal/geode_globals.hpp>
@@ -92,8 +90,8 @@
char hostInfo[255] = {0};
uint32_t offset = 0;
for (uint32_t i = 0; i < getHostAddrLen(); i++) {
- offset += ACE_OS::snprintf(hostInfo + offset, 255 - offset, ":%x",
- m_hostAddr[i]);
+ offset +=
+ std::snprintf(hostInfo + offset, 255 - offset, ":%x", m_hostAddr[i]);
}
result +=
internal::geode_hash<std::string>{}(std::string(hostInfo, offset));
diff --git a/cppcache/src/ClientProxyMembershipIDFactory.cpp b/cppcache/src/ClientProxyMembershipIDFactory.cpp
index e54a055..62e6b6e 100644
--- a/cppcache/src/ClientProxyMembershipIDFactory.cpp
+++ b/cppcache/src/ClientProxyMembershipIDFactory.cpp
@@ -21,6 +21,8 @@
#include <iterator>
#include <random>
+#include <boost/process/environment.hpp>
+
#include "util/Log.hpp"
namespace apache {
@@ -43,7 +45,7 @@
std::generate_n(std::back_inserter(randString), 10,
[&]() { return alphabet[dist(rng)]; });
- auto pid = ACE_OS::getpid();
+ auto pid = boost::this_process::get_id();
randString.append(std::to_string(pid));
LOGINFO("Using %s as random data for ClientProxyMembershipID",
diff --git a/cppcache/src/ClientReplacementRequest.cpp b/cppcache/src/ClientReplacementRequest.cpp
index 953cc50..64a565f 100644
--- a/cppcache/src/ClientReplacementRequest.cpp
+++ b/cppcache/src/ClientReplacementRequest.cpp
@@ -29,8 +29,8 @@
this->m_serverLocation.toData(output);
}
-DSFid ClientReplacementRequest::getDSFID() const {
- return DSFid::ClientReplacementRequest;
+internal::DSFid ClientReplacementRequest::getDSFID() const {
+ return internal::DSFid::ClientReplacementRequest;
}
} // namespace client
diff --git a/cppcache/src/ClientReplacementRequest.hpp b/cppcache/src/ClientReplacementRequest.hpp
index a873455..e712284 100644
--- a/cppcache/src/ClientReplacementRequest.hpp
+++ b/cppcache/src/ClientReplacementRequest.hpp
@@ -23,10 +23,11 @@
#include <set>
#include <string>
+#include <geode/internal/DataSerializableFixedId.hpp>
+
#include "ClientConnectionRequest.hpp"
#include "ServerLocation.hpp"
#include "ServerLocationRequest.hpp"
-#include "TcrEndpoint.hpp"
namespace apache {
namespace geode {
@@ -43,7 +44,7 @@
~ClientReplacementRequest() override = default;
void toData(DataOutput& output) const override;
- DSFid getDSFID() const override;
+ internal::DSFid getDSFID() const override;
private:
const ServerLocation m_serverLocation;
diff --git a/cppcache/src/Condition.cpp b/cppcache/src/Condition.cpp
deleted file mode 100644
index 21e148f..0000000
--- a/cppcache/src/Condition.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "Condition.hpp"
-
-namespace apache {
-namespace geode {
-namespace client {
-
-/**
- * Create a Condition protected by the mutex provided.
- */
-Condition::Condition(ACE_Recursive_Thread_Mutex& mutex)
- : m_cond(mutex), m_signaled(false) {}
-
-bool Condition::waitUntil(ACE_Time_Value* absoluteStopTime) {
- ACE_OS::last_error(0);
-
- ACE_Time_Value stopAt = *absoluteStopTime;
- while ((!m_signaled) && (m_cond.wait(&stopAt) != 0) &&
- (ACE_OS::last_error() != ETIME)) {
- ACE_OS::last_error(0);
- stopAt = *absoluteStopTime;
- ACE_Time_Value now = ACE_OS::gettimeofday();
- if (now >= stopAt) {
- break;
- }
- }
- bool result = m_signaled;
- m_signaled = false;
- return result;
-}
-} // namespace client
-} // namespace geode
-} // namespace apache
diff --git a/cppcache/src/Condition.hpp b/cppcache/src/Condition.hpp
deleted file mode 100644
index e345212..0000000
--- a/cppcache/src/Condition.hpp
+++ /dev/null
@@ -1,81 +0,0 @@
-#pragma once
-
-#ifndef GEODE_CONDITION_H_
-#define GEODE_CONDITION_H_
-
-/*
- * 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 <ace/Condition_Recursive_Thread_Mutex.h>
-#include <ace/OS_NS_sys_time.h>
-
-#include <geode/internal/geode_globals.hpp>
-
-namespace apache {
-namespace geode {
-namespace client {
-
-/**
- * Condition wrapper when you want an absolute signal or timeout condition.
- */
-class APACHE_GEODE_EXPORT Condition {
- private:
- ACE_Condition<ACE_Recursive_Thread_Mutex> m_cond;
- bool m_signaled;
-
- public:
- /**
- * Create a Condition protected by the mutex provided.
- */
- explicit Condition(ACE_Recursive_Thread_Mutex& mutex);
-
- ~Condition() {}
-
- /**
- * Release the given mutex, and wait for condition to be signaled, then
- * re-acquire the mutex.
- * Returns true only if the condition is signaled.
- * Returns false only if the time is passed.
- */
- bool waitUntil(ACE_Time_Value* absoluteStopTime);
- /** Convenience to derive absolute time.
- */
- inline bool waitFor(uint32_t seconds) {
- ACE_Time_Value stopAt = ACE_OS::gettimeofday();
- stopAt += seconds;
- return waitUntil(&stopAt);
- }
-
- /**
- * The mutex for this condition should be locked/held by the thread calling
- * this signal method.
- */
- inline void signal() {
- m_signaled = true;
- m_cond.signal();
- }
-
- inline ACE_Recursive_Thread_Mutex& mutex() { return m_cond.mutex(); }
-
- /** Must be called with the mutex held. */
- inline void reset() { m_signaled = false; }
-};
-} // namespace client
-} // namespace geode
-} // namespace apache
-
-#endif // GEODE_CONDITION_H_
diff --git a/cppcache/src/CppCacheLibrary.cpp b/cppcache/src/CppCacheLibrary.cpp
index e3765a6..ada5d08 100644
--- a/cppcache/src/CppCacheLibrary.cpp
+++ b/cppcache/src/CppCacheLibrary.cpp
@@ -22,7 +22,6 @@
#include <ace/ACE.h>
#include <ace/Init_ACE.h>
#include <ace/Log_Msg.h>
-#include <ace/OS.h>
#include <ace/Singleton.h>
#include <geode/CacheFactory.hpp>
diff --git a/cppcache/src/CqAttributesImpl.cpp b/cppcache/src/CqAttributesImpl.cpp
index 6e1f35e..ae64452 100644
--- a/cppcache/src/CqAttributesImpl.cpp
+++ b/cppcache/src/CqAttributesImpl.cpp
@@ -26,7 +26,7 @@
namespace client {
CqAttributes::listener_container_type CqAttributesImpl::getCqListeners() {
- ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_mutex);
+ std::lock_guard<decltype(m_mutex)> _guard(m_mutex);
return m_cqListeners;
}
@@ -34,7 +34,7 @@
if (cql == nullptr) {
throw IllegalArgumentException("addCqListener parameter was null");
}
- ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_mutex);
+ std::lock_guard<decltype(m_mutex)> _guard(m_mutex);
m_cqListeners.push_back(cql);
}
@@ -53,7 +53,7 @@
decltype(m_cqListeners) oldListeners(m_cqListeners);
{
- ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_mutex);
+ std::lock_guard<decltype(m_mutex)> _guard(m_mutex);
m_cqListeners = addedListeners;
}
if (!oldListeners.empty()) {
@@ -75,7 +75,7 @@
if (cql == nullptr) {
throw IllegalArgumentException("removeCqListener parameter was null");
}
- ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_mutex);
+ std::lock_guard<decltype(m_mutex)> _guard(m_mutex);
if (!m_cqListeners.empty()) {
m_cqListeners.erase(
std::remove_if(
diff --git a/cppcache/src/CqAttributesImpl.hpp b/cppcache/src/CqAttributesImpl.hpp
index 2bd3e0c..26e80f9 100644
--- a/cppcache/src/CqAttributesImpl.hpp
+++ b/cppcache/src/CqAttributesImpl.hpp
@@ -1,8 +1,3 @@
-#pragma once
-
-#ifndef GEODE_CQATTRIBUTESIMPL_H_
-#define GEODE_CQATTRIBUTESIMPL_H_
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -20,19 +15,16 @@
* limitations under the License.
*/
-#include <ace/ACE.h>
-#include <ace/Condition_Recursive_Thread_Mutex.h>
-#include <ace/Guard_T.h>
-#include <ace/Recursive_Thread_Mutex.h>
-#include <ace/Time_Value.h>
+#pragma once
+
+#ifndef GEODE_CQATTRIBUTESIMPL_H_
+#define GEODE_CQATTRIBUTESIMPL_H_
+
+#include <mutex>
#include <geode/CqAttributes.hpp>
#include <geode/CqAttributesMutator.hpp>
-/**
- * @file
- */
-
namespace apache {
namespace geode {
namespace client {
@@ -70,8 +62,9 @@
private:
listener_container_type m_cqListeners;
bool m_dataPolicyHasBeenSet;
- ACE_Recursive_Thread_Mutex m_mutex;
+ std::recursive_mutex m_mutex;
};
+
} // namespace client
} // namespace geode
} // namespace apache
diff --git a/cppcache/src/CqEventImpl.cpp b/cppcache/src/CqEventImpl.cpp
index 222a19c..ada5619 100644
--- a/cppcache/src/CqEventImpl.cpp
+++ b/cppcache/src/CqEventImpl.cpp
@@ -14,10 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
#include "CqEventImpl.hpp"
#include <geode/CacheableString.hpp>
+#include "TcrConnectionManager.hpp"
#include "TcrMessage.hpp"
#include "ThinClientCacheDistributionManager.hpp"
#include "ThinClientPoolHADM.hpp"
@@ -92,7 +94,7 @@
std::string CqEventImpl::toString() {
char buffer[1024];
- ACE_OS::snprintf(
+ std::snprintf(
buffer, 1024,
"CqEvent CqName=%s; base operation=%d; cq operation= %d;key=%s;value=%s",
m_cQuery->getName().c_str(), static_cast<int>(m_baseOp),
diff --git a/cppcache/src/CqQueryImpl.cpp b/cppcache/src/CqQueryImpl.cpp
index d7e2bb5..a7eadf8 100644
--- a/cppcache/src/CqQueryImpl.cpp
+++ b/cppcache/src/CqQueryImpl.cpp
@@ -21,9 +21,9 @@
#include <geode/CqAttributesMutator.hpp>
#include <geode/ExceptionTypes.hpp>
-#include "ReadWriteLock.hpp"
#include "ResultSetImpl.hpp"
#include "StructSetImpl.hpp"
+#include "TcrConnectionManager.hpp"
#include "ThinClientRegion.hpp"
#include "UserAttributes.hpp"
#include "util/Log.hpp"
@@ -248,7 +248,7 @@
}
GfErrType CqQueryImpl::execute(TcrEndpoint* endpoint) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_mutex);
+ std::lock_guard<decltype(m_mutex)> _guard(m_mutex);
if (m_cqState != CqState::RUNNING) {
return GF_NOERR;
}
@@ -282,23 +282,13 @@
reply.getMessageType() == TcrMessage::CQ_EXCEPTION_TYPE) {
err = ThinClientRegion::handleServerException("CqQuery::execute(endpoint)",
reply.getException());
- /*
- if (err == GF_CACHESERVER_EXCEPTION) {
- throw CqQueryException("CqQuery::execute(endpoint): exception at the
- server side: ",
- reply.getException());
- }
- else {
- GfErrTypeToException("CqQuery::execute(endpoint)", err);
- }
- */
}
return err;
}
void CqQueryImpl::executeAfterFailover() {
- ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_mutex);
+ std::lock_guard<decltype(m_mutex)> _guard(m_mutex);
if (m_cqState != CqState::RUNNING) {
return;
}
@@ -311,10 +301,10 @@
gua.setAuthenticatedView(m_authenticatedView);
}
- ACE_Guard<ACE_Recursive_Thread_Mutex> guardRedundancy(
- *(m_tccdm->getRedundancyLock()));
+ auto& redundancyMutex = m_tccdm->getRedundancyLock();
+ std::lock_guard<decltype(redundancyMutex)> guardRedundancy(redundancyMutex);
- ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_mutex);
+ std::lock_guard<decltype(m_mutex)> _guard(m_mutex);
if (m_cqState == CqState::RUNNING) {
throw IllegalStateException("CqQuery::execute: cq is already running");
}
@@ -355,7 +345,7 @@
GfErrTypeToException("CqQuery::executeCq", err);
}
}
- ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_mutex);
+ std::lock_guard<decltype(m_mutex)> _guard(m_mutex);
m_cqState = CqState::RUNNING;
updateStats();
return true;
@@ -371,10 +361,10 @@
gua.setAuthenticatedView(m_authenticatedView);
}
- ACE_Guard<ACE_Recursive_Thread_Mutex> guardRedundancy(
- *(m_tccdm->getRedundancyLock()));
+ std::lock_guard<decltype(m_tccdm->getRedundancyLock())> guardRedundancy(
+ m_tccdm->getRedundancyLock());
- ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_mutex);
+ std::lock_guard<decltype(m_mutex)> _guard(m_mutex);
if (m_cqState == CqState::RUNNING) {
throw IllegalStateException(
"CqQuery::executeWithInitialResults: cq is already running");
@@ -519,7 +509,7 @@
if (isClosed()) {
throw CqClosedException(("CQ is closed, CqName : " + m_cqName).c_str());
}
- ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_mutex);
+ std::lock_guard<decltype(m_mutex)> _guard(m_mutex);
m_cqState = state;
}
@@ -566,7 +556,7 @@
* @return true if running, false otherwise
*/
bool CqQueryImpl::isRunning() const {
- ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_mutex);
+ std::lock_guard<decltype(m_mutex)> _guard(m_mutex);
return m_cqState == CqState::RUNNING;
}
@@ -575,7 +565,7 @@
* @return true if stopped, false otherwise
*/
bool CqQueryImpl::isStopped() const {
- ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_mutex);
+ std::lock_guard<decltype(m_mutex)> _guard(m_mutex);
return m_cqState == CqState::STOPPED ||
(m_authenticatedView && m_authenticatedView->isClosed());
}
@@ -585,7 +575,7 @@
* @return true if closed, false otherwise
*/
bool CqQueryImpl::isClosed() const {
- ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_mutex);
+ std::lock_guard<decltype(m_mutex)> _guard(m_mutex);
return m_cqState == CqState::CLOSED ||
(m_authenticatedView && m_authenticatedView->isClosed());
}
diff --git a/cppcache/src/CqQueryImpl.hpp b/cppcache/src/CqQueryImpl.hpp
index d4d27da..3c1b246 100644
--- a/cppcache/src/CqQueryImpl.hpp
+++ b/cppcache/src/CqQueryImpl.hpp
@@ -20,14 +20,9 @@
#ifndef GEODE_CQQUERYIMPL_H_
#define GEODE_CQQUERYIMPL_H_
+#include <mutex>
#include <string>
-#include <ace/ACE.h>
-#include <ace/Condition_Recursive_Thread_Mutex.h>
-#include <ace/Guard_T.h>
-#include <ace/Recursive_Thread_Mutex.h>
-#include <ace/Time_Value.h>
-
#include <geode/AuthenticatedView.hpp>
#include <geode/CqAttributes.hpp>
#include <geode/CqOperation.hpp>
@@ -39,7 +34,6 @@
#include "CqQueryVsdStats.hpp"
#include "CqService.hpp"
-#include "MapWithLock.hpp"
/**
* @file
@@ -271,7 +265,7 @@
private:
void updateStats();
- mutable ACE_Recursive_Thread_Mutex m_mutex;
+ mutable std::recursive_mutex m_mutex;
void sendStopOrClose(TcrMessage::MsgType requestType);
ThinClientBaseDM* m_tccdm;
AuthenticatedView* m_authenticatedView;
diff --git a/cppcache/src/CqService.cpp b/cppcache/src/CqService.cpp
index 51ec757..e872554 100644
--- a/cppcache/src/CqService.cpp
+++ b/cppcache/src/CqService.cpp
@@ -28,6 +28,7 @@
#include "CqQueryImpl.hpp"
#include "DistributedSystem.hpp"
#include "ReadWriteLock.hpp"
+#include "TcrConnectionManager.hpp"
#include "ThinClientPoolDM.hpp"
#include "util/exception.hpp"
@@ -41,14 +42,10 @@
m_statisticsFactory(statisticsFactory),
m_notificationSema(1),
m_stats(std::make_shared<CqServiceVsdStats>(m_statisticsFactory)) {
- m_cqQueryMap = new MapOfCqQueryWithLock();
m_running = true;
LOGDEBUG("CqService Started");
}
-CqService::~CqService() {
- if (m_cqQueryMap != nullptr) delete m_cqQueryMap;
- LOGDEBUG("CqService Destroyed");
-}
+CqService::~CqService() noexcept { LOGDEBUG("CqService Destroyed"); }
void CqService::updateStats() {
auto stats = std::dynamic_pointer_cast<CqServiceVsdStats>(m_stats);
@@ -56,14 +53,14 @@
stats->setNumCqsActive(0);
stats->setNumCqsStopped(0);
- MapOfRegionGuard guard(m_cqQueryMap->mutex());
+ auto&& lock = m_cqQueryMap.make_lock();
- stats->setNumCqsOnClient(static_cast<uint32_t>(m_cqQueryMap->current_size()));
+ stats->setNumCqsOnClient(static_cast<uint32_t>(m_cqQueryMap.size()));
- if (m_cqQueryMap->current_size() == 0) return;
+ if (m_cqQueryMap.empty()) return;
- for (auto q = m_cqQueryMap->begin(); q != m_cqQueryMap->end(); ++q) {
- auto cquery = ((*q).int_id_);
+ for (const auto& kv : m_cqQueryMap) {
+ auto& cquery = kv.second;
switch (cquery->getState()) {
case CqState::RUNNING:
stats->incNumCqsActive();
@@ -129,8 +126,7 @@
std::shared_ptr<UserAttributes> ua = nullptr;
if (m_tccdm != nullptr && m_tccdm->isMultiUserMode()) {
- ua =
- TSSUserAttributesWrapper::s_geodeTSSUserAttributes->getUserAttributes();
+ ua = UserAttributes::threadLocalUserAttributes;
}
auto cQuery = std::make_shared<CqQueryImpl>(
@@ -144,15 +140,9 @@
* Adds the given CQ and cqQuery object into the CQ map.
*/
void CqService::addCq(const std::string& cqName, std::shared_ptr<CqQuery>& cq) {
- try {
- MapOfRegionGuard guard(m_cqQueryMap->mutex());
- std::shared_ptr<CqQuery> tmp;
- if (0 == m_cqQueryMap->find(cqName, tmp)) {
- throw CqExistsException("CQ with given name already exists. ");
- }
- m_cqQueryMap->bind(cqName, cq);
- } catch (Exception& e) {
- throw e;
+ auto result = m_cqQueryMap.emplace(cqName, cq);
+ if (!result.second) {
+ throw CqExistsException("CQ with given name already exists. ");
}
}
@@ -160,12 +150,7 @@
* Removes given CQ from the cqMap..
*/
void CqService::removeCq(const std::string& cqName) {
- try {
- MapOfRegionGuard guard(m_cqQueryMap->mutex());
- m_cqQueryMap->unbind(cqName);
- } catch (Exception& e) {
- throw e;
- }
+ m_cqQueryMap.erase(cqName);
}
/**
@@ -173,12 +158,12 @@
* @return the CqQuery or null if not found
*/
std::shared_ptr<CqQuery> CqService::getCq(const std::string& cqName) {
- MapOfRegionGuard guard(m_cqQueryMap->mutex());
- std::shared_ptr<CqQuery> tmp;
- if (0 != m_cqQueryMap->find(cqName, tmp)) {
+ auto&& lock = m_cqQueryMap.make_lock();
+ const auto& found = m_cqQueryMap.find(cqName);
+ if (found == m_cqQueryMap.end()) {
LOGWARN("Failed to get the specified CQ: %s", cqName.c_str());
} else {
- return tmp;
+ return found->second;
}
return nullptr;
}
@@ -188,12 +173,7 @@
*/
void CqService::clearCqQueryMap() {
Log::fine("Cleaning clearCqQueryMap.");
- try {
- MapOfRegionGuard guard(m_cqQueryMap->mutex());
- m_cqQueryMap->unbind_all();
- } catch (Exception& e) {
- throw e;
- }
+ m_cqQueryMap.clear();
}
/**
@@ -201,11 +181,12 @@
*/
CqService::query_container_type CqService::getAllCqs() {
CqService::query_container_type cqVec;
- MapOfRegionGuard guard(m_cqQueryMap->mutex());
- if (m_cqQueryMap->current_size() == 0) return cqVec;
- cqVec.reserve(static_cast<int32_t>(m_cqQueryMap->current_size()));
- for (auto& q : *m_cqQueryMap) {
- cqVec.push_back(q.int_id_);
+ auto&& lock = m_cqQueryMap.make_lock();
+ if (!m_cqQueryMap.empty()) {
+ cqVec.reserve(m_cqQueryMap.size());
+ for (auto& kv : m_cqQueryMap) {
+ cqVec.push_back(kv.second);
+ }
}
return cqVec;
}
@@ -214,9 +195,7 @@
* Executes all the cqs on this client.
*/
void CqService::executeAllClientCqs(bool afterFailover) {
- // ACE_Guard< ACE_Recursive_Thread_Mutex > _guard( m_mutex );
query_container_type cqVec = getAllCqs();
- // MapOfRegionGuard guard( m_cqQueryMap->mutex() );
executeCqs(cqVec, afterFailover);
}
@@ -371,7 +350,7 @@
Log::fine("closeAllCqs()");
query_container_type cqVec = getAllCqs();
Log::fine("closeAllCqs() 1");
- MapOfRegionGuard guard(m_cqQueryMap->mutex());
+ auto&& lock = m_cqQueryMap.make_lock();
Log::fine("closeAllCqs() 2");
closeCqs(cqVec);
}
@@ -396,16 +375,9 @@
* @return true if exists else false.
*/
bool CqService::isCqExists(const std::string& cqName) {
- bool status = false;
- try {
- MapOfRegionGuard guard(m_cqQueryMap->mutex());
- std::shared_ptr<CqQuery> tmp;
- status = (0 == m_cqQueryMap->find(cqName, tmp));
- } catch (Exception& ex) {
- LOGFINE("Exception (%s) in isCQExists, ignored ",
- ex.what()); // Ignore.
- }
- return status;
+ auto&& lock = m_cqQueryMap.make_lock();
+
+ return m_cqQueryMap.find(cqName) != m_cqQueryMap.end();
}
void CqService::receiveNotification(TcrMessage* msg) {
invokeCqListeners(msg->getCqs(), msg->getMessageTypeForCq(), msg->getKey(),
diff --git a/cppcache/src/CqService.hpp b/cppcache/src/CqService.hpp
index d3b16db..5fed8de 100644
--- a/cppcache/src/CqService.hpp
+++ b/cppcache/src/CqService.hpp
@@ -21,15 +21,10 @@
#define GEODE_CQSERVICE_H_
#include <map>
+#include <mutex>
#include <string>
-#include <ace/ACE.h>
-#include <ace/Condition_Recursive_Thread_Mutex.h>
-#include <ace/Guard_T.h>
-#include <ace/Recursive_Thread_Mutex.h>
#include <ace/Semaphore.h>
-#include <ace/Task.h>
-#include <ace/Time_Value.h>
#include <geode/CacheableKey.hpp>
#include <geode/CqOperation.hpp>
@@ -38,27 +33,25 @@
#include "CqServiceVsdStats.hpp"
#include "DistributedSystem.hpp"
-#include "MapWithLock.hpp"
+#include "ErrType.hpp"
#include "NonCopyable.hpp"
#include "Queue.hpp"
#include "TcrMessage.hpp"
-#include "ThinClientBaseDM.hpp"
-
-/**
- * @file
- */
+#include "util/synchronized_map.hpp"
namespace apache {
namespace geode {
namespace client {
+class ThinClientBaseDM;
+class TcrEndpoint;
+
/**
* @class CqService CqService.hpp
*
* Implements the CqService functionality.
*
*/
-
class APACHE_GEODE_EXPORT CqService
: private NonCopyable,
private NonAssignable,
@@ -66,19 +59,16 @@
private:
ThinClientBaseDM* m_tccdm;
statistics::StatisticsFactory* m_statisticsFactory;
- ACE_Recursive_Thread_Mutex m_mutex;
- std::string m_queryString;
ACE_Semaphore m_notificationSema;
bool m_running;
- MapOfCqQueryWithLock* m_cqQueryMap;
+ synchronized_map<std::unordered_map<std::string, std::shared_ptr<CqQuery>>,
+ std::recursive_mutex>
+ m_cqQueryMap;
std::shared_ptr<CqServiceStatistics> m_stats;
- inline bool noCq() const {
- MapOfRegionGuard guard(m_cqQueryMap->mutex());
- return (0 == m_cqQueryMap->current_size());
- }
+ inline bool noCq() const { return m_cqQueryMap.empty(); }
public:
typedef std::vector<std::shared_ptr<CqQuery>> query_container_type;
@@ -88,10 +78,11 @@
*/
CqService(ThinClientBaseDM* tccdm,
statistics::StatisticsFactory* statisticsFactory);
+ ~CqService() noexcept;
+
ThinClientBaseDM* getDM() { return m_tccdm; }
void receiveNotification(TcrMessage* msg);
- ~CqService();
/**
* Returns the state of the cqService.
diff --git a/cppcache/src/DataOutput.cpp b/cppcache/src/DataOutput.cpp
index b672842..29b5470 100644
--- a/cppcache/src/DataOutput.cpp
+++ b/cppcache/src/DataOutput.cpp
@@ -17,9 +17,6 @@
#include <vector>
-#include <ace/Recursive_Thread_Mutex.h>
-#include <ace/TSS_T.h>
-
#include <geode/DataOutput.hpp>
#include <geode/SystemProperties.hpp>
@@ -34,7 +31,7 @@
namespace geode {
namespace client {
-ACE_Recursive_Thread_Mutex g_bigBufferLock;
+std::recursive_mutex globalBigBufferMutex;
size_t DataOutput::m_highWaterMark = 50 * 1024 * 1024;
size_t DataOutput::m_lowWaterMark = 8192;
@@ -93,7 +90,7 @@
m_buffers.push_back(desc);
}
- static ACE_TSS<TSSDataOutput> s_tssDataOutput;
+ static thread_local TSSDataOutput threadLocalBufferPool;
};
TSSDataOutput::TSSDataOutput() : m_buffers() {
@@ -109,7 +106,7 @@
}
}
-ACE_TSS<TSSDataOutput> TSSDataOutput::s_tssDataOutput;
+thread_local TSSDataOutput TSSDataOutput::threadLocalBufferPool;
DataOutput::DataOutput(const CacheImpl* cache, Pool* pool)
: m_size(0), m_haveBigBuffer(false), m_cache(cache), m_pool(pool) {
@@ -118,11 +115,11 @@
}
uint8_t* DataOutput::checkoutBuffer(size_t* size) {
- return TSSDataOutput::s_tssDataOutput->getBuffer(size);
+ return TSSDataOutput::threadLocalBufferPool.getBuffer(size);
}
void DataOutput::checkinBuffer(uint8_t* buffer, size_t size) {
- TSSDataOutput::s_tssDataOutput->poolBuffer(buffer, size);
+ TSSDataOutput::threadLocalBufferPool.poolBuffer(buffer, size);
}
void DataOutput::writeObjectInternal(const std::shared_ptr<Serializable>& ptr,
@@ -130,9 +127,9 @@
getSerializationRegistry().serialize(ptr, *this, isDelta);
}
-void DataOutput::acquireLock() { g_bigBufferLock.acquire(); }
+void DataOutput::acquireLock() { globalBigBufferMutex.lock(); }
-void DataOutput::releaseLock() { g_bigBufferLock.release(); }
+void DataOutput::releaseLock() { globalBigBufferMutex.unlock(); }
const SerializationRegistry& DataOutput::getSerializationRegistry() const {
return *m_cache->getSerializationRegistry();
diff --git a/cppcache/src/DiffieHellman.cpp b/cppcache/src/DiffieHellman.cpp
index d1790d5..fc0c81d 100644
--- a/cppcache/src/DiffieHellman.cpp
+++ b/cppcache/src/DiffieHellman.cpp
@@ -45,8 +45,8 @@
void* func = m_dll.symbol(function_name);
if (func == nullptr) {
char msg[1000];
- ACE_OS::snprintf(msg, 1000, "cannot find function %s in library %s",
- function_name, "cryptoImpl");
+ std::snprintf(msg, 1000, "cannot find function %s in library %s",
+ function_name, "cryptoImpl");
LOGERROR(msg);
throw IllegalStateException(msg);
}
@@ -64,7 +64,7 @@
if (m_dll.open(libName, ACE_DEFAULT_SHLIB_MODE, 0) == -1) {
char msg[1000];
- ACE_OS::snprintf(msg, 1000, "cannot open library: %s", libName);
+ std::snprintf(msg, 1000, "cannot open library: %s", libName);
LOGERROR(msg);
throw FileNotFoundException(msg);
}
@@ -102,13 +102,13 @@
if (error == DH_ERR_UNSUPPORTED_ALGO) { // Unsupported Algorithm
char msg[64] = {'\0'};
- ACE_OS::snprintf(msg, 64, "Algorithm %s is not supported.",
- dhAlgo->value().c_str());
+ std::snprintf(msg, 64, "Algorithm %s is not supported.",
+ dhAlgo->value().c_str());
throw IllegalArgumentException(msg);
} else if (error == DH_ERR_ILLEGAL_KEYSIZE) { // Illegal Key size
char msg[64] = {'\0'};
- ACE_OS::snprintf(msg, 64, "Illegal key size for algorithm %s.",
- dhAlgo->value().c_str());
+ std::snprintf(msg, 64, "Illegal key size for algorithm %s.",
+ dhAlgo->value().c_str());
throw IllegalArgumentException(msg);
} else if (m_dhCtx == nullptr) {
throw IllegalStateException(
diff --git a/cppcache/src/DiffieHellman.hpp b/cppcache/src/DiffieHellman.hpp
index 31d3238..234cac9 100644
--- a/cppcache/src/DiffieHellman.hpp
+++ b/cppcache/src/DiffieHellman.hpp
@@ -22,8 +22,6 @@
#include <string>
#include <ace/DLL.h>
-#include <ace/OS.h>
-#include <ace/Recursive_Thread_Mutex.h>
#include <geode/CacheableBuiltins.hpp>
#include <geode/Properties.hpp>
diff --git a/cppcache/src/DiskStoreId.cpp b/cppcache/src/DiskStoreId.cpp
index 3fa024b..802efae 100644
--- a/cppcache/src/DiskStoreId.cpp
+++ b/cppcache/src/DiskStoreId.cpp
@@ -17,32 +17,19 @@
#include "DiskStoreId.hpp"
-#include <inttypes.h>
-
-#include <ace/OS.h>
-
namespace apache {
namespace geode {
namespace client {
+
std::string DiskStoreId::getHashKey() {
- if (m_hashCode.size() == 0) {
- char hashCode[128] = {0};
- /* adongre - Coverity II
- * CID 29207: Calling risky function (SECURE_CODING)[VERY RISKY]. Using
- * "sprintf" can cause a
- * buffer overflow when done incorrectly. Because sprintf() assumes an
- * arbitrarily long string,
- * callers must be careful not to overflow the actual space of the
- * destination.
- * Use snprintf() instead, or correct precision specifiers.
- * Fix : using ACE_OS::snprintf
- */
- ACE_OS::snprintf(hashCode, 128, "%" PRIx64 "_%" PRIx64, m_mostSig,
- m_leastSig);
- m_hashCode.append(hashCode);
+ if (m_hashCode.empty()) {
+ m_hashCode.append(std::to_string(m_mostSig))
+ .append("_")
+ .append(std::to_string(m_leastSig));
}
return m_hashCode;
}
+
} // namespace client
} // namespace geode
} // namespace apache
diff --git a/cppcache/src/DistributedSystem.cpp b/cppcache/src/DistributedSystem.cpp
index c275d0f..41ae8fb 100644
--- a/cppcache/src/DistributedSystem.cpp
+++ b/cppcache/src/DistributedSystem.cpp
@@ -17,10 +17,6 @@
#include "DistributedSystem.hpp"
-#include <ace/Guard_T.h>
-#include <ace/OS.h>
-#include <ace/Recursive_Thread_Mutex.h>
-
#include <geode/CacheFactory.hpp>
#include <geode/DataOutput.hpp>
#include <geode/SystemProperties.hpp>
diff --git a/cppcache/src/DistributedSystemImpl.cpp b/cppcache/src/DistributedSystemImpl.cpp
index 9681882..a648232 100644
--- a/cppcache/src/DistributedSystemImpl.cpp
+++ b/cppcache/src/DistributedSystemImpl.cpp
@@ -17,16 +17,22 @@
#include "DistributedSystemImpl.hpp"
+#if defined(HAVE_PTHREAD_H)
+#include <pthread.h>
+#elif defined(_WIN32)
+#include <windows.h>
+#endif
+
+#include <boost/filesystem.hpp>
+
#include <geode/SystemProperties.hpp>
#include "CacheImpl.hpp"
#include "CacheRegionHelper.hpp"
#include "CppCacheLibrary.hpp"
-#include "DiffieHellman.hpp"
#include "PoolStatistics.hpp"
#include "RegionStats.hpp"
#include "config.h"
-#include "statistics/StatisticsManager.hpp"
#include "util/Log.hpp"
#include "version.h"
@@ -36,7 +42,7 @@
volatile bool DistributedSystemImpl::m_isCliCallbackSet = false;
std::map<int, CliCallbackMethod> DistributedSystemImpl::m_cliCallbackMap;
-ACE_Recursive_Thread_Mutex DistributedSystemImpl::m_cliCallbackLock;
+std::recursive_mutex DistributedSystemImpl::m_cliCallbackLock;
DistributedSystemImpl::DistributedSystemImpl(
std::string name, DistributedSystem* implementee,
@@ -81,20 +87,12 @@
LOGCONFIG(
"Running on: SystemName=%s Machine=%s Host=%s Release=%s Version=%s",
u.sysname, u.machine, u.nodename, u.release, u.version);
-
-#ifdef _WIN32
- const uint32_t pathMax = _MAX_PATH;
-#else
- const uint32_t pathMax = PATH_MAX;
-#endif
- ACE_TCHAR cwd[pathMax + 1];
- (void)ACE_OS::getcwd(cwd, pathMax);
- LOGCONFIG("Current directory: %s", cwd);
- LOGCONFIG("Current value of PATH: %s", ACE_OS::getenv("PATH"));
+ LOGCONFIG("Current directory: %s",
+ boost::filesystem::current_path().string().c_str());
+ LOGCONFIG("Current value of PATH: %s", Utils::getEnv("PATH").c_str());
#ifndef _WIN32
- const char* ld_libpath = ACE_OS::getenv("LD_LIBRARY_PATH");
LOGCONFIG("Current library path: %s",
- ld_libpath == nullptr ? "nullptr" : ld_libpath);
+ Utils::getEnv("LD_LIBRARY_PATH").c_str());
#endif
// Log the Geode system properties
m_sysProps->logSettings();
@@ -122,7 +120,8 @@
const std::string& DistributedSystemImpl::getName() const { return m_name; }
void DistributedSystemImpl::CallCliCallBack(Cache& cache) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> disconnectGuard(m_cliCallbackLock);
+ std::lock_guard<decltype(m_cliCallbackLock)> disconnectGuard(
+ m_cliCallbackLock);
if (m_isCliCallbackSet == true) {
for (const auto& iter : m_cliCallbackMap) {
iter.second(cache);
@@ -132,13 +131,15 @@
void DistributedSystemImpl::registerCliCallback(int appdomainId,
CliCallbackMethod clicallback) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> disconnectGuard(m_cliCallbackLock);
+ std::lock_guard<decltype(m_cliCallbackLock)> disconnectGuard(
+ m_cliCallbackLock);
m_cliCallbackMap[appdomainId] = clicallback;
m_isCliCallbackSet = true;
}
void DistributedSystemImpl::unregisterCliCallback(int appdomainId) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> disconnectGuard(m_cliCallbackLock);
+ std::lock_guard<decltype(m_cliCallbackLock)> disconnectGuard(
+ m_cliCallbackLock);
auto iter = m_cliCallbackMap.find(appdomainId);
if (iter != m_cliCallbackMap.end()) {
m_cliCallbackMap.erase(iter);
@@ -146,6 +147,43 @@
}
}
+void DistributedSystemImpl::setThreadName(const std::string& threadName) {
+ if (threadName.empty()) {
+ throw IllegalArgumentException("Thread name is empty.");
+ }
+
+#if defined(HAVE_pthread_setname_np)
+
+ pthread_setname_np(threadName.c_str());
+
+#elif defined(_WIN32)
+
+ const DWORD MS_VC_EXCEPTION = 0x406D1388;
+
+#pragma pack(push, 8)
+ typedef struct tagTHREADNAME_INFO {
+ DWORD dwType; // Must be 0x1000.
+ LPCSTR szName; // Pointer to name (in user addr space).
+ DWORD dwThreadID; // Thread ID (-1=caller thread).
+ DWORD dwFlags; // Reserved for future use, must be zero.
+ } THREADNAME_INFO;
+#pragma pack(pop)
+
+ THREADNAME_INFO info;
+ info.dwType = 0x1000;
+ info.szName = threadName.c_str();
+ info.dwThreadID = -1;
+ info.dwFlags = 0;
+
+ __try {
+ RaiseException(MS_VC_EXCEPTION, 0, sizeof(info) / sizeof(ULONG_PTR),
+ (ULONG_PTR*)&info);
+ } __except (EXCEPTION_EXECUTE_HANDLER) {
+ }
+
+#endif
+}
+
} // namespace client
} // namespace geode
} // namespace apache
diff --git a/cppcache/src/DistributedSystemImpl.hpp b/cppcache/src/DistributedSystemImpl.hpp
index e469627..ff3e2cc 100644
--- a/cppcache/src/DistributedSystemImpl.hpp
+++ b/cppcache/src/DistributedSystemImpl.hpp
@@ -20,56 +20,35 @@
#ifndef GEODE_DISTRIBUTEDSYSTEMIMPL_H_
#define GEODE_DISTRIBUTEDSYSTEMIMPL_H_
-/**
- * @file
- */
-
#include <map>
#include <memory>
+#include <mutex>
#include <string>
-#include <ace/Guard_T.h>
-#include <ace/OS.h>
-#include <ace/Recursive_Thread_Mutex.h>
-
#include <geode/internal/geode_globals.hpp>
#include "DiffieHellman.hpp"
#include "DistributedSystem.hpp"
#include "statistics/StatisticsManager.hpp"
-#ifdef __linux
-#include <sys/prctl.h>
-#endif
-
namespace apache {
namespace geode {
namespace client {
+
class SystemProperties;
+class DistributedSystemImpl;
+
+using CliCallbackMethod = std::function<void(Cache&)>;
+
/**
* @class DistributedSystemImpl DistributedSystemImpl.hpp
* A "connection" to a Geode distributed system.
* The connection will be through a (host, port) pair.
*/
-
-class DistributedSystemImpl;
-
-using CliCallbackMethod = std::function<void(Cache&)>;
-
class APACHE_GEODE_EXPORT DistributedSystemImpl {
- /**
- * @brief public methods
- */
public:
- static void setThreadName(const std::string& threadName) {
- if (threadName.empty()) {
- throw IllegalArgumentException("Thread name is empty.");
- }
-#ifdef __linux
- prctl(PR_SET_NAME, threadName.c_str(), 0, 0, 0);
-#endif
- }
+ static void setThreadName(const std::string& threadName);
/**
* @brief destructor
@@ -107,12 +86,13 @@
static void CallCliCallBack(Cache& cache);
private:
- static ACE_Recursive_Thread_Mutex m_cliCallbackLock;
+ static std::recursive_mutex m_cliCallbackLock;
static volatile bool m_isCliCallbackSet;
static std::map<int, CliCallbackMethod> m_cliCallbackMap;
std::unique_ptr<SystemProperties> m_sysProps;
bool m_connected;
};
+
} // namespace client
} // namespace geode
} // namespace apache
diff --git a/cppcache/src/EntryExpiryHandler.cpp b/cppcache/src/EntryExpiryHandler.cpp
index 253b954..cc02155 100644
--- a/cppcache/src/EntryExpiryHandler.cpp
+++ b/cppcache/src/EntryExpiryHandler.cpp
@@ -17,15 +17,16 @@
#include "EntryExpiryHandler.hpp"
+#include <ace/Reactor.h>
+#include <ace/Timer_Heap.h>
+#include <ace/Timer_Heap_T.h>
+#include <ace/Timer_Queue.h>
+#include <ace/Timer_Queue_Adapters.h>
+#include <ace/svc_export.h>
+
#include "CacheImpl.hpp"
#include "ExpiryTaskManager.hpp"
#include "RegionInternal.hpp"
-#include "ace/Reactor.h"
-#include "ace/Timer_Heap.h"
-#include "ace/Timer_Heap_T.h"
-#include "ace/Timer_Queue.h"
-#include "ace/Timer_Queue_Adapters.h"
-#include "ace/svc_export.h"
namespace apache {
namespace geode {
diff --git a/cppcache/src/EventId.cpp b/cppcache/src/EventId.cpp
index 46b0a1e..a6db548 100644
--- a/cppcache/src/EventId.cpp
+++ b/cppcache/src/EventId.cpp
@@ -120,7 +120,7 @@
EventId::EventId(char* memId, uint32_t memIdLen, int64_t thr, int64_t seq) {
// TODO: statics being assigned; not thread-safe??
- ACE_OS::memcpy(m_eidMem, memId, memIdLen);
+ std::memcpy(m_eidMem, memId, memIdLen);
m_eidMemLen = memIdLen;
m_eidThr = thr;
m_eidSeq = seq;
diff --git a/cppcache/src/EventIdMap.cpp b/cppcache/src/EventIdMap.cpp
index 5b960c5..6fe069e 100644
--- a/cppcache/src/EventIdMap.cpp
+++ b/cppcache/src/EventIdMap.cpp
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
#include "EventIdMap.hpp"
namespace apache {
@@ -27,7 +28,8 @@
}
void EventIdMap::clear() {
- GUARD_MAP;
+ std::lock_guard<decltype(m_lock)> guard(m_lock);
+
m_map.clear();
}
@@ -40,9 +42,9 @@
bool EventIdMap::isDuplicate(std::shared_ptr<EventSource> key,
std::shared_ptr<EventSequence> value) {
- GUARD_MAP;
- const auto& entry = m_map.find(key);
+ std::lock_guard<decltype(m_lock)> guard(m_lock);
+ const auto& entry = m_map.find(key);
if (entry != m_map.end() && ((*value) <= (*(entry->second)))) {
return true;
}
@@ -51,12 +53,11 @@
bool EventIdMap::put(std::shared_ptr<EventSource> key,
std::shared_ptr<EventSequence> value, bool onlynew) {
- GUARD_MAP;
+ std::lock_guard<decltype(m_lock)> guard(m_lock);
value->touch(m_expiry);
const auto& entry = m_map.find(key);
-
if (entry != m_map.end()) {
if (onlynew && ((*value) <= (*(entry->second)))) {
return false;
@@ -71,10 +72,9 @@
}
bool EventIdMap::touch(std::shared_ptr<EventSource> key) {
- GUARD_MAP;
+ std::lock_guard<decltype(m_lock)> guard(m_lock);
const auto& entry = m_map.find(key);
-
if (entry != m_map.end()) {
entry->second->touch(m_expiry);
return true;
@@ -84,7 +84,7 @@
}
bool EventIdMap::remove(std::shared_ptr<EventSource> key) {
- GUARD_MAP;
+ std::lock_guard<decltype(m_lock)> guard(m_lock);
const auto& entry = m_map.find(key);
@@ -98,7 +98,7 @@
// side-effect: sets acked flags to true
EventIdMapEntryList EventIdMap::getUnAcked() {
- GUARD_MAP;
+ std::lock_guard<decltype(m_lock)> guard(m_lock);
EventIdMapEntryList entries;
@@ -115,7 +115,7 @@
}
uint32_t EventIdMap::clearAckedFlags(EventIdMapEntryList& entries) {
- GUARD_MAP;
+ std::lock_guard<decltype(m_lock)> guard(m_lock);
uint32_t cleared = 0;
@@ -132,27 +132,24 @@
}
uint32_t EventIdMap::expire(bool onlyacked) {
- GUARD_MAP;
+ std::lock_guard<decltype(m_lock)> guard(m_lock);
uint32_t expired = 0;
EventIdMapEntryList entries;
- ACE_Time_Value current = ACE_OS::gettimeofday();
-
for (const auto& entry : m_map) {
if (onlyacked && !entry.second->getAcked()) {
continue;
}
- if (entry.second->getDeadline() < current) {
+ if (entry.second->getDeadline() < EventSequence::clock::now()) {
entries.push_back(std::make_pair(entry.first, entry.second));
}
}
- for (EventIdMapEntryList::iterator expiry = entries.begin();
- expiry != entries.end(); expiry++) {
- m_map.erase((*expiry).first);
+ for (auto&& expiry : entries) {
+ m_map.erase(expiry.first);
expired++;
}
@@ -162,7 +159,7 @@
void EventSequence::init() {
m_seqNum = -1;
m_acked = false;
- m_deadline = ACE_OS::gettimeofday();
+ m_deadline = clock::now();
}
void EventSequence::clear() { init(); }
@@ -177,8 +174,7 @@
EventSequence::~EventSequence() { clear(); }
void EventSequence::touch(std::chrono::milliseconds ageSecs) {
- m_deadline = ACE_OS::gettimeofday();
- m_deadline += ageSecs;
+ m_deadline = clock::now() + ageSecs;
}
void EventSequence::touch(int64_t seqNum, std::chrono::milliseconds ageSecs) {
@@ -195,11 +191,9 @@
void EventSequence::setAcked(bool acked) { m_acked = acked; }
-ACE_Time_Value EventSequence::getDeadline() { return m_deadline; }
+EventSequence::time_point EventSequence::getDeadline() { return m_deadline; }
-void EventSequence::setDeadline(ACE_Time_Value deadline) {
- m_deadline = deadline;
-}
+void EventSequence::setDeadline(time_point deadline) { m_deadline = deadline; }
bool EventSequence::operator<=(const EventSequence& rhs) const {
return this->m_seqNum <= (&rhs)->m_seqNum;
diff --git a/cppcache/src/EventIdMap.hpp b/cppcache/src/EventIdMap.hpp
index 4b2805a..6ec3379 100644
--- a/cppcache/src/EventIdMap.hpp
+++ b/cppcache/src/EventIdMap.hpp
@@ -20,17 +20,14 @@
#ifndef GEODE_EVENTIDMAP_H_
#define GEODE_EVENTIDMAP_H_
+#include <chrono>
#include <functional>
#include <memory>
+#include <mutex>
#include <unordered_map>
#include <utility>
#include <vector>
-#include <ace/ACE.h>
-#include <ace/Guard_T.h>
-#include <ace/Recursive_Thread_Mutex.h>
-#include <ace/Time_Value.h>
-
#include <geode/internal/functional.hpp>
#include "EventId.hpp"
@@ -47,10 +44,6 @@
EventIdMapEntry;
typedef std::vector<EventIdMapEntry> EventIdMapEntryList;
-typedef ACE_Guard<ACE_Recursive_Thread_Mutex> MapGuard;
-
-#define GUARD_MAP MapGuard mapguard(m_lock)
-
/** @class EventIdMap EventIdMap.hpp
*
* This is the class that encapsulates a HashMap and
@@ -67,7 +60,7 @@
std::chrono::milliseconds m_expiry;
map_type m_map;
- ACE_Recursive_Thread_Mutex m_lock;
+ std::recursive_mutex m_lock;
// hidden
EventIdMap(const EventIdMap &);
@@ -135,9 +128,14 @@
* a flag indicating whether or not it is ACKed
*/
class APACHE_GEODE_EXPORT EventSequence {
+ public:
+ using clock = std::chrono::steady_clock;
+ using time_point = clock::time_point;
+
+ private:
int64_t m_seqNum;
bool m_acked;
- ACE_Time_Value m_deadline; // current time plus the expiration delay (age)
+ time_point m_deadline; // current time plus the expiration delay (age)
void init();
@@ -161,8 +159,8 @@
bool getAcked();
void setAcked(bool acked);
- ACE_Time_Value getDeadline();
- void setDeadline(ACE_Time_Value deadline);
+ time_point getDeadline();
+ void setDeadline(time_point deadline);
bool operator<=(const EventSequence &rhs) const;
};
diff --git a/cppcache/src/EventSource.cpp b/cppcache/src/EventSource.cpp
index d303416..7b9b5cc 100644
--- a/cppcache/src/EventSource.cpp
+++ b/cppcache/src/EventSource.cpp
@@ -14,6 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
+#include <ace/ACE.h>
+
#include "EventIdMap.hpp"
namespace apache {
diff --git a/cppcache/src/EvictionController.cpp b/cppcache/src/EvictionController.cpp
index 52aac5c..10b4a1c 100644
--- a/cppcache/src/EvictionController.cpp
+++ b/cppcache/src/EvictionController.cpp
@@ -17,13 +17,16 @@
#include "EvictionController.hpp"
-#include <string>
+#include <chrono>
+
+#include <boost/thread/lock_types.hpp>
#include "CacheImpl.hpp"
#include "CacheRegionHelper.hpp"
#include "DistributedSystem.hpp"
#include "ReadWriteLock.hpp"
#include "RegionInternal.hpp"
+#include "util/Log.hpp"
namespace apache {
namespace geode {
@@ -36,45 +39,61 @@
m_maxHeapSize(maxHeapSize * 1024 * 1024),
m_heapSizeDelta(heapSizeDelta),
m_cacheImpl(cache),
- m_currentHeapSize(0) {
- evictionThreadPtr = new EvictionThread(this);
+ m_currentHeapSize(0),
+ m_evictionThread(this) {
LOGINFO("Maximum heap size for Heap LRU set to %ld bytes", m_maxHeapSize);
- // m_currentHeapSize =
- // DistributedSystem::getSystemProperties()->gfHighWaterMark(),
- // DistributedSystem::getSystemProperties()->gfMessageSize();
}
-EvictionController::~EvictionController() {
- _GEODE_SAFE_DELETE(evictionThreadPtr);
+void EvictionController::start() {
+ m_evictionThread.start();
+
+ m_run = true;
+ m_thread = std::thread(&EvictionController::svc, this);
+
+ LOGFINE("Eviction Controller started");
+}
+
+void EvictionController::stop() {
+ m_run = false;
+ m_queueCondition.notify_one();
+ m_thread.join();
+
+ m_evictionThread.stop();
+
+ m_regions.clear();
+ m_queue.clear();
+
+ LOGFINE("Eviction controller stopped");
+}
+
+void EvictionController::svc() {
+ DistributedSystemImpl::setThreadName(NC_EC_Thread);
+
+ int64_t pendingEvictions = 0;
+
+ while (m_run) {
+ std::unique_lock<std::mutex> lock(m_queueMutex);
+ m_queueCondition.wait(lock, [this] { return !m_run || !m_queue.empty(); });
+
+ while (!m_queue.empty()) {
+ auto readInfo = m_queue.front();
+ m_queue.pop_front();
+ if (0 != readInfo) {
+ processHeapInfo(readInfo, pendingEvictions);
+ }
+ }
+ }
}
void EvictionController::updateRegionHeapInfo(int64_t info) {
- // LOGINFO("updateRegionHeapInfo is %d", info);
- m_queue.put(info);
+ std::unique_lock<std::mutex> lock(m_queueMutex);
+ m_queue.push_back(info);
+ m_queueCondition.notify_one();
+
// We could block here if we wanted to prevent any further memory use
// until the evictions had been completed.
}
-int EvictionController::svc() {
- DistributedSystemImpl::setThreadName(NC_EC_Thread);
- int64_t pendingEvictions = 0;
- while (m_run) {
- int64_t readInfo = 0;
- readInfo = m_queue.get(1500);
- if (readInfo == 0) continue;
-
- processHeapInfo(readInfo, pendingEvictions);
- }
- int32_t size = m_queue.size();
- for (int i = 0; i < size; i++) {
- int64_t readInfo = 0;
- readInfo = m_queue.get();
- if (readInfo == 0) continue;
- processHeapInfo(readInfo, pendingEvictions);
- }
- return 1;
-}
-
void EvictionController::processHeapInfo(int64_t& readInfo,
int64_t& pendingEvictions) {
m_currentHeapSize += readInfo;
@@ -113,31 +132,29 @@
}
}
-void EvictionController::registerRegion(std::string& name) {
- WriteGuard guard(m_regionLock);
+void EvictionController::registerRegion(const std::string& name) {
+ boost::unique_lock<decltype(m_regionLock)> lock(m_regionLock);
m_regions.push_back(name);
- LOGFINE("Registered region with Heap LRU eviction controller: name is %s",
- name.c_str());
+ LOGFINE("Registered region with Heap LRU eviction controller: name is " +
+ name);
}
-void EvictionController::deregisterRegion(std::string& name) {
+void EvictionController::deregisterRegion(const std::string& name) {
// Iterate over regions vector and remove the one that we need to remove
- WriteGuard guard(m_regionLock);
- for (size_t i = 0; i < m_regions.size(); i++) {
- std::string str = m_regions.at(i);
- if (str == name) {
- std::vector<std::string>::iterator iter = m_regions.begin();
- m_regions.erase(iter + i);
- LOGFINE(
- "Deregistered region with Heap LRU eviction controller: name is %s",
- name.c_str());
- break;
- }
+ boost::unique_lock<decltype(m_regionLock)> lock(m_regionLock);
+
+ const auto& removed =
+ std::remove_if(m_regions.begin(), m_regions.end(),
+ [&](const std::string& region) { return region == name; });
+ if (removed != m_regions.cend()) {
+ LOGFINE("Deregistered region with Heap LRU eviction controller: name is " +
+ name);
}
+ m_regions.erase(removed, m_regions.cend());
}
void EvictionController::orderEvictions(int32_t percentage) {
- evictionThreadPtr->putEvictionInfo(percentage);
+ m_evictionThread.putEvictionInfo(percentage);
}
void EvictionController::evict(int32_t percentage) {
@@ -149,25 +166,23 @@
// On the flip side, this requires a copy of the registered region list
// every time eviction is ordered and that might not be cheap
//@TODO: Discuss with team
- VectorOfString regionTempVector;
+
+ decltype(m_regions) regionTempVector;
{
- ReadGuard guard(m_regionLock);
- for (size_t i = 0; i < m_regions.size(); i++) {
- regionTempVector.push_back(m_regions.at(i));
- }
+ boost::shared_lock<decltype(m_regionLock)> lock(m_regionLock);
+ regionTempVector.reserve(m_regions.size());
+ regionTempVector.insert(regionTempVector.end(), m_regions.begin(),
+ m_regions.end());
}
- for (size_t i = 0; i < regionTempVector.size(); i++) {
- std::string region_name = regionTempVector.at(i);
- auto region = m_cacheImpl->getRegion(region_name);
- if (region != nullptr) {
- RegionInternal* regionImpl = dynamic_cast<RegionInternal*>(region.get());
- if (regionImpl != nullptr) {
- regionImpl->evict(percentage);
- }
+ for (const auto& regionName : regionTempVector) {
+ if (auto region = std::dynamic_pointer_cast<RegionInternal>(
+ m_cacheImpl->getRegion(regionName))) {
+ region->evict(percentage);
}
}
}
+
} // namespace client
} // namespace geode
} // namespace apache
diff --git a/cppcache/src/EvictionController.hpp b/cppcache/src/EvictionController.hpp
index 6529d48..9e7ae72 100644
--- a/cppcache/src/EvictionController.hpp
+++ b/cppcache/src/EvictionController.hpp
@@ -1,8 +1,3 @@
-#pragma once
-
-#ifndef GEODE_EVICTIONCONTROLLER_H_
-#define GEODE_EVICTIONCONTROLLER_H_
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -20,21 +15,27 @@
* limitations under the License.
*/
-#include <memory>
+#pragma once
+
+#ifndef GEODE_EVICTIONCONTROLLER_H_
+#define GEODE_EVICTIONCONTROLLER_H_
+
+#include <atomic>
+#include <condition_variable>
+#include <mutex>
#include <string>
+#include <thread>
#include <vector>
-#include <ace/ACE.h>
-#include <ace/OS.h>
-#include <ace/Singleton.h>
-#include <ace/Task.h>
-#include <ace/Thread_Mutex.h>
-
-#include <geode/DataOutput.hpp>
+#include <boost/thread/shared_mutex.hpp>
#include "EvictionThread.hpp"
-#include "IntQueue.hpp"
-#include "util/Log.hpp"
+
+namespace apache {
+namespace geode {
+namespace client {
+
+class CacheImpl;
/**
* This class ensures that the cache consumes only as much memory as
@@ -61,46 +62,22 @@
* When a region is destroyed, it deregisters itself with the EvictionController
* Format of object that is put into the region map (int size, int numEntries)
*/
-namespace apache {
-namespace geode {
-namespace client {
-
-typedef IntQueue<int64_t> HeapSizeInfoQueue;
-typedef std::vector<std::string> VectorOfString;
-
-class EvictionController;
-class EvictionThread;
-class CacheImpl;
-
-class APACHE_GEODE_EXPORT EvictionController : public ACE_Task_Base {
+class EvictionController {
public:
EvictionController(size_t maxHeapSize, int32_t heapSizeDelta,
CacheImpl* cache);
- ~EvictionController();
+ inline ~EvictionController() noexcept = default;
- inline void start() {
- m_run = true;
- evictionThreadPtr->start();
- this->activate();
- LOGFINE("Eviction Controller started");
- }
+ void start();
- inline void stop() {
- m_run = false;
- evictionThreadPtr->stop();
- this->wait();
- m_regions.clear();
- m_queue.clear();
+ void stop();
- LOGFINE("Eviction controller stopped");
- }
-
- int svc(void);
+ void svc(void);
void updateRegionHeapInfo(int64_t info);
- void registerRegion(std::string& name);
- void deregisterRegion(std::string& name);
+ void registerRegion(const std::string& name);
+ void deregisterRegion(const std::string& name);
void evict(int32_t percentage);
private:
@@ -108,17 +85,21 @@
void processHeapInfo(int64_t& readInfo, int64_t& pendingEvictions);
private:
- bool m_run;
+ std::thread m_thread;
+ std::atomic<bool> m_run;
int64_t m_maxHeapSize;
int64_t m_heapSizeDelta;
CacheImpl* m_cacheImpl;
int64_t m_currentHeapSize;
- HeapSizeInfoQueue m_queue;
- VectorOfString m_regions;
- mutable ACE_RW_Thread_Mutex m_regionLock;
- EvictionThread* evictionThreadPtr;
+ std::deque<int64_t> m_queue;
+ std::mutex m_queueMutex;
+ std::condition_variable m_queueCondition;
+ std::vector<std::string> m_regions;
+ boost::shared_mutex m_regionLock;
+ EvictionThread m_evictionThread;
static const char* NC_EC_Thread;
};
+
} // namespace client
} // namespace geode
} // namespace apache
diff --git a/cppcache/src/EvictionThread.cpp b/cppcache/src/EvictionThread.cpp
index b658bf5..fcdc9e7 100644
--- a/cppcache/src/EvictionThread.cpp
+++ b/cppcache/src/EvictionThread.cpp
@@ -14,44 +14,63 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
#include "EvictionThread.hpp"
+#include <chrono>
+
#include "DistributedSystemImpl.hpp"
#include "EvictionController.hpp"
+#include "util/Log.hpp"
namespace apache {
namespace geode {
namespace client {
const char* EvictionThread::NC_Evic_Thread = "NC Evic Thread";
+
EvictionThread::EvictionThread(EvictionController* parent)
- : m_pParent(parent),
- /* adongre
- * CID 28936: Uninitialized scalar field (UNINIT_CTOR)
- */
- m_run(false) {}
+ : m_run(false), m_pParent(parent) {}
-int EvictionThread::svc(void) {
+void EvictionThread::start() {
+ m_run = true;
+ m_thread = std::thread(&EvictionThread::svc, this);
+
+ LOGFINE("Eviction Thread started");
+}
+
+void EvictionThread::stop() {
+ m_run = false;
+ m_queueCondition.notify_one();
+ m_thread.join();
+
+ m_queue.clear();
+
+ LOGFINE("Eviction Thread stopped");
+}
+
+void EvictionThread::svc(void) {
DistributedSystemImpl::setThreadName(NC_Evic_Thread);
+
while (m_run) {
- processEvictions();
- }
- int32_t size = m_queue.size();
- for (int i = 0; i < size; i++) {
- processEvictions();
- }
- return 1;
-}
+ std::unique_lock<std::mutex> lock(m_queueMutex);
+ m_queueCondition.wait(lock, [this] { return !m_run || !m_queue.empty(); });
-void EvictionThread::processEvictions() {
- int32_t percentageToEvict = 0;
- percentageToEvict = static_cast<int32_t>(m_queue.get(1500));
- if (percentageToEvict != 0) {
- m_pParent->evict(percentageToEvict);
+ while (!m_queue.empty()) {
+ auto percentageToEvict = m_queue.front();
+ m_queue.pop_front();
+ if (0 != percentageToEvict) {
+ m_pParent->evict(percentageToEvict);
+ }
+ }
}
}
-void EvictionThread::putEvictionInfo(int32_t info) { m_queue.put(info); }
+void EvictionThread::putEvictionInfo(int32_t info) {
+ std::unique_lock<std::mutex> lock(m_queueMutex);
+ m_queue.push_back(info);
+ m_queueCondition.notify_one();
+}
} // namespace client
} // namespace geode
diff --git a/cppcache/src/EvictionThread.hpp b/cppcache/src/EvictionThread.hpp
index e9fc248..5a13282 100644
--- a/cppcache/src/EvictionThread.hpp
+++ b/cppcache/src/EvictionThread.hpp
@@ -1,8 +1,3 @@
-#pragma once
-
-#ifndef GEODE_EVICTIONTHREAD_H_
-#define GEODE_EVICTIONTHREAD_H_
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -20,53 +15,45 @@
* limitations under the License.
*/
-#include <ace/ACE.h>
-#include <ace/OS.h>
-#include <ace/Singleton.h>
-#include <ace/Task.h>
-#include <ace/Thread_Mutex.h>
+#pragma once
-#include <geode/DataOutput.hpp>
+#ifndef GEODE_EVICTIONTHREAD_H_
+#define GEODE_EVICTIONTHREAD_H_
-#include "IntQueue.hpp"
-#include "util/Log.hpp"
-/**
- * This class does the actual evictions
- */
+#include <atomic>
+#include <condition_variable>
+#include <deque>
+#include <mutex>
+#include <thread>
+
namespace apache {
namespace geode {
namespace client {
-class EvictionController;
-typedef IntQueue<int64_t> HeapSizeInfoQueue;
-class APACHE_GEODE_EXPORT EvictionThread : public ACE_Task_Base {
+class EvictionController;
+
+/**
+ * This class does the actual evictions
+ */
+class EvictionThread {
public:
explicit EvictionThread(EvictionController* parent);
-
- inline void start() {
- m_run = true;
- this->activate();
- LOGFINE("Eviction Thread started");
- }
-
- inline void stop() {
- m_run = false;
- this->wait();
- m_queue.clear();
- LOGFINE("Eviction Thread stopped");
- }
-
- int svc();
+ void start();
+ void stop();
+ void svc();
void putEvictionInfo(int32_t info);
- void processEvictions();
private:
+ std::thread m_thread;
+ std::atomic<bool> m_run;
EvictionController* m_pParent;
- HeapSizeInfoQueue m_queue;
- bool m_run;
+ std::deque<int32_t> m_queue;
+ std::mutex m_queueMutex;
+ std::condition_variable m_queueCondition;
static const char* NC_Evic_Thread;
};
+
} // namespace client
} // namespace geode
} // namespace apache
diff --git a/cppcache/src/Exception.cpp b/cppcache/src/Exception.cpp
index 132eb28..8f984de 100644
--- a/cppcache/src/Exception.cpp
+++ b/cppcache/src/Exception.cpp
@@ -17,8 +17,6 @@
#include <cstdlib>
-#include <ace/OS.h>
-#include <ace/TSS_T.h>
#include <boost/core/demangle.hpp>
#include <geode/CacheableString.hpp>
@@ -55,30 +53,17 @@
// class to store/clear last server exception in TSS area
-class TSSExceptionString {
- private:
- std::string m_exMsg;
+thread_local std::string threadLocalExceptionMessage;
- public:
- TSSExceptionString() : m_exMsg() {}
- virtual ~TSSExceptionString() {}
-
- inline std::string& str() { return m_exMsg; }
-
- static ACE_TSS<TSSExceptionString> s_tssExceptionMsg;
-};
-
-ACE_TSS<TSSExceptionString> TSSExceptionString::s_tssExceptionMsg;
-
-void setTSSExceptionMessage(const char* exMsg) {
- TSSExceptionString::s_tssExceptionMsg->str().clear();
+void setThreadLocalExceptionMessage(const char* exMsg) {
+ threadLocalExceptionMessage.clear();
if (exMsg != nullptr) {
- TSSExceptionString::s_tssExceptionMsg->str().append(exMsg);
+ threadLocalExceptionMessage.assign(exMsg);
}
}
-const char* getTSSExceptionMessage() {
- return TSSExceptionString::s_tssExceptionMsg->str().c_str();
+const std::string& getThreadLocalExceptionMessage() {
+ return threadLocalExceptionMessage;
}
} // namespace client
} // namespace geode
diff --git a/cppcache/src/ExceptionTypes.cpp b/cppcache/src/ExceptionTypes.cpp
index ea5af09..366d189 100644
--- a/cppcache/src/ExceptionTypes.cpp
+++ b/cppcache/src/ExceptionTypes.cpp
@@ -30,335 +30,328 @@
namespace geode {
namespace client {
-void setTSSExceptionMessage(const char* exMsg);
-const char* getTSSExceptionMessage();
+void setThreadLocalExceptionMessage(const char* exMsg);
+const std::string& getThreadLocalExceptionMessage();
[[noreturn]] void GfErrTypeThrowException(const char* str, GfErrType err) {
std::string func;
std::string message;
- const char* exMsg = getTSSExceptionMessage();
- if (exMsg != nullptr && exMsg[0] == '\0') {
- exMsg = nullptr;
- } else {
+ const auto& exMsg = getThreadLocalExceptionMessage();
+ if (!exMsg.empty()) {
func.append(str);
func.append(": ");
- str = func.c_str();
}
switch (err) {
case GF_NOTCON: {
- message.append(exMsg != nullptr ? exMsg : ": not connected to Geode");
+ message.append(!exMsg.empty() ? exMsg : ": not connected to Geode");
NotConnectedException ex(message);
- setTSSExceptionMessage(nullptr);
+ setThreadLocalExceptionMessage(nullptr);
throw ex;
}
case GF_MSG: {
- message.append(exMsg != nullptr
+ message.append(!exMsg.empty()
? exMsg
: ": message from server could not be handled");
MessageException ex(message);
- setTSSExceptionMessage(nullptr);
+ setThreadLocalExceptionMessage(nullptr);
throw ex;
}
case GF_CACHESERVER_EXCEPTION: {
- message.append(exMsg != nullptr ? exMsg
- : ": exception happened at cache server");
+ message.append(!exMsg.empty() ? exMsg
+ : ": exception happened at cache server");
CacheServerException ex(message);
- setTSSExceptionMessage(nullptr);
+ setThreadLocalExceptionMessage(nullptr);
throw ex;
}
case GF_NOTOWN: {
- message.append(exMsg != nullptr ? exMsg : ": not own the lock");
+ message.append(!exMsg.empty() ? exMsg : ": not own the lock");
NotOwnerException ex(message);
- setTSSExceptionMessage(nullptr);
+ setThreadLocalExceptionMessage(nullptr);
throw ex;
}
case GF_CACHE_REGION_NOT_FOUND: {
- message.append(exMsg != nullptr ? exMsg : ": region not found on server");
+ message.append(!exMsg.empty() ? exMsg : ": region not found on server");
CacheServerException ex(message);
- setTSSExceptionMessage(nullptr);
+ setThreadLocalExceptionMessage(nullptr);
throw ex;
}
case GF_CACHE_REGION_NOT_GLOBAL: {
- message.append(exMsg != nullptr ? exMsg : ": region not global");
+ message.append(!exMsg.empty() ? exMsg : ": region not global");
IllegalStateException ex(message);
- setTSSExceptionMessage(nullptr);
+ setThreadLocalExceptionMessage(nullptr);
throw ex;
}
case GF_CACHE_ILLEGAL_ARGUMENT_EXCEPTION: {
- message.append(exMsg != nullptr ? exMsg : ": illegal argument");
+ message.append(!exMsg.empty() ? exMsg : ": illegal argument");
IllegalArgumentException ex(message);
- setTSSExceptionMessage(nullptr);
+ setThreadLocalExceptionMessage(nullptr);
throw ex;
}
case GF_CACHE_ILLEGAL_STATE_EXCEPTION: {
- message.append(exMsg != nullptr ? exMsg : ": illegal State");
+ message.append(!exMsg.empty() ? exMsg : ": illegal State");
IllegalStateException ex(message);
- setTSSExceptionMessage(nullptr);
+ setThreadLocalExceptionMessage(nullptr);
throw ex;
}
case GF_CACHE_WRITER_EXCEPTION: {
- message.append(exMsg != nullptr ? exMsg
- : ": exception on server during write");
+ message.append(!exMsg.empty() ? exMsg
+ : ": exception on server during write");
CacheWriterException ex(message);
- setTSSExceptionMessage(nullptr);
+ setThreadLocalExceptionMessage(nullptr);
throw ex;
}
case GF_CACHEWRITER_ERROR: {
- message.append(exMsg != nullptr ? exMsg : ": exception in CacheWriter");
+ message.append(!exMsg.empty() ? exMsg : ": exception in CacheWriter");
CacheWriterException ex(message);
- setTSSExceptionMessage(nullptr);
+ setThreadLocalExceptionMessage(nullptr);
throw ex;
}
case GF_CACHE_LOADER_EXCEPTION: {
- message.append(exMsg != nullptr ? exMsg : ": exception in CacheLoader");
+ message.append(!exMsg.empty() ? exMsg : ": exception in CacheLoader");
CacheLoaderException ex(message);
- setTSSExceptionMessage(nullptr);
+ setThreadLocalExceptionMessage(nullptr);
throw ex;
}
case GF_CACHE_LISTENER_EXCEPTION: {
- message.append(exMsg != nullptr ? exMsg : ": exception in CacheListener");
+ message.append(!exMsg.empty() ? exMsg : ": exception in CacheListener");
CacheListenerException ex(message);
- setTSSExceptionMessage(nullptr);
+ setThreadLocalExceptionMessage(nullptr);
throw ex;
}
case GF_CACHE_REGION_INVALID: {
- message.append(exMsg != nullptr ? exMsg : ": region not valid");
+ message.append(!exMsg.empty() ? exMsg : ": region not valid");
RegionDestroyedException ex(message);
- setTSSExceptionMessage(nullptr);
+ setThreadLocalExceptionMessage(nullptr);
throw ex;
}
case GF_CACHE_PROXY: {
- message.append(exMsg != nullptr ? exMsg : ": error in Cache proxy");
+ message.append(!exMsg.empty() ? exMsg : ": error in Cache proxy");
CacheProxyException ex(message);
- setTSSExceptionMessage(nullptr);
+ setThreadLocalExceptionMessage(nullptr);
throw ex;
}
case GF_IOERR: {
- message.append(exMsg != nullptr ? exMsg
- : ": Input/Output error in operation");
+ message.append(!exMsg.empty() ? exMsg
+ : ": Input/Output error in operation");
GeodeIOException ex(message);
- setTSSExceptionMessage(nullptr);
+ setThreadLocalExceptionMessage(nullptr);
throw ex;
}
case GF_ENOENT: {
- message.append(exMsg != nullptr ? exMsg : ": entity does not exist");
+ message.append(!exMsg.empty() ? exMsg : ": entity does not exist");
NoSystemException ex(message);
- setTSSExceptionMessage(nullptr);
+ setThreadLocalExceptionMessage(nullptr);
throw ex;
}
case GF_CACHE_REGION_KEYS_NOT_STRINGS: {
- message.append(exMsg != nullptr
- ? exMsg
- : ": region entries do not support C access");
+ message.append(
+ !exMsg.empty() ? exMsg : ": region entries do not support C access");
IllegalArgumentException ex(message);
- setTSSExceptionMessage(nullptr);
+ setThreadLocalExceptionMessage(nullptr);
throw ex;
}
case GF_CACHE_REGION_ENTRY_NOT_BYTES: {
- message.append(exMsg != nullptr
+ message.append(!exMsg.empty()
? exMsg
: ": existing non-null values was not a byte array");
IllegalArgumentException ex(message);
- setTSSExceptionMessage(nullptr);
+ setThreadLocalExceptionMessage(nullptr);
throw ex;
}
case GF_CACHE_TIMEOUT_EXCEPTION: {
- message.append(exMsg != nullptr ? exMsg : ": timed out");
+ message.append(!exMsg.empty() ? exMsg : ": timed out");
TimeoutException ex(message);
- setTSSExceptionMessage(nullptr);
+ setThreadLocalExceptionMessage(nullptr);
throw ex;
}
case GF_TIMOUT: {
- message.append(exMsg != nullptr ? exMsg : ": timed out");
+ message.append(!exMsg.empty() ? exMsg : ": timed out");
TimeoutException ex(message);
- setTSSExceptionMessage(nullptr);
+ setThreadLocalExceptionMessage(nullptr);
throw ex;
}
case GF_CLIENT_WAIT_TIMEOUT: {
- message.append(exMsg != nullptr
+ message.append(!exMsg.empty()
? exMsg
: ": timed out, possibly bucket is not available.");
TimeoutException ex(message);
- setTSSExceptionMessage(nullptr);
+ setThreadLocalExceptionMessage(nullptr);
throw ex;
}
case GF_ENOMEM: {
- message.append(exMsg != nullptr ? exMsg : ": Out of memory");
+ message.append(!exMsg.empty() ? exMsg : ": Out of memory");
OutOfMemoryException ex(message);
- setTSSExceptionMessage(nullptr);
+ setThreadLocalExceptionMessage(nullptr);
throw ex;
}
case GF_ERANGE: {
- message.append(exMsg != nullptr ? exMsg : ": Buffer Size Exceeded");
+ message.append(!exMsg.empty() ? exMsg : ": Buffer Size Exceeded");
BufferSizeExceededException ex(message);
- setTSSExceptionMessage(nullptr);
+ setThreadLocalExceptionMessage(nullptr);
throw ex;
}
case GF_CACHE_LEASE_EXPIRED_EXCEPTION: {
- message.append(exMsg != nullptr ? exMsg : ": lock Lease Expired On you");
+ message.append(!exMsg.empty() ? exMsg : ": lock Lease Expired On you");
LeaseExpiredException ex(message);
- setTSSExceptionMessage(nullptr);
+ setThreadLocalExceptionMessage(nullptr);
throw ex;
}
case GF_CACHE_REGION_EXISTS_EXCEPTION: {
- message.append(exMsg != nullptr ? exMsg : ": Named Region Exists");
+ message.append(!exMsg.empty() ? exMsg : ": Named Region Exists");
RegionExistsException ex(message);
- setTSSExceptionMessage(nullptr);
+ setThreadLocalExceptionMessage(nullptr);
throw ex;
}
case GF_CACHE_ENTRY_NOT_FOUND: {
- message.append(exMsg != nullptr ? exMsg : ": Entry not found");
+ message.append(!exMsg.empty() ? exMsg : ": Entry not found");
EntryNotFoundException ex(message);
- setTSSExceptionMessage(nullptr);
+ setThreadLocalExceptionMessage(nullptr);
throw ex;
}
case GF_CACHE_ENTRY_EXISTS: {
- message.append(exMsg != nullptr ? exMsg
- : ": Entry already exists in the region");
+ message.append(!exMsg.empty() ? exMsg
+ : ": Entry already exists in the region");
EntryExistsException ex(message);
- setTSSExceptionMessage(nullptr);
+ setThreadLocalExceptionMessage(nullptr);
throw ex;
}
case GF_CACHE_ENTRY_DESTROYED_EXCEPTION: {
- message.append(exMsg != nullptr ? exMsg : ": Entry has been destroyed");
+ message.append(!exMsg.empty() ? exMsg : ": Entry has been destroyed");
EntryDestroyedException ex(message);
- setTSSExceptionMessage(nullptr);
+ setThreadLocalExceptionMessage(nullptr);
throw ex;
}
case GF_CACHE_REGION_DESTROYED_EXCEPTION: {
- message.append(exMsg != nullptr ? exMsg : ": Named Region Destroyed");
+ message.append(!exMsg.empty() ? exMsg : ": Named Region Destroyed");
RegionDestroyedException ex(message);
- setTSSExceptionMessage(nullptr);
+ setThreadLocalExceptionMessage(nullptr);
throw ex;
}
case GF_CACHE_CLOSED_EXCEPTION: {
- message.append(exMsg != nullptr ? exMsg : ": Cache has been closed");
+ message.append(!exMsg.empty() ? exMsg : ": Cache has been closed");
CacheClosedException ex(message);
- setTSSExceptionMessage(nullptr);
+ setThreadLocalExceptionMessage(nullptr);
throw ex;
}
case GF_CACHE_STATISTICS_DISABLED_EXCEPTION: {
- message.append(exMsg != nullptr
+ message.append(!exMsg.empty()
? exMsg
: ": Statistics have been disabled for the region");
StatisticsDisabledException ex(message);
- setTSSExceptionMessage(nullptr);
+ setThreadLocalExceptionMessage(nullptr);
throw ex;
}
case GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION: {
- message.append(
- exMsg != nullptr ? exMsg : ": Concurrent modification in the cache");
+ message.append(!exMsg.empty() ? exMsg
+ : ": Concurrent modification in the cache");
ConcurrentModificationException ex(message);
- setTSSExceptionMessage(nullptr);
+ setThreadLocalExceptionMessage(nullptr);
throw ex;
}
case GF_NOT_AUTHORIZED_EXCEPTION: {
- message.append(exMsg != nullptr ? exMsg : ": unauthorized operation");
+ message.append(!exMsg.empty() ? exMsg : ": unauthorized operation");
NotAuthorizedException ex(message);
- setTSSExceptionMessage(nullptr);
+ setThreadLocalExceptionMessage(nullptr);
throw ex;
}
case GF_AUTHENTICATION_FAILED_EXCEPTION: {
- message.append(exMsg != nullptr ? exMsg : ": authentication failed");
+ message.append(!exMsg.empty() ? exMsg : ": authentication failed");
AuthenticationFailedException ex(message);
- setTSSExceptionMessage(nullptr);
+ setThreadLocalExceptionMessage(nullptr);
throw ex;
}
case GF_AUTHENTICATION_REQUIRED_EXCEPTION: {
- message.append(exMsg != nullptr ? exMsg : ": no authentication provided");
+ message.append(!exMsg.empty() ? exMsg : ": no authentication provided");
AuthenticationRequiredException ex(message);
- setTSSExceptionMessage(nullptr);
+ setThreadLocalExceptionMessage(nullptr);
throw ex;
}
case GF_DUPLICATE_DURABLE_CLIENT: {
- message.append(exMsg != nullptr ? exMsg
- : ": Duplicate Durable Client Id");
+ message.append(!exMsg.empty() ? exMsg : ": Duplicate Durable Client Id");
DuplicateDurableClientException ex(message);
- setTSSExceptionMessage(nullptr);
+ setThreadLocalExceptionMessage(nullptr);
throw ex;
}
case GF_REMOTE_QUERY_EXCEPTION: {
- message.append(exMsg != nullptr ? exMsg : ": Query failed");
+ message.append(!exMsg.empty() ? exMsg : ": Query failed");
QueryException ex(message);
- setTSSExceptionMessage(nullptr);
+ setThreadLocalExceptionMessage(nullptr);
throw ex;
}
case GF_CACHE_LOCATOR_EXCEPTION: {
NoAvailableLocatorsException cause(
- std::string(str) +
- (exMsg != nullptr ? exMsg : ": No locators available"));
- setTSSExceptionMessage(nullptr);
+ func + (!exMsg.empty() ? exMsg : ": No locators available"));
+ setThreadLocalExceptionMessage(nullptr);
try {
throw cause;
} catch (...) {
NotConnectedException ex(
- std::string(str) +
- (exMsg != nullptr ? exMsg : ": No locators available"));
+ func + (!exMsg.empty() ? exMsg : ": No locators available"));
std::throw_with_nested(ex);
}
}
case GF_ALL_CONNECTIONS_IN_USE_EXCEPTION: {
- message.append(exMsg != nullptr ? exMsg : ": All connections are in use");
+ message.append(!exMsg.empty() ? exMsg : ": All connections are in use");
AllConnectionsInUseException ex(message);
- setTSSExceptionMessage(nullptr);
+ setThreadLocalExceptionMessage(nullptr);
throw ex;
}
case GF_FUNCTION_EXCEPTION: {
- message.append(exMsg != nullptr ? exMsg : ": Function execution failed");
+ message.append(!exMsg.empty() ? exMsg : ": Function execution failed");
FunctionExecutionException ex(message);
- setTSSExceptionMessage(nullptr);
+ setThreadLocalExceptionMessage(nullptr);
throw ex;
}
case GF_DISKFULL: {
- message.append(exMsg != nullptr ? exMsg : ": Disk full");
+ message.append(!exMsg.empty() ? exMsg : ": Disk full");
DiskFailureException ex(message);
- setTSSExceptionMessage(nullptr);
+ setThreadLocalExceptionMessage(nullptr);
throw ex;
}
case GF_ROLLBACK_EXCEPTION: {
- message.append(exMsg != nullptr ? exMsg : ": Transaction rolled back");
+ message.append(!exMsg.empty() ? exMsg : ": Transaction rolled back");
RollbackException ex(message);
- setTSSExceptionMessage(nullptr);
+ setThreadLocalExceptionMessage(nullptr);
throw ex;
}
case GF_COMMIT_CONFLICT_EXCEPTION: {
- message.append(exMsg != nullptr ? exMsg : ": Commit conflict exception");
+ message.append(!exMsg.empty() ? exMsg : ": Commit conflict exception");
CommitConflictException ex(message);
- setTSSExceptionMessage(nullptr);
+ setThreadLocalExceptionMessage(nullptr);
throw ex;
}
case GF_TRANSACTION_DATA_REBALANCED_EXCEPTION: {
message.append(
- exMsg != nullptr ? exMsg : ": Transaction data rebalanced exception");
+ !exMsg.empty() ? exMsg : ": Transaction data rebalanced exception");
TransactionDataRebalancedException ex(message);
- setTSSExceptionMessage(nullptr);
+ setThreadLocalExceptionMessage(nullptr);
throw ex;
}
case GF_TRANSACTION_DATA_NODE_HAS_DEPARTED_EXCEPTION: {
- message.append(exMsg != nullptr
+ message.append(!exMsg.empty()
? exMsg
: ": Transaction data node has departed exception");
TransactionDataNodeHasDepartedException ex(message);
- setTSSExceptionMessage(nullptr);
+ setThreadLocalExceptionMessage(nullptr);
throw ex;
}
case GF_PUTALL_PARTIAL_RESULT_EXCEPTION: {
- message.append(exMsg != nullptr ? exMsg : ": PutAll Partial exception");
+ message.append(!exMsg.empty() ? exMsg : ": PutAll Partial exception");
PutAllPartialResultException ex(message);
- setTSSExceptionMessage(nullptr);
+ setThreadLocalExceptionMessage(nullptr);
throw ex;
}
default: {
- char buf[64];
LOGINFO("error code: %d", err);
- if (exMsg == nullptr) {
- ACE_OS::snprintf(buf, 64, "Unknown error code[0x%X]", err);
- exMsg = buf;
+ std::string message = func;
+ if (exMsg.empty()) {
+ message.append("Unknown error code ").append(std::to_string(err));
+ } else {
+ message.append(exMsg);
}
- std::string message = std::string(str) + exMsg;
UnknownException ex(message);
- setTSSExceptionMessage(nullptr);
+ setThreadLocalExceptionMessage(nullptr);
throw ex;
}
}
diff --git a/cppcache/src/ExecutionImpl.cpp b/cppcache/src/ExecutionImpl.cpp
index f8d73b8..bf5dc11 100644
--- a/cppcache/src/ExecutionImpl.cpp
+++ b/cppcache/src/ExecutionImpl.cpp
@@ -24,6 +24,7 @@
#include <geode/internal/geode_globals.hpp>
#include "NoResult.hpp"
+#include "TcrConnectionManager.hpp"
#include "ThinClientPoolDM.hpp"
#include "ThinClientRegion.hpp"
#include "UserAttributes.hpp"
@@ -34,10 +35,9 @@
namespace client {
FunctionToFunctionAttributes ExecutionImpl::m_func_attrs;
-ACE_Recursive_Thread_Mutex ExecutionImpl::m_func_attrs_lock;
+std::recursive_mutex ExecutionImpl::m_func_attrs_lock;
Execution ExecutionImpl::withFilter(
std::shared_ptr<CacheableVector> routingObj) {
- // ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_lock);
if (routingObj == nullptr) {
throw IllegalArgumentException("Execution::withFilter: filter is null");
}
@@ -53,7 +53,6 @@
}
Execution ExecutionImpl::withArgs(std::shared_ptr<Cacheable> args) {
- // ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_lock);
if (args == nullptr) {
throw IllegalArgumentException("Execution::withArgs: args is null");
}
@@ -64,7 +63,6 @@
}
Execution ExecutionImpl::withCollector(std::shared_ptr<ResultCollector> rs) {
- // ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_lock);
if (rs == nullptr) {
throw IllegalArgumentException(
"Execution::withCollector: collector is null");
@@ -110,7 +108,7 @@
auto&& attr = getFunctionAttributes(func);
{
if (attr == nullptr) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_func_attrs_lock);
+ std::lock_guard<decltype(m_func_attrs_lock)> _guard(m_func_attrs_lock);
GfErrType err = GF_NOERR;
attr = getFunctionAttributes(func);
if (attr == nullptr) {
@@ -134,9 +132,8 @@
serverOptimizeForWrite = ((attr->at(2) == 1) ? true : false);
LOGDEBUG(
- "ExecutionImpl::execute got functionAttributes from srver for function = "
- "%s serverHasResult = %d "
- " serverIsHA = %d serverOptimizeForWrite = %d ",
+ "ExecutionImpl::execute got functionAttributes from server for function "
+ "= %s serverHasResult = %d serverIsHA = %d serverOptimizeForWrite = %d ",
func.c_str(), serverHasResult, serverIsHA, serverOptimizeForWrite);
if (serverHasResult == false) {
@@ -160,7 +157,7 @@
LOGDEBUG("ExecutionImpl::execute: isHAHasResultOptimizeForWrite = %d",
isHAHasResultOptimizeForWrite);
- TXState* txState = TSSTXStateWrapper::s_geodeTSSTXState->getTXState();
+ TXState* txState = TSSTXStateWrapper::get().getTXState();
if (txState != nullptr && m_allServer == true) {
throw UnsupportedOperationException(
@@ -395,10 +392,15 @@
reply.getException());
break;
}
+ case TcrMessage::REQUEST_DATA_ERROR: {
+ LOGERROR("Error message from server: " + reply.getValue()->toString());
+ throw FunctionExecutionException(reply.getValue()->toString());
+ }
default: {
LOGERROR("Unknown message type %d while getting function attributes.",
reply.getMessageType());
err = GF_MSG;
+ break;
}
}
return err;
diff --git a/cppcache/src/ExecutionImpl.hpp b/cppcache/src/ExecutionImpl.hpp
index f763632..f7b89ac 100644
--- a/cppcache/src/ExecutionImpl.hpp
+++ b/cppcache/src/ExecutionImpl.hpp
@@ -21,9 +21,7 @@
#define GEODE_EXECUTIONIMPL_H_
#include <map>
-
-#include <ace/Condition_Recursive_Thread_Mutex.h>
-#include <ace/Guard_T.h>
+#include <mutex>
#include <geode/AuthenticatedView.hpp>
#include <geode/CacheableBuiltins.hpp>
@@ -102,7 +100,6 @@
m_allServer(allServer),
m_pool(pool),
m_authenticatedView(authenticatedView) {}
- // ACE_Recursive_Thread_Mutex m_lock;
std::shared_ptr<CacheableVector> m_routingObj;
std::shared_ptr<Cacheable> m_args;
std::shared_ptr<ResultCollector> m_rc;
@@ -110,7 +107,7 @@
bool m_allServer;
std::shared_ptr<Pool> m_pool;
AuthenticatedView* m_authenticatedView;
- static ACE_Recursive_Thread_Mutex m_func_attrs_lock;
+ static std::recursive_mutex m_func_attrs_lock;
static FunctionToFunctionAttributes m_func_attrs;
// std::vector<int8_t> m_attributes;
diff --git a/cppcache/src/ExpiryHandler_T.hpp b/cppcache/src/ExpiryHandler_T.hpp
index f83bafb..1157cf5 100644
--- a/cppcache/src/ExpiryHandler_T.hpp
+++ b/cppcache/src/ExpiryHandler_T.hpp
@@ -25,8 +25,9 @@
*@version 1.0
*/
+#include <ace/Event_Handler.h>
+
#include "StackTrace.hpp"
-#include "ace/Event_Handler.h"
#include "util/Log.hpp"
namespace apache {
namespace geode {
diff --git a/cppcache/src/ExpiryTaskManager.cpp b/cppcache/src/ExpiryTaskManager.cpp
index 1c741a4..f5348ac 100644
--- a/cppcache/src/ExpiryTaskManager.cpp
+++ b/cppcache/src/ExpiryTaskManager.cpp
@@ -51,31 +51,6 @@
timer.release();
}
-ExpiryTaskManager::id_type ExpiryTaskManager::scheduleExpiryTask(
- ACE_Event_Handler* handler, uint32_t expTime, uint32_t interval,
- bool cancelExistingTask) {
- LOGFINER("ExpiryTaskManager: expTime %d, interval %d, cancelExistingTask %d",
- expTime, interval, cancelExistingTask);
- if (cancelExistingTask) {
- m_reactor->cancel_timer(handler, 1);
- }
-
- ACE_Time_Value expTimeValue(expTime);
- ACE_Time_Value intervalValue(interval);
- return m_reactor->schedule_timer(handler, nullptr, expTimeValue,
- intervalValue);
-}
-
-ExpiryTaskManager::id_type ExpiryTaskManager::scheduleExpiryTask(
- ACE_Event_Handler* handler, ACE_Time_Value expTimeValue,
- ACE_Time_Value intervalVal, bool cancelExistingTask) {
- if (cancelExistingTask) {
- m_reactor->cancel_timer(handler, 1);
- }
-
- return m_reactor->schedule_timer(handler, nullptr, expTimeValue, intervalVal);
-}
-
int ExpiryTaskManager::resetTask(ExpiryTaskManager::id_type id, uint32_t sec) {
ACE_Time_Value interval(sec);
return m_reactor->reset_timer_interval(id, interval);
@@ -88,7 +63,11 @@
int ExpiryTaskManager::svc() {
DistributedSystemImpl::setThreadName(NC_ETM_Thread);
LOGFINE("ExpiryTaskManager thread is running.");
- m_reactorEventLoopRunning = true;
+ {
+ std::unique_lock<std::mutex> lock(m_mutex);
+ m_reactorEventLoopRunning = true;
+ m_condition.notify_all();
+ }
m_reactor->owner(ACE_OS::thr_self());
m_reactor->run_reactor_event_loop();
LOGFINE("ExpiryTaskManager thread has stopped.");
@@ -96,21 +75,21 @@
}
void ExpiryTaskManager::stopExpiryTaskManager() {
+ std::unique_lock<std::mutex> lock(m_mutex);
+
if (m_reactorEventLoopRunning) {
m_reactor->end_reactor_event_loop();
this->wait();
GF_D_ASSERT(m_reactor->reactor_event_loop_done() > 0);
m_reactorEventLoopRunning = false;
+ m_condition.notify_all();
}
}
void ExpiryTaskManager::begin() {
this->activate();
- ACE_Time_Value t;
- t.msec(50);
- while (!m_reactorEventLoopRunning) {
- ACE_OS::sleep(t);
- }
+ std::unique_lock<std::mutex> lock(m_mutex);
+ m_condition.wait(lock, [this] { return m_reactorEventLoopRunning; });
}
ExpiryTaskManager::~ExpiryTaskManager() {
diff --git a/cppcache/src/ExpiryTaskManager.hpp b/cppcache/src/ExpiryTaskManager.hpp
index 8b8aa06..769ce82 100644
--- a/cppcache/src/ExpiryTaskManager.hpp
+++ b/cppcache/src/ExpiryTaskManager.hpp
@@ -21,6 +21,8 @@
#define GEODE_EXPIRYTASKMANAGER_H_
#include <chrono>
+#include <condition_variable>
+#include <mutex>
#include <type_traits>
#include <ace/Reactor.h>
@@ -33,16 +35,10 @@
#include "ReadWriteLock.hpp"
#include "util/Log.hpp"
-/**
- * @file ExpiryTaskManager.hpp
- */
-
namespace apache {
namespace geode {
namespace client {
-using ::apache::geode::internal::chrono::duration::to_string;
-
/**
* @class ExpiryTaskManager ExpiryTaskManager.hpp
*
@@ -228,28 +224,24 @@
* Constructor
*/
ExpiryTaskManager();
+
/**
* Destructor. Stops the reactors event loop if it is not running
* and then exits.
*/
~ExpiryTaskManager();
+
/**
* For scheduling a task for expiration.
*/
- ExpiryTaskManager::id_type scheduleExpiryTask(
- ACE_Event_Handler* handler, uint32_t expTime, uint32_t interval = 0,
- bool cancelExistingTask = false);
-
- ExpiryTaskManager::id_type scheduleExpiryTask(
- ACE_Event_Handler* handler, ACE_Time_Value expTimeValue,
- ACE_Time_Value intervalVal, bool cancelExistingTask = false);
-
template <class ExpRep, class ExpPeriod, class IntRep, class IntPeriod>
ExpiryTaskManager::id_type scheduleExpiryTask(
ACE_Event_Handler* handler,
std::chrono::duration<ExpRep, ExpPeriod> expTime,
std::chrono::duration<IntRep, IntPeriod> interval,
bool cancelExistingTask = false) {
+ using ::apache::geode::internal::chrono::duration::to_string;
+
LOGFINER(
"ExpiryTaskManager: expTime %s, interval %s, cancelExistingTask %d",
to_string(expTime).c_str(), to_string(interval).c_str(),
@@ -260,7 +252,7 @@
ACE_Time_Value expTimeValue(expTime);
ACE_Time_Value intervalValue(interval);
- LOGFINER("Scheduled expiration ... in %d seconds.", expTime.count());
+ LOGFINER("Scheduled expiration ... in " + to_string(expTime));
return m_reactor->schedule_timer(handler, nullptr, expTimeValue,
intervalValue);
}
@@ -286,12 +278,14 @@
* id - the id assigned to the expiry task initially.
*/
int cancelTask(id_type id);
+
/**
* A separate thread is started in which the reactor event loop
* is kept running unless explicitly stopped or when this object
* goes out of scope.
*/
int svc();
+
/**
* For explicitly stopping the reactor's event loop.
*/
@@ -305,9 +299,10 @@
bool m_reactorEventLoopRunning; // flag to indicate if the reactor event
// loop is running or not.
- ACE_Recursive_Thread_Mutex m_taskLock; // to synchronize scheduling
- // of expiry tasks.
static const char* NC_ETM_Thread;
+
+ std::mutex m_mutex;
+ std::condition_variable m_condition;
};
} // namespace client
} // namespace geode
diff --git a/cppcache/src/IntQueue.hpp b/cppcache/src/IntQueue.hpp
deleted file mode 100644
index 4b518c9..0000000
--- a/cppcache/src/IntQueue.hpp
+++ /dev/null
@@ -1,124 +0,0 @@
-#pragma once
-
-#ifndef GEODE_INTQUEUE_H_
-#define GEODE_INTQUEUE_H_
-
-/*
- * 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 <deque>
-
-#include <ace/ACE.h>
-#include <ace/Condition_Recursive_Thread_Mutex.h>
-#include <ace/Guard_T.h>
-#include <ace/Recursive_Thread_Mutex.h>
-#include <ace/Time_Value.h>
-
-namespace apache {
-namespace geode {
-namespace client {
-
-template <class T>
-
-class APACHE_GEODE_EXPORT IntQueue {
- public:
- IntQueue() : m_cond(m_mutex) {}
-
- ~IntQueue() {
- ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_mutex);
-
- while (m_queue.size() > 0) {
- m_queue.pop_back();
- }
- }
-
- /** wait usec time until notified */
- T get(int64_t usec) {
- ACE_Time_Value interval(usec / 1000000, usec % 1000000);
- return getUntil(interval);
- }
-
- T get() {
- T mp = 0;
-
- getInternal(mp);
- return mp;
- }
-
- void put(T mp) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_mutex);
- m_queue.push_front(mp);
- m_cond.signal();
- }
-
- uint32_t size() {
- ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_mutex);
- return static_cast<uint32_t>(m_queue.size());
- }
-
- void clear() {
- ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_mutex);
- m_queue.clear();
- m_cond.signal();
- }
-
- bool empty() { return size() == 0; }
-
- private:
- inline bool getInternal(T& val) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_mutex);
-
- if (m_queue.size() > 0) {
- val = m_queue.back();
- m_queue.pop_back();
- return true;
- }
-
- return false;
- }
-
- T getUntil(const ACE_Time_Value& interval) {
- T mp = 0;
- bool found = getInternal(mp);
-
- if (!found) {
- ACE_Time_Value stopAt(ACE_OS::gettimeofday());
- stopAt += interval;
-
- while (!found && ACE_OS::gettimeofday() < stopAt) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_mutex);
- m_cond.wait(&stopAt);
- if (m_queue.size() > 0) {
- mp = m_queue.back();
- m_queue.pop_back();
- found = true;
- }
- }
- }
- return mp;
- }
-
- typedef std::deque<T> LocalQueue;
- LocalQueue m_queue;
- ACE_Recursive_Thread_Mutex m_mutex;
- ACE_Condition<ACE_Recursive_Thread_Mutex> m_cond;
-};
-} // namespace client
-} // namespace geode
-} // namespace apache
-
-#endif // GEODE_INTQUEUE_H_
diff --git a/cppcache/src/InternalCacheTransactionManager2PCImpl.cpp b/cppcache/src/InternalCacheTransactionManager2PCImpl.cpp
index dd71ccf..9f4acb4 100644
--- a/cppcache/src/InternalCacheTransactionManager2PCImpl.cpp
+++ b/cppcache/src/InternalCacheTransactionManager2PCImpl.cpp
@@ -24,6 +24,7 @@
#include "CacheRegionHelper.hpp"
#include "CacheTransactionManagerImpl.hpp"
#include "TXCleaner.hpp"
+#include "TcrConnectionManager.hpp"
#include "TcrMessage.hpp"
#include "ThinClientPoolDM.hpp"
#include "util/exception.hpp"
@@ -41,9 +42,7 @@
void InternalCacheTransactionManager2PCImpl::prepare() {
try {
- auto& txStateWrapper = TSSTXStateWrapper::s_geodeTSSTXState;
- auto txState = txStateWrapper->getTXState();
-
+ auto txState = TSSTXStateWrapper::get().getTXState();
if (!txState) {
GfErrTypeThrowException(
"Transaction is null, cannot prepare of a null transaction",
@@ -118,7 +117,7 @@
void InternalCacheTransactionManager2PCImpl::afterCompletion(int32_t status) {
try {
- auto txState = TSSTXStateWrapper::s_geodeTSSTXState->getTXState();
+ auto txState = TSSTXStateWrapper::get().getTXState();
if (!txState) {
GfErrTypeThrowException(
diff --git a/cppcache/src/LRUEntriesMap.cpp b/cppcache/src/LRUEntriesMap.cpp
index bd8f3de..394f5fe 100644
--- a/cppcache/src/LRUEntriesMap.cpp
+++ b/cppcache/src/LRUEntriesMap.cpp
@@ -14,11 +14,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
#include "LRUEntriesMap.hpp"
#include <mutex>
#include "CacheImpl.hpp"
+#include "EvictionController.hpp"
#include "ExpiryTaskManager.hpp"
#include "LRUList.cpp"
#include "MapSegment.hpp"
@@ -27,6 +29,7 @@
namespace apache {
namespace geode {
namespace client {
+
/**
* @brief LRUAction for testing map outside of a region....
*/
@@ -164,7 +167,6 @@
GfErrType LRUEntriesMap::evictionHelper() {
GfErrType err = GF_NOERR;
- // ACE_Guard< ACE_Recursive_Thread_Mutex > guard( m_mutex );
std::shared_ptr<MapEntryImpl> lruEntryPtr;
m_lruList.getLRUEntry(lruEntryPtr);
if (lruEntryPtr == nullptr) {
@@ -218,7 +220,7 @@
// later value
// TODO: assess any other effects of this race
if (CacheableToken::isOverflowed(oldValue)) {
- ACE_Guard<MapSegment> _guard(*segmentRPtr);
+ std::lock_guard<MapSegment> _guard(*segmentRPtr);
auto&& persistenceInfo = me->getLRUProperties().getPersistenceInfo();
// get the old value first which is required for heapLRU
// calculation and for listeners; note even though there is a race
@@ -265,14 +267,14 @@
{
if (m_action != nullptr &&
m_action->getType() == LRUAction::OVERFLOW_TO_DISK) {
- segmentRPtr->acquire();
+ segmentRPtr->lock();
segmentLocked = true;
}
std::shared_ptr<MapEntryImpl> mePtr;
if ((err = segmentRPtr->put(key, newValue, me, oldValue, updateCount,
destroyTracker, isUpdate, versionTag, delta)) !=
GF_NOERR) {
- if (segmentLocked == true) segmentRPtr->release();
+ if (segmentLocked == true) segmentRPtr->unlock();
return err;
}
@@ -292,7 +294,7 @@
// unless very careful thought has gone into it.
if (CacheableToken::isOverflowed(oldValue)) {
if (!segmentLocked) {
- segmentRPtr->release();
+ segmentRPtr->unlock();
segmentLocked = true;
}
auto&& persistenceInfo = me->getLRUProperties().getPersistenceInfo();
@@ -360,7 +362,7 @@
err = processLRU();
if (segmentLocked) {
- segmentRPtr->release();
+ segmentRPtr->unlock();
}
return err;
}
@@ -378,14 +380,14 @@
bool segmentLocked = false;
if (m_action != nullptr &&
m_action->getType() == LRUAction::OVERFLOW_TO_DISK) {
- segmentRPtr->acquire();
+ segmentRPtr->lock();
segmentLocked = true;
}
{
returnPtr = nullptr;
std::shared_ptr<MapEntryImpl> mePtr;
if (false == segmentRPtr->getEntry(key, mePtr, returnPtr)) {
- if (segmentLocked == true) segmentRPtr->release();
+ if (segmentLocked == true) segmentRPtr->unlock();
return false;
}
// segmentRPtr->get(key, returnPtr, mePtr);
@@ -398,7 +400,7 @@
tmpObj = m_pmPtr->read(key, persistenceInfo);
} catch (Exception& ex) {
LOGERROR("read on the persistence layer failed - %s", ex.what());
- if (segmentLocked == true) segmentRPtr->release();
+ if (segmentLocked == true) segmentRPtr->unlock();
return false;
}
m_region->getRegionStats()->incRetrieves();
@@ -435,13 +437,13 @@
GfErrType IsProcessLru = processLRU();
if ((IsProcessLru != GF_NOERR)) {
if (segmentLocked) {
- segmentRPtr->release();
+ segmentRPtr->unlock();
}
return false;
}
}
if (segmentLocked) {
- segmentRPtr->release();
+ segmentRPtr->unlock();
}
return true;
}
@@ -467,7 +469,7 @@
--m_validEntries;
}
if (CacheableToken::isOverflowed(result)) {
- ACE_Guard<MapSegment> _guard(*segmentRPtr);
+ std::lock_guard<MapSegment> _guard(*segmentRPtr);
auto&& persistenceInfo = lruProps.getPersistenceInfo();
// get the old value first which is required for heapLRU
// calculation and for listeners; note even though there is a race
diff --git a/cppcache/src/LocalRegion.cpp b/cppcache/src/LocalRegion.cpp
index 8b37f64..f3b28dd 100644
--- a/cppcache/src/LocalRegion.cpp
+++ b/cppcache/src/LocalRegion.cpp
@@ -33,6 +33,7 @@
#include "RegionGlobalLocks.hpp"
#include "SerializableHelper.hpp"
#include "TXState.hpp"
+#include "TcrConnectionManager.hpp"
#include "Utils.hpp"
#include "VersionTag.hpp"
#include "util/Log.hpp"
@@ -195,6 +196,16 @@
m_entries->reapTombstones(tombstoneKeys);
}
}
+
+std::shared_ptr<Region> LocalRegion::findSubRegion(const std::string& name) {
+ auto&& lock = m_subRegions.make_lock<std::lock_guard>();
+ const auto& find = m_subRegions.find(name);
+ if (find != m_subRegions.end()) {
+ return find->second;
+ }
+ return nullptr;
+}
+
std::shared_ptr<Region> LocalRegion::getSubregion(const std::string& path) {
CHECK_DESTROY_PENDING(TryReadGuard, LocalRegion::getSubregion);
@@ -203,25 +214,28 @@
LOGERROR("Get subregion path [" + path + "] is not valid.");
throw IllegalArgumentException("Get subegion path is empty or a /");
}
+
auto fullname = path;
if (fullname.substr(0, 1) == slash) {
fullname = path.substr(1);
}
+
// find second separator
- size_t idx = fullname.find('/');
+ auto idx = fullname.find('/');
auto stepname = fullname.substr(0, idx);
- std::shared_ptr<Region> region, rptr;
- if (0 == m_subRegions.find(stepname, region)) {
+ auto region = findSubRegion(stepname);
+ if (region) {
if (stepname == fullname) {
// done...
- rptr = region;
+ return region;
} else {
std::string remainder = fullname.substr(stepname.length() + 1);
- rptr = region->getSubregion(remainder.c_str());
+ return region->getSubregion(remainder);
}
}
- return rptr;
+
+ return nullptr;
}
std::shared_ptr<Region> LocalRegion::createSubregion(
@@ -235,9 +249,9 @@
}
}
- MapOfRegionGuard guard1(m_subRegions.mutex());
+ auto&& lock = m_subRegions.make_lock();
std::shared_ptr<Region> region_ptr;
- if (0 == m_subRegions.find(subregionName, region_ptr)) {
+ if (m_subRegions.find(subregionName) != m_subRegions.end()) {
throw RegionExistsException(
"LocalRegion::createSubregion: named region exists in the region");
}
@@ -265,7 +279,7 @@
}
rPtr->acquireReadLock();
- m_subRegions.bind(rPtr->getName(), std::shared_ptr<Region>(rPtr));
+ m_subRegions.emplace(rPtr->getName(), rPtr);
// schedule the sub region expiry if regionExpiry enabled.
rPtr->setRegionExpiryTask();
@@ -276,7 +290,7 @@
std::vector<std::shared_ptr<Region>> LocalRegion::subregions(
const bool recursive) {
CHECK_DESTROY_PENDING(TryReadGuard, LocalRegion::subregions);
- if (m_subRegions.current_size() == 0) {
+ if (m_subRegions.empty()) {
return std::vector<std::shared_ptr<Region>>();
}
@@ -789,16 +803,16 @@
std::vector<std::shared_ptr<Region>> LocalRegion::subregions_internal(
const bool recursive) {
- MapOfRegionGuard guard(m_subRegions.mutex());
+ auto&& lock = m_subRegions.make_lock();
std::vector<std::shared_ptr<Region>> regions;
- regions.reserve(m_subRegions.current_size());
+ regions.reserve(m_subRegions.size());
- for (const auto& entry : m_subRegions) {
- const auto& subRegion = entry.int_id_;
+ for (const auto& kv : m_subRegions) {
+ const auto& subRegion = kv.second;
regions.push_back(subRegion);
- if (recursive == true) {
+ if (recursive) {
if (auto localRegion =
std::dynamic_pointer_cast<LocalRegion>(subRegion)) {
auto subRegions = localRegion->subregions_internal(true);
@@ -1064,7 +1078,7 @@
TXState* m_txState;
inline explicit PutActions(LocalRegion& region) : m_region(region) {
- m_txState = TSSTXStateWrapper::s_geodeTSSTXState->getTXState();
+ m_txState = TSSTXStateWrapper::get().getTXState();
}
inline static const char* name() { return "Region::put"; }
@@ -1151,7 +1165,7 @@
TXState* m_txState;
inline explicit CreateActions(LocalRegion& region) : m_region(region) {
- m_txState = TSSTXStateWrapper::s_geodeTSSTXState->getTXState();
+ m_txState = TSSTXStateWrapper::get().getTXState();
}
inline static const char* name() { return "Region::create"; }
@@ -1214,7 +1228,7 @@
TXState* m_txState;
inline explicit DestroyActions(LocalRegion& region) : m_region(region) {
- m_txState = TSSTXStateWrapper::s_geodeTSSTXState->getTXState();
+ m_txState = TSSTXStateWrapper::get().getTXState();
}
inline static const char* name() { return "Region::destroy"; }
@@ -1329,7 +1343,7 @@
inline explicit RemoveActions(LocalRegion& region)
: m_region(region), m_ServerResponse(GF_ENOENT) {
- m_txState = TSSTXStateWrapper::s_geodeTSSTXState->getTXState();
+ m_txState = TSSTXStateWrapper::get().getTXState();
allowNULLValue = false;
}
@@ -1536,7 +1550,7 @@
TXState* m_txState;
inline explicit InvalidateActions(LocalRegion& region) : m_region(region) {
- m_txState = TSSTXStateWrapper::s_geodeTSSTXState->getTXState();
+ m_txState = TSSTXStateWrapper::get().getTXState();
}
inline static const char* name() { return "Region::invalidate"; }
@@ -2246,6 +2260,23 @@
return err;
}
+GfErrType LocalRegion::invalidateRegionNoThrowOnSubRegions(
+ const std::shared_ptr<Serializable>& aCallbackArgument,
+ const CacheEventFlags eventFlags) {
+ auto&& lock = m_subRegions.make_lock();
+ for (const auto& kv : m_subRegions) {
+ if (auto subRegion = std::dynamic_pointer_cast<RegionInternal>(kv.second)) {
+ auto err =
+ subRegion->invalidateRegionNoThrow(aCallbackArgument, eventFlags);
+ if (err != GF_NOERR) {
+ return err;
+ }
+ }
+ }
+
+ return GF_NOERR;
+}
+
GfErrType LocalRegion::invalidateRegionNoThrow(
const std::shared_ptr<Serializable>& aCallbackArgument,
const CacheEventFlags eventFlags) {
@@ -2254,9 +2285,9 @@
if (m_regionAttributes.getCachingEnabled()) {
std::vector<std::shared_ptr<CacheableKey>> v = keys_internal();
- const auto size = v.size();
+ auto size = v.size();
std::shared_ptr<MapEntryImpl> me;
- for (size_t i = 0; i < size; i++) {
+ for (decltype(size) i = 0; i < size; i++) {
{
std::shared_ptr<Cacheable> oldValue;
// invalidate all the entries with a nullptr versionTag
@@ -2278,20 +2309,11 @@
if (err != GF_NOERR) return err;
}
- if (m_subRegions.current_size() > 0) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> subguard(m_subRegions.mutex());
- for (MapOfRegionWithLock::iterator p = m_subRegions.begin();
- p != m_subRegions.end(); ++p) {
- RegionInternal* subRegion =
- dynamic_cast<RegionInternal*>((*p).int_id_.get());
- if (subRegion != nullptr) {
- err = subRegion->invalidateRegionNoThrow(aCallbackArgument, eventFlags);
- if (err != GF_NOERR) {
- return err;
- }
- }
- }
+ err = invalidateRegionNoThrowOnSubRegions(aCallbackArgument, eventFlags);
+ if (err != GF_NOERR) {
+ return err;
}
+
err = invokeCacheListenerForRegionEvent(aCallbackArgument, eventFlags,
AFTER_REGION_INVALIDATE);
@@ -2357,15 +2379,14 @@
LOGFINE("Region %s is being destroyed", m_fullPath.c_str());
{
- MapOfRegionGuard guard(m_subRegions.mutex());
- for (MapOfRegionWithLock::iterator p = m_subRegions.begin();
- p != m_subRegions.end(); ++p) {
+ auto&& lock = m_subRegions.make_lock();
+
+ for (const auto& kv : m_subRegions) {
// TODO: remove unnecessary dynamic_cast by having m_subRegions hold
// RegionInternal and invoke the destroy method in that
- RegionInternal* subRegion =
- dynamic_cast<RegionInternal*>((*p).int_id_.get());
- if (subRegion != nullptr) {
- // for subregions never remove from parent since that will cause
+ if (auto subRegion =
+ std::dynamic_pointer_cast<RegionInternal>(kv.second)) {
+ // for subregions never remove from parent since that will cause
// the region to be destroyed and SEGV; unbind_all takes care of that
// Also don't send remote destroy message for sub-regions
err = subRegion->destroyRegionNoThrow(
@@ -2378,7 +2399,7 @@
}
}
}
- m_subRegions.unbind_all();
+ m_subRegions.clear();
// for the expiry case try the local destroy first and remote
// destroy only if local destroy succeeds
@@ -2505,20 +2526,17 @@
m_entries->getEntries(me);
if (recursive == true) {
- MapOfRegionGuard guard(m_subRegions.mutex());
- for (MapOfRegionWithLock::iterator p = m_subRegions.begin();
- p != m_subRegions.end(); ++p) {
- dynamic_cast<LocalRegion*>((*p).int_id_.get())
- ->entries_internal(me, true);
+ auto&& lock = m_subRegions.make_lock();
+ for (const auto& kv : m_subRegions) {
+ if (auto subRegion = std::dynamic_pointer_cast<LocalRegion>(kv.second)) {
+ subRegion->entries_internal(me, true);
+ }
}
}
}
-int LocalRegion::removeRegion(const std::string& name) {
- if (m_subRegions.current_size() == 0) {
- return 0;
- }
- return m_subRegions.unbind(name);
+void LocalRegion::removeRegion(const std::string& name) {
+ m_subRegions.erase(name);
}
bool LocalRegion::invokeCacheWriterForEntryEvent(
diff --git a/cppcache/src/LocalRegion.hpp b/cppcache/src/LocalRegion.hpp
index c98fbc4..698f544 100644
--- a/cppcache/src/LocalRegion.hpp
+++ b/cppcache/src/LocalRegion.hpp
@@ -1,8 +1,3 @@
-#pragma once
-
-#ifndef GEODE_LOCALREGION_H_
-#define GEODE_LOCALREGION_H_
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -20,16 +15,15 @@
* limitations under the License.
*/
-/**
- * @file
- */
+#pragma once
+
+#ifndef GEODE_LOCALREGION_H_
+#define GEODE_LOCALREGION_H_
#include <string>
#include <unordered_map>
-#include <ace/ACE.h>
-#include <ace/Hash_Map_Manager_T.h>
-#include <ace/Recursive_Thread_Mutex.h>
+#include <ace/RW_Thread_Mutex.h>
#include <geode/AttributesMutator.hpp>
#include <geode/Cache.hpp>
@@ -51,12 +45,12 @@
#include "EntriesMapFactory.hpp"
#include "EventType.hpp"
#include "ExpMapEntry.hpp"
-#include "MapWithLock.hpp"
#include "RegionInternal.hpp"
#include "RegionStats.hpp"
#include "SerializationRegistry.hpp"
#include "TSSTXStateWrapper.hpp"
#include "TombstoneList.hpp"
+#include "util/synchronized_map.hpp"
namespace apache {
namespace geode {
@@ -472,9 +466,7 @@
void setPool(const std::shared_ptr<Pool>& p) { m_attachedPool = p; }
- TXState* getTXState() const {
- return TSSTXStateWrapper::s_geodeTSSTXState->getTXState();
- }
+ TXState* getTXState() const { return TSSTXStateWrapper::get().getTXState(); }
std::shared_ptr<Cacheable> handleReplay(
GfErrType& err, std::shared_ptr<Cacheable> value) const;
@@ -510,7 +502,9 @@
/* protected attributes */
std::string m_name;
std::shared_ptr<Region> m_parentRegion;
- MapOfRegionWithLock m_subRegions;
+ synchronized_map<std::unordered_map<std::string, std::shared_ptr<Region>>,
+ std::recursive_mutex>
+ m_subRegions;
std::string m_fullPath;
volatile bool m_destroyPending;
std::shared_ptr<CacheListener> m_listener;
@@ -529,7 +523,7 @@
mutable ACE_RW_Thread_Mutex m_rwLock;
std::vector<std::shared_ptr<CacheableKey>> keys_internal();
bool containsKey_internal(const std::shared_ptr<CacheableKey>& keyPtr) const;
- int removeRegion(const std::string& name);
+ void removeRegion(const std::string& name);
bool invokeCacheWriterForEntryEvent(
const std::shared_ptr<CacheableKey>& key,
@@ -577,6 +571,12 @@
std::shared_ptr<EventId> eventId, std::shared_ptr<Cacheable>& fullObject,
std::shared_ptr<VersionTag>& versionTag);
+ private:
+ std::shared_ptr<Region> findSubRegion(const std::string& name);
+ GfErrType invalidateRegionNoThrowOnSubRegions(
+ const std::shared_ptr<Serializable>& aCallbackArgument,
+ const CacheEventFlags eventFlags);
+
// these classes encapsulate actions specific to update operations
// used by the template <code>updateNoThrow</code> class
friend class PutActions;
@@ -586,6 +586,7 @@
friend class RemoveActions;
friend class InvalidateActions;
};
+
} // namespace client
} // namespace geode
} // namespace apache
diff --git a/cppcache/src/Log.cpp b/cppcache/src/Log.cpp
index d56b886..93a2ffb 100644
--- a/cppcache/src/Log.cpp
+++ b/cppcache/src/Log.cpp
@@ -17,9 +17,12 @@
#include "util/Log.hpp"
+#include <algorithm>
#include <cctype>
#include <chrono>
#include <cinttypes>
+#include <ctime>
+#include <mutex>
#include <string>
#include <thread>
#include <utility>
@@ -28,14 +31,13 @@
#include <ace/ACE.h>
#include <ace/Dirent.h>
#include <ace/Dirent_Selector.h>
-#include <ace/Guard_T.h>
#include <ace/OS.h>
#include <ace/OS_NS_Thread.h>
#include <ace/OS_NS_sys_stat.h>
#include <ace/OS_NS_sys_time.h>
#include <ace/OS_NS_time.h>
#include <ace/OS_NS_unistd.h>
-#include <ace/Thread_Mutex.h>
+#include <boost/process/environment.hpp>
#include <geode/ExceptionTypes.hpp>
#include <geode/internal/geode_globals.hpp>
@@ -44,6 +46,7 @@
#include "../internal/hacks/AceThreadId.h"
#include "Assert.hpp"
#include "geodeBanner.hpp"
+#include "util/chrono/time_point.hpp"
#if defined(_WIN32)
#include <io.h>
@@ -79,7 +82,7 @@
char g_logFileNameBuffer[2048] = {0};
-ACE_Thread_Mutex* g_logMutex = new ACE_Thread_Mutex("Log::logMutex");
+std::mutex g_logMutex;
int g_rollIndex = 0;
size_t g_spaceUsed = 0;
@@ -141,7 +144,7 @@
return 1;
}
- int diff = ACE_OS::strcmp((*d1)->d_name, (*d2)->d_name);
+ int diff = std::strcmp((*d1)->d_name, (*d2)->d_name);
if (diff < 0) {
return -1;
} else if (diff > 0) {
@@ -166,7 +169,6 @@
using apache::geode::log::globals::g_isLogFileOpened;
using apache::geode::log::globals::g_log;
using apache::geode::log::globals::g_logFile;
-using apache::geode::log::globals::g_logFileNameBuffer;
using apache::geode::log::globals::g_logFileWithExt;
using apache::geode::log::globals::g_logMutex;
using apache::geode::log::globals::g_pid;
@@ -176,23 +178,6 @@
/*****************************************************************************/
-const char* Log::logFileName() {
- ACE_Guard<ACE_Thread_Mutex> guard(*g_logMutex);
-
- if (!g_logFile) {
- g_logFileNameBuffer[0] = '\0';
- } else {
- if (g_logFile->size() >= sizeof g_logFileNameBuffer) {
- throw IllegalStateException(
- ("Log file name is too long: " + *g_logFile).c_str());
- }
- ACE_OS::strncpy(g_logFileNameBuffer, g_logFile->c_str(),
- sizeof(g_logFileNameBuffer));
- }
-
- return g_logFileNameBuffer;
-}
-
void Log::init(LogLevel level, const char* logFileName, int32_t logFileLimit,
int64_t logDiskSpaceLimit) {
if (g_log != nullptr) {
@@ -201,7 +186,6 @@
"Call Log::close() before calling Log::init again.");
}
s_logLevel = level;
- if (g_logMutex == nullptr) g_logMutex = new ACE_Thread_Mutex("Log::logMutex");
if (logDiskSpaceLimit <
0 /*|| logDiskSpaceLimit > GEODE_MAX_LOG_DISK_LIMIT*/) {
@@ -212,14 +196,10 @@
logFileLimit = GEODE_MAX_LOG_FILE_LIMIT;
}
- ACE_Guard<ACE_Thread_Mutex> guard(*g_logMutex);
+ std::lock_guard<decltype(g_logMutex)> guard(g_logMutex);
if (logFileName && logFileName[0]) {
std::string filename = logFileName;
- if (filename.size() >= sizeof g_logFileNameBuffer) {
- throw IllegalStateException(
- ("Log file name is too long: " + filename).c_str());
- }
if (g_logFile) {
*g_logFile = filename;
} else {
@@ -228,17 +208,7 @@
#ifdef _WIN32
// replace all '\' with '/' to make everything easier..
- size_t length = g_logFile->length() + 1;
- char* slashtmp = new char[length];
- ACE_OS::strncpy(slashtmp, g_logFile->c_str(), length);
- for (size_t i = 0; i < g_logFile->length(); i++) {
- if (slashtmp[i] == '/') {
- slashtmp[i] = '\\';
- }
- }
- *g_logFile = slashtmp;
- delete[] slashtmp;
- slashtmp = nullptr;
+ std::replace(g_logFile->begin(), g_logFile->end(), '\\', '/');
#endif
// Appending a ".log" at the end if it does not exist or file has some other
@@ -295,7 +265,7 @@
if (fileHyphenPos != std::string::npos) {
std::string buff =
tempname.substr(fileHyphenPos + 1, tempname.length());
- g_rollIndex = ACE_OS::atoi(buff.c_str()) + 1;
+ g_rollIndex = std::stoi(buff) + 1;
}
} // if loop
} // for loop
@@ -304,17 +274,6 @@
FILE* existingFile = fopen(g_logFileWithExt->c_str(), "r");
if (existingFile != nullptr && logFileLimit > 0) {
- /* adongre
- * Coverity - II
- * CID 29205: Calling risky function (SECURE_CODING)[VERY RISKY]. Using
- * "sprintf" can cause a
- * buffer overflow when done incorrectly. Because sprintf() assumes an
- * arbitrarily long string,
- * callers must be careful not to overflow the actual space of the
- * destination.
- * Use snprintf() instead, or correct precision specifiers.
- * Fix : using ACE_OS::snprintf
- */
char rollFile[1024] = {0};
std::string logsdirname;
std::string logsbasename;
@@ -341,18 +300,18 @@
fnameBeforeExt = logsbasename.substr(0, posOfExt);
extName = logsbasename.substr(posOfExt + 1, baselen);
}
- ACE_OS::snprintf(rollFile, 1024, "%s%c%s-%d.%s", logsdirname.c_str(),
- ACE_DIRECTORY_SEPARATOR_CHAR, fnameBeforeExt.c_str(),
- g_rollIndex++, extName.c_str());
+ std::snprintf(rollFile, 1024, "%s%c%s-%d.%s", logsdirname.c_str(),
+ ACE_DIRECTORY_SEPARATOR_CHAR, fnameBeforeExt.c_str(),
+ g_rollIndex++, extName.c_str());
bool rollFileNameGot = false;
while (!rollFileNameGot) {
FILE* checkFile = fopen(rollFile, "r");
if (checkFile != nullptr) {
fclose(checkFile);
checkFile = nullptr;
- ACE_OS::snprintf(rollFile, 1024, "%s%c%s-%d.%s", logsdirname.c_str(),
- ACE_DIRECTORY_SEPARATOR_CHAR, fnameBeforeExt.c_str(),
- g_rollIndex++, extName.c_str());
+ std::snprintf(rollFile, 1024, "%s%c%s-%d.%s", logsdirname.c_str(),
+ ACE_DIRECTORY_SEPARATOR_CHAR, fnameBeforeExt.c_str(),
+ g_rollIndex++, extName.c_str());
} else {
rollFileNameGot = true;
}
@@ -393,7 +352,7 @@
}
void Log::close() {
- ACE_Guard<ACE_Thread_Mutex> guard(*g_logMutex);
+ std::lock_guard<decltype(g_logMutex)> guard(g_logMutex);
std::string oldfile;
@@ -510,8 +469,8 @@
default: {
char buf[64] = {0};
- ACE_OS::snprintf(buf, 64, "Unexpected log level: %d",
- static_cast<int>(level));
+ std::snprintf(buf, 64, "Unexpected log level: %d",
+ static_cast<int>(level));
throw IllegalArgumentException(buf);
}
}
@@ -553,22 +512,24 @@
char* Log::formatLogLine(char* buf, LogLevel level) {
if (g_pid == 0) {
- g_pid = ACE_OS::getpid();
+ g_pid = boost::this_process::get_id();
ACE_OS::uname(&g_uname);
}
const size_t MINBUFSIZE = 128;
- ACE_Time_Value clock = ACE_OS::gettimeofday();
- time_t secs = clock.sec();
- struct tm* tm_val = ACE_OS::localtime(&secs);
- char* pbuf = buf;
- pbuf += ACE_OS::snprintf(pbuf, 15, "[%s ", Log::levelToChars(level));
- pbuf += ACE_OS::strftime(pbuf, MINBUFSIZE, "%Y/%m/%d %H:%M:%S", tm_val);
- pbuf += ACE_OS::snprintf(pbuf, 15, ".%06" PRId64 " ",
- static_cast<int64_t>(clock.usec()));
- pbuf += ACE_OS::strftime(pbuf, MINBUFSIZE, "%Z ", tm_val);
+ auto now = std::chrono::system_clock::now();
+ auto secs = std::chrono::system_clock::to_time_t(now);
+ auto microseconds = std::chrono::duration_cast<std::chrono::microseconds>(
+ now - std::chrono::system_clock::from_time_t(secs));
+ auto tm_val = apache::geode::util::chrono::localtime(secs);
+ auto pbuf = buf;
+ pbuf += std::snprintf(pbuf, 15, "[%s ", Log::levelToChars(level));
+ pbuf += std::strftime(pbuf, MINBUFSIZE, "%Y/%m/%d %H:%M:%S", &tm_val);
+ pbuf += std::snprintf(pbuf, 15, ".%06" PRId64 " ",
+ static_cast<int64_t>(microseconds.count()));
+ pbuf += std::strftime(pbuf, MINBUFSIZE, "%Z ", &tm_val);
- ACE_OS::snprintf(pbuf, 300, "%s:%d %" PRIu64 "] ", g_uname.nodename, g_pid,
- hacks::aceThreadId(ACE_OS::thr_self()));
+ std::snprintf(pbuf, 300, "%s:%d %" PRIu64 "] ", g_uname.nodename, g_pid,
+ hacks::aceThreadId(ACE_OS::thr_self()));
return buf;
}
@@ -579,7 +540,7 @@
// int g_count = 0;
void Log::put(LogLevel level, const char* msg) {
- ACE_Guard<ACE_Thread_Mutex> guard(*g_logMutex);
+ std::lock_guard<decltype(g_logMutex)> guard(g_logMutex);
g_fileInfo fileInfo;
@@ -608,8 +569,7 @@
}
formatLogLine(buf, level);
- size_t numChars =
- static_cast<int>(ACE_OS::strlen(buf) + ACE_OS::strlen(msg));
+ size_t numChars = static_cast<int>(std::strlen(buf) + std::strlen(msg));
g_bytesWritten +=
numChars + 2; // bcoz we have to count trailing new line (\n)
@@ -640,17 +600,17 @@
fnameBeforeExt = logsbasename.substr(0, posOfExt);
extName = logsbasename.substr(posOfExt + 1, baselen);
}
- ACE_OS::snprintf(rollFile, 1024, "%s%c%s-%d.%s", logsdirname.c_str(),
- ACE_DIRECTORY_SEPARATOR_CHAR, fnameBeforeExt.c_str(),
- g_rollIndex++, extName.c_str());
+ std::snprintf(rollFile, 1024, "%s%c%s-%d.%s", logsdirname.c_str(),
+ ACE_DIRECTORY_SEPARATOR_CHAR, fnameBeforeExt.c_str(),
+ g_rollIndex++, extName.c_str());
bool rollFileNameGot = false;
while (!rollFileNameGot) {
FILE* fp1 = fopen(rollFile, "r");
if (fp1 != nullptr) {
fclose(fp1);
- ACE_OS::snprintf(rollFile, 1024, "%s%c%s-%d.%s", logsdirname.c_str(),
- ACE_DIRECTORY_SEPARATOR_CHAR, fnameBeforeExt.c_str(),
- g_rollIndex++, extName.c_str());
+ std::snprintf(rollFile, 1024, "%s%c%s-%d.%s", logsdirname.c_str(),
+ ACE_DIRECTORY_SEPARATOR_CHAR, fnameBeforeExt.c_str(),
+ g_rollIndex++, extName.c_str());
} else {
rollFileNameGot = true;
}
@@ -679,8 +639,8 @@
int status = sds.open(dirname.c_str(), selector, comparator);
if (status != -1) {
for (int index = 1; index < sds.length(); ++index) {
- ACE_OS::snprintf(fullpath, 512, "%s%c%s", dirname.c_str(),
- ACE_DIRECTORY_SEPARATOR_CHAR, sds[index]->d_name);
+ std::snprintf(fullpath, 512, "%s%c%s", dirname.c_str(),
+ ACE_DIRECTORY_SEPARATOR_CHAR, sds[index]->d_name);
ACE_OS::stat(fullpath, &statBuf);
g_fileInfoPair = std::make_pair(fullpath, statBuf.st_size);
fileInfo.push_back(g_fileInfoPair);
@@ -697,8 +657,8 @@
g_spaceUsed -= fileSize;
} else {
char printmsg[256];
- ACE_OS::snprintf(printmsg, 256, "%s\t%s\n", "Could not delete",
- fileInfo[fileIndex].first.c_str());
+ std::snprintf(printmsg, 256, "%s\t%s\n", "Could not delete",
+ fileInfo[fileIndex].first.c_str());
int numChars =
fprintf(g_log, "%s%s\n", formatLogLine(buf, level), printmsg);
g_bytesWritten +=
@@ -745,7 +705,7 @@
fn = fn.substr(fn.size() - MAX_NAME_LENGTH, MAX_NAME_LENGTH);
}
char buf[MAX_NAME_LENGTH + 512] = {0};
- ACE_OS::snprintf(buf, 1536, "{{{===>>> Entering function %s", fn.c_str());
+ std::snprintf(buf, 1536, "{{{===>>> Entering function %s", fn.c_str());
put(level, buf);
}
@@ -756,7 +716,7 @@
fn = fn.substr(fn.size() - MAX_NAME_LENGTH, MAX_NAME_LENGTH);
}
char buf[MAX_NAME_LENGTH + 512] = {0};
- ACE_OS::snprintf(buf, 1536, "<<<===}}} Exiting function %s", fn.c_str());
+ std::snprintf(buf, 1536, "<<<===}}} Exiting function %s", fn.c_str());
put(level, buf);
}
diff --git a/cppcache/src/MapSegment.cpp b/cppcache/src/MapSegment.cpp
index fda7371..37d3a7b 100644
--- a/cppcache/src/MapSegment.cpp
+++ b/cppcache/src/MapSegment.cpp
@@ -17,9 +17,7 @@
#include "MapSegment.hpp"
-#include <mutex>
-
-#include <ace/OS.h>
+#include <chrono>
#include "MapEntry.hpp"
#include "RegionInternal.hpp"
@@ -29,7 +27,6 @@
#include "TombstoneExpiryHandler.hpp"
#include "TrackedMapEntry.hpp"
#include "Utils.hpp"
-#include "ace/Time_Value.h"
#include "util/concurrent/spinlock_mutex.hpp"
namespace apache {
@@ -50,7 +47,7 @@
uint32_t mapSize = TableOfPrimes::nextLargerPrime(size, m_primeIndex);
LOGFINER("Initializing MapSegment with size %d (given size %d).", mapSize,
size);
- m_map->open(mapSize);
+ m_map->reserve(mapSize);
m_entryFactory = entryFactory;
m_region = region;
m_tombstoneList =
@@ -60,16 +57,16 @@
m_concurrencyChecksEnabled = concurrencyChecksEnabled;
}
-void MapSegment::close() { m_map->close(); }
+void MapSegment::close() {}
void MapSegment::clear() {
std::lock_guard<spinlock_mutex> lk(m_spinlock);
- m_map->unbind_all();
+ m_map->clear();
}
-int MapSegment::acquire() { return m_segmentMutex.acquire(); }
+void MapSegment::lock() { m_segmentMutex.lock(); }
-int MapSegment::release() { return m_segmentMutex.release(); }
+void MapSegment::unlock() { m_segmentMutex.unlock(); }
GfErrType MapSegment::create(const std::shared_ptr<CacheableKey>& key,
const std::shared_ptr<Cacheable>& newValue,
@@ -83,17 +80,19 @@
{
std::lock_guard<spinlock_mutex> lk(m_spinlock);
// if size is greater than 75 percent of prime, rehash
- uint32_t mapSize = TableOfPrimes::getPrime(m_primeIndex);
- if (((m_map->current_size() * 75) / 100) > mapSize) {
+ auto mapSize = TableOfPrimes::getPrime(m_primeIndex);
+ if (((m_map->size() * 75) / 100) > mapSize) {
rehash();
}
- std::shared_ptr<MapEntry> entry;
- if ((m_map->find(key, entry)) == -1) {
+
+ const auto& find = m_map->find(key);
+ if (find == m_map->end()) {
if ((err = putNoEntry(key, newValue, me, updateCount, destroyTracker,
versionTag)) != GF_NOERR) {
return err;
}
} else {
+ auto& entry = find->second;
auto entryImpl = entry->getImplPtr();
entryImpl->getValueI(oldValue);
if (oldValue == nullptr || CacheableToken::isTombstone(oldValue)) {
@@ -152,11 +151,12 @@
std::lock_guard<spinlock_mutex> lk(m_spinlock);
// if size is greater than 75 percent of prime, rehash
uint32_t mapSize = TableOfPrimes::getPrime(m_primeIndex);
- if (((m_map->current_size() * 75) / 100) > mapSize) {
+ if (((m_map->size() * 75) / 100) > mapSize) {
rehash();
}
- std::shared_ptr<MapEntry> entry;
- if ((m_map->find(key, entry)) == -1) {
+
+ const auto& find = m_map->find(key);
+ if (find == m_map->end()) {
if (delta != nullptr) {
return GF_INVALID_DELTA; // You can not apply delta when there is no
}
@@ -165,6 +165,7 @@
err = putNoEntry(key, newValue, me, updateCount, destroyTracker,
versionTag);
} else {
+ auto& entry = find->second;
auto entryImpl = entry->getImplPtr();
std::shared_ptr<Cacheable> meOldValue;
entryImpl->getValueI(meOldValue);
@@ -215,8 +216,10 @@
std::lock_guard<spinlock_mutex> lk(m_spinlock);
isTokenAdded = false;
GfErrType err = GF_NOERR;
- std::shared_ptr<MapEntry> entry;
- if ((m_map->find(key, entry)) != -1) {
+
+ const auto& find = m_map->find(key);
+ if (find != m_map->end()) {
+ auto entry = find->second;
VersionStamp versionStamp;
if (m_concurrencyChecksEnabled) {
versionStamp = entry->getVersionStamp();
@@ -261,10 +264,11 @@
bool& isEntryFound, ExpiryTaskManager::id_type expiryTaskID,
TombstoneExpiryHandler* handler, bool& expTaskSet) {
GfErrType err = GF_NOERR;
- std::shared_ptr<MapEntry> entry;
VersionStamp versionStamp;
// If entry found, else return no entry
- if ((m_map->find(key, entry)) != -1) {
+ const auto& find = m_map->find(key);
+ if (find != m_map->end()) {
+ auto entry = find->second;
isEntryFound = true;
// If the version tag is null, use the version tag of
// the existing entry
@@ -349,8 +353,7 @@
}
std::lock_guard<spinlock_mutex> lk(m_spinlock);
- std::shared_ptr<Cacheable> value;
- if ((m_map->unbind(key, entry)) == -1) {
+ if (m_map->erase(key) == 0) {
// didn't unbind, probably no entry...
oldValue = nullptr;
volatile int destroyTrackers = *m_numDestroyTrackers;
@@ -375,9 +378,8 @@
bool MapSegment::unguardedRemoveActualEntry(
const std::shared_ptr<CacheableKey>& key, bool cancelTask) {
- std::shared_ptr<MapEntry> entry;
m_tombstoneList->eraseEntryFromTombstoneList(key, cancelTask);
- if (m_map->unbind(key, entry) == -1) {
+ if (m_map->erase(key) == 0) {
return false;
}
return true;
@@ -389,7 +391,7 @@
std::shared_ptr<MapEntry> entry;
taskid = m_tombstoneList->eraseEntryFromTombstoneListWithoutCancelTask(
key, handler);
- if (m_map->unbind(key, entry) == -1) {
+ if (m_map->erase(key) == 0) {
return false;
}
return true;
@@ -407,12 +409,14 @@
std::shared_ptr<MapEntryImpl>& result,
std::shared_ptr<Cacheable>& value) {
std::lock_guard<spinlock_mutex> lk(m_spinlock);
- std::shared_ptr<MapEntry> entry;
- if ((m_map->find(key, entry)) == -1) {
+
+ const auto& find = m_map->find(key);
+ if (find == m_map->end()) {
result = nullptr;
value = nullptr;
return false;
}
+ auto entry = find->second;
// If the value is a tombstone return not found
auto mePtr = entry->getImplPtr();
@@ -431,10 +435,13 @@
*/
bool MapSegment::containsKey(const std::shared_ptr<CacheableKey>& key) {
std::lock_guard<spinlock_mutex> lk(m_spinlock);
- std::shared_ptr<MapEntry> mePtr;
- if ((m_map->find(key, mePtr)) == -1) {
+
+ const auto& find = m_map->find(key);
+ if (find == m_map->end()) {
return false;
}
+ auto mePtr = find->second;
+
// If the value is a tombstone return not found
std::shared_ptr<Cacheable> value;
auto mePtr1 = mePtr->getImplPtr();
@@ -449,12 +456,12 @@
*/
void MapSegment::getKeys(std::vector<std::shared_ptr<CacheableKey>>& result) {
std::lock_guard<spinlock_mutex> lk(m_spinlock);
- for (CacheableKeyHashMap::iterator iter = m_map->begin();
- iter != m_map->end(); iter++) {
+
+ for (const auto& kv : *m_map) {
std::shared_ptr<Cacheable> valuePtr;
- (*iter).int_id_->getImplPtr()->getValueI(valuePtr);
+ kv.second->getImplPtr()->getValueI(valuePtr);
if (!CacheableToken::isTombstone(valuePtr)) {
- result.push_back((*iter).ext_id_);
+ result.push_back(kv.first);
}
}
}
@@ -464,13 +471,13 @@
*/
void MapSegment::getEntries(std::vector<std::shared_ptr<RegionEntry>>& result) {
std::lock_guard<spinlock_mutex> lk(m_spinlock);
- for (CacheableKeyHashMap::iterator iter = m_map->begin();
- iter != m_map->end(); iter++) {
+
+ for (const auto& kv : *m_map) {
std::shared_ptr<CacheableKey> keyPtr;
std::shared_ptr<Cacheable> valuePtr;
- auto me = ((*iter).int_id_)->getImplPtr();
+ auto me = kv.second->getImplPtr();
me->getValueI(valuePtr);
- if (valuePtr != nullptr && !CacheableToken::isTombstone(valuePtr)) {
+ if (valuePtr && !CacheableToken::isTombstone(valuePtr)) {
if (CacheableToken::isInvalid(valuePtr)) {
valuePtr = nullptr;
}
@@ -486,17 +493,17 @@
*/
void MapSegment::getValues(std::vector<std::shared_ptr<Cacheable>>& result) {
std::lock_guard<spinlock_mutex> lk(m_spinlock);
- for (auto&& it : *m_map) {
- auto&& entry = it.int_id_;
+ for (const auto& kv : *m_map) {
+ auto& entry = kv.second;
std::shared_ptr<Cacheable> value;
entry->getValue(value);
- auto&& entryImpl = entry->getImplPtr();
+ auto entryImpl = entry->getImplPtr();
if (value && !CacheableToken::isInvalid(value) &&
!CacheableToken::isDestroyed(value) &&
!CacheableToken::isTombstone(value)) {
if (CacheableToken::isOverflowed(value)) { // get Value from disc.
- auto&& key = it.ext_id_;
+ auto& key = kv.first;
value = getFromDisc(key, entryImpl);
entryImpl->setValueI(value);
}
@@ -516,8 +523,8 @@
std::lock_guard<spinlock_mutex> lk(m_spinlock);
std::shared_ptr<MapEntry> entry;
std::shared_ptr<MapEntry> newEntry;
- int status;
- if ((status = m_map->find(key, entry)) == -1) {
+ const auto& find = m_map->find(key);
+ if (find == m_map->end()) {
oldValue = nullptr;
if (addIfAbsent) {
std::shared_ptr<MapEntryImpl> entryImpl;
@@ -531,6 +538,7 @@
return -1;
}
} else {
+ entry = find->second;
entry->getValue(oldValue);
if (failIfPresent) {
// return -1 without adding an entry; the callee should check on
@@ -545,11 +553,11 @@
} else {
updateCount = entry->addTracker(newEntry);
}
- if (newEntry != nullptr) {
- if (status == -1) {
- m_map->bind(key, newEntry);
+ if (newEntry) {
+ if (find == m_map->end()) {
+ m_map->emplace(key, newEntry);
} else {
- m_map->rebind(key, newEntry);
+ find->second = newEntry;
}
}
return updateCount;
@@ -562,8 +570,10 @@
const std::shared_ptr<CacheableKey>& key) {
if (m_concurrencyChecksEnabled) return;
std::lock_guard<spinlock_mutex> lk(m_spinlock);
- std::shared_ptr<MapEntry> entry;
- if ((m_map->find(key, entry)) != -1) {
+
+ const auto& find = m_map->find(key);
+ if (find != m_map->end()) {
+ auto& entry = find->second;
auto impl = entry->getImplPtr();
removeTrackerForEntry(key, entry, impl);
}
@@ -576,16 +586,16 @@
MapOfUpdateCounters& updateCounterMap) {
if (m_concurrencyChecksEnabled) return;
std::lock_guard<spinlock_mutex> lk(m_spinlock);
+
std::shared_ptr<MapEntry> newEntry;
std::shared_ptr<CacheableKey> key;
- for (CacheableKeyHashMap::iterator iter = m_map->begin();
- iter != m_map->end(); ++iter) {
- (*iter).int_id_->getKey(key);
- int updateCount = (*iter).int_id_->addTracker(newEntry);
+ for (auto& kv : *m_map) {
+ kv.second->getKey(key);
+ int updateCount = kv.second->addTracker(newEntry);
if (newEntry != nullptr) {
- m_map->rebind(key, newEntry);
+ kv.second = newEntry;
}
- updateCounterMap.insert(std::make_pair(key, updateCount));
+ updateCounterMap.emplace(key, updateCount);
}
}
@@ -602,25 +612,11 @@
* @brief replace the existing hash map with one that is wider
* to reduce collision chains.
*/
-void MapSegment::rehash() { // Only called from put, segment must already be
- // locked...
-
- uint32_t newMapSize = TableOfPrimes::getPrime(++m_primeIndex);
+void MapSegment::rehash() {
+ // Only called from put, segment must already be locked...
+ auto newMapSize = TableOfPrimes::getPrime(++m_primeIndex);
LOGFINER("Rehashing MapSegment to size %d.", newMapSize);
- auto* newMap = new CacheableKeyHashMap();
- newMap->open(newMapSize);
-
- // copy all entries into newMap..
- for (CacheableKeyHashMap::iterator iter = m_map->begin();
- iter != m_map->end(); ++iter) {
- newMap->bind((*iter).ext_id_, (*iter).int_id_);
- }
-
- // plug newMap into real member.
- CacheableKeyHashMap* oldMap = m_map;
- m_map = newMap;
- // clean up the old map.
- delete oldMap;
+ m_map->reserve(newMapSize);
m_rehashCount++;
}
std::shared_ptr<Cacheable> MapSegment::getFromDisc(
@@ -652,41 +648,46 @@
if (oldValue == nullptr || CacheableToken::isDestroyed(oldValue) ||
CacheableToken::isInvalid(oldValue) ||
CacheableToken::isTombstone(oldValue)) {
- if (m_poolDM) m_poolDM->updateNotificationStats(false, 0);
+ if (m_poolDM) {
+ m_poolDM->updateNotificationStats(false, std::chrono::nanoseconds(0));
+ }
return GF_INVALID_DELTA;
} else if (CacheableToken::isOverflowed(
oldValue)) { // get Value from disc.
oldValue = getFromDisc(key, entryImpl);
if (oldValue == nullptr) {
- if (m_poolDM) m_poolDM->updateNotificationStats(false, 0);
+ if (m_poolDM) {
+ m_poolDM->updateNotificationStats(false,
+ std::chrono::nanoseconds(0));
+ }
return GF_INVALID_DELTA;
}
}
+ using clock = std::chrono::steady_clock;
+
auto valueWithDelta = std::dynamic_pointer_cast<Delta>(oldValue);
auto& newValue1 = const_cast<std::shared_ptr<Cacheable>&>(newValue);
try {
if (m_region->getAttributes().getCloningEnabled()) {
auto tempVal = valueWithDelta->clone();
- ACE_Time_Value currTimeBefore = ACE_OS::gettimeofday();
+ auto currTimeBefore = clock::now();
tempVal->fromDelta(*delta);
if (m_poolDM) {
- m_poolDM->updateNotificationStats(
- true,
- ((ACE_OS::gettimeofday() - currTimeBefore).msec()) * 1000000);
+ m_poolDM->updateNotificationStats(true,
+ clock::now() - currTimeBefore);
}
newValue1 = std::dynamic_pointer_cast<Serializable>(tempVal);
entryImpl->setValueI(newValue1);
} else {
- ACE_Time_Value currTimeBefore = ACE_OS::gettimeofday();
+ auto currTimeBefore = clock::now();
valueWithDelta->fromDelta(*delta);
newValue1 = std::dynamic_pointer_cast<Serializable>(valueWithDelta);
if (m_poolDM) {
- m_poolDM->updateNotificationStats(
- true,
- ((ACE_OS::gettimeofday() - currTimeBefore).msec()) * 1000000);
+ m_poolDM->updateNotificationStats(true,
+ clock::now() - currTimeBefore);
}
entryImpl->setValueI(
std::dynamic_pointer_cast<Serializable>(valueWithDelta));
@@ -729,12 +730,13 @@
std::shared_ptr<MapEntryImpl>& me,
bool& result) {
std::shared_ptr<Cacheable> value;
- std::shared_ptr<MapEntry> entry;
std::shared_ptr<MapEntryImpl> mePtr;
- if (m_map->find(key, entry) == -1) {
+ const auto& find = m_map->find(key);
+ if (find == m_map->end()) {
result = false;
return GF_NOERR;
}
+ auto& entry = find->second;
mePtr = entry->getImplPtr();
if (!mePtr) {
@@ -751,8 +753,9 @@
if (CacheableToken::isTombstone(value)) {
if (m_tombstoneList->exists(key)) {
std::shared_ptr<MapEntry> entry;
- if (m_map->find(key, entry) != -1) {
- auto mePtr = entry->getImplPtr();
+ const auto find = m_map->find(key);
+ if (find != m_map->end()) {
+ auto mePtr = find->second->getImplPtr();
me = mePtr;
}
result = true;
diff --git a/cppcache/src/MapSegment.hpp b/cppcache/src/MapSegment.hpp
index 6b5dc36..3e00989 100644
--- a/cppcache/src/MapSegment.hpp
+++ b/cppcache/src/MapSegment.hpp
@@ -21,17 +21,10 @@
#define GEODE_MAPSEGMENT_H_
#include <memory>
+#include <mutex>
#include <unordered_map>
#include <vector>
-#include <ace/Functor_T.h>
-#include <ace/Hash_Map_Manager.h>
-#include <ace/Null_Mutex.h>
-#include <ace/Recursive_Thread_Mutex.h>
-#include <ace/Thread_Mutex.h>
-#include <ace/Versioned_Namespace.h>
-#include <ace/config-lite.h>
-
#include <geode/CacheableKey.hpp>
#include <geode/Delta.hpp>
#include <geode/RegionEntry.hpp>
@@ -43,42 +36,18 @@
#include "TombstoneList.hpp"
#include "util/concurrent/spinlock_mutex.hpp"
-namespace ACE_VERSIONED_NAMESPACE_NAME {
-
-template <>
-class ACE_Hash<std::shared_ptr<apache::geode::client::CacheableKey>> {
- public:
- u_long operator()(
- const std::shared_ptr<apache::geode::client::CacheableKey>& key) {
- return key->hashcode();
- }
-};
-
-template <>
-class ACE_Equal_To<std::shared_ptr<apache::geode::client::CacheableKey>> {
- public:
- bool operator()(
- const std::shared_ptr<apache::geode::client::CacheableKey>& key1,
- const std::shared_ptr<apache::geode::client::CacheableKey>& key2) {
- return key1->operator==(*key2);
- }
-};
-
-// NOLINTNEXTLINE(google-readability-namespace-comments)
-} // namespace ACE_VERSIONED_NAMESPACE_NAME
-
namespace apache {
namespace geode {
namespace client {
class RegionInternal;
-typedef ::ACE_Hash_Map_Manager_Ex<
- std::shared_ptr<CacheableKey>, std::shared_ptr<MapEntry>,
- ::ACE_Hash<std::shared_ptr<CacheableKey>>,
- ::ACE_Equal_To<std::shared_ptr<CacheableKey>>, ::ACE_Null_Mutex>
+typedef std::unordered_map<std::shared_ptr<CacheableKey>,
+ std::shared_ptr<MapEntry>,
+ dereference_hash<std::shared_ptr<CacheableKey>>,
+ dereference_equal_to<std::shared_ptr<CacheableKey>>>
CacheableKeyHashMap;
-/** @brief type wrapper around the ACE map implementation. */
+/** @brief type wrapper around the std::unordered_map implementation. */
class APACHE_GEODE_EXPORT MapSegment {
private:
// contain
@@ -92,7 +61,7 @@
// index of the current prime in the primes table
uint32_t m_primeIndex;
spinlock_mutex m_spinlock;
- ACE_Recursive_Thread_Mutex m_segmentMutex;
+ std::recursive_mutex m_segmentMutex;
bool m_concurrencyChecksEnabled;
// number of operations that are tracking destroys
@@ -116,7 +85,7 @@
std::shared_ptr<MapEntry> newEntry;
entry->incrementUpdateCount(newEntry);
if (newEntry != nullptr) {
- m_map->rebind(key, newEntry);
+ m_map->emplace(key, newEntry);
entry = newEntry;
return true;
}
@@ -140,13 +109,13 @@
entryImpl->getValueI(value);
if (value == nullptr) {
// get rid of an entry marked as destroyed
- m_map->unbind(key);
+ m_map->erase(key);
return;
}
}
if (trackerPair.first) {
entry = entryImpl ? entryImpl : entry->getImplPtr();
- m_map->rebind(key, entry);
+ (*m_map)[key] = entry;
}
}
@@ -179,7 +148,7 @@
newEntry->getVersionStamp().setVersions(*versionStamp);
}
}
- m_map->bind(key, newEntry);
+ m_map->emplace(key, newEntry);
return GF_NOERR;
}
@@ -217,10 +186,9 @@
~MapSegment();
- // methods to acquire/release MapSegment mutex (not SpinLock)
- // that allow using MapSegment with ACE_Guard
- int acquire();
- int release();
+ // methods for BasicLockable
+ void lock();
+ void unlock();
/**
* @brief initialize underlying map structures. Not called by constructor.
diff --git a/cppcache/src/MapWithLock.hpp b/cppcache/src/MapWithLock.hpp
index 2494032..58fab50 100644
--- a/cppcache/src/MapWithLock.hpp
+++ b/cppcache/src/MapWithLock.hpp
@@ -1,8 +1,3 @@
-#pragma once
-
-#ifndef GEODE_MAPWITHLOCK_H_
-#define GEODE_MAPWITHLOCK_H_
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -20,13 +15,12 @@
* limitations under the License.
*/
-#include <string>
-#include <unordered_map>
+#pragma once
-#include <ace/Hash_Map_Manager.h>
-#include <ace/Recursive_Thread_Mutex.h>
-#include <ace/Versioned_Namespace.h>
-#include <ace/config-lite.h>
+#ifndef GEODE_MAPWITHLOCK_H_
+#define GEODE_MAPWITHLOCK_H_
+
+#include <unordered_map>
#include <geode/CacheableKey.hpp>
#include <geode/internal/geode_globals.hpp>
@@ -39,23 +33,6 @@
CacheableKey::hash, CacheableKey::equal_to>
MapOfUpdateCounters;
-class Region;
-/** Map type used to hold root regions in the Cache, and subRegions. */
-typedef ACE_Hash_Map_Manager_Ex<
- std::string, std::shared_ptr<Region>, ACE_Hash<std::string>,
- ACE_Equal_To<std::string>, ACE_Recursive_Thread_Mutex>
- MapOfRegionWithLock;
-
-class CqQuery;
-typedef ACE_Hash_Map_Manager_Ex<
- std::string, std::shared_ptr<CqQuery>, ACE_Hash<std::string>,
- ACE_Equal_To<std::string>, ACE_Recursive_Thread_Mutex>
- MapOfCqQueryWithLock;
-
-/** Guard type for locking a MapOfRegionWithLock while iterating or performing
- * other composite operations. ex.. MapOfRegionGuard guard( map->mutex() );
- */
-typedef ACE_Guard<ACE_Recursive_Thread_Mutex> MapOfRegionGuard;
} // namespace client
} // namespace geode
} // namespace apache
diff --git a/cppcache/src/MemberListForVersionStamp.hpp b/cppcache/src/MemberListForVersionStamp.hpp
index cf6ae92..bc24492 100644
--- a/cppcache/src/MemberListForVersionStamp.hpp
+++ b/cppcache/src/MemberListForVersionStamp.hpp
@@ -23,11 +23,12 @@
#include <memory>
#include <unordered_map>
+#include <ace/RW_Thread_Mutex.h>
+
#include <geode/internal/geode_globals.hpp>
#include "DSMemberForVersionStamp.hpp"
#include "ReadWriteLock.hpp"
-#include "ace/RW_Thread_Mutex.h"
namespace apache {
namespace geode {
diff --git a/cppcache/src/NonCopyable.hpp b/cppcache/src/NonCopyable.hpp
index 3bb3063..7dd6cb5 100644
--- a/cppcache/src/NonCopyable.hpp
+++ b/cppcache/src/NonCopyable.hpp
@@ -31,8 +31,8 @@
NonCopyable() {}
~NonCopyable() {}
- private:
- NonCopyable(const NonCopyable&);
+ public:
+ NonCopyable(const NonCopyable&) = delete;
};
class APACHE_GEODE_EXPORT NonAssignable {
@@ -40,8 +40,8 @@
NonAssignable() {}
~NonAssignable() {}
- private:
- const NonAssignable& operator=(const NonAssignable&);
+ public:
+ const NonAssignable& operator=(const NonAssignable&) = delete;
};
} // namespace client
diff --git a/cppcache/src/PdxFieldType.cpp b/cppcache/src/PdxFieldType.cpp
index c3b3f86..360ed61 100644
--- a/cppcache/src/PdxFieldType.cpp
+++ b/cppcache/src/PdxFieldType.cpp
@@ -26,9 +26,6 @@
#include <geode/PdxFieldTypes.hpp>
#include "PdxTypes.hpp"
-//#include <malloc.h>
-
-#include "ace/OS.h"
namespace apache {
namespace geode {
@@ -135,11 +132,10 @@
std::string PdxFieldType::toString() const {
char stringBuf[1024];
- ACE_OS::snprintf(
- stringBuf, 1024,
- " PdxFieldName=%s TypeId=%d VarLenFieldIdx=%d sequenceid=%d\n",
- this->m_fieldName.c_str(), static_cast<int>(this->m_typeId),
- this->m_varLenFieldIdx, this->m_sequenceId);
+ std::snprintf(stringBuf, 1024,
+ " PdxFieldName=%s TypeId=%d VarLenFieldIdx=%d sequenceid=%d\n",
+ this->m_fieldName.c_str(), static_cast<int>(this->m_typeId),
+ this->m_varLenFieldIdx, this->m_sequenceId);
return std::string(stringBuf);
}
diff --git a/cppcache/src/PdxFieldType.hpp b/cppcache/src/PdxFieldType.hpp
index aed8471..ea04687 100644
--- a/cppcache/src/PdxFieldType.hpp
+++ b/cppcache/src/PdxFieldType.hpp
@@ -60,9 +60,9 @@
PdxFieldType();
- inline const char* getFieldName() { return m_fieldName.c_str(); }
+ inline const std::string& getFieldName() { return m_fieldName; }
- inline const char* getClassName() { return m_className.c_str(); }
+ inline const std::string& getClassName() { return m_className; }
inline PdxFieldTypes getTypeId() { return m_typeId; }
diff --git a/cppcache/src/PdxInstanceImpl.cpp b/cppcache/src/PdxInstanceImpl.cpp
index cbaf8b6..0796320 100644
--- a/cppcache/src/PdxInstanceImpl.cpp
+++ b/cppcache/src/PdxInstanceImpl.cpp
@@ -51,7 +51,7 @@
bool sortFunc(std::shared_ptr<PdxFieldType> field1,
std::shared_ptr<PdxFieldType> field2) {
- int diff = ACE_OS::strcmp(field1->getFieldName(), field2->getFieldName());
+ const auto diff = field1->getFieldName().compare(field2->getFieldName());
if (diff < 0) {
return true;
} else {
@@ -653,7 +653,7 @@
auto pField = pdxIdentityFieldList.at(i);
LOGDEBUG("hashcode for pdxfield %s hashcode is %d ",
- pField->getFieldName(), hashCode);
+ pField->getFieldName().c_str(), hashCode);
switch (pField->getTypeId()) {
case PdxFieldTypes::CHAR:
case PdxFieldTypes::BOOLEAN:
@@ -699,18 +699,8 @@
}
default: {
char excpStr[256] = {0};
- /* adongre - Coverity II
- * CID 29264: Calling risky function (SECURE_CODING)[VERY RISKY]. Using
- * "sprintf" can cause a
- * buffer overflow when done incorrectly. Because sprintf() assumes an
- * arbitrarily long string,
- * callers must be careful not to overflow the actual space of the
- * destination.
- * Use snprintf() instead, or correct precision specifiers.
- * Fix : using ACE_OS::snprintf
- */
- ACE_OS::snprintf(excpStr, 256, "PdxInstance not found typeid %d ",
- static_cast<int>(pField->getTypeId()));
+ std::snprintf(excpStr, 256, "PdxInstance not found typeid %d ",
+ static_cast<int>(pField->getTypeId()));
throw IllegalStateException(excpStr);
}
}
@@ -880,15 +870,6 @@
}
std::string PdxInstanceImpl::toString() const {
- /* adongre - Coverity II
- * CID 29265: Calling risky function (SECURE_CODING)[VERY RISKY]. Using
- * "sprintf" can cause a
- * buffer overflow when done incorrectly. Because sprintf() assumes an
- * arbitrarily long string,
- * callers must be careful not to overflow the actual space of the
- * destination. Use snprintf() instead, or correct precision specifiers. Fix
- * : using ACE_OS::snprintf
- */
auto pt = getPdxType();
std::string toString = "PDX[" + std::to_string(pt->getTypeId()) + "," +
pt->getPdxClassName() + "]{";
@@ -1163,7 +1144,8 @@
LOGDEBUG("pdxfield %s ",
((myPFT != m_DefaultPdxFieldType) ? myPFT->getFieldName()
- : otherPFT->getFieldName()));
+ : otherPFT->getFieldName())
+ .c_str());
if (myPFT->equals(m_DefaultPdxFieldType)) {
fieldTypeId = otherPFT->getTypeId();
} else if (otherPFT->equals(m_DefaultPdxFieldType)) {
@@ -1243,18 +1225,8 @@
}
default: {
char excpStr[256] = {0};
- /* adongre - Coverity II
- * CID 29267: Calling risky function (SECURE_CODING)[VERY RISKY]. Using
- * "sprintf" can cause a
- * buffer overflow when done incorrectly. Because sprintf() assumes an
- * arbitrarily long string,
- * callers must be careful not to overflow the actual space of the
- * destination.
- * Use snprintf() instead, or correct precision specifiers.
- * Fix : using ACE_OS::snprintf
- */
- ACE_OS::snprintf(excpStr, 256, "PdxInstance not found typeid %d ",
- static_cast<int>(myPFT->getTypeId()));
+ std::snprintf(excpStr, 256, "PdxInstance not found typeid %d ",
+ static_cast<int>(myPFT->getTypeId()));
throw IllegalStateException(excpStr);
}
}
@@ -1369,7 +1341,7 @@
for (size_t i = 0; i < pdxFieldList->size(); i++) {
auto currPf = pdxFieldList->at(i);
LOGDEBUG("toData filedname = %s , isVarLengthType = %d ",
- currPf->getFieldName(), currPf->IsVariableLengthType());
+ currPf->getFieldName().c_str(), currPf->IsVariableLengthType());
std::shared_ptr<Cacheable> value = nullptr;
auto&& iter = m_updatedFields.find(currPf->getFieldName());
@@ -1399,7 +1371,7 @@
for (size_t i = 0; i < pdxFieldList->size(); i++) {
auto currPf = pdxFieldList->at(i);
LOGDEBUG("toData1 filedname = %s , isVarLengthType = %d ",
- currPf->getFieldName(), currPf->IsVariableLengthType());
+ currPf->getFieldName().c_str(), currPf->IsVariableLengthType());
auto value = m_updatedFields[currPf->getFieldName()];
writeField(writer, currPf->getFieldName(), currPf->getTypeId(), value);
}
diff --git a/cppcache/src/PdxReaderWithTypeCollector.cpp b/cppcache/src/PdxReaderWithTypeCollector.cpp
index 44bc9cb..974c603 100644
--- a/cppcache/src/PdxReaderWithTypeCollector.cpp
+++ b/cppcache/src/PdxReaderWithTypeCollector.cpp
@@ -23,8 +23,6 @@
#include "PdxReaderWithTypeCollector.hpp"
-#include <ace/OS_NS_stdio.h>
-
#include <geode/PdxFieldTypes.hpp>
#include "CacheImpl.hpp"
diff --git a/cppcache/src/PdxType.cpp b/cppcache/src/PdxType.cpp
index 04457d9..53bb207 100644
--- a/cppcache/src/PdxType.cpp
+++ b/cppcache/src/PdxType.cpp
@@ -23,8 +23,6 @@
#include "PdxType.hpp"
-#include <ace/OS.h>
-
#include "PdxFieldType.hpp"
#include "PdxHelper.hpp"
#include "PdxTypeRegistry.hpp"
diff --git a/cppcache/src/PdxType.hpp b/cppcache/src/PdxType.hpp
index 54b7e40..b76b824 100644
--- a/cppcache/src/PdxType.hpp
+++ b/cppcache/src/PdxType.hpp
@@ -25,8 +25,7 @@
#include <string>
#include <vector>
-#include <ace/ACE.h>
-#include <ace/Recursive_Thread_Mutex.h>
+#include <ace/RW_Thread_Mutex.h>
#include <geode/CacheableBuiltins.hpp>
#include <geode/PdxFieldTypes.hpp>
diff --git a/cppcache/src/PdxTypeRegistry.cpp b/cppcache/src/PdxTypeRegistry.cpp
index 6c77596..9c520da 100644
--- a/cppcache/src/PdxTypeRegistry.cpp
+++ b/cppcache/src/PdxTypeRegistry.cpp
@@ -182,7 +182,8 @@
} else {
// schedule new expiry task
auto handler = new PreservedDataExpiryHandler(shared_from_this(), obj);
- auto id = expiryTaskManager.scheduleExpiryTask(handler, 20, 0, false);
+ auto id = expiryTaskManager.scheduleExpiryTask(
+ handler, std::chrono::seconds(20), std::chrono::seconds::zero(), false);
pData->setPreservedDataExpiryTaskId(id);
LOGDEBUG(
"PdxTypeRegistry::setPreserveData Schedule new expirt task with id=%ld",
diff --git a/cppcache/src/PdxTypeRegistry.hpp b/cppcache/src/PdxTypeRegistry.hpp
index 7998d1e..b2d168e 100644
--- a/cppcache/src/PdxTypeRegistry.hpp
+++ b/cppcache/src/PdxTypeRegistry.hpp
@@ -23,8 +23,7 @@
#include <map>
#include <unordered_map>
-#include <ace/ACE.h>
-#include <ace/Recursive_Thread_Mutex.h>
+#include <ace/RW_Thread_Mutex.h>
#include <geode/Cache.hpp>
#include <geode/PdxSerializable.hpp>
diff --git a/cppcache/src/Pool.cpp b/cppcache/src/Pool.cpp
index 4a02faf..129bbc6 100644
--- a/cppcache/src/Pool.cpp
+++ b/cppcache/src/Pool.cpp
@@ -21,12 +21,9 @@
#include <geode/Pool.hpp>
#include "PoolAttributes.hpp"
+#include "TcrConnectionManager.hpp"
#include "ThinClientPoolHADM.hpp"
-/**
- * @file
- */
-
namespace apache {
namespace geode {
namespace client {
diff --git a/cppcache/src/PoolAttributes.hpp b/cppcache/src/PoolAttributes.hpp
index f8a47e6..3fee900 100644
--- a/cppcache/src/PoolAttributes.hpp
+++ b/cppcache/src/PoolAttributes.hpp
@@ -24,8 +24,6 @@
#include <string>
#include <vector>
-#include <ace/OS.h>
-
#include <geode/ExceptionTypes.hpp>
#include <geode/internal/geode_globals.hpp>
diff --git a/cppcache/src/PoolFactory.cpp b/cppcache/src/PoolFactory.cpp
index d4af923..deaed13 100644
--- a/cppcache/src/PoolFactory.cpp
+++ b/cppcache/src/PoolFactory.cpp
@@ -16,7 +16,6 @@
*/
#include <ace/INET_Addr.h>
-#include <ace/Recursive_Thread_Mutex.h>
#include <geode/Pool.hpp>
#include <geode/PoolFactory.hpp>
@@ -26,6 +25,7 @@
#include "CacheImpl.hpp"
#include "CacheRegionHelper.hpp"
#include "PoolAttributes.hpp"
+#include "TcrConnectionManager.hpp"
#include "ThinClientPoolDM.hpp"
#include "ThinClientPoolHADM.hpp"
#include "ThinClientPoolStickyDM.hpp"
diff --git a/cppcache/src/PoolManagerImpl.hpp b/cppcache/src/PoolManagerImpl.hpp
index c9f5289..a35eae0 100644
--- a/cppcache/src/PoolManagerImpl.hpp
+++ b/cppcache/src/PoolManagerImpl.hpp
@@ -25,6 +25,7 @@
#include <string>
#include <unordered_map>
+#include <geode/HashMapOfPools.hpp>
#include <geode/Region.hpp>
#include "CacheImpl.hpp"
@@ -35,7 +36,6 @@
class Pool;
class PoolFactory;
-typedef std::unordered_map<std::string, std::shared_ptr<Pool>> HashMapOfPools;
class PoolManagerImpl {
public:
diff --git a/cppcache/src/PoolStatistics.hpp b/cppcache/src/PoolStatistics.hpp
index b12ed79..8b7e861 100644
--- a/cppcache/src/PoolStatistics.hpp
+++ b/cppcache/src/PoolStatistics.hpp
@@ -26,6 +26,7 @@
#include "statistics/Statistics.hpp"
#include "statistics/StatisticsFactory.hpp"
#include "statistics/StatisticsManager.hpp"
+#include "util/concurrent/spinlock_mutex.hpp"
namespace apache {
namespace geode {
diff --git a/cppcache/src/PreservedDataExpiryHandler.cpp b/cppcache/src/PreservedDataExpiryHandler.cpp
index 5cf1a3d..e30dd53 100644
--- a/cppcache/src/PreservedDataExpiryHandler.cpp
+++ b/cppcache/src/PreservedDataExpiryHandler.cpp
@@ -22,13 +22,14 @@
*/
#include "PreservedDataExpiryHandler.hpp"
+#include <ace/Reactor.h>
+#include <ace/Timer_Heap.h>
+#include <ace/Timer_Heap_T.h>
+#include <ace/Timer_Queue.h>
+#include <ace/Timer_Queue_Adapters.h>
+#include <ace/svc_export.h>
+
#include "PdxTypeRegistry.hpp"
-#include "ace/Reactor.h"
-#include "ace/Timer_Heap.h"
-#include "ace/Timer_Heap_T.h"
-#include "ace/Timer_Queue.h"
-#include "ace/Timer_Queue_Adapters.h"
-#include "ace/svc_export.h"
namespace apache {
namespace geode {
diff --git a/cppcache/src/ProxyRemoteQueryService.cpp b/cppcache/src/ProxyRemoteQueryService.cpp
index 381179c..2174a73 100644
--- a/cppcache/src/ProxyRemoteQueryService.cpp
+++ b/cppcache/src/ProxyRemoteQueryService.cpp
@@ -82,7 +82,7 @@
void ProxyRemoteQueryService::addCqQuery(
const std::shared_ptr<CqQuery>& cqQuery) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_cqQueryListLock);
+ std::lock_guard<decltype(m_cqQueryListLock)> guard(m_cqQueryListLock);
m_cqQueries.push_back(cqQuery);
}
@@ -113,7 +113,7 @@
void ProxyRemoteQueryService::closeCqs() { closeCqs(false); }
void ProxyRemoteQueryService::closeCqs(bool keepAlive) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_cqQueryListLock);
+ std::lock_guard<decltype(m_cqQueryListLock)> guard(m_cqQueryListLock);
for (auto&& q : m_cqQueries) {
try {
@@ -135,7 +135,7 @@
}
QueryService::query_container_type ProxyRemoteQueryService::getCqs() const {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_cqQueryListLock);
+ std::lock_guard<decltype(m_cqQueryListLock)> guard(m_cqQueryListLock);
return m_cqQueries;
}
@@ -160,7 +160,7 @@
}
void ProxyRemoteQueryService::executeCqs() {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_cqQueryListLock);
+ std::lock_guard<decltype(m_cqQueryListLock)> guard(m_cqQueryListLock);
for (auto&& q : m_cqQueries) {
try {
@@ -176,7 +176,7 @@
}
void ProxyRemoteQueryService::stopCqs() {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_cqQueryListLock);
+ std::lock_guard<decltype(m_cqQueryListLock)> guard(m_cqQueryListLock);
for (auto&& q : m_cqQueries) {
try {
diff --git a/cppcache/src/ProxyRemoteQueryService.hpp b/cppcache/src/ProxyRemoteQueryService.hpp
index f8508b9..82ff468 100644
--- a/cppcache/src/ProxyRemoteQueryService.hpp
+++ b/cppcache/src/ProxyRemoteQueryService.hpp
@@ -19,9 +19,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#include <memory>
-#include <ace/Recursive_Thread_Mutex.h>
+#include <memory>
+#include <mutex>
#include <geode/AuthenticatedView.hpp>
#include <geode/QueryService.hpp>
@@ -81,7 +81,7 @@
AuthenticatedView* m_authenticatedView;
query_container_type m_cqQueries;
// lock for cqQuery list;
- mutable ACE_Recursive_Thread_Mutex m_cqQueryListLock;
+ mutable std::recursive_mutex m_cqQueryListLock;
friend class AuthenticatedView;
};
diff --git a/cppcache/src/PutAllPartialResult.cpp b/cppcache/src/PutAllPartialResult.cpp
index 7cbf1c1..84adafb 100644
--- a/cppcache/src/PutAllPartialResult.cpp
+++ b/cppcache/src/PutAllPartialResult.cpp
@@ -20,8 +20,8 @@
namespace geode {
namespace client {
-PutAllPartialResult::PutAllPartialResult(
- int totalMapSize, ACE_Recursive_Thread_Mutex& responseLock) {
+PutAllPartialResult::PutAllPartialResult(int totalMapSize,
+ std::recursive_mutex& responseLock) {
m_succeededKeys = std::make_shared<VersionedCacheableObjectPartList>(
new std::vector<std::shared_ptr<CacheableKey>>(), responseLock);
m_totalMapSize = totalMapSize;
diff --git a/cppcache/src/PutAllPartialResult.hpp b/cppcache/src/PutAllPartialResult.hpp
index 5da3a62..9b7e658 100644
--- a/cppcache/src/PutAllPartialResult.hpp
+++ b/cppcache/src/PutAllPartialResult.hpp
@@ -20,6 +20,9 @@
#ifndef GEODE_PUTALLPARTIALRESULT_H_
#define GEODE_PUTALLPARTIALRESULT_H_
+#include <mutex>
+
+#include <ace/RW_Thread_Mutex.h>
#include <ace/Task.h>
#include <geode/CacheableString.hpp>
@@ -40,8 +43,7 @@
ACE_RW_Thread_Mutex g_readerWriterLock;
public:
- PutAllPartialResult(int totalMapSize,
- ACE_Recursive_Thread_Mutex& responseLock);
+ PutAllPartialResult(int totalMapSize, std::recursive_mutex& responseLock);
~PutAllPartialResult() noexcept final {}
void setTotalMapSize(int totalMapSize) { m_totalMapSize = totalMapSize; }
@@ -86,8 +88,8 @@
virtual std::string toString() const final {
char msgStr1[1024];
if (m_firstFailedKey != nullptr) {
- ACE_OS::snprintf(msgStr1, 1024, "[ Key =%s ]",
- m_firstFailedKey->toString().c_str());
+ std::snprintf(msgStr1, 1024, "[ Key =%s ]",
+ m_firstFailedKey->toString().c_str());
}
char msgStr2[1024];
@@ -95,12 +97,12 @@
// TODO:: impl. CacheableObjectPartList.size();
int failedKeyNum = m_totalMapSize - m_succeededKeys->size();
if (failedKeyNum > 0) {
- ACE_OS::snprintf(
+ std::snprintf(
msgStr2, 1024,
"The putAll operation failed to put %d out of %d entries ",
failedKeyNum, m_totalMapSize);
} else {
- ACE_OS::snprintf(
+ std::snprintf(
msgStr2, 1024,
"The putAll operation successfully put %d out of %d entries ",
m_succeededKeys->size(), m_totalMapSize);
@@ -108,8 +110,8 @@
}
char stringBuf[7000];
- ACE_OS::snprintf(stringBuf, 7000, "PutAllPartialResult: %s%s", msgStr1,
- msgStr2);
+ std::snprintf(stringBuf, 7000, "PutAllPartialResult: %s%s", msgStr1,
+ msgStr2);
return std::string(stringBuf);
}
};
diff --git a/cppcache/src/PutAllPartialResultServerException.cpp b/cppcache/src/PutAllPartialResultServerException.cpp
index b1cd000..b1a4a6d 100644
--- a/cppcache/src/PutAllPartialResultServerException.cpp
+++ b/cppcache/src/PutAllPartialResultServerException.cpp
@@ -29,7 +29,7 @@
PutAllPartialResultServerException::PutAllPartialResultServerException() {
LOGDEBUG("Partial keys are processed in putAll");
- ACE_Recursive_Thread_Mutex responseLock;
+ std::recursive_mutex responseLock;
m_result = std::make_shared<PutAllPartialResult>(-1, responseLock);
}
diff --git a/cppcache/src/Queue.hpp b/cppcache/src/Queue.hpp
index bdab592..715277d 100644
--- a/cppcache/src/Queue.hpp
+++ b/cppcache/src/Queue.hpp
@@ -1,8 +1,3 @@
-#pragma once
-
-#ifndef GEODE_QUEUE_H_
-#define GEODE_QUEUE_H_
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -20,12 +15,15 @@
* limitations under the License.
*/
-#include <deque>
+#pragma once
-#include <ace/Condition_Recursive_Thread_Mutex.h>
-#include <ace/Guard_T.h>
-#include <ace/Recursive_Thread_Mutex.h>
-#include <ace/Time_Value.h>
+#ifndef GEODE_QUEUE_H_
+#define GEODE_QUEUE_H_
+
+#include <chrono>
+#include <condition_variable>
+#include <deque>
+#include <mutex>
namespace apache {
namespace geode {
@@ -39,76 +37,62 @@
* should be deleted in the destructor, and maximum size of queue.
*/
explicit Queue(bool deleteObjs = true, const uint32_t maxSize = 0)
- : m_cond(m_mutex),
- m_deleteObjs(deleteObjs),
- m_maxSize(maxSize),
- m_closed(false) {}
+ : m_deleteObjs(deleteObjs), m_maxSize(maxSize), m_closed(false) {}
~Queue() { close(); }
T get() {
- ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_mutex);
+ std::unique_lock<decltype(m_mutex)> _guard(m_mutex);
return getNoLock();
}
- /** wait "sec" secs, "usec" micros time until notified */
- T getUntil(uint32_t sec, uint32_t usec = 0) {
- auto&& mp = get();
-
+ template <class _Rep, class _Period>
+ T getFor(const std::chrono::duration<_Rep, _Period>& duration) {
+ std::unique_lock<decltype(m_mutex)> _guard(m_mutex);
+ auto&& mp = getNoLock();
if (mp == nullptr) {
- ACE_Time_Value interval(sec + usec / 1000000, usec % 1000000);
- ACE_Time_Value stopAt(ACE_OS::gettimeofday());
- stopAt += interval;
-
- while (!m_closed && mp == nullptr && ACE_OS::gettimeofday() < stopAt) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_mutex);
- if (m_cond.wait(&stopAt) != -1) mp = getNoLock();
- }
+ m_cond.wait_for(_guard, duration, [this, &mp] {
+ return !(m_closed || nullptr == (mp = getNoLock()));
+ });
}
return mp;
}
bool put(T mp) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_mutex);
+ std::unique_lock<decltype(m_mutex)> _guard(m_mutex);
if (m_maxSize > 0 && m_queue.size() >= m_maxSize) {
return false;
}
return putNoLock(mp);
}
- bool putUntil(T mp, uint32_t sec, uint32_t usec = 0) {
+ template <class _Rep, class _Period>
+ bool putFor(T mp, const std::chrono::duration<_Rep, _Period>& duration) {
if (m_maxSize > 0) {
- {
- ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_mutex);
- if (m_queue.size() < m_maxSize) {
- return putNoLock(mp);
- }
+ std::unique_lock<decltype(m_mutex)> _guard(m_mutex);
+ if (m_queue.size() < m_maxSize) {
+ return putNoLock(mp);
}
- ACE_Time_Value interval(sec + usec / 1000000, usec % 1000000);
- ACE_Time_Value stopAt(ACE_OS::gettimeofday());
- stopAt += interval;
- while (ACE_OS::gettimeofday() < stopAt) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_mutex);
- m_cond.wait(&stopAt);
- if (m_queue.size() < m_maxSize) {
- return putNoLock(mp);
- }
+ if (m_cond.wait_for(_guard, duration,
+ [this] { return m_queue.size() < m_maxSize; })) {
+ return putNoLock(mp);
}
+
return false;
} else {
- ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_mutex);
+ std::unique_lock<decltype(m_mutex)> _guard(m_mutex);
return putNoLock(mp);
}
}
void open() {
- ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_mutex);
+ std::unique_lock<decltype(m_mutex)> _guard(m_mutex);
m_closed = false;
}
void close() {
- ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_mutex);
+ std::unique_lock<decltype(m_mutex)> _guard(m_mutex);
if (m_deleteObjs) {
while (m_queue.size() > 0) {
@@ -119,11 +103,11 @@
m_queue.clear();
}
m_closed = true;
- m_cond.signal();
+ m_cond.notify_all();
}
uint32_t size() {
- ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_mutex);
+ std::unique_lock<decltype(m_mutex)> _guard(m_mutex);
return static_cast<uint32_t>(m_queue.size());
}
@@ -133,13 +117,13 @@
inline T getNoLock() {
T mp = nullptr;
- uint32_t queueSize = static_cast<uint32_t>(m_queue.size());
+ auto queueSize = static_cast<uint32_t>(m_queue.size());
if (queueSize > 0) {
mp = m_queue.back();
m_queue.pop_back();
// signal the waiting putter threads, if any
if (m_maxSize > 0 && queueSize == m_maxSize) {
- m_cond.signal();
+ m_cond.notify_one();
}
}
return mp;
@@ -150,7 +134,7 @@
m_queue.push_front(mp);
// signal the waiting getter threads, if any
if (m_queue.size() == 1) {
- m_cond.signal();
+ m_cond.notify_one();
}
return true;
}
@@ -158,12 +142,13 @@
}
std::deque<T> m_queue;
- ACE_Recursive_Thread_Mutex m_mutex;
- ACE_Condition<ACE_Recursive_Thread_Mutex> m_cond;
+ std::recursive_mutex m_mutex;
+ std::condition_variable_any m_cond;
bool m_deleteObjs;
const uint32_t m_maxSize;
bool m_closed;
};
+
} // namespace client
} // namespace geode
} // namespace apache
diff --git a/cppcache/src/ReadWriteLock.cpp b/cppcache/src/ReadWriteLock.cpp
index aa02c6a..2ce5385 100644
--- a/cppcache/src/ReadWriteLock.cpp
+++ b/cppcache/src/ReadWriteLock.cpp
@@ -23,44 +23,6 @@
namespace geode {
namespace client {
-TimedTryWriteGuard::TimedTryWriteGuard(ACE_RW_Thread_Mutex& lock, uint32_t usec)
- : lock_(lock), isAcquired_(false), mutex_(), cond_(mutex_) {
- int cnt = 10;
- uint32_t timeSlice = usec / cnt;
- do {
- if (lock_.tryacquire_write() != -1) {
- isAcquired_ = true;
- break;
- }
- ACE_Time_Value tv = ACE_OS::gettimeofday();
- ACE_Time_Value offset(0, timeSlice);
- tv += offset;
- ACE_Time_Value stopAt(tv);
- ACE_OS::thr_yield();
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(cond_.mutex());
- cond_.waitUntil(&stopAt);
- } while (cnt-- > 0);
-}
-
-bool TimedTryWriteGuard::tryAcquireLock(uint32_t usec) {
- int cnt = 10;
- uint32_t timeSlice = usec / cnt;
- do {
- if (lock_.tryacquire_write() != -1) {
- isAcquired_ = true;
- break;
- }
- ACE_Time_Value tv = ACE_OS::gettimeofday();
- ACE_Time_Value offset(0, timeSlice);
- tv += offset;
- ACE_Time_Value stopAt(tv);
- ACE_OS::thr_yield();
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(cond_.mutex());
- cond_.waitUntil(&stopAt);
- } while (cnt-- > 0);
- return isAcquired();
-}
-
TryReadGuard::TryReadGuard(ACE_RW_Thread_Mutex& lock,
const volatile bool& exitCondition)
: lock_(lock), isAcquired_(false) {
diff --git a/cppcache/src/ReadWriteLock.hpp b/cppcache/src/ReadWriteLock.hpp
index 825d277..ecad9b8 100644
--- a/cppcache/src/ReadWriteLock.hpp
+++ b/cppcache/src/ReadWriteLock.hpp
@@ -1,8 +1,3 @@
-#pragma once
-
-#ifndef GEODE_READWRITELOCK_H_
-#define GEODE_READWRITELOCK_H_
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -20,28 +15,18 @@
* limitations under the License.
*/
+#pragma once
+
+#ifndef GEODE_READWRITELOCK_H_
+#define GEODE_READWRITELOCK_H_
+
#include <ace/RW_Thread_Mutex.h>
-#include "Condition.hpp"
+#include <geode/internal/geode_globals.hpp>
namespace apache {
namespace geode {
namespace client {
-class TimedTryWriteGuard {
- public:
- TimedTryWriteGuard(ACE_RW_Thread_Mutex& lock, uint32_t usec);
- bool tryAcquireLock(uint32_t usec);
- ~TimedTryWriteGuard() {
- if (isAcquired_) lock_.release();
- }
- bool isAcquired() const { return isAcquired_; }
-
- private:
- ACE_RW_Thread_Mutex& lock_;
- bool isAcquired_;
- ACE_Recursive_Thread_Mutex mutex_;
- Condition cond_;
-};
class APACHE_GEODE_EXPORT ReadGuard {
public:
diff --git a/cppcache/src/RegionAttributes.cpp b/cppcache/src/RegionAttributes.cpp
index f696f12..8c37059 100644
--- a/cppcache/src/RegionAttributes.cpp
+++ b/cppcache/src/RegionAttributes.cpp
@@ -19,7 +19,6 @@
#include <string>
#include <ace/DLL.h>
-#include <ace/OS.h>
#include <geode/Cache.hpp>
#include <geode/DataInput.hpp>
diff --git a/cppcache/src/RegionExpiryHandler.cpp b/cppcache/src/RegionExpiryHandler.cpp
index 062f0fb..71ffc46 100644
--- a/cppcache/src/RegionExpiryHandler.cpp
+++ b/cppcache/src/RegionExpiryHandler.cpp
@@ -17,15 +17,16 @@
#include "RegionExpiryHandler.hpp"
+#include <ace/Reactor.h>
+#include <ace/Timer_Heap.h>
+#include <ace/Timer_Heap_T.h>
+#include <ace/Timer_Queue.h>
+#include <ace/Timer_Queue_Adapters.h>
+#include <ace/svc_export.h>
+
#include "CacheImpl.hpp"
#include "ExpiryTaskManager.hpp"
#include "RegionInternal.hpp"
-#include "ace/Reactor.h"
-#include "ace/Timer_Heap.h"
-#include "ace/Timer_Heap_T.h"
-#include "ace/Timer_Queue.h"
-#include "ace/Timer_Queue_Adapters.h"
-#include "ace/svc_export.h"
namespace apache {
namespace geode {
diff --git a/cppcache/src/RegionFactory.cpp b/cppcache/src/RegionFactory.cpp
index 166444f..ab947dd 100644
--- a/cppcache/src/RegionFactory.cpp
+++ b/cppcache/src/RegionFactory.cpp
@@ -18,9 +18,6 @@
#include <map>
#include <string>
-#include <ace/Guard_T.h>
-#include <ace/Recursive_Thread_Mutex.h>
-
#include <geode/Cache.hpp>
#include <geode/CacheFactory.hpp>
#include <geode/PoolManager.hpp>
@@ -156,7 +153,7 @@
RegionFactory& RegionFactory::setInitialCapacity(int initialCapacity) {
char excpStr[256] = {0};
if (initialCapacity < 0) {
- ACE_OS::snprintf(excpStr, 256, "initialCapacity must be >= 0 ");
+ std::snprintf(excpStr, 256, "initialCapacity must be >= 0 ");
throw IllegalArgumentException(excpStr);
}
m_regionAttributesFactory->setInitialCapacity(initialCapacity);
diff --git a/cppcache/src/RemoteQuery.cpp b/cppcache/src/RemoteQuery.cpp
index 0c28ea5..fce5803 100644
--- a/cppcache/src/RemoteQuery.cpp
+++ b/cppcache/src/RemoteQuery.cpp
@@ -19,6 +19,7 @@
#include "ResultSetImpl.hpp"
#include "StructSetImpl.hpp"
+#include "TcrConnectionManager.hpp"
#include "ThinClientPoolDM.hpp"
#include "ThinClientRegion.hpp"
#include "UserAttributes.hpp"
@@ -96,10 +97,10 @@
} else {
if (values->size() % fieldNameVec.size() != 0) {
char exMsg[1024];
- ACE_OS::snprintf(exMsg, 1023,
- "%s: Number of values coming from "
- "server has to be exactly divisible by field count",
- func);
+ std::snprintf(exMsg, 1023,
+ "%s: Number of values coming from "
+ "server has to be exactly divisible by field count",
+ func);
throw MessageException(exMsg);
} else {
LOGFINEST("%s: creating StructSet for query: %s", func,
diff --git a/cppcache/src/RemoteQuery.hpp b/cppcache/src/RemoteQuery.hpp
index 71dda84..263d2e0 100644
--- a/cppcache/src/RemoteQuery.hpp
+++ b/cppcache/src/RemoteQuery.hpp
@@ -32,16 +32,13 @@
#include <geode/internal/geode_globals.hpp>
#include "CacheImpl.hpp"
-#include "ThinClientBaseDM.hpp"
-
-/**
- * @file
- */
namespace apache {
namespace geode {
namespace client {
+class ThinClientBaseDM;
+
class APACHE_GEODE_EXPORT RemoteQuery : public Query {
std::string m_queryString;
std::shared_ptr<RemoteQueryService> m_queryService;
diff --git a/cppcache/src/RemoteQueryService.cpp b/cppcache/src/RemoteQueryService.cpp
index dcec032..8a3d079 100644
--- a/cppcache/src/RemoteQueryService.cpp
+++ b/cppcache/src/RemoteQueryService.cpp
@@ -72,8 +72,6 @@
return std::shared_ptr<Query>(
new RemoteQuery(querystring, shared_from_this(), m_tccdm));
} else {
- auto ua =
- TSSUserAttributesWrapper::s_geodeTSSUserAttributes->getUserAttributes();
TryReadGuard guard(m_rwLock, m_invalid);
if (m_invalid) {
@@ -83,7 +81,8 @@
LOGDEBUG("RemoteQueryService: creating a new query: " + querystring);
return std::shared_ptr<Query>(new RemoteQuery(
- querystring, shared_from_this(), m_tccdm, ua->getAuthenticatedView()));
+ querystring, shared_from_this(), m_tccdm,
+ UserAttributes::threadLocalUserAttributes->getAuthenticatedView()));
}
}
diff --git a/cppcache/src/RemoteQueryService.hpp b/cppcache/src/RemoteQueryService.hpp
index 6003eeb..9de7ac8 100644
--- a/cppcache/src/RemoteQueryService.hpp
+++ b/cppcache/src/RemoteQueryService.hpp
@@ -23,7 +23,7 @@
#include <memory>
#include <string>
-#include <ace/Recursive_Thread_Mutex.h>
+#include <ace/RW_Thread_Mutex.h>
#include <geode/QueryService.hpp>
#include <geode/internal/geode_globals.hpp>
diff --git a/cppcache/src/SerializationRegistry.cpp b/cppcache/src/SerializationRegistry.cpp
index 5040c9e..7918144 100644
--- a/cppcache/src/SerializationRegistry.cpp
+++ b/cppcache/src/SerializationRegistry.cpp
@@ -230,7 +230,8 @@
TypeFactoryMethod createType = nullptr;
- theTypeMap.findDataSerializableFixedId(fixedId, createType);
+ theTypeMap.findDataSerializableFixedId(static_cast<DSFid>(fixedId),
+ createType);
if (createType == nullptr) {
throw IllegalStateException("Unregistered type in deserialization");
@@ -285,11 +286,12 @@
}
void SerializationRegistry::addDataSerializableFixedIdType(
- int32_t id, TypeFactoryMethod func) {
+ internal::DSFid id, TypeFactoryMethod func) {
theTypeMap.rebindDataSerializableFixedId(id, func);
}
-void SerializationRegistry::removeDataSerializableFixeIdType(int32_t id) {
+void SerializationRegistry::removeDataSerializableFixeIdType(
+ internal::DSFid id) {
theTypeMap.unbindDataSerializableFixedId(id);
}
@@ -367,36 +369,45 @@
void TheTypeMap::clear() {
std::lock_guard<util::concurrent::spinlock_mutex> guard(
m_dataSerializableMapLock);
- m_dataSerializableMap->unbind_all();
+ m_dataSerializableMap.clear();
std::lock_guard<util::concurrent::spinlock_mutex> guard2(
m_dataSerializableFixedIdMapLock);
- m_dataSerializableFixedIdMap->unbind_all();
+ m_dataSerializableFixedIdMap.clear();
std::lock_guard<util::concurrent::spinlock_mutex> guard3(
m_pdxSerializableMapLock);
- m_pdxSerializableMap->unbind_all();
+ m_pdxSerializableMap.clear();
}
void TheTypeMap::findDataSerializable(int32_t id,
TypeFactoryMethod& func) const {
std::lock_guard<util::concurrent::spinlock_mutex> guard(
m_dataSerializableMapLock);
- m_dataSerializableMap->find(id, func);
+ const auto& found = m_dataSerializableMap.find(id);
+ if (found != m_dataSerializableMap.end()) {
+ func = found->second;
+ }
}
-void TheTypeMap::findDataSerializableFixedId(int32_t id,
+void TheTypeMap::findDataSerializableFixedId(DSFid dsfid,
TypeFactoryMethod& func) const {
std::lock_guard<util::concurrent::spinlock_mutex> guard(
m_dataSerializableFixedIdMapLock);
- m_dataSerializableFixedIdMap->find(id, func);
+ const auto& found = m_dataSerializableFixedIdMap.find(dsfid);
+ if (found != m_dataSerializableFixedIdMap.end()) {
+ func = found->second;
+ }
}
void TheTypeMap::findDataSerializablePrimitive(DSCode dsCode,
TypeFactoryMethod& func) const {
std::lock_guard<util::concurrent::spinlock_mutex> guard(
m_dataSerializablePrimitiveMapLock);
- m_dataSerializablePrimitiveMap->find(dsCode, func);
+ const auto& found = m_dataSerializablePrimitiveMap.find(dsCode);
+ if (found != m_dataSerializablePrimitiveMap.end()) {
+ func = found->second;
+ }
}
void TheTypeMap::bindDataSerializable(TypeFactoryMethod func, int32_t id) {
@@ -412,49 +423,34 @@
std::lock_guard<util::concurrent::spinlock_mutex> guard(
m_dataSerializableMapLock);
- int bindRes = m_dataSerializableMap->bind(id, func);
- if (bindRes == 1) {
+ const auto& result = m_dataSerializableMap.emplace(id, func);
+ if (!result.second) {
LOGERROR("A class with ID %d is already registered.", id);
throw IllegalStateException("A class with given ID is already registered.");
- } else if (bindRes == -1) {
- LOGERROR("Unknown error while adding class ID %d to map.", id);
- throw IllegalStateException("Unknown error while adding type to map.");
}
}
void TheTypeMap::rebindDataSerializable(int32_t id, TypeFactoryMethod func) {
std::lock_guard<util::concurrent::spinlock_mutex> guard(
m_dataSerializableMapLock);
- int bindRes = m_dataSerializableMap->rebind(id, func);
- if (bindRes == -1) {
- LOGERROR(
- "Unknown error "
- "while adding class ID %d to map.",
- id);
- throw IllegalStateException(
- "Unknown error "
- "while adding type to map.");
- }
+ m_dataSerializableMap[id] = func;
}
void TheTypeMap::unbindDataSerializable(int32_t id) {
std::lock_guard<util::concurrent::spinlock_mutex> guard(
m_dataSerializableMapLock);
- m_dataSerializableMap->unbind(id);
+ m_dataSerializableMap.erase(id);
}
void TheTypeMap::bindDataSerializablePrimitive(TypeFactoryMethod func,
DSCode dsCode) {
std::lock_guard<util::concurrent::spinlock_mutex> guard(
m_dataSerializablePrimitiveMapLock);
- int bindRes = m_dataSerializablePrimitiveMap->bind(dsCode, func);
- if (bindRes == 1) {
+ const auto& result = m_dataSerializablePrimitiveMap.emplace(dsCode, func);
+ if (!result.second) {
LOGERROR("A class with DSCode %d is already registered.", dsCode);
throw IllegalStateException(
"A class with given DSCode is already registered.");
- } else if (bindRes == -1) {
- LOGERROR("Unknown error while adding DSCode %d to map.", dsCode);
- throw IllegalStateException("Unknown error while adding type to map.");
}
}
@@ -462,16 +458,16 @@
TypeFactoryMethod func) {
std::lock_guard<util::concurrent::spinlock_mutex> guard(
m_dataSerializablePrimitiveMapLock);
- m_dataSerializablePrimitiveMap->rebind(dsCode, func);
+ m_dataSerializablePrimitiveMap[dsCode] = func;
}
void TheTypeMap::bindDataSerializableFixedId(TypeFactoryMethod func) {
auto obj = func();
- int32_t id = 0;
+ DSFid id;
if (const auto dataSerializableFixedId =
std::dynamic_pointer_cast<DataSerializableFixedId>(obj)) {
- id = static_cast<int64_t>(dataSerializableFixedId->getDSFID());
+ id = dataSerializableFixedId->getDSFID();
} else {
throw UnsupportedOperationException(
"TheTypeMap::bindDataSerializableInternal: Unknown serialization "
@@ -480,37 +476,25 @@
std::lock_guard<util::concurrent::spinlock_mutex> guard(
m_dataSerializableFixedIdMapLock);
- int bindRes = m_dataSerializableFixedIdMap->bind(id, func);
- if (bindRes == 1) {
- LOGERROR(
- "A fixed class with "
- "ID %d is already registered.",
- id);
+ const auto& result = m_dataSerializableFixedIdMap.emplace(id, func);
+ if (!result.second) {
+ LOGERROR("A fixed class with ID %d is already registered.", id);
throw IllegalStateException(
- "A fixed class with "
- "given ID is already registered.");
- } else if (bindRes == -1) {
- LOGERROR(
- "Unknown error "
- "while adding class ID %d to map2.",
- id);
- throw IllegalStateException(
- "Unknown error "
- "while adding to map2.");
+ "A fixed class with given ID is already registered.");
}
}
-void TheTypeMap::rebindDataSerializableFixedId(int32_t id,
+void TheTypeMap::rebindDataSerializableFixedId(internal::DSFid id,
TypeFactoryMethod func) {
std::lock_guard<util::concurrent::spinlock_mutex> guard(
m_dataSerializableFixedIdMapLock);
- m_dataSerializableFixedIdMap->rebind(id, func);
+ m_dataSerializableFixedIdMap[id] = func;
}
-void TheTypeMap::unbindDataSerializableFixedId(int32_t id) {
+void TheTypeMap::unbindDataSerializableFixedId(internal::DSFid id) {
std::lock_guard<util::concurrent::spinlock_mutex> guard(
m_dataSerializableFixedIdMapLock);
- m_dataSerializableFixedIdMap->unbind(id);
+ m_dataSerializableFixedIdMap.erase(id);
}
void TheTypeMap::bindPdxSerializable(TypeFactoryMethodPdx func) {
@@ -519,17 +503,12 @@
m_pdxSerializableMapLock);
auto&& objFullName = obj->getClassName();
- int bindRes = m_pdxSerializableMap->bind(objFullName, func);
-
- if (bindRes == 1) {
+ const auto& result = m_pdxSerializableMap.emplace(objFullName, func);
+ if (!result.second) {
LOGERROR("A object with FullName " + objFullName +
" is already registered.");
throw IllegalStateException(
"A Object with given FullName is already registered.");
- } else if (bindRes == -1) {
- LOGERROR("Unknown error while adding Pdx Object named " + objFullName +
- " to map.");
- throw IllegalStateException("Unknown error while adding type to map.");
}
}
@@ -537,27 +516,23 @@
TypeFactoryMethodPdx& func) const {
std::lock_guard<util::concurrent::spinlock_mutex> guard(
m_pdxSerializableMapLock);
- m_pdxSerializableMap->find(objFullName, func);
+ const auto& found = m_pdxSerializableMap.find(objFullName);
+ if (found != m_pdxSerializableMap.end()) {
+ func = found->second;
+ }
}
void TheTypeMap::rebindPdxSerializable(std::string objFullName,
TypeFactoryMethodPdx func) {
std::lock_guard<util::concurrent::spinlock_mutex> guard(
m_pdxSerializableMapLock);
- int bindRes = m_pdxSerializableMap->rebind(objFullName, func);
- if (bindRes == -1) {
- LOGERROR("Unknown error while adding Pdx Object FullName " + objFullName +
- " to map.");
- throw IllegalStateException(
- "Unknown error "
- "while adding type to map.");
- }
+ m_pdxSerializableMap[objFullName] = func;
}
void TheTypeMap::unbindPdxSerializable(const std::string& objFullName) {
std::lock_guard<util::concurrent::spinlock_mutex> guard(
m_pdxSerializableMapLock);
- m_pdxSerializableMap->unbind(objFullName);
+ m_pdxSerializableMap.erase(objFullName);
}
void PdxTypeHandler::serialize(
diff --git a/cppcache/src/SerializationRegistry.hpp b/cppcache/src/SerializationRegistry.hpp
index 329cc62..bd46bcd 100644
--- a/cppcache/src/SerializationRegistry.hpp
+++ b/cppcache/src/SerializationRegistry.hpp
@@ -28,10 +28,6 @@
#include <typeinfo>
#include <unordered_map>
-#include <ace/Hash_Map_Manager.h>
-#include <ace/Null_Mutex.h>
-#include <ace/Thread_Mutex.h>
-
#include <geode/DataOutput.hpp>
#include <geode/DataSerializable.hpp>
#include <geode/Delta.hpp>
@@ -48,33 +44,27 @@
#include "config.h"
#include "util/concurrent/spinlock_mutex.hpp"
-namespace ACE_VERSIONED_NAMESPACE_NAME {
+namespace std {
-#if defined(_MACOSX)
-// TODO CMake check type int64_t
template <>
-class ACE_Export ACE_Hash<int64_t> {
- public:
- // NOLINTNEXTLINE(google-runtime-int)
- inline unsigned long operator()(int64_t t) const {
- // NOLINTNEXTLINE(google-runtime-int)
- return static_cast<unsigned long>(t);
+struct hash<apache::geode::client::internal::DSCode>
+ : public std::unary_function<apache::geode::client::internal::DSCode,
+ size_t> {
+ size_t operator()(apache::geode::client::internal::DSCode val) const {
+ return std::hash<int32_t>{}(static_cast<int32_t>(val));
}
};
-#endif
-
-using apache::geode::client::DSCode;
template <>
-class ACE_Hash<DSCode> {
- public:
- inline u_long operator()(const DSCode key) {
- return static_cast<u_long>(key);
+struct hash<apache::geode::client::internal::DSFid>
+ : public std::unary_function<apache::geode::client::internal::DSFid,
+ size_t> {
+ size_t operator()(apache::geode::client::internal::DSFid val) const {
+ return std::hash<int32_t>{}(static_cast<int32_t>(val));
}
};
-// NOLINTNEXTLINE(google-readability-namespace-comments)
-} // namespace ACE_VERSIONED_NAMESPACE_NAME
+} // namespace std
namespace apache {
namespace geode {
@@ -83,21 +73,14 @@
using internal::DataSerializableInternal;
using internal::DataSerializablePrimitive;
-typedef ACE_Hash_Map_Manager<DSCode, TypeFactoryMethod, ACE_Null_Mutex>
- DSCodeToFactoryMap;
-
-typedef ACE_Hash_Map_Manager<int32_t, TypeFactoryMethod, ACE_Null_Mutex>
- IdToFactoryMap;
-
-typedef ACE_Hash_Map_Manager<std::string, TypeFactoryMethodPdx, ACE_Null_Mutex>
- StrToPdxFactoryMap;
-
class TheTypeMap : private NonCopyable {
private:
- DSCodeToFactoryMap* m_dataSerializablePrimitiveMap;
- IdToFactoryMap* m_dataSerializableMap;
- IdToFactoryMap* m_dataSerializableFixedIdMap;
- StrToPdxFactoryMap* m_pdxSerializableMap;
+ std::unordered_map<internal::DSCode, TypeFactoryMethod>
+ m_dataSerializablePrimitiveMap;
+ std::unordered_map<int32_t, TypeFactoryMethod> m_dataSerializableMap;
+ std::unordered_map<internal::DSFid, TypeFactoryMethod>
+ m_dataSerializableFixedIdMap;
+ std::unordered_map<std::string, TypeFactoryMethodPdx> m_pdxSerializableMap;
mutable util::concurrent::spinlock_mutex m_dataSerializablePrimitiveMapLock;
mutable util::concurrent::spinlock_mutex m_dataSerializableMapLock;
mutable util::concurrent::spinlock_mutex m_dataSerializableFixedIdMapLock;
@@ -107,35 +90,9 @@
std::unordered_map<std::type_index, int32_t> typeToClassId;
public:
- TheTypeMap() {
- // map to hold DataSerializablePrimitive
- m_dataSerializablePrimitiveMap = new DSCodeToFactoryMap();
+ TheTypeMap() { setup(); }
- // map to hold Data Serializable IDs
- m_dataSerializableMap = new IdToFactoryMap();
-
- // map to hold internal Data Serializable Fixed IDs
- m_dataSerializableFixedIdMap = new IdToFactoryMap();
-
- // map to hold PDX types <string, funptr>.
- m_pdxSerializableMap = new StrToPdxFactoryMap();
-
- setup();
- }
-
- virtual ~TheTypeMap() {
- if (m_dataSerializableMap != nullptr) {
- delete m_dataSerializableMap;
- }
-
- if (m_dataSerializableFixedIdMap != nullptr) {
- delete m_dataSerializableFixedIdMap;
- }
-
- if (m_pdxSerializableMap != nullptr) {
- delete m_pdxSerializableMap;
- }
- }
+ ~TheTypeMap() noexcept = default;
void setup();
@@ -149,13 +106,15 @@
void unbindDataSerializable(int32_t id);
- void findDataSerializableFixedId(int32_t id, TypeFactoryMethod& func) const;
+ void findDataSerializableFixedId(internal::DSFid id,
+ TypeFactoryMethod& func) const;
void bindDataSerializableFixedId(TypeFactoryMethod func);
- void rebindDataSerializableFixedId(int32_t idd, TypeFactoryMethod func);
+ void rebindDataSerializableFixedId(internal::DSFid id,
+ TypeFactoryMethod func);
- void unbindDataSerializableFixedId(int32_t id);
+ void unbindDataSerializableFixedId(internal::DSFid id);
void bindPdxSerializable(TypeFactoryMethodPdx func);
@@ -287,9 +246,10 @@
void addDataSerializableFixedIdType(TypeFactoryMethod func);
- void addDataSerializableFixedIdType(int32_t id, TypeFactoryMethod func);
+ void addDataSerializableFixedIdType(internal::DSFid id,
+ TypeFactoryMethod func);
- void removeDataSerializableFixeIdType(int32_t id);
+ void removeDataSerializableFixeIdType(internal::DSFid id);
void setDataSerializablePrimitiveType(TypeFactoryMethod func, DSCode dsCode);
diff --git a/cppcache/src/ServerLocation.hpp b/cppcache/src/ServerLocation.hpp
index b43b4b4..1461203 100644
--- a/cppcache/src/ServerLocation.hpp
+++ b/cppcache/src/ServerLocation.hpp
@@ -108,12 +108,7 @@
inline bool isValid() const { return !m_serverName.empty() && m_port >= 0; }
- inline std::string& getEpString() {
- /*if (m_epString.empty() == false) {
- return m_epString;
- }*/
- return m_epString;
- }
+ inline const std::string& getEpString() { return m_epString; }
inline int hashcode() const {
int prime = 31;
diff --git a/cppcache/src/Set.hpp b/cppcache/src/Set.hpp
deleted file mode 100644
index 89c791c..0000000
--- a/cppcache/src/Set.hpp
+++ /dev/null
@@ -1,132 +0,0 @@
-#pragma once
-
-#ifndef GEODE_SET_H_
-#define GEODE_SET_H_
-
-/*
- * 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 <unordered_set>
-
-#include <ace/Guard_T.h>
-#include <ace/Recursive_Thread_Mutex.h>
-
-#include "NonCopyable.hpp"
-
-namespace apache {
-namespace geode {
-namespace client {
-
-// A synchronized Set using std::unordered_set<T>
-
-/* adongre
- * CID 28616: Other violation (COPY_WITHOUT_ASSIGN)
- * Class "apache::geode::client::Set<unsigned short>::Iterator" has user-written
- * copyi
- * `constructor "apache::geode::client::Set<unsigned
- * short>::Iterator::Iterator(apache::geode::client::Set<unsigned
- * short>::Iterator const &)" i
- * but no corresponding user-written assignment operator.
- *
- * FIX : Make the class non copyable
- */
-template <typename T>
-class APACHE_GEODE_EXPORT Set : private NonAssignable {
- public:
- // Iterator for a synchronized Set
- class Iterator {
- private:
- Set<T>& m_set;
- typename std::unordered_set<T>::const_iterator m_iter;
-
- explicit Iterator(Set<T>& set) : m_set(set) {
- m_set.m_mutex.acquire();
- m_iter = set.m_set.begin();
- }
- // Never defined.
- Iterator();
-
- public:
- Iterator(const Iterator& other) : m_set(other.m_set) {
- m_set.m_mutex.acquire();
- m_iter = other.m_iter;
- }
-
- inline const T& next() { return *(m_iter++); }
-
- inline bool hasNext() const { return (m_iter != m_set.m_set.end()); }
-
- ~Iterator() { m_set.m_mutex.release(); }
-
- friend class Set;
- };
-
- Set() : m_set() {}
-
- ~Set() {
- ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_mutex);
-
- m_set.clear();
- }
-
- inline bool insert(const T& key) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_mutex);
-
- return m_set.insert(key).second;
- }
-
- inline bool find(const T& key) const {
- ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_mutex);
-
- return (m_set.find(key) != m_set.end());
- }
-
- inline bool erase(const T& key) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_mutex);
-
- return (m_set.erase(key) > 0);
- }
-
- inline size_t size() {
- ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_mutex);
-
- return m_set.size();
- }
-
- inline void clear() {
- ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_mutex);
-
- m_set.clear();
- }
-
- inline bool empty() {
- ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_mutex);
-
- return m_set.empty();
- }
-
- inline Iterator iterator() { return Iterator(*this); }
-
- private:
- std::unordered_set<T> m_set;
- ACE_Recursive_Thread_Mutex m_mutex;
-};
-} // namespace client
-} // namespace geode
-} // namespace apache
-
-#endif // GEODE_SET_H_
diff --git a/cppcache/src/SslSockStream.cpp b/cppcache/src/SslSockStream.cpp
index a394799..7a30cb0 100644
--- a/cppcache/src/SslSockStream.cpp
+++ b/cppcache/src/SslSockStream.cpp
@@ -17,7 +17,7 @@
#include "SslSockStream.hpp"
-#include <ace/OS_NS_stdio.h>
+#include <ace/OS.h>
#include <geode/ExceptionTypes.hpp>
@@ -31,8 +31,8 @@
void *func = m_dll.symbol(function_name);
if (func == nullptr) {
char msg[1000];
- ACE_OS::snprintf(msg, 1000, "cannot find function %s in library %s",
- function_name, "cryptoImpl");
+ std::snprintf(msg, 1000, "cannot find function %s in library %s",
+ function_name, "cryptoImpl");
LOGERROR(msg);
throw IllegalStateException(msg);
}
@@ -46,7 +46,7 @@
LOGERROR("Failed to open cryptoImpl . Errno: %d : %s", lastError,
ACE_OS::strerror(lastError));
char msg[1000] = {0};
- ACE_OS::snprintf(msg, 1000, "cannot open library: %s", libName);
+ std::snprintf(msg, 1000, "cannot open library: %s", libName);
LOGERROR(msg);
throw FileNotFoundException(msg);
}
diff --git a/cppcache/src/SuspendedTxExpiryHandler.cpp b/cppcache/src/SuspendedTxExpiryHandler.cpp
index ab5e50f..d203722 100644
--- a/cppcache/src/SuspendedTxExpiryHandler.cpp
+++ b/cppcache/src/SuspendedTxExpiryHandler.cpp
@@ -16,14 +16,15 @@
*/
#include "SuspendedTxExpiryHandler.hpp"
+#include <ace/Reactor.h>
+#include <ace/Timer_Heap.h>
+#include <ace/Timer_Heap_T.h>
+#include <ace/Timer_Queue.h>
+#include <ace/Timer_Queue_Adapters.h>
+#include <ace/svc_export.h>
+
#include "CacheImpl.hpp"
#include "ExpiryTaskManager.hpp"
-#include "ace/Reactor.h"
-#include "ace/Timer_Heap.h"
-#include "ace/Timer_Heap_T.h"
-#include "ace/Timer_Queue.h"
-#include "ace/Timer_Queue_Adapters.h"
-#include "ace/svc_export.h"
namespace apache {
namespace geode {
diff --git a/cppcache/src/SystemProperties.cpp b/cppcache/src/SystemProperties.cpp
index fda13a3..bc69dc9 100644
--- a/cppcache/src/SystemProperties.cpp
+++ b/cppcache/src/SystemProperties.cpp
@@ -17,9 +17,7 @@
#include <cstdlib>
#include <string>
-
-#include <ace/DLL.h>
-#include <ace/OS.h>
+#include <thread>
#include <geode/CacheableKey.hpp>
#include <geode/ExceptionTypes.hpp>
@@ -68,7 +66,6 @@
const char ConflateEvents[] = "conflate-events";
const char SecurityClientDhAlgo[] = "security-client-dhalgo";
const char SecurityClientKsPath[] = "security-client-kspath";
-const char GridClient[] = "grid-client";
const char AutoReadyForEvents[] = "auto-ready-for-events";
const char SslEnabled[] = "ssl-enabled";
const char TimeStatisticsEnabled[] = "enable-time-statistics";
@@ -101,7 +98,6 @@
const int DefaultConnectionPoolSize = 5;
-const bool DefaultGridClient = false;
const bool DefaultAutoReadyForEvents = true;
const bool DefaultSslEnabled = false;
const bool DefaultTimeStatisticsEnabled = false; // or true;
@@ -125,7 +121,7 @@
constexpr auto DefaultNotifyAckInterval = std::chrono::seconds(1);
constexpr auto DefaultNotifyDupCheckLife = std::chrono::seconds(300);
const char DefaultSecurityPrefix[] = "security-";
-const uint32_t DefaultThreadPoolSize = ACE_OS::num_processors() * 2;
+const uint32_t DefaultThreadPoolSize = std::thread::hardware_concurrency() * 2;
constexpr auto DefaultSuspendedTxTimeout = std::chrono::seconds(30);
constexpr auto DefaultTombstoneTimeout = std::chrono::seconds(480);
// not disable; all region api will use chunk handler thread
@@ -175,7 +171,6 @@
m_connectTimeout(DefaultConnectTimeout),
m_connectWaitTimeout(DefaultConnectWaitTimeout),
m_bucketWaitTimeout(DefaultBucketWaitTimeout),
- m_gridClient(DefaultGridClient),
m_autoReadyForEvents(DefaultAutoReadyForEvents),
m_sslEnabled(DefaultSslEnabled),
m_timestatisticsEnabled(DefaultTimeStatisticsEnabled),
@@ -307,8 +302,6 @@
parseDurationProperty(property, std::string(value), m_bucketWaitTimeout);
} else if (property == DisableShufflingEndpoint) {
m_disableShufflingEndpoint = parseBooleanProperty(property, value);
- } else if (property == GridClient) {
- m_gridClient = parseBooleanProperty(property, value);
} else if (property == AutoReadyForEvents) {
m_autoReadyForEvents = parseBooleanProperty(property, value);
} else if (property == SslEnabled) {
@@ -420,9 +413,6 @@
settings += "\n enable-time-statistics = ";
settings += getEnableTimeStatistics() ? "true" : "false";
- settings += "\n grid-client = ";
- settings += isGridClient() ? "true" : "false";
-
settings += "\n heap-lru-delta = ";
settings += std::to_string(heapLRUDelta());
diff --git a/cppcache/src/TSSTXStateWrapper.cpp b/cppcache/src/TSSTXStateWrapper.cpp
index 15d53e7..e51ffc9 100644
--- a/cppcache/src/TSSTXStateWrapper.cpp
+++ b/cppcache/src/TSSTXStateWrapper.cpp
@@ -14,12 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/*
- * TSSTXStateWrapper.cpp
- *
- * Created on: 09-Feb-2011
- * Author: ankurs
- */
#include "TSSTXStateWrapper.hpp"
@@ -28,16 +22,14 @@
namespace apache {
namespace geode {
namespace client {
-ACE_TSS<TSSTXStateWrapper> TSSTXStateWrapper::s_geodeTSSTXState;
-TSSTXStateWrapper::TSSTXStateWrapper() { m_txState = nullptr; }
-
-TSSTXStateWrapper::~TSSTXStateWrapper() {
+TSSTXStateWrapper::~TSSTXStateWrapper() noexcept {
if (m_txState) {
delete m_txState;
m_txState = nullptr;
}
}
+
} // namespace client
} // namespace geode
} // namespace apache
diff --git a/cppcache/src/TSSTXStateWrapper.hpp b/cppcache/src/TSSTXStateWrapper.hpp
index 467e8d4..3567b78 100644
--- a/cppcache/src/TSSTXStateWrapper.hpp
+++ b/cppcache/src/TSSTXStateWrapper.hpp
@@ -1,8 +1,3 @@
-#pragma once
-
-#ifndef GEODE_TSSTXSTATEWRAPPER_H_
-#define GEODE_TSSTXSTATEWRAPPER_H_
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -19,36 +14,41 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/*
- * TSSTXStateWrapper.hpp
- *
- * Created on: 09-Feb-2011
- * Author: ankurs
- */
-#include <ace/TSS_T.h>
+#pragma once
+
+#ifndef GEODE_TSSTXSTATEWRAPPER_H_
+#define GEODE_TSSTXSTATEWRAPPER_H_
#include "TXId.hpp"
namespace apache {
namespace geode {
namespace client {
+
class TXState;
class TSSTXStateWrapper {
public:
- TSSTXStateWrapper();
- virtual ~TSSTXStateWrapper();
+ inline TSSTXStateWrapper() : m_txState(nullptr){};
- static ACE_TSS<TSSTXStateWrapper> s_geodeTSSTXState;
- TXState* getTXState() { return m_txState; }
- void setTXState(TXState* conn) { m_txState = conn; }
+ ~TSSTXStateWrapper() noexcept;
+
+ inline static TSSTXStateWrapper& get() {
+ static thread_local TSSTXStateWrapper instance;
+ return instance;
+ }
+
+ inline TXState* getTXState() { return m_txState; }
+
+ inline void setTXState(TXState* conn) { m_txState = conn; }
private:
TXState* m_txState;
TSSTXStateWrapper& operator=(const TSSTXStateWrapper&);
TSSTXStateWrapper(const TSSTXStateWrapper&);
};
+
} // namespace client
} // namespace geode
} // namespace apache
diff --git a/cppcache/src/TXCleaner.cpp b/cppcache/src/TXCleaner.cpp
index 87d31cc..40da8ed 100644
--- a/cppcache/src/TXCleaner.cpp
+++ b/cppcache/src/TXCleaner.cpp
@@ -14,12 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/*
- * TxCleaner.cpp
- *
- * Created on: Nov 13, 2015
- * Author: sshcherbakov
- */
#include "TXCleaner.hpp"
@@ -28,8 +22,7 @@
namespace client {
TXCleaner::TXCleaner(CacheTransactionManagerImpl* cacheTxMgr) {
- m_txStateWrapper = TSSTXStateWrapper::s_geodeTSSTXState;
- m_txState = m_txStateWrapper->getTXState();
+ m_txState = TSSTXStateWrapper::get().getTXState();
m_cacheTxMgr = cacheTxMgr;
}
@@ -45,15 +38,15 @@
if (m_txState != nullptr) {
m_cacheTxMgr->removeTx(m_txState->getTransactionId().getId());
}
- if (m_txStateWrapper != nullptr && m_txState != nullptr) {
- m_txStateWrapper->setTXState(nullptr);
+ if (m_txState != nullptr) {
+ TSSTXStateWrapper::get().setTXState(nullptr);
}
}
TXState* TXCleaner::getTXState() {
- return (m_txStateWrapper == nullptr) ? nullptr
- : m_txStateWrapper->getTXState();
+ return TSSTXStateWrapper::get().getTXState();
}
+
} // namespace client
} // namespace geode
} // namespace apache
diff --git a/cppcache/src/TXCleaner.hpp b/cppcache/src/TXCleaner.hpp
index 7ce0f9a..776835c 100644
--- a/cppcache/src/TXCleaner.hpp
+++ b/cppcache/src/TXCleaner.hpp
@@ -43,7 +43,6 @@
TXState* getTXState();
private:
- TSSTXStateWrapper* m_txStateWrapper;
TXState* m_txState;
CacheTransactionManagerImpl* m_cacheTxMgr;
diff --git a/cppcache/src/Task.hpp b/cppcache/src/Task.hpp
index 30340ad..5612422 100644
--- a/cppcache/src/Task.hpp
+++ b/cppcache/src/Task.hpp
@@ -20,9 +20,9 @@
#ifndef GEODE_Task_H_
#define GEODE_Task_H_
+#include <atomic>
#include <memory>
-
-#include <ace/Task.h>
+#include <thread>
#include "AppDomainContext.hpp"
#include "DistributedSystemImpl.hpp"
@@ -30,69 +30,63 @@
namespace apache {
namespace geode {
namespace client {
-const char NC_thread[] = "NC thread";
+
+/**
+ * Re-implementation of the Task class based on std::thread rather then
+ * ACE_Task.
+ */
template <class T>
-class APACHE_GEODE_EXPORT Task : public ACE_Task_Base {
+class Task {
public:
- /// Handle timeout events.
- typedef int (T::*OPERATION)(volatile bool& isRunning);
+ typedef void (T::*Method)(std::atomic<bool>& isRunning);
- // op_handler is the receiver of the timeout event. timeout is the method to
- // be executed by op_handler_
- Task(T* op_handler, OPERATION op)
- : op_handler_(op_handler),
- m_op(op),
- m_run(false),
- m_threadName(NC_thread),
- m_appDomainContext(createAppDomainContext()) {}
+ inline Task(T* target, Method method, const char* threadName)
+ : target_(target),
+ method_(method),
+ threadName_(threadName),
+ runnable_(false),
+ appDomainContext_(createAppDomainContext()) {}
- // op_handler is the receiver of the timeout event. timeout is the method to
- // be executed by op_handler_
- Task(T* op_handler, OPERATION op, const char* tn)
- : op_handler_(op_handler),
- m_op(op),
- m_run(false),
- m_threadName(tn),
- m_appDomainContext(createAppDomainContext()) {}
+ inline ~Task() noexcept { stop(); };
- ~Task() {}
-
- void start() {
- m_run = true;
- activate();
+ inline void start() {
+ runnable_ = true;
+ thread_ = std::thread(&Task::svc, this);
}
- void stop() {
- if (m_run) {
- m_run = false;
- wait();
+ inline void stop() noexcept {
+ stopNoblock();
+ wait();
+ }
+
+ inline void stopNoblock() noexcept { runnable_ = false; }
+
+ inline void wait() noexcept {
+ if (thread_.joinable()) {
+ thread_.join();
}
}
- void stopNoblock() { m_run = false; }
+ inline void svc(void) {
+ DistributedSystemImpl::setThreadName(threadName_);
- int svc(void) {
- DistributedSystemImpl::setThreadName(m_threadName);
-
- if (m_appDomainContext) {
- int ret;
- m_appDomainContext->run([this, &ret]() {
- ret = (this->op_handler_->*this->m_op)(this->m_run);
- });
- return ret;
+ if (appDomainContext_) {
+ appDomainContext_->run(
+ [this]() { (this->target_->*this->method_)(this->runnable_); });
} else {
- return (this->op_handler_->*m_op)(m_run);
+ (this->target_->*method_)(runnable_);
}
}
private:
- T* op_handler_;
- /// Handle timeout events.
- OPERATION m_op;
- volatile bool m_run;
- const char* m_threadName;
- std::unique_ptr<AppDomainContext> m_appDomainContext;
+ std::thread thread_;
+ T* target_;
+ Method method_;
+ const char* threadName_;
+ std::atomic<bool> runnable_;
+ std::unique_ptr<AppDomainContext> appDomainContext_;
};
+
} // namespace client
} // namespace geode
} // namespace apache
diff --git a/cppcache/src/TcpConn.cpp b/cppcache/src/TcpConn.cpp
index eacc6d5..ec88007 100644
--- a/cppcache/src/TcpConn.cpp
+++ b/cppcache/src/TcpConn.cpp
@@ -17,7 +17,9 @@
#include "TcpConn.hpp"
-#include <memory.h>
+#include <chrono>
+#include <memory>
+#include <thread>
#include <ace/INET_Addr.h>
#include <ace/OS.h>
@@ -98,8 +100,8 @@
LOGERROR("Failed to create socket. Errno: %d: %s", lastError,
ACE_OS::strerror(lastError));
char msg[256];
- ACE_OS::snprintf(msg, 256, "TcpConn::connect failed with errno: %d: %s",
- lastError, ACE_OS::strerror(lastError));
+ std::snprintf(msg, 256, "TcpConn::connect failed with errno: %d: %s",
+ lastError, ACE_OS::strerror(lastError));
throw GeodeIOException(msg);
}
@@ -175,8 +177,8 @@
"TcpConn::listen Attempt to listen timed out after " +
to_string(waitSeconds) + ".");
}
- ACE_OS::snprintf(msg, 256, "TcpConn::listen failed with errno: %d: %s",
- lastError, ACE_OS::strerror(lastError));
+ std::snprintf(msg, 256, "TcpConn::listen failed with errno: %d: %s",
+ lastError, ACE_OS::strerror(lastError));
throw GeodeIOException(msg);
}
}
@@ -230,18 +232,18 @@
"TcpConn::connect Attempt to connect timed out after" +
to_string(waitMicroSeconds) + ".");
}
- ACE_OS::snprintf(msg, 256, "TcpConn::connect failed with errno: %d: %s",
- lastError, ACE_OS::strerror(lastError));
+ std::snprintf(msg, 256, "TcpConn::connect failed with errno: %d: %s",
+ lastError, ACE_OS::strerror(lastError));
// this is only called by constructor, so we must delete m_io
close();
throw GeodeIOException(msg);
}
int rc = this->m_io->enable(ACE_NONBLOCK);
if (-1 == rc) {
- char msg[250];
+ char msg[256];
int32_t lastError = ACE_OS::last_error();
- ACE_OS::snprintf(msg, 256, "TcpConn::NONBLOCK: %d: %s", lastError,
- ACE_OS::strerror(lastError));
+ std::snprintf(msg, 256, "TcpConn::NONBLOCK: %d: %s", lastError,
+ ACE_OS::strerror(lastError));
LOGINFO(msg);
}
@@ -265,22 +267,8 @@
}
size_t TcpConn::socketOp(TcpConn::SockOp op, char *buff, size_t len,
- std::chrono::microseconds waitSeconds) {
+ std::chrono::microseconds waitDuration) {
{
- /*{
- ACE_HANDLE handle = m_io->get_handle();
- int val = ACE::get_flags (handle);
-
- if (ACE_BIT_DISABLED (val, ACE_NONBLOCK))
- {
- //ACE::set_flags (handle, ACE_NONBLOCK);
- LOGINFO("Flag is not set");
- }else
- {
- LOGINFO("Flag is set");
- }
- }*/
-
GF_DEV_ASSERT(m_io != nullptr);
GF_DEV_ASSERT(buff != nullptr);
@@ -294,10 +282,8 @@
}
#endif
- ACE_Time_Value waitTime(waitSeconds);
- ACE_Time_Value endTime(ACE_OS::gettimeofday());
- endTime += waitTime;
- ACE_Time_Value sleepTime(0, 100);
+ ACE_Time_Value waitTime(waitDuration);
+ auto endTime = std::chrono::steady_clock::now() + waitDuration;
size_t readLen = 0;
ssize_t retVal;
bool errnoSet = false;
@@ -324,7 +310,7 @@
if (retVal < 0) {
int32_t lastError = ACE_OS::last_error();
if (lastError == EAGAIN) {
- ACE_OS::sleep(sleepTime);
+ std::this_thread::sleep_for(std::chrono::microseconds(100));
} else {
errnoSet = true;
break;
@@ -337,7 +323,7 @@
buff += readLen;
if (sendlen == 0) break;
- waitTime = endTime - ACE_OS::gettimeofday();
+ waitTime = endTime - std::chrono::steady_clock::now();
if (waitTime <= ACE_Time_Value::zero) break;
} while (sendlen > 0);
if (errnoSet) break;
diff --git a/cppcache/src/TcpConn.hpp b/cppcache/src/TcpConn.hpp
index b602796..8fddb8a 100644
--- a/cppcache/src/TcpConn.hpp
+++ b/cppcache/src/TcpConn.hpp
@@ -22,6 +22,7 @@
#include <ace/OS.h>
#include <ace/SOCK_Stream.h>
+#include <boost/interprocess/mapped_region.hpp>
#include <geode/internal/geode_globals.hpp>
@@ -62,17 +63,17 @@
int32_t maxSize(ACE_HANDLE sock, int32_t flag, int32_t size);
virtual size_t socketOp(SockOp op, char* buff, size_t len,
- std::chrono::microseconds waitSeconds);
+ std::chrono::microseconds waitDuration);
virtual void createSocket(ACE_HANDLE sock);
public:
size_t m_chunkSize;
- static int getDefaultChunkSize() {
+ static size_t getDefaultChunkSize() {
// Attempt to set chunk size to nearest OS page size
// for perf improvement
- int pageSize = ACE_OS::getpagesize();
+ auto pageSize = boost::interprocess::mapped_region::get_page_size();
if (pageSize > 16000000) {
return 16000000;
} else if (pageSize > 0) {
diff --git a/cppcache/src/TcpSslConn.cpp b/cppcache/src/TcpSslConn.cpp
index 2b2bbbf..8712ad0 100644
--- a/cppcache/src/TcpSslConn.cpp
+++ b/cppcache/src/TcpSslConn.cpp
@@ -17,6 +17,9 @@
#include "TcpSslConn.hpp"
+#include <chrono>
+#include <thread>
+
#include <geode/SystemProperties.hpp>
#include "CacheImpl.hpp"
@@ -31,7 +34,7 @@
const char* libName = "cryptoImpl";
if (m_dll.open(libName, RTLD_NOW | RTLD_GLOBAL, 0) == -1) {
char msg[1000] = {0};
- ACE_OS::snprintf(msg, 1000, "cannot open library: %s", libName);
+ std::snprintf(msg, 1000, "cannot open library: %s", libName);
LOGERROR(msg);
throw FileNotFoundException(msg);
}
@@ -40,9 +43,9 @@
reinterpret_cast<gf_create_SslImpl>(m_dll.symbol("gf_create_SslImpl"));
if (func == nullptr) {
char msg[1000];
- ACE_OS::snprintf(msg, 1000,
- "cannot find function %s in library gf_create_SslImpl",
- "cryptoImpl");
+ std::snprintf(msg, 1000,
+ "cannot find function %s in library gf_create_SslImpl",
+ "cryptoImpl");
LOGERROR(msg);
throw IllegalStateException(msg);
}
@@ -71,10 +74,8 @@
"TcpSslConn::listen Attempt to listen timed out after" +
to_string(waitSeconds) + ".");
}
- // sprintf( msg, "TcpSslConn::listen failed with errno: %d: %s", lastError,
- // ACE_OS::strerror(lastError) );
- ACE_OS::snprintf(msg, 255, "TcpSslConn::listen failed with errno: %d: %s",
- lastError, ACE_OS::strerror(lastError));
+ std::snprintf(msg, 255, "TcpSslConn::listen failed with errno: %d: %s",
+ lastError, ACE_OS::strerror(lastError));
throw GeodeIOException(msg);
}
}
@@ -106,8 +107,8 @@
"TcpSslConn::connect Attempt to connect timed out after " +
to_string(waitMicroSeconds) + ".");
}
- ACE_OS::snprintf(msg, 256, "TcpSslConn::connect failed with errno: %d: %s",
- lastError, ACE_OS::strerror(lastError));
+ std::snprintf(msg, 256, "TcpSslConn::connect failed with errno: %d: %s",
+ lastError, ACE_OS::strerror(lastError));
// this is only called by constructor, so we must delete m_ssl
_GEODE_SAFE_DELETE(m_ssl);
throw GeodeIOException(msg);
@@ -125,7 +126,7 @@
}
size_t TcpSslConn::socketOp(TcpConn::SockOp op, char* buff, size_t len,
- std::chrono::microseconds waitSeconds) {
+ std::chrono::microseconds waitDuration) {
{
GF_DEV_ASSERT(m_ssl != nullptr);
GF_DEV_ASSERT(buff != nullptr);
@@ -140,10 +141,8 @@
}
#endif
// passing wait time as micro seconds
- ACE_Time_Value waitTime(waitSeconds);
- ACE_Time_Value endTime(ACE_OS::gettimeofday());
- endTime += waitTime;
- ACE_Time_Value sleepTime(0, 100);
+ ACE_Time_Value waitTime(waitDuration);
+ auto endTime = std::chrono::steady_clock::now() + waitDuration;
size_t readLen = 0;
bool errnoSet = false;
@@ -170,7 +169,7 @@
if (retVal < 0) {
int32_t lastError = ACE_OS::last_error();
if (lastError == EAGAIN) {
- ACE_OS::sleep(sleepTime);
+ std::this_thread::sleep_for(std::chrono::microseconds(100));
} else {
errnoSet = true;
break;
@@ -183,7 +182,7 @@
buff += readLen;
- waitTime = endTime - ACE_OS::gettimeofday();
+ waitTime = endTime - std::chrono::steady_clock::now();
if (waitTime <= ACE_Time_Value::zero) break;
} while (sendlen > 0);
if (errnoSet) break;
diff --git a/cppcache/src/TcpSslConn.hpp b/cppcache/src/TcpSslConn.hpp
index 52b6c69..02f3ea5 100644
--- a/cppcache/src/TcpSslConn.hpp
+++ b/cppcache/src/TcpSslConn.hpp
@@ -47,7 +47,7 @@
protected:
size_t socketOp(SockOp op, char* buff, size_t len,
- std::chrono::microseconds waitSeconds) override;
+ std::chrono::microseconds waitDuration) override;
void createSocket(ACE_HANDLE sock) override;
diff --git a/cppcache/src/TcrChunkedContext.hpp b/cppcache/src/TcrChunkedContext.hpp
index 3e548c2..e5df84c 100644
--- a/cppcache/src/TcrChunkedContext.hpp
+++ b/cppcache/src/TcrChunkedContext.hpp
@@ -41,7 +41,6 @@
ACE_Semaphore* m_finalizeSema;
std::shared_ptr<Exception> m_ex;
bool m_inSameThread;
- std::unique_ptr<AppDomainContext> appDomainContext;
protected:
uint16_t m_dsmemId;
@@ -56,7 +55,6 @@
: m_finalizeSema(nullptr),
m_ex(nullptr),
m_inSameThread(false),
- appDomainContext(createAppDomainContext()),
m_dsmemId(0) {}
virtual ~TcrChunkedResult() {}
void setFinalizeSemaphore(ACE_Semaphore* finalizeSema) {
@@ -73,14 +71,7 @@
void fireHandleChunk(const uint8_t* bytes, int32_t len,
uint8_t isLastChunkWithSecurity,
const CacheImpl* cacheImpl) {
- if (appDomainContext) {
- appDomainContext->run(
- [this, bytes, len, isLastChunkWithSecurity, cacheImpl]() {
- handleChunk(bytes, len, isLastChunkWithSecurity, cacheImpl);
- });
- } else {
- handleChunk(bytes, len, isLastChunkWithSecurity, cacheImpl);
- }
+ handleChunk(bytes, len, isLastChunkWithSecurity, cacheImpl);
}
/**
diff --git a/cppcache/src/TcrConnection.cpp b/cppcache/src/TcrConnection.cpp
index 031d136..bdfa00e 100644
--- a/cppcache/src/TcrConnection.cpp
+++ b/cppcache/src/TcrConnection.cpp
@@ -50,7 +50,8 @@
throw ex; \
}
bool TcrConnection::InitTcrConnection(
- TcrEndpoint* endpointObj, const char* endpoint, Set<uint16_t>& ports,
+ TcrEndpoint* endpointObj, const char* endpoint,
+ synchronized_set<std::unordered_set<uint16_t>>& ports,
bool isClientNotification, bool isSecondary,
std::chrono::microseconds connectTimeout) {
m_conn = nullptr;
@@ -63,9 +64,9 @@
m_queueSize = 0;
m_dh = nullptr;
// m_chunksProcessSema = 0;
- m_creationTime = ACE_OS::gettimeofday();
+ m_creationTime = clock::now();
connectionId = INITIAL_CONNECTION_ID;
- m_lastAccessed = ACE_OS::gettimeofday();
+ m_lastAccessed = clock::now();
auto cacheImpl = m_poolDM->getConnectionManager().getCacheImpl();
const auto& distributedSystem = cacheImpl->getDistributedSystem();
const auto& sysProp = distributedSystem.getSystemProperties();
@@ -127,10 +128,10 @@
ports.insert(m_port);
} else {
// add the local ports to message
- Set<uint16_t>::Iterator iter = ports.iterator();
+ auto&& lock = ports.make_lock();
handShakeMsg.writeInt(static_cast<int32_t>(ports.size()));
- while (iter.hasNext()) {
- handShakeMsg.writeInt(static_cast<int32_t>(iter.next()));
+ for (const auto& port : ports) {
+ handShakeMsg.writeInt(static_cast<int32_t>(port));
}
}
@@ -709,29 +710,7 @@
const TcrMessage& request, size_t len, TcrMessageReply& reply,
std::chrono::microseconds sendTimeoutSec,
std::chrono::microseconds receiveTimeoutSec) {
- int32_t msgType = request.getMessageType();
- // ACE_OS::memcpy(&msgType, buffer, 4);
- // msgType = ntohl(msgType);
-
- /*receiveTimeoutSec = (msgType == TcrMessage::QUERY ||
- msgType == TcrMessage::QUERY_WITH_PARAMETERS ||
- msgType == TcrMessage::EXECUTECQ_WITH_IR_MSG_TYPE ||
- msgType == TcrMessage::GETDURABLECQS_MSG_TYPE ||
- msgType == TcrMessage::EXECUTE_FUNCTION ||
- msgType == TcrMessage::EXECUTE_REGION_FUNCTION ||
- msgType == TcrMessage::EXECUTE_REGION_FUNCTION_SINGLE_HOP)
- ? reply.getTimeout() : receiveTimeoutSec;
-
- //send + recieve should be part of API timeout
- sendTimeoutSec = (msgType == TcrMessage::QUERY ||
- msgType == TcrMessage::QUERY_WITH_PARAMETERS ||
- msgType == TcrMessage::EXECUTECQ_WITH_IR_MSG_TYPE ||
- msgType == TcrMessage::GETDURABLECQS_MSG_TYPE ||
- msgType == TcrMessage::EXECUTE_FUNCTION ||
- msgType == TcrMessage::EXECUTE_REGION_FUNCTION ||
- msgType == TcrMessage::EXECUTE_REGION_FUNCTION_SINGLE_HOP)
- ? reply.getTimeout() : sendTimeoutSec;
- */
+ auto msgType = request.getMessageType();
switch (msgType) {
case TcrMessage::QUERY:
case TcrMessage::QUERY_WITH_PARAMETERS:
@@ -747,18 +726,7 @@
default:
break;
}
- /*if((msgType == TcrMessage::QUERY ||
- msgType == TcrMessage::QUERY_WITH_PARAMETERS ||
- msgType == TcrMessage::EXECUTECQ_WITH_IR_MSG_TYPE ||
- msgType == TcrMessage::GETDURABLECQS_MSG_TYPE ||
- msgType == TcrMessage::EXECUTE_FUNCTION ||
- msgType == TcrMessage::EXECUTE_REGION_FUNCTION))
- {
- receiveTimeoutSec = reply.getTimeout();
- sendTimeoutSec = reply.getTimeout();
- }*/
- // send(buffer, len, sendTimeoutSec);
std::chrono::microseconds timeSpent{0};
send(timeSpent, request.getMsgData(), len, sendTimeoutSec, true);
@@ -893,7 +861,7 @@
char* fullMessage;
*recvLen = HEADER_LENGTH + msgLen;
_GEODE_NEW(fullMessage, char[HEADER_LENGTH + msgLen]);
- ACE_OS::memcpy(fullMessage, msg_header, HEADER_LENGTH);
+ std::memcpy(fullMessage, msg_header, HEADER_LENGTH);
return fullMessage;
// exit(0);
}
@@ -903,7 +871,7 @@
char* fullMessage;
*recvLen = HEADER_LENGTH + msgLen;
_GEODE_NEW(fullMessage, char[HEADER_LENGTH + msgLen]);
- ACE_OS::memcpy(fullMessage, msg_header, HEADER_LENGTH);
+ std::memcpy(fullMessage, msg_header, HEADER_LENGTH);
std::chrono::microseconds mesgBodyTimeout = receiveTimeoutSec;
if (isNotificationMessage) {
@@ -937,20 +905,7 @@
"TcrConnection::readMessage: received message body from "
"endpoint %s; bytes: %s",
m_endpoint,
- Utils::convertBytesToString(fullMessage + HEADER_LENGTH, msgLen)
-
- .c_str());
-
- // This is the test case when msg type is GET_CLIENT_PR_METADATA and msgLen is
- // 0.
- /*if (request == TcrMessage::GET_CLIENT_PR_METADATA) {
- LOGCONFIG("Amey request == TcrMessage::GET_CLIENT_PR_METADATA");
- char* fullMessage2;
- *recvLen = HEADER_LENGTH;
- _GEODE_NEW( fullMessage2, char[HEADER_LENGTH ] );
- ACE_OS::memcpy(fullMessage2, msg_header, HEADER_LENGTH);
- return fullMessage2;
- }*/
+ Utils::convertBytesToString(fullMessage + HEADER_LENGTH, msgLen).c_str());
return fullMessage;
}
@@ -1102,16 +1057,6 @@
}
void TcrConnection::close() {
- // If this is a short lived grid client, don't bother with this close ack
- // message
- if (m_poolDM->getConnectionManager()
- .getCacheImpl()
- ->getDistributedSystem()
- .getSystemProperties()
- .isGridClient()) {
- return;
- }
-
TcrMessage* closeMsg = TcrMessage::getCloseConnMessage(
m_poolDM->getConnectionManager().getCacheImpl());
try {
@@ -1399,13 +1344,7 @@
return false;
}
- ACE_Time_Value _expiryTime(expiryTime);
-
- if (ACE_OS::gettimeofday() - m_creationTime > _expiryTime) {
- return true;
- } else {
- return false;
- }
+ return (clock::now() - m_creationTime) > expiryTime;
}
bool TcrConnection::isIdle(const std::chrono::milliseconds& idleTime) {
@@ -1413,18 +1352,14 @@
return false;
}
- ACE_Time_Value _idleTime(idleTime);
-
- if (ACE_OS::gettimeofday() - m_lastAccessed > _idleTime) {
- return true;
- } else {
- return false;
- }
+ return (clock::now() - m_lastAccessed) > idleTime;
}
-void TcrConnection::touch() { m_lastAccessed = ACE_OS::gettimeofday(); }
+void TcrConnection::touch() { m_lastAccessed = clock::now(); }
-ACE_Time_Value TcrConnection::getLastAccessed() { return m_lastAccessed; }
+TcrConnection::time_point TcrConnection::getLastAccessed() {
+ return m_lastAccessed;
+}
uint8_t TcrConnection::getOverrides(const SystemProperties* props) {
uint8_t conflateByte = 0;
@@ -1440,7 +1375,7 @@
}
void TcrConnection::updateCreationTime() {
- m_creationTime = ACE_OS::gettimeofday();
+ m_creationTime = clock::now();
touch();
}
diff --git a/cppcache/src/TcrConnection.hpp b/cppcache/src/TcrConnection.hpp
index 904db27..64d78e4 100644
--- a/cppcache/src/TcrConnection.hpp
+++ b/cppcache/src/TcrConnection.hpp
@@ -31,8 +31,8 @@
#include "Connector.hpp"
#include "DiffieHellman.hpp"
-#include "Set.hpp"
#include "TcrMessage.hpp"
+#include "util/synchronized_set.hpp"
#define DEFAULT_TIMEOUT_RETRIES 12
#define PRIMARY_SERVER_TO_CLIENT 101
@@ -86,6 +86,9 @@
class TcrConnectionManager;
class APACHE_GEODE_EXPORT TcrConnection {
public:
+ using clock = std::chrono::steady_clock;
+ using time_point = clock::time_point;
+
/** Create one connection, endpoint is in format of hostname:portno
* It will do handshake with j-server. There're 2 types of handshakes:
* 1) handshake for request
@@ -111,7 +114,8 @@
* @param numPorts Size of ports list
*/
bool InitTcrConnection(
- TcrEndpoint* endpointObj, const char* endpoint, Set<uint16_t>& ports,
+ TcrEndpoint* endpointObj, const char* endpoint,
+ synchronized_set<std::unordered_set<uint16_t>>& ports,
bool isClientNotification = false, bool isSecondary = false,
std::chrono::microseconds connectTimeout = DEFAULT_CONNECT_TIMEOUT);
@@ -275,7 +279,7 @@
void touch();
bool hasExpired(const std::chrono::milliseconds& expiryTime);
bool isIdle(const std::chrono::milliseconds& idleTime);
- ACE_Time_Value getLastAccessed();
+ time_point getLastAccessed();
void updateCreationTime();
int64_t getConnectionId() {
@@ -403,8 +407,10 @@
// semaphore to synchronize with the chunked response processing thread
ACE_Semaphore m_chunksProcessSema;
- ACE_Time_Value m_creationTime;
- ACE_Time_Value m_lastAccessed;
+
+ time_point m_creationTime;
+ time_point m_lastAccessed;
+
// Disallow copy constructor and assignment operator.
TcrConnection(const TcrConnection&);
TcrConnection& operator=(const TcrConnection&);
diff --git a/cppcache/src/TcrConnectionManager.cpp b/cppcache/src/TcrConnectionManager.cpp
index efccda8..cb6dcae 100644
--- a/cppcache/src/TcrConnectionManager.cpp
+++ b/cppcache/src/TcrConnectionManager.cpp
@@ -82,7 +82,7 @@
auto &props = m_cache->getDistributedSystem().getSystemProperties();
m_isDurable = !props.durableClientId().empty();
auto pingInterval = (props.pingInterval() / 2);
- if (!props.isGridClient() && !isPool) {
+ if (!isPool) {
ACE_Event_Handler *connectionChecker =
new ExpiryHandler_T<TcrConnectionManager>(
this, &TcrConnectionManager::checkConnection);
@@ -127,32 +127,33 @@
GfErrTypeToException("TcrConnectionManager::init", err);
}
- m_redundancyTask = new Task<TcrConnectionManager>(
- this, &TcrConnectionManager::redundancy, NC_Redundancy);
+ m_redundancyTask = std::unique_ptr<Task<TcrConnectionManager>>(
+ new Task<TcrConnectionManager>(this, &TcrConnectionManager::redundancy,
+ NC_Redundancy));
m_redundancyTask->start();
m_redundancyManager->m_HAenabled = true;
}
- if (!props.isGridClient()) {
- startFailoverAndCleanupThreads(isPool);
- }
+ startFailoverAndCleanupThreads(isPool);
}
void TcrConnectionManager::startFailoverAndCleanupThreads(bool isPool) {
- if (m_failoverTask == nullptr || m_cleanupTask == nullptr) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_distMngrsLock);
- if (m_failoverTask == nullptr && !isPool) {
- m_failoverTask = new Task<TcrConnectionManager>(
- this, &TcrConnectionManager::failover, NC_Failover);
+ if (!isPool && (m_failoverTask == nullptr || m_cleanupTask == nullptr)) {
+ std::lock_guard<decltype(m_distMngrsLock)> _guard(m_distMngrsLock);
+ if (!m_failoverTask) {
+ m_failoverTask = std::unique_ptr<Task<TcrConnectionManager>>(
+ new Task<TcrConnectionManager>(this, &TcrConnectionManager::failover,
+ NC_Failover));
m_failoverTask->start();
}
- if (m_cleanupTask == nullptr && !isPool) {
- if (m_redundancyManager->m_HAenabled && !isPool) {
+ if (!m_cleanupTask) {
+ if (m_redundancyManager->m_HAenabled) {
m_redundancyManager->startPeriodicAck();
}
- m_cleanupTask = new Task<TcrConnectionManager>(
- this, &TcrConnectionManager::cleanup, NC_CleanUp);
+ m_cleanupTask = std::unique_ptr<Task<TcrConnectionManager>>(
+ new Task<TcrConnectionManager>(this, &TcrConnectionManager::cleanup,
+ NC_CleanUp));
m_cleanupTask->start();
}
}
@@ -168,7 +169,7 @@
m_failoverTask->stopNoblock();
m_failoverSema.release();
m_failoverTask->wait();
- _GEODE_SAFE_DELETE(m_failoverTask);
+ m_failoverTask = nullptr;
}
auto cacheAttributes = m_cache->getAttributes();
@@ -183,7 +184,7 @@
m_redundancyTask->wait();
// now stop cleanup task
// stopCleanupTask();
- _GEODE_SAFE_DELETE(m_redundancyTask);
+ m_redundancyTask = nullptr;
}
m_redundancyManager->close();
@@ -206,22 +207,18 @@
m_cleanupTask->wait();
// Clean notification lists if something remains in there; see bug #250
cleanNotificationLists();
- _GEODE_SAFE_DELETE(m_cleanupTask);
+ m_cleanupTask = nullptr;
// sanity cleanup of any remaining endpoints with warning; see bug #298
// cleanup of endpoints, when regions are destroyed via notification
{
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_endpoints.mutex());
-
- size_t numEndPoints = m_endpoints.current_size();
+ auto &&guard = m_endpoints.make_lock();
+ auto numEndPoints = m_endpoints.size();
if (numEndPoints > 0) {
LOGFINE("TCCM: endpoints remain in destructor");
}
- for (ACE_Map_Manager<std::string, TcrEndpoint *,
- ACE_Recursive_Thread_Mutex>::iterator iter =
- m_endpoints.begin();
- iter != m_endpoints.end(); ++iter) {
- TcrEndpoint *ep = (*iter).int_id_;
+ for (const auto &iter : m_endpoints) {
+ auto ep = iter.second;
LOGFINE("TCCM: forcing endpoint delete for %d in destructor",
ep->name().c_str());
_GEODE_SAFE_DELETE(ep);
@@ -234,9 +231,9 @@
void TcrConnectionManager::connect(
ThinClientBaseDM *distMng, std::vector<TcrEndpoint *> &endpoints,
const std::unordered_set<std::string> &endpointStrs) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guardDistMngrs(m_distMngrsLock);
+ std::lock_guard<decltype(m_distMngrsLock)> guardDistMngrs(m_distMngrsLock);
{
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_endpoints.mutex());
+ auto &&endpointsGuard = m_endpoints.make_lock();
int32_t numEndPoints = static_cast<int32_t>(endpointStrs.size());
if (numEndPoints == 0) {
@@ -244,12 +241,9 @@
"TcrConnectionManager::connect(): Empty endpointstr vector "
"passed to TCCM, will initialize endpoints list with all available "
"endpoints (%d).",
- m_endpoints.current_size());
- for (ACE_Map_Manager<std::string, TcrEndpoint *,
- ACE_Recursive_Thread_Mutex>::iterator currItr =
- m_endpoints.begin();
- currItr != m_endpoints.end(); ++currItr) {
- TcrEndpoint *ep = (*currItr).int_id_;
+ m_endpoints.size());
+ for (const auto &currItr : m_endpoints) {
+ auto ep = currItr.second;
ep->setNumRegions(ep->numRegions() + 1);
LOGFINER(
"TCCM 2: incremented region reference count for endpoint %s "
@@ -258,10 +252,8 @@
endpoints.push_back(ep);
}
} else {
- for (std::unordered_set<std::string>::const_iterator iter =
- endpointStrs.begin();
- iter != endpointStrs.end(); ++iter) {
- TcrEndpoint *ep = addRefToTcrEndpoint(*iter, distMng);
+ for (const auto &iter : endpointStrs) {
+ auto ep = addRefToTcrEndpoint(iter, distMng);
endpoints.push_back(ep);
}
}
@@ -285,14 +277,16 @@
TcrEndpoint *TcrConnectionManager::addRefToTcrEndpoint(std::string endpointName,
ThinClientBaseDM *dm) {
TcrEndpoint *ep = nullptr;
- /*
- endpointName = Utils::convertHostToCanonicalForm(endpointName.c_str());
- */
- if (0 != m_endpoints.find(endpointName, ep)) {
+
+ auto &&guard = m_endpoints.make_lock();
+ const auto &find = m_endpoints.find(endpointName);
+ if (find == m_endpoints.end()) {
// this endpoint does not exist
ep = new TcrEndpoint(endpointName, m_cache, m_failoverSema, m_cleanupSema,
m_redundancySema, dm, false);
- GF_R_ASSERT(0 == m_endpoints.bind(endpointName, ep));
+ m_endpoints.emplace(endpointName, ep);
+ } else {
+ ep = find->second;
}
ep->setNumRegions(ep->numRegions() + 1);
@@ -305,13 +299,10 @@
void TcrConnectionManager::disconnect(ThinClientBaseDM *distMng,
std::vector<TcrEndpoint *> &endpoints,
bool keepEndpoints) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guardDistMngrs(m_distMngrsLock);
+ std::lock_guard<decltype(m_distMngrsLock)> guardDistMngrs(m_distMngrsLock);
{
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_endpoints.mutex());
-
- int32_t numEndPoints = static_cast<int32_t>(endpoints.size());
- for (int32_t i = 0; i < numEndPoints; ++i) {
- TcrEndpoint *ep = endpoints[i];
+ auto &&guard = m_endpoints.make_lock();
+ for (const auto &ep : endpoints) {
removeRefToEndpoint(ep, keepEndpoints);
}
}
@@ -333,7 +324,7 @@
if (0 == ep->numRegions()) {
// this endpoint no longer used
- GF_R_ASSERT(0 == m_endpoints.unbind(ep->name(), ep));
+ m_endpoints.erase(ep->name());
LOGFINE("delete endpoint %s", ep->name().c_str());
_GEODE_SAFE_DELETE(ep);
hasRemovedEndpoint = true;
@@ -348,15 +339,11 @@
int TcrConnectionManager::checkConnection(const ACE_Time_Value &,
const void *) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_endpoints.mutex());
- ACE_Map_Manager<std::string, TcrEndpoint *,
- ACE_Recursive_Thread_Mutex>::iterator currItr =
- m_endpoints.begin();
- while (currItr != m_endpoints.end()) {
- if ((*currItr).int_id_->connected() && !m_isNetDown) {
- (*currItr).int_id_->pingServer();
+ auto &&guard = m_endpoints.make_lock();
+ for (const auto &currItr : m_endpoints) {
+ if (currItr.second->connected() && !m_isNetDown) {
+ currItr.second->pingServer();
}
- currItr++;
}
return 0;
}
@@ -367,16 +354,15 @@
return 0;
}
-int TcrConnectionManager::failover(volatile bool &isRunning) {
+void TcrConnectionManager::failover(std::atomic<bool> &isRunning) {
LOGFINE("TcrConnectionManager: starting failover thread");
while (isRunning) {
m_failoverSema.acquire();
if (isRunning && !m_isNetDown) {
try {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_distMngrsLock);
- for (std::list<ThinClientBaseDM *>::iterator it = m_distMngrs.begin();
- it != m_distMngrs.end(); ++it) {
- (*it)->failover();
+ std::lock_guard<decltype(m_distMngrsLock)> guard(m_distMngrsLock);
+ for (const auto &it : m_distMngrs) {
+ it->failover();
}
while (m_failoverSema.tryacquire() != -1) {
;
@@ -393,24 +379,18 @@
}
}
LOGFINE("TcrConnectionManager: ending failover thread");
- return 0;
}
void TcrConnectionManager::getAllEndpoints(
std::vector<TcrEndpoint *> &endpoints) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_endpoints.mutex());
-
- for (ACE_Map_Manager<std::string, TcrEndpoint *,
- ACE_Recursive_Thread_Mutex>::iterator currItr =
- m_endpoints.begin();
- currItr != m_endpoints.end(); currItr++) {
- endpoints.push_back((*currItr).int_id_);
+ auto &&guard = m_endpoints.make_lock();
+ for (const auto &currItr : m_endpoints) {
+ endpoints.push_back(currItr.second);
}
}
int32_t TcrConnectionManager::getNumEndPoints() {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_endpoints.mutex());
- return static_cast<int32_t>(m_endpoints.current_size());
+ return static_cast<int32_t>(m_endpoints.size());
}
GfErrType TcrConnectionManager::registerInterestAllRegions(
@@ -421,7 +401,7 @@
GfErrType err = GF_NOERR;
GfErrType opErr = GF_NOERR;
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_distMngrsLock);
+ std::lock_guard<decltype(m_distMngrsLock)> guard(m_distMngrsLock);
std::list<ThinClientBaseDM *>::iterator begin = m_distMngrs.begin();
std::list<ThinClientBaseDM *>::iterator end = m_distMngrs.end();
for (std::list<ThinClientBaseDM *>::iterator it = begin; it != end; ++it) {
@@ -446,7 +426,7 @@
// 1. m_distMngrs.size() > 1 (query distribution manager + 1 or more
// TcrHADistributionManagers).
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_distMngrsLock);
+ std::lock_guard<decltype(m_distMngrsLock)> guard(m_distMngrsLock);
std::list<ThinClientBaseDM *>::iterator begin = m_distMngrs.begin();
std::list<ThinClientBaseDM *>::iterator end = m_distMngrs.end();
for (std::list<ThinClientBaseDM *>::iterator it = begin; it != end; ++it) {
@@ -472,12 +452,10 @@
}
void TcrConnectionManager::removeHAEndpoints() {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_endpoints.mutex());
- ACE_Map_Manager<std::string, TcrEndpoint *,
- ACE_Recursive_Thread_Mutex>::iterator currItr =
- m_endpoints.begin();
+ auto &&guard = m_endpoints.make_lock();
+ auto currItr = m_endpoints.begin();
while (currItr != m_endpoints.end()) {
- if (removeRefToEndpoint((*currItr).int_id_)) {
+ if (removeRefToEndpoint(currItr->second)) {
currItr = m_endpoints.begin();
} else {
currItr++;
@@ -492,13 +470,9 @@
std::this_thread::sleep_for(std::chrono::seconds(15));
{
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_endpoints.mutex());
-
- for (ACE_Map_Manager<std::string, TcrEndpoint *,
- ACE_Recursive_Thread_Mutex>::iterator currItr =
- m_endpoints.begin();
- currItr != m_endpoints.end(); currItr++) {
- (*currItr).int_id_->setConnectionStatus(false);
+ auto &&guard = m_endpoints.make_lock();
+ for (auto &currItr : m_endpoints) {
+ currItr.second->setConnectionStatus(false);
}
}
@@ -515,7 +489,7 @@
std::this_thread::sleep_for(std::chrono::seconds(15));
}
-int TcrConnectionManager::redundancy(volatile bool &isRunning) {
+void TcrConnectionManager::redundancy(std::atomic<bool> &isRunning) {
LOGFINE("Starting subscription maintain redundancy thread.");
while (isRunning) {
m_redundancySema.acquire();
@@ -527,19 +501,18 @@
}
}
LOGFINE("Ending subscription maintain redundancy thread.");
- return 0;
}
void TcrConnectionManager::addNotificationForDeletion(
Task<TcrEndpoint> *notifyReceiver, TcrConnection *notifyConnection,
ACE_Semaphore ¬ifyCleanupSema) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_notificationLock);
+ std::lock_guard<decltype(m_notificationLock)> guard(m_notificationLock);
m_connectionReleaseList.put(notifyConnection);
m_receiverReleaseList.put(notifyReceiver);
m_notifyCleanupSemaList.put(¬ifyCleanupSema);
}
-int TcrConnectionManager::cleanup(volatile bool &isRunning) {
+void TcrConnectionManager::cleanup(std::atomic<bool> &isRunning) {
LOGFINE("TcrConnectionManager: starting cleanup thread");
do {
// If we block on acquire, the queue must be empty (precondition).
@@ -561,7 +534,6 @@
// Postcondition - all notification channels should be cleaned up by the end
// of this function.
GF_DEV_ASSERT(m_receiverReleaseList.size() == 0);
- return 0;
}
void TcrConnectionManager::cleanNotificationLists() {
@@ -571,14 +543,14 @@
while (true) {
{
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_notificationLock);
+ std::lock_guard<decltype(m_notificationLock)> guard(m_notificationLock);
notifyReceiver = m_receiverReleaseList.get();
if (!notifyReceiver) break;
notifyConnection = m_connectionReleaseList.get();
notifyCleanupSema = m_notifyCleanupSemaList.get();
}
notifyReceiver->wait();
- _GEODE_SAFE_DELETE(notifyReceiver);
+ //_GEODE_SAFE_DELETE(notifyReceiver);
_GEODE_SAFE_DELETE(notifyConnection);
notifyCleanupSema->release();
}
@@ -591,11 +563,8 @@
// TESTING: Durable clients - return queue status of endpoing. Not thread safe.
bool TcrConnectionManager::getEndpointStatus(const std::string &endpoint) {
- for (ACE_Map_Manager<std::string, TcrEndpoint *,
- ACE_Recursive_Thread_Mutex>::iterator currItr =
- m_endpoints.begin();
- currItr != m_endpoints.end(); currItr++) {
- TcrEndpoint *ep = (*currItr).int_id_;
+ for (auto &currItr : m_endpoints) {
+ auto ep = currItr.second;
const std::string epName = ep->name();
if (epName == endpoint) return ep->getServerQueueStatusTEST();
}
diff --git a/cppcache/src/TcrConnectionManager.hpp b/cppcache/src/TcrConnectionManager.hpp
index 8e01b87..837e448 100644
--- a/cppcache/src/TcrConnectionManager.hpp
+++ b/cppcache/src/TcrConnectionManager.hpp
@@ -1,8 +1,3 @@
-#pragma once
-
-#ifndef GEODE_TCRCONNECTIONMANAGER_H_
-#define GEODE_TCRCONNECTIONMANAGER_H_
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -20,15 +15,18 @@
* limitations under the License.
*/
+#pragma once
+
+#ifndef GEODE_TCRCONNECTIONMANAGER_H_
+#define GEODE_TCRCONNECTIONMANAGER_H_
+
#include <list>
+#include <mutex>
#include <string>
#include <unordered_map>
#include <vector>
-#include <ace/Map_Manager.h>
-#include <ace/Recursive_Thread_Mutex.h>
#include <ace/Semaphore.h>
-#include <ace/Versioned_Namespace.h>
#include <ace/config-lite.h>
#include <geode/internal/geode_globals.hpp>
@@ -37,6 +35,7 @@
#include "Queue.hpp"
#include "Task.hpp"
#include "ThinClientRedundancyManager.hpp"
+#include "util/synchronized_map.hpp"
namespace apache {
namespace geode {
@@ -52,7 +51,7 @@
/**
* @brief transport data between caches
*/
-class APACHE_GEODE_EXPORT TcrConnectionManager {
+class TcrConnectionManager {
public:
explicit TcrConnectionManager(CacheImpl* cache);
~TcrConnectionManager();
@@ -78,7 +77,8 @@
void setClientCrashTEST() { TEST_DURABLE_CLIENT_CRASH = true; }
volatile static bool TEST_DURABLE_CLIENT_CRASH;
- inline ACE_Map_Manager<std::string, TcrEndpoint*, ACE_Recursive_Thread_Mutex>&
+ inline synchronized_map<std::unordered_map<std::string, TcrEndpoint*>,
+ std::recursive_mutex>&
getGlobalEndpoints() {
return m_endpoints;
}
@@ -119,20 +119,20 @@
inline void acquireRedundancyLock() {
m_redundancyManager->acquireRedundancyLock();
- m_distMngrsLock.acquire_read();
+ m_distMngrsLock.lock();
}
inline void releaseRedundancyLock() {
m_redundancyManager->releaseRedundancyLock();
- m_distMngrsLock.release();
+ m_distMngrsLock.unlock();
}
bool checkDupAndAdd(std::shared_ptr<EventId> eventid) {
return m_redundancyManager->checkDupAndAdd(eventid);
}
- ACE_Recursive_Thread_Mutex* getRedundancyLock() {
- return &m_redundancyManager->getRedundancyLock();
+ std::recursive_mutex& getRedundancyLock() {
+ return m_redundancyManager->getRedundancyLock();
}
GfErrType sendRequestToPrimary(TcrMessage& request, TcrMessageReply& reply) {
@@ -144,16 +144,17 @@
private:
CacheImpl* m_cache;
volatile bool m_initGuard;
- ACE_Map_Manager<std::string, TcrEndpoint*, ACE_Recursive_Thread_Mutex>
+ synchronized_map<std::unordered_map<std::string, TcrEndpoint*>,
+ std::recursive_mutex>
m_endpoints;
std::list<TcrEndpoint*> m_poolEndpointList;
// key is hostname:port
std::list<ThinClientBaseDM*> m_distMngrs;
- ACE_Recursive_Thread_Mutex m_distMngrsLock;
+ std::recursive_mutex m_distMngrsLock;
ACE_Semaphore m_failoverSema;
- Task<TcrConnectionManager>* m_failoverTask;
+ std::unique_ptr<Task<TcrConnectionManager>> m_failoverTask;
bool removeRefToEndpoint(TcrEndpoint* ep, bool keepEndpoint = false);
TcrEndpoint* addRefToTcrEndpoint(std::string endpointName,
@@ -163,7 +164,7 @@
void removeHAEndpoints();
ACE_Semaphore m_cleanupSema;
- Task<TcrConnectionManager>* m_cleanupTask;
+ std::unique_ptr<Task<TcrConnectionManager>> m_cleanupTask;
ExpiryTaskManager::id_type m_pingTaskId;
ExpiryTaskManager::id_type m_servermonitorTaskId;
@@ -172,19 +173,19 @@
Queue<ACE_Semaphore*> m_notifyCleanupSemaList;
ACE_Semaphore m_redundancySema;
- Task<TcrConnectionManager>* m_redundancyTask;
- ACE_Recursive_Thread_Mutex m_notificationLock;
+ std::unique_ptr<Task<TcrConnectionManager>> m_redundancyTask;
+ std::recursive_mutex m_notificationLock;
bool m_isDurable;
bool m_isNetDown;
ThinClientRedundancyManager* m_redundancyManager;
- int failover(volatile bool& isRunning);
- int redundancy(volatile bool& isRunning);
+ void failover(std::atomic<bool>& isRunning);
+ void redundancy(std::atomic<bool>& isRunning);
void cleanNotificationLists();
- int cleanup(volatile bool& isRunning);
+ void cleanup(std::atomic<bool>& isRunning);
// Disallow copy constructor and assignment operator.
TcrConnectionManager(const TcrConnectionManager&);
@@ -206,10 +207,10 @@
public:
explicit DistManagersLockGuard(TcrConnectionManager& tccm) : m_tccm(tccm) {
- m_tccm.m_distMngrsLock.acquire();
+ m_tccm.m_distMngrsLock.lock();
}
- ~DistManagersLockGuard() { m_tccm.m_distMngrsLock.release(); }
+ ~DistManagersLockGuard() { m_tccm.m_distMngrsLock.unlock(); }
};
} // namespace client
} // namespace geode
diff --git a/cppcache/src/TcrEndpoint.cpp b/cppcache/src/TcrEndpoint.cpp
index 0a0d6a4..7b57e5d 100644
--- a/cppcache/src/TcrEndpoint.cpp
+++ b/cppcache/src/TcrEndpoint.cpp
@@ -28,6 +28,7 @@
#include "CacheImpl.hpp"
#include "DistributedSystemImpl.hpp"
#include "StackTrace.hpp"
+#include "TcrConnectionManager.hpp"
#include "ThinClientPoolHADM.hpp"
#include "ThinClientRegion.hpp"
#include "Utils.hpp"
@@ -47,7 +48,6 @@
: m_notifyConnection(nullptr),
m_notifyReceiver(nullptr),
m_cacheImpl(cacheImpl),
- m_connectLockCond(m_connectLock),
m_maxConnections(cacheImpl->getDistributedSystem()
.getSystemProperties()
.connectionPoolSize()),
@@ -88,7 +88,7 @@
closeConnections();
{
// force close the notification channel -- see bug #295
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_notifyReceiverLock);
+ std::lock_guard<decltype(m_notifyReceiverLock)> guard(m_notifyReceiverLock);
if (m_numRegionListener > 0) {
LOGFINE(
"Connection to %s still has references "
@@ -127,23 +127,25 @@
GfErrType TcrEndpoint::createNewConnectionWL(
TcrConnection*& newConn, bool isClientNotification, bool isSecondary,
std::chrono::microseconds connectTimeout) {
+ using clock = std::chrono::steady_clock;
+
LOGFINE("TcrEndpoint::createNewConnectionWL");
auto connectWaitTimeout = m_cacheImpl->getDistributedSystem()
.getSystemProperties()
.connectWaitTimeout();
- ACE_Time_Value interval(connectWaitTimeout);
- ACE_Time_Value stopAt(ACE_OS::gettimeofday());
- stopAt += interval;
- bool connCreated = false;
- while (ACE_OS::gettimeofday() < stopAt) {
- int32_t ret = m_connectLock.acquire(&stopAt);
+ auto stopAt = clock::now() + connectWaitTimeout;
+ auto connCreated = false;
+ std::unique_lock<decltype(m_connectLock)> lock(m_connectLock,
+ std::defer_lock);
- LOGFINE(
- "TcrEndpoint::createNewConnectionWL ret = %d interval = %ld error =%s",
- ret, interval.get_msec(), ACE_OS::strerror(ACE_OS::last_error()));
+ while (clock::now() < stopAt) {
+ auto locked = lock.try_lock_until(stopAt);
- if (ret != -1) { // got lock
+ LOGFINE("TcrEndpoint::createNewConnectionWL ret = %d interval = %ld",
+ locked, connectWaitTimeout.count());
+
+ if (locked) {
try {
LOGFINE("TcrEndpoint::createNewConnectionWL got lock");
newConn =
@@ -152,29 +154,20 @@
isClientNotification, isSecondary,
connectTimeout);
- connCreated = true; // to break while loop
-
+ connCreated = true; // to break while loop
m_needToConnectInLock = false; // no need to take lock
-
- m_connectLock.release();
LOGFINE("New Connection Created");
break;
} catch (const TimeoutException&) {
LOGINFO("Timeout1 in handshake with endpoint[%s]", m_name.c_str());
- m_connectLock.release();
- // throw te;
return GF_CLIENT_WAIT_TIMEOUT_REFRESH_PRMETADATA;
} catch (std::exception& ex) {
- m_connectLock.release();
LOGWARN("Failed1 in handshake with endpoint[%s]: %s", m_name.c_str(),
ex.what());
- // throw ex;
return GF_CLIENT_WAIT_TIMEOUT_REFRESH_PRMETADATA;
} catch (...) {
LOGWARN("Unknown1 failure in handshake with endpoint[%s]",
m_name.c_str());
- m_connectLock.release();
- // throw;
return GF_CLIENT_WAIT_TIMEOUT_REFRESH_PRMETADATA;
}
}
@@ -224,7 +217,8 @@
if (!isClientNotification && sendUpdateNotification) {
bool notificationStarted;
{
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_notifyReceiverLock);
+ std::lock_guard<decltype(m_notifyReceiverLock)> guard(
+ m_notifyReceiverLock);
notificationStarted = (m_numRegionListener > 0) || m_isQueueHosted;
}
if (notificationStarted) {
@@ -247,8 +241,8 @@
m_needToConnectInLock = true; // while creating the connection
std::this_thread::sleep_for(std::chrono::milliseconds(50));
} catch (const GeodeIOException& ex) {
- LOGINFO("IO error[%d] in handshake with endpoint[%s]: %s",
- ACE_OS::last_error(), m_name.c_str(), ex.what());
+ LOGINFO("IO error in handshake with endpoint[%s]: %s", m_name.c_str(),
+ ex.what());
err = GF_IOERR;
m_needToConnectInLock = true; // while creating the connection
break;
@@ -296,7 +290,8 @@
m_isAuthenticated, m_baseDM);
if (!m_isAuthenticated && m_baseDM) {
this->setConnected();
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_endpointAuthenticationLock);
+ std::lock_guard<decltype(m_endpointAuthenticationLock)> guard(
+ m_endpointAuthenticationLock);
GfErrType err = GF_NOERR;
auto creds = getCredentials();
@@ -401,7 +396,7 @@
bool connected = false;
GfErrType err = GF_NOERR;
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_connectionLock);
+ std::lock_guard<decltype(m_connectionLock)> guard(m_connectionLock);
// Three cases here:
// 1. m_connected is false, m_isActiveEndpoint is false and then
// if isActiveEndpoint is true, then create 'max' connections
@@ -456,7 +451,7 @@
if (m_connected || connected) {
if (clientNotification) {
if (distMgr != nullptr) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guardDistMgrs(m_distMgrsLock);
+ std::lock_guard<decltype(m_distMgrsLock)> guardDistMgrs(m_distMgrsLock);
m_distMgrs.push_back(distMgr);
}
LOGFINEST(
@@ -464,7 +459,8 @@
"channel for endpoint %s",
m_name.c_str());
// setup notification channel for the first region
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_notifyReceiverLock);
+ std::lock_guard<decltype(m_notifyReceiverLock)> guard(
+ m_notifyReceiverLock);
if (m_numRegionListener == 0) {
if ((err = createNewConnection(m_notifyConnection, true, isSecondary,
m_cacheImpl->getDistributedSystem()
@@ -479,8 +475,9 @@
m_name.c_str());
return err;
}
- m_notifyReceiver = new Task<TcrEndpoint>(
- this, &TcrEndpoint::receiveNotification, NC_Notification);
+ m_notifyReceiver =
+ std::unique_ptr<Task<TcrEndpoint>>(new Task<TcrEndpoint>(
+ this, &TcrEndpoint::receiveNotification, NC_Notification));
m_notifyReceiver->start();
}
++m_numRegionListener;
@@ -519,14 +516,14 @@
"channel for endpoint %s",
m_name.c_str());
// close notification channel if there is no region
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_notifyReceiverLock);
+ std::lock_guard<decltype(m_notifyReceiverLock)> guard(m_notifyReceiverLock);
if (m_numRegionListener > 0 && --m_numRegionListener == 0) {
closeNotification();
}
LOGFINEST("Decremented subscription region count for endpoint %s to %d",
m_name.c_str(), m_numRegionListener);
if (distMgr != nullptr) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guardDistMgrs(m_distMgrsLock);
+ std::lock_guard<decltype(m_distMgrsLock)> guardDistMgrs(m_distMgrsLock);
m_distMgrs.remove(distMgr);
}
LOGFINEST("Done unsubscribe for endpoint %s", m_name.c_str());
@@ -583,7 +580,7 @@
return m_cacheImpl->tcrConnectionManager().checkDupAndAdd(eventid);
}
-int TcrEndpoint::receiveNotification(volatile bool& isRunning) {
+void TcrEndpoint::receiveNotification(std::atomic<bool>& isRunning) {
LOGFINE("Started subscription channel for endpoint %s", m_name.c_str());
while (isRunning) {
TcrMessageReply* msg = nullptr;
@@ -601,7 +598,8 @@
if (isRunning) {
setConnectionStatus(false);
// close notification channel
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_notifyReceiverLock);
+ std::lock_guard<decltype(m_notifyReceiverLock)> guard(
+ m_notifyReceiverLock);
if (m_numRegionListener > 0) {
m_numRegionListener = 0;
closeNotification();
@@ -711,7 +709,8 @@
if (m_connected) {
setConnectionStatus(false);
// close notification channel
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_notifyReceiverLock);
+ std::lock_guard<decltype(m_notifyReceiverLock)> guard(
+ m_notifyReceiverLock);
if (m_numRegionListener > 0) {
m_numRegionListener = 0;
closeNotification();
@@ -733,7 +732,6 @@
}
}
LOGFINE("Ended subscription channel for endpoint %s", m_name.c_str());
- return 0;
}
inline bool TcrEndpoint::compareTransactionIds(int32_t reqTransId,
@@ -919,7 +917,7 @@
epFailure = false;
if (useEPPool) {
if (m_maxConnections == 0) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_connectionLock);
+ std::lock_guard<decltype(m_connectionLock)> guard(m_connectionLock);
if (m_maxConnections == 0) {
LOGFINE(
"Creating a new connection when connection-pool-size system "
@@ -1191,7 +1189,7 @@
// bool wasActive = m_isActiveEndpoint;
// Then after taking the lock:
// If ( !wasActive && isActiveEndpoint ) { return; }
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_connectionLock);
+ std::lock_guard<decltype(m_connectionLock)> guard(m_connectionLock);
if (m_connected != status) {
bool connected = m_connected;
m_connected = status;
@@ -1242,7 +1240,7 @@
m_notifyConnection->close();
m_notifyReceiver->stopNoblock();
TcrConnectionManager& tccm = m_cacheImpl->tcrConnectionManager();
- tccm.addNotificationForDeletion(m_notifyReceiver, m_notifyConnection,
+ tccm.addNotificationForDeletion(m_notifyReceiver.get(), m_notifyConnection,
m_notificationCleanupSema);
m_notifyCount++;
m_cleanupSema.release();
@@ -1262,53 +1260,36 @@
void TcrEndpoint::stopNotifyReceiverAndCleanup() {
LOGFINER("Stopping subscription receiver and cleaning up");
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_notifyReceiverLock);
+ std::lock_guard<decltype(m_notifyReceiverLock)> guard(m_notifyReceiverLock);
if (m_notifyReceiver != nullptr) {
LOGFINER("Waiting for notification thread...");
// m_notifyReceiver->stopNoblock();
m_notifyReceiver->wait();
bool found = false;
- for (std::list<Task<TcrEndpoint>*>::iterator it =
- m_notifyReceiverList.begin();
- it != m_notifyReceiverList.end(); it++) {
- if (*it == m_notifyReceiver) {
+ for (const auto& it : m_notifyReceiverList) {
+ if (it == m_notifyReceiver.get()) {
found = true;
break;
}
}
if (!found) {
- _GEODE_SAFE_DELETE(m_notifyReceiver);
+ m_notifyReceiver = nullptr;
_GEODE_SAFE_DELETE(m_notifyConnection);
}
}
m_numRegionListener = 0;
- if (m_notifyReceiverList.size() > 0) {
- LOGFINER("TcrEndpoint::stopNotifyReceiverAndCleanup: notifylist size = %d",
- m_notifyReceiverList.size());
- for (std::list<Task<TcrEndpoint>*>::iterator it =
- m_notifyReceiverList.begin();
- it != m_notifyReceiverList.end(); it++) {
- LOGFINER(
- "TcrEndpoint::stopNotifyReceiverAndCleanup: deleting old notify "
- "recievers.");
- _GEODE_SAFE_DELETE(*it);
- }
- }
-
- if (m_notifyConnectionList.size() > 0) {
+ if (!m_notifyConnectionList.empty()) {
LOGFINER("TcrEndpoint::stopNotifyReceiverAndCleanup: notifylist size = %d",
m_notifyConnectionList.size());
- for (std::list<TcrConnection*>::iterator it =
- m_notifyConnectionList.begin();
- it != m_notifyConnectionList.end(); it++) {
+ for (auto& it : m_notifyConnectionList) {
LOGFINER(
"TcrEndpoint::stopNotifyReceiverAndCleanup: deleting old notify "
"connections.");
- _GEODE_SAFE_DELETE(*it);
+ _GEODE_SAFE_DELETE(it);
}
}
}
diff --git a/cppcache/src/TcrEndpoint.hpp b/cppcache/src/TcrEndpoint.hpp
index ac54349..4413529 100644
--- a/cppcache/src/TcrEndpoint.hpp
+++ b/cppcache/src/TcrEndpoint.hpp
@@ -22,9 +22,12 @@
#include <atomic>
#include <list>
+#include <memory>
+#include <mutex>
#include <string>
+#include <unordered_set>
-#include <ace/Recursive_Thread_Mutex.h>
+#include <ace/Condition_Recursive_Thread_Mutex.h>
#include <ace/Semaphore.h>
#include <geode/internal/geode_base.hpp>
@@ -32,9 +35,9 @@
#include "ErrType.hpp"
#include "FairQueue.hpp"
-#include "Set.hpp"
#include "Task.hpp"
#include "TcrConnection.hpp"
+#include "util/synchronized_set.hpp"
namespace apache {
namespace geode {
@@ -48,7 +51,7 @@
class ThinClientPoolDM;
class QueryService;
-class APACHE_GEODE_EXPORT TcrEndpoint {
+class TcrEndpoint {
public:
TcrEndpoint(
const std::string& name, CacheImpl* cacheImpl,
@@ -73,7 +76,7 @@
// void unregisterPoolDM( );
void pingServer(ThinClientPoolDM* poolDM = nullptr);
- int receiveNotification(volatile bool& isRunning);
+ void receiveNotification(std::atomic<bool>& isRunning);
GfErrType send(const TcrMessage& request, TcrMessageReply& reply);
GfErrType sendRequestConn(const TcrMessage& request, TcrMessageReply& reply,
TcrConnection* conn, std::string& failReason);
@@ -166,9 +169,7 @@
void setConnected(volatile bool connected = true) { m_connected = connected; }
virtual ThinClientPoolDM* getPoolHADM() { return nullptr; }
bool isQueueHosted();
- ACE_Recursive_Thread_Mutex& getQueueHostedMutex() {
- return m_notifyReceiverLock;
- }
+ std::recursive_mutex& getQueueHostedMutex() { return m_notifyReceiverLock; }
/*
void sendNotificationCloseMsg();
*/
@@ -190,13 +191,12 @@
protected:
TcrConnection* m_notifyConnection;
- Task<TcrEndpoint>* m_notifyReceiver;
+ std::unique_ptr<Task<TcrEndpoint>> m_notifyReceiver;
CacheImpl* m_cacheImpl;
std::list<Task<TcrEndpoint>*> m_notifyReceiverList;
std::list<TcrConnection*> m_notifyConnectionList;
- ACE_Condition<ACE_Recursive_Thread_Mutex> m_connectLockCond;
- ACE_Recursive_Thread_Mutex m_connectLock;
- ACE_Recursive_Thread_Mutex m_notifyReceiverLock;
+ std::timed_mutex m_connectLock;
+ std::recursive_mutex m_notifyReceiverLock;
FairQueue<TcrConnection> m_opConnections;
volatile int m_maxConnections;
int m_numRegionListener;
@@ -229,11 +229,11 @@
ThinClientBaseDM* m_baseDM;
std::string m_name;
std::list<ThinClientBaseDM*> m_distMgrs;
- ACE_Recursive_Thread_Mutex m_endpointAuthenticationLock;
- ACE_Recursive_Thread_Mutex m_connectionLock;
- ACE_Recursive_Thread_Mutex m_distMgrsLock;
+ std::recursive_mutex m_endpointAuthenticationLock;
+ std::recursive_mutex m_connectionLock;
+ std::recursive_mutex m_distMgrsLock;
ACE_Semaphore m_notificationCleanupSema;
- Set<uint16_t> m_ports;
+ synchronized_set<std::unordered_set<uint16_t>> m_ports;
int32_t m_numberOfTimesFailed;
int m_numRegions;
int m_pingTimeouts;
diff --git a/cppcache/src/TcrHADistributionManager.cpp b/cppcache/src/TcrHADistributionManager.cpp
index 3ede87d..91dfa06 100644
--- a/cppcache/src/TcrHADistributionManager.cpp
+++ b/cppcache/src/TcrHADistributionManager.cpp
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
#include "TcrHADistributionManager.hpp"
#include <geode/ExceptionTypes.hpp>
@@ -21,6 +22,7 @@
#include "CacheImpl.hpp"
#include "RemoteQueryService.hpp"
+#include "TcrEndpoint.hpp"
#include "TcrMessage.hpp"
#include "ThinClientHARegion.hpp"
#include "ThinClientRegion.hpp"
diff --git a/cppcache/src/TcrHADistributionManager.hpp b/cppcache/src/TcrHADistributionManager.hpp
index e0a91fe..fb293ae 100644
--- a/cppcache/src/TcrHADistributionManager.hpp
+++ b/cppcache/src/TcrHADistributionManager.hpp
@@ -1,8 +1,3 @@
-#pragma once
-
-#ifndef GEODE_TCRHADISTRIBUTIONMANAGER_H_
-#define GEODE_TCRHADISTRIBUTIONMANAGER_H_
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -20,10 +15,15 @@
* limitations under the License.
*/
+#pragma once
+
+#ifndef GEODE_TCRHADISTRIBUTIONMANAGER_H_
+#define GEODE_TCRHADISTRIBUTIONMANAGER_H_
+
#include <geode/CacheAttributes.hpp>
#include <geode/internal/geode_base.hpp>
-#include "TcrEndpoint.hpp"
+#include "TcrConnectionManager.hpp"
#include "ThinClientDistributionManager.hpp"
namespace apache {
@@ -32,6 +32,8 @@
class ThinClientRegion;
class ThinClientHARegion;
+class TcrEndpoint;
+
/**
* @brief Distribute data between caches
*/
diff --git a/cppcache/src/TcrMessage.cpp b/cppcache/src/TcrMessage.cpp
index 6b7ee76..e5b6f93 100644
--- a/cppcache/src/TcrMessage.cpp
+++ b/cppcache/src/TcrMessage.cpp
@@ -36,6 +36,7 @@
#include "TXState.hpp"
#include "TcrChunkedContext.hpp"
#include "TcrConnection.hpp"
+#include "TcrConnectionManager.hpp"
#include "ThinClientBaseDM.hpp"
#include "ThinClientPoolDM.hpp"
#include "ThinClientRegion.hpp"
@@ -53,6 +54,8 @@
uint32_t g_headerLen = 17;
} // namespace
+extern void setThreadLocalExceptionMessage(const char*);
+
// AtomicInc TcrMessage::m_transactionId = 0;
uint8_t* TcrMessage::m_keepalive = nullptr;
const int TcrMessage::m_flag_empty = 0x01;
@@ -197,32 +200,31 @@
*intValue = input.readInt64();
}
-void TcrMessage::readStringPart(DataInput& input, uint32_t* len, char** str) {
- char* ts;
- int32_t sl = input.readInt32();
- ts = new char[sl];
- if (input.read()) throw Exception("String is not an object");
- input.readBytesOnly(reinterpret_cast<int8_t*>(ts), sl);
- *len = sl;
- *str = ts;
+const std::string TcrMessage::readStringPart(DataInput& input) {
+ char* stringBuffer;
+ int32_t stringLength = input.readInt32();
+ stringBuffer = new char[stringLength + 1];
+ stringBuffer[stringLength] = '\0';
+ if (input.read()) {
+ throw Exception("String is not an object");
+ }
+ input.readBytesOnly(reinterpret_cast<int8_t*>(stringBuffer), stringLength);
+ std::string str = stringBuffer;
+ delete[] stringBuffer;
+ return str;
}
+
void TcrMessage::readCqsPart(DataInput& input) {
m_cqs->clear();
readIntPart(input, &m_numCqPart);
for (uint32_t cqCnt = 0; cqCnt < m_numCqPart;) {
- char* cqName;
- uint32_t len;
- readStringPart(input, &len, &cqName);
- std::string cq(cqName, len);
- delete[] cqName;
+ auto cq = readStringPart(input);
cqCnt++;
int32_t cqOp;
readIntPart(input, reinterpret_cast<uint32_t*>(&cqOp));
cqCnt++;
(*m_cqs)[cq] = cqOp;
- // LOGINFO("read cqName[%s],cqOp[%d]", cq.c_str(), cqOp);
}
- // LOGDEBUG("mapsize = %d", m_cqs.size());
}
inline void TcrMessage::readCallbackObjectPart(DataInput& input,
@@ -234,17 +236,10 @@
input.readObject(m_callbackArgument);
} else {
if (defaultString) {
- // TODO:
- // m_callbackArgument = CacheableString::create(
- // (char*)input.currentBufferPosition( ), lenObj );
m_callbackArgument = readCacheableString(input, lenObj);
} else {
- // TODO::
- // m_callbackArgument = CacheableBytes::create(
- // input.currentBufferPosition( ), lenObj );
m_callbackArgument = readCacheableBytes(input, lenObj);
}
- // input.advanceCursor( lenObj );
}
}
}
@@ -257,15 +252,10 @@
input.readObject(m_value);
} else {
if (defaultString) {
- // m_value = CacheableString::create(
- // (char*)input.currentBufferPosition( ), lenObj );
m_value = readCacheableString(input, lenObj);
} else {
- // m_value = CacheableBytes::create(
- // input.currentBufferPosition( ), lenObj );
m_value = readCacheableBytes(input, lenObj);
}
- // input.advanceCursor( lenObj );
}
} else if (lenObj == 0 && isObj == 2) { // EMPTY BYTE ARRAY
m_value = CacheableBytes::create();
@@ -596,7 +586,7 @@
// the end write the length at the (buffer +
// 4) offset.
m_request->writeInt(static_cast<int32_t>(numOfParts));
- TXState* txState = TSSTXStateWrapper::s_geodeTSSTXState->getTXState();
+ auto txState = TSSTXStateWrapper::get().getTXState();
if (txState == nullptr) {
m_txId = -1;
} else {
@@ -851,12 +841,28 @@
}
break;
}
+ case TcrMessage::PUT_DATA_ERROR: {
+ chunkSecurityHeader(1, bytes, len, isLastChunkAndisSecurityHeader);
+ if (nullptr != bytes) {
+ auto input =
+ m_tcdm->getConnectionManager().getCacheImpl()->createDataInput(
+ bytes, len);
+ auto errorString = readStringPart(input);
+
+ if (!errorString.empty()) {
+ setThreadLocalExceptionMessage(errorString.c_str());
+ }
+
+ _GEODE_SAFE_DELETE_ARRAY(bytes);
+ }
+ break;
+ }
case TcrMessage::GET_ALL_DATA_ERROR: {
chunkSecurityHeader(1, bytes, len, isLastChunkAndisSecurityHeader);
if (bytes != nullptr) {
_GEODE_SAFE_DELETE_ARRAY(bytes);
}
- // nothing else to done since this will be taken care of at higher level
+
break;
}
default: {
@@ -1043,13 +1049,12 @@
case TcrMessage::UNREGISTER_INTEREST_DATA_ERROR:
case TcrMessage::PUT_DATA_ERROR:
case TcrMessage::KEY_SET_DATA_ERROR:
- case TcrMessage::REQUEST_DATA_ERROR:
case TcrMessage::DESTROY_REGION_DATA_ERROR:
case TcrMessage::CLEAR_REGION_DATA_ERROR:
case TcrMessage::CONTAINS_KEY_DATA_ERROR:
- case TcrMessage::PUT_DELTA_ERROR: {
- // do nothing. (?) TODO Do we need to process further.
- m_shouldIgnore = true;
+ case TcrMessage::PUT_DELTA_ERROR:
+ case TcrMessage::REQUEST_DATA_ERROR: {
+ m_value = std::make_shared<CacheableString>(readStringPart(input));
break;
}
diff --git a/cppcache/src/TcrMessage.hpp b/cppcache/src/TcrMessage.hpp
index f949851..46665c0 100644
--- a/cppcache/src/TcrMessage.hpp
+++ b/cppcache/src/TcrMessage.hpp
@@ -26,8 +26,6 @@
#include <string>
#include <vector>
-#include <ace/OS.h>
-
#include <geode/CacheableBuiltins.hpp>
#include <geode/CacheableKey.hpp>
#include <geode/CacheableString.hpp>
@@ -35,6 +33,7 @@
#include <geode/DataInput.hpp>
#include <geode/DataOutput.hpp>
#include <geode/ExceptionTypes.hpp>
+#include <geode/Region.hpp>
#include <geode/Serializable.hpp>
#include <geode/internal/geode_globals.hpp>
@@ -577,7 +576,7 @@
int32_t parts = 1); // skip num parts then read eventid
void skipParts(DataInput& input, int32_t numParts = 1);
- void readStringPart(DataInput& input, uint32_t* len, char** str);
+ const std::string readStringPart(DataInput& input);
void readCqsPart(DataInput& input);
void readHashMapForGCVersions(apache::geode::client::DataInput& input,
std::shared_ptr<CacheableHashMap>& value);
@@ -1263,12 +1262,11 @@
} else if (!isObj) {
// otherwise we're currently always expecting an object
char exMsg[256];
- ACE_OS::snprintf(exMsg, 255,
- "TcrMessageHelper::readChunkPartHeader: "
- "%s: part is not object",
- methodName);
+ std::snprintf(exMsg, sizeof(exMsg),
+ "TcrMessageHelper::readChunkPartHeader: "
+ "%s: part is not object",
+ methodName);
LOGDEBUG("%s ", exMsg);
- // throw MessageException(exMsg);
return ChunkObjectType::EXCEPTION;
}
@@ -1284,8 +1282,8 @@
return ChunkObjectType::EXCEPTION;
} else {
char exMsg[256];
- ACE_OS::snprintf(
- exMsg, 255,
+ std::snprintf(
+ exMsg, sizeof(exMsg),
"TcrMessageHelper::readChunkPartHeader: %s: cannot handle "
"java serializable object from server",
methodName);
@@ -1300,10 +1298,10 @@
if (expectedFirstType > DSCode::FixedIDDefault) {
if (partType != expectedFirstType) {
char exMsg[256];
- ACE_OS::snprintf(exMsg, 255,
- "TcrMessageHelper::readChunkPartHeader: "
- "%s: got unhandled object class = %" PRId8,
- methodName, static_cast<int8_t>(partType));
+ std::snprintf(exMsg, sizeof(exMsg),
+ "TcrMessageHelper::readChunkPartHeader: "
+ "%s: got unhandled object class = %" PRId8,
+ methodName, static_cast<int8_t>(partType));
throw MessageException(exMsg);
}
// This is for GETALL
@@ -1316,8 +1314,8 @@
}
if (compId != expectedPartType) {
char exMsg[256];
- ACE_OS::snprintf(
- exMsg, 255,
+ std::snprintf(
+ exMsg, sizeof(exMsg),
"TcrMessageHelper::readChunkPartHeader: "
"%s: got unhandled object type = %d, expected = %d, raw = %d",
methodName, compId, expectedPartType, rawByte);
@@ -1340,10 +1338,10 @@
} else if (!isObj) {
// otherwise we're currently always expecting an object
char exMsg[256];
- ACE_OS::snprintf(exMsg, 255,
- "TcrMessageHelper::readChunkPartHeader: "
- "%s: part is not object",
- methodName);
+ std::snprintf(exMsg, 255,
+ "TcrMessageHelper::readChunkPartHeader: "
+ "%s: part is not object",
+ methodName);
throw MessageException(exMsg);
}
@@ -1356,7 +1354,7 @@
return ChunkObjectType::EXCEPTION;
} else {
char exMsg[256];
- ACE_OS::snprintf(
+ std::snprintf(
exMsg, 255,
"TcrMessageHelper::readChunkPartHeader: %s: cannot handle "
"java serializable object from server",
diff --git a/cppcache/src/TcrPoolEndPoint.cpp b/cppcache/src/TcrPoolEndPoint.cpp
index cd387e5..c3ff4c0 100644
--- a/cppcache/src/TcrPoolEndPoint.cpp
+++ b/cppcache/src/TcrPoolEndPoint.cpp
@@ -60,7 +60,7 @@
LOGFINE("TcrPoolEndPoint::closeNotification..");
m_notifyReceiver->stopNoblock();
m_notifyConnectionList.push_back(m_notifyConnection);
- m_notifyReceiverList.push_back(m_notifyReceiver);
+ m_notifyReceiverList.push_back(m_notifyReceiver.get());
m_isQueueHosted = false;
}
@@ -68,7 +68,8 @@
ThinClientBaseDM*) {
GfErrType err = GF_NOERR;
ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_dm->getPoolLock());
- ACE_Guard<ACE_Recursive_Thread_Mutex> guardQueueHosted(getQueueHostedMutex());
+ std::lock_guard<decltype(getQueueHostedMutex())> guardQueueHosted(
+ getQueueHostedMutex());
auto& sysProp = m_cacheImpl->getDistributedSystem().getSystemProperties();
if (!connected()) {
TcrConnection* newConn;
@@ -97,8 +98,8 @@
name().c_str());
return err;
}
- m_notifyReceiver = new Task<TcrEndpoint>(
- this, &TcrEndpoint::receiveNotification, NC_Notification);
+ m_notifyReceiver = std::unique_ptr<Task<TcrEndpoint>>(new Task<TcrEndpoint>(
+ this, &TcrEndpoint::receiveNotification, NC_Notification));
m_notifyReceiver->start();
}
++m_numRegionListener;
@@ -111,7 +112,8 @@
}
void TcrPoolEndPoint::unregisterDM(bool, ThinClientBaseDM*,
bool checkQueueHosted) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(getQueueHostedMutex());
+ std::lock_guard<decltype(getQueueHostedMutex())> guardQueueHosted(
+ getQueueHostedMutex());
if (checkQueueHosted && !m_isQueueHosted) {
LOGFINEST(
@@ -125,7 +127,7 @@
"TcrEndpoint: unregistering pool DM and closing notification "
"channel for endpoint %s",
name().c_str());
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard2(m_notifyReceiverLock);
+ std::lock_guard<decltype(m_notifyReceiverLock)> guard2(m_notifyReceiverLock);
if (m_numRegionListener > 0 && --m_numRegionListener == 0) {
closeNotification();
}
diff --git a/cppcache/src/ThinClientBaseDM.cpp b/cppcache/src/ThinClientBaseDM.cpp
index 2bc1baa..b062915 100644
--- a/cppcache/src/ThinClientBaseDM.cpp
+++ b/cppcache/src/ThinClientBaseDM.cpp
@@ -17,8 +17,11 @@
#include "ThinClientBaseDM.hpp"
+#include <chrono>
+
#include <geode/AuthenticatedView.hpp>
+#include "TcrConnectionManager.hpp"
#include "ThinClientRegion.hpp"
#include "UserAttributes.hpp"
@@ -45,8 +48,7 @@
->getDistributedSystem()
.getSystemProperties();
- if (!systemProperties.isGridClient() &&
- systemProperties.enableChunkHandlerThread()) {
+ if (systemProperties.enableChunkHandlerThread()) {
startChunkProcessor();
}
@@ -194,19 +196,17 @@
void ThinClientBaseDM::queueChunk(TcrChunkedContext* chunk) {
LOGDEBUG("ThinClientBaseDM::queueChunk");
- const uint32_t timeout = 1;
if (m_chunkProcessor == nullptr) {
LOGDEBUG("ThinClientBaseDM::queueChunk2");
// process in same thread if no chunk processor thread
chunk->handleChunk(true);
_GEODE_SAFE_DELETE(chunk);
- } else if (!m_chunks.putUntil(chunk, timeout, 0)) {
+ } else if (!m_chunks.putFor(chunk, std::chrono::seconds(1))) {
LOGDEBUG("ThinClientBaseDM::queueChunk3");
// if put in queue fails due to whatever reason then process in same thread
LOGFINE(
"addChunkToQueue: timed out while adding to queue of "
- "unbounded size after waiting for %d secs",
- timeout);
+ "unbounded size after waiting for 1 secs");
chunk->handleChunk(true);
_GEODE_SAFE_DELETE(chunk);
} else {
@@ -215,39 +215,39 @@
}
// the chunk processing thread
-int ThinClientBaseDM::processChunks(volatile bool& isRunning) {
+void ThinClientBaseDM::processChunks(std::atomic<bool>& isRunning) {
TcrChunkedContext* chunk;
LOGFINE("Starting chunk process thread for region %s",
- (m_region != nullptr ? m_region->getFullPath().c_str() : "(null)"));
+ (m_region ? m_region->getFullPath().c_str() : "(null)"));
while (isRunning) {
- chunk = m_chunks.getUntil(0, 100000);
+ chunk = m_chunks.getFor(std::chrono::microseconds(100000));
if (chunk) {
chunk->handleChunk(false);
_GEODE_SAFE_DELETE(chunk);
}
}
LOGFINE("Ending chunk process thread for region %s",
- (m_region != nullptr ? m_region->getFullPath().c_str() : "(null)"));
+ (m_region ? m_region->getFullPath().c_str() : "(null)"));
GF_DEV_ASSERT(m_chunks.size() == 0);
- return 0;
}
// start the chunk processing thread
void ThinClientBaseDM::startChunkProcessor() {
if (m_chunkProcessor == nullptr) {
m_chunks.open();
- m_chunkProcessor = new Task<ThinClientBaseDM>(
- this, &ThinClientBaseDM::processChunks, NC_ProcessChunk);
+ m_chunkProcessor =
+ std::unique_ptr<Task<ThinClientBaseDM>>(new Task<ThinClientBaseDM>(
+ this, &ThinClientBaseDM::processChunks, NC_ProcessChunk));
m_chunkProcessor->start();
}
}
// stop the chunk processing thread
void ThinClientBaseDM::stopChunkProcessor() {
- if (m_chunkProcessor != nullptr) {
+ if (m_chunkProcessor) {
m_chunkProcessor->stop();
m_chunks.close();
- _GEODE_SAFE_DELETE(m_chunkProcessor);
+ m_chunkProcessor = nullptr;
}
}
@@ -270,13 +270,11 @@
connId = conn->getConnectionId();
uniqueId = conn->getEndpointObject()->getUniqueId();
} else {
- auto userAttribute = TSSUserAttributesWrapper::s_geodeTSSUserAttributes
- ->getUserAttributes();
connId = conn->getConnectionId();
if (!(request.getMessageType() == TcrMessage::USER_CREDENTIAL_MESSAGE)) {
- uniqueId =
- userAttribute->getConnectionAttribute(conn->getEndpointObject())
- ->getUniqueId();
+ uniqueId = UserAttributes::threadLocalUserAttributes
+ ->getConnectionAttribute(conn->getEndpointObject())
+ ->getUniqueId();
}
}
@@ -302,11 +300,8 @@
if (request.getMessageType() == TcrMessage::USER_CREDENTIAL_MESSAGE) {
if (TcrMessage::RESPONSE == reply.getMessageType()) {
if (this->isMultiUserMode()) {
- auto userAttribute =
- TSSUserAttributesWrapper::s_geodeTSSUserAttributes
- ->getUserAttributes();
- userAttribute->setConnectionAttributes(conn->getEndpointObject(),
- reply.getUniqueId(conn));
+ UserAttributes::threadLocalUserAttributes->setConnectionAttributes(
+ conn->getEndpointObject(), reply.getUniqueId(conn));
} else {
conn->getEndpointObject()->setUniqueId(reply.getUniqueId(conn));
}
@@ -336,6 +331,14 @@
bool ThinClientBaseDM::isEndpointAttached(TcrEndpoint*) { return false; }
+bool ThinClientBaseDM::checkDupAndAdd(std::shared_ptr<EventId> eventid) {
+ return m_connManager.checkDupAndAdd(eventid);
+}
+
+std::recursive_mutex& ThinClientBaseDM::getRedundancyLock() {
+ return m_connManager.getRedundancyLock();
+}
+
} // namespace client
} // namespace geode
} // namespace apache
diff --git a/cppcache/src/ThinClientBaseDM.hpp b/cppcache/src/ThinClientBaseDM.hpp
index 7a235b9..779f441 100644
--- a/cppcache/src/ThinClientBaseDM.hpp
+++ b/cppcache/src/ThinClientBaseDM.hpp
@@ -20,23 +20,30 @@
#ifndef GEODE_THINCLIENTBASEDM_H_
#define GEODE_THINCLIENTBASEDM_H_
+#include <memory>
#include <vector>
#include <geode/internal/geode_globals.hpp>
-#include "TcrConnectionManager.hpp"
-#include "TcrEndpoint.hpp"
+#include "Queue.hpp"
+#include "Task.hpp"
+#include "util/Log.hpp"
namespace apache {
namespace geode {
namespace client {
+class TcrMessage;
+class ThinClientRegion;
+class TcrEndpoint;
+class TcrConnectionManager;
+class TcrMessageReply;
+class TcrChunkedContext;
+class EventId;
+
/**
* @brief Distribute data between caches
*/
-class TcrMessage;
-class ThinClientRegion;
-
class ThinClientBaseDM {
public:
ThinClientBaseDM(TcrConnectionManager& connManager, ThinClientRegion* region);
@@ -108,13 +115,9 @@
virtual TcrEndpoint* getActiveEndpoint() { return nullptr; }
- virtual bool checkDupAndAdd(std::shared_ptr<EventId> eventid) {
- return m_connManager.checkDupAndAdd(eventid);
- }
+ virtual bool checkDupAndAdd(std::shared_ptr<EventId> eventid);
- virtual ACE_Recursive_Thread_Mutex* getRedundancyLock() {
- return m_connManager.getRedundancyLock();
- }
+ virtual std::recursive_mutex& getRedundancyLock();
static bool isDeltaEnabledOnServer() { return s_isDeltaEnabledOnServer; }
@@ -172,7 +175,7 @@
ThinClientRegion* m_region;
// methods for the chunk processing thread
- int processChunks(volatile bool& isRunning);
+ void processChunks(std::atomic<bool>& isRunning);
void startChunkProcessor();
void stopChunkProcessor();
@@ -193,7 +196,7 @@
bool m_clientNotification;
Queue<TcrChunkedContext*> m_chunks;
- Task<ThinClientBaseDM>* m_chunkProcessor;
+ std::unique_ptr<Task<ThinClientBaseDM>> m_chunkProcessor;
private:
static volatile bool s_isDeltaEnabledOnServer;
diff --git a/cppcache/src/ThinClientCacheDistributionManager.cpp b/cppcache/src/ThinClientCacheDistributionManager.cpp
index 50e1acf..7a67a10 100644
--- a/cppcache/src/ThinClientCacheDistributionManager.cpp
+++ b/cppcache/src/ThinClientCacheDistributionManager.cpp
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
#include "ThinClientCacheDistributionManager.hpp"
#include <algorithm>
@@ -25,6 +26,7 @@
#include "CacheImpl.hpp"
#include "ReadWriteLock.hpp"
#include "RemoteQueryService.hpp"
+#include "TcrConnectionManager.hpp"
#include "TcrEndpoint.hpp"
#include "TcrMessage.hpp"
#include "ThinClientBaseDM.hpp"
@@ -52,7 +54,7 @@
reply.setDM(this);
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_endpointsLock);
+ std::lock_guard<decltype(m_endpointsLock)> guard(m_endpointsLock);
// Return best effort result: If CQ succeeds on ANY server return no-error
// even if
@@ -134,8 +136,7 @@
// take the global endpoint lock so that the global endpoints list
// does not change while we are (possibly) adding endpoint to this endpoints
// list and incrementing the reference count of endpoint
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(
- m_connManager.getGlobalEndpoints().mutex());
+ auto&& guard = m_connManager.getGlobalEndpoints().make_lock();
// This method is called at the time of failover to refresh
// the list of endpoints.
std::vector<TcrEndpoint*> currentGlobalEndpointsList;
@@ -143,23 +144,18 @@
// Update local list with new endpoints.
std::vector<TcrEndpoint*> newEndpointsList;
- for (std::vector<TcrEndpoint*>::iterator it =
- currentGlobalEndpointsList.begin();
- it != currentGlobalEndpointsList.end(); ++it) {
+ for (const auto& it : currentGlobalEndpointsList) {
bool found = false;
- for (std::vector<TcrEndpoint*>::iterator currIter = m_endpoints.begin();
- currIter != m_endpoints.end(); ++currIter) {
- if (*currIter == *it) {
+ for (const auto& currIter : m_endpoints) {
+ if (currIter == it) {
found = true;
break;
}
}
- if (!found) newEndpointsList.push_back(*it);
+ if (!found) newEndpointsList.push_back(it);
}
- for (std::vector<TcrEndpoint*>::iterator it = newEndpointsList.begin();
- it != newEndpointsList.end(); ++it) {
- TcrEndpoint* ep = *it;
+ for (const auto& ep : newEndpointsList) {
m_endpoints.push_back(ep);
ep->setNumRegions(ep->numRegions() + 1);
LOGFINER(
diff --git a/cppcache/src/ThinClientDistributionManager.cpp b/cppcache/src/ThinClientDistributionManager.cpp
index 723c64d..5bf8cfe 100644
--- a/cppcache/src/ThinClientDistributionManager.cpp
+++ b/cppcache/src/ThinClientDistributionManager.cpp
@@ -23,6 +23,8 @@
#include <geode/SystemProperties.hpp>
#include "DistributedSystemImpl.hpp"
+#include "TcrConnectionManager.hpp"
+#include "TcrEndpoint.hpp"
#include "ThinClientRegion.hpp"
#include "util/exception.hpp"
@@ -68,7 +70,7 @@
return;
}
DistManagersLockGuard _guard(m_connManager);
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_endpointsLock);
+ std::lock_guard<decltype(m_endpointsLock)> guard(m_endpointsLock);
if (m_activeEndpoint >= 0) {
m_endpoints[m_activeEndpoint]->unregisterDM(m_clientNotification, this);
}
@@ -160,7 +162,7 @@
}
if (!isFatalError(error)) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_endpointsLock);
+ std::lock_guard<decltype(m_endpointsLock)> guard(m_endpointsLock);
GfErrType connErr = GF_NOERR;
while (error != GF_NOERR && !isFatalError(error) &&
(connErr = selectEndpoint(randIndex, doRand, useActiveEndpoint,
@@ -249,7 +251,7 @@
if (currentEndpoint < 0 || !m_endpoints[currentEndpoint]->connected() ||
forceSelect) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_endpointsLock);
+ std::lock_guard<decltype(m_endpointsLock)> guard(m_endpointsLock);
if (m_activeEndpoint < 0 || !m_endpoints[m_activeEndpoint]->connected() ||
forceSelect) { // double check
currentEndpoint = m_activeEndpoint;
diff --git a/cppcache/src/ThinClientDistributionManager.hpp b/cppcache/src/ThinClientDistributionManager.hpp
index d16421e..794cbf2 100644
--- a/cppcache/src/ThinClientDistributionManager.hpp
+++ b/cppcache/src/ThinClientDistributionManager.hpp
@@ -1,8 +1,3 @@
-#pragma once
-
-#ifndef GEODE_THINCLIENTDISTRIBUTIONMANAGER_H_
-#define GEODE_THINCLIENTDISTRIBUTIONMANAGER_H_
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -20,11 +15,19 @@
* limitations under the License.
*/
+#pragma once
+
+#ifndef GEODE_THINCLIENTDISTRIBUTIONMANAGER_H_
+#define GEODE_THINCLIENTDISTRIBUTIONMANAGER_H_
+
+#include <mutex>
+
#include "ThinClientBaseDM.hpp"
namespace apache {
namespace geode {
namespace client {
+
class ThinClientDistributionManager : public ThinClientBaseDM {
public:
ThinClientDistributionManager(TcrConnectionManager& connManager,
@@ -40,8 +43,8 @@
void failover() override;
- void acquireFailoverLock() override { m_endpointsLock.acquire_read(); };
- void releaseFailoverLock() override { m_endpointsLock.release(); };
+ void acquireFailoverLock() override { m_endpointsLock.lock(); };
+ void releaseFailoverLock() override { m_endpointsLock.unlock(); };
TcrEndpoint* getActiveEndpoint() override {
return m_endpoints[m_activeEndpoint];
@@ -76,7 +79,7 @@
volatile int m_activeEndpoint;
std::vector<TcrEndpoint*> m_endpoints;
- ACE_Recursive_Thread_Mutex m_endpointsLock;
+ std::recursive_mutex m_endpointsLock;
};
} // namespace client
} // namespace geode
diff --git a/cppcache/src/ThinClientHARegion.cpp b/cppcache/src/ThinClientHARegion.cpp
index 8205c57..3d11082 100644
--- a/cppcache/src/ThinClientHARegion.cpp
+++ b/cppcache/src/ThinClientHARegion.cpp
@@ -43,16 +43,6 @@
void ThinClientHARegion::initTCR() {
try {
const bool isPool = !m_attributes.getPoolName().empty();
- if (m_cacheImpl->getDistributedSystem()
- .getSystemProperties()
- .isGridClient()) {
- LOGWARN(
- "Region: HA region having notification channel created for grid "
- "client; force starting required notification, cleanup and "
- "failover threads");
- m_cacheImpl->tcrConnectionManager().startFailoverAndCleanupThreads(
- isPool);
- }
if (isPool) {
m_tcrdm = dynamic_cast<ThinClientPoolHADM*>(
diff --git a/cppcache/src/ThinClientLocatorHelper.cpp b/cppcache/src/ThinClientLocatorHelper.cpp
index 78fd5f5..e7174ce 100644
--- a/cppcache/src/ThinClientLocatorHelper.cpp
+++ b/cppcache/src/ThinClientLocatorHelper.cpp
@@ -32,10 +32,13 @@
#include "QueueConnectionRequest.hpp"
#include "QueueConnectionResponse.hpp"
#include "TcpSslConn.hpp"
+#include "TcrConnectionManager.hpp"
#include "ThinClientPoolDM.hpp"
+
namespace apache {
namespace geode {
namespace client {
+
const int BUFF_SIZE = 3000;
class ConnectionWrapper {
@@ -87,7 +90,7 @@
GfErrType ThinClientLocatorHelper::getAllServers(
std::vector<std::shared_ptr<ServerLocation> >& servers,
const std::string& serverGrp) {
- ACE_Guard<ACE_Thread_Mutex> guard(m_locatorLock);
+ std::lock_guard<decltype(m_locatorLock)> guard(m_locatorLock);
auto& sysProps = m_poolDM->getConnectionManager()
.getCacheImpl()
@@ -151,7 +154,7 @@
ClientProxyMembershipID& memId, std::list<ServerLocation>& outEndpoint,
std::string&, int redundancy, const std::set<ServerLocation>& exclEndPts,
const std::string& serverGrp) {
- ACE_Guard<ACE_Thread_Mutex> guard(m_locatorLock);
+ std::lock_guard<decltype(m_locatorLock)> guard(m_locatorLock);
auto& sysProps = m_poolDM->getConnectionManager()
.getCacheImpl()
->getDistributedSystem()
@@ -233,7 +236,7 @@
const std::set<ServerLocation>& exclEndPts, const std::string& serverGrp,
const TcrConnection* currentServer) {
bool locatorFound = false;
- ACE_Guard<ACE_Thread_Mutex> guard(m_locatorLock);
+ std::lock_guard<decltype(m_locatorLock)> guard(m_locatorLock);
auto& sysProps = m_poolDM->getConnectionManager()
.getCacheImpl()
->getDistributedSystem()
@@ -334,7 +337,7 @@
GfErrType ThinClientLocatorHelper::updateLocators(
const std::string& serverGrp) {
- ACE_Guard<ACE_Thread_Mutex> guard(m_locatorLock);
+ std::lock_guard<decltype(m_locatorLock)> guard(m_locatorLock);
auto& sysProps = m_poolDM->getConnectionManager()
.getCacheImpl()
->getDistributedSystem()
diff --git a/cppcache/src/ThinClientLocatorHelper.hpp b/cppcache/src/ThinClientLocatorHelper.hpp
index a3ede6a..c72f950 100644
--- a/cppcache/src/ThinClientLocatorHelper.hpp
+++ b/cppcache/src/ThinClientLocatorHelper.hpp
@@ -21,22 +21,25 @@
#define GEODE_THINCLIENTLOCATORHELPER_H_
#include <list>
+#include <mutex>
#include <set>
#include <string>
#include <geode/internal/geode_globals.hpp>
#include "ClientProxyMembershipID.hpp"
+#include "ErrType.hpp"
#include "GetAllServersRequest.hpp"
#include "GetAllServersResponse.hpp"
#include "ServerLocation.hpp"
-#include "TcrEndpoint.hpp"
namespace apache {
namespace geode {
namespace client {
-class TcrEndpoint;
+
class ThinClientPoolDM;
+class Connector;
+
class ThinClientLocatorHelper {
public:
ThinClientLocatorHelper(const std::vector<std::string>& locatorAddresses,
@@ -63,7 +66,7 @@
int32_t port,
std::chrono::microseconds waitSeconds,
int32_t maxBuffSizePool = 0);
- ACE_Thread_Mutex m_locatorLock;
+ std::mutex m_locatorLock;
std::vector<ServerLocation> m_locHostPort;
const ThinClientPoolDM* m_poolDM;
ThinClientLocatorHelper(const ThinClientLocatorHelper&);
diff --git a/cppcache/src/ThinClientPoolDM.cpp b/cppcache/src/ThinClientPoolDM.cpp
index 4ac91f2..f0c9da2 100644
--- a/cppcache/src/ThinClientPoolDM.cpp
+++ b/cppcache/src/ThinClientPoolDM.cpp
@@ -31,6 +31,7 @@
#include "ExpiryHandler_T.hpp"
#include "ExpiryTaskManager.hpp"
#include "NonCopyable.hpp"
+#include "TcrConnectionManager.hpp"
#include "TcrEndpoint.hpp"
#include "ThinClientRegion.hpp"
#include "ThinClientStickyManager.hpp"
@@ -91,8 +92,7 @@
m_keys.get(), m_poolDM, m_aCallbackArgument);
m_reply = new TcrMessageReply(true, m_poolDM);
if (m_poolDM->isMultiUserMode()) {
- m_userAttribute = TSSUserAttributesWrapper::s_geodeTSSUserAttributes
- ->getUserAttributes();
+ m_userAttribute = UserAttributes::threadLocalUserAttributes;
}
m_resultCollector = (new ChunkedGetAllResponse(
@@ -208,7 +208,8 @@
}
}
if (m_attrs->getPRSingleHopEnabled()) {
- m_clientMetadataService = new ClientMetadataService(this);
+ m_clientMetadataService =
+ std::unique_ptr<ClientMetadataService>(new ClientMetadataService(this));
}
m_manager = new ThinClientStickyManager(this);
}
@@ -231,15 +232,18 @@
m_connManager.init(true);
- LOGDEBUG("ThinClientPoolDM::init: is grid client = %d ",
- sysProp.isGridClient());
-
- if (!sysProp.isGridClient()) {
- ThinClientPoolDM::startBackgroundThreads();
- }
+ ThinClientPoolDM::startBackgroundThreads();
LOGDEBUG("ThinClientPoolDM::init: Completed initialization");
}
+
+ThinClientPoolDM::~ThinClientPoolDM() {
+ destroy();
+ _GEODE_SAFE_DELETE(m_locHelper);
+ _GEODE_SAFE_DELETE(m_stats);
+ _GEODE_SAFE_DELETE(m_manager);
+}
+
std::shared_ptr<Properties> ThinClientPoolDM::getCredentials(TcrEndpoint* ep) {
auto cacheImpl = m_connManager.getCacheImpl();
const auto& distributedSystem = cacheImpl->getDistributedSystem();
@@ -262,8 +266,9 @@
void ThinClientPoolDM::startBackgroundThreads() {
LOGDEBUG("ThinClientPoolDM::startBackgroundThreads: Starting ping thread");
- m_pingTask = new Task<ThinClientPoolDM>(this, &ThinClientPoolDM::pingServer,
- NC_Ping_Thread);
+ m_pingTask =
+ std::unique_ptr<Task<ThinClientPoolDM>>(new Task<ThinClientPoolDM>(
+ this, &ThinClientPoolDM::pingServer, NC_Ping_Thread));
m_pingTask->start();
auto& props = m_connManager.getCacheImpl()
@@ -272,21 +277,21 @@
if (props.onClientDisconnectClearPdxTypeIds() == true) {
m_cliCallbackTask =
- new Task<ThinClientPoolDM>(this, &ThinClientPoolDM::cliCallback);
+ std::unique_ptr<Task<ThinClientPoolDM>>(new Task<ThinClientPoolDM>(
+ this, &ThinClientPoolDM::cliCallback, "NC_cliCallback"));
m_cliCallbackTask->start();
}
- auto pingInterval =
- static_cast<int32_t>(getPingInterval().count() / (1000 * 2));
- if (pingInterval > 0) {
+ const auto& pingInterval = getPingInterval() / 2;
+ if (pingInterval > std::chrono::seconds::zero()) {
LOGDEBUG(
"ThinClientPoolDM::startBackgroundThreads: Scheduling ping task at %ld",
- pingInterval);
+ pingInterval.count());
auto pingHandler =
new ExpiryHandler_T<ThinClientPoolDM>(this, &ThinClientPoolDM::doPing);
m_pingTaskId =
m_connManager.getCacheImpl()->getExpiryTaskManager().scheduleExpiryTask(
- pingHandler, 1, pingInterval, false);
+ pingHandler, std::chrono::seconds(1), pingInterval, false);
} else {
LOGDEBUG(
"ThinClientPoolDM::startBackgroundThreads: Not Scheduling ping task as "
@@ -294,15 +299,14 @@
getPingInterval().count());
}
- auto updateLocatorListInterval =
- static_cast<uint32_t>(getUpdateLocatorListInterval().count());
+ auto updateLocatorListInterval = getUpdateLocatorListInterval();
- if (updateLocatorListInterval > 0) {
+ if (updateLocatorListInterval > std::chrono::seconds::zero()) {
m_updateLocatorListTask =
- new Task<ThinClientPoolDM>(this, &ThinClientPoolDM::updateLocatorList);
+ std::unique_ptr<Task<ThinClientPoolDM>>(new Task<ThinClientPoolDM>(
+ this, &ThinClientPoolDM::updateLocatorList, "NC_LocatorList"));
m_updateLocatorListTask->start();
- updateLocatorListInterval = updateLocatorListInterval / 1000; // seconds
LOGDEBUG(
"ThinClientPoolDM::startBackgroundThreads: Creating updateLocatorList "
"task");
@@ -312,18 +316,20 @@
LOGDEBUG(
"ThinClientPoolDM::startBackgroundThreads: Scheduling updater Locator "
"task at %ld",
- updateLocatorListInterval);
+ updateLocatorListInterval.count());
m_updateLocatorListTaskId =
m_connManager.getCacheImpl()->getExpiryTaskManager().scheduleExpiryTask(
- updateLocatorListHandler, 1, updateLocatorListInterval, false);
+ updateLocatorListHandler, std::chrono::seconds(1),
+ updateLocatorListInterval, false);
}
LOGDEBUG(
"ThinClientPoolDM::startBackgroundThreads: Starting manageConnections "
"thread");
// Manage Connection Thread
- m_connManageTask = new Task<ThinClientPoolDM>(
- this, &ThinClientPoolDM::manageConnections, NC_MC_Thread);
+ m_connManageTask =
+ std::unique_ptr<Task<ThinClientPoolDM>>(new Task<ThinClientPoolDM>(
+ this, &ThinClientPoolDM::manageConnections, NC_MC_Thread));
m_connManageTask->start();
auto idle = getIdleTimeout();
@@ -360,11 +366,12 @@
LOGDEBUG(
"ThinClientPoolDM::startBackgroundThreads: Starting pool stat sampler");
- if (m_PoolStatsSampler == nullptr &&
+ if (!m_PoolStatsSampler &&
getStatisticInterval() > std::chrono::milliseconds::zero() &&
props.statisticsEnabled()) {
- m_PoolStatsSampler = new statistics::PoolStatsSampler(
- getStatisticInterval(), m_connManager.getCacheImpl(), this);
+ m_PoolStatsSampler = std::unique_ptr<statistics::PoolStatsSampler>(
+ new statistics::PoolStatsSampler(getStatisticInterval(),
+ m_connManager.getCacheImpl(), this));
m_PoolStatsSampler->start();
}
@@ -375,7 +382,7 @@
m_clientMetadataService->start();
}
}
-int ThinClientPoolDM::manageConnections(volatile bool& isRunning) {
+void ThinClientPoolDM::manageConnections(std::atomic<bool>& isRunning) {
LOGFINE("ThinClientPoolDM: starting manageConnections thread");
while (isRunning) {
@@ -388,18 +395,17 @@
}
}
LOGFINE("ThinClientPoolDM: ending manageConnections thread");
- return 0;
}
-void ThinClientPoolDM::cleanStaleConnections(volatile bool& isRunning) {
+void ThinClientPoolDM::cleanStaleConnections(std::atomic<bool>& isRunning) {
if (!isRunning) {
return;
}
LOGDEBUG("Cleaning stale connections");
- ACE_Time_Value _idle(getIdleTimeout());
- ACE_Time_Value _nextIdle = _idle;
+ auto _idle = getIdleTimeout();
+ auto _nextIdle = _idle;
{
TcrConnection* conn = nullptr;
@@ -411,9 +417,10 @@
if (canItBeDeleted(conn)) {
replacelist.push_back(conn);
} else if (conn) {
- ACE_Time_Value nextIdle =
- _idle - (ACE_OS::gettimeofday() - conn->getLastAccessed());
- if ((ACE_Time_Value(0, 0) < nextIdle) && (nextIdle < _nextIdle)) {
+ auto nextIdle =
+ _idle - std::chrono::duration_cast<std::chrono::milliseconds>(
+ TcrConnection::clock::now() - conn->getLastAccessed());
+ if (nextIdle > std::chrono::seconds::zero() && nextIdle < _nextIdle) {
_nextIdle = nextIdle;
}
savelist.push_back(conn);
@@ -437,9 +444,11 @@
createPoolConnection(newConn, excludeServers, maxConnLimit,
/*hasExpired(conn) ? nullptr :*/ conn);
if (newConn) {
- ACE_Time_Value nextIdle =
- _idle - (ACE_OS::gettimeofday() - newConn->getLastAccessed());
- if ((ACE_Time_Value(0, 0) < nextIdle) && (nextIdle < _nextIdle)) {
+ auto nextIdle =
+ _idle -
+ std::chrono::duration_cast<std::chrono::milliseconds>(
+ TcrConnection::clock::now() - conn->getLastAccessed());
+ if (nextIdle > std::chrono::seconds::zero() && nextIdle < _nextIdle) {
_nextIdle = nextIdle;
}
savelist.push_back(newConn);
@@ -457,9 +466,12 @@
LOGDEBUG("Removed a connection");
} else {
conn->updateCreationTime();
- ACE_Time_Value nextIdle =
- _idle - (ACE_OS::gettimeofday() - conn->getLastAccessed());
- if ((ACE_Time_Value(0, 0) < nextIdle) && (nextIdle < _nextIdle)) {
+ auto nextIdle =
+ _idle -
+ std::chrono::duration_cast<std::chrono::milliseconds>(
+ TcrConnection::clock::now() - conn->getLastAccessed());
+ if (nextIdle > std::chrono::seconds::zero() &&
+ nextIdle < _nextIdle) {
_nextIdle = nextIdle;
}
savelist.push_back(conn);
@@ -478,18 +490,20 @@
}
if (m_connManageTaskId >= 0 && isRunning &&
m_connManager.getCacheImpl()->getExpiryTaskManager().resetTask(
- m_connManageTaskId, static_cast<uint32_t>(_nextIdle.sec() + 1))) {
+ m_connManageTaskId, _nextIdle)) {
LOGERROR("Failed to reschedule connection manager");
} else {
- LOGFINEST("Rescheduled next connection manager run after %d seconds",
- _nextIdle.sec() + 1);
+ LOGFINEST(
+ "Rescheduled next connection manager run after %d seconds",
+ std::chrono::duration_cast<std::chrono::seconds>(_nextIdle).count());
}
LOGDEBUG("Pool size is %d, pool counter is %d", size(), m_poolSize.load());
}
-void ThinClientPoolDM::cleanStickyConnections(volatile bool&) {}
-void ThinClientPoolDM::restoreMinConnections(volatile bool& isRunning) {
+void ThinClientPoolDM::cleanStickyConnections(std::atomic<bool>&) {}
+
+void ThinClientPoolDM::restoreMinConnections(std::atomic<bool>& isRunning) {
if (!isRunning) {
return;
}
@@ -521,7 +535,7 @@
LOGDEBUG("Pool size is %d, pool counter is %d", size(), m_poolSize.load());
}
-int ThinClientPoolDM::manageConnectionsInternal(volatile bool& isRunning) {
+void ThinClientPoolDM::manageConnectionsInternal(std::atomic<bool>& isRunning) {
try {
LOGFINE(
"ThinClientPoolDM::manageConnections(): checking connections in pool "
@@ -542,7 +556,6 @@
} catch (...) {
LOGERROR("Unexpected exception during manage connections");
}
- return 0;
}
std::string ThinClientPoolDM::selectEndpoint(
@@ -568,15 +581,15 @@
getStats().incLoctorResposes();
char epNameStr[128] = {0};
- ACE_OS::snprintf(epNameStr, 128, "%s:%d",
- outEndpoint.getServerName().c_str(),
- outEndpoint.getPort());
+ std::snprintf(epNameStr, 128, "%s:%d", outEndpoint.getServerName().c_str(),
+ outEndpoint.getPort());
LOGFINE("ThinClientPoolDM: Locator returned endpoint [%s]", epNameStr);
return epNameStr;
} else if (m_attrs->m_initServList
.size()) { // use specified server endpoints
// highly complex round-robin algorithm
- ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_endpointSelectionLock);
+ std::lock_guard<decltype(m_endpointSelectionLock)> _guard(
+ m_endpointSelectionLock);
if (m_server >= m_attrs->m_initServList.size()) {
m_server = 0;
}
@@ -607,6 +620,7 @@
put(conn, false);
++m_poolSize;
}
+
GfErrType ThinClientPoolDM::sendRequestToAllServers(
const char* func, uint8_t getResult, std::chrono::milliseconds timeout,
std::shared_ptr<Cacheable> args, std::shared_ptr<ResultCollector>& rs,
@@ -615,7 +629,7 @@
getStats().setCurClientOps(++m_clientOps);
- auto resultCollectorLock = std::make_shared<ACE_Recursive_Thread_Mutex>();
+ auto resultCollectorLock = std::make_shared<std::recursive_mutex>();
auto csArray = getServers();
@@ -624,31 +638,30 @@
return GF_NOSERVER_FOUND;
}
- int feIndex = 0;
- FunctionExecution* fePtrList = new FunctionExecution[csArray->length()];
- auto* threadPool = m_connManager.getCacheImpl()->getThreadPool();
- auto userAttr =
- TSSUserAttributesWrapper::s_geodeTSSUserAttributes->getUserAttributes();
+ std::vector<std::shared_ptr<FunctionExecution>> fePtrList;
+ fePtrList.reserve(csArray->length());
+ auto& threadPool = m_connManager.getCacheImpl()->getThreadPool();
+ auto userAttr = UserAttributes::threadLocalUserAttributes;
for (int i = 0; i < csArray->length(); i++) {
auto cs = (*csArray)[i];
- std::string endpointStr(cs->value().c_str());
- TcrEndpoint* ep = nullptr;
- if (m_endpoints.find(endpointStr, ep)) {
- ep = addEP(cs->value().c_str());
+ auto endpointStr = cs->value();
+ auto ep = getEndpoint(endpointStr);
+ if (!ep) {
+ ep = addEP(cs->value());
} else if (!ep->connected()) {
LOGFINE(
"ThinClientPoolDM::sendRequestToAllServers server not connected %s ",
cs->value().c_str());
}
- FunctionExecution* funcExe = &fePtrList[feIndex++];
+ auto funcExe = std::make_shared<FunctionExecution>();
funcExe->setParameters(func, getResult, timeout, args, ep, this,
resultCollectorLock, &rs, userAttr);
- threadPool->perform(funcExe);
+ fePtrList.push_back(funcExe);
+ threadPool.perform(funcExe);
}
GfErrType finalErrorReturn = GF_NOERR;
- for (int i = 0; i < feIndex; i++) {
- FunctionExecution* funcExe = &fePtrList[i];
+ for (auto& funcExe : fePtrList) {
err = funcExe->getResult();
if (err != GF_NOERR) {
if (funcExe->getException() == nullptr) {
@@ -688,7 +701,6 @@
getStats().setCurClientOps(--m_clientOps);
getStats().incSucceedClientOps();
- delete[] fePtrList;
return finalErrorReturn;
}
@@ -738,7 +750,7 @@
m_pingTask->stopNoblock();
m_pingSema.release();
m_pingTask->wait();
- _GEODE_SAFE_DELETE(m_pingTask);
+ m_pingTask = nullptr;
if (m_pingTaskId >= 0) {
m_connManager.getCacheImpl()->getExpiryTaskManager().cancelTask(
m_pingTaskId);
@@ -752,7 +764,7 @@
m_updateLocatorListTask->stopNoblock();
m_updateLocatorListSema.release();
m_updateLocatorListTask->wait();
- _GEODE_SAFE_DELETE(m_updateLocatorListTask);
+ m_updateLocatorListTask = nullptr;
if (m_updateLocatorListTaskId >= 0) {
m_connManager.getCacheImpl()->getExpiryTaskManager().cancelTask(
m_updateLocatorListTaskId);
@@ -766,7 +778,7 @@
m_cliCallbackTask->stopNoblock();
m_cliCallbackSema.release();
m_cliCallbackTask->wait();
- _GEODE_SAFE_DELETE(m_cliCallbackTask);
+ m_cliCallbackTask = nullptr;
}
}
@@ -781,21 +793,21 @@
}
LOGDEBUG("Closing PoolStatsSampler thread.");
- if (m_PoolStatsSampler != nullptr) {
+ if (m_PoolStatsSampler) {
m_PoolStatsSampler->stop();
- _GEODE_SAFE_DELETE(m_PoolStatsSampler);
+ m_PoolStatsSampler = nullptr;
}
LOGDEBUG("PoolStatsSampler thread closed .");
stopCliCallbackThread();
LOGDEBUG("ThinClientPoolDM::destroy( ): Closing connection manager.");
+ auto cacheImpl = m_connManager.getCacheImpl();
if (m_connManageTask) {
m_connManageTask->stopNoblock();
m_connSema.release();
m_connManageTask->wait();
- _GEODE_SAFE_DELETE(m_connManageTask);
+ m_connManageTask = nullptr;
if (m_connManageTaskId >= 0) {
- m_connManager.getCacheImpl()->getExpiryTaskManager().cancelTask(
- m_connManageTaskId);
+ cacheImpl->getExpiryTaskManager().cancelTask(m_connManageTaskId);
}
}
@@ -803,8 +815,9 @@
stopPingThread();
stopUpdateLocatorListThread();
- if (m_clientMetadataService != nullptr) {
+ if (m_clientMetadataService) {
m_clientMetadataService->stop();
+ // m_clientMetadataService = nullptr;
}
// closing all the thread local connections ( sticky).
LOGDEBUG("ThinClientPoolDM::destroy( ): closing FairQueue, pool size = %d",
@@ -812,11 +825,8 @@
close();
LOGDEBUG("ThinClientPoolDM::destroy( ): after close ");
- for (ACE_Map_Manager<std::string, TcrEndpoint*,
- ACE_Recursive_Thread_Mutex>::iterator iter =
- m_endpoints.begin();
- iter != m_endpoints.end(); ++iter) {
- TcrEndpoint* ep = (*iter).int_id_;
+ for (const auto& iter : m_endpoints) {
+ auto ep = iter.second;
LOGFINE("ThinClientPoolDM: forcing endpoint delete for %d in destructor",
ep->name().c_str());
_GEODE_SAFE_DELETE(ep);
@@ -824,14 +834,9 @@
// Close Stats
getStats().close();
- m_connManager.getCacheImpl()->getStatisticsManager().forceSample();
+ cacheImpl->getStatisticsManager().forceSample();
- if (m_clientMetadataService != nullptr) {
- _GEODE_SAFE_DELETE(m_clientMetadataService);
- }
-
- m_connManager.getCacheImpl()->getPoolManager().removePool(
- m_poolName.c_str());
+ cacheImpl->getPoolManager().removePool(m_poolName);
stopChunkProcessor();
m_manager->closeAllStickyConnections();
@@ -869,30 +874,18 @@
->getDistributedSystem()
.getSystemProperties();
- if (props.isGridClient()) {
- LOGWARN("Initializing query service while grid-client setting is enabled.");
- // Init Query Service
- m_remoteQueryServicePtr = std::make_shared<RemoteQueryService>(
- m_connManager.getCacheImpl(), this);
- m_remoteQueryServicePtr->init();
- } else {
- LOGWARN("Remote query service is not initialized.");
- }
+ LOGWARN("Remote query service is not initialized.");
return m_remoteQueryServicePtr;
}
void ThinClientPoolDM::sendUserCacheCloseMessage(bool keepAlive) {
LOGDEBUG("ThinClientPoolDM::sendUserCacheCloseMessage");
- auto userAttribute =
- TSSUserAttributesWrapper::s_geodeTSSUserAttributes->getUserAttributes();
+ auto userAttribute = UserAttributes::threadLocalUserAttributes;
- std::map<std::string, UserConnectionAttributes*>& uca =
- userAttribute->getUserConnectionServers();
+ auto& ucs = userAttribute->getUserConnectionServers();
- std::map<std::string, UserConnectionAttributes*>::iterator it;
-
- for (it = uca.begin(); it != uca.end(); it++) {
- UserConnectionAttributes* uca = (*it).second;
+ for (const auto& it : ucs) {
+ auto uca = it.second;
if (uca->isAuthenticated() && uca->getEndpoint()->connected()) {
TcrMessageRemoveUserAuth request(
new DataOutput(m_connManager.getCacheImpl()->createDataOutput()),
@@ -1194,19 +1187,17 @@
return ep;
}
- if (m_endpoints.find(serverLocation->getEpString(), ep) != -1) {
+ ep = getEndpoint(serverLocation->getEpString());
+ if (ep) {
LOGDEBUG("Endpoint for single hop is %p", ep);
return ep;
}
// do for pool with endpoints. Add endpoint into m_endpoints only when we
// did not find it above and it is in the pool's m_initServList.
- for (std::vector<std::string>::iterator itr =
- m_attrs->m_initServList.begin();
- itr != m_attrs->m_initServList.end(); ++itr) {
- if ((ACE_OS::strcmp(serverLocation->getEpString().c_str(),
- (*itr).c_str()) == 0)) {
- ep = addEP(*(serverLocation.get())); // see if this is new endpoint
+ for (const auto& itr : m_attrs->m_initServList) {
+ if (serverLocation->getEpString() == itr) {
+ ep = addEP(*serverLocation); // see if this is new endpoint
break;
}
}
@@ -1241,14 +1232,13 @@
return ep;
}
-// gets the endpoint from the list of endpoints using the endpoint Name
-TcrEndpoint* ThinClientPoolDM::getEndPoint(std::string epNameStr) {
- TcrEndpoint* ep = nullptr;
- if (m_endpoints.find(epNameStr, ep) != -1) {
- LOGDEBUG("Endpoint for single hop is %p", ep);
- return ep;
+TcrEndpoint* ThinClientPoolDM::getEndpoint(const std::string& endpointName) {
+ auto&& guard = m_endpoints.make_lock();
+ const auto& find = m_endpoints.find(endpointName);
+ if (find == m_endpoints.end()) {
+ return nullptr;
}
- return ep;
+ return find->second;
}
GfErrType ThinClientPoolDM::sendSyncRequest(TcrMessage& request,
@@ -1274,9 +1264,9 @@
return sendSyncRequest(request, reply, attemptFailover, isBGThread,
nullptr);
}
- std::vector<GetAllWork*> getAllWorkers;
- auto* threadPool = m_connManager.getCacheImpl()->getThreadPool();
- ChunkedGetAllResponse* responseHandler =
+ std::vector<std::shared_ptr<GetAllWork>> getAllWorkers;
+ auto& threadPool = m_connManager.getCacheImpl()->getThreadPool();
+ auto responseHandler =
static_cast<ChunkedGetAllResponse*>(reply.getChunkedResultHandler());
for (const auto& locationIter : *locationMap) {
@@ -1284,18 +1274,16 @@
if (serverLocation == nullptr) {
}
const auto& keys = locationIter.second;
- auto worker =
- new GetAllWork(this, region, serverLocation, keys, attemptFailover,
- isBGThread, responseHandler->getAddToLocalCache(),
- responseHandler, request.getCallbackArgument());
- threadPool->perform(worker);
+ auto worker = std::make_shared<GetAllWork>(
+ this, region, serverLocation, keys, attemptFailover, isBGThread,
+ responseHandler->getAddToLocalCache(), responseHandler,
+ request.getCallbackArgument());
+ threadPool.perform(worker);
getAllWorkers.push_back(worker);
}
reply.setMessageType(TcrMessage::RESPONSE);
- for (std::vector<GetAllWork*>::iterator iter = getAllWorkers.begin();
- iter != getAllWorkers.end(); iter++) {
- GetAllWork* worker = *iter;
+ for (auto& worker : getAllWorkers) {
GfErrType err = worker->getResult();
if (err != GF_NOERR) {
@@ -1306,8 +1294,6 @@
if (currentReply->getMessageType() != TcrMessage::RESPONSE) {
reply.setMessageType(currentReply->getMessageType());
}
-
- delete worker;
}
return error;
} else {
@@ -1393,8 +1379,7 @@
request, version, singleHopConnFound,
connFound, serverLocation);
} else {
- userAttr = TSSUserAttributesWrapper::s_geodeTSSUserAttributes
- ->getUserAttributes();
+ userAttr = UserAttributes::threadLocalUserAttributes;
if (userAttr == nullptr) {
LOGWARN("Attempted operation type %d without credentials",
request.getMessageType());
@@ -1636,7 +1621,7 @@
conn = nullptr;
GfErrType error = GF_NOERR;
- auto theEP = getEndPoint(epNameStr);
+ auto theEP = getEndpoint(epNameStr);
LOGFINE(
"ThinClientPoolDM::getConnectionToAnEndPoint( ): Getting endpoint object "
@@ -1811,9 +1796,9 @@
LOGFINE("Endpoint selection failed");
return GF_NOTCON;
}
+
LOGFINE("Connecting to %s", epNameStr.c_str());
- TcrEndpoint* ep = nullptr;
- ep = addEP(epNameStr.c_str());
+ auto ep = addEP(epNameStr);
if (currentserver != nullptr &&
epNameStr == currentserver->getEndpointObject()->name()) {
@@ -1973,16 +1958,8 @@
error = this->sendUserCredentials(this->getCredentials(currentEndpoint),
conn, false, isServerException);
} else if (this->m_isMultiUserMode) {
- ua = TSSUserAttributesWrapper::s_geodeTSSUserAttributes
- ->getUserAttributes();
- if (ua == nullptr) {
- LOGWARN("Attempted operation type %d without credentials",
- request.getMessageType());
- if (conn) {
- putInQueue(conn, false, request.forTransaction());
- }
- return GF_NOT_AUTHORIZED_EXCEPTION;
- } else {
+ ua = UserAttributes::threadLocalUserAttributes;
+ if (ua) {
UserConnectionAttributes* uca =
ua->getConnectionAttribute(currentEndpoint);
@@ -1990,6 +1967,13 @@
error = this->sendUserCredentials(ua->getCredentials(), conn, false,
isServerException);
}
+ } else {
+ LOGWARN("Attempted operation type %d without credentials",
+ request.getMessageType());
+ if (conn) {
+ putInQueue(conn, false, request.forTransaction());
+ }
+ return GF_NOT_AUTHORIZED_EXCEPTION;
}
}
}
@@ -2055,29 +2039,28 @@
std::string serverName = serverLoc.getServerName();
int port = serverLoc.getPort();
char endpointName[100];
- ACE_OS::snprintf(endpointName, 100, "%s:%d", serverName.c_str(), port);
+ std::snprintf(endpointName, 100, "%s:%d", serverName.c_str(), port);
return addEP(endpointName);
}
-TcrEndpoint* ThinClientPoolDM::addEP(const char* endpointName) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_endpointsLock);
- TcrEndpoint* ep = nullptr;
+TcrEndpoint* ThinClientPoolDM::addEP(const std::string& endpointName) {
+ std::lock_guard<decltype(m_endpointsLock)> guard(m_endpointsLock);
- std::string fullName = endpointName;
- if (m_endpoints.find(fullName, ep)) {
- LOGFINE("Created new endpoint %s for pool %s", fullName.c_str(),
+ auto ep = getEndpoint(endpointName);
+ if (!ep) {
+ LOGFINE("Created new endpoint %s for pool %s", endpointName.c_str(),
m_poolName.c_str());
- ep = createEP(fullName.c_str());
- if (m_endpoints.bind(fullName, ep)) {
- LOGERROR("Failed to add endpoint %s to pool %s", fullName.c_str(),
+ ep = createEP(endpointName.c_str());
+ if (m_endpoints.emplace(endpointName, ep).second) {
+ LOGERROR("Failed to add endpoint %s to pool %s", endpointName.c_str(),
m_poolName.c_str());
GF_DEV_ASSERT(
"ThinClientPoolDM::addEP( ): failed to add endpoint" ? false : false);
}
}
// Update Server Stats
- getStats().setServers(static_cast<int32_t>(m_endpoints.current_size()));
+ getStats().setServers(static_cast<int32_t>(m_endpoints.size()));
return ep;
}
@@ -2089,22 +2072,20 @@
void ThinClientPoolDM::pingServerLocal() {
ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(getPoolLock());
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_endpointsLock);
- for (ACE_Map_Manager<std::string, TcrEndpoint*,
- ACE_Recursive_Thread_Mutex>::iterator it =
- m_endpoints.begin();
- it != m_endpoints.end(); it++) {
- if ((*it).int_id_->connected()) {
- (*it).int_id_->pingServer(this);
- if (!(*it).int_id_->connected()) {
- removeEPConnections((*it).int_id_);
- removeCallbackConnection((*it).int_id_);
+ std::lock_guard<decltype(m_endpointsLock)> guard(m_endpointsLock);
+ for (auto& it : m_endpoints) {
+ auto endpoint = it.second;
+ if (endpoint->connected()) {
+ endpoint->pingServer(this);
+ if (!endpoint->connected()) {
+ removeEPConnections(endpoint);
+ removeCallbackConnection(endpoint);
}
}
}
}
-int ThinClientPoolDM::updateLocatorList(volatile bool& isRunning) {
+void ThinClientPoolDM::updateLocatorList(std::atomic<bool>& isRunning) {
LOGFINE("Starting updateLocatorList thread for pool %s", m_poolName.c_str());
while (isRunning) {
m_updateLocatorListSema.acquire();
@@ -2113,10 +2094,9 @@
}
}
LOGFINE("Ending updateLocatorList thread for pool %s", m_poolName.c_str());
- return 0;
}
-int ThinClientPoolDM::pingServer(volatile bool& isRunning) {
+void ThinClientPoolDM::pingServer(std::atomic<bool>& isRunning) {
LOGFINE("Starting ping thread for pool %s", m_poolName.c_str());
while (isRunning) {
m_pingSema.acquire();
@@ -2128,10 +2108,9 @@
}
}
LOGFINE("Ending ping thread for pool %s", m_poolName.c_str());
- return 0;
}
-int ThinClientPoolDM::cliCallback(volatile bool& isRunning) {
+void ThinClientPoolDM::cliCallback(std::atomic<bool>& isRunning) {
LOGFINE("Starting cliCallback thread for pool %s", m_poolName.c_str());
while (isRunning) {
m_cliCallbackSema.acquire();
@@ -2148,7 +2127,6 @@
}
}
LOGFINE("Ending cliCallback thread for pool %s", m_poolName.c_str());
- return 0;
}
int ThinClientPoolDM::doPing(const ACE_Time_Value&, const void*) {
@@ -2199,7 +2177,7 @@
bool queue = false;
{
ACE_Guard<ACE_Recursive_Thread_Mutex> poolguard(m_queueLock); // PXR
- ACE_Guard<ACE_Recursive_Thread_Mutex> guardQueue(
+ std::lock_guard<decltype(endPt->getQueueHostedMutex())> guardQueue(
endPt->getQueueHostedMutex());
queue = endPt->isQueueHosted();
if (queue) {
@@ -2328,11 +2306,11 @@
m_destroyPending = true;
}
-void ThinClientPoolDM::updateNotificationStats(bool isDeltaSuccess,
- int64_t timeInNanoSecond) {
+void ThinClientPoolDM::updateNotificationStats(
+ bool isDeltaSuccess, std::chrono::nanoseconds timeInNanoSecond) {
if (isDeltaSuccess) {
getStats().incProcessedDeltaMessages();
- getStats().incProcessedDeltaMessagesTime(timeInNanoSecond);
+ getStats().incProcessedDeltaMessagesTime(timeInNanoSecond.count());
} else {
getStats().incDeltaMessageFailures();
}
@@ -2399,7 +2377,7 @@
if (request.forTransaction()) {
bool connFound =
m_manager->getStickyConnection(conn, error, excludeServers, true);
- TXState* txState = TSSTXStateWrapper::s_geodeTSSTXState->getTXState();
+ auto txState = TSSTXStateWrapper::get().getTXState();
if (*error == GF_NOERR && !connFound &&
(txState == nullptr || txState->isDirty())) {
*error = doFailover(conn);
@@ -2482,6 +2460,106 @@
return conn;
}
+bool ThinClientPoolDM::checkDupAndAdd(std::shared_ptr<EventId> eventid) {
+ return m_connManager.checkDupAndAdd(eventid);
+}
+
+TcrEndpoint* ThinClientPoolDM::createEP(const char* endpointName) {
+ return new TcrPoolEndPoint(
+ endpointName, m_connManager.getCacheImpl(), m_connManager.m_failoverSema,
+ m_connManager.m_cleanupSema, m_connManager.m_redundancySema, this);
+}
+
+GfErrType FunctionExecution::execute(void) {
+ GuardUserAttributes gua;
+
+ if (m_userAttr) {
+ gua.setAuthenticatedView(m_userAttr->getAuthenticatedView());
+ }
+
+ std::string funcName(m_func);
+ TcrMessageExecuteFunction request(
+ new DataOutput(
+ m_poolDM->getConnectionManager().getCacheImpl()->createDataOutput()),
+ funcName, m_args, m_getResult, m_poolDM, m_timeout);
+ TcrMessageReply reply(true, m_poolDM);
+ ChunkedFunctionExecutionResponse* resultProcessor(
+ new ChunkedFunctionExecutionResponse(reply, (m_getResult & 2) == 2, *m_rc,
+ m_resultCollectorLock));
+ reply.setChunkedResultHandler(resultProcessor);
+ reply.setTimeout(m_timeout);
+ reply.setDM(m_poolDM);
+
+ LOGDEBUG(
+ "ThinClientPoolDM::sendRequestToAllServer sendRequest on endpoint[%s]!",
+ m_ep->name().c_str());
+
+ m_error = m_poolDM->sendRequestToEP(request, reply, m_ep);
+ m_error = m_poolDM->handleEPError(m_ep, reply, m_error);
+ if (m_error != GF_NOERR) {
+ if (m_error == GF_NOTCON || m_error == GF_IOERR) {
+ delete resultProcessor;
+ resultProcessor = nullptr;
+ return GF_NOERR; // if server is unavailable its not an error for
+ // functionexec OnServers() case
+ }
+ LOGDEBUG("FunctionExecution::execute failed on endpoint[%s]!. Error = %d ",
+ m_ep->name().c_str(), m_error);
+ if (reply.getMessageType() == TcrMessage::EXCEPTION) {
+ exceptionPtr = CacheableString::create(reply.getException());
+ }
+
+ delete resultProcessor;
+ resultProcessor = nullptr;
+ return m_error;
+ } else if (reply.getMessageType() == TcrMessage::EXCEPTION ||
+ reply.getMessageType() == TcrMessage::EXECUTE_FUNCTION_ERROR) {
+ m_error = ThinClientRegion::handleServerException("Execute",
+ reply.getException());
+ exceptionPtr = CacheableString::create(reply.getException());
+ }
+ if (resultProcessor->getResult() == true) {
+ }
+ delete resultProcessor;
+ resultProcessor = nullptr;
+ return m_error;
+}
+
+OnRegionFunctionExecution::OnRegionFunctionExecution(
+ std::string func, const Region* region, std::shared_ptr<Cacheable> args,
+ std::shared_ptr<CacheableHashSet> routingObj, uint8_t getResult,
+ std::chrono::milliseconds timeout, ThinClientPoolDM* poolDM,
+ const std::shared_ptr<std::recursive_mutex>& rCL,
+ std::shared_ptr<ResultCollector> rs,
+ std::shared_ptr<UserAttributes> userAttr, bool isBGThread,
+ const std::shared_ptr<BucketServerLocation>& serverLocation,
+ bool allBuckets)
+ : m_serverLocation(serverLocation),
+ m_isBGThread(isBGThread),
+ m_poolDM(poolDM),
+ m_func(func),
+ m_getResult(getResult),
+ m_timeout(timeout),
+ m_args(args),
+ m_routingObj(routingObj),
+ m_rc(rs),
+ m_resultCollectorLock(rCL),
+ m_userAttr(userAttr),
+ m_region(region),
+ m_allBuckets(allBuckets) {
+ m_request = new TcrMessageExecuteRegionFunctionSingleHop(
+ new DataOutput(
+ m_poolDM->getConnectionManager().getCacheImpl()->createDataOutput()),
+ m_func, m_region, m_args, m_routingObj, m_getResult, nullptr,
+ m_allBuckets, timeout, m_poolDM);
+ m_reply = new TcrMessageReply(true, m_poolDM);
+ m_resultCollector = new ChunkedFunctionExecutionResponse(
+ *m_reply, (m_getResult & 2) == 2, m_rc, m_resultCollectorLock);
+ m_reply->setChunkedResultHandler(m_resultCollector);
+ m_reply->setTimeout(m_timeout);
+ m_reply->setDM(m_poolDM);
+}
+
} // namespace client
} // namespace geode
} // namespace apache
diff --git a/cppcache/src/ThinClientPoolDM.hpp b/cppcache/src/ThinClientPoolDM.hpp
index 88bc492..79e7506 100644
--- a/cppcache/src/ThinClientPoolDM.hpp
+++ b/cppcache/src/ThinClientPoolDM.hpp
@@ -20,17 +20,19 @@
#ifndef GEODE_THINCLIENTPOOLDM_H_
#define GEODE_THINCLIENTPOOLDM_H_
+#include <chrono>
#include <memory>
+#include <mutex>
#include <set>
#include <string>
#include <vector>
+#include <ace/Recursive_Thread_Mutex.h>
#include <ace/Semaphore.h>
#include <geode/Pool.hpp>
#include <geode/ResultCollector.hpp>
-#include "ClientMetadataService.hpp"
#include "ExecutionImpl.hpp"
#include "FairQueue.hpp"
#include "NonCopyable.hpp"
@@ -60,20 +62,8 @@
class CacheImpl;
class FunctionExecution;
+class ClientMetadataService;
-/* adongre
- * CID 28731: Other violation (MISSING_COPY)
- * Class "apache::geode::client::ThinClientPoolDM" owns resources that are
- managed in its
- * constructor and destructor but has no user-written copy constructor.
- * FIX : Make the class no Copyablez
-
- * CID 28717: Other violation (MISSING_ASSIGN)
- * Class "apache::geode::client::ThinClientPoolDM" owns resources that are
- * managed in its constructor and destructor but has no user-written assignment
- operator.
- * Fix : Make the class Non Assinable
- */
class ThinClientPoolDM
: public ThinClientBaseDM,
public Pool,
@@ -84,56 +74,49 @@
ThinClientPoolDM(const char* name, std::shared_ptr<PoolAttributes> poolAttrs,
TcrConnectionManager& connManager);
- virtual void init();
+ void init() override;
- const std::string& getName() const { return m_poolName; }
+ const std::string& getName() const override { return m_poolName; }
- virtual GfErrType sendSyncRequest(TcrMessage& request, TcrMessageReply& reply,
- bool attemptFailover = true,
- bool isBGThread = false);
- GfErrType sendSyncRequest(
+ GfErrType sendSyncRequest(TcrMessage& request, TcrMessageReply& reply,
+ bool attemptFailover = true,
+ bool isBGThread = false) override;
+ virtual GfErrType sendSyncRequest(
TcrMessage& request, TcrMessageReply& reply, bool attemptFailover,
bool isBGThread,
const std::shared_ptr<BucketServerLocation>& serverLocation);
// Pool Specific Fns.
- virtual const std::shared_ptr<CacheableStringArray> getLocators() const;
- virtual const std::shared_ptr<CacheableStringArray> getServers();
- virtual void destroy(bool keepalive = false);
- virtual bool isDestroyed() const;
- virtual std::shared_ptr<QueryService> getQueryService();
+ const std::shared_ptr<CacheableStringArray> getLocators() const override;
+ const std::shared_ptr<CacheableStringArray> getServers() override;
+ void destroy(bool keepalive = false) override;
+ bool isDestroyed() const override;
+ std::shared_ptr<QueryService> getQueryService() override;
virtual std::shared_ptr<QueryService> getQueryServiceWithoutCheck();
- virtual bool isEndpointAttached(TcrEndpoint* ep);
+ bool isEndpointAttached(TcrEndpoint* ep) override;
GfErrType sendRequestToAllServers(
const char* func, uint8_t getResult, std::chrono::milliseconds timeout,
std::shared_ptr<Cacheable> args, std::shared_ptr<ResultCollector>& rs,
std::shared_ptr<CacheableString>& exceptionPtr);
GfErrType sendRequestToEP(const TcrMessage& request, TcrMessageReply& reply,
- TcrEndpoint* currentEndpoint);
+ TcrEndpoint* currentEndpoint) override;
void addConnection(TcrConnection* conn);
TcrEndpoint* addEP(ServerLocation& serverLoc);
- TcrEndpoint* addEP(const char* endpointName);
- virtual int pingServer(volatile bool& isRunning);
- virtual int updateLocatorList(volatile bool& isRunning);
- virtual int cliCallback(volatile bool& isRunning);
+ TcrEndpoint* addEP(const std::string& endpointName);
+ virtual void pingServer(std::atomic<bool>& isRunning);
+ virtual void updateLocatorList(std::atomic<bool>& isRunning);
+ virtual void cliCallback(std::atomic<bool>& isRunning);
virtual void pingServerLocal();
- virtual ~ThinClientPoolDM() {
- destroy();
- _GEODE_SAFE_DELETE(m_locHelper);
- _GEODE_SAFE_DELETE(m_stats);
- _GEODE_SAFE_DELETE(m_clientMetadataService);
- _GEODE_SAFE_DELETE(m_manager);
- }
+ ~ThinClientPoolDM() override;
+
// void updateQueue(const char* regionPath) ;
ClientProxyMembershipID* getMembershipId() { return m_memId.get(); }
virtual void processMarker(){};
- virtual bool checkDupAndAdd(std::shared_ptr<EventId> eventid) {
- return m_connManager.checkDupAndAdd(eventid);
- }
+ bool checkDupAndAdd(std::shared_ptr<EventId> eventid) override;
ACE_Recursive_Thread_Mutex& getPoolLock() { return getQueueLock(); }
void reducePoolSize(int num);
void removeEPConnections(int numConn, bool triggerManagerConn = true);
@@ -143,7 +126,7 @@
bool& maxConnLimit,
const TcrConnection* currentServer = nullptr);
ThinClientLocatorHelper* getLocatorHelper() { return m_locHelper; }
- virtual void releaseThreadLocalConnection();
+ void releaseThreadLocalConnection() override;
virtual void setThreadLocalConnection(TcrConnection* conn);
bool excludeConnection(TcrConnection*, std::set<ServerLocation>&);
void incRegionCount();
@@ -155,17 +138,18 @@
virtual bool canItBeDeletedNoImpl(TcrConnection* conn);
- void updateNotificationStats(bool isDeltaSuccess, int64_t timeInNanoSecond);
+ void updateNotificationStats(bool isDeltaSuccess,
+ std::chrono::nanoseconds timeInNanoSecond);
- virtual bool isSecurityOn() { return m_isSecurityOn || m_isMultiUserMode; }
+ bool isSecurityOn() override { return m_isSecurityOn || m_isMultiUserMode; }
- virtual bool isMultiUserMode() { return m_isMultiUserMode; }
+ bool isMultiUserMode() override { return m_isMultiUserMode; }
virtual void sendUserCacheCloseMessage(bool keepAlive);
virtual inline PoolStats& getStats() { return *m_stats; }
- size_t getNumberOfEndPoints() const { return m_endpoints.current_size(); }
+ size_t getNumberOfEndPoints() const override { return m_endpoints.size(); }
int32_t GetPDXIdForType(std::shared_ptr<Serializable> pdxType);
@@ -191,7 +175,7 @@
int8_t& version, std::set<ServerLocation>& excludeServers);
ClientMetadataService* getClientMetaDataService() {
- return m_clientMetadataService;
+ return m_clientMetadataService.get();
}
void setPrimaryServerQueueSize(int queueSize) {
m_primaryServerQueueSize = queueSize;
@@ -201,15 +185,14 @@
protected:
ThinClientStickyManager* m_manager;
std::vector<std::string> m_canonicalHosts;
- ACE_Map_Manager<std::string, TcrEndpoint*, ACE_Recursive_Thread_Mutex>
+ synchronized_map<std::unordered_map<std::string, TcrEndpoint*>,
+ std::recursive_mutex>
m_endpoints;
- ACE_Recursive_Thread_Mutex m_endpointsLock;
- ACE_Recursive_Thread_Mutex m_endpointSelectionLock;
+ std::recursive_mutex m_endpointsLock;
+ std::recursive_mutex m_endpointSelectionLock;
std::string m_poolName;
PoolStats* m_stats;
bool m_sticky;
- // PoolStats * m_stats;
- // PoolStatType* m_poolStatType;
void netDown();
ACE_Semaphore m_updateLocatorListSema;
ACE_Semaphore m_pingSema;
@@ -223,7 +206,7 @@
virtual void stopPingThread();
virtual void stopUpdateLocatorListThread();
virtual void stopCliCallbackThread();
- virtual void cleanStickyConnections(volatile bool& isRunning);
+ virtual void cleanStickyConnections(std::atomic<bool>& isRunning);
virtual TcrConnection* getConnectionFromQueue(bool timeout, GfErrType* error,
std::set<ServerLocation>&,
bool& maxConnLimit);
@@ -263,7 +246,7 @@
std::shared_ptr<UserAttributes> userAttribute);
// get endpoint using the endpoint string
- TcrEndpoint* getEndPoint(std::string epNameStr);
+ TcrEndpoint* getEndpoint(const std::string& epNameStr);
bool m_isSecurityOn;
bool m_isMultiUserMode;
@@ -286,18 +269,13 @@
std::set<ServerLocation>& excludeServers,
bool& maxConnLimit);
bool exclude(TcrConnection* conn, std::set<ServerLocation>& excludeServers);
- void deleteAction() { removeEPConnections(1); }
+ void deleteAction() override { removeEPConnections(1); }
std::string selectEndpoint(std::set<ServerLocation>&,
const TcrConnection* currentServer = nullptr);
// TODO global - m_memId was volatile
std::unique_ptr<ClientProxyMembershipID> m_memId;
- virtual TcrEndpoint* createEP(const char* endpointName) {
- return new TcrPoolEndPoint(endpointName, m_connManager.getCacheImpl(),
- m_connManager.m_failoverSema,
- m_connManager.m_cleanupSema,
- m_connManager.m_redundancySema, this);
- }
+ virtual TcrEndpoint* createEP(const char* endpointName);
virtual void removeCallbackConnection(TcrEndpoint*) {}
bool excludeServer(std::string, std::set<ServerLocation>&);
@@ -312,23 +290,23 @@
// Manage Connection thread
ACE_Semaphore m_connSema;
- Task<ThinClientPoolDM>* m_connManageTask;
- Task<ThinClientPoolDM>* m_pingTask;
- Task<ThinClientPoolDM>* m_updateLocatorListTask;
- Task<ThinClientPoolDM>* m_cliCallbackTask;
+ std::unique_ptr<Task<ThinClientPoolDM>> m_connManageTask;
+ std::unique_ptr<Task<ThinClientPoolDM>> m_pingTask;
+ std::unique_ptr<Task<ThinClientPoolDM>> m_updateLocatorListTask;
+ std::unique_ptr<Task<ThinClientPoolDM>> m_cliCallbackTask;
ExpiryTaskManager::id_type m_pingTaskId;
ExpiryTaskManager::id_type m_updateLocatorListTaskId;
ExpiryTaskManager::id_type m_connManageTaskId;
- int manageConnections(volatile bool& isRunning);
+ void manageConnections(std::atomic<bool>& isRunning);
int doPing(const ACE_Time_Value&, const void*);
int doUpdateLocatorList(const ACE_Time_Value&, const void*);
int doManageConnections(const ACE_Time_Value&, const void*);
- int manageConnectionsInternal(volatile bool& isRunning);
- void cleanStaleConnections(volatile bool& isRunning);
- void restoreMinConnections(volatile bool& isRunning);
+ void manageConnectionsInternal(std::atomic<bool>& isRunning);
+ void cleanStaleConnections(std::atomic<bool>& isRunning);
+ void restoreMinConnections(std::atomic<bool>& isRunning);
std::atomic<int32_t> m_clientOps; // Actual Size of Pool
- statistics::PoolStatsSampler* m_PoolStatsSampler;
- ClientMetadataService* m_clientMetadataService;
+ std::unique_ptr<statistics::PoolStatsSampler> m_PoolStatsSampler;
+ std::unique_ptr<ClientMetadataService> m_clientMetadataService;
friend class CacheImpl;
friend class ThinClientStickyManager;
friend class FunctionExecution;
@@ -346,7 +324,7 @@
std::shared_ptr<Cacheable> m_args;
GfErrType m_error;
std::shared_ptr<ResultCollector>* m_rc;
- std::shared_ptr<ACE_Recursive_Thread_Mutex> m_resultCollectorLock;
+ std::shared_ptr<std::recursive_mutex> m_resultCollectorLock;
std::shared_ptr<CacheableString> exceptionPtr;
std::shared_ptr<UserAttributes> m_userAttr;
@@ -370,7 +348,7 @@
std::chrono::milliseconds timeout,
std::shared_ptr<Cacheable> args, TcrEndpoint* ep,
ThinClientPoolDM* poolDM,
- const std::shared_ptr<ACE_Recursive_Thread_Mutex>& rCL,
+ const std::shared_ptr<std::recursive_mutex>& rCL,
std::shared_ptr<ResultCollector>* rs,
std::shared_ptr<UserAttributes> userAttr) {
exceptionPtr = nullptr;
@@ -384,68 +362,9 @@
m_ep = ep;
m_poolDM = poolDM;
m_userAttr = userAttr;
-
- // m_functionExecutionTask = new Task<FunctionExecution>(this,
- //&FunctionExecution::execute);
}
- GfErrType execute(void) {
- // TSSUserAttributesWrapper::s_geodeTSSUserAttributes->setUserAttributes(m_userAttr);
- GuardUserAttributes gua;
-
- if (m_userAttr) {
- gua.setAuthenticatedView(m_userAttr->getAuthenticatedView());
- }
-
- std::string funcName(m_func);
- TcrMessageExecuteFunction request(
- new DataOutput(m_poolDM->getConnectionManager()
- .getCacheImpl()
- ->createDataOutput()),
- funcName, m_args, m_getResult, m_poolDM, m_timeout);
- TcrMessageReply reply(true, m_poolDM);
- ChunkedFunctionExecutionResponse* resultProcessor(
- new ChunkedFunctionExecutionResponse(reply, (m_getResult & 2) == 2,
- *m_rc, m_resultCollectorLock));
- reply.setChunkedResultHandler(resultProcessor);
- reply.setTimeout(m_timeout);
- reply.setDM(m_poolDM);
-
- LOGDEBUG(
- "ThinClientPoolDM::sendRequestToAllServer sendRequest on endpoint[%s]!",
- m_ep->name().c_str());
-
- m_error = m_poolDM->sendRequestToEP(request, reply, m_ep);
- m_error = m_poolDM->handleEPError(m_ep, reply, m_error);
- if (m_error != GF_NOERR) {
- if (m_error == GF_NOTCON || m_error == GF_IOERR) {
- delete resultProcessor;
- resultProcessor = nullptr;
- return GF_NOERR; // if server is unavailable its not an error for
- // functionexec OnServers() case
- }
- LOGDEBUG(
- "FunctionExecution::execute failed on endpoint[%s]!. Error = %d ",
- m_ep->name().c_str(), m_error);
- if (reply.getMessageType() == TcrMessage::EXCEPTION) {
- exceptionPtr = CacheableString::create(reply.getException());
- }
-
- delete resultProcessor;
- resultProcessor = nullptr;
- return m_error;
- } else if (reply.getMessageType() == TcrMessage::EXCEPTION ||
- reply.getMessageType() == TcrMessage::EXECUTE_FUNCTION_ERROR) {
- m_error = ThinClientRegion::handleServerException("Execute",
- reply.getException());
- exceptionPtr = CacheableString::create(reply.getException());
- }
- if (resultProcessor->getResult() == true) {
- }
- delete resultProcessor;
- resultProcessor = nullptr;
- return m_error;
- }
+ GfErrType execute(void);
};
class OnRegionFunctionExecution : public PooledWork<GfErrType> {
@@ -461,7 +380,7 @@
std::shared_ptr<CacheableHashSet> m_routingObj;
std::shared_ptr<ResultCollector> m_rc;
TcrChunkedResult* m_resultCollector;
- std::shared_ptr<ACE_Recursive_Thread_Mutex> m_resultCollectorLock;
+ std::shared_ptr<std::recursive_mutex> m_resultCollectorLock;
std::shared_ptr<UserAttributes> m_userAttr;
const Region* m_region;
bool m_allBuckets;
@@ -471,37 +390,11 @@
std::string func, const Region* region, std::shared_ptr<Cacheable> args,
std::shared_ptr<CacheableHashSet> routingObj, uint8_t getResult,
std::chrono::milliseconds timeout, ThinClientPoolDM* poolDM,
- const std::shared_ptr<ACE_Recursive_Thread_Mutex>& rCL,
+ const std::shared_ptr<std::recursive_mutex>& rCL,
std::shared_ptr<ResultCollector> rs,
std::shared_ptr<UserAttributes> userAttr, bool isBGThread,
const std::shared_ptr<BucketServerLocation>& serverLocation,
- bool allBuckets)
- : m_serverLocation(serverLocation),
- m_isBGThread(isBGThread),
- m_poolDM(poolDM),
- m_func(func),
- m_getResult(getResult),
- m_timeout(timeout),
- m_args(args),
- m_routingObj(routingObj),
- m_rc(rs),
- m_resultCollectorLock(rCL),
- m_userAttr(userAttr),
- m_region(region),
- m_allBuckets(allBuckets) {
- m_request = new TcrMessageExecuteRegionFunctionSingleHop(
- new DataOutput(m_poolDM->getConnectionManager()
- .getCacheImpl()
- ->createDataOutput()),
- m_func, m_region, m_args, m_routingObj, m_getResult, nullptr,
- m_allBuckets, timeout, m_poolDM);
- m_reply = new TcrMessageReply(true, m_poolDM);
- m_resultCollector = new ChunkedFunctionExecutionResponse(
- *m_reply, (m_getResult & 2) == 2, m_rc, m_resultCollectorLock);
- m_reply->setChunkedResultHandler(m_resultCollector);
- m_reply->setTimeout(m_timeout);
- m_reply->setDM(m_poolDM);
- }
+ bool allBuckets);
~OnRegionFunctionExecution() {
delete m_request;
diff --git a/cppcache/src/ThinClientPoolHADM.cpp b/cppcache/src/ThinClientPoolHADM.cpp
index 5b0270b..244fd2e 100644
--- a/cppcache/src/ThinClientPoolHADM.cpp
+++ b/cppcache/src/ThinClientPoolHADM.cpp
@@ -20,6 +20,7 @@
#include <geode/SystemProperties.hpp>
#include "ExpiryHandler_T.hpp"
+#include "TcrConnectionManager.hpp"
#include "util/exception.hpp"
namespace apache {
@@ -50,11 +51,6 @@
->getDistributedSystem()
.getSystemProperties();
- if (props.isGridClient()) {
- LOGWARN("Starting background threads and ignoring grid-client setting");
- ThinClientPoolDM::startBackgroundThreads();
- }
-
m_redundancyManager->initialize(m_attrs->getSubscriptionRedundancy());
// Call maintain redundancy level, so primary is available for notification
// operations.
@@ -85,8 +81,9 @@
}
m_redundancyManager->startPeriodicAck();
- m_redundancyTask = new Task<ThinClientPoolHADM>(
- this, &ThinClientPoolHADM::redundancy, NC_Redundancy);
+ m_redundancyTask =
+ std::unique_ptr<Task<ThinClientPoolHADM>>(new Task<ThinClientPoolHADM>(
+ this, &ThinClientPoolHADM::redundancy, NC_Redundancy));
m_redundancyTask->start();
}
@@ -147,7 +144,7 @@
return true;
}
-int ThinClientPoolHADM::redundancy(volatile bool& isRunning) {
+void ThinClientPoolHADM::redundancy(std::atomic<bool>& isRunning) {
LOGFINE("ThinClientPoolHADM: Starting maintain redundancy thread.");
while (isRunning) {
m_redundancySema.acquire();
@@ -159,7 +156,6 @@
}
}
LOGFINE("ThinClientPoolHADM: Ending maintain redundancy thread.");
- return 0;
}
int ThinClientPoolHADM::checkRedundancy(const ACE_Time_Value&, const void*) {
@@ -199,7 +195,7 @@
m_redundancyTask->stopNoblock();
m_redundancySema.release();
m_redundancyTask->wait();
- _GEODE_SAFE_DELETE(m_redundancyTask);
+ m_redundancyTask = nullptr;
m_redundancyManager->sendNotificationCloseMsgs();
}
}
@@ -209,7 +205,7 @@
GfErrType err = GF_NOERR;
GfErrType opErr = GF_NOERR;
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_regionsLock);
+ std::lock_guard<decltype(m_regionsLock)> guard(m_regionsLock);
for (std::list<ThinClientRegion*>::iterator itr = m_regions.begin();
itr != m_regions.end(); itr++) {
if ((opErr = (*itr)->registerKeys(ep, request, reply)) != GF_NOERR) {
@@ -221,18 +217,48 @@
return err;
}
+bool ThinClientPoolHADM::checkDupAndAdd(std::shared_ptr<EventId> eventid) {
+ return m_redundancyManager->checkDupAndAdd(eventid);
+}
+
+void ThinClientPoolHADM::processMarker() {
+ // also set the static bool m_processedMarker for makePrimary messages
+ m_redundancyManager->m_globalProcessedMarker = true;
+}
+
+void ThinClientPoolHADM::acquireRedundancyLock() {
+ m_redundancyManager->acquireRedundancyLock();
+}
+
+void ThinClientPoolHADM::releaseRedundancyLock() {
+ m_redundancyManager->releaseRedundancyLock();
+}
+
+std::recursive_mutex& ThinClientPoolHADM::getRedundancyLock() {
+ return m_redundancyManager->getRedundancyLock();
+}
+
+GfErrType ThinClientPoolHADM::sendRequestToPrimary(TcrMessage& request,
+ TcrMessageReply& reply) {
+ return m_redundancyManager->sendRequestToPrimary(request, reply);
+}
+
+bool ThinClientPoolHADM::isReadyForEvent() const {
+ return m_redundancyManager->isSentReadyForEvents();
+}
+
void ThinClientPoolHADM::addRegion(ThinClientRegion* theTCR) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_regionsLock);
+ std::lock_guard<decltype(m_regionsLock)> guard(m_regionsLock);
m_regions.push_back(theTCR);
}
void ThinClientPoolHADM::addDisMessToQueue(ThinClientRegion* theTCR) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_regionsLock);
+ std::lock_guard<decltype(m_regionsLock)> guard(m_regionsLock);
if (m_redundancyManager->allEndPointDiscon()) {
theTCR->receiveNotification(TcrMessage::getAllEPDisMess());
}
}
void ThinClientPoolHADM::removeRegion(ThinClientRegion* theTCR) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_regionsLock);
+ std::lock_guard<decltype(m_regionsLock)> guard(m_regionsLock);
for (std::list<ThinClientRegion*>::iterator itr = m_regions.begin();
itr != m_regions.end(); itr++) {
if (*itr == theTCR) {
@@ -261,9 +287,9 @@
ThinClientPoolDM::netDown();
{
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_endpointsLock);
+ std::lock_guard<decltype(m_endpointsLock)> guard(m_endpointsLock);
for (auto&& currItr : m_endpoints) {
- currItr.int_id_->setConnectionStatus(false);
+ currItr.second->setConnectionStatus(false);
}
}
@@ -271,8 +297,8 @@
}
void ThinClientPoolHADM::pingServerLocal() {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(
- m_redundancyManager->getRedundancyLock());
+ auto& mutex = m_redundancyManager->getRedundancyLock();
+ std::lock_guard<decltype(mutex)> guard(mutex);
ThinClientPoolDM::pingServerLocal();
}
@@ -281,13 +307,19 @@
}
void ThinClientPoolHADM::sendNotConMesToAllregions() {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_regionsLock);
+ std::lock_guard<decltype(m_regionsLock)> guard(m_regionsLock);
for (std::list<ThinClientRegion*>::iterator it = m_regions.begin();
it != m_regions.end(); it++) {
(*it)->receiveNotification(TcrMessage::getAllEPDisMess());
}
}
+TcrEndpoint* ThinClientPoolHADM::createEP(const char* endpointName) {
+ return new TcrPoolEndPoint(
+ endpointName, m_connManager.getCacheImpl(), m_connManager.m_failoverSema,
+ m_connManager.m_cleanupSema, m_redundancySema, this);
+}
+
} // namespace client
} // namespace geode
} // namespace apache
diff --git a/cppcache/src/ThinClientPoolHADM.hpp b/cppcache/src/ThinClientPoolHADM.hpp
index f2ca229..a430b3f 100644
--- a/cppcache/src/ThinClientPoolHADM.hpp
+++ b/cppcache/src/ThinClientPoolHADM.hpp
@@ -1,8 +1,3 @@
-#pragma once
-
-#ifndef GEODE_THINCLIENTPOOLHADM_H_
-#define GEODE_THINCLIENTPOOLHADM_H_
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -19,27 +14,41 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
+#pragma once
+
+#ifndef GEODE_THINCLIENTPOOLHADM_H_
+#define GEODE_THINCLIENTPOOLHADM_H_
+
+#include <atomic>
+#include <memory>
+#include <mutex>
+
#include "PoolAttributes.hpp"
-#include "TcrConnectionManager.hpp"
+#include "Task.hpp"
#include "ThinClientHARegion.hpp"
#include "ThinClientPoolDM.hpp"
-//#include "TcrPoolEndPoint.hpp"
+
namespace apache {
namespace geode {
namespace client {
+class TcrConnectionManager;
+class ThinClientRedundancyManager;
+
class ThinClientPoolHADM : public ThinClientPoolDM {
public:
ThinClientPoolHADM(const char* name, std::shared_ptr<PoolAttributes> poolAttr,
TcrConnectionManager& connManager);
+ ThinClientPoolHADM(const ThinClientPoolHADM&) = delete;
+ ThinClientPoolHADM& operator=(const ThinClientPoolHADM&) = delete;
+ ~ThinClientPoolHADM() override { destroy(); }
- void init();
+ void init() override;
- virtual ~ThinClientPoolHADM() { destroy(); }
-
- virtual GfErrType sendSyncRequest(TcrMessage& request, TcrMessageReply& reply,
- bool attemptFailover = true,
- bool isBGThread = false);
+ GfErrType sendSyncRequest(TcrMessage& request, TcrMessageReply& reply,
+ bool attemptFailover = true,
+ bool isBGThread = false) override;
bool registerInterestForHARegion(TcrEndpoint* ep, const TcrMessage* request,
ThinClientHARegion& region);
@@ -47,55 +56,43 @@
GfErrType sendSyncRequestRegisterInterestEP(TcrMessage& request,
TcrMessageReply& reply,
bool attemptFailover,
- TcrEndpoint* endpoint);
+ TcrEndpoint* endpoint) override;
GfErrType registerInterestAllRegions(TcrEndpoint* ep,
const TcrMessage* request,
TcrMessageReply* reply);
- virtual void destroy(bool keepAlive = false);
+ virtual void destroy(bool keepAlive = false) override;
void readyForEvents();
void sendNotificationCloseMsgs();
- bool checkDupAndAdd(std::shared_ptr<EventId> eventid) {
- return m_redundancyManager->checkDupAndAdd(eventid);
- }
+ bool checkDupAndAdd(std::shared_ptr<EventId> eventid) override;
- void processMarker() {
- // also set the static bool m_processedMarker for makePrimary messages
- m_redundancyManager->m_globalProcessedMarker = true;
- }
+ void processMarker() override;
void netDown();
- void pingServerLocal();
+ void pingServerLocal() override;
- virtual void acquireRedundancyLock() {
- m_redundancyManager->acquireRedundancyLock();
- };
- virtual void releaseRedundancyLock() {
- m_redundancyManager->releaseRedundancyLock();
- };
- virtual ACE_Recursive_Thread_Mutex* getRedundancyLock() {
- return &m_redundancyManager->getRedundancyLock();
- }
+ void acquireRedundancyLock() override;
- GfErrType sendRequestToPrimary(TcrMessage& request, TcrMessageReply& reply) {
- return m_redundancyManager->sendRequestToPrimary(request, reply);
- }
+ void releaseRedundancyLock() override;
- virtual void triggerRedundancyThread() { m_redundancySema.release(); }
+ std::recursive_mutex& getRedundancyLock() override;
- bool isReadyForEvent() const {
- return m_redundancyManager->isSentReadyForEvents();
- }
+ GfErrType sendRequestToPrimary(TcrMessage& request, TcrMessageReply& reply);
+
+ void triggerRedundancyThread() override { m_redundancySema.release(); }
+
+ bool isReadyForEvent() const;
protected:
- virtual GfErrType sendSyncRequestRegisterInterest(
+ GfErrType sendSyncRequestRegisterInterest(
TcrMessage& request, TcrMessageReply& reply, bool attemptFailover = true,
- ThinClientRegion* region = nullptr, TcrEndpoint* endpoint = nullptr);
+ ThinClientRegion* region = nullptr,
+ TcrEndpoint* endpoint = nullptr) override;
virtual GfErrType sendSyncRequestCq(TcrMessage& request,
TcrMessageReply& reply);
@@ -104,36 +101,26 @@
virtual bool postFailoverAction(TcrEndpoint* endpoint);
- virtual void startBackgroundThreads();
+ void startBackgroundThreads() override;
private:
- // Disallow copy constructor and assignment operator.
ThinClientRedundancyManager* m_redundancyManager;
- ThinClientPoolHADM(const ThinClientPoolHADM&);
- ThinClientPoolHADM& operator=(const ThinClientPoolHADM&) = delete;
TcrConnectionManager& m_theTcrConnManager;
ACE_Semaphore m_redundancySema;
- Task<ThinClientPoolHADM>* m_redundancyTask;
+ std::unique_ptr<Task<ThinClientPoolHADM>> m_redundancyTask;
- int redundancy(volatile bool& isRunning);
- /*
- void stopNotificationThreads();
- */
+ void redundancy(std::atomic<bool>& isRunning);
+
ExpiryTaskManager::id_type m_servermonitorTaskId;
int checkRedundancy(const ACE_Time_Value&, const void*);
- virtual TcrEndpoint* createEP(const char* endpointName) {
- return new TcrPoolEndPoint(endpointName, m_connManager.getCacheImpl(),
- m_connManager.m_failoverSema,
- m_connManager.m_cleanupSema, m_redundancySema,
- this);
- }
+ TcrEndpoint* createEP(const char* endpointName) override;
- void removeCallbackConnection(TcrEndpoint*);
+ void removeCallbackConnection(TcrEndpoint*) override;
std::list<ThinClientRegion*> m_regions;
- ACE_Recursive_Thread_Mutex m_regionsLock;
+ std::recursive_mutex m_regionsLock;
void addRegion(ThinClientRegion* theTCR);
void removeRegion(ThinClientRegion* theTCR);
void sendNotConMesToAllregions();
diff --git a/cppcache/src/ThinClientPoolStickyDM.cpp b/cppcache/src/ThinClientPoolStickyDM.cpp
index be61f56..0f04150 100644
--- a/cppcache/src/ThinClientPoolStickyDM.cpp
+++ b/cppcache/src/ThinClientPoolStickyDM.cpp
@@ -97,7 +97,7 @@
request.forTransaction());
if (request.forTransaction()) {
- TXState* txState = TSSTXStateWrapper::s_geodeTSSTXState->getTXState();
+ auto txState = TSSTXStateWrapper::get().getTXState();
if (*error == GF_NOERR && !cf &&
(txState == nullptr || txState->isDirty())) {
*error = doFailover(conn);
@@ -131,7 +131,8 @@
}
}
-void ThinClientPoolStickyDM::cleanStickyConnections(volatile bool& isRunning) {
+void ThinClientPoolStickyDM::cleanStickyConnections(
+ std::atomic<bool>& isRunning) {
if (!isRunning) {
return;
}
diff --git a/cppcache/src/ThinClientPoolStickyDM.hpp b/cppcache/src/ThinClientPoolStickyDM.hpp
index b46d358..869c212 100644
--- a/cppcache/src/ThinClientPoolStickyDM.hpp
+++ b/cppcache/src/ThinClientPoolStickyDM.hpp
@@ -32,26 +32,23 @@
: ThinClientPoolDM(name, poolAttrs, connManager) {
m_sticky = true;
}
- virtual ~ThinClientPoolStickyDM() {
- // m_manager->closeAllStickyConnections();
- // delete m_manager; m_manager = nullptr;
- }
- virtual bool canItBeDeletedNoImpl(TcrConnection* conn);
+ ~ThinClientPoolStickyDM() override {}
+
+ bool canItBeDeletedNoImpl(TcrConnection* conn) override;
protected:
- virtual void cleanStickyConnections(volatile bool& isRunning);
- virtual TcrConnection* getConnectionFromQueueW(
+ void cleanStickyConnections(std::atomic<bool>& isRunning) override;
+ TcrConnection* getConnectionFromQueueW(
GfErrType* error, std::set<ServerLocation>&, bool isBGThread,
TcrMessage& request, int8_t& version, bool& match, bool& connFound,
- const std::shared_ptr<BucketServerLocation>& serverLocation = nullptr);
- virtual void putInQueue(TcrConnection* conn, bool isBGThread,
- bool isTransaction = false);
- virtual void setStickyNull(bool isBGThread);
- virtual bool canItBeDeleted(TcrConnection* conn);
- virtual void releaseThreadLocalConnection();
- virtual void setThreadLocalConnection(TcrConnection* conn);
-
- // virtual void cleanStickyConnections(volatile bool& isRunning);
+ const std::shared_ptr<BucketServerLocation>& serverLocation =
+ nullptr) override;
+ void putInQueue(TcrConnection* conn, bool isBGThread,
+ bool isTransaction = false) override;
+ void setStickyNull(bool isBGThread) override;
+ bool canItBeDeleted(TcrConnection* conn) override;
+ void releaseThreadLocalConnection() override;
+ void setThreadLocalConnection(TcrConnection* conn) override;
};
} // namespace client
} // namespace geode
diff --git a/cppcache/src/ThinClientRedundancyManager.cpp b/cppcache/src/ThinClientRedundancyManager.cpp
index c2658e0..75fe357 100644
--- a/cppcache/src/ThinClientRedundancyManager.cpp
+++ b/cppcache/src/ThinClientRedundancyManager.cpp
@@ -121,7 +121,8 @@
// to nonfatal errors such as server not available
GfErrType fatalError = GF_NOERR;
bool fatal = false;
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_redundantEndpointsLock);
+ std::lock_guard<decltype(m_redundantEndpointsLock)> guard(
+ m_redundantEndpointsLock);
bool isRedundancySatisfied = false;
int secondaryCount = 0;
bool isPrimaryConnected = false;
@@ -667,9 +668,8 @@
if (interval < std::chrono::milliseconds(100)) {
interval = std::chrono::milliseconds(100);
}
- m_nextAckInc = ACE_Time_Value(interval);
- m_nextAck = ACE_OS::gettimeofday();
- m_nextAck += m_nextAckInc;
+ m_nextAckInc = interval;
+ m_nextAck = clock::now() + interval;
}
if (m_poolHADM) {
@@ -693,7 +693,8 @@
}
void ThinClientRedundancyManager::sendNotificationCloseMsgs() {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_redundantEndpointsLock);
+ std::lock_guard<decltype(m_redundantEndpointsLock)> guard(
+ m_redundantEndpointsLock);
for (auto&& endpoint : m_redundantEndpoints) {
LOGDEBUG(
@@ -723,10 +724,11 @@
m_periodicAckTask->stopNoblock();
m_periodicAckSema.release();
m_periodicAckTask->wait();
- _GEODE_SAFE_DELETE(m_periodicAckTask);
+ m_periodicAckTask = nullptr;
}
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_redundantEndpointsLock);
+ std::lock_guard<decltype(m_redundantEndpointsLock)> guard(
+ m_redundantEndpointsLock);
for (auto&& endpoint : m_redundantEndpoints) {
LOGDEBUG(
@@ -827,7 +829,8 @@
TcrMessage& request, TcrMessageReply& reply, ThinClientBaseDM* theHADM) {
LOGDEBUG("ThinClientRedundancyManager::sendSyncRequestCq msgType[%d]",
request.getMessageType());
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_redundantEndpointsLock);
+ std::lock_guard<decltype(m_redundantEndpointsLock)> guard(
+ m_redundantEndpointsLock);
GfErrType err = GF_NOERR;
GfErrType opErr;
@@ -872,8 +875,7 @@
while (attempts--) {
if (err != GF_NOERR || m_redundantEndpoints.empty()) {
- auto userAttr = TSSUserAttributesWrapper::s_geodeTSSUserAttributes
- ->getUserAttributes();
+ auto userAttr = UserAttributes::threadLocalUserAttributes;
if (userAttr) {
authenticatedView = userAttr->getAuthenticatedView();
}
@@ -918,7 +920,8 @@
ThinClientBaseDM* theHADM, ThinClientRegion* region) {
LOGDEBUG("ThinClientRedundancyManager::sendSyncRequestRegisterInterest ");
if (!endpoint) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_redundantEndpointsLock);
+ std::lock_guard<decltype(m_redundantEndpointsLock)> guard(
+ m_redundantEndpointsLock);
auto err = GF_NOERR;
auto opErr = GF_NOERR;
@@ -980,8 +983,9 @@
}
}
-void ThinClientRedundancyManager::getAllEndpoints(
- std::vector<TcrEndpoint*>& endpoints) {
+synchronized_map<std::unordered_map<std::string, TcrEndpoint*>,
+ std::recursive_mutex>&
+ThinClientRedundancyManager::updateAndSelectEndpoints() {
// 38196 Fix: For durable clients reconnect
// 1. Get list of endpoints which have HA queue.
// 2. Get HA endpoint with max queuesize;
@@ -994,36 +998,35 @@
// Exception: For R =0 ( or when no EP with Max queuesize ),
// Old primary would be considered as new. Hence it would be at the end
- ACE_Map_Manager<std::string, TcrEndpoint*, ACE_Recursive_Thread_Mutex>*
- tempContainer;
if (m_poolHADM) {
- tempContainer = &m_poolHADM->m_endpoints;
// fetch queue servers
// send queue servers for sorting
std::set<ServerLocation> exclEndPts;
std::list<ServerLocation> outEndpoints;
outEndpoints = selectServers(-1, exclEndPts);
- for (std::list<ServerLocation>::iterator it = outEndpoints.begin();
- it != outEndpoints.end(); it++) {
- m_poolHADM->addEP(*it);
+ for (auto& it : outEndpoints) {
+ m_poolHADM->addEP(it);
}
- } else {
- tempContainer = &m_theTcrConnManager->m_endpoints;
- }
+ return m_poolHADM->m_endpoints;
+ } else {
+ return m_theTcrConnManager->m_endpoints;
+ }
+}
+
+void ThinClientRedundancyManager::getAllEndpoints(
+ std::vector<TcrEndpoint*>& endpoints) {
TcrEndpoint* maxQEp = nullptr;
TcrEndpoint* primaryEp = nullptr;
- for (ACE_Map_Manager<std::string, TcrEndpoint*,
- ACE_Recursive_Thread_Mutex>::iterator currItr =
- (*tempContainer).begin();
- currItr != (*tempContainer).end(); currItr++) {
+ auto& selectedEndpoints = updateAndSelectEndpoints();
+ for (const auto& currItr : selectedEndpoints) {
if (isDurable()) {
- TcrEndpoint* ep = (*currItr).int_id_;
+ auto ep = currItr.second;
int32_t queueSize = 0;
TcrConnection* statusConn = nullptr;
- ServerQueueStatus status =
+ auto status =
ep->getFreshServerQueueStatus(queueSize, !m_poolHADM, statusConn);
if (m_poolHADM && status != NON_REDUNDANT_SERVER) {
m_poolHADM->addConnection(statusConn);
@@ -1048,13 +1051,13 @@
"ThinClientRedundancyManager::getAllEndpoints(): sorting "
"endpoints, found primary endpoint.");
} else {
- endpoints.push_back((*currItr).int_id_);
+ endpoints.push_back(currItr.second);
LOGDEBUG(
"ThinClientRedundancyManager::getAllEndpoints(): sorting "
"endpoints, found nonredundant endpoint.");
}
} else {
- endpoints.push_back((*currItr).int_id_);
+ endpoints.push_back(currItr.second);
}
//(*currItr)++;
}
@@ -1113,7 +1116,8 @@
GfErrType result = GF_NOTCON;
unsigned int epCount = 0;
- ACE_Guard<ACE_Recursive_Thread_Mutex> guardEPs(m_redundantEndpointsLock);
+ std::lock_guard<decltype(m_redundantEndpointsLock)> guard(
+ m_redundantEndpointsLock);
if (m_sentReadyForEvents) {
throw IllegalStateException("Already called readyForEvents");
@@ -1159,7 +1163,7 @@
return 0;
}
-int ThinClientRedundancyManager::periodicAck(volatile bool& isRunning) {
+void ThinClientRedundancyManager::periodicAck(std::atomic<bool>& isRunning) {
while (isRunning) {
m_periodicAckSema.acquire();
if (isRunning) {
@@ -1169,7 +1173,6 @@
}
}
}
- return 0;
}
void ThinClientRedundancyManager::doPeriodicAck() {
@@ -1177,21 +1180,19 @@
"ThinClientRedundancyManager::processEventIdMap( ): Examining eventid "
"map.");
// do periodic ack if HA is enabled and the time has come
- if (m_HAenabled && (m_nextAck < ACE_OS::gettimeofday())) {
+ if (m_HAenabled && (m_nextAck < clock::now())) {
LOGFINER("Doing periodic ack");
m_nextAck += m_nextAckInc;
- EventIdMapEntryList entries = m_eventidmap.getUnAcked();
- uint32_t count = static_cast<uint32_t>(entries.size());
-
+ auto entries = m_eventidmap.getUnAcked();
+ auto count = entries.size();
if (count > 0) {
bool acked = false;
- ACE_Guard<ACE_Recursive_Thread_Mutex> guardEPs(m_redundantEndpointsLock);
+ std::lock_guard<decltype(m_redundantEndpointsLock)> guard(
+ m_redundantEndpointsLock);
- std::vector<TcrEndpoint*>::iterator endpoint =
- m_redundantEndpoints.begin();
-
+ auto endpoint = m_redundantEndpoints.begin();
if (endpoint != m_redundantEndpoints.end()) {
TcrMessagePeriodicAck request(
new DataOutput(
@@ -1240,8 +1241,9 @@
}
void ThinClientRedundancyManager::startPeriodicAck() {
- m_periodicAckTask = new Task<ThinClientRedundancyManager>(
- this, &ThinClientRedundancyManager::periodicAck, NC_PerodicACK);
+ m_periodicAckTask = std::unique_ptr<Task<ThinClientRedundancyManager>>(
+ new Task<ThinClientRedundancyManager>(
+ this, &ThinClientRedundancyManager::periodicAck, NC_PerodicACK));
m_periodicAckTask->start();
const auto& props = m_theTcrConnManager->getCacheImpl()
->getDistributedSystem()
@@ -1277,7 +1279,8 @@
}
void ThinClientRedundancyManager::netDown() {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_redundantEndpointsLock);
+ std::lock_guard<decltype(m_redundantEndpointsLock)> guard(
+ m_redundantEndpointsLock);
if (!m_poolHADM) {
m_nonredundantEndpoints.insert(m_nonredundantEndpoints.end(),
@@ -1288,13 +1291,15 @@
}
void ThinClientRedundancyManager::removeCallbackConnection(TcrEndpoint* ep) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_redundantEndpointsLock);
+ std::lock_guard<decltype(m_redundantEndpointsLock)> guard(
+ m_redundantEndpointsLock);
ep->unregisterDM(false, nullptr, true);
}
GfErrType ThinClientRedundancyManager::sendRequestToPrimary(
TcrMessage& request, TcrMessageReply& reply) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_redundantEndpointsLock);
+ std::lock_guard<decltype(m_redundantEndpointsLock)> guard(
+ m_redundantEndpointsLock);
GfErrType err = GF_NOTCON;
for (size_t count = 0;
count <= m_redundantEndpoints.size() + m_nonredundantEndpoints.size();
diff --git a/cppcache/src/ThinClientRedundancyManager.hpp b/cppcache/src/ThinClientRedundancyManager.hpp
index 11cb1a8..5794e50 100644
--- a/cppcache/src/ThinClientRedundancyManager.hpp
+++ b/cppcache/src/ThinClientRedundancyManager.hpp
@@ -20,15 +20,23 @@
#ifndef GEODE_THINCLIENTREDUNDANCYMANAGER_H_
#define GEODE_THINCLIENTREDUNDANCYMANAGER_H_
+#include <atomic>
+#include <chrono>
#include <list>
+#include <memory>
+#include <mutex>
#include <set>
#include <string>
+#include <ace/ACE.h>
+
+#include "ErrType.hpp"
#include "EventIdMap.hpp"
#include "ExpiryTaskManager.hpp"
#include "ServerLocation.hpp"
-#include "TcrEndpoint.hpp"
+#include "Task.hpp"
#include "TcrMessage.hpp"
+#include "util/synchronized_map.hpp"
namespace apache {
namespace geode {
@@ -38,6 +46,7 @@
class TcrHADistributionManager;
class ThinClientRegion;
class ThinClientPoolHADM;
+class TcrEndpoint;
class ThinClientRedundancyManager {
public:
@@ -69,19 +78,20 @@
void startPeriodicAck();
bool checkDupAndAdd(std::shared_ptr<EventId> eventid);
void netDown();
- void acquireRedundancyLock() { m_redundantEndpointsLock.acquire_read(); }
- void releaseRedundancyLock() { m_redundantEndpointsLock.release(); }
+ void acquireRedundancyLock() { m_redundantEndpointsLock.lock(); }
+ void releaseRedundancyLock() { m_redundantEndpointsLock.unlock(); }
bool allEndPointDiscon() { return m_IsAllEpDisCon; }
void removeCallbackConnection(TcrEndpoint*);
- ACE_Recursive_Thread_Mutex& getRedundancyLock() {
- return m_redundantEndpointsLock;
- }
+ std::recursive_mutex& getRedundancyLock() { return m_redundantEndpointsLock; }
GfErrType sendRequestToPrimary(TcrMessage& request, TcrMessageReply& reply);
bool isSentReadyForEvents() const { return m_sentReadyForEvents; }
private:
+ using clock = std::chrono::steady_clock;
+ using time_point = clock::time_point;
+
// for selectServers
volatile bool m_IsAllEpDisCon;
int m_server;
@@ -91,7 +101,7 @@
ThinClientPoolHADM* m_poolHADM;
std::vector<TcrEndpoint*> m_redundantEndpoints;
std::vector<TcrEndpoint*> m_nonredundantEndpoints;
- ACE_Recursive_Thread_Mutex m_redundantEndpointsLock;
+ std::recursive_mutex m_redundantEndpointsLock;
TcrConnectionManager* m_theTcrConnManager;
std::shared_ptr<CacheableStringArray> m_locators;
std::shared_ptr<CacheableStringArray> m_servers;
@@ -110,6 +120,10 @@
void moveEndpointToLast(std::vector<TcrEndpoint*>& epVector,
TcrEndpoint* targetEp);
+ synchronized_map<std::unordered_map<std::string, TcrEndpoint*>,
+ std::recursive_mutex>&
+ updateAndSelectEndpoints();
+
void getAllEndpoints(std::vector<TcrEndpoint*>& endpoints);
// For 38196 Fix: Reorder End points.
void insertEPInQueueSizeOrder(TcrEndpoint* ep,
@@ -122,15 +136,15 @@
inline bool isDurable();
int processEventIdMap(const ACE_Time_Value&, const void*);
- Task<ThinClientRedundancyManager>* m_periodicAckTask;
+ std::unique_ptr<Task<ThinClientRedundancyManager>> m_periodicAckTask;
ACE_Semaphore m_periodicAckSema;
ExpiryTaskManager::id_type
m_processEventIdMapTaskId; // periodic check eventid map for notify ack
// and/or expiry
- int periodicAck(volatile bool& isRunning);
+ void periodicAck(std::atomic<bool>& isRunning);
void doPeriodicAck();
- ACE_Time_Value m_nextAck; // next ack time
- ACE_Time_Value m_nextAckInc; // next ack time increment
+ time_point m_nextAck; // next ack time
+ std::chrono::milliseconds m_nextAckInc; // next ack time increment
volatile bool m_HAenabled;
EventIdMap m_eventidmap;
diff --git a/cppcache/src/ThinClientRegion.cpp b/cppcache/src/ThinClientRegion.cpp
index ffe9a44..0b59f30 100644
--- a/cppcache/src/ThinClientRegion.cpp
+++ b/cppcache/src/ThinClientRegion.cpp
@@ -34,6 +34,7 @@
#include "ReadWriteLock.hpp"
#include "RegionGlobalLocks.hpp"
#include "RemoteQuery.hpp"
+#include "TcrConnectionManager.hpp"
#include "TcrDistributionManager.hpp"
#include "TcrEndpoint.hpp"
#include "ThinClientBaseDM.hpp"
@@ -51,7 +52,7 @@
static const std::regex PREDICATE_IS_FULL_QUERY_REGEX(
"^\\s*(?:select|import)\\b", std::regex::icase);
-void setTSSExceptionMessage(const char* exMsg);
+void setThreadLocalExceptionMessage(const char* exMsg);
class PutAllWork : public PooledWork<GfErrType>,
private NonCopyable,
@@ -102,13 +103,12 @@
m_reply = new TcrMessageReply(true, m_poolDM);
// create new instanceof VCOPL
- ACE_Recursive_Thread_Mutex responseLock;
+ std::recursive_mutex responseLock;
m_verObjPartListPtr = std::make_shared<VersionedCacheableObjectPartList>(
keys.get(), responseLock);
if (m_poolDM->isMultiUserMode()) {
- m_userAttribute = TSSUserAttributesWrapper::s_geodeTSSUserAttributes
- ->getUserAttributes();
+ m_userAttribute = UserAttributes::threadLocalUserAttributes;
}
m_request->setTimeout(m_timeout);
@@ -245,13 +245,12 @@
*keys, m_aCallbackArgument, m_poolDM);
m_reply = new TcrMessageReply(true, m_poolDM);
// create new instanceof VCOPL
- ACE_Recursive_Thread_Mutex responseLock;
+ std::recursive_mutex responseLock;
m_verObjPartListPtr = std::make_shared<VersionedCacheableObjectPartList>(
keys.get(), responseLock);
if (m_poolDM->isMultiUserMode()) {
- m_userAttribute = TSSUserAttributesWrapper::s_geodeTSSUserAttributes
- ->getUserAttributes();
+ m_userAttribute = UserAttributes::threadLocalUserAttributes;
}
m_resultCollector = new ChunkedRemoveAllResponse(
@@ -349,7 +348,6 @@
: LocalRegion(name, cacheImpl, rPtr, attributes, stats, shared),
m_tcrdm(nullptr),
m_notifyRelease(false),
- m_notificationSema(1),
m_isMetaDataRefreshed(false) {
m_transactionEnabled = true;
m_isDurableClnt = !cacheImpl->getDistributedSystem()
@@ -359,25 +357,6 @@
}
void ThinClientRegion::initTCR() {
- bool subscription = false;
- auto pool = m_cacheImpl->getPoolManager().find(getAttributes().getPoolName());
- if (pool != nullptr) {
- subscription = pool->getSubscriptionEnabled();
- }
- bool notificationEnabled =
- getAttributes().getClientNotificationEnabled() || subscription;
- if (notificationEnabled) {
- if (m_cacheImpl->getDistributedSystem()
- .getSystemProperties()
- .isGridClient()) {
- LOGWARN(
- "Region %s: client subscription channel enabled for a grid "
- "client; starting required internal subscription, cleanup and "
- "failover threads",
- m_fullPath.c_str());
- m_cacheImpl->tcrConnectionManager().startFailoverAndCleanupThreads();
- }
- }
try {
m_tcrdm =
new TcrDistributionManager(this, m_cacheImpl->tcrConnectionManager());
@@ -1234,7 +1213,7 @@
aCallbackArgument); // now we need to initialize later
TcrMessageReply reply(true, m_tcrdm);
- ACE_Recursive_Thread_Mutex responseLock;
+ std::recursive_mutex responseLock;
// need to check
TcrChunkedResult* resultCollector(new ChunkedGetAllResponse(
reply, this, keys, values, exceptions, resultKeys, updateCountMap,
@@ -1339,9 +1318,8 @@
* method.
* e. insert the worker into the vector.
*/
- std::vector<PutAllWork*> putAllWorkers;
- auto threadPool =
- CacheRegionHelper::getCacheImpl(&getCache())->getThreadPool();
+ std::vector<std::shared_ptr<PutAllWork>> putAllWorkers;
+ auto& threadPool = m_cacheImpl->getThreadPool();
int locationMapIndex = 0;
for (const auto& locationIter : *locationMap) {
const auto& serverLocation = locationIter.first;
@@ -1361,10 +1339,10 @@
}
}
- auto worker = new PutAllWork(tcrdm, serverLocation, region,
- true /*attemptFailover*/, false /*isBGThread*/,
- filteredMap, keys, timeout, aCallbackArgument);
- threadPool->perform(worker);
+ auto worker = std::make_shared<PutAllWork>(
+ tcrdm, serverLocation, region, true /*attemptFailover*/,
+ false /*isBGThread*/, filteredMap, keys, timeout, aCallbackArgument);
+ threadPool.perform(worker);
putAllWorkers.push_back(worker);
locationMapIndex++;
}
@@ -1428,7 +1406,6 @@
}
*/
- delete worker;
cnt++;
}
/**
@@ -1439,7 +1416,7 @@
* versions. C. ToDO:: what if the value in the resultMap is of type
* PutAllPartialResultServerException
*/
- ACE_Recursive_Thread_Mutex responseLock;
+ std::recursive_mutex responseLock;
auto result = std::make_shared<PutAllPartialResult>(
static_cast<int>(map.size()), responseLock);
LOGDEBUG(
@@ -1608,7 +1585,7 @@
request.setTimeout(timeout);
reply.setTimeout(timeout);
- ACE_Recursive_Thread_Mutex responseLock;
+ std::recursive_mutex responseLock;
versionedObjPartList =
std::make_shared<VersionedCacheableObjectPartList>(this, responseLock);
// need to check
@@ -1665,7 +1642,7 @@
LOGDEBUG("ThinClientRegion::putAllNoThrow_remote");
auto poolDM = dynamic_cast<ThinClientPoolDM*>(m_tcrdm);
- auto txState = TSSTXStateWrapper::s_geodeTSSTXState->getTXState();
+ auto txState = TSSTXStateWrapper::get().getTXState();
if (poolDM != nullptr) {
if (poolDM->getPRSingleHopEnabled() &&
@@ -1719,9 +1696,8 @@
* method.
* e. insert the worker into the vector.
*/
- std::vector<RemoveAllWork*> removeAllWorkers;
- auto* threadPool =
- CacheRegionHelper::getCacheImpl(&getCache())->getThreadPool();
+ std::vector<std::shared_ptr<RemoveAllWork>> removeAllWorkers;
+ auto& threadPool = m_cacheImpl->getThreadPool();
int locationMapIndex = 0;
for (const auto& locationIter : *locationMap) {
const auto& serverLocation = locationIter.first;
@@ -1729,10 +1705,10 @@
LOGDEBUG("serverLocation is nullptr");
}
const auto& mappedkeys = locationIter.second;
- auto worker = new RemoveAllWork(
+ auto worker = std::make_shared<RemoveAllWork>(
tcrdm, serverLocation, region, true /*attemptFailover*/,
false /*isBGThread*/, mappedkeys, aCallbackArgument);
- threadPool->perform(worker);
+ threadPool.perform(worker);
removeAllWorkers.push_back(worker);
locationMapIndex++;
}
@@ -1783,7 +1759,6 @@
"worker->getResultCollector()->getList()->getVersionedTagsize() = %d ",
worker->getResultCollector()->getList()->getVersionedTagsize());
- delete worker;
cnt++;
}
/**
@@ -1794,7 +1769,7 @@
* versions. C. ToDO:: what if the value in the resultMap is of type
* PutAllPartialResultServerException
*/
- ACE_Recursive_Thread_Mutex responseLock;
+ std::recursive_mutex responseLock;
auto result = std::make_shared<PutAllPartialResult>(
static_cast<int>(keys.size()), responseLock);
LOGDEBUG(
@@ -1943,7 +1918,7 @@
this, keys, aCallbackArgument, m_tcrdm);
TcrMessageReply reply(true, m_tcrdm);
- ACE_Recursive_Thread_Mutex responseLock;
+ std::recursive_mutex responseLock;
versionedObjPartList =
std::make_shared<VersionedCacheableObjectPartList>(this, responseLock);
// need to check
@@ -1992,7 +1967,7 @@
LOGDEBUG("ThinClientRegion::removeAllNoThrow_remote");
ThinClientPoolDM* poolDM = dynamic_cast<ThinClientPoolDM*>(m_tcrdm);
- TXState* txState = TSSTXStateWrapper::s_geodeTSSTXState->getTXState();
+ auto txState = TSSTXStateWrapper::get().getTXState();
if (poolDM != nullptr) {
if (poolDM->getPRSingleHopEnabled() &&
@@ -2261,7 +2236,7 @@
CHECK_DESTROY_PENDING_NOTHROW(TryReadGuard);
GfErrType err = GF_NOERR;
- ACE_Guard<ACE_Recursive_Thread_Mutex> keysGuard(m_keysLock);
+ std::lock_guard<decltype(m_keysLock)> keysGuard(m_keysLock);
if (keys.empty()) {
return err;
}
@@ -2281,7 +2256,7 @@
new DataOutput(m_cacheImpl->createDataOutput()), this, keys, isDurable,
getAttributes().getCachingEnabled(), receiveValues, interestPolicy,
m_tcrdm);
- ACE_Recursive_Thread_Mutex responseLock;
+ std::recursive_mutex responseLock;
TcrChunkedResult* resultCollector = nullptr;
if (interestPolicy.ordinal == InterestResultPolicy::KEYS_VALUES.ordinal) {
auto values = std::make_shared<HashMapOfCacheable>();
@@ -2332,7 +2307,7 @@
RegionGlobalLocks acquireLocksFailover(this);
CHECK_DESTROY_PENDING_NOTHROW(TryReadGuard);
GfErrType err = GF_NOERR;
- ACE_Guard<ACE_Recursive_Thread_Mutex> keysGuard(m_keysLock);
+ std::lock_guard<decltype(m_keysLock)> keysGuard(m_keysLock);
TcrMessageReply reply(true, m_tcrdm);
if (keys.empty()) {
return err;
@@ -2368,7 +2343,7 @@
RegionGlobalLocks acquireLocksRedundancy(this, false);
RegionGlobalLocks acquireLocksFailover(this);
GfErrType err = GF_NOERR;
- ACE_Guard<ACE_Recursive_Thread_Mutex> keysGuard(m_keysLock);
+ std::lock_guard<decltype(m_keysLock)> keysGuard(m_keysLock);
TcrMessageReply reply(true, m_tcrdm);
if (keys.empty()) {
return err;
@@ -2420,7 +2395,7 @@
GfErrType err = GF_NOERR;
bool allKeys = (regex == ".*");
- ACE_Guard<ACE_Recursive_Thread_Mutex> keysGuard(m_keysLock);
+ std::lock_guard<decltype(m_keysLock)> keysGuard(m_keysLock);
if (attemptFailover) {
if ((isDurable &&
@@ -2459,7 +2434,7 @@
new DataOutput(m_cacheImpl->createDataOutput()), m_fullPath,
regex.c_str(), interestPolicy, isDurable,
getAttributes().getCachingEnabled(), receiveValues, m_tcrdm);
- ACE_Recursive_Thread_Mutex responseLock;
+ std::recursive_mutex responseLock;
if (reply == nullptr) {
TcrMessageReply replyLocal(true, m_tcrdm);
auto values = std::make_shared<HashMapOfCacheable>();
@@ -2551,7 +2526,7 @@
GfErrType ThinClientRegion::findRegex(const std::string& regex) {
GfErrType err = GF_NOERR;
- ACE_Guard<ACE_Recursive_Thread_Mutex> keysGuard(m_keysLock);
+ std::lock_guard<decltype(m_keysLock)> keysGuard(m_keysLock);
if (m_interestListRegex.find(regex) == m_interestListRegex.end() &&
m_durableInterestListRegex.find(regex) ==
@@ -2567,7 +2542,7 @@
}
void ThinClientRegion::clearRegex(const std::string& regex) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> keysGuard(m_keysLock);
+ std::lock_guard<decltype(m_keysLock)> keysGuard(m_keysLock);
m_interestListRegex.erase(regex);
m_durableInterestListRegex.erase(regex);
m_interestListRegexForUpdatesAsInvalidates.erase(regex);
@@ -2642,11 +2617,11 @@
std::vector<std::shared_ptr<CacheableKey>> ThinClientRegion::getInterestList()
const {
- ThinClientRegion* nthis = const_cast<ThinClientRegion*>(this);
+ auto nthis = const_cast<ThinClientRegion*>(this);
RegionGlobalLocks acquireLocksRedundancy(nthis, false);
RegionGlobalLocks acquireLocksFailover(nthis);
CHECK_DESTROY_PENDING(TryReadGuard, getInterestList);
- ACE_Guard<ACE_Recursive_Thread_Mutex> keysGuard(nthis->m_keysLock);
+ std::lock_guard<decltype(m_keysLock)> keysGuard(nthis->m_keysLock);
std::vector<std::shared_ptr<CacheableKey>> vlist;
@@ -2665,11 +2640,11 @@
}
std::vector<std::shared_ptr<CacheableString>>
ThinClientRegion::getInterestListRegex() const {
- ThinClientRegion* nthis = const_cast<ThinClientRegion*>(this);
+ auto nthis = const_cast<ThinClientRegion*>(this);
RegionGlobalLocks acquireLocksRedundancy(nthis, false);
RegionGlobalLocks acquireLocksFailover(nthis);
CHECK_DESTROY_PENDING(TryReadGuard, getInterestListRegex);
- ACE_Guard<ACE_Recursive_Thread_Mutex> keysGuard(nthis->m_keysLock);
+ std::lock_guard<decltype(m_keysLock)> keysGuard(nthis->m_keysLock);
std::vector<std::shared_ptr<CacheableString>> vlist;
@@ -2769,7 +2744,7 @@
GfErrType ThinClientRegion::handleServerException(const char* func,
const char* exceptionMsg) {
GfErrType error = GF_NOERR;
- setTSSExceptionMessage(exceptionMsg);
+ setThreadLocalExceptionMessage(exceptionMsg);
if (strstr(exceptionMsg,
"org.apache.geode.security.NotAuthorizedException") != nullptr) {
error = GF_NOT_AUTHORIZED_EXCEPTION;
@@ -2818,6 +2793,7 @@
}
void ThinClientRegion::receiveNotification(TcrMessage* msg) {
+ std::unique_lock<std::mutex> lock(m_notificationMutex, std::defer_lock);
{
TryReadGuard guard(m_rwLock, m_destroyPending);
if (m_destroyPending) {
@@ -2826,7 +2802,7 @@
}
return;
}
- m_notificationSema.acquire();
+ lock.lock();
}
if (msg->getMessageType() == TcrMessage::CLIENT_MARKER) {
@@ -2835,7 +2811,7 @@
clientNotificationHandler(*msg);
}
- m_notificationSema.release();
+ lock.unlock();
if (TcrMessage::getAllEPDisMess() != msg) _GEODE_SAFE_DELETE(msg);
}
@@ -2938,8 +2914,10 @@
if (m_released) {
return;
}
+
+ std::unique_lock<std::mutex> lock(m_notificationMutex, std::defer_lock);
if (!m_notifyRelease) {
- m_notificationSema.acquire();
+ lock.lock();
}
destroyDM(invokeCallbacks);
@@ -3165,11 +3143,10 @@
std::shared_ptr<CacheableHashSet>& failedNodes,
std::chrono::milliseconds timeout, bool allBuckets) {
bool reExecute = false;
- auto resultCollectorLock = std::make_shared<ACE_Recursive_Thread_Mutex>();
- const auto& userAttr =
- TSSUserAttributesWrapper::s_geodeTSSUserAttributes->getUserAttributes();
+ auto resultCollectorLock = std::make_shared<std::recursive_mutex>();
+ const auto& userAttr = UserAttributes::threadLocalUserAttributes;
std::vector<std::shared_ptr<OnRegionFunctionExecution>> feWorkers;
- auto* threadPool =
+ auto& threadPool =
CacheRegionHelper::getCacheImpl(&getCache())->getThreadPool();
for (const auto& locationIter : *locationMap) {
@@ -3179,14 +3156,13 @@
func, this, args, routingObj, getResult, timeout,
dynamic_cast<ThinClientPoolDM*>(m_tcrdm), resultCollectorLock, rc,
userAttr, false, serverLocation, allBuckets);
- threadPool->perform(worker.get());
+ threadPool.perform(worker);
feWorkers.push_back(worker);
}
GfErrType abortError = GF_NOERR;
- for (auto iter = std::begin(feWorkers); iter != std::end(feWorkers);) {
- auto worker = *iter;
+ for (auto worker : feWorkers) {
auto err = worker->getResult();
auto currentReply = worker->getReply();
@@ -3209,7 +3185,8 @@
}
worker->getResultCollector()->reset();
{
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(*resultCollectorLock);
+ std::lock_guard<decltype(*resultCollectorLock)> guard(
+ *resultCollectorLock);
rc->clearResults();
}
std::shared_ptr<CacheableHashSet> failedNodeIds(
@@ -3235,7 +3212,8 @@
}
worker->getResultCollector()->reset();
{
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(*resultCollectorLock);
+ std::lock_guard<decltype(*resultCollectorLock)> guard(
+ *resultCollectorLock);
rc->clearResults();
}
} else {
@@ -3250,8 +3228,6 @@
}
}
}
-
- iter = feWorkers.erase(iter);
}
if (abortError != GF_NOERR) {
@@ -3283,10 +3259,15 @@
reply.getException());
break;
}
+ case TcrMessage::REQUEST_DATA_ERROR: {
+ LOGERROR("Error message from server: " + reply.getValue()->toString());
+ throw FunctionExecutionException(reply.getValue()->toString());
+ }
default: {
LOGERROR("Unknown message type %d while getting function attributes.",
reply.getMessageType());
err = GF_MSG;
+ break;
}
}
return err;
@@ -3712,7 +3693,8 @@
result = value;
}
if (m_resultCollectorLock) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(*m_resultCollectorLock);
+ std::lock_guard<decltype(*m_resultCollectorLock)> guard(
+ *m_resultCollectorLock);
m_rc->addResult(result);
} else {
m_rc->addResult(result);
@@ -3806,7 +3788,7 @@
if (chunkType == TcrMessageHelper::ChunkObjectType::OBJECT) {
LOGDEBUG("ChunkedPutAllResponse::handleChunk object");
- ACE_Recursive_Thread_Mutex responseLock;
+ std::recursive_mutex responseLock;
auto vcObjPart = std::make_shared<VersionedCacheableObjectPartList>(
dynamic_cast<ThinClientRegion*>(m_region.get()),
m_msg.getChunkedResultHandler()->getEndpointMemId(), responseLock);
@@ -3864,7 +3846,7 @@
if (chunkType == TcrMessageHelper::ChunkObjectType::OBJECT) {
LOGDEBUG("ChunkedRemoveAllResponse::handleChunk object");
- ACE_Recursive_Thread_Mutex responseLock;
+ std::recursive_mutex responseLock;
auto vcObjPart = std::make_shared<VersionedCacheableObjectPartList>(
dynamic_cast<ThinClientRegion*>(m_region.get()),
m_msg.getChunkedResultHandler()->getEndpointMemId(), responseLock);
@@ -3912,7 +3894,7 @@
if (!input.readBoolean()) {
// we're currently always expecting an object
char exMsg[256];
- ACE_OS::snprintf(
+ std::snprintf(
exMsg, 255,
"ChunkedDurableCQListResponse::handleChunk: part is not object");
throw MessageException(exMsg);
diff --git a/cppcache/src/ThinClientRegion.hpp b/cppcache/src/ThinClientRegion.hpp
index b039ee5..a7ec893 100644
--- a/cppcache/src/ThinClientRegion.hpp
+++ b/cppcache/src/ThinClientRegion.hpp
@@ -20,8 +20,10 @@
#ifndef GEODE_THINCLIENTREGION_H_
#define GEODE_THINCLIENTREGION_H_
+#include <mutex>
#include <unordered_map>
+#include <ace/RW_Thread_Mutex.h>
#include <ace/Task.h>
#include <geode/ResultCollector.hpp>
@@ -33,17 +35,14 @@
#include "Queue.hpp"
#include "RegionGlobalLocks.hpp"
#include "TcrChunkedContext.hpp"
-#include "TcrEndpoint.hpp"
#include "TcrMessage.hpp"
-/**
- * @file
- */
namespace apache {
namespace geode {
namespace client {
class ThinClientBaseDM;
+class TcrEndpoint;
/**
* @class ThinClientRegion ThinClientRegion.hpp
@@ -52,7 +51,6 @@
* region. It will inherit from DistributedRegion and overload some methods
*
*/
-
class APACHE_GEODE_EXPORT ThinClientRegion : public LocalRegion {
public:
/**
@@ -285,7 +283,7 @@
bool isDurableClient() { return m_isDurableClnt; }
/** @brief Protected fields. */
ThinClientBaseDM* m_tcrdm;
- ACE_Recursive_Thread_Mutex m_keysLock;
+ std::recursive_mutex m_keysLock;
mutable ACE_RW_Thread_Mutex m_rwDestroyLock;
std::unordered_map<std::shared_ptr<CacheableKey>, InterestResultPolicy>
m_interestList;
@@ -304,7 +302,7 @@
m_durableInterestListRegexForUpdatesAsInvalidates;
bool m_notifyRelease;
- ACE_Semaphore m_notificationSema;
+ std::mutex m_notificationMutex;
bool m_isDurableClnt;
@@ -470,7 +468,7 @@
// std::shared_ptr<CacheableVector> m_functionExecutionResults;
bool m_getResult;
std::shared_ptr<ResultCollector> m_rc;
- std::shared_ptr<ACE_Recursive_Thread_Mutex> m_resultCollectorLock;
+ std::shared_ptr<std::recursive_mutex> m_resultCollectorLock;
// disabled
ChunkedFunctionExecutionResponse(const ChunkedFunctionExecutionResponse&);
@@ -484,7 +482,7 @@
inline ChunkedFunctionExecutionResponse(
TcrMessage& msg, bool getResult, std::shared_ptr<ResultCollector> rc,
- const std::shared_ptr<ACE_Recursive_Thread_Mutex>& resultCollectorLock)
+ const std::shared_ptr<std::recursive_mutex>& resultCollectorLock)
: TcrChunkedResult(),
m_msg(msg),
m_getResult(getResult),
@@ -526,7 +524,7 @@
int32_t m_destroyTracker;
bool m_addToLocalCache;
uint32_t m_keysOffset;
- ACE_Recursive_Thread_Mutex& m_responseLock;
+ std::recursive_mutex& m_responseLock;
// disabled
ChunkedGetAllResponse(const ChunkedGetAllResponse&);
ChunkedGetAllResponse& operator=(const ChunkedGetAllResponse&);
@@ -540,7 +538,7 @@
const std::shared_ptr<std::vector<std::shared_ptr<CacheableKey>>>&
resultKeys,
MapOfUpdateCounters& trackerMap, int32_t destroyTracker,
- bool addToLocalCache, ACE_Recursive_Thread_Mutex& responseLock)
+ bool addToLocalCache, std::recursive_mutex& responseLock)
: TcrChunkedResult(),
m_msg(msg),
m_region(region),
@@ -567,7 +565,7 @@
return m_resultKeys;
}
MapOfUpdateCounters& getUpdateCounters() { return m_trackerMap; }
- ACE_Recursive_Thread_Mutex& getResponseLock() { return m_responseLock; }
+ std::recursive_mutex& getResponseLock() { return m_responseLock; }
};
/**
@@ -577,7 +575,7 @@
private:
TcrMessage& m_msg;
const std::shared_ptr<Region> m_region;
- ACE_Recursive_Thread_Mutex& m_responseLock;
+ std::recursive_mutex& m_responseLock;
std::shared_ptr<VersionedCacheableObjectPartList> m_list;
// disabled
ChunkedPutAllResponse(const ChunkedPutAllResponse&);
@@ -586,7 +584,7 @@
public:
inline ChunkedPutAllResponse(
const std::shared_ptr<Region>& region, TcrMessage& msg,
- ACE_Recursive_Thread_Mutex& responseLock,
+ std::recursive_mutex& responseLock,
std::shared_ptr<VersionedCacheableObjectPartList>& list)
: TcrChunkedResult(),
m_msg(msg),
@@ -599,7 +597,7 @@
const CacheImpl* cacheImpl);
virtual void reset();
std::shared_ptr<VersionedCacheableObjectPartList> getList() { return m_list; }
- ACE_Recursive_Thread_Mutex& getResponseLock() { return m_responseLock; }
+ std::recursive_mutex& getResponseLock() { return m_responseLock; }
};
/**
@@ -609,7 +607,7 @@
private:
TcrMessage& m_msg;
const std::shared_ptr<Region> m_region;
- ACE_Recursive_Thread_Mutex& m_responseLock;
+ std::recursive_mutex& m_responseLock;
std::shared_ptr<VersionedCacheableObjectPartList> m_list;
// disabled
ChunkedRemoveAllResponse(const ChunkedRemoveAllResponse&);
@@ -618,7 +616,7 @@
public:
inline ChunkedRemoveAllResponse(
const std::shared_ptr<Region>& region, TcrMessage& msg,
- ACE_Recursive_Thread_Mutex& responseLock,
+ std::recursive_mutex& responseLock,
std::shared_ptr<VersionedCacheableObjectPartList>& list)
: TcrChunkedResult(),
m_msg(msg),
@@ -631,7 +629,7 @@
const CacheImpl* cacheImpl);
virtual void reset();
std::shared_ptr<VersionedCacheableObjectPartList> getList() { return m_list; }
- ACE_Recursive_Thread_Mutex& getResponseLock() { return m_responseLock; }
+ std::recursive_mutex& getResponseLock() { return m_responseLock; }
};
/**
diff --git a/cppcache/src/ThinClientStickyManager.cpp b/cppcache/src/ThinClientStickyManager.cpp
index debc020..8474641 100644
--- a/cppcache/src/ThinClientStickyManager.cpp
+++ b/cppcache/src/ThinClientStickyManager.cpp
@@ -25,7 +25,6 @@
std::set<ServerLocation>& excludeServers, bool forTransaction) {
bool maxConnLimit = false;
bool connFound = false;
- // ACE_Guard<ACE_Recursive_Thread_Mutex> guard( m_stickyLock );
conn = (*TssConnectionWrapper::s_geodeTSSConn)->getConnection();
if (!conn) {
@@ -58,7 +57,7 @@
}
void ThinClientStickyManager::addStickyConnection(TcrConnection* conn) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_stickyLock);
+ std::lock_guard<decltype(m_stickyLock)> keysGuard(m_stickyLock);
TcrConnection* oldConn =
(*TssConnectionWrapper::s_geodeTSSConn)->getConnection();
if (oldConn) {
@@ -86,9 +85,8 @@
void ThinClientStickyManager::setStickyConnection(TcrConnection* conn,
bool forTransaction) {
- // ACE_Guard<ACE_Recursive_Thread_Mutex> guard( m_stickyLock );
if (!conn) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_stickyLock);
+ std::lock_guard<decltype(m_stickyLock)> keysGuard(m_stickyLock);
(*TssConnectionWrapper::s_geodeTSSConn)
->setConnection(nullptr, m_dm->shared_from_this());
} else {
@@ -96,7 +94,7 @@
(*TssConnectionWrapper::s_geodeTSSConn)->getConnection();
if (currentConn != conn) // otherwsie no need to set it again
{
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_stickyLock);
+ std::lock_guard<decltype(m_stickyLock)> keysGuard(m_stickyLock);
(*TssConnectionWrapper::s_geodeTSSConn)
->setConnection(conn, m_dm->shared_from_this());
conn->setAndGetBeingUsed(
@@ -120,7 +118,7 @@
void ThinClientStickyManager::cleanStaleStickyConnection() {
LOGDEBUG("Cleaning sticky connections");
std::set<ServerLocation> excludeServers;
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_stickyLock);
+ std::lock_guard<decltype(m_stickyLock)> keysGuard(m_stickyLock);
std::find_if(m_stickyConnList.begin(), m_stickyConnList.end(),
ThinClientStickyManager::isNULL);
while (1) {
@@ -159,7 +157,7 @@
void ThinClientStickyManager::closeAllStickyConnections() {
LOGDEBUG("ThinClientStickyManager::closeAllStickyConnections()");
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_stickyLock);
+ std::lock_guard<decltype(m_stickyLock)> keysGuard(m_stickyLock);
for (std::set<TcrConnection**>::iterator it = m_stickyConnList.begin();
it != m_stickyConnList.end(); it++) {
TcrConnection** tempConn = *it;
@@ -173,10 +171,10 @@
bool ThinClientStickyManager::canThisConnBeDeleted(TcrConnection* conn) {
bool canBeDeleted = false;
LOGDEBUG("ThinClientStickyManager::canThisConnBeDeleted()");
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_stickyLock);
+ std::lock_guard<decltype(m_stickyLock)> keysGuard(m_stickyLock);
if (m_dm->canItBeDeletedNoImpl(conn)) return true;
TcrEndpoint* endPt = conn->getEndpointObject();
- ACE_Guard<ACE_Recursive_Thread_Mutex> guardQueue(
+ std::lock_guard<decltype(endPt->getQueueHostedMutex())> guardQueue(
endPt->getQueueHostedMutex());
if (endPt->isQueueHosted()) {
for (std::set<TcrConnection**>::iterator it = m_stickyConnList.begin();
@@ -194,7 +192,7 @@
TcrConnection* conn =
(*TssConnectionWrapper::s_geodeTSSConn)->getConnection();
if (conn) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_stickyLock);
+ std::lock_guard<decltype(m_stickyLock)> keysGuard(m_stickyLock);
std::set<TcrConnection**>::iterator it = m_stickyConnList.find(
(*TssConnectionWrapper::s_geodeTSSConn)->getConnDoublePtr());
LOGDEBUG("ThinClientStickyManager::releaseThreadLocalConnection()");
diff --git a/cppcache/src/ThinClientStickyManager.hpp b/cppcache/src/ThinClientStickyManager.hpp
index cd25998..dbb2fa7 100644
--- a/cppcache/src/ThinClientStickyManager.hpp
+++ b/cppcache/src/ThinClientStickyManager.hpp
@@ -21,19 +21,22 @@
*/
#include <algorithm>
+#include <mutex>
#include <set>
#include <vector>
-#include <ace/Recursive_Thread_Mutex.h>
-
+#include "ErrType.hpp"
#include "TssConnectionWrapper.hpp"
+
namespace apache {
namespace geode {
namespace client {
+
class ThinClientPoolDM;
class ServerLocation;
class TcrConnection;
class TcrEndpoint;
+
class ThinClientStickyManager {
public:
explicit ThinClientStickyManager(ThinClientPoolDM* poolDM) : m_dm(poolDM) {}
@@ -56,8 +59,9 @@
static bool isNULL(TcrConnection** conn);
ThinClientPoolDM* m_dm;
std::set<TcrConnection**> m_stickyConnList;
- ACE_Recursive_Thread_Mutex m_stickyLock;
+ std::recursive_mutex m_stickyLock;
};
+
} // namespace client
} // namespace geode
} // namespace apache
diff --git a/cppcache/src/ThreadPool.cpp b/cppcache/src/ThreadPool.cpp
index 2e21142..f9212d9 100644
--- a/cppcache/src/ThreadPool.cpp
+++ b/cppcache/src/ThreadPool.cpp
@@ -17,136 +17,79 @@
#include "ThreadPool.hpp"
-#include <geode/SystemProperties.hpp>
-
-#include "CacheImpl.hpp"
-#include "DistributedSystem.hpp"
#include "DistributedSystemImpl.hpp"
namespace apache {
namespace geode {
namespace client {
-ThreadPoolWorker::ThreadPoolWorker(IThreadPool* manager)
- : manager_(manager), queue_(msg_queue()), shutdown_(0) {
-#if defined(_MACOSX)
- threadId_ = nullptr;
-#else
- threadId_ = 0;
-#endif
-}
+const char* ThreadPool::NC_Pool_Thread = "NC Pool Thread";
-ThreadPoolWorker::~ThreadPoolWorker() { shutDown(); }
+ThreadPool::ThreadPool(size_t threadPoolSize)
+ : shutdown_(false), appDomainContext_(createAppDomainContext()) {
+ workers_.reserve(threadPoolSize);
-int ThreadPoolWorker::perform(ACE_Method_Request* req) {
- ACE_TRACE(ACE_TEXT("Worker::perform"));
- return this->queue_.enqueue(req);
-}
+ std::function<void()> executeWork = [this] {
+ DistributedSystemImpl::setThreadName(NC_Pool_Thread);
+ while (true) {
+ std::unique_lock<decltype(queueMutex_)> lock(queueMutex_);
+ queueCondition_.wait(lock,
+ [this] { return shutdown_ || !queue_.empty(); });
-int ThreadPoolWorker::svc(void) {
- threadId_ = ACE_Thread::self();
- while (1) {
- ACE_Method_Request* request = this->queue_.dequeue();
- if (request == nullptr) {
- shutDown();
- break;
+ if (shutdown_) {
+ break;
+ }
+
+ auto work = queue_.front();
+ queue_.pop_front();
+
+ lock.unlock();
+
+ try {
+ work->call();
+ } catch (...) {
+ // ignore
+ }
}
+ };
- // Invoke the request
- request->call();
-
- // Return to work.
- this->manager_->returnToWork(this);
- }
- return 0;
-}
-
-int ThreadPoolWorker::shutDown(void) {
- if (shutdown_ != 1) {
- queue_.queue()->close();
- wait();
- shutdown_ = 1;
+ if (appDomainContext_) {
+ executeWork = [executeWork, this] { appDomainContext_->run(executeWork); };
}
- return shutdown_;
-}
-
-ACE_thread_t ThreadPoolWorker::threadId(void) { return threadId_; }
-
-ThreadPool::ThreadPool(uint32_t threadPoolSize)
- : poolSize_(threadPoolSize),
- shutdown_(0),
- workersLock_(),
- workersCond_(workersLock_) {
- activate();
+ for (size_t i = 0; i < threadPoolSize; i++) {
+ workers_.emplace_back(executeWork);
+ }
}
ThreadPool::~ThreadPool() { shutDown(); }
-int ThreadPool::perform(ACE_Method_Request* req) {
- return this->queue_.enqueue(req);
-}
-
-const char* ThreadPool::NC_Pool_Thread = "NC Pool Thread";
-int ThreadPool::svc(void) {
- DistributedSystemImpl::setThreadName(NC_Pool_Thread);
- // Create pool when you get in the first time.
- createWorkerPool();
- while (!done()) {
- // Get the next message
- ACE_Method_Request* request = this->queue_.dequeue();
- if (request == nullptr) {
- shutDown();
- break;
+void ThreadPool::perform(std::shared_ptr<Callable> req) {
+ {
+ std::lock_guard<decltype(queueMutex_)> lock(queueMutex_);
+ queue_.push_back(std::move(req));
+ if (queue_.size() > 1) {
+ return;
}
- // Choose a worker.
- ThreadPoolWorker* worker = chooseWorker();
- // Ask the worker to do the job.
- worker->perform(request);
- }
- return 0;
-}
-
-int ThreadPool::shutDown(void) {
- if (shutdown_ != 1) {
- queue_.queue()->close();
- wait();
- shutdown_ = 1;
}
- return shutdown_;
+ queueCondition_.notify_all();
}
-int ThreadPool::returnToWork(ThreadPoolWorker* worker) {
- ACE_GUARD_RETURN(ACE_Thread_Mutex, workerMon, this->workersLock_, -1);
- this->workers_.enqueue_tail(worker);
- this->workersCond_.signal();
- return 0;
-}
-
-ThreadPoolWorker* ThreadPool::chooseWorker(void) {
- ACE_GUARD_RETURN(ACE_Thread_Mutex, workerMon, this->workersLock_, nullptr);
- while (this->workers_.is_empty()) workersCond_.wait();
- ThreadPoolWorker* worker;
- this->workers_.dequeue_head(worker);
- return worker;
-}
-
-int ThreadPool::createWorkerPool(void) {
- ACE_GUARD_RETURN(ACE_Thread_Mutex, worker_mon, this->workersLock_, -1);
- for (int i = 0; i < poolSize_; i++) {
- ThreadPoolWorker* worker;
- ACE_NEW_RETURN(worker, ThreadPoolWorker(this), -1);
- this->workers_.enqueue_tail(worker);
- worker->activate();
+void ThreadPool::shutDown(void) {
+ {
+ std::lock_guard<decltype(queueMutex_)> lock(queueMutex_);
+ if (shutdown_) {
+ return;
+ }
+ shutdown_ = true;
}
- return 0;
-}
-int ThreadPool::done(void) { return (shutdown_ == 1); }
+ queueCondition_.notify_all();
-ACE_thread_t ThreadPool::threadId(ThreadPoolWorker* worker) {
- return worker->threadId();
+ for (auto& worker : workers_) {
+ worker.join();
+ }
}
} // namespace client
diff --git a/cppcache/src/ThreadPool.hpp b/cppcache/src/ThreadPool.hpp
index 77f7754..d72f12a 100644
--- a/cppcache/src/ThreadPool.hpp
+++ b/cppcache/src/ThreadPool.hpp
@@ -1,8 +1,3 @@
-#pragma once
-
-#ifndef GEODE_THREADPOOL_H_
-#define GEODE_THREADPOOL_H_
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -19,29 +14,33 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/*
- * ThreadPool.hpp
- *
- * Created on: 16-Mar-2010
- * Author: ankurs
- */
-#include <ace/Method_Request.h>
-#include <ace/Task.h>
-//#include <ace/Future.h>
+#pragma once
+
+#ifndef GEODE_THREADPOOL_H_
+#define GEODE_THREADPOOL_H_
+
+#include <atomic>
#include <condition_variable>
+#include <deque>
#include <mutex>
+#include <thread>
+#include <vector>
-#include <ace/Activation_Queue.h>
-#include <ace/Condition_T.h>
-#include <ace/Guard_T.h>
-#include <ace/Singleton.h>
+#include "AppDomainContext.hpp"
+
namespace apache {
namespace geode {
namespace client {
+class Callable {
+ public:
+ virtual ~Callable() noexcept = default;
+ virtual void call() = 0;
+};
+
template <class T>
-class PooledWork : public ACE_Method_Request {
+class PooledWork : public Callable {
private:
T m_retVal;
std::recursive_mutex m_mutex;
@@ -51,9 +50,9 @@
public:
PooledWork() : m_mutex(), m_cond(), m_done(false) {}
- virtual ~PooledWork() {}
+ ~PooledWork() override {}
- virtual int call(void) {
+ void call() override {
T res = execute();
std::lock_guard<decltype(m_mutex)> lock(m_mutex);
@@ -61,8 +60,6 @@
m_retVal = res;
m_done = true;
m_cond.notify_all();
-
- return 0;
}
T getResult(void) {
@@ -79,73 +76,25 @@
virtual T execute(void) = 0;
};
-template <typename S, typename R = int>
-class PooledWorkFP : public PooledWork<R> {
+class ThreadPool {
public:
- typedef R (S::*OPERATION)(void);
- PooledWorkFP(S* op_handler, OPERATION op)
- : op_handler_(op_handler), m_op(op) {}
- virtual ~PooledWorkFP() {}
+ explicit ThreadPool(size_t threadPoolSize);
+ ~ThreadPool();
- protected:
- virtual R execute(void) { return (this->op_handler_->*m_op)(); }
+ void perform(std::shared_ptr<Callable> req);
+
+ void shutDown(void);
private:
- S* op_handler_;
- OPERATION m_op;
-};
-
-class ThreadPoolWorker;
-
-class IThreadPool {
- public:
- virtual int returnToWork(ThreadPoolWorker* worker) = 0;
- virtual ~IThreadPool() {}
-};
-
-class ThreadPoolWorker : public ACE_Task<ACE_MT_SYNCH> {
- public:
- explicit ThreadPoolWorker(IThreadPool* manager);
- virtual ~ThreadPoolWorker();
- int perform(ACE_Method_Request* req);
- int shutDown(void);
-
- virtual int svc(void);
- ACE_thread_t threadId(void);
-
- private:
- IThreadPool* manager_;
- ACE_thread_t threadId_;
- ACE_Activation_Queue queue_;
- int shutdown_;
-};
-
-class ThreadPool : public ACE_Task_Base, IThreadPool {
- friend class ACE_Singleton<ThreadPool, ACE_Recursive_Thread_Mutex>;
-
- public:
- explicit ThreadPool(uint32_t threadPoolSize);
- virtual ~ThreadPool();
- int perform(ACE_Method_Request* req);
- int svc(void);
- int shutDown(void);
- virtual int returnToWork(ThreadPoolWorker* worker);
-
- private:
- ThreadPoolWorker* chooseWorker(void);
- int createWorkerPool(void);
- int done(void);
- ACE_thread_t threadId(ThreadPoolWorker* worker);
-
- private:
- int poolSize_;
- int shutdown_;
- ACE_Thread_Mutex workersLock_;
- ACE_Condition<ACE_Thread_Mutex> workersCond_;
- ACE_Unbounded_Queue<ThreadPoolWorker*> workers_;
- ACE_Activation_Queue queue_;
+ bool shutdown_;
+ std::vector<std::thread> workers_;
+ std::deque<std::shared_ptr<Callable>> queue_;
+ std::mutex queueMutex_;
+ std::condition_variable queueCondition_;
static const char* NC_Pool_Thread;
+ AppDomainContext* appDomainContext_;
};
+
} // namespace client
} // namespace geode
} // namespace apache
diff --git a/cppcache/src/TimeoutTimer.hpp b/cppcache/src/TimeoutTimer.hpp
deleted file mode 100644
index 0925026..0000000
--- a/cppcache/src/TimeoutTimer.hpp
+++ /dev/null
@@ -1,73 +0,0 @@
-#pragma once
-
-#ifndef GEODE_TIMEOUTTIMER_H_
-#define GEODE_TIMEOUTTIMER_H_
-
-/*
- * 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 <ace/Condition_Recursive_Thread_Mutex.h>
-#include <ace/Condition_T.h>
-#include <ace/Guard_T.h>
-#include <ace/OS_NS_sys_time.h>
-#include <ace/Time_Value.h>
-
-#include <geode/internal/geode_globals.hpp>
-
-namespace apache {
-namespace geode {
-namespace client {
-
-class APACHE_GEODE_EXPORT TimeoutTimer {
- private:
- ACE_Recursive_Thread_Mutex m_mutex;
- ACE_Condition<ACE_Recursive_Thread_Mutex> m_cond;
- volatile bool m_reset;
-
- public:
- TimeoutTimer() : m_mutex(), m_cond(m_mutex), m_reset(false) {}
-
- /**
- * Return only after seconds have passed without receiving a reset.
- */
- void untilTimeout(int seconds) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_mutex);
-
- ACE_OS::last_error(0);
- while ((ACE_OS::last_error() != ETIME) || m_reset) {
- m_reset = false;
- ACE_Time_Value stopTime = ACE_OS::gettimeofday();
- stopTime += seconds;
- ACE_OS::last_error(0);
- m_cond.wait(&stopTime);
- }
- }
-
- /**
- * Reset the timeout interval so that it restarts now.
- */
- void reset() {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_mutex);
- // m_cond.signal();
- m_reset = true;
- }
-};
-} // namespace client
-} // namespace geode
-} // namespace apache
-
-#endif // GEODE_TIMEOUTTIMER_H_
diff --git a/cppcache/src/TombstoneExpiryHandler.cpp b/cppcache/src/TombstoneExpiryHandler.cpp
index 6a7acc4..72e9f7a 100644
--- a/cppcache/src/TombstoneExpiryHandler.cpp
+++ b/cppcache/src/TombstoneExpiryHandler.cpp
@@ -14,18 +14,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
#include "TombstoneExpiryHandler.hpp"
+#include <ace/Reactor.h>
+#include <ace/Timer_Heap.h>
+#include <ace/Timer_Heap_T.h>
+#include <ace/Timer_Queue.h>
+#include <ace/Timer_Queue_Adapters.h>
+#include <ace/svc_export.h>
+
#include "CacheImpl.hpp"
#include "ExpiryTaskManager.hpp"
#include "MapEntry.hpp"
#include "RegionInternal.hpp"
-#include "ace/Reactor.h"
-#include "ace/Timer_Heap.h"
-#include "ace/Timer_Heap_T.h"
-#include "ace/Timer_Queue.h"
-#include "ace/Timer_Queue_Adapters.h"
-#include "ace/svc_export.h"
namespace apache {
namespace geode {
@@ -39,31 +41,33 @@
m_cacheImpl(cacheImpl),
m_tombstoneList(tombstoneList) {}
-int TombstoneExpiryHandler::handle_timeout(const ACE_Time_Value& current_time,
- const void*) {
+int TombstoneExpiryHandler::handle_timeout(const ACE_Time_Value&, const void*) {
std::shared_ptr<CacheableKey> key;
m_entryPtr->getEntry()->getKeyI(key);
auto creationTime = m_entryPtr->getTombstoneCreationTime();
- auto curr_time = static_cast<int64_t>(current_time.get_msec());
+ auto curr_time = TombstoneEntry::clock::now();
auto expiryTaskId = m_entryPtr->getExpiryTaskId();
- auto sec = curr_time - creationTime - m_duration.count();
+ auto sec = curr_time - creationTime - m_duration;
try {
+ using apache::geode::internal::chrono::duration::to_string;
LOGDEBUG(
"Entered entry expiry task handler for tombstone of key [%s]: "
- "%lld,%lld,%d,%lld",
- Utils::nullSafeToString(key).c_str(), curr_time, creationTime,
- m_duration.count(), sec);
- if (sec >= 0) {
+ "%s,%s,%s,%s",
+ Utils::nullSafeToString(key).c_str(),
+ to_string(curr_time.time_since_epoch()).c_str(),
+ to_string(creationTime.time_since_epoch()).c_str(),
+ to_string(m_duration).c_str(), to_string(sec).c_str());
+ if (sec >= std::chrono::seconds::zero()) {
DoTheExpirationAction(key);
} else {
// reset the task after
// (lastAccessTime + entryExpiryDuration - curr_time) in seconds
LOGDEBUG(
- "Resetting expiry task %d secs later for key "
+ "Resetting expiry task %s later for key "
"[%s]",
- -sec / 1000 + 1, Utils::nullSafeToString(key).c_str());
+ to_string(-sec).c_str(), Utils::nullSafeToString(key).c_str());
m_cacheImpl->getExpiryTaskManager().resetTask(
- m_entryPtr->getExpiryTaskId(), uint32_t(-sec / 1000 + 1));
+ m_entryPtr->getExpiryTaskId(), -sec);
return 0;
}
} catch (...) {
diff --git a/cppcache/src/TombstoneList.cpp b/cppcache/src/TombstoneList.cpp
index a3eb9c3..211d95d 100644
--- a/cppcache/src/TombstoneList.cpp
+++ b/cppcache/src/TombstoneList.cpp
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
#include "TombstoneList.hpp"
#include <unordered_map>
@@ -46,9 +47,8 @@
auto duration = m_cacheImpl->getDistributedSystem()
.getSystemProperties()
.tombstoneTimeout();
- ACE_Time_Value currTime(ACE_OS::gettimeofday());
- auto tombstoneEntryPtr = std::make_shared<TombstoneEntry>(
- nullptr, static_cast<int64_t>(currTime.get_msec()));
+
+ auto tombstoneEntryPtr = std::make_shared<TombstoneEntry>(nullptr);
*handler = new TombstoneExpiryHandler(tombstoneEntryPtr, this, duration,
m_cacheImpl);
tombstoneEntryPtr->setHandler(*handler);
@@ -61,11 +61,8 @@
TombstoneExpiryHandler* handler,
ExpiryTaskManager::id_type taskid) {
// This function is not guarded as all functions of this class are called from
- // MapSegment
- // read TombstoneTImeout from systemProperties.
- ACE_Time_Value currTime(ACE_OS::gettimeofday());
- auto tombstoneEntryPtr = std::make_shared<TombstoneEntry>(
- entry, static_cast<int64_t>(currTime.get_msec()));
+ // MapSegment read TombstoneTImeout from systemProperties.
+ auto tombstoneEntryPtr = std::make_shared<TombstoneEntry>(entry);
handler->setTombstoneEntry(tombstoneEntryPtr);
tombstoneEntryPtr->setHandler(handler);
std::shared_ptr<CacheableKey> key;
diff --git a/cppcache/src/TombstoneList.hpp b/cppcache/src/TombstoneList.hpp
index 7feed98..99b8fe2 100644
--- a/cppcache/src/TombstoneList.hpp
+++ b/cppcache/src/TombstoneList.hpp
@@ -20,13 +20,11 @@
#ifndef GEODE_TOMBSTONELIST_H_
#define GEODE_TOMBSTONELIST_H_
+#include <chrono>
#include <list>
#include <memory>
#include <unordered_map>
-#include <ace/Guard_T.h>
-#include <ace/Recursive_Thread_Mutex.h>
-
#include <geode/CacheableBuiltins.hpp>
#include <geode/internal/functional.hpp>
@@ -35,19 +33,23 @@
namespace apache {
namespace geode {
namespace client {
+
class MapSegment;
class TombstoneExpiryHandler;
+
class TombstoneEntry {
public:
- TombstoneEntry(const std::shared_ptr<MapEntryImpl>& entry,
- int64_t tombstoneCreationTime)
+ using clock = std::chrono::steady_clock;
+ using time_point = clock::time_point;
+
+ explicit TombstoneEntry(const std::shared_ptr<MapEntryImpl>& entry)
: m_entry(entry),
- m_tombstoneCreationTime(tombstoneCreationTime),
+ m_tombstoneCreationTime(TombstoneEntry::clock::now()),
m_expiryTaskId(0),
m_handler(nullptr) {}
virtual ~TombstoneEntry() {}
std::shared_ptr<MapEntryImpl> getEntry() { return m_entry; }
- int64_t getTombstoneCreationTime() { return m_tombstoneCreationTime; }
+ time_point getTombstoneCreationTime() { return m_tombstoneCreationTime; }
ExpiryTaskManager::id_type getExpiryTaskId() { return m_expiryTaskId; }
void setExpiryTaskId(ExpiryTaskManager::id_type expiryTaskId) {
m_expiryTaskId = expiryTaskId;
@@ -57,7 +59,7 @@
private:
std::shared_ptr<MapEntryImpl> m_entry;
- int64_t m_tombstoneCreationTime;
+ time_point m_tombstoneCreationTime;
ExpiryTaskManager::id_type m_expiryTaskId;
TombstoneExpiryHandler* m_handler;
};
@@ -94,11 +96,11 @@
dereference_equal_to<std::shared_ptr<CacheableKey>>>
TombstoneMap;
TombstoneMap m_tombstoneMap;
- ACE_Recursive_Thread_Mutex m_queueLock;
MapSegment* m_mapSegment;
CacheImpl* m_cacheImpl;
friend class TombstoneExpiryHandler;
};
+
} // namespace client
} // namespace geode
} // namespace apache
diff --git a/cppcache/src/TransactionSuspender.cpp b/cppcache/src/TransactionSuspender.cpp
index 3f7cd23..1319da3 100644
--- a/cppcache/src/TransactionSuspender.cpp
+++ b/cppcache/src/TransactionSuspender.cpp
@@ -14,12 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/*
- * TransactionSuspender.cpp
- *
- * Created on: 16-Feb-2011
- * Author: ankurs
- */
#include "TransactionSuspender.hpp"
@@ -30,14 +24,14 @@
namespace client {
TransactionSuspender::TransactionSuspender() {
- TSSTXStateWrapper* txStateWrapper = TSSTXStateWrapper::s_geodeTSSTXState;
- m_TXState = txStateWrapper->getTXState();
- txStateWrapper->setTXState(nullptr);
+ m_TXState = TSSTXStateWrapper::get().getTXState();
+ TSSTXStateWrapper::get().setTXState(nullptr);
}
TransactionSuspender::~TransactionSuspender() {
- TSSTXStateWrapper::s_geodeTSSTXState->setTXState(m_TXState);
+ TSSTXStateWrapper::get().setTXState(m_TXState);
}
+
} // namespace client
} // namespace geode
} // namespace apache
diff --git a/cppcache/src/TransactionSuspender.hpp b/cppcache/src/TransactionSuspender.hpp
index 0a6f2a4..cf7b436 100644
--- a/cppcache/src/TransactionSuspender.hpp
+++ b/cppcache/src/TransactionSuspender.hpp
@@ -1,8 +1,3 @@
-#pragma once
-
-#ifndef GEODE_TRANSACTIONSUSPENDER_H_
-#define GEODE_TRANSACTIONSUSPENDER_H_
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -19,12 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/*
- * TransactionSuspender.hpp
- *
- * Created on: 16-Feb-2011
- * Author: ankurs
- */
+
+#pragma once
+
+#ifndef GEODE_TRANSACTIONSUSPENDER_H_
+#define GEODE_TRANSACTIONSUSPENDER_H_
#include "TXState.hpp"
diff --git a/cppcache/src/TssConnectionWrapper.hpp b/cppcache/src/TssConnectionWrapper.hpp
index 9d1a47d..ee958b7 100644
--- a/cppcache/src/TssConnectionWrapper.hpp
+++ b/cppcache/src/TssConnectionWrapper.hpp
@@ -1,8 +1,3 @@
-#pragma once
-
-#ifndef GEODE_TSSCONNECTIONWRAPPER_H_
-#define GEODE_TSSCONNECTIONWRAPPER_H_
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -19,6 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
+#pragma once
+
+#ifndef GEODE_TSSCONNECTIONWRAPPER_H_
+#define GEODE_TSSCONNECTIONWRAPPER_H_
+
#include <map>
#include <string>
@@ -26,12 +27,13 @@
#include <geode/Pool.hpp>
-#include "TcrEndpoint.hpp"
-
namespace apache {
namespace geode {
namespace client {
+
+class TcrEndpoint;
class TcrConnection;
+
typedef std::map<std::string, TcrConnection*> EpNameVsConnection;
class PoolWrapper {
@@ -76,6 +78,7 @@
void releaseSHConnections(std::shared_ptr<Pool> p);
TcrConnection* getAnyConnection(const char* poolname);
};
+
} // namespace client
} // namespace geode
} // namespace apache
diff --git a/cppcache/src/UserAttributes.cpp b/cppcache/src/UserAttributes.cpp
index bcae70a..50b2549 100644
--- a/cppcache/src/UserAttributes.cpp
+++ b/cppcache/src/UserAttributes.cpp
@@ -34,12 +34,10 @@
bool UserAttributes::isCacheClosed() { return m_authenticatedView->isClosed(); }
UserAttributes::~UserAttributes() {
- std::map<std::string, UserConnectionAttributes*>::iterator it;
-
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_listLock);
- for (it = m_connectionAttr.begin(); it != m_connectionAttr.end(); it++) {
- UserConnectionAttributes* uca = (*it).second;
- if (uca != nullptr) {
+ std::lock_guard<decltype(m_listLock)> guard(m_listLock);
+ for (auto& it : m_connectionAttr) {
+ auto uca = it.second;
+ if (uca) {
_GEODE_SAFE_DELETE(uca);
}
}
@@ -47,19 +45,6 @@
UserConnectionAttributes* UserAttributes::getConnectionAttribute() {
LOGDEBUG("UserConnectionAttributes* getConnectionAttribute().");
- if (m_connectionAttr.size() == 0) return nullptr;
-
- // std::map<std::string, UserConnectionAttributes*>::iterator it;
-
- // ACE_Guard< ACE_Recursive_Thread_Mutex > guard( m_listLock );
- /*for( it = m_connectionAttr.begin(); it != m_connectionAttr.end(); it++ )
- {
- UserConnectionAttributes* uca = &((*it).second);
- if (uca->isAuthenticated() && uca->getEndpoint()->connected())
- return uca;
- else
- uca->setUnAuthenticated();
- }*/
return nullptr;
}
@@ -71,9 +56,9 @@
// TODO: chk before returing whether endpoint is up or not
// std::map<std::string, UserConnectionAttributes>::iterator it;
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_listLock);
- UserConnectionAttributes* uca = m_connectionAttr[endpoint->name()];
- if (uca != nullptr) {
+ std::lock_guard<decltype(m_listLock)> guard(m_listLock);
+ auto uca = m_connectionAttr[endpoint->name()];
+ if (uca) {
m_connectionAttr.erase(endpoint->name());
_GEODE_SAFE_DELETE(uca);
}
@@ -91,15 +76,7 @@
LOGDEBUG("UserConnectionAttributes* getConnectionAttribute with EP.");
if (m_connectionAttr.size() == 0) return nullptr;
- // std::map<std::string, UserConnectionAttributes>::iterator it;
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_listLock);
- /*for( it = m_connectionAttr.begin(); it != m_connectionAttr.end(); it++ )
- {
- UserConnectionAttributes* uca = &((*it).second);
- if (uca->isAuthenticated() && (uca->getEndpoint() == ep))
- return uca;
- }*/
-
+ std::lock_guard<decltype(m_listLock)> guard(m_listLock);
return m_connectionAttr[ep->name()];
}
@@ -108,9 +85,9 @@
"UserAttributes::isEndpointAuthenticated: (TcrEndpoint* ep) with EP.");
if (m_connectionAttr.size() == 0) return false;
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_listLock);
- UserConnectionAttributes* uca = m_connectionAttr[ep->name()];
- if (uca != nullptr && uca->isAuthenticated() && (uca->getEndpoint() == ep)) {
+ std::lock_guard<decltype(m_listLock)> guard(m_listLock);
+ auto uca = m_connectionAttr[ep->name()];
+ if (uca && uca->isAuthenticated() && (uca->getEndpoint() == ep)) {
return true;
}
return false;
@@ -130,8 +107,8 @@
return m_authenticatedView;
}
-ACE_TSS<TSSUserAttributesWrapper>
- TSSUserAttributesWrapper::s_geodeTSSUserAttributes;
+thread_local std::shared_ptr<UserAttributes>
+ UserAttributes::threadLocalUserAttributes;
GuardUserAttributes::GuardUserAttributes(AuthenticatedView* authenticatedView) {
setAuthenticatedView(authenticatedView);
@@ -142,8 +119,8 @@
m_authenticatedView = authenticatedView;
LOGDEBUG("GuardUserAttributes::GuardUserAttributes:");
if (m_authenticatedView != nullptr && !authenticatedView->isClosed()) {
- TSSUserAttributesWrapper::s_geodeTSSUserAttributes->setUserAttributes(
- authenticatedView->m_userAttributes);
+ UserAttributes::threadLocalUserAttributes =
+ authenticatedView->m_userAttributes;
} else {
throw CacheClosedException("User Cache has been closed");
}
@@ -153,8 +130,7 @@
GuardUserAttributes::~GuardUserAttributes() {
if (m_authenticatedView != nullptr) {
- TSSUserAttributesWrapper::s_geodeTSSUserAttributes->setUserAttributes(
- nullptr);
+ UserAttributes::threadLocalUserAttributes = nullptr;
}
}
diff --git a/cppcache/src/UserAttributes.hpp b/cppcache/src/UserAttributes.hpp
index da03bda..a75bd43 100644
--- a/cppcache/src/UserAttributes.hpp
+++ b/cppcache/src/UserAttributes.hpp
@@ -21,10 +21,9 @@
#define GEODE_USERATTRIBUTES_H_
#include <map>
+#include <mutex>
#include <string>
-#include <ace/TSS_T.h>
-
#include <geode/Properties.hpp>
#include <geode/internal/geode_globals.hpp>
@@ -33,8 +32,10 @@
namespace apache {
namespace geode {
namespace client {
+
class AuthenticatedView;
class ThinClientPoolDM;
+
class UserConnectionAttributes {
public:
UserConnectionAttributes(TcrEndpoint* endpoint, uint64_t id) {
@@ -71,7 +72,7 @@
// UserConnectionAttributes & operator =(const UserConnectionAttributes &);
};
-class APACHE_GEODE_EXPORT UserAttributes {
+class UserAttributes {
// TODO: need to add lock here so that user should not be authenticated at two
// servers
public:
@@ -88,11 +89,9 @@
void setConnectionAttributes(TcrEndpoint* endpoint, uint64_t id) {
m_isUserAuthenticated = true;
- UserConnectionAttributes* ucb = new UserConnectionAttributes(endpoint, id);
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_listLock);
- // m_connectionAttr.push_back(ucb);
- std::string fullName(endpoint->name().c_str());
- m_connectionAttr[fullName] = ucb;
+ auto ucb = new UserConnectionAttributes(endpoint, id);
+ std::lock_guard<decltype(m_listLock)> guard(m_listLock);
+ m_connectionAttr[endpoint->name()] = ucb;
}
void unAuthenticateEP(TcrEndpoint* endpoint);
@@ -109,11 +108,12 @@
bool isEndpointAuthenticated(TcrEndpoint* ep);
+ static thread_local std::shared_ptr<UserAttributes> threadLocalUserAttributes;
+
private:
std::map<std::string, UserConnectionAttributes*> m_connectionAttr;
std::shared_ptr<Properties> m_credentials;
- // ThinClientPoolDM m_pool;
- ACE_Recursive_Thread_Mutex m_listLock;
+ std::recursive_mutex m_listLock;
bool m_isUserAuthenticated;
AuthenticatedView* m_authenticatedView;
std::shared_ptr<Pool> m_pool;
@@ -123,24 +123,6 @@
UserAttributes& operator=(const UserAttributes&);
};
-class TSSUserAttributesWrapper {
- private:
- std::shared_ptr<UserAttributes> m_userAttribute;
- TSSUserAttributesWrapper& operator=(const TSSUserAttributesWrapper&);
- TSSUserAttributesWrapper(const TSSUserAttributesWrapper&);
-
- public:
- static ACE_TSS<TSSUserAttributesWrapper> s_geodeTSSUserAttributes;
- std::shared_ptr<UserAttributes> getUserAttributes() {
- return m_userAttribute;
- }
- void setUserAttributes(std::shared_ptr<UserAttributes> userAttr) {
- m_userAttribute = userAttr;
- }
- TSSUserAttributesWrapper() : m_userAttribute(nullptr) {}
- ~TSSUserAttributesWrapper() {}
-};
-
class GuardUserAttributes {
public:
GuardUserAttributes();
@@ -154,6 +136,7 @@
private:
AuthenticatedView* m_authenticatedView;
};
+
} // namespace client
} // namespace geode
} // namespace apache
diff --git a/cppcache/src/Utils.cpp b/cppcache/src/Utils.cpp
index b816529..f8fa0ec 100644
--- a/cppcache/src/Utils.cpp
+++ b/cppcache/src/Utils.cpp
@@ -19,34 +19,25 @@
#include <chrono>
#include <cstdio>
+#include <cstdlib>
#include <iomanip>
#include <sstream>
#include <ace/INET_Addr.h>
#include <ace/OS.h>
-#include <ace/Recursive_Thread_Mutex.h>
namespace apache {
namespace geode {
namespace client {
int32_t Utils::getLastError() { return ACE_OS::last_error(); }
+
std::string Utils::getEnv(const char* varName) {
-#ifdef _WIN32
- DWORD dwRet;
- char varValue[8192];
- dwRet = ::GetEnvironmentVariable(varName, varValue, 8192);
- if (dwRet == 0 && (::GetLastError() == ERROR_ENVVAR_NOT_FOUND)) {
- return "";
+ std::string env;
+ if (const auto varValue = std::getenv(varName)) {
+ env = varValue;
}
- return varValue;
-#else
- char* varValue = ACE_OS::getenv(varName);
- if (varValue == nullptr) {
- return "";
- }
- return varValue;
-#endif
+ return env;
}
void Utils::parseEndpointString(const char* endpoints, std::string& host,
@@ -107,7 +98,7 @@
struct hostent* host;
host = ACE_OS::gethostbyname(hostName);
if (host) {
- ACE_OS::snprintf(fullName, 256, "%s:%d", host->h_name, port);
+ std::snprintf(fullName, 256, "%s:%d", host->h_name, port);
return fullName;
}
} else {
@@ -115,7 +106,7 @@
if (pos != std::string::npos) {
ACE_INET_Addr addr(endpoints);
addr.get_host_name(hostName, 256);
- ACE_OS::snprintf(fullName, 256, "%s:%d", hostName, port);
+ std::snprintf(fullName, 256, "%s:%d", hostName, port);
return fullName;
}
}
@@ -173,32 +164,6 @@
return "";
}
-int32_t Utils::logWideString(char* buf, size_t maxLen, const wchar_t* wStr) {
- if (wStr != nullptr) {
- mbstate_t state;
- ACE_OS::memset(&state, 0, sizeof(mbstate_t));
- const char* bufStart = buf;
- do {
- if (maxLen < static_cast<size_t>(MB_CUR_MAX)) {
- break;
- }
- size_t numChars = wcrtomb(buf, *wStr, &state);
- if (numChars == static_cast<size_t>(-1)) {
- // write short when conversion cannot be done
- numChars = ACE_OS::snprintf(buf, maxLen, "<%u>", *wStr);
- }
- buf += numChars;
- if (numChars >= maxLen) {
- break;
- }
- maxLen -= numChars;
- } while (*wStr++ != L'\0');
- return static_cast<int32_t>(buf - bufStart);
- } else {
- return ACE_OS::snprintf(buf, maxLen, "null");
- }
-}
-
int64_t Utils::startStatOpTime() {
return std::chrono::duration_cast<std::chrono::nanoseconds>(
std::chrono::steady_clock::now().time_since_epoch())
diff --git a/cppcache/src/Utils.hpp b/cppcache/src/Utils.hpp
index 32b6ead..b3577c1 100644
--- a/cppcache/src/Utils.hpp
+++ b/cppcache/src/Utils.hpp
@@ -98,8 +98,6 @@
return std::string(typeIdName);
}
- static int logWideString(char* buf, size_t maxLen, const wchar_t* wStr);
-
/**
* The only operations that is well defined on the result is "asChar".
*/
diff --git a/cppcache/src/VersionStamp.cpp b/cppcache/src/VersionStamp.cpp
index 9d1004a..ef1c3e9 100644
--- a/cppcache/src/VersionStamp.cpp
+++ b/cppcache/src/VersionStamp.cpp
@@ -187,7 +187,9 @@
"delta requires full value due to version mismatch. key=%s tagVersion "
"%lld stampVersion %lld ",
keystr.c_str(), tagVersion, stampVersion);
- if (poolDM) poolDM->updateNotificationStats(false, 0);
+ if (poolDM) {
+ poolDM->updateNotificationStats(false, std::chrono::nanoseconds(0));
+ }
return GF_INVALID_DELTA;
} else {
@@ -199,7 +201,9 @@
"MemberId of the version stamp could not be found. Requesting full "
"delta value. key=%s",
keystr.c_str());
- if (poolDM) poolDM->updateNotificationStats(false, 0);
+ if (poolDM) {
+ poolDM->updateNotificationStats(false, std::chrono::nanoseconds(0));
+ }
return GF_INVALID_DELTA;
}
@@ -209,7 +213,9 @@
"Previous MemberId of the version tag could not be found. Requesting "
"full delta value. key=%s",
keystr.c_str());
- if (poolDM) poolDM->updateNotificationStats(false, 0);
+ if (poolDM) {
+ poolDM->updateNotificationStats(false, std::chrono::nanoseconds(0));
+ }
return GF_INVALID_DELTA;
}
@@ -220,7 +226,9 @@
keystr.c_str(), tagID->getHashKey().c_str(),
stampID->getHashKey().c_str());
- if (poolDM) poolDM->updateNotificationStats(false, 0);
+ if (poolDM) {
+ poolDM->updateNotificationStats(false, std::chrono::nanoseconds(0));
+ }
return GF_INVALID_DELTA;
}
return GF_NOERR;
diff --git a/cppcache/src/VersionedCacheableObjectPartList.cpp b/cppcache/src/VersionedCacheableObjectPartList.cpp
index 3df5504..15b8ea3 100644
--- a/cppcache/src/VersionedCacheableObjectPartList.cpp
+++ b/cppcache/src/VersionedCacheableObjectPartList.cpp
@@ -87,7 +87,7 @@
}
void VersionedCacheableObjectPartList::fromData(DataInput& input) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_responseLock);
+ std::lock_guard<decltype(m_responseLock)> guard(m_responseLock);
LOGDEBUG("VersionedCacheableObjectPartList::fromData");
uint8_t flags = input.read();
m_hasKeys = (flags & 0x01) == 0x01;
diff --git a/cppcache/src/VersionedCacheableObjectPartList.hpp b/cppcache/src/VersionedCacheableObjectPartList.hpp
index 4c9e7e4..68b3846 100644
--- a/cppcache/src/VersionedCacheableObjectPartList.hpp
+++ b/cppcache/src/VersionedCacheableObjectPartList.hpp
@@ -20,17 +20,13 @@
#ifndef GEODE_VERSIONEDCACHEABLEOBJECTPARTLIST_H_
#define GEODE_VERSIONEDCACHEABLEOBJECTPARTLIST_H_
+#include <mutex>
#include <vector>
-#include <ace/Task.h>
-
#include "CacheableObjectPartList.hpp"
#include "VersionTag.hpp"
#include "util/Log.hpp"
-/** @file
- */
-
namespace apache {
namespace geode {
namespace client {
@@ -57,7 +53,7 @@
std::vector<uint8_t> m_byteArray;
uint16_t m_endpointMemId;
std::shared_ptr<std::vector<std::shared_ptr<CacheableKey>>> m_tempKeys;
- ACE_Recursive_Thread_Mutex& m_responseLock;
+ std::recursive_mutex& m_responseLock;
static const uint8_t FLAG_NULL_TAG;
static const uint8_t FLAG_FULL_TAG;
@@ -71,13 +67,6 @@
const VersionedCacheableObjectPartList& other);
VersionedCacheableObjectPartList(
const VersionedCacheableObjectPartList& other);
- /*inline VersionedCacheableObjectPartList() : m_responseLock()
- {
- m_regionIsVersioned = false;
- m_serializeValues = false;
- m_endpointMemId = 0;
- _GEODE_NEW(m_tempKeys, std::vector<std::shared_ptr<CacheableKey>> );
- }*/
public:
VersionedCacheableObjectPartList(
@@ -88,7 +77,7 @@
resultKeys,
ThinClientRegion* region, MapOfUpdateCounters* trackerMap,
int32_t destroyTracker, bool addToLocalCache, uint16_t m_dsmemId,
- ACE_Recursive_Thread_Mutex& responseLock)
+ std::recursive_mutex& responseLock)
: CacheableObjectPartList(keys, keysOffset, values, exceptions,
resultKeys, region, trackerMap, destroyTracker,
addToLocalCache),
@@ -104,7 +93,7 @@
VersionedCacheableObjectPartList(
std::vector<std::shared_ptr<CacheableKey>>* keys, int32_t totalMapSize,
- ACE_Recursive_Thread_Mutex& responseLock)
+ std::recursive_mutex& responseLock)
: m_tempKeys(keys), m_responseLock(responseLock) {
m_regionIsVersioned = false;
m_serializeValues = false;
@@ -116,7 +105,7 @@
}
VersionedCacheableObjectPartList(ThinClientRegion* region, uint16_t dsmemId,
- ACE_Recursive_Thread_Mutex& responseLock)
+ std::recursive_mutex& responseLock)
: CacheableObjectPartList(region),
m_endpointMemId(dsmemId),
m_responseLock(responseLock) {
@@ -129,7 +118,7 @@
VersionedCacheableObjectPartList(
std::vector<std::shared_ptr<CacheableKey>>* keys,
- ACE_Recursive_Thread_Mutex& responseLock)
+ std::recursive_mutex& responseLock)
: m_tempKeys(keys), m_responseLock(responseLock) {
m_regionIsVersioned = false;
m_serializeValues = false;
@@ -141,7 +130,7 @@
VersionedCacheableObjectPartList(
ThinClientRegion* region,
std::vector<std::shared_ptr<CacheableKey>>* keys,
- ACE_Recursive_Thread_Mutex& responseLock)
+ std::recursive_mutex& responseLock)
: CacheableObjectPartList(region),
m_tempKeys(keys),
m_responseLock(responseLock) {
@@ -153,7 +142,7 @@
}
VersionedCacheableObjectPartList(ThinClientRegion* region,
- ACE_Recursive_Thread_Mutex& responseLock)
+ std::recursive_mutex& responseLock)
: CacheableObjectPartList(region), m_responseLock(responseLock) {
m_regionIsVersioned = false;
m_serializeValues = false;
@@ -183,8 +172,8 @@
return m_tempKeys;
}
- inline VersionedCacheableObjectPartList(
- uint16_t endpointMemId, ACE_Recursive_Thread_Mutex& responseLock)
+ inline VersionedCacheableObjectPartList(uint16_t endpointMemId,
+ std::recursive_mutex& responseLock)
: m_tempKeys(
std::make_shared<std::vector<std::shared_ptr<CacheableKey>>>()),
m_responseLock(responseLock) {
@@ -196,8 +185,6 @@
}
void addAll(std::shared_ptr<VersionedCacheableObjectPartList> other) {
- // LOGDEBUG("DEBUG:: COPL.addAll called");
- // ACE_Guard< ACE_Recursive_Thread_Mutex > guard( this->m_responseLock );
if (other->m_tempKeys != nullptr) {
if (this->m_tempKeys == nullptr) {
this->m_tempKeys =
diff --git a/cppcache/src/config.h.in b/cppcache/src/config.h.in
index 7444cc3..c2a283f 100644
--- a/cppcache/src/config.h.in
+++ b/cppcache/src/config.h.in
@@ -22,6 +22,13 @@
#cmakedefine HAVE_SYS_MOUNT_H
+#cmakedefine CMAKE_USE_PTHREADS_INIT
+#if defined(CMAKE_USE_PTHREADS_INIT)
+#cmakedefine HAVE_PTHREAD_H
+#cmakedefine HAVE_PTHREAD_HX
+#cmakedefine HAVE_pthread_setname_np
+#endif
+
#cmakedefine HAVE_SIGSTKFLT
#cmakedefine HAVE_ACE_Select_Reactor
diff --git a/cppcache/src/dllmain.cpp b/cppcache/src/dllmain.cpp
index 0ad9d12..54a97d5 100644
--- a/cppcache/src/dllmain.cpp
+++ b/cppcache/src/dllmain.cpp
@@ -19,8 +19,6 @@
#include <cstdlib>
#include <string>
-#include <ace/TSS_T.h>
-
#include <geode/Exception.hpp>
#include "CppCacheLibrary.hpp"
diff --git a/cppcache/src/internal/duration.cpp b/cppcache/src/internal/chrono/duration.cpp
similarity index 100%
rename from cppcache/src/internal/duration.cpp
rename to cppcache/src/internal/chrono/duration.cpp
diff --git a/cppcache/src/statistics/AtomicStatisticsImpl.cpp b/cppcache/src/statistics/AtomicStatisticsImpl.cpp
index 8ad053e..3618844 100644
--- a/cppcache/src/statistics/AtomicStatisticsImpl.cpp
+++ b/cppcache/src/statistics/AtomicStatisticsImpl.cpp
@@ -19,8 +19,6 @@
#include <atomic>
-#include <ace/OS_NS_stdio.h>
-
#include <geode/internal/geode_globals.hpp>
#include "../Assert.hpp"
@@ -140,7 +138,7 @@
void AtomicStatisticsImpl::_setInt(int32_t offset, int32_t value) {
if (offset >= statsType->getIntStatCount()) {
char s[128] = {'\0'};
- ACE_OS::snprintf(
+ std::snprintf(
s, 128, "setInt:The id (%d) of the Statistic Descriptor is not valid ",
offset);
throw IllegalArgumentException(s);
@@ -152,7 +150,7 @@
if (offset >= statsType->getLongStatCount()) {
char s[128] = {'\0'};
- ACE_OS::snprintf(
+ std::snprintf(
s, 128, "setLong:The id (%d) of the Statistic Descriptor is not valid ",
offset);
throw IllegalArgumentException(s);
@@ -164,7 +162,7 @@
void AtomicStatisticsImpl::_setDouble(int32_t offset, double value) {
if (offset >= statsType->getDoubleStatCount()) {
char s[128] = {'\0'};
- ACE_OS::snprintf(
+ std::snprintf(
s, 128,
"setDouble:The id (%d) of the Statistic Descriptor is not valid ",
offset);
@@ -177,7 +175,7 @@
int32_t AtomicStatisticsImpl::_getInt(int32_t offset) const {
if (offset >= statsType->getIntStatCount()) {
char s[128] = {'\0'};
- ACE_OS::snprintf(
+ std::snprintf(
s, 128, "getInt:The id (%d) of the Statistic Descriptor is not valid ",
offset);
throw IllegalArgumentException(s);
@@ -189,7 +187,7 @@
int64_t AtomicStatisticsImpl::_getLong(int32_t offset) const {
if (offset >= statsType->getLongStatCount()) {
char s[128] = {'\0'};
- ACE_OS::snprintf(
+ std::snprintf(
s, 128, "getLong:The id (%d) of the Statistic Descriptor is not valid ",
offset);
throw IllegalArgumentException(s);
@@ -200,7 +198,7 @@
double AtomicStatisticsImpl::_getDouble(int32_t offset) const {
if (offset >= statsType->getDoubleStatCount()) {
char s[128] = {'\0'};
- ACE_OS::snprintf(
+ std::snprintf(
s, 128,
"getDouble:The id (%d) of the Statistic Descriptor is not valid ",
offset);
@@ -243,7 +241,7 @@
int32_t AtomicStatisticsImpl::_incInt(int32_t offset, int32_t delta) {
if (offset >= statsType->getIntStatCount()) {
char s[128] = {'\0'};
- ACE_OS::snprintf(
+ std::snprintf(
s, 128, "incInt:The id (%d) of the Statistic Descriptor is not valid ",
offset);
throw IllegalArgumentException(s);
@@ -254,24 +252,9 @@
int64_t AtomicStatisticsImpl::_incLong(int32_t offset, int64_t delta) {
if (offset >= statsType->getLongStatCount()) {
- char s[128] = {'\0'};
- /* adongre - Coverity II
- * CID 29273: Calling risky function (SECURE_CODING)[VERY RISKY]. Using
- * "sprintf" can cause a
- * buffer overflow when done incorrectly. Because sprintf() assumes an
- * arbitrarily long string,
- * callers must be careful not to overflow the actual space of the
- * destination.
- * Use snprintf() instead, or correct precision specifiers.
- * Fix : using ACE_OS::snprintf
- */
- // sprintf(s, "incLong:The id (%d) of the Statistic Descriptor is not valid
- // ", offset);
-
- ACE_OS::snprintf(
- s, 128, "incLong:The id (%d) of the Statistic Descriptor is not valid ",
- offset);
- throw IllegalArgumentException(s);
+ throw IllegalArgumentException(
+ "incLong:The id " + std::to_string(offset) +
+ " of the Statistic Descriptor is not valid.");
}
return (longStorage[offset] += delta);
@@ -279,12 +262,9 @@
double AtomicStatisticsImpl::_incDouble(int32_t offset, double delta) {
if (offset >= statsType->getDoubleStatCount()) {
- char s[128] = {'\0'};
- ACE_OS::snprintf(
- s, 128,
- "incDouble:The id (%d) of the Statistic Descriptor is not valid ",
- offset);
- throw IllegalArgumentException(s);
+ throw IllegalArgumentException(
+ "incDouble:The id " + std::to_string(offset) +
+ " of the Statistic Descriptor is not valid.");
}
double expected = doubleStorage[offset];
diff --git a/cppcache/src/statistics/GeodeStatisticsFactory.cpp b/cppcache/src/statistics/GeodeStatisticsFactory.cpp
index db19ec3..834d61d 100644
--- a/cppcache/src/statistics/GeodeStatisticsFactory.cpp
+++ b/cppcache/src/statistics/GeodeStatisticsFactory.cpp
@@ -1,4 +1,3 @@
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -20,10 +19,7 @@
#include <string>
-#include <ace/Guard_T.h>
-#include <ace/OS.h>
-#include <ace/Recursive_Thread_Mutex.h>
-#include <ace/Thread_Mutex.h>
+#include <boost/process/environment.hpp>
#include <geode/Exception.hpp>
#include <geode/internal/geode_globals.hpp>
@@ -31,6 +27,7 @@
#include "../util/Log.hpp"
#include "AtomicStatisticsImpl.hpp"
#include "OsStatisticsImpl.hpp"
+#include "StatisticDescriptorImpl.hpp"
namespace apache {
namespace geode {
@@ -43,7 +40,7 @@
GeodeStatisticsFactory::GeodeStatisticsFactory(StatisticsManager* statMngr) {
m_name = "GeodeStatisticsFactory";
- m_id = ACE_OS::getpid();
+ m_id = boost::this_process::get_id();
m_statsListUniqueId = 1;
m_statMngr = statMngr;
@@ -54,17 +51,14 @@
m_statMngr = nullptr;
// Clean Map : Delete all the pointers of StatisticsType from the map.
- if (statsTypeMap.total_size() == 0) return;
+ std::lock_guard<decltype(statsTypeMap)::mutex_type> lock(
+ statsTypeMap.mutex());
+ if (statsTypeMap.empty()) return;
- ACE_Map_Manager<std::string, StatisticsTypeImpl*,
- ACE_Recursive_Thread_Mutex>::iterator iterFind =
- statsTypeMap.begin();
- while (iterFind != statsTypeMap.end()) {
- delete (*iterFind).int_id_;
- (*iterFind).int_id_ = nullptr;
- iterFind++;
+ for (auto& entry : statsTypeMap) {
+ delete entry.second;
}
- statsTypeMap.unbind_all();
+ statsTypeMap.clear();
} catch (const Exception& ex) {
Log::warningCatch("~GeodeStatisticsFactory swallowing Geode exception", ex);
@@ -107,7 +101,8 @@
int64_t myUniqueId;
{
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_statsListUniqueIdLock);
+ std::lock_guard<decltype(m_statsListUniqueIdLock)> guard(
+ m_statsListUniqueIdLock);
myUniqueId = m_statsListUniqueId++;
}
@@ -137,7 +132,8 @@
int64_t myUniqueId;
{
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_statsListUniqueIdLock);
+ std::lock_guard<decltype(m_statsListUniqueIdLock)> guard(
+ m_statsListUniqueIdLock);
myUniqueId = m_statsListUniqueId++;
}
@@ -156,20 +152,17 @@
StatisticsTypeImpl* GeodeStatisticsFactory::addType(StatisticsTypeImpl* st) {
const auto& name = st->getName();
- int status;
try {
- StatisticsTypeImpl* st1;
- status = statsTypeMap.rebind(name, st, st1);
+ auto status = statsTypeMap.emplace(name, st);
+ if (!status.second) {
+ throw IllegalArgumentException(
+ "GeodeStatisticsFactory::addType: failed to add new type " + name);
+ }
} catch (const std::exception& ex) {
throw IllegalArgumentException(ex.what());
} catch (...) {
throw IllegalArgumentException("addType: unknown exception");
}
- if (status == 1) {
- } else if (status == -1) {
- throw IllegalArgumentException(
- "GeodeStatisticsFactory::addType: failed to add new type " + name);
- }
return st;
}
@@ -179,8 +172,7 @@
StatisticsType* GeodeStatisticsFactory::createType(
const std::string& name, const std::string& description,
StatisticDescriptor** stats, int32_t statsLength) {
- StatisticsTypeImpl* st =
- new StatisticsTypeImpl(name, description, stats, statsLength);
+ auto st = new StatisticsTypeImpl(name, description, stats, statsLength);
if (st != nullptr) {
st = addType(st);
@@ -193,15 +185,13 @@
StatisticsType* GeodeStatisticsFactory::findType(
const std::string& name) const {
- StatisticsTypeImpl* st = nullptr;
- int status = statsTypeMap.find(name, st);
- if (status == -1) {
+ auto&& lock = statsTypeMap.make_lock();
+ const auto& entry = statsTypeMap.find(name);
+ if (entry == statsTypeMap.end()) {
std::string s = "There is no statistic named \"" + name + "\"";
- // LOGWARN(s.c_str());
- // throw IllegalArgumentException(s.c_str());
return nullptr;
} else {
- return st;
+ return entry->second;
}
}
diff --git a/cppcache/src/statistics/GeodeStatisticsFactory.hpp b/cppcache/src/statistics/GeodeStatisticsFactory.hpp
index 790bede..4d6ed46 100644
--- a/cppcache/src/statistics/GeodeStatisticsFactory.hpp
+++ b/cppcache/src/statistics/GeodeStatisticsFactory.hpp
@@ -20,14 +20,14 @@
#ifndef GEODE_STATISTICS_GEODESTATISTICSFACTORY_H_
#define GEODE_STATISTICS_GEODESTATISTICSFACTORY_H_
+#include <mutex>
+#include <unordered_map>
#include <vector>
-#include <ace/Map_Manager.h>
-#include <ace/Recursive_Thread_Mutex.h>
-
#include <geode/ExceptionTypes.hpp>
#include <geode/internal/geode_globals.hpp>
+#include "../util/synchronized_map.hpp"
#include "StatisticsFactory.hpp"
#include "StatisticsManager.hpp"
#include "StatisticsTypeImpl.hpp"
@@ -56,10 +56,12 @@
int64_t m_statsListUniqueId; // Creates a unique id for each stats object in
// the list
- ACE_Recursive_Thread_Mutex m_statsListUniqueIdLock;
+ std::recursive_mutex m_statsListUniqueIdLock;
/* Maps a stat name to its StatisticDescriptor*/
- ACE_Map_Manager<std::string, StatisticsTypeImpl*, ACE_Recursive_Thread_Mutex>
+ apache::geode::client::synchronized_map<
+ std::unordered_map<std::string, StatisticsTypeImpl*>,
+ std::recursive_mutex>
statsTypeMap;
StatisticsTypeImpl* addType(StatisticsTypeImpl* t);
diff --git a/cppcache/src/statistics/HostStatSampler.cpp b/cppcache/src/statistics/HostStatSampler.cpp
index 74fb443..1fc5b8e 100644
--- a/cppcache/src/statistics/HostStatSampler.cpp
+++ b/cppcache/src/statistics/HostStatSampler.cpp
@@ -29,8 +29,7 @@
#include <ace/INET_Addr.h>
#include <ace/OS_NS_sys_stat.h>
#include <ace/OS_NS_sys_utsname.h>
-#include <ace/Task.h>
-#include <ace/Thread_Mutex.h>
+#include <boost/process/environment.hpp>
#include <geode/SystemProperties.hpp>
#include <geode/internal/geode_globals.hpp>
@@ -39,6 +38,7 @@
#include "../ClientHealthStats.hpp"
#include "../ClientProxyMembershipID.hpp"
#include "../DistributedSystem.hpp"
+#include "../TcrConnectionManager.hpp"
#include "../util/Log.hpp"
#include "GeodeStatisticsFactory.hpp"
#include "StatArchiveWriter.hpp"
@@ -81,7 +81,7 @@
size_t fileHyphenPos = tempname.find_last_of('-');
if (fileHyphenPos != std::string::npos) {
std::string buff1 = tempname.substr(0, fileHyphenPos);
- if (ACE_OS::strstr(filebasename.c_str(), buff1.c_str()) == nullptr) {
+ if (filebasename.find(buff1) == std::string::npos) {
return 0;
}
if (fileHyphenPos != actualHyphenPos) return 0;
@@ -108,7 +108,7 @@
} else if (strlen((*d1)->d_name) > strlen((*d2)->d_name)) {
return 1;
}
- int diff = ACE_OS::strcmp((*d1)->d_name, (*d2)->d_name);
+ int diff = std::strcmp((*d1)->d_name, (*d2)->d_name);
if (diff < 0) {
return -1;
} else if (diff > 0) {
@@ -146,7 +146,7 @@
m_archiver = nullptr;
m_samplerStats = new StatSamplerStats(statMngr->getStatisticsFactory());
m_startTime = system_clock::now();
- m_pid = ACE_OS::getpid();
+ m_pid = boost::this_process::get_id();
m_statMngr = statMngr;
m_archiveFileName = filePath;
globals::g_statFile = filePath;
@@ -190,28 +190,15 @@
#ifdef _WIN32
// replace all '\' with '/' to make everything easier..
- size_t len = globals::g_statFile.length() + 1;
- char* slashtmp = new char[len];
- ACE_OS::strncpy(slashtmp, globals::g_statFile.c_str(), len);
- for (size_t i = 0; i < globals::g_statFile.length(); i++) {
- if (slashtmp[i] == '/') {
- slashtmp[i] = '\\';
- }
- }
- globals::g_statFile = slashtmp;
- delete[] slashtmp;
- slashtmp = nullptr;
+ std::replace(globals::g_statFile.begin(), globals::g_statFile.end(), '\\',
+ '/');
#endif
std::string dirname = ACE::dirname(globals::g_statFile.c_str());
- // struct dirent **resultArray;
- // int entries_count = ACE_OS::scandir(dirname.c_str(), &resultArray,
- // selector, comparator);
ACE_Dirent_Selector sds;
int status = sds.open(dirname.c_str(), selector, comparator);
if (status != -1) {
for (int i = 0; i < sds.length(); i++) {
- // std::string strname = ACE::basename(resultArray[i]->d_name);
std::string strname = ACE::basename(sds[i]->d_name);
size_t fileExtPos = strname.find_last_of('.', strname.length());
if (fileExtPos != std::string::npos) {
@@ -220,34 +207,21 @@
if (fileHyphenPos != std::string::npos) {
std::string buff =
tempname.substr(fileHyphenPos + 1, tempname.length());
- rollIndex = ACE_OS::atoi(buff.c_str()) + 1;
+ rollIndex = std::stoi(buff) + 1;
}
}
}
sds.close();
}
- /*for(int i = 0; i < entries_count; i++) {
- ACE_OS::free ( resultArray[i] );
- }
- if (entries_count >= 0) {
- ACE_OS::free( resultArray );
- resultArray = nullptr;
- }*/
FILE* existingFile = fopen(globals::g_statFileWithExt.c_str(), "r");
if (existingFile != nullptr && statFileLimit > 0) {
fclose(existingFile);
- /* adongre
- * CID 28820: Resource leak (RESOURCE_LEAK)
- */
existingFile = nullptr;
changeArchive(globals::g_statFileWithExt);
} else {
writeGfs();
}
- /* adongre
- * CID 28820: Resource leak (RESOURCE_LEAK)
- */
if (existingFile != nullptr) {
fclose(existingFile);
existingFile = nullptr;
@@ -271,15 +245,15 @@
std::string HostStatSampler::createArchiveFileName() {
if (!m_isStatDiskSpaceEnabled) {
char buff[1024] = {0};
- int32_t pid = ACE_OS::getpid();
- int32_t len = static_cast<int32_t>(m_archiveFileName.length());
- size_t fileExtPos = m_archiveFileName.find_last_of('.', len);
+ auto pid = boost::this_process::get_id();
+ auto len = m_archiveFileName.length();
+ auto fileExtPos = m_archiveFileName.find_last_of('.', len);
if (fileExtPos == std::string::npos) {
- ACE_OS::snprintf(buff, 1024, "%s-%d.gfs", m_archiveFileName.c_str(), pid);
+ std::snprintf(buff, 1024, "%s-%d.gfs", m_archiveFileName.c_str(), pid);
} else {
std::string tmp;
tmp = m_archiveFileName.substr(0, fileExtPos);
- ACE_OS::snprintf(buff, 1024, "%s-%d.gfs", tmp.c_str(), pid);
+ std::snprintf(buff, 1024, "%s-%d.gfs", tmp.c_str(), pid);
}
m_archiveFileName = buff;
return m_archiveFileName;
@@ -309,7 +283,8 @@
}
bool HostStatSampler::statisticsExists(const int64_t id) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_statMngr->getListMutex());
+ std::lock_guard<decltype(m_statMngr->getListMutex())> guard(
+ m_statMngr->getListMutex());
std::vector<Statistics*>& statsList = m_statMngr->getStatsList();
std::vector<Statistics*>::iterator i;
for (i = statsList.begin(); i != statsList.end(); ++i) {
@@ -321,7 +296,8 @@
}
Statistics* HostStatSampler::findStatistics(const int64_t id) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_statMngr->getListMutex());
+ std::lock_guard<decltype(m_statMngr->getListMutex())> guard(
+ m_statMngr->getListMutex());
std::vector<Statistics*>& statsList = m_statMngr->getStatsList();
std::vector<Statistics*>::iterator i;
for (i = statsList.begin(); i != statsList.end(); ++i) {
@@ -332,7 +308,7 @@
return nullptr;
}
-ACE_Recursive_Thread_Mutex& HostStatSampler::getStatListMutex() {
+std::recursive_mutex& HostStatSampler::getStatListMutex() {
return m_statMngr->getListMutex();
}
@@ -461,13 +437,13 @@
while (!gotNewFileName) {
char newfilename[1000] = {0};
if (i < 10) {
- ACE_OS::snprintf(newfilename, 1000, "%s%c%s-%d.%s", statsdirname.c_str(),
- ACE_DIRECTORY_SEPARATOR_CHAR, fnameBeforeExt.c_str(), i,
- extName.c_str());
+ std::snprintf(newfilename, 1000, "%s%c%s-%d.%s", statsdirname.c_str(),
+ ACE_DIRECTORY_SEPARATOR_CHAR, fnameBeforeExt.c_str(), i,
+ extName.c_str());
} else {
- ACE_OS::snprintf(newfilename, 1000, "%s%c%s-%d.%s", statsdirname.c_str(),
- ACE_DIRECTORY_SEPARATOR_CHAR, fnameBeforeExt.c_str(), i,
- extName.c_str());
+ std::snprintf(newfilename, 1000, "%s%c%s-%d.%s", statsdirname.c_str(),
+ ACE_DIRECTORY_SEPARATOR_CHAR, fnameBeforeExt.c_str(), i,
+ extName.c_str());
}
FILE* fp = fopen(newfilename, "r");
@@ -503,18 +479,14 @@
void HostStatSampler::checkListeners() {}
void HostStatSampler::start() {
- if (!m_running) {
- m_running = true;
- this->activate();
+ if (!m_running.exchange(true)) {
+ m_thread = std::thread(&HostStatSampler::svc, this);
}
}
void HostStatSampler::stop() {
m_stopRequested = true;
- this->wait();
- // while (m_running) {
- // ACE_OS::sleep(100);
- //}
+ m_thread.join();
}
bool HostStatSampler::isRunning() { return m_running; }
@@ -557,7 +529,7 @@
}
}
}
- static int numCPU = ACE_OS::num_processors();
+ static auto numCPU = std::thread::hardware_concurrency();
auto obj = client::ClientHealthStats::create(
gets, puts, misses, numListeners, numThreads, cpuTime, numCPU);
if (clientId.empty()) {
@@ -589,7 +561,7 @@
}
void HostStatSampler::forceSample() {
- ACE_Guard<ACE_Recursive_Thread_Mutex> samplingGuard(m_samplingLock);
+ std::lock_guard<decltype(m_samplingLock)> guard(m_samplingLock);
if (m_archiver) {
sampleSpecialStats();
@@ -599,7 +571,7 @@
}
void HostStatSampler::doSample(std::string& archivefilename) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> samplingGuard(m_samplingLock);
+ std::lock_guard<decltype(m_samplingLock)> guard(m_samplingLock);
sampleSpecialStats();
checkListeners();
@@ -641,29 +613,19 @@
globals::g_spaceUsed = 0;
char fullpath[512] = {0};
std::string dirname = ACE::dirname(globals::g_statFile.c_str());
- // struct dirent **resultArray;
- // int entries_count = ACE_OS::scandir(dirname.c_str(), &resultArray,
- // selector, comparator);
ACE_stat statBuf = {};
ACE_Dirent_Selector sds;
int status = sds.open(dirname.c_str(), selector, comparator);
if (status != -1) {
for (int i = 1; i < sds.length(); i++) {
- ACE_OS::snprintf(fullpath, 512, "%s%c%s", dirname.c_str(),
- ACE_DIRECTORY_SEPARATOR_CHAR, sds[i]->d_name);
+ std::snprintf(fullpath, 512, "%s%c%s", dirname.c_str(),
+ ACE_DIRECTORY_SEPARATOR_CHAR, sds[i]->d_name);
ACE_OS::stat(fullpath, &statBuf);
globals::g_fileInfoPair = std::make_pair(fullpath, statBuf.st_size);
fileInfo.push_back(globals::g_fileInfoPair);
globals::g_spaceUsed += fileInfo[i - 1].second;
}
globals::g_spaceUsed += m_archiver->bytesWritten();
- /*for(int i = 0; i < entries_count; i++) {
- ACE_OS::free ( resultArray[i] );
- }
- if (entries_count >= 0) {
- ACE_OS::free( resultArray );
- resultArray = nullptr;
- }*/
sds.close();
}
int fileIndex = 0;
@@ -680,7 +642,7 @@
}
}
-int32_t HostStatSampler::svc(void) {
+void HostStatSampler::svc(void) {
client::DistributedSystemImpl::setThreadName(NC_HSS_Thread);
try {
initSpecialStats();
@@ -697,7 +659,7 @@
while (!m_stopRequested) {
try {
if (gotexception) {
- ACE_OS::sleep(1);
+ std::this_thread::sleep_for(std::chrono::seconds(1));
waitTime++;
if (waitTime < 60) { // sleep for minute and then try to recreate
@@ -752,7 +714,6 @@
closeSpecialStats();
}*/
m_running = false;
- return 0;
}
} // namespace statistics
} // namespace geode
diff --git a/cppcache/src/statistics/HostStatSampler.hpp b/cppcache/src/statistics/HostStatSampler.hpp
index 0d110f9..3091e91 100644
--- a/cppcache/src/statistics/HostStatSampler.hpp
+++ b/cppcache/src/statistics/HostStatSampler.hpp
@@ -20,12 +20,14 @@
#ifndef GEODE_STATISTICS_HOSTSTATSAMPLER_H_
#define GEODE_STATISTICS_HOSTSTATSAMPLER_H_
+#include <atomic>
#include <chrono>
#include <memory>
+#include <mutex>
#include <string>
+#include <thread>
#include <vector>
-#include <ace/Recursive_Thread_Mutex.h>
#include <ace/Task.h>
#include <geode/ExceptionTypes.hpp>
@@ -39,8 +41,6 @@
#include "StatisticsManager.hpp"
#include "StatisticsType.hpp"
-/** @file
- */
#ifndef GEMFIRE_MAX_STATS_FILE_LIMIT
#define GEMFIRE_MAX_STATS_FILE_LIMIT (1024 * 1024 * 1024)
#endif
@@ -48,6 +48,7 @@
#ifndef GEMFIRE_MAX_STAT_DISK_LIMIT
#define GEMFIRE_MAX_STAT_DISK_LIMIT (1024LL * 1024LL * 1024LL * 1024LL)
#endif
+
namespace apache {
namespace geode {
namespace statistics {
@@ -64,9 +65,7 @@
* HostStatSampler implements a thread which will monitor, sample and archive
* statistics. It only has the common functionalities which any sampler needs.
*/
-class APACHE_GEODE_EXPORT HostStatSampler : public ACE_Task_Base,
- private NonCopyable,
- private NonAssignable {
+class HostStatSampler : private NonCopyable, private NonAssignable {
public:
/*
* Constructor:
@@ -122,7 +121,7 @@
/**
* Gets list mutex for synchronization
*/
- ACE_Recursive_Thread_Mutex& getStatListMutex();
+ std::recursive_mutex& getStatListMutex();
/**
* Returns a vector of ptrs to all the current statistic resource instances.
*/
@@ -180,7 +179,7 @@
/**
* The function executed by the thread
*/
- int32_t svc(void);
+ void svc(void);
/**
* Method to know whether the sampling thread is running or not.
@@ -190,12 +189,12 @@
~HostStatSampler();
private:
- ACE_Recursive_Thread_Mutex m_samplingLock;
+ std::recursive_mutex m_samplingLock;
bool m_adminError;
- // Related to ACE Thread.
- bool m_running;
- bool m_stopRequested;
- volatile bool m_isStatDiskSpaceEnabled;
+ std::thread m_thread;
+ std::atomic<bool> m_running;
+ std::atomic<bool> m_stopRequested;
+ std::atomic<bool> m_isStatDiskSpaceEnabled;
std::unique_ptr<StatArchiveWriter> m_archiver;
StatSamplerStats* m_samplerStats;
const char* m_durableClientId;
@@ -247,6 +246,7 @@
static const char* NC_HSS_Thread;
};
+
} // namespace statistics
} // namespace geode
} // namespace apache
diff --git a/cppcache/src/statistics/OsStatisticsImpl.cpp b/cppcache/src/statistics/OsStatisticsImpl.cpp
index 90c770b..2afbc22 100644
--- a/cppcache/src/statistics/OsStatisticsImpl.cpp
+++ b/cppcache/src/statistics/OsStatisticsImpl.cpp
@@ -20,7 +20,6 @@
#include "../util/Log.hpp"
#include "StatisticDescriptorImpl.hpp"
#include "StatisticsTypeImpl.hpp"
-#include "ace/OS.h"
namespace apache {
namespace geode {
@@ -164,7 +163,7 @@
void OsStatisticsImpl::_setInt(int32_t offset, int32_t value) {
if (offset >= statsType->getIntStatCount()) {
char s[128] = {'\0'};
- ACE_OS::snprintf(
+ std::snprintf(
s, 128, "setInt:The id (%d) of the Statistic Descriptor is not valid ",
offset);
throw IllegalArgumentException(s);
@@ -175,19 +174,7 @@
void OsStatisticsImpl::_setLong(int32_t offset, int64_t value) {
if (offset >= statsType->getLongStatCount()) {
char s[128] = {'\0'};
- /* adongre - Coverity II
- * CID 29275: Calling risky function (SECURE_CODING)[VERY RISKY]. Using
- * "sprintf" can cause a
- * buffer overflow when done incorrectly. Because sprintf() assumes an
- * arbitrarily long string,
- * callers must be careful not to overflow the actual space of the
- * destination.
- * Use snprintf() instead, or correct precision specifiers.
- * Fix : using ACE_OS::snprintf
- */
- // sprintf(s, "setLong:The id (%d) of the Statistic Descriptor is not valid
- // ", offset);
- ACE_OS::snprintf(
+ std::snprintf(
s, 128, "setLong:The id (%d) of the Statistic Descriptor is not valid ",
offset);
throw IllegalArgumentException(s);
@@ -198,7 +185,7 @@
void OsStatisticsImpl::_setDouble(int32_t offset, double value) {
if (offset >= statsType->getDoubleStatCount()) {
char s[128] = {'\0'};
- ACE_OS::snprintf(
+ std::snprintf(
s, 128,
"setDouble:The id (%d) of the Statistic Descriptor is not valid ",
offset);
@@ -212,7 +199,7 @@
int32_t OsStatisticsImpl::_getInt(int32_t offset) const {
if (offset >= statsType->getIntStatCount()) {
char s[128] = {'\0'};
- ACE_OS::snprintf(
+ std::snprintf(
s, 128, "getInt:The id (%d) of the Statistic Descriptor is not valid ",
offset);
throw IllegalArgumentException(s);
@@ -224,7 +211,7 @@
int64_t OsStatisticsImpl::_getLong(int32_t offset) const {
if (offset >= statsType->getLongStatCount()) {
char s[128] = {'\0'};
- ACE_OS::snprintf(
+ std::snprintf(
s, 128, "getLong:The id (%d) of the Statistic Descriptor is not valid ",
offset);
throw IllegalArgumentException(s);
@@ -236,7 +223,7 @@
double OsStatisticsImpl::_getDouble(int32_t offset) const {
if (offset >= statsType->getDoubleStatCount()) {
char s[128] = {'\0'};
- ACE_OS::snprintf(
+ std::snprintf(
s, 128,
"getDouble:The id (%d) of the Statistic Descriptor is not valid ",
offset);
@@ -274,7 +261,7 @@
int32_t OsStatisticsImpl::_incInt(int32_t offset, int32_t delta) {
if (offset >= statsType->getIntStatCount()) {
char s[128] = {'\0'};
- ACE_OS::snprintf(
+ std::snprintf(
s, 128, "incInt:The id (%d) of the Statistic Descriptor is not valid ",
offset);
throw IllegalArgumentException(s);
@@ -287,20 +274,7 @@
int64_t OsStatisticsImpl::_incLong(int32_t offset, int64_t delta) {
if (offset >= statsType->getLongStatCount()) {
char s[128] = {'\0'};
- /* adongre - Coverity II
- * CID 29274: Calling risky function (SECURE_CODING)[VERY RISKY]. Using
- * "sprintf" can cause a
- * buffer overflow when done incorrectly. Because sprintf() assumes an
- * arbitrarily long string,
- * callers must be careful not to overflow the actual space of the
- * destination.
- * Use snprintf() instead, or correct precision specifiers.
- * Fix : using ACE_OS::snprintf
- */
- // sprintf(s, "incLong:The id (%d) of the Statistic Descriptor is not valid
- // ", offset);
-
- ACE_OS::snprintf(
+ std::snprintf(
s, 128, "incLong:The id (%d) of the Statistic Descriptor is not valid ",
offset);
throw IllegalArgumentException(s);
@@ -312,7 +286,7 @@
double OsStatisticsImpl::_incDouble(int32_t offset, double delta) {
if (offset >= statsType->getDoubleStatCount()) {
char s[128] = {'\0'};
- ACE_OS::snprintf(
+ std::snprintf(
s, 128,
"incDouble:The id (%d) of the Statistic Descriptor is not valid ",
offset);
diff --git a/cppcache/src/statistics/PoolStatsSampler.cpp b/cppcache/src/statistics/PoolStatsSampler.cpp
index f205c71..b7d13fe 100644
--- a/cppcache/src/statistics/PoolStatsSampler.cpp
+++ b/cppcache/src/statistics/PoolStatsSampler.cpp
@@ -17,9 +17,7 @@
#include "PoolStatsSampler.hpp"
-#include <chrono>
#include <string>
-#include <thread>
#include "../CacheImpl.hpp"
#include "../ClientHealthStats.hpp"
@@ -40,18 +38,16 @@
PoolStatsSampler::PoolStatsSampler(milliseconds sampleRate, CacheImpl* cache,
ThinClientPoolDM* distMan)
- : m_sampleRate(sampleRate),
+ : m_running(false),
+ m_stopRequested(false),
+ m_sampleRate(sampleRate),
+ m_adminRegion(AdminRegion::create(cache, distMan)),
m_distMan(distMan),
m_statisticsFactory(
- cache->getStatisticsManager().getStatisticsFactory()) {
- m_running = false;
- m_stopRequested = false;
- m_adminRegion = AdminRegion::create(cache, distMan);
-}
+ cache->getStatisticsManager().getStatisticsFactory()) {}
-int32_t PoolStatsSampler::svc() {
+void PoolStatsSampler::svc() {
client::DistributedSystemImpl::setThreadName(NC_PSS_Thread);
- // ACE_Guard < ACE_Recursive_Thread_Mutex > _guard( m_lock );
while (!m_stopRequested) {
auto sampleStart = high_resolution_clock::now();
putStatsInAdminRegion();
@@ -65,21 +61,19 @@
sleepDuration -= wakeInterval;
}
}
- return 0;
}
void PoolStatsSampler::start() {
- if (!m_running) {
- m_running = true;
- this->activate();
+ if (!m_running.exchange(true)) {
+ m_thread = std::thread(&PoolStatsSampler::svc, this);
}
}
void PoolStatsSampler::stop() {
- // ACE_Guard < ACE_Recursive_Thread_Mutex > _guard( m_lock );
m_stopRequested = true;
- this->wait();
+ m_thread.join();
}
+
bool PoolStatsSampler::isRunning() { return m_running; }
void PoolStatsSampler::putStatsInAdminRegion() {
@@ -106,7 +100,7 @@
}
}
}
- static int numCPU = ACE_OS::num_processors();
+ static auto numCPU = std::thread::hardware_concurrency();
auto obj = client::ClientHealthStats::create(
gets, puts, misses, numListeners, numThreads, cpuTime, numCPU);
const auto memId = m_distMan->getMembershipId();
diff --git a/cppcache/src/statistics/PoolStatsSampler.hpp b/cppcache/src/statistics/PoolStatsSampler.hpp
index c04505b..687c47d 100644
--- a/cppcache/src/statistics/PoolStatsSampler.hpp
+++ b/cppcache/src/statistics/PoolStatsSampler.hpp
@@ -20,12 +20,13 @@
#ifndef GEODE_STATISTICS_POOLSTATSSAMPLER_H_
#define GEODE_STATISTICS_POOLSTATSSAMPLER_H_
-#include <ace/Task.h>
+#include <atomic>
+#include <chrono>
+#include <memory>
+#include <thread>
#include <geode/internal/geode_globals.hpp>
-#include "GeodeStatisticsFactory.hpp"
-
namespace apache {
namespace geode {
@@ -45,29 +46,30 @@
using client::ThinClientPoolDM;
class StatisticsManager;
+class GeodeStatisticsFactory;
-class APACHE_GEODE_EXPORT PoolStatsSampler : public ACE_Task_Base {
+class PoolStatsSampler {
public:
PoolStatsSampler() = delete;
PoolStatsSampler(std::chrono::milliseconds sampleRate, CacheImpl* cache,
ThinClientPoolDM* distMan);
PoolStatsSampler& operator=(const PoolStatsSampler&) = delete;
PoolStatsSampler(const PoolStatsSampler& PoolStatsSampler) = delete;
- ~PoolStatsSampler() noexcept override {}
+ ~PoolStatsSampler() noexcept {}
void start();
void stop();
- int32_t svc(void) override;
+ void svc(void);
bool isRunning();
private:
void putStatsInAdminRegion();
- volatile bool m_running;
- volatile bool m_stopRequested;
+ std::thread m_thread;
+ std::atomic<bool> m_running;
+ std::atomic<bool> m_stopRequested;
std::chrono::milliseconds m_sampleRate;
std::shared_ptr<AdminRegion> m_adminRegion;
ThinClientPoolDM* m_distMan;
- ACE_Recursive_Thread_Mutex m_lock;
static const char* NC_PSS_Thread;
GeodeStatisticsFactory* m_statisticsFactory;
};
diff --git a/cppcache/src/statistics/StatArchiveWriter.cpp b/cppcache/src/statistics/StatArchiveWriter.cpp
index 1369871..a216c06 100644
--- a/cppcache/src/statistics/StatArchiveWriter.cpp
+++ b/cppcache/src/statistics/StatArchiveWriter.cpp
@@ -17,6 +17,9 @@
#include "StatArchiveWriter.hpp"
+#include <chrono>
+#include <ctime>
+
#include <ace/ACE.h>
#include <ace/OS_NS_sys_time.h>
#include <ace/OS_NS_sys_utsname.h>
@@ -27,7 +30,9 @@
#include <geode/internal/geode_globals.hpp>
#include "../CacheImpl.hpp"
+#include "../util/chrono/time_point.hpp"
#include "GeodeStatisticsFactory.hpp"
+#include "HostStatSampler.hpp"
namespace apache {
namespace geode {
@@ -347,11 +352,10 @@
tzOffset = tzOffset * -1 * 1000;
this->dataBuffer->writeInt(tzOffset);
- struct tm *tm_val;
- time_t clock = ACE_OS::time();
- tm_val = ACE_OS::localtime(&clock);
+ auto now = std::chrono::system_clock::now();
+ auto tm_val = apache::geode::util::chrono::localtime(now);
char buf[512] = {0};
- ACE_OS::strftime(buf, sizeof(buf), "%Z", tm_val);
+ std::strftime(buf, sizeof(buf), "%Z", &tm_val);
std::string tzId(buf);
this->dataBuffer->writeUTF(tzId);
@@ -396,7 +400,8 @@
int64_t StatArchiveWriter::getSampleSize() { return m_samplesize; }
void StatArchiveWriter::sample(const steady_clock::time_point &timeStamp) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(sampler->getStatListMutex());
+ std::lock_guard<decltype(sampler->getStatListMutex())> guard(
+ sampler->getStatListMutex());
m_samplesize = dataBuffer->getBytesWritten();
sampleResources();
@@ -502,7 +507,8 @@
}
void StatArchiveWriter::resampleResources() {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(sampler->getStatListMutex());
+ std::lock_guard<decltype(sampler->getStatListMutex())> guard(
+ sampler->getStatListMutex());
std::vector<Statistics *> &statsList = sampler->getStatistics();
std::vector<Statistics *>::iterator statlistIter = statsList.begin();
while (statlistIter != statsList.end()) {
diff --git a/cppcache/src/statistics/StatArchiveWriter.hpp b/cppcache/src/statistics/StatArchiveWriter.hpp
index 3055fb0..4f8c2a3 100644
--- a/cppcache/src/statistics/StatArchiveWriter.hpp
+++ b/cppcache/src/statistics/StatArchiveWriter.hpp
@@ -32,7 +32,6 @@
#include "../NonCopyable.hpp"
#include "../SerializationRegistry.hpp"
#include "../util/Log.hpp"
-#include "HostStatSampler.hpp"
#include "StatisticDescriptor.hpp"
#include "StatisticDescriptorImpl.hpp"
#include "Statistics.hpp"
@@ -65,6 +64,8 @@
namespace geode {
namespace statistics {
+class HostStatSampler;
+
using apache::geode::client::CacheImpl;
using apache::geode::client::DataOutput;
using apache::geode::client::NonAssignable;
diff --git a/cppcache/src/statistics/StatisticsManager.cpp b/cppcache/src/statistics/StatisticsManager.cpp
index 06a7cc2..1f07ed1 100644
--- a/cppcache/src/statistics/StatisticsManager.cpp
+++ b/cppcache/src/statistics/StatisticsManager.cpp
@@ -19,17 +19,13 @@
#include <string>
-#include <ace/Guard_T.h>
-#include <ace/OS.h>
-#include <ace/Thread_Mutex.h>
-#include <ace/Time_Value.h>
-
#include <geode/Exception.hpp>
#include <geode/internal/geode_globals.hpp>
#include "../util/Log.hpp"
#include "AtomicStatisticsImpl.hpp"
#include "GeodeStatisticsFactory.hpp"
+#include "HostStatSampler.hpp"
#include "OsStatisticsImpl.hpp"
namespace apache {
@@ -51,13 +47,14 @@
std::unique_ptr<GeodeStatisticsFactory>(new GeodeStatisticsFactory(this));
try {
- if (m_sampler == nullptr && enabled) {
- m_sampler = new HostStatSampler(filePath, m_sampleIntervalMs, this, cache,
- statFileLimit, statDiskSpaceLimit);
+ if (enabled) {
+ m_sampler = std::unique_ptr<HostStatSampler>(
+ new HostStatSampler(filePath, m_sampleIntervalMs, this, cache,
+ statFileLimit, statDiskSpaceLimit));
m_sampler->start();
}
} catch (...) {
- delete m_sampler;
+ m_sampler = nullptr;
throw;
}
}
@@ -73,7 +70,7 @@
// List should be empty if close() is called on each Stats object
// If this is not done, delete all the pointers
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_statsListLock);
+ std::lock_guard<decltype(m_statsListLock)> guard(m_statsListLock);
int32_t count = static_cast<int32_t>(m_statsList.size());
if (count > 0) {
LOGFINEST("~StatisticsManager has found %d leftover statistics:", count);
@@ -109,21 +106,20 @@
}
}
-ACE_Recursive_Thread_Mutex& StatisticsManager::getListMutex() {
+std::recursive_mutex& StatisticsManager::getListMutex() {
return m_statsListLock;
}
void StatisticsManager::closeSampler() {
- if (m_sampler != nullptr) {
+ if (m_sampler) {
m_sampler->stop();
- delete m_sampler;
m_sampler = nullptr;
}
}
void StatisticsManager::addStatisticsToList(Statistics* stat) {
if (stat) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_statsListLock);
+ std::lock_guard<decltype(m_statsListLock)> guard(m_statsListLock);
m_statsList.push_back(stat);
/* Add to m_newlyAddedStatsList also so that a fresh traversal not needed
@@ -135,7 +131,7 @@
}
int32_t StatisticsManager::getStatListModCount() {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_statsListLock);
+ std::lock_guard<decltype(m_statsListLock)> guard(m_statsListLock);
return static_cast<int32_t>(m_statsList.size());
}
@@ -149,7 +145,7 @@
Statistics* StatisticsManager::findFirstStatisticsByType(
const StatisticsType* type) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_statsListLock);
+ std::lock_guard<decltype(m_statsListLock)> guard(m_statsListLock);
std::vector<Statistics*>::iterator start = m_statsList.begin();
while (start != m_statsList.end()) {
if (!((*start)->isClosed()) && ((*start)->getType() == type)) {
@@ -164,7 +160,7 @@
StatisticsType* type) {
std::vector<Statistics*> hits;
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_statsListLock);
+ std::lock_guard<decltype(m_statsListLock)> guard(m_statsListLock);
std::vector<Statistics*>::iterator start = m_statsList.begin();
while (start != m_statsList.end()) {
@@ -180,7 +176,7 @@
char* textId) {
std::vector<Statistics*> hits;
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_statsListLock);
+ std::lock_guard<decltype(m_statsListLock)> guard(m_statsListLock);
std::vector<Statistics*>::iterator start = m_statsList.begin();
while (start != m_statsList.end()) {
@@ -196,7 +192,7 @@
int64_t numericId) {
std::vector<Statistics*> hits;
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_statsListLock);
+ std::lock_guard<decltype(m_statsListLock)> guard(m_statsListLock);
std::vector<Statistics*>::iterator start = m_statsList.begin();
while (start != m_statsList.end()) {
@@ -209,7 +205,7 @@
}
Statistics* StatisticsManager::findStatisticsByUniqueId(int64_t uniqueId) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_statsListLock);
+ std::lock_guard<decltype(m_statsListLock)> guard(m_statsListLock);
std::vector<Statistics*>::iterator start = m_statsList.begin();
while (start != m_statsList.end()) {
diff --git a/cppcache/src/statistics/StatisticsManager.hpp b/cppcache/src/statistics/StatisticsManager.hpp
index 84ccd99..b91968d 100644
--- a/cppcache/src/statistics/StatisticsManager.hpp
+++ b/cppcache/src/statistics/StatisticsManager.hpp
@@ -21,6 +21,7 @@
#define GEODE_STATISTICS_STATISTICSMANAGER_H_
#include <memory>
+#include <mutex>
#include <vector>
#include <geode/ExceptionTypes.hpp>
@@ -28,7 +29,6 @@
#include "../AdminRegion.hpp"
#include "GeodeStatisticsFactory.hpp"
-#include "HostStatSampler.hpp"
#include "Statistics.hpp"
#include "StatisticsTypeImpl.hpp"
@@ -39,6 +39,7 @@
using apache::geode::client::AdminRegion;
class GeodeStatisticsFactory;
+class HostStatSampler;
/**
* Head Application Manager for Statistics Module.
@@ -50,7 +51,7 @@
std::chrono::milliseconds m_sampleIntervalMs;
// Statistics sampler
- HostStatSampler* m_sampler;
+ std::unique_ptr<HostStatSampler> m_sampler;
// Vector containing all the Stats objects
std::vector<Statistics*> m_statsList;
@@ -59,7 +60,7 @@
std::vector<Statistics*> m_newlyAddedStatsList;
// Mutex to lock the list of Stats
- ACE_Recursive_Thread_Mutex m_statsListLock;
+ std::recursive_mutex m_statsListLock;
std::shared_ptr<AdminRegion> m_adminRegion;
@@ -91,7 +92,7 @@
std::vector<Statistics*>& getNewlyAddedStatsList();
- ACE_Recursive_Thread_Mutex& getListMutex();
+ std::recursive_mutex& getListMutex();
/** Return the first instance that matches the type, or nullptr */
Statistics* findFirstStatisticsByType(const StatisticsType* type);
diff --git a/cppcache/src/statistics/StatisticsTypeImpl.cpp b/cppcache/src/statistics/StatisticsTypeImpl.cpp
index 0a65577..200cdde 100644
--- a/cppcache/src/statistics/StatisticsTypeImpl.cpp
+++ b/cppcache/src/statistics/StatisticsTypeImpl.cpp
@@ -19,8 +19,6 @@
#include <string>
-#include <ace/OS.h>
-
#include "../util/Log.hpp"
#include "StatisticDescriptorImpl.hpp"
@@ -44,15 +42,10 @@
throw NullPointerException(s);
}
if (statsLengthArg > MAX_DESCRIPTORS_PER_TYPE) {
- char buffer[100];
- ACE_OS::snprintf(buffer, 100, "%d", statsLengthArg);
- std::string temp(buffer);
- std::string s = "The requested descriptor count " + temp +
- " exceeds the maximum which is ";
- ACE_OS::snprintf(buffer, 100, "%d", MAX_DESCRIPTORS_PER_TYPE);
- std::string buf(buffer);
- s += buf + ".";
- throw IllegalArgumentException(s.c_str());
+ throw IllegalArgumentException(
+ "The requested descriptor count " + std::to_string(statsLengthArg) +
+ " exceeds the maximum which is " +
+ std::to_string(MAX_DESCRIPTORS_PER_TYPE) + ".");
}
this->name = nameArg;
this->description = descriptionArg;
@@ -65,14 +58,6 @@
// Concrete class required to set the ids only.
StatisticDescriptorImpl* sd =
dynamic_cast<StatisticDescriptorImpl*>(stats[i]);
- /* adongre
- * CID 28694: Dereference after null check (FORWARD_NULL)Comparing "sd" to
- * null implies that "sd" might be null.
- *
- * FIX : Do not check null from the dynamic_cast
- * catch the exception thrown by the dynamic_cast
- */
-
if (sd != nullptr) {
if (sd->getTypeCode() == INT_TYPE) {
sd->setId(intCount);
@@ -87,9 +72,8 @@
std::string str = stats[i]->getName();
StatisticsDescMap::iterator iterFind = statsDescMap.find(str);
if (iterFind != statsDescMap.end()) {
- std::string s = "Duplicate StatisticDescriptor named ";
- s += sd->getName();
- throw IllegalArgumentException(s.c_str());
+ throw IllegalArgumentException("Duplicate StatisticDescriptor named " +
+ sd->getName());
} else {
// statsDescMap.insert(make_pair(stats[i]->getName(), stats[i]));
statsDescMap.insert(
@@ -111,10 +95,8 @@
}
// same pointers are also stored in this map.
// So, Set the pointers to null.
- StatisticsDescMap::iterator iterFind = statsDescMap.begin();
- while (iterFind != statsDescMap.end()) {
- (*iterFind).second = nullptr;
- iterFind++;
+ for (auto& it : statsDescMap) {
+ it.second = nullptr;
}
} catch (...) {
}
@@ -141,7 +123,7 @@
std::string s = "There is no statistic named " + nameArg +
" in this statistics instance ";
LOGWARN("StatisticsTypeImpl::nameToDescriptor %s", s.c_str());
- throw IllegalArgumentException(s.c_str());
+ throw IllegalArgumentException(s);
} else {
return iterFind->second;
}
diff --git a/cppcache/src/util/Log.hpp b/cppcache/src/util/Log.hpp
index 7c80fcd..740a13d 100644
--- a/cppcache/src/util/Log.hpp
+++ b/cppcache/src/util/Log.hpp
@@ -157,13 +157,6 @@
static void setLogLevel(LogLevel level) { s_logLevel = level; }
/**
- * @return the name of the current log file.
- * NOTE: This function is for debugging only, as it is not completely
- * thread-safe!
- */
- static const char* logFileName();
-
- /**
* Initializes logging facility with given level and filenames.
* This method is called automatically within @ref DistributedSystem::connect
* with the log-file, log-level, and log-file-size system properties used as
@@ -260,6 +253,10 @@
if (errorEnabled()) put(LogLevel::Error, msg);
}
+ static void error(const std::string& msg) {
+ if (errorEnabled()) put(LogLevel::Error, msg.c_str());
+ }
+
/**
* Logs both a message and thrown exception.
* The message level is "error".
diff --git a/cppcache/src/util/chrono/time_point.hpp b/cppcache/src/util/chrono/time_point.hpp
new file mode 100644
index 0000000..5614598
--- /dev/null
+++ b/cppcache/src/util/chrono/time_point.hpp
@@ -0,0 +1,102 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#ifndef GEODE_UTIL_CHRONO_TIME_POINT_H_
+#define GEODE_UTIL_CHRONO_TIME_POINT_H_
+
+#include <iomanip>
+#include <sstream>
+
+#include "time_point.hpp"
+
+namespace apache {
+namespace geode {
+namespace util {
+namespace chrono {
+
+/**
+ * Wrapper around platform specific thread safe localtime functions.
+ * @param time to get local time for
+ * @return local time
+ */
+inline std::tm localtime(const time_t& time) {
+ std::tm localtime;
+#if defined(_WIN32)
+ localtime_s(&localtime, &time);
+#else
+ localtime_r(&time, &localtime);
+#endif
+ return localtime;
+}
+
+/**
+ * Wrapper around platform specific thread safe localtime functions.
+ * @param time to get local time for
+ * @return local time
+ */
+inline std::tm localtime(
+ const std::chrono::system_clock::time_point& time_point) {
+ return localtime(std::chrono::system_clock::to_time_t(time_point));
+}
+
+/**
+ * Produces string representation for given time.
+ * @param time to get string for
+ * @return string representation of given time
+ */
+inline std::string to_string(const time_t& time) {
+ std::stringstream stringstream;
+ const auto local = localtime(time);
+
+#if defined(_WIN32)
+ /*
+ Windows does not allow for time_t to be negative (in the past). Any negative
+ time_t will result in a tm with negative values. Converting this to a string
+ will result in an assertion failure. The original string converstion would
+ then result in something like -1/-1/1998. Rather than return a formatted but
+ invalid time we should return a string indicating and invalid time failed to
+ convert.
+
+ TODO: replace with C++20 std::chrono::format or other date library
+ */
+ if (-1 == local.tm_hour) {
+ return "invalid time";
+ }
+#endif
+
+ stringstream << std::put_time(&local, "%c %Z");
+ return stringstream.str();
+}
+
+/**
+ * Produces string representation for given time_point.
+ * @param time_point to get string for
+ * @return string representation of given time_point
+ */
+inline std::string to_string(
+ const std::chrono::system_clock::time_point& time_point) {
+ return to_string(std::chrono::system_clock::to_time_t(time_point));
+}
+
+} // namespace chrono
+} // namespace util
+} // namespace geode
+} // namespace apache
+
+#endif /* GEODE_UTIL_CHRONO_TIME_POINT_H_ */
diff --git a/cppcache/src/util/queue.hpp b/cppcache/src/util/queue.hpp
new file mode 100644
index 0000000..3e0092a
--- /dev/null
+++ b/cppcache/src/util/queue.hpp
@@ -0,0 +1,54 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#ifndef NATIVECLIENT_UTIL_QUEUE_H
+#define NATIVECLIENT_UTIL_QUEUE_H
+
+namespace apache {
+namespace geode {
+namespace client {
+namespace queue {
+
+/**
+ * Coalesce the contents of a Queue structure based on the given value. Will
+ * remove all values at the front of the queue that equal value.
+ *
+ * @tparam Queue type to coalesce
+ * @tparam Type of value to coalesce
+ * @param queue to coalesce
+ * @param value to coalesce
+ */
+template <class Queue, class Type>
+inline void coalesce(Queue& queue, const Type& value) {
+ while (!queue.empty()) {
+ const auto& next = queue.front();
+ if (next == value) {
+ queue.pop_front();
+ } else {
+ break;
+ }
+ }
+}
+
+} // namespace queue
+} // namespace client
+} // namespace geode
+} // namespace apache
+
+#endif // NATIVECLIENT_UTIL_QUEUE_H
diff --git a/cppcache/src/util/string.hpp b/cppcache/src/util/string.hpp
index 76869cc..f0b8d12 100644
--- a/cppcache/src/util/string.hpp
+++ b/cppcache/src/util/string.hpp
@@ -20,6 +20,7 @@
#ifndef GEODE_UTIL_STRING_H_
#define GEODE_UTIL_STRING_H_
+#include <cctype>
#include <codecvt>
#include <locale>
#include <string>
@@ -41,7 +42,7 @@
#if defined(_MSC_VER) && _MSC_VER >= 1900
/*
* Workaround for missing std:codecvt identifier.
- * https://connect.microsoft.com/VisualStudio/feedback/details/1403302
+ * https://stackoverflow.com/questions/32055357/visual-studio-c-2015-stdcodecvt-with-char16-t-or-char32-t
*/
auto int16String =
std::wstring_convert<std::codecvt_utf8_utf16<int16_t>, int16_t>{}
@@ -58,7 +59,7 @@
#if defined(_MSC_VER) && _MSC_VER >= 1900
/*
* Workaround for missing std:codecvt identifier.
- * https://connect.microsoft.com/VisualStudio/feedback/details/1403302
+ * https://stackoverflow.com/questions/32055357/visual-studio-c-2015-stdcodecvt-with-char16-t-or-char32-t
*/
auto data = reinterpret_cast<const int32_t*>(ucs4.data());
auto bytes =
@@ -82,7 +83,7 @@
#if defined(_MSC_VER) && _MSC_VER >= 1900
/*
* Workaround for missing std:codecvt identifier.
- * https://connect.microsoft.com/VisualStudio/feedback/details/1403302
+ * https://stackoverflow.com/questions/32055357/visual-studio-c-2015-stdcodecvt-with-char16-t-or-char32-t
*/
auto data = reinterpret_cast<const int32_t*>(ucs4);
auto bytes =
@@ -106,7 +107,7 @@
#if defined(_MSC_VER) && _MSC_VER >= 1900
/*
* Workaround for missing std:codecvt identifier.
- * https://connect.microsoft.com/VisualStudio/feedback/details/1403302
+ * https://stackoverflow.com/questions/32055357/visual-studio-c-2015-stdcodecvt-with-char16-t-or-char32-t
*/
auto data = reinterpret_cast<const char*>(utf16.data());
auto tmp =
@@ -129,7 +130,7 @@
#if defined(_MSC_VER) && _MSC_VER >= 1900
/*
* Workaround for missing std:codecvt identifier.
- * https://connect.microsoft.com/VisualStudio/feedback/details/1403302
+ * https://stackoverflow.com/questions/32055357/visual-studio-c-2015-stdcodecvt-with-char16-t-or-char32-t
*/
auto data = reinterpret_cast<const int16_t*>(utf16.data());
return std::wstring_convert<std::codecvt_utf8_utf16<int16_t>, int16_t>{}
@@ -144,7 +145,7 @@
#if defined(_MSC_VER) && _MSC_VER >= 1900
/*
* Workaround for missing std:codecvt identifier.
- * https://connect.microsoft.com/VisualStudio/feedback/details/1403302
+ * https://stackoverflow.com/questions/32055357/visual-studio-c-2015-stdcodecvt-with-char16-t-or-char32-t
*/
auto data = reinterpret_cast<const int32_t*>(ucs4.data());
return std::wstring_convert<std::codecvt_utf8<int32_t>, int32_t>{}.to_bytes(
@@ -155,6 +156,16 @@
#endif
}
+inline bool equal_ignore_case(const std::string& str1,
+ const std::string& str2) {
+ return ((str1.size() == str2.size()) &&
+ std::equal(str1.begin(), str1.end(), str2.begin(),
+ [](const char& c1, const char& c2) {
+ return (c1 == c2 ||
+ std::toupper(c1) == std::toupper(c2));
+ }));
+}
+
} // namespace client
} // namespace geode
} // namespace apache
diff --git a/cppcache/src/util/synchronized_map.hpp b/cppcache/src/util/synchronized_map.hpp
new file mode 100644
index 0000000..c3677e9
--- /dev/null
+++ b/cppcache/src/util/synchronized_map.hpp
@@ -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.
+ */
+
+#pragma once
+
+#ifndef GEODE_UTIL_SYNCHRONIZED_MAP_H_
+#define GEODE_UTIL_SYNCHRONIZED_MAP_H_
+
+#include <mutex>
+#include <utility>
+
+namespace apache {
+namespace geode {
+namespace client {
+
+/**
+ * Wrapper around std::map, std::unordered_map and other map like
+ * implementations.
+ *
+ * This is a very incomplete implementation. Add methods as needed.
+ *
+ * @tparam Map type to wrap.
+ * @tparam Mutex type to synchronize with. Defaults to std::recursive_mutex
+ */
+template <class Map, class Mutex = std::recursive_mutex>
+class synchronized_map {
+ private:
+ Map map_;
+ mutable Mutex mutex_;
+
+ public:
+ typedef Mutex mutex_type;
+ typedef Map map_type;
+ typedef typename Map::key_type key_type;
+ typedef typename Map::mapped_type mapped_type;
+ typedef typename Map::allocator_type allocator_type;
+ typedef typename Map::value_type value_type;
+ typedef typename Map::reference reference;
+ typedef typename Map::const_reference const_reference;
+ typedef typename Map::iterator iterator;
+ typedef typename Map::const_iterator const_iterator;
+ typedef typename Map::difference_type difference_type;
+ typedef typename Map::size_type size_type;
+
+ inline mutex_type& mutex() const noexcept { return mutex_; }
+
+ inline map_type& map() noexcept { return map_; }
+ inline const map_type& map() const noexcept { return map_; }
+
+ /**
+ * Allocates a Lock object around the Mutex and locks the Mutex.
+ *
+ * Example:
+ * \code{.cpp}
+ * auto&& guard = exampleMap.make_lock();
+ * \endcode
+ *
+ * Equivalent to:
+ * \code{.cpp}
+ * std::lock_guard<decltype(exampleMap)::mutex_type> guard(exampleMap.mutex);
+ * \endcode
+ *
+ * @tparam Lock type to allocate. Defaults to std::lock_guard.
+ * @return allocated Lock object with lock taken.
+ * @throws Any exception throws by Mutex::lock()
+ */
+ template <template <class...> class Lock = std::lock_guard>
+ inline Lock<Mutex> make_lock() const {
+ mutex_.lock();
+ return {mutex_, std::adopt_lock};
+ }
+
+ /**
+ * Allocates a Lock object around the Mutex passing any args to the Lock
+ * constructor.
+ *
+ * Example:
+ * \code{.cpp}
+ * auto&& guard = exampleMap.make_lock<std::unique_lock>(std::defer_lock);
+ * \endcode
+ *
+ * Equivalent to:
+ * \code{.cpp}
+ * std::unique_lock<decltype(exampleMap)::mutex_type> guard(exampleMap.mutex,
+ * std::defer_lock); \endcode
+ *
+ * @tparam Lock type to allocate. Defaults to std::lock_guard.
+ * @tparam Args types passed to Lock constructor.
+ * @param args values passed to Lock constructor.
+ * @return allocated Lock object.
+ * @throws Any exception throws by Lock constructors.
+ */
+ template <template <class...> class Lock = std::lock_guard, class... Args>
+ inline Lock<Mutex> make_lock(Args&&... args) const {
+ return {mutex_, std::forward<Args>(args)...};
+ }
+
+ template <class... Args>
+ inline std::pair<typename Map::iterator, bool> emplace(Args&&... args) {
+ std::lock_guard<Mutex> lock(mutex_);
+ return map_.emplace(std::forward<Args>(args)...);
+ }
+
+ inline size_type erase(const key_type& key) {
+ std::lock_guard<Mutex> lock(mutex_);
+ return map_.erase(key);
+ }
+
+ inline bool empty() const noexcept {
+ std::lock_guard<Mutex> lock(mutex_);
+ return map_.empty();
+ }
+
+ inline size_type size() const noexcept {
+ std::lock_guard<Mutex> lock(mutex_);
+ return map_.size();
+ }
+
+ inline void clear() noexcept {
+ std::lock_guard<Mutex> lock(mutex_);
+ map_.clear();
+ }
+
+ inline iterator find(const key_type& key) {
+ // std::lock_guard<Mutex> lock(mutex_);
+ return map_.find(key);
+ }
+
+ inline const_iterator find(const key_type& key) const {
+ // std::lock_guard<Mutex> lock(mutex_);
+ return map_.find(key);
+ }
+
+ inline iterator begin() noexcept { return map_.begin(); }
+ inline iterator end() noexcept { return map_.end(); }
+ inline const_iterator begin() const noexcept { return map_.begin(); }
+ inline const_iterator end() const noexcept { return map_.end(); }
+ inline const_iterator cbegin() const noexcept { return map_.begin(); }
+ inline const_iterator cend() const noexcept { return map_.end(); }
+
+ template <class InputIterator>
+ inline void insert(InputIterator first, InputIterator last) {
+ std::lock_guard<Mutex> lock(mutex_);
+ map_.insert(first, last);
+ }
+};
+
+} // namespace client
+} // namespace geode
+} // namespace apache
+
+#endif // GEODE_UTIL_SYNCHRONIZED_MAP_H_
diff --git a/cppcache/src/util/synchronized_set.hpp b/cppcache/src/util/synchronized_set.hpp
new file mode 100644
index 0000000..4029fb0
--- /dev/null
+++ b/cppcache/src/util/synchronized_set.hpp
@@ -0,0 +1,175 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#ifndef GEODE_UTIL_SYNCHRONIZED_SET_H_
+#define GEODE_UTIL_SYNCHRONIZED_SET_H_
+
+#include <mutex>
+#include <utility>
+
+namespace apache {
+namespace geode {
+namespace client {
+
+/**
+ * Wrapper around std::set, std::unordered_set and other set like
+ * implementations.
+ *
+ * This is a very incomplete implementation. Add methods as needed.
+ *
+ * @tparam Set type to wrap.
+ * @tparam Mutex type to synchronize with. Defaults to std::recursive_mutex
+ */
+template <class Set, class Mutex = std::recursive_mutex>
+class synchronized_set {
+ private:
+ Set set_;
+ mutable Mutex mutex_;
+
+ public:
+ typedef Mutex mutex_type;
+ typedef Set set_type;
+ typedef typename Set::key_type key_type;
+ typedef typename Set::allocator_type allocator_type;
+ typedef typename Set::value_type value_type;
+ typedef typename Set::reference reference;
+ typedef typename Set::const_reference const_reference;
+ typedef typename Set::iterator iterator;
+ typedef typename Set::const_iterator const_iterator;
+ typedef typename Set::difference_type difference_type;
+ typedef typename Set::size_type size_type;
+
+ inline mutex_type& mutex() const noexcept { return mutex_; }
+
+ inline set_type& set() noexcept { return set_; }
+ inline const set_type& set() const noexcept { return set_; }
+
+ /**
+ * Allocates a Lock object around the Mutex and locks the Mutex.
+ *
+ * Example:
+ * \code{.cpp}
+ * auto&& guard = exampleSet.make_lock();
+ * \endcode
+ *
+ * Equivalent to:
+ * \code{.cpp}
+ * std::lock_guard<decltype(exampleSet)::mutex_type> guard(exampleSet.mutex);
+ * \endcode
+ *
+ * @tparam Lock type to allocate. Defaults to std::lock_guard.
+ * @return allocated Lock object with lock taken.
+ * @throws Any exception throws by Mutex::lock()
+ */
+ template <template <class...> class Lock = std::lock_guard>
+ inline Lock<Mutex> make_lock() const {
+ mutex_.lock();
+ return {mutex_, std::adopt_lock};
+ }
+
+ /**
+ * Allocates a Lock object around the Mutex passing any args to the Lock
+ * constructor.
+ *
+ * Example:
+ * \code{.cpp}
+ * auto&& guard = exampleSet.make_lock<std::unique_lock>(std::defer_lock);
+ * \endcode
+ *
+ * Equivalent to:
+ * \code{.cpp}
+ * std::unique_lock<decltype(exampleSet)::mutex_type> guard(exampleSet.mutex,
+ * std::defer_lock); \endcode
+ *
+ * @tparam Lock type to allocate. Defaults to std::lock_guard.
+ * @tparam Args types passed to Lock constructor.
+ * @param args values passed to Lock constructor.
+ * @return allocated Lock object.
+ * @throws Any exception throws by Lock constructors.
+ */
+ template <template <class...> class Lock = std::lock_guard, class... Args>
+ inline Lock<Mutex> make_lock(Args&&... args) const {
+ return {mutex_, std::forward<Args>(args)...};
+ }
+
+ template <class... Args>
+ inline std::pair<typename Set::iterator, bool> emplace(Args&&... args) {
+ std::lock_guard<Mutex> lock(mutex_);
+ return set_.emplace(std::forward<Args>(args)...);
+ }
+
+ inline size_type erase(const key_type& key) {
+ std::lock_guard<Mutex> lock(mutex_);
+ return set_.erase(key);
+ }
+
+ inline bool empty() const noexcept {
+ std::lock_guard<Mutex> lock(mutex_);
+ return set_.empty();
+ }
+
+ inline size_type size() const noexcept {
+ std::lock_guard<Mutex> lock(mutex_);
+ return set_.size();
+ }
+
+ inline void clear() noexcept {
+ std::lock_guard<Mutex> lock(mutex_);
+ set_.clear();
+ }
+
+ inline iterator find(const key_type& key) {
+ // std::lock_guard<Mutex> lock(mutex_);
+ return set_.find(key);
+ }
+
+ inline const_iterator find(const key_type& key) const {
+ // std::lock_guard<Mutex> lock(mutex_);
+ return set_.find(key);
+ }
+
+ inline iterator begin() noexcept { return set_.begin(); }
+ inline iterator end() noexcept { return set_.end(); }
+ inline const_iterator begin() const noexcept { return set_.begin(); }
+ inline const_iterator end() const noexcept { return set_.end(); }
+ inline const_iterator cbegin() const noexcept { return set_.begin(); }
+ inline const_iterator cend() const noexcept { return set_.end(); }
+
+ template <class InputIterator>
+ inline void insert(InputIterator first, InputIterator last) {
+ std::lock_guard<Mutex> lock(mutex_);
+ set_.insert(first, last);
+ }
+
+ inline std::pair<iterator, bool> insert(value_type&& value) {
+ std::lock_guard<Mutex> lock(mutex_);
+ return set_.insert(std::move(value));
+ }
+
+ inline std::pair<iterator, bool> insert(const value_type& value) {
+ std::lock_guard<Mutex> lock(mutex_);
+ return set_.insert(value);
+ }
+};
+
+} // namespace client
+} // namespace geode
+} // namespace apache
+
+#endif // GEODE_UTIL_SYNCHRONIZED_SET_H_
diff --git a/cppcache/static/CMakeLists.txt b/cppcache/static/CMakeLists.txt
index b387871..9b8d663 100644
--- a/cppcache/static/CMakeLists.txt
+++ b/cppcache/static/CMakeLists.txt
@@ -13,7 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-cmake_minimum_required(VERSION 3.4)
project(apache-geode-static LANGUAGES CXX)
add_library(apache-geode-static STATIC ${SOURCES_ALL})
@@ -33,6 +32,19 @@
add_dependencies(client-libraries apache-geode-static)
+set_target_properties(apache-geode-static PROPERTIES
+ FOLDER cpp
+)
+
+if (MSVC)
+ cmake_minimum_required(VERSION 3.13)
+ set_target_properties(apache-geode-static PROPERTIES
+ INTERPROCEDURAL_OPTIMIZATION_RELEASE FALSE
+ INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO FALSE
+ )
+endif()
+
+set_target_properties(apache-geode-static PROPERTIES INTERPROCEDURAL_OPTIMIZATION FALSE)
# BEGIN Visual Studio organization
source_group("Header Files" REGULAR_EXPRESSION "\.(hpp|inl)$")
@@ -50,7 +62,6 @@
endif()
set_target_properties(apache-geode-static PROPERTIES
- FOLDER cpp
COTIRE_ENABLE_PRECOMPILED_HEADER TRUE
COTIRE_ADD_UNITY_BUILD TRUE
COTIRE_PREFIX_HEADER_IGNORE_PATH "${_COTIRE_PREFIX_HEADER_IGNORE_PATH}"
@@ -59,9 +70,6 @@
set_source_files_properties(cppcache/version.h PROPERTIES GENERATED TRUE)
cotire(apache-geode-static)
-else()
- set_target_properties(apache-geode-static PROPERTIES
- FOLDER cpp)
endif()
add_clangformat(apache-geode-static)
diff --git a/cppcache/test/CMakeLists.txt b/cppcache/test/CMakeLists.txt
index 9cb1e22..e9c2c9e 100644
--- a/cppcache/test/CMakeLists.txt
+++ b/cppcache/test/CMakeLists.txt
@@ -16,8 +16,6 @@
cmake_minimum_required( VERSION 3.10 )
project(apache-geode_unittests LANGUAGES CXX)
-file(GLOB_RECURSE SOURCES "*.cpp")
-
add_executable(apache-geode_unittests
AutoDeleteTest.cpp
ByteArray.cpp
@@ -42,8 +40,16 @@
RegionAttributesFactoryTest.cpp
SerializableCreateTests.cpp
StructSetTest.cpp
- TcrMessage_unittest.cpp
-)
+ TcrMessageTest.cpp
+ CacheableDateTest.cpp
+ util/synchronized_mapTest.cpp
+ util/synchronized_setTest.cpp
+ util/JavaModifiedUtf8Tests.cpp
+ util/functionalTests.cpp
+ util/chrono/durationTest.cpp
+ LocalRegionTest.cpp
+ util/queueTest.cpp
+ ThreadPoolTest.cpp)
target_compile_definitions(apache-geode_unittests
PUBLIC
@@ -57,9 +63,10 @@
target_link_libraries(apache-geode_unittests
PRIVATE
apache-geode-static
- GTest::GTest
- GTest::Main
+ GTest::gtest
+ GTest::gtest_main
Boost::boost
+ Boost::thread
_WarningsAsError
_CppCodeCoverage
)
diff --git a/cppcache/test/CacheableDateTest.cpp b/cppcache/test/CacheableDateTest.cpp
new file mode 100644
index 0000000..a22774e
--- /dev/null
+++ b/cppcache/test/CacheableDateTest.cpp
@@ -0,0 +1,125 @@
+/*
+ * 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 <chrono>
+#include <ctime>
+#include <iomanip>
+#include <sstream>
+
+#include <gtest/gtest.h>
+
+#include <geode/CacheableDate.hpp>
+
+using apache::geode::client::CacheableDate;
+
+TEST(CacheableDateTest, constructFrom_time_t_WithDefault) {
+ const CacheableDate cacheableDate;
+
+ EXPECT_EQ(0, cacheableDate.milliseconds());
+ EXPECT_EQ(0, static_cast<time_t>(cacheableDate));
+}
+
+TEST(CacheableDateTest, constructFrom_time_t) {
+ time_t time = 0;
+ std::time(&time);
+ CacheableDate cacheableDate(time);
+
+ EXPECT_EQ(time * 1000, cacheableDate.milliseconds());
+ EXPECT_EQ(time, static_cast<time_t>(cacheableDate));
+}
+
+TEST(CacheableDateTest, constructFrom_time_point) {
+ const auto timePoint = CacheableDate::clock::now();
+ const CacheableDate cacheableDate(timePoint);
+
+ const auto millisecondsSinceEpoch =
+ std::chrono::duration_cast<std::chrono::milliseconds>(
+ timePoint.time_since_epoch());
+ EXPECT_EQ(millisecondsSinceEpoch.count(), cacheableDate.milliseconds());
+ EXPECT_EQ(
+ millisecondsSinceEpoch,
+ static_cast<CacheableDate::time_point>(cacheableDate).time_since_epoch());
+
+ const auto duration = static_cast<CacheableDate::duration>(cacheableDate);
+ EXPECT_EQ(millisecondsSinceEpoch, duration);
+
+ const auto time = CacheableDate::clock::to_time_t(timePoint);
+ EXPECT_EQ(time, static_cast<time_t>(cacheableDate));
+}
+
+TEST(CacheableDateTest, constructFrom_duration) {
+ const auto duration = CacheableDate::duration(1000);
+ const CacheableDate cacheableDate(duration);
+
+ EXPECT_EQ(duration.count(), cacheableDate.milliseconds());
+
+ auto timePoint = static_cast<CacheableDate::time_point>(cacheableDate);
+ EXPECT_EQ(duration, timePoint.time_since_epoch());
+
+ EXPECT_EQ(duration, static_cast<CacheableDate::duration>(cacheableDate));
+
+ const auto time = CacheableDate::clock::to_time_t(timePoint);
+ EXPECT_EQ(time, static_cast<time_t>(cacheableDate));
+}
+
+TEST(CacheableDateTest, toString) {
+ // output from CacheableString::toString is local and timezone dependent.
+ const time_t time = 0;
+ const auto localtime = std::localtime(&time);
+ std::stringstream stringstream;
+ stringstream << std::put_time(localtime, "%c %Z");
+ const auto expectedString = stringstream.str();
+
+ const CacheableDate cacheableDate;
+
+ auto string = cacheableDate.toString();
+ EXPECT_EQ(expectedString, string);
+}
+
+TEST(CacheableDateTest, toStringWithFutureDate) {
+ // output from CacheableString::toString is local and timezone dependent.
+ const time_t time = 2147512508;
+ const auto localtime = std::localtime(&time);
+ std::stringstream stringstream;
+ stringstream << std::put_time(localtime, "%c %Z");
+ const auto expectedString = stringstream.str();
+
+ const CacheableDate cacheableDate(time);
+
+ auto string = cacheableDate.toString();
+ EXPECT_EQ(expectedString, string);
+}
+
+TEST(CacheableDateTest, toStringWithPastDate) {
+ // output from CacheableString::toString is local and timezone dependent.
+ const auto past =
+ std::chrono::system_clock::from_time_t(0) - std::chrono::hours(100);
+ const time_t time = std::chrono::system_clock::to_time_t(past);
+ const auto localtime = std::localtime(&time);
+#if defined(_WIN32)
+ const auto expectedString = std::string("invalid time");
+#else
+ std::stringstream stringstream;
+ stringstream << std::put_time(localtime, "%c %Z");
+ const auto expectedString = stringstream.str();
+#endif
+
+ const CacheableDate cacheableDate(time);
+
+ auto string = cacheableDate.toString();
+ EXPECT_EQ(expectedString, string);
+}
diff --git a/cppcache/test/ClientProxyMembershipIDFactoryTest.cpp b/cppcache/test/ClientProxyMembershipIDFactoryTest.cpp
index afaeda2..a1fc61f 100644
--- a/cppcache/test/ClientProxyMembershipIDFactoryTest.cpp
+++ b/cppcache/test/ClientProxyMembershipIDFactoryTest.cpp
@@ -15,17 +15,20 @@
* limitations under the License.
*/
-#include <ClientProxyMembershipIDFactory.hpp>
#include <regex>
+#include <boost/endian/conversion.hpp>
+
#include <gtest/gtest.h>
+#include "ClientProxyMembershipIDFactory.hpp"
+
using apache::geode::client::ClientProxyMembershipIDFactory;
TEST(ClientProxyMembershipIDFactoryTest, testCreate) {
ClientProxyMembershipIDFactory factory("myDs");
- auto hostAddr = htonl(1);
+ auto hostAddr = boost::endian::native_to_big(1);
auto id = factory.create("myHost", hostAddr, 2, "myClientID",
std::chrono::seconds(3));
ASSERT_NE(nullptr, id);
diff --git a/cppcache/test/DataOutputTest.cpp b/cppcache/test/DataOutputTest.cpp
index 1936d98..f3017d5 100644
--- a/cppcache/test/DataOutputTest.cpp
+++ b/cppcache/test/DataOutputTest.cpp
@@ -20,8 +20,6 @@
#include <limits>
#include <random>
-#include <boost/endian/conversion.hpp>
-
#include <gtest/gtest.h>
#include <geode/CacheFactory.hpp>
diff --git a/cppcache/test/LocalRegionTest.cpp b/cppcache/test/LocalRegionTest.cpp
new file mode 100644
index 0000000..4e7765e
--- /dev/null
+++ b/cppcache/test/LocalRegionTest.cpp
@@ -0,0 +1,79 @@
+/*
+ * 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 <gtest/gtest.h>
+
+#include <geode/AuthenticatedView.hpp>
+#include <geode/Cache.hpp>
+#include <geode/PoolManager.hpp>
+#include <geode/RegionFactory.hpp>
+#include <geode/RegionShortcut.hpp>
+
+using apache::geode::client::CacheClosedException;
+using apache::geode::client::CacheFactory;
+using apache::geode::client::RegionAttributesFactory;
+using apache::geode::client::RegionShortcut;
+
+/**
+ * Cache should close and throw exceptions on methods called after close.
+ */
+TEST(LocalRegionTest, subRegions) {
+ auto cache = CacheFactory{}.set("log-level", "none").create();
+
+ auto rootRegions = cache.rootRegions();
+ EXPECT_TRUE(rootRegions.empty());
+
+ auto rootRegion1 =
+ cache.createRegionFactory(RegionShortcut::LOCAL).create("rootRegion1");
+ EXPECT_NE(nullptr, rootRegion1);
+
+ auto subRegion11 = rootRegion1->createSubregion(
+ "subRegion11", RegionAttributesFactory().create());
+ EXPECT_NE(nullptr, subRegion11);
+
+ auto subRegion12 = rootRegion1->createSubregion(
+ "subRegion12", RegionAttributesFactory().create());
+ EXPECT_NE(nullptr, subRegion12);
+
+ auto subRegions1 = rootRegion1->subregions(true);
+ EXPECT_EQ(2, subRegions1.size());
+
+ auto rootRegion2 =
+ cache.createRegionFactory(RegionShortcut::LOCAL).create("rootRegion2");
+ EXPECT_NE(nullptr, rootRegion2);
+
+ auto subRegion21 = rootRegion2->createSubregion(
+ "subRegion21", RegionAttributesFactory().create());
+ EXPECT_NE(nullptr, subRegion21);
+
+ auto subRegion211 = subRegion21->createSubregion(
+ "subRegion211", RegionAttributesFactory().create());
+ EXPECT_NE(nullptr, subRegion211);
+
+ auto subRegions2 = rootRegion2->subregions(true);
+ EXPECT_EQ(2, subRegions2.size());
+
+ auto subRegions2NonRecursive = rootRegion2->subregions(false);
+ EXPECT_EQ(1, subRegions2NonRecursive.size());
+
+ auto rootRegion3 =
+ cache.createRegionFactory(RegionShortcut::LOCAL).create("rootRegion3");
+ EXPECT_NE(nullptr, rootRegion3);
+
+ auto subRegions3 = rootRegion3->subregions(true);
+ EXPECT_EQ(0, subRegions3.size());
+}
diff --git a/cppcache/test/TcrMessage_unittest.cpp b/cppcache/test/TcrMessageTest.cpp
similarity index 97%
rename from cppcache/test/TcrMessage_unittest.cpp
rename to cppcache/test/TcrMessageTest.cpp
index c6c2293..93d26a9 100644
--- a/cppcache/test/TcrMessage_unittest.cpp
+++ b/cppcache/test/TcrMessageTest.cpp
@@ -95,7 +95,7 @@
EXPECT_MESSAGE_EQ(
"0000000B0000003800000003\\h{8}"
"000000001300494E56414C49445F524547494F4E5F4E414D450000001200030000000000"
- "0000010300000000000000\\h{2}0000000400000003E8",
+ "00000103\\h{16}0000000400000003E8",
message);
}
@@ -114,11 +114,11 @@
EXPECT_MESSAGE_EQ(
"000000240000003800000003\\h{8}"
"000000001300494E56414C49445F524547494F4E5F4E414D450000001200030000000000"
- "0000010300000000000000\\h{2}0000000400000003E8",
+ "00000103\\h{16}0000000400000003E8",
message);
}
-TEST_F(TcrMessageTest, testQueryConstructorMessageDataCotent) {
+TEST_F(TcrMessageTest, testQueryConstructorMessageDataContent) {
using apache::geode::client::TcrMessageCloseCQ;
std::chrono::milliseconds messageResponseTimeout{1000};
@@ -131,7 +131,7 @@
EXPECT_MESSAGE_EQ(
"0000002D0000003100000003FFFFFFFF000000000C006D79526567696F6E4E616D650000"
- "0012000300000000000000010300000000000000\\h{2}0000000400000003E8",
+ "00120003000000000000000103\\h{16}0000000400000003E8",
message);
}
@@ -148,7 +148,7 @@
EXPECT_MESSAGE_EQ(
"000000220000003000000003FFFFFFFF000000000B0061526567696F6E4E616D65000000"
- "12000300000000000000010300000000000000\\h{2}0000000400000003E8",
+ "120003000000000000000103\\h{16}0000000400000003E8",
message);
}
@@ -165,7 +165,7 @@
EXPECT_MESSAGE_EQ(
"0000002C0000003000000003FFFFFFFF000000000B0061526567696F6E4E616D65000000"
- "12000300000000000000010300000000000000\\h{2}0000000400000003E8",
+ "120003000000000000000103\\h{16}0000000400000003E8",
message);
}
@@ -182,7 +182,7 @@
EXPECT_MESSAGE_EQ(
"0000002D0000003000000003FFFFFFFF000000000B0061526567696F6E4E616D65000000"
- "12000300000000000000010300000000000000\\h{2}0000000400000003E8",
+ "120003000000000000000103\\h{16}0000000400000003E8",
message);
}
@@ -271,7 +271,7 @@
EXPECT_MESSAGE_EQ(
"000000090000004800000005FFFFFFFF000000001300494E56414C49445F524547494F4E"
"5F4E414D4500000008015700056D796B6579000000010129000000010129000000120003"
- "000000000000000103000000000000000\\h{1}",
+ "000000000000000103\\h{16}",
message);
}
@@ -290,8 +290,8 @@
EXPECT_MESSAGE_EQ(
"000000530000003C00000003FFFFFFFF000000001300494E56414C49445F524547494F4E"
- "5F4E414D4500000008015700056D796B6579000000120003000000000000000103000000"
- "000000000\\h{1}",
+ "5F4E414D4500000008015700056D796B6579000000120003000000000000000103\\h{"
+ "16}",
message);
}
@@ -313,8 +313,8 @@
EXPECT_MESSAGE_EQ(
"000000070000005A00000007FFFFFFFF000000000C006D79526567696F6E4E616D650000"
"0001012900000004000000000000000008015700056D796B657900000002013500000000"
- "0A015700076D7976616C7565000000120003000000000000000103000000000000000\\h"
- "{1}",
+ "0A015700076D7976616C7565000000120003000000000000000103\\h"
+ "{16}",
message);
}
diff --git a/cppcache/test/ThreadPoolTest.cpp b/cppcache/test/ThreadPoolTest.cpp
new file mode 100644
index 0000000..f62bf61
--- /dev/null
+++ b/cppcache/test/ThreadPoolTest.cpp
@@ -0,0 +1,56 @@
+/*
+ * 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 <atomic>
+#include <chrono>
+#include <condition_variable>
+#include <deque>
+#include <mutex>
+#include <thread>
+
+#include <gtest/gtest.h>
+
+#include "ThreadPool.hpp"
+
+using apache::geode::client::Callable;
+using apache::geode::client::ThreadPool;
+
+class TestCallable : public Callable {
+ public:
+ TestCallable() : called_(0) {}
+
+ void call() {
+ std::lock_guard<decltype(mutex_)> lock(mutex_);
+ called_++;
+ condition_.notify_all();
+ }
+
+ size_t called_;
+ std::mutex mutex_;
+ std::condition_variable condition_;
+};
+
+TEST(ThreadPoolTest, callableIsCalled) {
+ ThreadPool threadPool(1);
+
+ auto c = std::make_shared<TestCallable>();
+ threadPool.perform(c);
+ std::unique_lock<decltype(c->mutex_)> lock(c->mutex_);
+ c->condition_.wait(lock, [&] { return c->called_ > 0; });
+
+ ASSERT_EQ(1, c->called_);
+}
diff --git a/cppcache/test/util/JavaModifiedUtf8Tests.cpp b/cppcache/test/util/JavaModifiedUtf8Tests.cpp
index 9f37ccc..7f6bda0 100644
--- a/cppcache/test/util/JavaModifiedUtf8Tests.cpp
+++ b/cppcache/test/util/JavaModifiedUtf8Tests.cpp
@@ -16,14 +16,14 @@
*/
#include <string>
+#include <util/JavaModifiedUtf8.hpp>
#include <gtest/gtest.h>
-#include <util/JavaModifiedUtf8.hpp>
-
#include "../ByteArray.hpp"
-using namespace apache::geode::client::internal;
+using apache::geode::client::ByteArray;
+using apache::geode::client::internal::JavaModifiedUtf8;
TEST(JavaModifiedUtf8Tests, EncodedLengthFromUtf8) {
EXPECT_EQ(27, JavaModifiedUtf8::encodedLength("You had me at meat tornado!"));
diff --git a/cppcache/test/util/TestableRecursiveMutex.hpp b/cppcache/test/util/TestableRecursiveMutex.hpp
new file mode 100644
index 0000000..8db755c
--- /dev/null
+++ b/cppcache/test/util/TestableRecursiveMutex.hpp
@@ -0,0 +1,63 @@
+/*
+ * 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 <atomic>
+#include <mutex>
+
+class TestableRecursiveMutex {
+ public:
+ std::recursive_mutex mutex_;
+ std::atomic<int32_t> recursive_depth_;
+ std::atomic<int32_t> lock_count_;
+ std::atomic<int32_t> unlock_count_;
+ std::atomic<int32_t> try_lock_count_;
+
+ TestableRecursiveMutex() noexcept
+ : recursive_depth_(0),
+ lock_count_(0),
+ unlock_count_(0),
+ try_lock_count_(0) {}
+
+ void lock() {
+ mutex_.lock();
+ ++recursive_depth_;
+ ++lock_count_;
+ }
+
+ void unlock() {
+ mutex_.unlock();
+ --recursive_depth_;
+ ++unlock_count_;
+ }
+
+ bool try_lock() {
+ bool locked = false;
+ if ((locked = mutex_.try_lock())) {
+ ++recursive_depth_;
+ }
+
+ ++try_lock_count_;
+ return locked;
+ }
+
+ void resetCounters() {
+ recursive_depth_ = 0;
+ lock_count_ = 0;
+ unlock_count_ = 0;
+ try_lock_count_ = 0;
+ }
+};
diff --git a/cppcache/test/util/chrono/durationTest.cpp b/cppcache/test/util/chrono/durationTest.cpp
index 262d212..b436bf7 100644
--- a/cppcache/test/util/chrono/durationTest.cpp
+++ b/cppcache/test/util/chrono/durationTest.cpp
@@ -15,8 +15,8 @@
* limitations under the License.
*/
-#include <chrono>
#include <algorithm>
+#include <chrono>
#include <gtest/gtest.h>
@@ -24,8 +24,10 @@
#include "util/chrono/duration_bounds.hpp"
-using namespace apache::geode::internal::chrono::duration;
-using namespace apache::geode::util::chrono::duration;
+using apache::geode::internal::chrono::duration::_ceil;
+using apache::geode::internal::chrono::duration::from_string;
+using apache::geode::internal::chrono::duration::to_string;
+using apache::geode::util::chrono::duration::assert_bounds;
TEST(util_chrono_durationTest, ceil) {
EXPECT_EQ(std::chrono::seconds(1),
diff --git a/cppcache/test/util/functionalTests.cpp b/cppcache/test/util/functionalTests.cpp
index 410ccbc..1cd483c 100644
--- a/cppcache/test/util/functionalTests.cpp
+++ b/cppcache/test/util/functionalTests.cpp
@@ -21,7 +21,7 @@
#include <geode/internal/functional.hpp>
-using namespace apache::geode::client::internal;
+using apache::geode::client::internal::geode_hash;
TEST(string, geode_hash) {
auto&& hash = geode_hash<std::string>{};
@@ -32,4 +32,12 @@
EXPECT_EQ(48, hash("0"));
EXPECT_EQ(57, hash("9"));
EXPECT_EQ(1077910243, hash("supercalifragilisticexpialidocious"));
+
+ EXPECT_EQ(1544552287, hash(u8"You had me at meat tornad\u00F6!\U000F0000"));
+
+ auto str = std::string("You had me at");
+ str.push_back(0);
+ str.append(u8"meat tornad\u00F6!\U000F0000");
+
+ EXPECT_EQ(701776767, hash(str));
}
diff --git a/cppcache/integration-test-2/framework/Framework.cpp b/cppcache/test/util/queueTest.cpp
similarity index 67%
copy from cppcache/integration-test-2/framework/Framework.cpp
copy to cppcache/test/util/queueTest.cpp
index fe6942a..b5d6861 100644
--- a/cppcache/integration-test-2/framework/Framework.cpp
+++ b/cppcache/test/util/queueTest.cpp
@@ -15,4 +15,22 @@
* limitations under the License.
*/
-#include "Framework.h"
+#include <deque>
+
+#include <gtest/gtest.h>
+
+#include "util/queue.hpp"
+
+using apache::geode::client::queue::coalesce;
+
+TEST(util_queueTest, coalesce) {
+ auto queue = std::deque<int32_t>({1, 1, 1, 2, 3, 4});
+
+ coalesce(queue, 1);
+ EXPECT_EQ(2, queue.front());
+ EXPECT_EQ(3, queue.size());
+
+ coalesce(queue, 3);
+ EXPECT_EQ(2, queue.front());
+ EXPECT_EQ(3, queue.size());
+}
diff --git a/cppcache/test/util/synchronized_mapTest.cpp b/cppcache/test/util/synchronized_mapTest.cpp
new file mode 100644
index 0000000..2a6f79c
--- /dev/null
+++ b/cppcache/test/util/synchronized_mapTest.cpp
@@ -0,0 +1,373 @@
+/*
+ * 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 <atomic>
+#include <mutex>
+#include <unordered_map>
+
+#include <gtest/gtest.h>
+
+#include "TestableRecursiveMutex.hpp"
+#include "util/synchronized_map.hpp"
+
+using apache::geode::client::synchronized_map;
+
+TEST(synchronized_mapTest, emplaceLocks) {
+ synchronized_map<std::unordered_map<std::string, std::string>,
+ TestableRecursiveMutex>
+ map;
+
+ auto result = map.emplace("a", "A");
+ ASSERT_EQ(true, result.second);
+ EXPECT_EQ("a", result.first->first);
+ EXPECT_EQ("A", result.first->second);
+ EXPECT_EQ(0, map.mutex().recursive_depth_);
+ EXPECT_EQ(1, map.mutex().lock_count_);
+ EXPECT_EQ(1, map.mutex().unlock_count_);
+
+ result = map.emplace("b", "B");
+ ASSERT_EQ(true, result.second);
+ EXPECT_EQ("b", result.first->first);
+ EXPECT_EQ("B", result.first->second);
+ EXPECT_EQ(0, map.mutex().recursive_depth_);
+ EXPECT_EQ(2, map.mutex().lock_count_);
+ EXPECT_EQ(2, map.mutex().unlock_count_);
+}
+
+TEST(synchronized_mapTest, eraseKeyLocks) {
+ synchronized_map<std::unordered_map<std::string, std::string>,
+ TestableRecursiveMutex>
+ map;
+
+ map.emplace("a", "A");
+ map.mutex().resetCounters();
+
+ auto result = map.erase("a");
+ ASSERT_EQ(1, result);
+ EXPECT_EQ(0, map.mutex().recursive_depth_);
+ EXPECT_EQ(1, map.mutex().lock_count_);
+ EXPECT_EQ(1, map.mutex().unlock_count_);
+}
+
+TEST(synchronized_mapTest, beginLocks) {
+ synchronized_map<std::unordered_map<std::string, std::string>,
+ TestableRecursiveMutex>
+ map;
+
+ map.emplace("a", "A");
+ map.mutex().resetCounters();
+
+ const auto& begin = map.begin();
+
+ ASSERT_EQ("a", begin->first);
+
+ EXPECT_EQ(0, map.mutex().recursive_depth_);
+ EXPECT_EQ(0, map.mutex().lock_count_);
+ EXPECT_EQ(0, map.mutex().unlock_count_);
+}
+
+TEST(synchronized_mapTest, beginConstLocks) {
+ synchronized_map<std::unordered_map<std::string, std::string>,
+ TestableRecursiveMutex>
+ map;
+
+ map.emplace("a", "A");
+ map.mutex().resetCounters();
+
+ const auto& constMap = map;
+ const auto& begin = constMap.begin();
+
+ ASSERT_EQ("a", begin->first);
+
+ EXPECT_EQ(0, map.mutex().recursive_depth_);
+ EXPECT_EQ(0, map.mutex().lock_count_);
+ EXPECT_EQ(0, map.mutex().unlock_count_);
+}
+
+TEST(synchronized_mapTest, cbeginLocks) {
+ synchronized_map<std::unordered_map<std::string, std::string>,
+ TestableRecursiveMutex>
+ map;
+
+ map.emplace("a", "A");
+ map.mutex().resetCounters();
+
+ const auto& begin = map.cbegin();
+
+ ASSERT_EQ("a", begin->first);
+
+ EXPECT_EQ(0, map.mutex().recursive_depth_);
+ EXPECT_EQ(0, map.mutex().lock_count_);
+ EXPECT_EQ(0, map.mutex().unlock_count_);
+}
+
+TEST(synchronized_mapTest, endLocks) {
+ synchronized_map<std::unordered_map<std::string, std::string>,
+ TestableRecursiveMutex>
+ map;
+
+ map.emplace("a", "A");
+ map.mutex().resetCounters();
+
+ const auto& begin = map.begin();
+ const auto& end = map.end();
+
+ ASSERT_NE(begin, end);
+
+ EXPECT_EQ(0, map.mutex().recursive_depth_);
+ EXPECT_EQ(0, map.mutex().lock_count_);
+ EXPECT_EQ(0, map.mutex().unlock_count_);
+}
+
+TEST(synchronized_mapTest, endConsLocks) {
+ synchronized_map<std::unordered_map<std::string, std::string>,
+ TestableRecursiveMutex>
+ map;
+
+ map.emplace("a", "A");
+ map.mutex().resetCounters();
+
+ const auto& constMap = map;
+ const auto& begin = constMap.begin();
+ const auto& end = constMap.end();
+
+ ASSERT_NE(begin, end);
+
+ EXPECT_EQ(0, map.mutex().recursive_depth_);
+ EXPECT_EQ(0, map.mutex().lock_count_);
+ EXPECT_EQ(0, map.mutex().unlock_count_);
+}
+
+TEST(synchronized_mapTest, cendLocks) {
+ synchronized_map<std::unordered_map<std::string, std::string>,
+ TestableRecursiveMutex>
+ map;
+
+ map.emplace("a", "A");
+ map.mutex().resetCounters();
+
+ const auto& begin = map.cbegin();
+ const auto& end = map.cend();
+
+ ASSERT_NE(begin, end);
+
+ EXPECT_EQ(0, map.mutex().recursive_depth_);
+ EXPECT_EQ(0, map.mutex().lock_count_);
+ EXPECT_EQ(0, map.mutex().unlock_count_);
+}
+
+TEST(synchronized_mapTest, emptyLocks) {
+ synchronized_map<std::unordered_map<std::string, std::string>,
+ TestableRecursiveMutex>
+ map;
+
+ ASSERT_TRUE(map.empty());
+ EXPECT_EQ(0, map.mutex().recursive_depth_);
+ EXPECT_EQ(1, map.mutex().lock_count_);
+ EXPECT_EQ(1, map.mutex().unlock_count_);
+
+ map.emplace("a", "A");
+ map.mutex().resetCounters();
+
+ ASSERT_FALSE(map.empty());
+ EXPECT_EQ(0, map.mutex().recursive_depth_);
+ EXPECT_EQ(1, map.mutex().lock_count_);
+ EXPECT_EQ(1, map.mutex().unlock_count_);
+}
+
+TEST(synchronized_mapTest, sizeLocks) {
+ synchronized_map<std::unordered_map<std::string, std::string>,
+ TestableRecursiveMutex>
+ map;
+
+ ASSERT_EQ(0, map.size());
+ EXPECT_EQ(0, map.mutex().recursive_depth_);
+ EXPECT_EQ(1, map.mutex().lock_count_);
+ EXPECT_EQ(1, map.mutex().unlock_count_);
+
+ map.emplace("a", "A");
+ map.mutex().resetCounters();
+
+ ASSERT_EQ(1, map.size());
+ EXPECT_EQ(0, map.mutex().recursive_depth_);
+ EXPECT_EQ(1, map.mutex().lock_count_);
+ EXPECT_EQ(1, map.mutex().unlock_count_);
+}
+
+TEST(synchronized_mapTest, clearLocks) {
+ synchronized_map<std::unordered_map<std::string, std::string>,
+ TestableRecursiveMutex>
+ map;
+
+ map.emplace("a", "A");
+ map.mutex().resetCounters();
+
+ map.clear();
+ EXPECT_EQ(0, map.mutex().recursive_depth_);
+ EXPECT_EQ(1, map.mutex().lock_count_);
+ EXPECT_EQ(1, map.mutex().unlock_count_);
+ EXPECT_TRUE(map.empty());
+}
+
+TEST(synchronized_mapTest, findNotLocked) {
+ synchronized_map<std::unordered_map<std::string, std::string>,
+ TestableRecursiveMutex>
+ map;
+
+ map.emplace("a", "A");
+ map.mutex().resetCounters();
+
+ {
+ std::lock_guard<decltype(map)::mutex_type> lock(map.mutex());
+ const auto& entry = map.find("a");
+ EXPECT_EQ(1, map.mutex().recursive_depth_);
+ EXPECT_EQ(1, map.mutex().lock_count_);
+ EXPECT_EQ(0, map.mutex().unlock_count_);
+ EXPECT_EQ("a", entry->first);
+ }
+ EXPECT_EQ(0, map.mutex().recursive_depth_);
+ EXPECT_EQ(1, map.mutex().lock_count_);
+ EXPECT_EQ(1, map.mutex().unlock_count_);
+}
+
+TEST(synchronized_mapTest, findConstNotLocked) {
+ synchronized_map<std::unordered_map<std::string, std::string>,
+ TestableRecursiveMutex>
+ map;
+
+ map.emplace("a", "A");
+ map.mutex().resetCounters();
+
+ {
+ auto&& lock = map.make_lock();
+ const auto& constMap = map;
+ const auto& entry = constMap.find("a");
+ EXPECT_EQ(1, map.mutex().recursive_depth_);
+ EXPECT_EQ(1, map.mutex().lock_count_);
+ EXPECT_EQ(0, map.mutex().unlock_count_);
+ EXPECT_EQ("a", entry->first);
+ }
+ EXPECT_EQ(0, map.mutex().recursive_depth_);
+ EXPECT_EQ(1, map.mutex().lock_count_);
+ EXPECT_EQ(1, map.mutex().unlock_count_);
+}
+
+TEST(synchronized_mapTest, iteratorNotLocked) {
+ synchronized_map<std::unordered_map<std::string, std::string>,
+ TestableRecursiveMutex>
+ map;
+
+ map.emplace("a", "A");
+ map.emplace("b", "B");
+ map.mutex().resetCounters();
+
+ auto& mutex = map.mutex();
+ EXPECT_EQ(0, mutex.recursive_depth_);
+ EXPECT_EQ(0, mutex.recursive_depth_);
+ EXPECT_EQ(0, map.mutex().lock_count_);
+ EXPECT_EQ(0, map.mutex().unlock_count_);
+
+ {
+ for (const auto& entry : map) {
+ EXPECT_EQ(0, mutex.recursive_depth_);
+ EXPECT_EQ(0, map.mutex().lock_count_);
+ EXPECT_EQ(0, map.mutex().unlock_count_);
+ }
+ }
+ EXPECT_EQ(0, mutex.recursive_depth_);
+ EXPECT_EQ(0, map.mutex().lock_count_);
+ EXPECT_EQ(0, map.mutex().unlock_count_);
+
+ {
+ std::lock_guard<decltype(map)::mutex_type> lock(mutex);
+ for (const auto& entry : map) {
+ EXPECT_EQ(1, mutex.recursive_depth_);
+ EXPECT_EQ(1, map.mutex().lock_count_);
+ EXPECT_EQ(0, map.mutex().unlock_count_);
+ }
+ }
+ EXPECT_EQ(0, mutex.recursive_depth_);
+ EXPECT_EQ(1, map.mutex().lock_count_);
+ EXPECT_EQ(1, map.mutex().unlock_count_);
+}
+
+TEST(synchronized_mapTest, make_lockDefault) {
+ synchronized_map<std::unordered_map<std::string, std::string>,
+ TestableRecursiveMutex>
+ map;
+
+ {
+ auto&& lock = map.make_lock();
+ EXPECT_EQ(1, map.mutex().recursive_depth_);
+ EXPECT_EQ(1, map.mutex().lock_count_);
+ EXPECT_EQ(0, map.mutex().unlock_count_);
+ }
+ EXPECT_EQ(0, map.mutex().recursive_depth_);
+ EXPECT_EQ(1, map.mutex().lock_count_);
+ EXPECT_EQ(1, map.mutex().unlock_count_);
+}
+
+TEST(synchronized_mapTest, make_lock_WithUniqueLock) {
+ synchronized_map<std::unordered_map<std::string, std::string>,
+ TestableRecursiveMutex>
+ map;
+
+ {
+ auto&& lock = map.make_lock<std::unique_lock>();
+ EXPECT_EQ(1, map.mutex().recursive_depth_);
+ EXPECT_EQ(1, map.mutex().lock_count_);
+ EXPECT_EQ(0, map.mutex().unlock_count_);
+ }
+ EXPECT_EQ(0, map.mutex().recursive_depth_);
+ EXPECT_EQ(1, map.mutex().lock_count_);
+ EXPECT_EQ(1, map.mutex().unlock_count_);
+}
+
+TEST(synchronized_mapTest, make_lock_WithUniqueLockDefered) {
+ synchronized_map<std::unordered_map<std::string, std::string>,
+ TestableRecursiveMutex>
+ map;
+
+ {
+ auto&& lock = map.make_lock<std::unique_lock>(std::defer_lock);
+ EXPECT_EQ(0, map.mutex().recursive_depth_);
+ EXPECT_EQ(0, map.mutex().lock_count_);
+ EXPECT_EQ(0, map.mutex().unlock_count_);
+ lock.lock();
+ EXPECT_EQ(1, map.mutex().recursive_depth_);
+ EXPECT_EQ(1, map.mutex().lock_count_);
+ EXPECT_EQ(0, map.mutex().unlock_count_);
+ }
+ EXPECT_EQ(0, map.mutex().recursive_depth_);
+ EXPECT_EQ(1, map.mutex().lock_count_);
+ EXPECT_EQ(1, map.mutex().unlock_count_);
+}
+
+TEST(synchronized_mapTest, insertIteratorIteratorLocks) {
+ std::unordered_map<std::string, std::string> source = {{"a", "A"},
+ {"b", "B"}};
+
+ synchronized_map<std::unordered_map<std::string, std::string>,
+ TestableRecursiveMutex>
+ map;
+
+ map.insert(source.begin(), source.end());
+ EXPECT_EQ(0, map.mutex().recursive_depth_);
+ EXPECT_EQ(1, map.mutex().lock_count_);
+ EXPECT_EQ(1, map.mutex().unlock_count_);
+ EXPECT_EQ(2, map.size());
+}
diff --git a/cppcache/test/util/synchronized_setTest.cpp b/cppcache/test/util/synchronized_setTest.cpp
new file mode 100644
index 0000000..98f8563
--- /dev/null
+++ b/cppcache/test/util/synchronized_setTest.cpp
@@ -0,0 +1,373 @@
+/*
+ * 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 <atomic>
+#include <mutex>
+#include <unordered_set>
+
+#include <gtest/gtest.h>
+
+#include "TestableRecursiveMutex.hpp"
+#include "util/synchronized_set.hpp"
+
+using apache::geode::client::synchronized_set;
+
+TEST(synchronized_setTest, emplaceLocks) {
+ synchronized_set<std::unordered_set<std::string>, TestableRecursiveMutex> set;
+
+ auto result = set.emplace("a");
+ ASSERT_EQ(true, result.second);
+ EXPECT_EQ("a", *result.first);
+ EXPECT_EQ(0, set.mutex().recursive_depth_);
+ EXPECT_EQ(1, set.mutex().lock_count_);
+ EXPECT_EQ(1, set.mutex().unlock_count_);
+
+ result = set.emplace("b");
+ ASSERT_EQ(true, result.second);
+ EXPECT_EQ("b", *result.first);
+ EXPECT_EQ(0, set.mutex().recursive_depth_);
+ EXPECT_EQ(2, set.mutex().lock_count_);
+ EXPECT_EQ(2, set.mutex().unlock_count_);
+}
+
+TEST(synchronized_setTest, eraseKeyLocks) {
+ synchronized_set<std::unordered_set<std::string>, TestableRecursiveMutex> set;
+
+ set.emplace("a");
+ set.mutex().resetCounters();
+
+ auto result = set.erase("a");
+ ASSERT_EQ(1, result);
+ EXPECT_EQ(0, set.mutex().recursive_depth_);
+ EXPECT_EQ(1, set.mutex().lock_count_);
+ EXPECT_EQ(1, set.mutex().unlock_count_);
+}
+
+TEST(synchronized_setTest, beginLocks) {
+ synchronized_set<std::unordered_set<std::string>, TestableRecursiveMutex> set;
+
+ set.emplace("a");
+ set.mutex().resetCounters();
+
+ const auto& begin = set.begin();
+
+ ASSERT_EQ("a", *begin);
+
+ EXPECT_EQ(0, set.mutex().recursive_depth_);
+ EXPECT_EQ(0, set.mutex().lock_count_);
+ EXPECT_EQ(0, set.mutex().unlock_count_);
+}
+
+TEST(synchronized_setTest, beginConstLocks) {
+ synchronized_set<std::unordered_set<std::string>, TestableRecursiveMutex> set;
+
+ set.emplace("a");
+ set.mutex().resetCounters();
+
+ const auto& constMap = set;
+ const auto& begin = constMap.begin();
+
+ ASSERT_EQ("a", *begin);
+
+ EXPECT_EQ(0, set.mutex().recursive_depth_);
+ EXPECT_EQ(0, set.mutex().lock_count_);
+ EXPECT_EQ(0, set.mutex().unlock_count_);
+}
+
+TEST(synchronized_setTest, cbeginLocks) {
+ synchronized_set<std::unordered_set<std::string>, TestableRecursiveMutex> set;
+
+ set.emplace("a");
+ set.mutex().resetCounters();
+
+ const auto& begin = set.cbegin();
+
+ ASSERT_EQ("a", *begin);
+
+ EXPECT_EQ(0, set.mutex().recursive_depth_);
+ EXPECT_EQ(0, set.mutex().lock_count_);
+ EXPECT_EQ(0, set.mutex().unlock_count_);
+}
+
+TEST(synchronized_setTest, endLocks) {
+ synchronized_set<std::unordered_set<std::string>, TestableRecursiveMutex> set;
+
+ set.emplace("a");
+ set.mutex().resetCounters();
+
+ const auto& begin = set.begin();
+ const auto& end = set.end();
+
+ ASSERT_NE(begin, end);
+
+ EXPECT_EQ(0, set.mutex().recursive_depth_);
+ EXPECT_EQ(0, set.mutex().lock_count_);
+ EXPECT_EQ(0, set.mutex().unlock_count_);
+}
+
+TEST(synchronized_setTest, endConsLocks) {
+ synchronized_set<std::unordered_set<std::string>, TestableRecursiveMutex> set;
+
+ set.emplace("a");
+ set.mutex().resetCounters();
+
+ const auto& constMap = set;
+ const auto& begin = constMap.begin();
+ const auto& end = constMap.end();
+
+ ASSERT_NE(begin, end);
+
+ EXPECT_EQ(0, set.mutex().recursive_depth_);
+ EXPECT_EQ(0, set.mutex().lock_count_);
+ EXPECT_EQ(0, set.mutex().unlock_count_);
+}
+
+TEST(synchronized_setTest, cendLocks) {
+ synchronized_set<std::unordered_set<std::string>, TestableRecursiveMutex> set;
+
+ set.emplace("a");
+ set.mutex().resetCounters();
+
+ const auto& begin = set.cbegin();
+ const auto& end = set.cend();
+
+ ASSERT_NE(begin, end);
+
+ EXPECT_EQ(0, set.mutex().recursive_depth_);
+ EXPECT_EQ(0, set.mutex().lock_count_);
+ EXPECT_EQ(0, set.mutex().unlock_count_);
+}
+
+TEST(synchronized_setTest, emptyLocks) {
+ synchronized_set<std::unordered_set<std::string>, TestableRecursiveMutex> set;
+
+ ASSERT_TRUE(set.empty());
+ EXPECT_EQ(0, set.mutex().recursive_depth_);
+ EXPECT_EQ(1, set.mutex().lock_count_);
+ EXPECT_EQ(1, set.mutex().unlock_count_);
+
+ set.emplace("a");
+ set.mutex().resetCounters();
+
+ ASSERT_FALSE(set.empty());
+ EXPECT_EQ(0, set.mutex().recursive_depth_);
+ EXPECT_EQ(1, set.mutex().lock_count_);
+ EXPECT_EQ(1, set.mutex().unlock_count_);
+}
+
+TEST(synchronized_setTest, sizeLocks) {
+ synchronized_set<std::unordered_set<std::string>, TestableRecursiveMutex> set;
+
+ ASSERT_EQ(0, set.size());
+ EXPECT_EQ(0, set.mutex().recursive_depth_);
+ EXPECT_EQ(1, set.mutex().lock_count_);
+ EXPECT_EQ(1, set.mutex().unlock_count_);
+
+ set.emplace("a");
+ set.mutex().resetCounters();
+
+ ASSERT_EQ(1, set.size());
+ EXPECT_EQ(0, set.mutex().recursive_depth_);
+ EXPECT_EQ(1, set.mutex().lock_count_);
+ EXPECT_EQ(1, set.mutex().unlock_count_);
+}
+
+TEST(synchronized_setTest, clearLocks) {
+ synchronized_set<std::unordered_set<std::string>, TestableRecursiveMutex> set;
+
+ set.emplace("a");
+ set.mutex().resetCounters();
+
+ set.clear();
+ EXPECT_EQ(0, set.mutex().recursive_depth_);
+ EXPECT_EQ(1, set.mutex().lock_count_);
+ EXPECT_EQ(1, set.mutex().unlock_count_);
+ EXPECT_TRUE(set.empty());
+}
+
+TEST(synchronized_setTest, findNotLocked) {
+ synchronized_set<std::unordered_set<std::string>, TestableRecursiveMutex> set;
+
+ set.emplace("a");
+ set.mutex().resetCounters();
+
+ {
+ std::lock_guard<decltype(set)::mutex_type> lock(set.mutex());
+ const auto& entry = set.find("a");
+ EXPECT_EQ(1, set.mutex().recursive_depth_);
+ EXPECT_EQ(1, set.mutex().lock_count_);
+ EXPECT_EQ(0, set.mutex().unlock_count_);
+ EXPECT_EQ("a", *entry);
+ }
+ EXPECT_EQ(0, set.mutex().recursive_depth_);
+ EXPECT_EQ(1, set.mutex().lock_count_);
+ EXPECT_EQ(1, set.mutex().unlock_count_);
+}
+
+TEST(synchronized_setTest, findConstNotLocked) {
+ synchronized_set<std::unordered_set<std::string>, TestableRecursiveMutex> set;
+
+ set.emplace("a");
+ set.mutex().resetCounters();
+
+ {
+ auto&& lock = set.make_lock();
+ const auto& constMap = set;
+ const auto& entry = constMap.find("a");
+ EXPECT_EQ(1, set.mutex().recursive_depth_);
+ EXPECT_EQ(1, set.mutex().lock_count_);
+ EXPECT_EQ(0, set.mutex().unlock_count_);
+ EXPECT_EQ("a", *entry);
+ }
+ EXPECT_EQ(0, set.mutex().recursive_depth_);
+ EXPECT_EQ(1, set.mutex().lock_count_);
+ EXPECT_EQ(1, set.mutex().unlock_count_);
+}
+
+TEST(synchronized_setTest, iteratorNotLocked) {
+ synchronized_set<std::unordered_set<std::string>, TestableRecursiveMutex> set;
+
+ set.emplace("a");
+ set.emplace("b");
+ set.mutex().resetCounters();
+
+ auto& mutex = set.mutex();
+ EXPECT_EQ(0, mutex.recursive_depth_);
+ EXPECT_EQ(0, mutex.recursive_depth_);
+ EXPECT_EQ(0, set.mutex().lock_count_);
+ EXPECT_EQ(0, set.mutex().unlock_count_);
+
+ {
+ for (const auto& entry : set) {
+ EXPECT_EQ(0, mutex.recursive_depth_);
+ EXPECT_EQ(0, set.mutex().lock_count_);
+ EXPECT_EQ(0, set.mutex().unlock_count_);
+ }
+ }
+ EXPECT_EQ(0, mutex.recursive_depth_);
+ EXPECT_EQ(0, set.mutex().lock_count_);
+ EXPECT_EQ(0, set.mutex().unlock_count_);
+
+ {
+ std::lock_guard<decltype(set)::mutex_type> lock(mutex);
+ for (const auto& entry : set) {
+ EXPECT_EQ(1, mutex.recursive_depth_);
+ EXPECT_EQ(1, set.mutex().lock_count_);
+ EXPECT_EQ(0, set.mutex().unlock_count_);
+ }
+ }
+ EXPECT_EQ(0, mutex.recursive_depth_);
+ EXPECT_EQ(1, set.mutex().lock_count_);
+ EXPECT_EQ(1, set.mutex().unlock_count_);
+}
+
+TEST(synchronized_setTest, make_lockDefault) {
+ synchronized_set<std::unordered_set<std::string>, TestableRecursiveMutex> set;
+
+ {
+ auto&& lock = set.make_lock();
+ EXPECT_EQ(1, set.mutex().recursive_depth_);
+ EXPECT_EQ(1, set.mutex().lock_count_);
+ EXPECT_EQ(0, set.mutex().unlock_count_);
+ }
+ EXPECT_EQ(0, set.mutex().recursive_depth_);
+ EXPECT_EQ(1, set.mutex().lock_count_);
+ EXPECT_EQ(1, set.mutex().unlock_count_);
+}
+
+TEST(synchronized_setTest, make_lock_WithUniqueLock) {
+ synchronized_set<std::unordered_set<std::string>, TestableRecursiveMutex> set;
+
+ {
+ auto&& lock = set.make_lock<std::unique_lock>();
+ EXPECT_EQ(1, set.mutex().recursive_depth_);
+ EXPECT_EQ(1, set.mutex().lock_count_);
+ EXPECT_EQ(0, set.mutex().unlock_count_);
+ }
+ EXPECT_EQ(0, set.mutex().recursive_depth_);
+ EXPECT_EQ(1, set.mutex().lock_count_);
+ EXPECT_EQ(1, set.mutex().unlock_count_);
+}
+
+TEST(synchronized_setTest, make_lock_WithUniqueLockDefered) {
+ synchronized_set<std::unordered_set<std::string>, TestableRecursiveMutex> set;
+
+ {
+ auto&& lock = set.make_lock<std::unique_lock>(std::defer_lock);
+ EXPECT_EQ(0, set.mutex().recursive_depth_);
+ EXPECT_EQ(0, set.mutex().lock_count_);
+ EXPECT_EQ(0, set.mutex().unlock_count_);
+ lock.lock();
+ EXPECT_EQ(1, set.mutex().recursive_depth_);
+ EXPECT_EQ(1, set.mutex().lock_count_);
+ EXPECT_EQ(0, set.mutex().unlock_count_);
+ }
+ EXPECT_EQ(0, set.mutex().recursive_depth_);
+ EXPECT_EQ(1, set.mutex().lock_count_);
+ EXPECT_EQ(1, set.mutex().unlock_count_);
+}
+
+TEST(synchronized_setTest, insertIteratorIteratorLocks) {
+ std::unordered_set<std::string> source = {"a", "b"};
+
+ synchronized_set<std::unordered_set<std::string>, TestableRecursiveMutex> set;
+
+ set.insert(source.begin(), source.end());
+ EXPECT_EQ(0, set.mutex().recursive_depth_);
+ EXPECT_EQ(1, set.mutex().lock_count_);
+ EXPECT_EQ(1, set.mutex().unlock_count_);
+ EXPECT_EQ(2, set.size());
+}
+
+TEST(synchronized_setTest, insertRvalue) {
+ synchronized_set<std::unordered_set<std::string>, TestableRecursiveMutex> set;
+
+ set.insert("a");
+ EXPECT_EQ(0, set.mutex().recursive_depth_);
+ EXPECT_EQ(1, set.mutex().lock_count_);
+ EXPECT_EQ(1, set.mutex().unlock_count_);
+ EXPECT_EQ(1, set.size());
+}
+
+TEST(synchronized_setTest, insertLvalue) {
+ synchronized_set<std::unordered_set<std::string>, TestableRecursiveMutex> set;
+
+ std::string value = "a";
+ set.insert(value);
+ EXPECT_EQ(0, set.mutex().recursive_depth_);
+ EXPECT_EQ(1, set.mutex().lock_count_);
+ EXPECT_EQ(1, set.mutex().unlock_count_);
+ EXPECT_EQ(1, set.size());
+}
+
+TEST(synchronized_setTest, compilesWithStdSet) {
+ synchronized_set<std::set<std::string>, TestableRecursiveMutex> set;
+
+ auto result = set.emplace("a");
+ ASSERT_EQ(true, result.second);
+ EXPECT_EQ("a", *result.first);
+ EXPECT_EQ(0, set.mutex().recursive_depth_);
+ EXPECT_EQ(1, set.mutex().lock_count_);
+ EXPECT_EQ(1, set.mutex().unlock_count_);
+
+ result = set.emplace("b");
+ ASSERT_EQ(true, result.second);
+ EXPECT_EQ("b", *result.first);
+ EXPECT_EQ(0, set.mutex().recursive_depth_);
+ EXPECT_EQ(2, set.mutex().lock_count_);
+ EXPECT_EQ(2, set.mutex().unlock_count_);
+}
diff --git a/cryptoimpl/CMakeLists.txt b/cryptoimpl/CMakeLists.txt
index 61acaa3..0c8a445 100644
--- a/cryptoimpl/CMakeLists.txt
+++ b/cryptoimpl/CMakeLists.txt
@@ -13,7 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-cmake_minimum_required(VERSION 3.4)
project(cryptoImpl LANGUAGES CXX)
add_library(cryptoImpl SHARED
@@ -38,13 +37,13 @@
target_link_libraries(cryptoImpl
PRIVATE
- ACE_SSL
+ ACE::ACE_SSL
_WarningsAsError
PUBLIC
- apache-geode
- crypto
- ssl
- c++11
+ apache-geode
+ OpenSSL::Crypto
+ OpenSSL::SSL
+ c++11
)
add_clangformat(cryptoImpl)
diff --git a/dependencies/ACE/CMakeLists.txt b/dependencies/ACE/CMakeLists.txt
index eb04e1c..f5129b9 100644
--- a/dependencies/ACE/CMakeLists.txt
+++ b/dependencies/ACE/CMakeLists.txt
@@ -13,14 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-project( ACE LANGUAGES NONE )
+project( ACE VERSION 6.5.3 LANGUAGES NONE )
-set( ${PROJECT_NAME}_VERSION 6.4.7 )
-set( ${PROJECT_NAME}_SHA265 b2b59a5f49b164121a8d1c109ff04fc23fcd67cfad040772e8c045c8a34cdabe )
-string(REPLACE "." "_" _VERSION_UNDERSCORE ${${PROJECT_NAME}_VERSION})
-set( ${PROJECT_NAME}_URL "https://github.com/DOCGroup/ACE_TAO/releases/download/ACE%2BTAO-${_VERSION_UNDERSCORE}/ACE.tar.gz" )
-set( ${PROJECT_NAME}_EXTERN ${PROJECT_NAME}-extern )
-set( ${PROJECT_NAME}_DEPENDS openssl-extern )
+set( SHA256 de20bdbfcbcf7d67836e9a2c0875e4eb348a1153e19b83392608330fec3c056a )
+set( DEPENDS OpenSSL::SSL )
if ("SunOS" STREQUAL ${CMAKE_SYSTEM_NAME})
set( ACE_PLATFORM sunos5_sunc++ )
@@ -46,9 +42,8 @@
message( FATAL_ERROR "ACE_PLATFORM unset for ${CMAKE_SYSTEM_NAME}" )
endif()
-include(ExternalProject)
-set( OPENSSL_ROOT ${DEPENDENCIES_openssl_DIR} )
+set( OPENSSL_ROOT $<TARGET_PROPERTY:OpenSSL::SSL,INTERFACE_INCLUDE_DIRECTORIES>/.. )
if (${WIN32})
@@ -58,27 +53,36 @@
set( _PLATFORM win32 )
endif()
+ if (MSVC_VERSION EQUAL 1900)
+ set(_TYPE "vc14")
+ elseif((MSVC_VERSION GREATER_EQUAL 1910) AND (MSVC_VERSION LESS_EQUAL 1919))
+ set(_TYPE "vs2017")
+ endIF()
+
set ( _COMMAND_PREFIX ${CMAKE_COMMAND} -E chdir ace )
set ( _MSBUILD_FLAGS /m /p:Platform=${_PLATFORM} /p:Configuration=$<$<CONFIG:Debug>:Debug>$<$<NOT:$<CONFIG:Debug>>:Release>)
- set ( _MSBUILD_FLAGS_STATIC ${_MSBUILD_FLAGS} /t:ace_vc${MSVC_VERSION}_static /t:SSL_vc${MSVC_VERSION}_static )
+ set ( _MSBUILD_FLAGS_STATIC ${_MSBUILD_FLAGS} /t:ace_${_TYPE}_static /t:SSL_${_TYPE}_static )
include(ProcessorCount)
ProcessorCount(_NPROCS)
- set ( MPC ${PERL} ..\\bin\\mwc.pl )
- set ( MPC_FLAGS -type vc${MSVC_VERSION} -expand_vars -features ssl=1 -recurse -hierarchy -workers ${_NPROCS} -value_template MultiProcessorCompilation=true -apply_project )
+
+ find_package(Perl REQUIRED)
+
+ set ( MPC ${PERL_EXECUTABLE} ..\\bin\\mwc.pl )
+ set ( MPC_FLAGS -type ${_TYPE} -expand_vars -features ssl=1 -recurse -hierarchy -workers ${_NPROCS} -value_template MultiProcessorCompilation=true -apply_project )
#TODO add custom targets to build in parallel?
#TODO MPC has flag to replace variables with absolute paths, think we need that for devstudio builds
set ( _CONFIGURE_COMMAND ${_COMMAND_PREFIX}
${CMAKE_COMMAND} -E env ACE_ROOT=<SOURCE_DIR> SSL_ROOT=${OPENSSL_ROOT}
- ${MPC} ${MPC_FLAGS} -name_modifier "*_vc${MSVC_VERSION}_static" -static
+ ${MPC} ${MPC_FLAGS} -name_modifier "*_${_TYPE}_static" -static
-value_template staticflags+=__ACE_INLINE__
-value_template staticflags+=ACE_BUILD_DLL
-value_template staticflags+=ACE_AS_STATIC_LIBS
-value_template runtime_library=Multithreaded$<$<CONFIG:Debug>:Debug>Dll
)
- set ( _BUILD_COMMAND ${_COMMAND_PREFIX} ${MSBUILD} ACE_vc${MSVC_VERSION}_static.sln ${_MSBUILD_FLAGS} ${_MSBUILD_FLAGS_STATIC}
+ set ( _BUILD_COMMAND ${_COMMAND_PREFIX} ${CMAKE_VS_MSBUILD_COMMAND} ACE_${_TYPE}_static.sln ${_MSBUILD_FLAGS} ${_MSBUILD_FLAGS_STATIC}
)
set ( _INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory lib <INSTALL_DIR>/lib
COMMAND ${CMAKE_COMMAND} -E copy_directory ace <INSTALL_DIR>/include/ace
@@ -97,83 +101,90 @@
set ( _INSTALL_COMMAND ${_MAKE} install )
endif()
-ExternalProject_Add( ${${PROJECT_NAME}_EXTERN}
- URL ${${PROJECT_NAME}_URL}
- URL_HASH SHA256=${${PROJECT_NAME}_SHA265}
+string(REPLACE "." "_" _VERSION_UNDERSCORE ${PROJECT_VERSION})
+
+set( EXTERN ${PROJECT_NAME}-extern )
+include(ExternalProject)
+ExternalProject_Add( ${EXTERN}
+ URL "https://github.com/DOCGroup/ACE_TAO/releases/download/ACE%2BTAO-${_VERSION_UNDERSCORE}/ACE-${PROJECT_VERSION}.tar.gz"
+ URL_HASH SHA256=${SHA256}
UPDATE_COMMAND ""
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND "${_CONFIGURE_COMMAND}"
BUILD_COMMAND "${_BUILD_COMMAND}"
INSTALL_COMMAND "${_INSTALL_COMMAND}"
- DEPENDS ${${PROJECT_NAME}_DEPENDS}
+ DEPENDS ${DEPENDS}
)
-ExternalProject_Get_Property( ${${PROJECT_NAME}_EXTERN} SOURCE_DIR )
-set( ${PROJECT_NAME}_SOURCE_DIR ${SOURCE_DIR} )
-ExternalProject_Get_Property( ${${PROJECT_NAME}_EXTERN} INSTALL_DIR )
-set( ${PROJECT_NAME}_INSTALL_DIR ${INSTALL_DIR} )
-set( DEPENDENCIES_${PROJECT_NAME}_DIR ${${PROJECT_NAME}_INSTALL_DIR} PARENT_SCOPE)
+ExternalProject_Get_Property( ${EXTERN} SOURCE_DIR )
+set( SOURCE_DIR ${SOURCE_DIR} )
+ExternalProject_Get_Property( ${EXTERN} INSTALL_DIR )
+set( INSTALL_DIR ${INSTALL_DIR} )
+set( DEPENDENCIES_DIR ${INSTALL_DIR} PARENT_SCOPE)
if ("SunOS" STREQUAL ${CMAKE_SYSTEM_NAME})
set( PATCH_FILE ${CMAKE_CURRENT_SOURCE_DIR}/patches )
-ExternalProject_Add_Step( ${${PROJECT_NAME}_EXTERN} patches
- ALWAYS 0
- DEPENDEES download
- DEPENDERS patch
- DEPENDS ${PATCH_FILE}
- BYPRODUCTS ${${PROJECT_NAME}_SOURCE_DIR}/include/makeinclude/platform_sunos5_sunc++.GNU ${${PROJECT_NAME}_SOURCE_DIR}/ace/config-lite.h ${${PROJECT_NAME}_SOURCE_DIR}/ace/Stats.cpp
- WORKING_DIRECTORY ${${PROJECT_NAME}_SOURCE_DIR}
- COMMAND ${PATCH} -u -N -p1 < ${PATCH_FILE}
+ExternalProject_Add_Step( ${EXTERN} patches
+ ALWAYS 0
+ DEPENDEES download
+ DEPENDERS patch
+ DEPENDS ${PATCH_FILE}
+ BYPRODUCTS ${SOURCE_DIR}/include/makeinclude/platform_sunos5_sunc++.GNU ${SOURCE_DIR}/ace/config-lite.h ${SOURCE_DIR}/ace/Stats.cpp
+ WORKING_DIRECTORY ${SOURCE_DIR}
+ COMMAND ${Patch_EXECUTABLE} -u -N -p1 < ${PATCH_FILE}
)
endif()
configure_file(config.h.in config.h)
-ExternalProject_Add_Step( ${${PROJECT_NAME}_EXTERN} config.h
- DEPENDEES patch
- DEPENDERS configure
- DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/config.h
- BYPRODUCTS ${${PROJECT_NAME}_SOURCE_DIR}/ace/config.h
- COMMAND ${CMAKE_COMMAND} -E copy config.h ${${PROJECT_NAME}_SOURCE_DIR}/ace/config.h
+ExternalProject_Add_Step( ${EXTERN} config.h
+ DEPENDEES patch
+ DEPENDERS configure
+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/config.h
+ BYPRODUCTS ${SOURCE_DIR}/ace/config.h
+ COMMAND ${CMAKE_COMMAND} -E copy config.h ${SOURCE_DIR}/ace/config.h
)
if (UNIX)
-ExternalProject_Add_Step( ${${PROJECT_NAME}_EXTERN} platform
- DEPENDEES patch
- DEPENDERS configure
- BYPRODUCTS ${${PROJECT_NAME}_SOURCE_DIR}/include/makeinclude/platform_macros.GNU
- COMMAND echo "INSTALL_PREFIX = ${${PROJECT_NAME}_INSTALL_DIR}" > ${${PROJECT_NAME}_SOURCE_DIR}/include/makeinclude/platform_macros.GNU
- COMMAND echo "CCFLAGS += ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_COMPILE_OPTIONS_PIC}" >> ${${PROJECT_NAME}_SOURCE_DIR}/include/makeinclude/platform_macros.GNU
- COMMAND echo "include ${${PROJECT_NAME}_SOURCE_DIR}/include/makeinclude/platform_${ACE_PLATFORM}.GNU" >> ${${PROJECT_NAME}_SOURCE_DIR}/include/makeinclude/platform_macros.GNU
+ExternalProject_Add_Step( ${EXTERN} platform
+ DEPENDEES patch
+ DEPENDERS configure
+ BYPRODUCTS ${SOURCE_DIR}/include/makeinclude/platform_macros.GNU
+ COMMAND echo "INSTALL_PREFIX = ${INSTALL_DIR}" > ${SOURCE_DIR}/include/makeinclude/platform_macros.GNU
+ COMMAND echo "CC = ${CMAKE_C_COMPILER}" >> ${SOURCE_DIR}/include/makeinclude/platform_macros.GNU
+ COMMAND echo "CXX = ${CMAKE_CXX_COMPILER}" >> ${SOURCE_DIR}/include/makeinclude/platform_macros.GNU
+ COMMAND echo "CCFLAGS += ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_COMPILE_OPTIONS_PIC}" >> ${SOURCE_DIR}/include/makeinclude/platform_macros.GNU
+ COMMAND echo "include ${SOURCE_DIR}/include/makeinclude/platform_${ACE_PLATFORM}.GNU" >> ${SOURCE_DIR}/include/makeinclude/platform_macros.GNU
)
endif()
-add_library(${PROJECT_NAME} INTERFACE)
-target_include_directories(${PROJECT_NAME} SYSTEM INTERFACE
- $<BUILD_INTERFACE:${${PROJECT_NAME}_INSTALL_DIR}/include>
+find_package(Threads)
+
+add_library(ACE_ACE INTERFACE)
+target_include_directories(ACE_ACE SYSTEM INTERFACE
+ $<BUILD_INTERFACE:${INSTALL_DIR}/include>
)
-target_compile_definitions(${PROJECT_NAME} INTERFACE
+target_compile_definitions(ACE_ACE INTERFACE
-D__ACE_INLINE__
-DACE_AS_STATIC_LIBS
)
-target_link_libraries(${PROJECT_NAME} INTERFACE
- ${${PROJECT_NAME}_INSTALL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}ACE${CMAKE_STATIC_LIBRARY_SUFFIX}
+target_link_libraries(ACE_ACE INTERFACE
+ ${INSTALL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}ACE${CMAKE_STATIC_LIBRARY_SUFFIX}
+ Threads::Threads
)
if ("SunOS" STREQUAL ${CMAKE_SYSTEM_NAME})
- target_link_libraries(${PROJECT_NAME} INTERFACE
+ target_link_libraries(ACE_ACE INTERFACE
rt
- pthread
m
socket
nsl
)
- target_compile_definitions( ${PROJECT_NAME} INTERFACE
+ target_compile_definitions(ACE_ACE INTERFACE
_POSIX_PTHREAD_SEMANTICS
)
elseif ("Linux" STREQUAL ${CMAKE_SYSTEM_NAME} )
- target_link_libraries(${PROJECT_NAME} INTERFACE
- pthread
+ target_link_libraries(ACE_ACE INTERFACE
dl
rt
)
@@ -181,10 +192,14 @@
elseif ("Windows" STREQUAL ${CMAKE_SYSTEM_NAME} )
endif()
-add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXTERN})
+add_dependencies(ACE_ACE ${EXTERN})
-add_library(ACE_SSL INTERFACE)
-target_link_libraries(ACE_SSL INTERFACE
- ${PROJECT_NAME}
- ${${PROJECT_NAME}_INSTALL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}ACE_SSL${CMAKE_STATIC_LIBRARY_SUFFIX}
+add_library(ACE_ACE_SSL INTERFACE)
+target_link_libraries(ACE_ACE_SSL INTERFACE
+ ${INSTALL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}ACE_SSL${CMAKE_STATIC_LIBRARY_SUFFIX}
+ ACE_ACE
+ OpenSSL::SSL
)
+
+add_library(ACE::ACE ALIAS ACE_ACE)
+add_library(ACE::ACE_SSL ALIAS ACE_ACE_SSL)
diff --git a/dependencies/CMakeLists.txt b/dependencies/CMakeLists.txt
index f86a418..a422e23 100644
--- a/dependencies/CMakeLists.txt
+++ b/dependencies/CMakeLists.txt
@@ -12,93 +12,25 @@
# 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.
+
cmake_minimum_required( VERSION 3.10 )
project( dependencies LANGUAGES NONE )
-#TODO options?
-set( USE_C++ 11 CACHE STRING "Use C++ standard X (11).")
+find_package(Patch REQUIRED)
-set ( DEPENDENCIES
- libxml2
- openssl
- ACE
- boost
- sqlite
- doxygen
- gtest
-)
+add_subdirectory( libxml2 )
+add_subdirectory( openssl )
+add_subdirectory( ACE )
+add_subdirectory( boost )
+add_subdirectory( sqlite )
+add_subdirectory( doxygen )
+add_subdirectory( gtest )
+add_subdirectory( benchmark )
-if ( "" STREQUAL "${USE_C++}" )
- set (DEPENDENCIES STLport ${DEPENDENCIES})
+if (USE_RAT)
+ add_subdirectory( rat )
endif()
-include(CheckCCompilerFlag)
-include(CheckCXXCompilerFlag)
-
-set( CONFIGURE_FLAGS --prefix=<INSTALL_DIR> CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} )
-set( CONFIGURE ./configure ${CONFIGURE_FLAGS} )
-
-find_program( PATCH NAMES gpatch patch )
-if ("PATCH-NOTFOUND" STREQUAL "${PATCH}")
- message( FATAL_ERROR "patch not found." )
-endif()
-
-# TODO windows why was windows finding bash?
-find_program( BASH bash )
-
if (WIN32)
- find_program( MSBUILD msbuild )
- # TODO FindPerl
- find_program( PERL perl )
-
- # Determin the Visual Studio version to generate projects for.
- if (MSVC10)
- set(MSVC_VERSION 10)
- elseif(MSVC11)
- set(MSVC_VERSION 11)
- elseif(MSVC12)
- set(MSVC_VERSION 12)
- elseif(MSVC14)
- set(MSVC_VERSION 14)
- endIF()
-
- set(DEPENDENCIES ${DEPENDENCIES} sqlite-netFx)
+ add_subdirectory( sqlite-netFx )
endif()
-
-# TODO autoconfig?
-set( CFLAGS_ARCH_32 -m32 )
-set( CFLAGS_ARCH_64 -m64 )
-
-# TODO check_c*_compiler_flag don't support linker flags
-#check_c_compiler_flag( ${CFLAGS_ARCH_${BUILD_BITS}} CFLAGS_ARCH_${BUILD_BITS}_ALLOWED )
-#if (${CFLAGS_ARCH_${BUILD_BITS}_ALLOWED})
- set( CFLAGS_ARCH ${CFLAGS_ARCH_${BUILD_BITS}} )
-#else()
-# message( FATAL_ERROR "${BUILD_BITS} bits flag ${CFLAGS_ARCH_${BUILD_BITS}} not supported.")
-#endif()
-
-set( CXXFLAGS_ARCH_32 -m32 )
-set( CXXFLAGS_ARCH_64 -m64 )
-
-#check_cxx_compiler_flag( ${CXXFLAGS_ARCH_${BUILD_BITS}} CXXFLAGS_ARCH_${BUILD_BITS}_ALLOWED )
-#if (${CXXFLAGS_ARCH_${BUILD_BITS}_ALLOWED})
- set( CXXFLAGS_ARCH ${CXXFLAGS_ARCH_${BUILD_BITS}} )
-#else()
-# message( FATAL_ERROR "${BUILD_BITS} bits flag ${CXXFLAGS_ARCH_${BUILD_BITS}} not supported.")
-#endif()
-
-set( CXXFLAGS_C++11 ${CMAKE_CXX11_STANDARD_COMPILE_OPTION} )
-if (NOT "" STREQUAL "${CXXFLAGS_C++${USE_C++}}" )
- set( CXXFLAGS_C++ ${CXXFLAGS_C++${USE_C++}} )
-endif()
-
-#TODO solaris needs special flags https://docs.oracle.com/cd/E37069_01/html/E37075/bkamq.html#scrolltoc
-set( CXXLDFLAGS_RUNTIME_C++11 -lstdc++ -lgcc_s -lCrunG3 -lc )
-set( CXXLDFLAGS_RUNTIME ${CXXFLAGS_C++${USE_C++}} )
-
-foreach(_D ${DEPENDENCIES})
- add_subdirectory( ${_D} )
-endforeach(_D)
-
-set(sqlite-netFx_SHARED_LIB ${sqlite-netFx_SHARED_LIB} PARENT_SCOPE)
-
diff --git a/dependencies/benchmark/CMakeLists.txt b/dependencies/benchmark/CMakeLists.txt
new file mode 100644
index 0000000..1a31a0c
--- /dev/null
+++ b/dependencies/benchmark/CMakeLists.txt
@@ -0,0 +1,80 @@
+# 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.
+
+project( benchmark VERSION 1.4.1 LANGUAGES NONE )
+
+set( SHA256 61ae07eb5d4a0b02753419eb17a82b7d322786bb36ab62bd3df331a4d47c00a7 )
+set( DEPENDS GTest::gtest )
+
+
+if(CMAKE_CXX_COMPILER_ID STREQUAL "SunPro")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64")
+endif()
+
+set( EXTERN ${PROJECT_NAME}-extern )
+include(ExternalProject)
+ExternalProject_Add( ${EXTERN}
+ URL "https://github.com/google/benchmark/archive/v${PROJECT_VERSION}.zip"
+ URL_HASH SHA256=${SHA256}
+ UPDATE_COMMAND ""
+ CMAKE_ARGS
+ -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
+ -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}
+ -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>/$<CONFIG>
+ -DCMAKE_BUILD_TYPE=$<CONFIG>
+ -DGTEST_ROOT=$<TARGET_PROPERTY:GTest::gtest,INTERFACE_INCLUDE_DIRECTORIES>/..
+ -DBENCHMARK_ENABLE_TESTING=OFF
+ DEPENDS ${DEPENDS}
+)
+
+ExternalProject_Get_Property( ${EXTERN} SOURCE_DIR )
+ExternalProject_Get_Property( ${EXTERN} INSTALL_DIR )
+set(INSTALL_DIR "${INSTALL_DIR}/$<CONFIG>")
+
+if (CMAKE_CXX_COMPILER_ID STREQUAL "SunPro")
+ set(PATCH_FILE ${CMAKE_CURRENT_SOURCE_DIR}/patches)
+ ExternalProject_Add_Step(${EXTERN} patches
+ ALWAYS 0
+ DEPENDEES download
+ DEPENDERS patch
+ DEPENDS ${PATCH_FILE}
+ BYPRODUCTS ${SOURCE_DIR}/CMakeLists.txt
+ WORKING_DIRECTORY ${SOURCE_DIR}
+ COMMAND ${Patch_EXECUTABLE} -u -N -p1 < ${PATCH_FILE}
+ )
+endif()
+
+find_package(Threads REQUIRED)
+
+add_library(benchmark_benchmark INTERFACE)
+target_include_directories(benchmark_benchmark SYSTEM INTERFACE
+ $<BUILD_INTERFACE:${INSTALL_DIR}/include>
+)
+target_link_libraries(benchmark_benchmark INTERFACE
+ ${INSTALL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}benchmark${CMAKE_STATIC_LIBRARY_SUFFIX}
+ Threads::Threads
+)
+if (WIN32)
+target_link_libraries(benchmark_benchmark INTERFACE
+ Shlwapi
+)
+elseif (CMAKE_CXX_COMPILER_ID STREQUAL "SunPro")
+ target_link_libraries(benchmark_benchmark INTERFACE
+ kstat
+ )
+endif()
+add_dependencies(benchmark_benchmark ${EXTERN})
+
+add_library(benchmark::benchmark ALIAS benchmark_benchmark)
diff --git a/dependencies/benchmark/patches b/dependencies/benchmark/patches
new file mode 100644
index 0000000..57907d4
--- /dev/null
+++ b/dependencies/benchmark/patches
@@ -0,0 +1,12 @@
+diff -ru a/CMakeLists.txt b/CMakeLists.txt
+--- a/CMakeLists.txt Tue Apr 3 22:12:47 2018
++++ b/CMakeLists.txt Sun May 6 00:15:34 2018
+@@ -120,6 +120,8 @@
+ set(CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "${CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL} /LTCG")
+ set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL} /LTCG")
+ endif()
++elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "SunPro")
++ add_cxx_compiler_flag(-std=c++11)
+ else()
+ # Try and enable C++11. Don't use C++14 because it doesn't work in some
+ # configurations.
diff --git a/dependencies/boost/CMakeLists.txt b/dependencies/boost/CMakeLists.txt
index 143fc46..6fd3e99 100644
--- a/dependencies/boost/CMakeLists.txt
+++ b/dependencies/boost/CMakeLists.txt
@@ -13,31 +13,25 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-project( boost LANGUAGES NONE )
+project( boost VERSION 1.68.0 LANGUAGES NONE )
-set( ${PROJECT_NAME}_VERSION 1.68.0 )
-set( ${PROJECT_NAME}_SHA265 da3411ea45622579d419bfda66f45cd0f8c32a181d84adfa936f5688388995cf )
-string(REPLACE "." "_" _VERSION_UNDERSCORE ${${PROJECT_NAME}_VERSION})
-set( ${PROJECT_NAME}_URL "https://dl.bintray.com/boostorg/release/${${PROJECT_NAME}_VERSION}/source/boost_${_VERSION_UNDERSCORE}.tar.gz" )
-set( ${PROJECT_NAME}_EXTERN ${PROJECT_NAME}-extern )
-
-include(ProcessorCount)
-ProcessorCount(_NPROCS)
-
-include(ExternalProject)
+set( SHA256 da3411ea45622579d419bfda66f45cd0f8c32a181d84adfa936f5688388995cf )
set(_B2_FLAGS
-d0
- --prefix=<INSTALL_DIR>
+ --prefix=<INSTALL_DIR>/$<CONFIG>
--with-system
--with-log
--layout=system
address-model=${BUILD_BITS}
link=static
threading=multi
- variant=$<LOWER_CASE:$<CONFIG>>
+ variant=$<IF:$<CONFIG:Debug>,debug,release>
+ debug-symbols=$<IF:$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>,on,off>
)
+include(ProcessorCount)
+ProcessorCount(_NPROCS)
if (${_NPROCS})
set ( _B2_FLAGS ${_B2_FLAGS} -j${_NPROCS} )
endif()
@@ -45,11 +39,11 @@
if (${WIN32})
set ( _BOOTSTRAP_COMMAND .\\bootstrap.bat )
set ( _B2_COMMAND .\\b2 )
- set ( _B2_FLAGS ${_B2_FLAGS} toolset=msvc-14.0 )
+ set ( _B2_FLAGS ${_B2_FLAGS} toolset=msvc-14.1 )
else()
set ( _BOOTSTRAP_COMMAND ./bootstrap.sh )
set ( _B2_COMMAND ./b2 )
- set ( _B2_FLAGS ${_B2_FLAGS} "cxxflags=${CMAKE_CXX_FLAGS} ${CMAKE_CXX11_STANDARD_COMPILE_OPTION}" )
+ set ( _B2_FLAGS ${_B2_FLAGS} "cxxflags=${CMAKE_CXX_FLAGS} ${CMAKE_CXX11_STANDARD_COMPILE_OPTION} ${CMAKE_CXX_COMPILE_OPTIONS_PIC}" )
endif()
if ("SunOS" STREQUAL ${CMAKE_SYSTEM_NAME})
@@ -61,9 +55,13 @@
set ( _BOOTSTRAP_COMMAND ${_BOOTSTRAP_COMMAND} --with-toolset=clang )
endif()
-ExternalProject_Add( ${${PROJECT_NAME}_EXTERN}
- URL ${${PROJECT_NAME}_URL}
- URL_HASH SHA256=${${PROJECT_NAME}_SHA265}
+string(REPLACE "." "_" _VERSION_UNDERSCORE ${PROJECT_VERSION})
+set( EXTERN ${PROJECT_NAME}-extern )
+
+include(ExternalProject)
+ExternalProject_Add( ${EXTERN}
+ URL "https://dl.bintray.com/boostorg/release/${PROJECT_VERSION}/source/boost_${_VERSION_UNDERSCORE}.tar.gz"
+ URL_HASH SHA256=${SHA256}
UPDATE_COMMAND ""
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ${_BOOTSTRAP_COMMAND}
@@ -75,22 +73,20 @@
STAMP_DIR ./stamp
)
-ExternalProject_Get_Property( ${${PROJECT_NAME}_EXTERN} SOURCE_DIR )
-set( ${PROJECT_NAME}_SOURCE_DIR ${SOURCE_DIR} )
-ExternalProject_Get_Property( ${${PROJECT_NAME}_EXTERN} INSTALL_DIR )
-set( ${PROJECT_NAME}_INSTALL_DIR ${INSTALL_DIR} )
+ExternalProject_Get_Property( ${EXTERN} SOURCE_DIR )
+ExternalProject_Get_Property( ${EXTERN} INSTALL_DIR )
+set(INSTALL_DIR "${INSTALL_DIR}/$<CONFIG>")
if (NOT WIN32)
# https://github.com/boostorg/process/issues/51
set( PATCH_FILE ${CMAKE_CURRENT_SOURCE_DIR}/patches)
- ExternalProject_Add_Step( ${${PROJECT_NAME}_EXTERN} patches
+ ExternalProject_Add_Step( ${EXTERN} patches
ALWAYS 0
DEPENDEES download
DEPENDERS patch
DEPENDS ${PATCH_FILE}
- BYPRODUCTS ${${PROJECT_NAME}_SOURCE_DIR}/boost/process/detail/posix/is_running.hpp
- WORKING_DIRECTORY ${${PROJECT_NAME}_INSTALL_DIR}
- COMMAND ${PATCH} -u -N -p1 < ${PATCH_FILE}
+ BYPRODUCTS ${SOURCE_DIR}/boost/process/detail/posix/is_running.hpp
+ COMMAND ${Patch_EXECUTABLE} -u -N -p1 < ${PATCH_FILE}
)
endif()
@@ -108,7 +104,7 @@
set(linkLibraries)
foreach(library ${args_LIBRARIES})
- list(APPEND linkLibraries "${${PROJECT_NAME}_INSTALL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}boost_${args_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}")
+ list(APPEND linkLibraries "${INSTALL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}boost_${args_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}")
endforeach()
add_library(boost_${args_NAME} INTERFACE)
@@ -122,8 +118,7 @@
add_library(${PROJECT_NAME} INTERFACE)
target_include_directories(${PROJECT_NAME} SYSTEM INTERFACE
- $<BUILD_INTERFACE:${${PROJECT_NAME}_INSTALL_DIR}/include>
- $<BUILD_INTERFACE:${${PROJECT_NAME}_INSTALL_DIR}/src>
+ $<BUILD_INTERFACE:${INSTALL_DIR}/include>
)
target_compile_definitions(${PROJECT_NAME} INTERFACE
BOOST_ALL_NO_LIB
@@ -131,11 +126,13 @@
target_link_libraries(${PROJECT_NAME} INTERFACE
)
add_library(Boost::boost ALIAS boost)
-add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXTERN})
+add_dependencies(${PROJECT_NAME} ${EXTERN})
+
+find_package(Threads REQUIRED)
add_boost_library(system DEPENDENCIES Boost::boost)
add_boost_library(atomic DEPENDENCIES Boost::boost)
-add_boost_library(thread DEPENDENCIES Boost::atomic Boost::boost)
-add_boost_library(filesystem DEPENDENCIES Boost::boost)
+add_boost_library(thread DEPENDENCIES Threads::Threads Boost::atomic Boost::boost)
+add_boost_library(filesystem DEPENDENCIES Boost::system Boost::boost)
add_boost_library(log DEPENDENCIES Boost::thread Boost::filesystem Boost::boost)
add_boost_library(log_setup DEPENDENCIES Boost::log)
diff --git a/dependencies/doxygen/CMakeLists.txt b/dependencies/doxygen/CMakeLists.txt
index 269973c..f9157f7 100644
--- a/dependencies/doxygen/CMakeLists.txt
+++ b/dependencies/doxygen/CMakeLists.txt
@@ -13,44 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-project( doxygen LANGUAGES NONE )
+project( doxygen VERSION 1.8 LANGUAGES NONE )
# used to compile documents
-set( ${PROJECT_NAME}_VERSION 1.6 )
-set( ${PROJECT_NAME}_SHA265 cedf78f6d213226464784ecb999b54515c97eab8a2f9b82514292f837cf88b93 )
-set( ${PROJECT_NAME}_URL "http://ftp.stack.nl/pub/users/dimitri/doxygen-${${PROJECT_NAME}_VERSION}.src.tar.gz" )
-#TODO flex broken set( ${PROJECT_NAME}_DEPENDS flex )
-
# Not a runtime requirement, so look for existing installation.
-find_package(Doxygen ${${PROJECT_NAME}_VERSION} REQUIRED)
-if( ${DOXYGEN_FOUND} )
-
- get_filename_component( DEPENDENCIES_${PROJECT_NAME}_DIR ${DOXYGEN_EXECUTABLE} DIRECTORY )
- get_filename_component( DEPENDENCIES_${PROJECT_NAME}_DIR ${DEPENDENCIES_${PROJECT_NAME}_DIR} DIRECTORY )
- set( DEPENDENCIES_${PROJECT_NAME}_DIR ${DEPENDENCIES_${PROJECT_NAME}_DIR} PARENT_SCOPE )
- set( DEPENDENCIES_${PROJECT_NAME}_VERSION ${DOXYGEN_VERSION} PARENT_SCOPE )
-
-else()
- # let's build it!
- # TODO FLEX won't build on Solaris
- # add_subdirectory( ../flex ${CMAKE_CURRENT_BINARY_DIR}/../flex )
-
- include(ExternalProject)
-
- # CMake based project
- ExternalProject_Add( ${PROJECT_NAME}
- URL ${${PROJECT_NAME}_URL}
- URL_HASH SHA256=${${PROJECT_NAME}_SHA265}
- UPDATE_COMMAND ""
-# DEPENDS ${${PROJECT_NAME}_DEPENDS}
- )
-
- ExternalProject_Get_Property( ${PROJECT_NAME} SOURCE_DIR )
- set( ${PROJECT_NAME}_SOURCE_DIR ${SOURCE_DIR} )
- ExternalProject_Get_Property( ${PROJECT_NAME} INSTALL_DIR )
- set( ${PROJECT_NAME}_INSTALL_DIR ${INSTALL_DIR} )
-
- set( DEPENDENCIES_${PROJECT_NAME}_DIR ${${PROJECT_NAME}_INSTALL_DIR} PARENT_SCOPE)
- set( DEPENDENCIES_${PROJECT_NAME}_VERSION ${${PROJECT_NAME}_VERSION} PARENT_SCOPE)
-
-endif( )
+find_package(Doxygen ${PROJECT_VERSION} REQUIRED)
diff --git a/dependencies/gtest/CMakeLists.txt b/dependencies/gtest/CMakeLists.txt
index b93c7ff..4d5c10a 100644
--- a/dependencies/gtest/CMakeLists.txt
+++ b/dependencies/gtest/CMakeLists.txt
@@ -4,72 +4,69 @@
# 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.
-project( gtest LANGUAGES NONE )
+project( gtest VERSION 1.8.1 LANGUAGES NONE )
-set( ${PROJECT_NAME}_VERSION 1.8.0 )
-set( ${PROJECT_NAME}_SHA265 f3ed3b58511efd272eb074a3a6d6fb79d7c2e6a0e374323d1e6bcbcc1ef141bf )
-set( ${PROJECT_NAME}_URL "https://github.com/google/googletest/archive/release-${${PROJECT_NAME}_VERSION}.zip" )
-set( ${PROJECT_NAME}_EXTERN ${PROJECT_NAME}-extern )
+set( SHA256 927827c183d01734cc5cfef85e0ff3f5a92ffe6188e0d18e909c5efebf28a0c7 )
include(ExternalProject)
+ExternalProject_Add( ${PROJECT_NAME}-extern
+ URL "https://github.com/google/googletest/archive/release-${PROJECT_VERSION}.zip"
+ URL_HASH SHA256=${SHA256}
+ CMAKE_ARGS
+ -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
+ -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}
+ -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
+ -DCMAKE_BUILD_TYPE=$<CONFIG>
+ -Dgtest_force_shared_crt:BOOL=ON
+)
-if(CMAKE_CXX_COMPILER_ID STREQUAL "SunPro")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64")
+ExternalProject_Get_Property( ${PROJECT_NAME}-extern INSTALL_DIR )
+
+if(WIN32)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 /D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING")
endif()
-ExternalProject_Add( ${${PROJECT_NAME}_EXTERN}
- URL ${${PROJECT_NAME}_URL}
- URL_HASH SHA256=${${PROJECT_NAME}_SHA265}
- UPDATE_COMMAND ""
- INSTALL_COMMAND ""
- CMAKE_ARGS -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} -Dgtest_force_shared_crt:BOOL=ON
-)
+include(GNUInstallDirs)
-ExternalProject_Get_Property( ${${PROJECT_NAME}_EXTERN} SOURCE_DIR )
-set( ${PROJECT_NAME}_gtest_SOURCE_DIR ${SOURCE_DIR}/googletest )
-set( ${PROJECT_NAME}_gmock_SOURCE_DIR ${SOURCE_DIR}/googlemock )
-ExternalProject_Get_Property( ${${PROJECT_NAME}_EXTERN} INSTALL_DIR )
-set( ${PROJECT_NAME}_INSTALL_DIR ${INSTALL_DIR} )
-ExternalProject_Get_Property( ${${PROJECT_NAME}_EXTERN} BINARY_DIR )
-set( ${PROJECT_NAME}_gtest_BINARY_DIR ${BINARY_DIR}/googlemock/gtest/${_DEBUG_OR_RELEASE} )
-set( ${PROJECT_NAME}_gmock_BINARY_DIR ${BINARY_DIR}/googlemock/${_DEBUG_OR_RELEASE} )
-set( DEPENDENCIES_${PROJECT_NAME}_DIR ${${PROJECT_NAME}_BINARY_DIR} PARENT_SCOPE)
+function(ADD_GTEST_LIBRARY)
+ set(options)
+ set(oneValueArgs)
+ set(multiValueArgs DEPENDENCIES)
+ cmake_parse_arguments(PARSE_ARGV 1 args "${options}" "${oneValueArgs}" "${multiValueArgs}")
-set( ${PROJECT_NAME}_STATIC_LIB
-${${PROJECT_NAME}_gtest_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}
-${${PROJECT_NAME}_gtest_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest_main${CMAKE_STATIC_LIBRARY_SUFFIX}
-${${PROJECT_NAME}_gmock_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gmock${CMAKE_STATIC_LIBRARY_SUFFIX}
-${${PROJECT_NAME}_gmock_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gmock_main${CMAKE_STATIC_LIBRARY_SUFFIX}
-PARENT_SCOPE)
+ set(args_NAME ${ARGV0})
-add_library(${PROJECT_NAME}_gtest INTERFACE)
-target_include_directories(${PROJECT_NAME}_gtest SYSTEM INTERFACE
- $<BUILD_INTERFACE:${${PROJECT_NAME}_gtest_SOURCE_DIR}/include>
- $<BUILD_INTERFACE:${${PROJECT_NAME}_gmock_SOURCE_DIR}/include>
-)
-target_link_libraries(${PROJECT_NAME}_gtest INTERFACE
- ${${PROJECT_NAME}_gtest_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}
-)
-add_dependencies(${PROJECT_NAME}_gtest ${${PROJECT_NAME}_EXTERN})
+ set(target "GTest_${args_NAME}")
-add_library(${PROJECT_NAME}_gtest_main INTERFACE)
-target_include_directories(${PROJECT_NAME}_gtest_main SYSTEM INTERFACE
- $<BUILD_INTERFACE:${${PROJECT_NAME}_gtest_SOURCE_DIR}/include>
- $<BUILD_INTERFACE:${${PROJECT_NAME}_gmock_SOURCE_DIR}/include>
-)
-target_link_libraries(${PROJECT_NAME}_gtest_main INTERFACE
- ${${PROJECT_NAME}_gtest_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest_main${CMAKE_STATIC_LIBRARY_SUFFIX}
-)
-add_dependencies(${PROJECT_NAME}_gtest_main ${${PROJECT_NAME}_EXTERN})
+ add_library(${target} INTERFACE)
-add_library(GTest::GTest ALIAS ${PROJECT_NAME}_gtest)
-add_library(GTest::Main ALIAS ${PROJECT_NAME}_gtest_main)
+ target_include_directories(${target} SYSTEM INTERFACE
+ $<BUILD_INTERFACE:${INSTALL_DIR}/${CMAKE_INSTALL_INCLUDEDIR}>
+ )
+
+ target_link_libraries(${target} INTERFACE
+ ${INSTALL_DIR}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${args_NAME}$<$<CONFIG:Debug>:d>${CMAKE_STATIC_LIBRARY_SUFFIX}
+ ${args_DEPENDENCIES}
+ )
+
+ add_library(GTest::${args_NAME} ALIAS ${target})
+
+ add_dependencies(${target} ${PROJECT_NAME}-extern)
+
+endfunction()
+
+find_package(Threads REQUIRED)
+
+add_gtest_library(gtest DEPENDENCIES Threads::Threads)
+add_gtest_library(gtest_main DEPENDENCIES GTest::gtest)
+add_gtest_library(gmock DEPENDENCIES GTest::gtest)
+add_gtest_library(gmock_main DEPENDENCIES GTest::gmock)
diff --git a/dependencies/libxml2/CMakeLists.txt b/dependencies/libxml2/CMakeLists.txt
index b5e5156..aabd6c8 100644
--- a/dependencies/libxml2/CMakeLists.txt
+++ b/dependencies/libxml2/CMakeLists.txt
@@ -13,14 +13,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-project( libxml2 LANGUAGES NONE )
+project( libxml2 VERSION 2.9.9 LANGUAGES NONE )
-set( ${PROJECT_NAME}_VERSION 2.9.7 )
-set( ${PROJECT_NAME}_SHA265 f63c5e7d30362ed28b38bfa1ac6313f9a80230720b7fb6c80575eeab3ff5900c )
-set( ${PROJECT_NAME}_URL "http://xmlsoft.org/sources/libxml2-${${PROJECT_NAME}_VERSION}.tar.gz" )
-set( ${PROJECT_NAME}_EXTERN ${PROJECT_NAME}-extern )
+set( SHA256 94fb70890143e3c6549f265cee93ec064c80a84c42ad0f23e85ee1fd6540a871 )
-set( ${PROJECT_NAME}_CFLAGS "${${PROJECT_NAME}_CFLAGS} ${CFLAGS_ARCH}" )
+set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64" )
if (${WIN32})
set (_MAKE_FLAGS ${_MAKE_FLAGS} "CPP=cl.exe /MP /EP" "CC=cl.exe /MP" )
@@ -41,16 +38,27 @@
set ( _BUILD_COMMAND ${CMAKE_COMMAND} -E chdir win32 nmake -f Makefile.msvc all ${_MAKE_FLAGS} )
set ( _INSTALL_COMMAND ${CMAKE_COMMAND} -E chdir win32 nmake -f Makefile.msvc install ${_MAKE_FLAGS} )
else()
- set ( _CONFIGURE_COMMAND ${CONFIGURE} $<$<CONFIG:Debug>:--with-debug> --libdir=<INSTALL_DIR>/lib --with-pic --enable-static --without-iconv --without-python --without-lzma CFLAGS=${${PROJECT_NAME}_CFLAGS} "MAKE=$(MAKE)")
+ set ( _CONFIGURE_COMMAND ./configure
+ --prefix=<INSTALL_DIR>
+ $<$<CONFIG:Debug>:--with-debug>
+ --libdir=<INSTALL_DIR>/lib
+ --with-pic
+ --enable-static
+ --without-iconv
+ --without-python
+ --without-lzma
+ CC=${CMAKE_C_COMPILER}
+ CFLAGS=${CMAKE_C_FLAGS}
+ "MAKE=$(MAKE)")
set ( _BUILD_COMMAND $(MAKE) all )
set ( _INSTALL_COMMAND $(MAKE) install )
endif()
+set( EXTERN ${PROJECT_NAME}-extern )
include(ExternalProject)
-
-ExternalProject_Add( ${${PROJECT_NAME}_EXTERN}
- URL ${${PROJECT_NAME}_URL}
- URL_HASH SHA256=${${PROJECT_NAME}_SHA265}
+ExternalProject_Add( ${EXTERN}
+ URL "http://xmlsoft.org/sources/libxml2-${PROJECT_VERSION}.tar.gz"
+ URL_HASH SHA256=${SHA256}
UPDATE_COMMAND ""
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND "${_CONFIGURE_COMMAND}"
@@ -58,27 +66,26 @@
INSTALL_COMMAND "${_INSTALL_COMMAND}"
)
-ExternalProject_Get_Property( ${${PROJECT_NAME}_EXTERN} SOURCE_DIR )
-set( ${PROJECT_NAME}_SOURCE_DIR ${SOURCE_DIR} )
-ExternalProject_Get_Property( ${${PROJECT_NAME}_EXTERN} INSTALL_DIR )
-set( ${PROJECT_NAME}_INSTALL_DIR ${INSTALL_DIR} )
-set( DEPENDENCIES_${PROJECT_NAME}_DIR ${${PROJECT_NAME}_INSTALL_DIR} PARENT_SCOPE)
+ExternalProject_Get_Property( ${EXTERN} INSTALL_DIR )
+set( INSTALL_DIR ${INSTALL_DIR} )
if (${WIN32})
set(CMAKE_STATIC_LIBRARY_PREFIX lib)
set(CMAKE_STATIC_LIBRARY_SUFFIX _a$<$<CONFIG:Debug>:d>.lib)
endif()
-add_library(${PROJECT_NAME} INTERFACE)
-target_include_directories(${PROJECT_NAME} SYSTEM INTERFACE
- $<BUILD_INTERFACE:${${PROJECT_NAME}_INSTALL_DIR}/include/libxml2>
+add_library(LibXml2_LibXml2 INTERFACE)
+target_include_directories(LibXml2_LibXml2 SYSTEM INTERFACE
+ $<BUILD_INTERFACE:${INSTALL_DIR}/include/libxml2>
)
-target_link_libraries(${PROJECT_NAME} INTERFACE
- ${${PROJECT_NAME}_INSTALL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}xml2${CMAKE_STATIC_LIBRARY_SUFFIX}
+target_link_libraries(LibXml2_LibXml2 INTERFACE
+ ${INSTALL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}xml2${CMAKE_STATIC_LIBRARY_SUFFIX}
)
if (${UNIX})
- target_link_libraries(${PROJECT_NAME} INTERFACE
- z
+ target_link_libraries(LibXml2_LibXml2 INTERFACE
+ z
)
endif()
-add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXTERN})
+add_dependencies(LibXml2_LibXml2 ${EXTERN})
+
+add_library(LibXml2::LibXml2 ALIAS LibXml2_LibXml2)
diff --git a/dependencies/openssl/CMakeLists.txt b/dependencies/openssl/CMakeLists.txt
index d4dfb3c..9587e00 100644
--- a/dependencies/openssl/CMakeLists.txt
+++ b/dependencies/openssl/CMakeLists.txt
@@ -4,9 +4,9 @@
# 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.
@@ -15,12 +15,8 @@
project( openssl LANGUAGES NONE )
-set( ${PROJECT_NAME}_VERSION 1.1.0 )
-set( ${PROJECT_NAME}_SHA265 f5c69ff9ac1472c80b868efc1c1c0d8dcfc746d29ebe563de2365dd56dbd8c82 )
-set( ${PROJECT_NAME}_URL "https://www.openssl.org/source/openssl-${${PROJECT_NAME}_VERSION}.tar.gz" )
-set( ${PROJECT_NAME}_EXTERN ${PROJECT_NAME}-extern )
-
-set ( ${PROJECT_NAME}_CFLAGS "${${PROJECT_NAME}_CFLAGS} ${CFLAGS_ARCH}" )
+set( VERSION 1.1.1a )
+set( SHA256 fc20130f8b7cbd2fb918b2f14e2f429e109c31ddd0fb38fc5d71d9ffed3f9f41 )
if ("SunOS" STREQUAL ${CMAKE_SYSTEM_NAME})
# No debug for Solaris without patching Configure
@@ -63,21 +59,23 @@
endif()
if (${WIN32})
+ find_package(Perl REQUIRED)
# Keeps separate release/debug objects in build script
- set ( _CONFIGURE_COMMAND ${PERL} Configure ${openssl_PLATFORM} --prefix=<INSTALL_DIR>/${_DEBUG_OR_RELEASE} --openssldir=<INSTALL_DIR>/${_DEBUG_OR_RELEASE} ${openssl_CONFIGURE_FLAGS} )
+ set ( _CONFIGURE_COMMAND ${PERL_EXECUTABLE} Configure ${openssl_PLATFORM} --prefix=<INSTALL_DIR>/$<CONFIG> --openssldir=<INSTALL_DIR>/$<CONFIG> ${openssl_CONFIGURE_FLAGS} )
set ( _BUILD_COMMAND nmake )
- set ( _INSTALL_COMMAND nmake install )
+ set ( _INSTALL_COMMAND nmake install_sw )
else()
# TODO Configure trips up without MAKE
- set ( _CONFIGURE_COMMAND MAKE=$(MAKE) ./Configure threads zlib shared --prefix=<INSTALL_DIR>/${_DEBUG_OR_RELEASE} ${openssl_CONFIGURE_FLAGS} ${openssl_PLATFORM} )
+ set ( _CONFIGURE_COMMAND MAKE=$(MAKE) ./Configure threads zlib shared --prefix=<INSTALL_DIR>/$<CONFIG> ${openssl_CONFIGURE_FLAGS} ${openssl_PLATFORM} )
set ( _BUILD_COMMAND $(MAKE) all )
set ( _INSTALL_COMMAND $(MAKE) install_sw )
endif()
+set( EXTERN ${PROJECT_NAME}-extern )
include(ExternalProject)
-ExternalProject_Add( ${${PROJECT_NAME}_EXTERN}
- URL ${${PROJECT_NAME}_URL}
- URL_HASH SHA256=${${PROJECT_NAME}_SHA265}
+ExternalProject_Add( ${EXTERN}
+ URL "https://www.openssl.org/source/openssl-${VERSION}.tar.gz"
+ URL_HASH SHA256=${SHA256}
UPDATE_COMMAND ""
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND "${_CONFIGURE_COMMAND}"
@@ -86,39 +84,37 @@
# TODO TEST_COMMAND $(MAKE) test
)
-ExternalProject_Get_Property( ${${PROJECT_NAME}_EXTERN} SOURCE_DIR )
-set( ${PROJECT_NAME}_SOURCE_DIR ${SOURCE_DIR} )
-ExternalProject_Get_Property( ${${PROJECT_NAME}_EXTERN} INSTALL_DIR )
-set( ${PROJECT_NAME}_INSTALL_DIR ${INSTALL_DIR}/${_DEBUG_OR_RELEASE} )
-set( DEPENDENCIES_${PROJECT_NAME}_DIR ${${PROJECT_NAME}_INSTALL_DIR} PARENT_SCOPE)
+ExternalProject_Get_Property( ${EXTERN} INSTALL_DIR )
+set(INSTALL_DIR "${INSTALL_DIR}/$<CONFIG>")
if (${WIN32})
- set( CRYPTO_NAME libcrypto )
- set( SSL_NAME libssl )
+ set( CMAKE_SHARED_LIBRARY_PREFIX lib )
else()
- set( CRYPTO_NAME crypto )
- set( SSL_NAME ssl )
set( CMAKE_LINK_LIBRARY_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX})
endif()
-add_library(ssl INTERFACE)
-target_include_directories(ssl SYSTEM INTERFACE
- $<BUILD_INTERFACE:${${PROJECT_NAME}_INSTALL_DIR}/include>
+add_library(OpenSSL_SSL INTERFACE)
+target_include_directories(OpenSSL_SSL SYSTEM INTERFACE
+ $<BUILD_INTERFACE:${INSTALL_DIR}/include>
)
-target_link_libraries(ssl INTERFACE
- ${${PROJECT_NAME}_INSTALL_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}${SSL_NAME}${CMAKE_LINK_LIBRARY_SUFFIX}
+target_link_libraries(OpenSSL_SSL INTERFACE
+ ${INSTALL_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}ssl${CMAKE_LINK_LIBRARY_SUFFIX}
)
-add_dependencies(ssl ${${PROJECT_NAME}_EXTERN})
+add_dependencies(OpenSSL_SSL ${EXTERN})
-add_library(crypto INTERFACE)
-target_include_directories(crypto SYSTEM INTERFACE
- $<BUILD_INTERFACE:${${PROJECT_NAME}_INSTALL_DIR}/include>
+add_library(OpenSSL_Crypto INTERFACE)
+target_include_directories(OpenSSL_Crypto SYSTEM INTERFACE
+ $<BUILD_INTERFACE:${INSTALL_DIR}/include>
)
-target_link_libraries(crypto INTERFACE
- ${${PROJECT_NAME}_INSTALL_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}${CRYPTO_NAME}${CMAKE_LINK_LIBRARY_SUFFIX}
+target_link_libraries(OpenSSL_Crypto INTERFACE
+ ${INSTALL_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}crypto${CMAKE_LINK_LIBRARY_SUFFIX}
)
-add_dependencies(crypto ${${PROJECT_NAME}_EXTERN})
+add_dependencies(OpenSSL_Crypto ${EXTERN})
-set_target_properties(ssl crypto PROPERTIES INTERFACE_LIBRARY_DIR ${${PROJECT_NAME}_INSTALL_DIR}/lib)
-set_target_properties(ssl crypto PROPERTIES INTERFACE_RUNTIME_DIR ${${PROJECT_NAME}_INSTALL_DIR}/bin)
+set_target_properties(OpenSSL_SSL OpenSSL_Crypto PROPERTIES
+ INTERFACE_LIBRARY_DIR ${INSTALL_DIR}/lib
+ INTERFACE_RUNTIME_DIR ${INSTALL_DIR}/bin
+)
+add_library(OpenSSL::SSL ALIAS OpenSSL_SSL)
+add_library(OpenSSL::Crypto ALIAS OpenSSL_Crypto)
diff --git a/dependencies/rat/CMakeLists.txt b/dependencies/rat/CMakeLists.txt
new file mode 100644
index 0000000..8615026
--- /dev/null
+++ b/dependencies/rat/CMakeLists.txt
@@ -0,0 +1,29 @@
+# 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.
+
+project( rat VERSION 0.12 LANGUAGES NONE )
+# used to check licenses in source
+
+set( ARTIFACT_NAME apache-rat-${PROJECT_VERSION} )
+set( ARTIFACT_FILE apache-rat-${PROJECT_VERSION}-bin.tar.gz )
+set( ARTIFACT_URL "https://www.apache.org/dyn/closer.cgi?action=download&filename=creadur/${ARTIFACT_NAME}/${ARTIFACT_FILE}" )
+
+file( DOWNLOAD ${ARTIFACT_URL} ${CMAKE_CURRENT_BINARY_DIR}/${ARTIFACT_FILE} )
+execute_process(
+ COMMAND ${CMAKE_COMMAND} -E tar xzf ${ARTIFACT_FILE}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+)
+
+set( Rat_JAR ${CMAKE_CURRENT_BINARY_DIR}/${ARTIFACT_NAME}/${ARTIFACT_NAME}.jar CACHE STRING "Full path to Apaceh Rat jar." )
diff --git a/dependencies/sqlite-netFx/CMakeLists.txt b/dependencies/sqlite-netFx/CMakeLists.txt
index d0cd244..4be8359 100644
--- a/dependencies/sqlite-netFx/CMakeLists.txt
+++ b/dependencies/sqlite-netFx/CMakeLists.txt
@@ -13,28 +13,24 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-project( sqlite-netFx LANGUAGES NONE )
-set( ${PROJECT_NAME}_VERSION 1.0.102.0 )
-set( ${PROJECT_NAME}_SHA265 b980e8a151ddc685ed30652d39573381aef7b623478cba80b02d0795607638e1 )
-set( ${PROJECT_NAME}_URL "https://system.data.sqlite.org/blobs/${${PROJECT_NAME}_VERSION}/${PROJECT_NAME}451-binary-x64-2013-${${PROJECT_NAME}_VERSION}.zip" )
+project( sqlite-netFx VERSION 1.0.102.0 LANGUAGES NONE )
+
+set( SHA256 b980e8a151ddc685ed30652d39573381aef7b623478cba80b02d0795607638e1 )
include(ExternalProject)
-
ExternalProject_Add( ${PROJECT_NAME}
- URL ${${PROJECT_NAME}_URL}
- URL_HASH SHA256=${${PROJECT_NAME}_SHA265}
- # SOURCE_DIR ${PROJECT_NAME}-prefix
+ URL "https://system.data.sqlite.org/blobs/${PROJECT_VERSION}/${PROJECT_NAME}451-binary-x64-2013-${PROJECT_VERSION}.zip"
+ URL_HASH SHA256=${SHA256}
UPDATE_COMMAND ""
BUILD_COMMAND ""
CONFIGURE_COMMAND ""
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy <SOURCE_DIR>/System.Data.SQLite.dll <INSTALL_DIR>
)
-
-ExternalProject_Get_Property( ${PROJECT_NAME} SOURCE_DIR )
-set( ${PROJECT_NAME}_SOURCE_DIR ${SOURCE_DIR} )
ExternalProject_Get_Property( ${PROJECT_NAME} INSTALL_DIR )
-set( ${PROJECT_NAME}_INSTALL_DIR ${INSTALL_DIR} )
-set( DEPENDENCIES_${PROJECT_NAME}_DIR ${${PROJECT_NAME}_INSTALL_DIR} PARENT_SCOPE)
-set( DEPENDENCIES_${PROJECT_NAME}_VERSION ${${PROJECT_NAME}_VERSION} PARENT_SCOPE)
-set( ${PROJECT_NAME}_SHARED_LIB ${${PROJECT_NAME}_INSTALL_DIR}/System.Data.SQLite.dll PARENT_SCOPE)
+add_library(SQLite_netFx INTERFACE)
+target_link_libraries(SQLite_netFx INTERFACE
+ ${INSTALL_DIR}/System.Data.SQLite.dll
+)
+add_dependencies(SQLite_netFx ${PROJECT_NAME})
+add_library(SQLite::netFx ALIAS SQLite_netFx)
diff --git a/dependencies/sqlite/CMakeLists.txt b/dependencies/sqlite/CMakeLists.txt
index 71dc4da..b26d176 100644
--- a/dependencies/sqlite/CMakeLists.txt
+++ b/dependencies/sqlite/CMakeLists.txt
@@ -4,60 +4,56 @@
# 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.
-project( sqlite LANGUAGES NONE )
+project( sqlite VERSION 3260000 LANGUAGES NONE )
-set( ${PROJECT_NAME}_VERSION 3140100 )
-set( ${PROJECT_NAME}_SHA265 bc7182476900017becb81565ecea7775d46ab747a97281aa610f4f45881c47a6 )
-set( ${PROJECT_NAME}_URL "https://www.sqlite.org/2016/sqlite-autoconf-${${PROJECT_NAME}_VERSION}.tar.gz" )
-set( ${PROJECT_NAME}_EXTERN ${PROJECT_NAME}-extern )
+set( SHA256 de5dcab133aa339a4cf9e97c40aa6062570086d6085d8f9ad7bc6ddf8a52096e )
-set ( ${PROJECT_NAME}_CFLAGS "${${PROJECT_NAME}_CFLAGS} ${CFLAGS_ARCH}" )
+set( EXTERN ${PROJECT_NAME}-extern )
include(ExternalProject)
-
-ExternalProject_Add( ${${PROJECT_NAME}_EXTERN}
- URL ${${PROJECT_NAME}_URL}
- URL_HASH SHA256=${${PROJECT_NAME}_SHA265}
- UPDATE_COMMAND ""
- CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
+ExternalProject_Add( ${EXTERN}
+ URL "https://www.sqlite.org/2018/sqlite-amalgamation-${PROJECT_VERSION}.zip"
+ URL_HASH SHA256=${SHA256}
+ UPDATE_COMMAND ""
+ CMAKE_ARGS
+ -DCMAKE_BUILD_TYPE=$<CONFIG>
+ -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
)
-ExternalProject_Get_Property( ${${PROJECT_NAME}_EXTERN} SOURCE_DIR )
-set( ${PROJECT_NAME}_SOURCE_DIR ${SOURCE_DIR} )
-ExternalProject_Get_Property( ${${PROJECT_NAME}_EXTERN} INSTALL_DIR )
-set( ${PROJECT_NAME}_INSTALL_DIR ${INSTALL_DIR} )
-set( DEPENDENCIES_${PROJECT_NAME}_DIR ${${PROJECT_NAME}_INSTALL_DIR} PARENT_SCOPE)
+ExternalProject_Get_Property( ${EXTERN} SOURCE_DIR )
+ExternalProject_Get_Property( ${EXTERN} INSTALL_DIR )
-ExternalProject_Add_Step( ${${PROJECT_NAME}_EXTERN} CMakeLists.txt
- DEPENDEES patch
- DEPENDERS configure
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt.in
- BYPRODUCTS ${${PROJECT_NAME}_SOURCE_DIR}/CMakeLists.txt
- COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt.in ${${PROJECT_NAME}_SOURCE_DIR}/CMakeLists.txt
+ExternalProject_Add_Step( ${EXTERN} CMakeLists.txt
+ DEPENDEES patch
+ DEPENDERS configure
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt.in
+ BYPRODUCTS ${SOURCE_DIR}/CMakeLists.txt
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt.in ${SOURCE_DIR}/CMakeLists.txt
)
if (WIN32)
set(CMAKE_SHARED_LIBRARY_SUFFIX .lib)
endif()
-add_library(${PROJECT_NAME} INTERFACE)
-target_include_directories(${PROJECT_NAME} SYSTEM INTERFACE
- $<BUILD_INTERFACE:${${PROJECT_NAME}_INSTALL_DIR}/include>
+add_library(SQLite_sqlite3 INTERFACE)
+target_include_directories(SQLite_sqlite3 SYSTEM INTERFACE
+ $<BUILD_INTERFACE:${INSTALL_DIR}/include>
)
-target_link_libraries(${PROJECT_NAME} INTERFACE
- ${${PROJECT_NAME}_INSTALL_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}sqlite3$<$<CONFIG:Debug>:d>${CMAKE_SHARED_LIBRARY_SUFFIX}
+target_link_libraries(SQLite_sqlite3 INTERFACE
+ ${INSTALL_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}sqlite3$<$<CONFIG:Debug>:d>${CMAKE_SHARED_LIBRARY_SUFFIX}
)
-add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXTERN})
+add_dependencies(SQLite_sqlite3 ${EXTERN})
-set_target_properties(${PROJECT_NAME} PROPERTIES INTERFACE_LIBRARY_DIR ${${PROJECT_NAME}_INSTALL_DIR}/lib)
-set_target_properties(${PROJECT_NAME} PROPERTIES INTERFACE_RUNTIME_DIR ${${PROJECT_NAME}_INSTALL_DIR}/bin)
+set_target_properties(SQLite_sqlite3 PROPERTIES INTERFACE_LIBRARY_DIR ${INSTALL_DIR}/lib)
+set_target_properties(SQLite_sqlite3 PROPERTIES INTERFACE_RUNTIME_DIR ${INSTALL_DIR}/bin)
+add_library(SQLite::sqlite3 ALIAS SQLite_sqlite3)
diff --git a/dhimpl/CMakeLists.txt b/dhimpl/CMakeLists.txt
index a5fe395..d256d5d 100644
--- a/dhimpl/CMakeLists.txt
+++ b/dhimpl/CMakeLists.txt
@@ -28,12 +28,13 @@
target_include_directories(DHImpl
PUBLIC
- $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>)
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
+)
target_link_libraries(DHImpl
- PUBLIC
+ PUBLIC
apache-geode
- crypto
+ OpenSSL::Crypto
c++11
PRIVATE
_WarningsAsError
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 55b6523..0e560a6 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -21,7 +21,7 @@
RUN apt-get update && \
apt-get install -y \
libc++-dev \
- libc++api-dev \
+ libc++abi-dev \
clang-${CLANG_VERSION} \
clang-tidy-${CLANG_VERSION} \
clang-format-${CLANG_VERSION} \
diff --git a/docs/README.md b/docs/README.md
index 4d28898..a8880dc 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -3,26 +3,30 @@
This document contains instructions for building and viewing the Apache Geode Native Client User Guide.
- [About](#about)
-- [Prerequisites](#prerequisites)
- [Bookbinder Usage](#bookbinder-usage)
+- [Docker Setup](#docker-setup)
- [Building the Documentation](#building-the-documentation)
+<a name="about"></a>
## About
The Geode-Native repository provides the full source for the Apache Geode Native Client User Guide in markdown format (see _geode-project-dir_/geode-docs/CONTRIBUTE.md for more information on how to use markdown in this context). Users can build the markdown into an HTML user guide using [Bookbinder](https://github.com/pivotal-cf/bookbinder) and the instructions below.
Bookbinder is a Ruby gem that binds a unified documentation web application from markdown, html, and/or DITA source material. The source material for bookbinder must be stored either in local directories or in GitHub repositories. Bookbinder runs [Middleman](http://middlemanapp.com/) to produce a Rackup app that can be deployed locally or as a web application.
+<a name="bookbinder-usage"></a>
## Bookbinder Usage
Bookbinder is meant to be used from within a project called a **book**. The book includes a configuration file that describes which documentation repositories to use as source materials. Bookbinder provides a set of scripts to aggregate those repositories and publish them to various locations.
For Geode Native Client, a preconfigured **book** is provided in the directory _geode-native-project-dir_/docs/geode-native-book, which gathers content from the directory _geode-native-project-dir_/docs/geode-native-docs. You can use this configuration to build an HTML version of the Apache Geode Native Client User Guide on your local system.
+<a name="docker-setup"></a>
## Docker Setup
For ease of use, a Docker image is provided that contains a self-consistent Bookbinder environment. [Install Docker](https://docs.docker.com/install/) if you have not already done so.
+<a name="building-the-documentation"></a>
## Building the Documentation
1. Navigate to the directory that contains the Dockerfile and run the `docker build` command to create the Bookbinder-enabled Docker image:
diff --git a/docs/api/unix_index.html b/docs/api/unix_index.html
index 464ba6e..9b1d6f1 100755
--- a/docs/api/unix_index.html
+++ b/docs/api/unix_index.html
@@ -32,8 +32,7 @@
Apache Geode Native Client Documentation</H1>
</b></FONT>
<p>
-Access documentation at <a href="http://docs-gemfire-nativeclient-develop.cfapps.io" target="_blank"><b>Pivotal GemFire Native Client Documentation</b></a>.
-NOTE: this is a temporary location until we are ready to host the docs at geode.apache.org.
+Access documentation at <a href="http://geode.apache.org/docs/" target="_blank"><b>Apache Geode Native Documentation</b></a>.
</p>
<hr color="#cc0000" width="75%" size="2" align="left">
diff --git a/docs/api/win_index.html b/docs/api/win_index.html
index d01f19d..28e82ba 100755
--- a/docs/api/win_index.html
+++ b/docs/api/win_index.html
@@ -31,9 +31,7 @@
<FONT size=6><b>
Apache Geode Native Client Documentation</H1>
</b></FONT>
-<p>
-Access documentation at <a href="http://docs-gemfire-nativeclient-develop.cfapps.io" target="_blank"><b>Pivotal GemFire Native Client Documentation</b></a>.
-NOTE: this is a temporary location until we are ready to host the docs at geode.apache.org.
+<p>Access documentation at <a href="http://geode.apache.org/docs/" target="_blank"><b>Apache Geode Native Documentation</b></a>.
</p>
<hr color="#cc0000" width="75%" size="2" align="left">
diff --git a/docs/docker/Dockerfile b/docs/docker/Dockerfile
index 82b3aed..ad5d674 100644
--- a/docs/docker/Dockerfile
+++ b/docs/docker/Dockerfile
@@ -1,3 +1,19 @@
+# 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.
+
FROM ubuntu:latest
RUN apt-get update
diff --git a/docs/geode-native-book/master_middleman/source/subnavs/geode-nc-nav.erb b/docs/geode-native-book/master_middleman/source/subnavs/geode-nc-nav.erb
index fc17f06..859b20a 100644
--- a/docs/geode-native-book/master_middleman/source/subnavs/geode-nc-nav.erb
+++ b/docs/geode-native-book/master_middleman/source/subnavs/geode-nc-nav.erb
@@ -86,6 +86,10 @@
</li>
<li>
+ <a href="/docs/geode-native/<%=vars.product_version_nodot%>/function-execution.html">Function Execution</a>
+ </li>
+
+ <li>
<a href="/docs/geode-native/<%=vars.product_version_nodot%>/transactions/transactions.html">Transactions</a>
</li>
</ul>
diff --git a/docs/geode-native-book/redirects.rb b/docs/geode-native-book/redirects.rb
index 4b64e23..9ae9f3b 100644
--- a/docs/geode-native-book/redirects.rb
+++ b/docs/geode-native-book/redirects.rb
@@ -14,10 +14,10 @@
#permissions and limitations under the License.
# Links to API Documentation #
-r301 %r{/releases/latest/javadoc/(.*)}, 'http://geode.apache.org/releases/latest/javadoc/$1'
+r301 %r{/releases/latest/javadoc/(.*)}, 'https://geode.apache.org/releases/latest/javadoc/$1'
# Links to User Guides #
rewrite '/', '/docs/geode-native/18/about-client-users-guide.html'
rewrite '/index.html', '/docs/geode-native/18/about-client-users-guide.html'
-r301 %r{/serverman/(.*)}, 'http://geode.apache.org/docs/guide/16/$1'
-r301 %r{/geodeman/(.*)}, 'http://geode.apache.org/docs/guide/16/$1'
+r301 %r{/serverman/(.*)}, 'https://geode.apache.org/docs/guide/18/$1'
+r301 %r{/geodeman/(.*)}, 'https://geode.apache.org/docs/guide/18/$1'
diff --git a/docs/geode-native-docs/configuring/sysprops.html.md.erb b/docs/geode-native-docs/configuring/sysprops.html.md.erb
index d563dea..890c7e6 100644
--- a/docs/geode-native-docs/configuring/sysprops.html.md.erb
+++ b/docs/geode-native-docs/configuring/sysprops.html.md.erb
@@ -50,7 +50,7 @@
<td>cache-xml-file</td>
<td>Name and path of the file whose contents are used by default to configure a cache if one is
created. If not specified, the client starts with an empty cache, which is populated at run time.
-<p>See <a href="../cache-init-file/chapter-overview.html#chapter-overview">Cache Initialization File</a> for more information on the cache initialization file.</p></td>
+</td>
<td>no default</td>
</tr>
<tr class="odd">
diff --git a/docs/geode-native-docs/function-execution.html.md.erb b/docs/geode-native-docs/function-execution.html.md.erb
new file mode 100644
index 0000000..e30dddc
--- /dev/null
+++ b/docs/geode-native-docs/function-execution.html.md.erb
@@ -0,0 +1,300 @@
+---
+title: Function Execution
+---
+
+<!--
+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.
+-->
+
+A client can invoke a server-resident function, with paramaters, and can collect and operate on the returned results.
+
+## <a id="server_side_requirements"></a>Server-side Requirements
+
+To be callable from your client, a function must be resident on the server and registered as available for client access.
+See [Executing a Function in <%=vars.product_name_long%>](/serverman/developing/function_exec/function_execution.html)
+in the <%=vars.product_name%> User Guide for details on how to write and register server-resident functions.
+
+## <a id="client_side_requirements"></a>Client-side Requirements
+
+The client must connect to the server through a connection pool in order to invoke a server-side function.
+
+## <a id="how_functions_execute"></a>How Functions Execute
+
+1. The calling client application runs the `execute` method on the `Execution` object. The object must already be registered on the servers.
+2. The function is invoked on all servers where it needs to run. The locations are determined by the `FunctionService on*`
+method calls, region configuration, and any filters.
+3. If the function has results, the result is returned in a `ResultCollector` object.
+4. The client collects results using the result collector `getResult`.
+
+In every client where you want to execute the function and process the results:
+
+- Use one of the `FunctionService on*` methods to create an `Execution` object. The `on*` methods,
+`onRegion`, `onServer` and `onServers`, define the highest level where the function is run. If
+you use `onRegion` you can further narrow your run scope by setting key filters. The function run
+using `onRegion` is a data dependent function – the others are data-independent functions.
+
+You can run a data dependent function against custom partitioned and colocated partitioned regions. From the client, provide the appropriate key
+ sets to the function call.
+
+- Use the `Execution` object as needed for additional function configuration. You can:
+ - Provide a set of data keys to `withFilter` to narrow the execution scope. This works only for `onRegion` Execution objects.
+ - Provide function arguments to `withArgs`.
+ - Define a custom `ResultCollector` to `withCollector`.
+
+- Call the `Execution` object execute method to run the function.
+
+## <a id="processing_function_results"></a>Processing Function Results
+
+The client may use the default result collector. If the client needs special results handling, code
+a custom `ResultsCollector` implementation to replace the default. Use the
+`Execution::withCollector` method to define the custom collector.
+
+For example, to program your client to get the results from a function, use the result collector returned from the function execution, like this:
+
+```cpp
+ResultCollectorPtr rc = FunctionService::onRegion(region)
+ ->withArgs(args)
+ ->withFilter(keySet)
+ ->withCollector(new MyCustomResultCollector())
+ .execute(Function);
+CacheableVectorPtr functionResult = rc.getResult();
+```
+
+The `getResult` methods of the default result collector block until all results are received, then return the full result set.
+
+To handle the results in a custom manner:
+
+1. Write a class that implements the `ResultCollector` interface to handle the results in a custom manner. The methods are of two types: one handles data and information from <%=vars.product_name%> and populates the results set, while the other returns the compiled results to the calling application:
+ - `addResult` is called when results arrive from the `Function` methods. Use `addResult` to add a single result to the ResultCollector.
+ - `endResults` is called to signal the end of all results from the function execution.
+ - `getResult` is available to your executing application (the one that calls `Execution.execute`) to retrieve the results. This may block until all results are available.
+ - `clearResults` is called to clear partial results from the results collector. This is used only for highly available `onRegion` functions where the calling application waits for the results. If the call fails, before <%=vars.product_name%> retries the execution, it calls `clearResults` to ready the instance for a clean set of results.
+2. Use the `Execution` object in your executing member to call `withCollector`, passing your custom collector, as shown in the example above.
+
+# <a id="examples"></a>Examples
+
+The native client source release contains examples of function execution written for .NET and
+C++. The examples are located in `../examples/dotnet/FunctionExecutionCs` and
+`../examples/cpp/function-execution`, respectively.
+
+Both examples begin with a server-side script that runs `gfsh` commands to create
+a region, simply called "partition_region", which is preloaded with a JAR file containing the
+server-side Java function code. The function, called "ExampleMultiGetFunction", is defined in the
+`examples/utilities` directory of your distribution. As its input parameter, the function takes an array of keys,
+then performs a `get` on each key and returns an array containing the results.
+The function does not load values into the data store. That is a separate operation, performed in these examples by
+the client, and does not involve the server-side function.
+
+As prerequisites, the client code must be aware of the connection to the server, the name of the function, and the expected type/format
+of the input parameter and return value.
+
+The client:
+
+- creates an execution object
+- populates the execution object with input parameters
+- invokes the object's execute method to invoke the server-side function.
+
+If the client expects results, it must create a result
+object. Optionally, the client can use a provided result collector which offers some predefined
+methods for iterating over and processing return values.
+
+## <a id="dotnet_example"></a>.NET Example
+This section contains code snippets showing highlights of the .NET function execution example. They are not intended for cut-and-paste execution.
+For the complete source, see the example source directory.
+
+The .NET example creates a cache, then uses it to create a connection pool.
+
+```csharp
+ var cacheFactory = new CacheFactory()
+ .Set("log-level", "none");
+ var cache = cacheFactory.Create();
+
+ var poolFactory = cache.GetPoolFactory()
+ .AddLocator("localhost", 10334);
+ var pool = poolFactory.Create("pool");
+```
+
+The example uses the connection pool to create a region, with the same characteristics and name as the server-side region (`partition_region`).
+
+```csharp
+ var regionFactory = cache.CreateRegionFactory(RegionShortcut.PROXY)
+ .SetPoolName("pool");
+ var region = regionFactory.Create<object, object>("partition_region");
+```
+
+The sample client populates the server's datastore with values, using the API and some sample key-value pairs.
+
+```csharp
+ string rtimmonsKey = "rtimmons";
+ string rtimmonsValue = "Robert Timmons";
+ string scharlesKey = "scharles";
+ string scharlesValue = "Sylvia Charles";
+ region.Put(rtimmonsKey, rtimmonsValue, null);
+ region.Put(scharlesKey, scharlesValue, null);
+```
+
+To confirm that the data has been stored, the client uses the API to retrieve the values and write them to the console.
+This is done without reference to the server-side example function.
+
+```csharp
+ var user1 = region.Get(rtimmonsKey, null);
+ var user2 = region.Get(scharlesKey, null);
+
+ Console.WriteLine(rtimmonsKey + " = " + user1);
+ Console.WriteLine(scharlesKey + " = " + user2);
+```
+
+Next, the client retrieves those same values using the server-side example function.
+The client code creates the input parameter, an array of keys whose values are to be retrieved.
+
+```csharp
+ ArrayList keyArgs = new ArrayList();
+ keyArgs.Add(rtimmonsKey);
+ keyArgs.Add(scharlesKey);
+```
+
+The client creates an execution object using `Client.FunctionService.OnRegion` and specifying the region.
+
+```csharp
+ var exc = Client.FunctionService<object>.OnRegion<object, object>(region);
+```
+
+The client then calls the server side function with its input arguments and stores the results in a Client.IResultCollector.
+
+```csharp
+ Client.IResultCollector<object> rc = exc.WithArgs<object>(keyArgs).Execute("ExampleMultiGetFunction");
+```
+
+It then loops through the results and prints the retrieved values.
+
+```csharp
+ ICollection<object> res = rc.GetResult();
+
+ Console.WriteLine("Function Execution Results:");
+ Console.WriteLine(" Count = {0}", res.Count);
+
+ foreach (List<object> item in res)
+ {
+ foreach (object item2 in item)
+ {
+ Console.WriteLine(" value = {0}", item2.ToString());
+ }
+ }
+```
+
+## <a id="cpp_example"></a>C++ Example
+This section contains code snippets showing highlights of the C++ function execution example. They are not intended for cut-and-paste execution.
+For the complete source, see the example source directory.
+
+The C++ example creates a cache.
+
+```cpp
+Cache setupCache() {
+ return CacheFactory()
+ .set("log-level", "none")
+ .create();
+}
+```
+
+The example client uses the cache to create a connection pool,
+
+```cpp
+void createPool(const Cache& cache) {
+ auto pool = cache.getPoolManager()
+ .createFactory()
+ .addServer("localhost", EXAMPLE_SERVER_PORT)
+ .create("pool");
+}
+```
+
+Then, using that pool, the client creates a region with the same characteristics and name as the server-side region (`partition_region`).
+
+```cpp
+std::shared_ptr<Region> createRegion(Cache& cache) {
+ auto regionFactory = cache.createRegionFactory(RegionShortcut::PROXY);
+ auto region = regionFactory.setPoolName("pool").create("partition_region");
+
+ return region;
+}
+```
+
+The sample client populates the server's datastore with values, using the API and some sample key-value pairs.
+
+```cpp
+void populateRegion(const std::shared_ptr<Region>& region) {
+ for (int i = 0; i < keys.size(); i++) {
+ region->put(keys[i], values[i]);
+ }
+}
+```
+
+As confirmation that the data has been stored, the sample client uses the API to retrieve the values and write them to the console.
+This is done without reference to the server-side example function.
+
+```cpp
+std::shared_ptr<CacheableVector> populateArguments() {
+ auto arguments = CacheableVector::create();
+ for (int i = 0; i < keys.size(); i++) {
+ arguments->push_back(CacheableKey::create(keys[i]));
+ }
+ return arguments;
+}
+```
+
+Next, the client retrieves those same values using the server-side example function.
+The client code creates the input parameter, an array of keys whose values are to be retrieved.
+
+```cpp
+std::vector<std::string> executeFunctionOnServer(const std::shared_ptr<Region> region,
+ const std::shared_ptr<CacheableVector> arguments) {
+ std::vector<std::string> resultList;
+```
+
+The client creates an execution object using `Client.FunctionService.OnRegion` and specifying the region.
+
+```cpp
+ auto functionService = FunctionService::onServer(region->getRegionService());
+```
+
+The client then calls the server side function with its input arguments and stores the results in a Client.IResultCollector.
+
+```cpp
+ if(auto executeFunctionResult = functionService.withArgs(arguments).execute(getFuncIName)->getResult()) {
+ for (auto &arrayList: *executeFunctionResult) {
+ for (auto &cachedString: *std::dynamic_pointer_cast<CacheableArrayList>(arrayList)) {
+ resultList.push_back(std::dynamic_pointer_cast<CacheableString>(cachedString)->value());
+ }
+ }
+ } else {
+ std::cout << "get executeFunctionResult is NULL\n";
+ }
+
+ return resultList;
+}
+```
+
+It then loops through the results and prints the retrieved values.
+
+```cpp
+void printResults(const std::vector<std::string>& resultList) {
+ std::cout << "Result count = " << resultList.size() << std::endl << std::endl;
+ int i = 0;
+ for (auto &cachedString: resultList) {
+ std::cout << "\tResult[" << i << "]=" << cachedString << std::endl;
+ ++i;
+ }
+```
+
diff --git a/docs/geode-native-docs/function-execution.html.md.erb-NOTOC b/docs/geode-native-docs/function-execution.html.md.erb-NOTOC
new file mode 100644
index 0000000..92ef29b
--- /dev/null
+++ b/docs/geode-native-docs/function-execution.html.md.erb-NOTOC
@@ -0,0 +1,300 @@
+---
+title: Function Execution
+---
+
+<!--
+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.
+-->
+
+A client can invoke a server-resident function, with paramaters, and can collect and operate on the returned results.
+
+## Server-side Requirements
+
+To be callable from your client, a function must be resident on the server and registered as available for client access.
+See [Executing a Function in <%=vars.product_name_long%>](/serverman/developing/function_exec/function_execution.html)
+in the <%=vars.product_name%> User Guide for details on how to write and register server-resident functions.
+
+## Client-side Requirements
+
+The client must connect to the server through a connection pool in order to invoke a server-side function.
+
+## How Functions Execute
+
+1. The calling client application runs the `execute` method on the `Execution` object. The object must already be registered on the servers.
+2. The function is invoked on all servers where it needs to run. The locations are determined by the `FunctionService on*`
+method calls, region configuration, and any filters.
+3. If the function has results, the result is returned in a `ResultCollector` object.
+4. The client collects results using the result collector `getResult`.
+
+In every client where you want to execute the function and process the results:
+
+- Use one of the `FunctionService on*` methods to create an `Execution` object. The `on*` methods,
+`onRegion`, `onServer` and `onServers`, define the highest level where the function is run. If
+you use `onRegion` you can further narrow your run scope by setting key filters. The function run
+using `onRegion` is a data dependent function – the others are data-independent functions.
+
+You can run a data dependent function against custom partitioned and colocated partitioned regions. From the client, provide the appropriate key
+ sets to the function call.
+
+- Use the `Execution` object as needed for additional function configuration. You can:
+ - Provide a set of data keys to `withFilter` to narrow the execution scope. This works only for `onRegion` Execution objects.
+ - Provide function arguments to `withArgs`.
+ - Define a custom `ResultCollector` to `withCollector`.
+
+- Call the `Execution` object execute method to run the function.
+
+## Processing Function Results
+
+The client may use the default result collector. If the client needs special results handling, code
+a custom `ResultsCollector` implementation to replace the default. Use the
+`Execution::withCollector` method to define the custom collector.
+
+For example, to program your client to get the results from a function, use the result collector returned from the function execution, like this:
+
+```cpp
+ResultCollectorPtr rc = FunctionService::onRegion(region)
+ ->withArgs(args)
+ ->withFilter(keySet)
+ ->withCollector(new MyCustomResultCollector())
+ .execute(Function);
+CacheableVectorPtr functionResult = rc.getResult();
+```
+
+The `getResult` methods of the default result collector block until all results are received, then return the full result set.
+
+To handle the results in a custom manner:
+
+1. Write a class that implements the `ResultCollector` interface to handle the results in a custom manner. The methods are of two types: one handles data and information from <%=vars.product_name%> and populates the results set, while the other returns the compiled results to the calling application:
+ - `addResult` is called when results arrive from the `Function` methods. Use `addResult` to add a single result to the ResultCollector.
+ - `endResults` is called to signal the end of all results from the function execution.
+ - `getResult` is available to your executing application (the one that calls `Execution.execute`) to retrieve the results. This may block until all results are available.
+ - `clearResults` is called to clear partial results from the results collector. This is used only for highly available `onRegion` functions where the calling application waits for the results. If the call fails, before <%=vars.product_name%> retries the execution, it calls `clearResults` to ready the instance for a clean set of results.
+2. Use the `Execution` object in your executing member to call `withCollector`, passing your custom collector, as shown in the example above.
+
+# Examples
+
+The native client source release contains examples of function execution written for .NET and
+C++. The examples are located in `../examples/dotnet/FunctionExecutionCs` and
+`../examples/cpp/function-execution`, respectively.
+
+Both examples begin with a server-side script that runs `gfsh` commands to create
+a region, simply called "partition_region", which is preloaded with a JAR file containing the
+server-side Java function code. The function, called "ExampleMultiGetFunction", is defined in the
+`examples/utilities` directory of your distribution. As its input parameter, the function takes an array of keys,
+then performs a `get` on each key and returns an array containing the results.
+The function does not load values into the data store. That is a separate operation, performed in these examples by
+the client, and does not involve the server-side function.
+
+As prerequisites, the client code must be aware of the connection to the server, the name of the function, and the expected type/format
+of the input parameter and return value.
+
+The client:
+
+- creates an execution object
+- populates the execution object with input parameters
+- invokes the object's execute method to invoke the server-side function.
+
+If the client expects results, it must create a result
+object. Optionally, the client can use a provided result collector which offers some predefined
+methods for iterating over and processing return values.
+
+## .NET Example
+This section contains code snippets showing highlights of the .NET function execution example. They are not intended for cut-and-paste execution.
+For the complete source, see the example source directory.
+
+The .NET example creates a cache, then uses it to create a connection pool.
+
+```csharp
+ var cacheFactory = new CacheFactory()
+ .Set("log-level", "none");
+ var cache = cacheFactory.Create();
+
+ var poolFactory = cache.GetPoolFactory()
+ .AddLocator("localhost", 10334);
+ var pool = poolFactory.Create("pool");
+```
+
+The example uses the connection pool to create a region, with the same characteristics and name as the server-side region (`partition_region`).
+
+```csharp
+ var regionFactory = cache.CreateRegionFactory(RegionShortcut.PROXY)
+ .SetPoolName("pool");
+ var region = regionFactory.Create<object, object>("partition_region");
+```
+
+The sample client populates the server's datastore with values, using the API and some sample key-value pairs.
+
+```csharp
+ string rtimmonsKey = "rtimmons";
+ string rtimmonsValue = "Robert Timmons";
+ string scharlesKey = "scharles";
+ string scharlesValue = "Sylvia Charles";
+ region.Put(rtimmonsKey, rtimmonsValue, null);
+ region.Put(scharlesKey, scharlesValue, null);
+```
+
+To confirm that the data has been stored, the client uses the API to retrieve the values and write them to the console.
+This is done without reference to the server-side example function.
+
+```csharp
+ var user1 = region.Get(rtimmonsKey, null);
+ var user2 = region.Get(scharlesKey, null);
+
+ Console.WriteLine(rtimmonsKey + " = " + user1);
+ Console.WriteLine(scharlesKey + " = " + user2);
+```
+
+Next, the client retrieves those same values using the server-side example function.
+The client code creates the input parameter, an array of keys whose values are to be retrieved.
+
+```csharp
+ ArrayList keyArgs = new ArrayList();
+ keyArgs.Add(rtimmonsKey);
+ keyArgs.Add(scharlesKey);
+```
+
+The client creates an execution object using `Client.FunctionService.OnRegion` and specifying the region.
+
+```csharp
+ var exc = Client.FunctionService<object>.OnRegion<object, object>(region);
+```
+
+The client then calls the server side function with its input arguments and stores the results in a Client.IResultCollector.
+
+```csharp
+ Client.IResultCollector<object> rc = exc.WithArgs<object>(keyArgs).Execute("ExampleMultiGetFunction");
+```
+
+It then loops through the results and prints the retrieved values.
+
+```csharp
+ ICollection<object> res = rc.GetResult();
+
+ Console.WriteLine("Function Execution Results:");
+ Console.WriteLine(" Count = {0}", res.Count);
+
+ foreach (List<object> item in res)
+ {
+ foreach (object item2 in item)
+ {
+ Console.WriteLine(" value = {0}", item2.ToString());
+ }
+ }
+```
+
+## C++ Example
+This section contains code snippets showing highlights of the C++ function execution example. They are not intended for cut-and-paste execution.
+For the complete source, see the example source directory.
+
+The C++ example creates a cache.
+
+```cpp
+Cache setupCache() {
+ return CacheFactory()
+ .set("log-level", "none")
+ .create();
+}
+```
+
+The example client uses the cache to create a connection pool,
+
+```cpp
+void createPool(const Cache& cache) {
+ auto pool = cache.getPoolManager()
+ .createFactory()
+ .addServer("localhost", EXAMPLE_SERVER_PORT)
+ .create("pool");
+}
+```
+
+Then, using that pool, the client creates a region with the same characteristics and name as the server-side region (`partition_region`).
+
+```cpp
+std::shared_ptr<Region> createRegion(Cache& cache) {
+ auto regionFactory = cache.createRegionFactory(RegionShortcut::PROXY);
+ auto region = regionFactory.setPoolName("pool").create("partition_region");
+
+ return region;
+}
+```
+
+The sample client populates the server's datastore with values, using the API and some sample key-value pairs.
+
+```cpp
+void populateRegion(const std::shared_ptr<Region>& region) {
+ for (int i = 0; i < keys.size(); i++) {
+ region->put(keys[i], values[i]);
+ }
+}
+```
+
+As confirmation that the data has been stored, the sample client uses the API to retrieve the values and write them to the console.
+This is done without reference to the server-side example function.
+
+```cpp
+std::shared_ptr<CacheableVector> populateArguments() {
+ auto arguments = CacheableVector::create();
+ for (int i = 0; i < keys.size(); i++) {
+ arguments->push_back(CacheableKey::create(keys[i]));
+ }
+ return arguments;
+}
+```
+
+Next, the client retrieves those same values using the server-side example function.
+The client code creates the input parameter, an array of keys whose values are to be retrieved.
+
+```cpp
+std::vector<std::string> executeFunctionOnServer(const std::shared_ptr<Region> region,
+ const std::shared_ptr<CacheableVector> arguments) {
+ std::vector<std::string> resultList;
+```
+
+The client creates an execution object using `Client.FunctionService.OnRegion` and specifying the region.
+
+```cpp
+ auto functionService = FunctionService::onServer(region->getRegionService());
+```
+
+The client then calls the server side function with its input arguments and stores the results in a Client.IResultCollector.
+
+```cpp
+ if(auto executeFunctionResult = functionService.withArgs(arguments).execute(getFuncIName)->getResult()) {
+ for (auto &arrayList: *executeFunctionResult) {
+ for (auto &cachedString: *std::dynamic_pointer_cast<CacheableArrayList>(arrayList)) {
+ resultList.push_back(std::dynamic_pointer_cast<CacheableString>(cachedString)->value());
+ }
+ }
+ } else {
+ std::cout << "get executeFunctionResult is NULL\n";
+ }
+
+ return resultList;
+}
+```
+
+It then loops through the results and prints the retrieved values.
+
+```cpp
+void printResults(const std::vector<std::string>& resultList) {
+ std::cout << "Result count = " << resultList.size() << std::endl << std::endl;
+ int i = 0;
+ for (auto &cachedString: resultList) {
+ std::cout << "\tResult[" << i << "]=" << cachedString << std::endl;
+ ++i;
+ }
+```
+
diff --git a/docs/geode-native-docs/security/authentication.html.md.erb b/docs/geode-native-docs/security/authentication.html.md.erb
index 8c0597e..9e8eee2 100644
--- a/docs/geode-native-docs/security/authentication.html.md.erb
+++ b/docs/geode-native-docs/security/authentication.html.md.erb
@@ -19,11 +19,9 @@
limitations under the License.
-->
-A client is authenticated when it connects with valid credentials to a <%=vars.product_name%> cache server that is configured with the client `Authenticator` callback.
+A client is authenticated when it connects with valid credentials to a <%=vars.product_name%> cache server that is configured with the client authentication callback.
For details on the server's role in authentication and what it expects from the client, see [Implementing Authentication](geodeman/managing/security/implementing_authentication.html) in the *<%=vars.product_name%> User Guide*.
-Examples of various implementations can be found in the Native Client source distribution's `../templates/security` directory.
-
In your application, authentication credentials must be set when creating the cache. In practice,
this means setting the authentication credentials when you create the CacheFactory.
@@ -32,6 +30,15 @@
The following excerpt is taken from the .NET example provided with your Native Client distribution in the `..\examples\dotnet\AuthInitialize` directory.
In this C# authentication example, credentials are implemented in the GetCredentials member function of the ExampleAuthInitialize class, which implements the IAuthInitialize interface.
+In this C# authentication example, the `CacheFactory` creation process sets the authentication callback:
+
+```cs
+ var cacheFactory = new CacheFactory()
+ .Set("log-level", "none")
+ .SetAuthInitialize(new ExampleAuthInitialize());
+```
+
+Credentials are implemented in the `GetCredentials` member function of the `ExampleAuthInitialize` class, which implements the `IAuthInitialize` interface:
```cs
class ExampleAuthInitialize : IAuthInitialize
diff --git a/examples/cpp/BUILD-CPP-EXAMPLES.md b/examples/BUILD-EXAMPLES.md
similarity index 84%
rename from examples/cpp/BUILD-CPP-EXAMPLES.md
rename to examples/BUILD-EXAMPLES.md
index f70f578..bdd1b97 100644
--- a/examples/cpp/BUILD-CPP-EXAMPLES.md
+++ b/examples/BUILD-EXAMPLES.md
@@ -12,13 +12,13 @@
**For Windows:** For reliable behavior of the example scripts, do not choose a workspace with directory names or filenames that contain spaces.
-1. Navigate to the directory for a specific example and use `cmake` to build it. For non-Windows systems, the commands are:
+1. Navigate to the examples directory and use `cmake` to build all examples. For non-Windows systems, the commands are:
```
- $ cd workspace/examples/cpp/<example>
+ $ cd workspace/examples
$ mkdir build
$ cd build
- $ cmake ..
+ $ cmake .. -DGEODE_ROOT="<geode-install-root-dir>"
$ cmake --build . -- <optional parallelism parameter>
```
where the optional parallelism parameter is of the form `-j n`.
@@ -26,7 +26,7 @@
**For Windows:** Include options that specify the generator, the architecture toolset, and the path to the Geode Native installation:
```
- $ cd workspace/examples/cpp/<example>
+ $ cd workspace/examples/
$ mkdir build
$ cd build
$ cmake .. -G"Visual Studio 14 2015 Win64" -Thost=x64 -DGeodeNative_ROOT="<NC-install-root-dir>"
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 0566b6c..f5db00f 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -25,14 +25,28 @@
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt.in ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindGeodeNative.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/cmake/Find${PRODUCT_NAME_NOSPACE}.cmake @ONLY)
+install(DIRECTORY .
+ DESTINATION examples
+ USE_SOURCE_PERMISSIONS
+ PATTERN "*.in" EXCLUDE
+ PATTERN "dotnet" EXCLUDE)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt
DESTINATION examples)
install(FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/../cmake/FindGeode.cmake
+ DESTINATION examples/cmake)
+install(FILES
${CMAKE_CURRENT_BINARY_DIR}/cmake/Find${PRODUCT_NAME_NOSPACE}.cmake
DESTINATION examples/cmake)
add_subdirectory(cpp)
if (BUILD_CLI)
+ install(DIRECTORY dotnet
+ DESTINATION examples
+ USE_SOURCE_PERMISSIONS
+ PATTERN "*.in" EXCLUDE)
+
add_subdirectory(dotnet)
endif()
+add_subdirectory(utilities)
diff --git a/examples/CMakeLists.txt.in b/examples/CMakeLists.txt.in
index f124022..6e363b6 100644
--- a/examples/CMakeLists.txt.in
+++ b/examples/CMakeLists.txt.in
@@ -19,3 +19,5 @@
add_subdirectory(cpp)
@DOTNET_SUB_DIRECTORY@
+add_subdirectory(utilities)
+
diff --git a/examples/cpp/CMakeLists.txt b/examples/cpp/CMakeLists.txt
index 8ab76e9..b87067d 100644
--- a/examples/cpp/CMakeLists.txt
+++ b/examples/cpp/CMakeLists.txt
@@ -19,32 +19,15 @@
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt.in ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt COPYONLY)
-install(FILES
- ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt
- BUILD-CPP-EXAMPLES.md
- DESTINATION examples/cpp)
-
function(add_example)
set(options)
set(oneValueArgs NAME)
set(multiValueArgs SOURCE)
cmake_parse_arguments(ADD_EXAMPLE "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
- foreach(SOURCE ${ADD_EXAMPLE_SOURCE})
- list(APPEND EXAMPLE_SOURCES_PATHS ${ADD_EXAMPLE_NAME}/${SOURCE})
- endforeach()
-
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt.cpp_example.in
${CMAKE_CURRENT_BINARY_DIR}/${ADD_EXAMPLE_NAME}/CMakeLists.txt
@ONLY)
-
- install(FILES
- ${CMAKE_CURRENT_BINARY_DIR}/${ADD_EXAMPLE_NAME}/CMakeLists.txt
- ${EXAMPLE_SOURCES_PATHS}
- ${ADD_EXAMPLE_NAME}/README.md
- ${ADD_EXAMPLE_NAME}/startserver.sh
- ${ADD_EXAMPLE_NAME}/stopserver.sh
- DESTINATION examples/cpp/${ADD_EXAMPLE_NAME})
endfunction()
add_example(NAME continuousquery
@@ -53,6 +36,9 @@
add_example(NAME dataserializable
SOURCE main.cpp Order.cpp Order.hpp)
+add_example(NAME function-execution
+ SOURCE main.cpp)
+
add_example(NAME pdxserializable
SOURCE main.cpp Order.cpp Order.hpp)
@@ -62,9 +48,16 @@
add_example(NAME put-get-remove
SOURCE main.cpp)
-add_example(NAME function-execution
- SOURCE main.cpp)
-
add_example(NAME remotequery
SOURCE main.cpp Order.cpp Order.hpp)
+add_example(NAME transaction
+ SOURCE main.cpp)
+
+ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ DESTINATION examples/
+ PATTERN "./*.in" EXCLUDE
+ PATTERN "CMakeFiles" EXCLUDE
+ PATTERN "Makefile" EXCLUDE
+ PATTERN "cmake_install.cmake" EXCLUDE)
+
diff --git a/examples/cpp/CMakeLists.txt.cpp_example.in b/examples/cpp/CMakeLists.txt.cpp_example.in
index c39ad9f..0e90284 100644
--- a/examples/cpp/CMakeLists.txt.cpp_example.in
+++ b/examples/cpp/CMakeLists.txt.cpp_example.in
@@ -20,15 +20,13 @@
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../../cmake)
set(CMAKE_CXX_STANDARD 11)
-if(CMAKE_CXX_COMPILER_ID STREQUAL "SunPro")
- add_compile_options(-m64)
- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m64")
-endif()
-
find_package(@PRODUCT_NAME_NOSPACE@ REQUIRED COMPONENTS cpp)
add_executable(${PROJECT_NAME} @ADD_EXAMPLE_SOURCE@)
+configure_file("startserver.sh" ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)
+configure_file("stopserver.sh" ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)
+
target_link_libraries(${PROJECT_NAME}
PUBLIC
@PRODUCT_NAME_NOSPACE@::cpp)
diff --git a/examples/cpp/CMakeLists.txt.in b/examples/cpp/CMakeLists.txt.in
index a1854c0..a9852a1 100644
--- a/examples/cpp/CMakeLists.txt.in
+++ b/examples/cpp/CMakeLists.txt.in
@@ -19,8 +19,9 @@
add_subdirectory(continuousquery)
add_subdirectory(dataserializable)
+add_subdirectory(function-execution)
add_subdirectory(pdxserializable)
add_subdirectory(pdxserializer)
add_subdirectory(put-get-remove)
-add_subdirectory(function-execution)
add_subdirectory(remotequery)
+add_subdirectory(transaction)
diff --git a/examples/cpp/continuousquery/CMakeLists.txt b/examples/cpp/continuousquery/CMakeLists.txt
index bf0b415..11b5ac6 100644
--- a/examples/cpp/continuousquery/CMakeLists.txt
+++ b/examples/cpp/continuousquery/CMakeLists.txt
@@ -20,11 +20,6 @@
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../../cmake)
set(CMAKE_CXX_STANDARD 11)
-if(CMAKE_CXX_COMPILER_ID STREQUAL "SunPro")
- add_compile_options(-m64)
- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m64")
-endif()
-
find_package(GeodeNative REQUIRED COMPONENTS cpp)
add_executable(${PROJECT_NAME} main.cpp;Order.cpp;Order.hpp)
diff --git a/examples/cpp/continuousquery/README.md b/examples/cpp/continuousquery/README.md
index f2f9941..59d557b 100644
--- a/examples/cpp/continuousquery/README.md
+++ b/examples/cpp/continuousquery/README.md
@@ -34,7 +34,7 @@
1. Execute `continuousquery`:
```
- $ build/continuousquery
+ $ ./continuousquery
Executing continuous query
Create orders
Putting and changing Order objects in the region
diff --git a/examples/cpp/continuousquery/startserver.sh b/examples/cpp/continuousquery/startserver.sh
index 2c947ea..7342182 100755
--- a/examples/cpp/continuousquery/startserver.sh
+++ b/examples/cpp/continuousquery/startserver.sh
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-#!/bin/env bash
+#!/usr/bin/env bash
GFSH_PATH=""
which gfsh 2> /dev/null
diff --git a/examples/cpp/continuousquery/stopserver.sh b/examples/cpp/continuousquery/stopserver.sh
index f406a23..f80cd6e 100755
--- a/examples/cpp/continuousquery/stopserver.sh
+++ b/examples/cpp/continuousquery/stopserver.sh
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-#!/bin/env bash
+#!/usr/bin/env bash
GFSH_PATH=""
which gfsh 2> /dev/null
diff --git a/examples/cpp/dataserializable/CMakeLists.txt b/examples/cpp/dataserializable/CMakeLists.txt
index ea1a552..22ac649 100644
--- a/examples/cpp/dataserializable/CMakeLists.txt
+++ b/examples/cpp/dataserializable/CMakeLists.txt
@@ -20,11 +20,6 @@
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../../cmake)
set(CMAKE_CXX_STANDARD 11)
-if(CMAKE_CXX_COMPILER_ID STREQUAL "SunPro")
- add_compile_options(-m64)
- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m64")
-endif()
-
find_package(GeodeNative REQUIRED COMPONENTS cpp)
add_executable(${PROJECT_NAME} main.cpp;Order.cpp;Order.hpp)
diff --git a/examples/cpp/dataserializable/README.md b/examples/cpp/dataserializable/README.md
index 9bad0d8..03f5a64 100644
--- a/examples/cpp/dataserializable/README.md
+++ b/examples/cpp/dataserializable/README.md
@@ -35,7 +35,7 @@
1. Execute `dataserializable`:
```
- $ build/dataserializable
+ $ ./dataserializable
Create orders
Storing orders in the region
Getting the orders from the region
diff --git a/examples/cpp/dataserializable/startserver.sh b/examples/cpp/dataserializable/startserver.sh
old mode 100644
new mode 100755
index 2c947ea..7342182
--- a/examples/cpp/dataserializable/startserver.sh
+++ b/examples/cpp/dataserializable/startserver.sh
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-#!/bin/env bash
+#!/usr/bin/env bash
GFSH_PATH=""
which gfsh 2> /dev/null
diff --git a/examples/cpp/dataserializable/stopserver.sh b/examples/cpp/dataserializable/stopserver.sh
old mode 100644
new mode 100755
diff --git a/examples/cpp/function-execution/README.md b/examples/cpp/function-execution/README.md
index 394b23c..a20deed 100644
--- a/examples/cpp/function-execution/README.md
+++ b/examples/cpp/function-execution/README.md
@@ -27,170 +27,26 @@
(1) Executing - start locator --name=locator
...
- (2) Executing - start server --name=server
+ (2) Executing - deploy --jar=../../utilities/example.jar
...
-(3) Executing - create region --name=example_userinfo --type=PARTITION
+ (3) Executing - start server --name=the-server --server-port=50505
+ ...
+ (4) Executing - create region --name=parition_region --type=PARTITION
- Member | Status
- ------ | ----------------------------------------------
- server | Region "/partition_region" created on "the-server"
- ```
-(1) Executing - start locator --name=locator
-
-...
-Locator in /nc_install/examples/cpp/function-execution/locator on 10.118.33.178[10334] as locator is currently online.
-Process ID: 63773
-Uptime: 2 seconds
-Geode Version: 1.6.0
-Java Version: 1.8.0_162
-Log File: /nc_install/examples/cpp/function-execution/locator/locator.log
-JVM Arguments: -Dgemfire.enable-cluster-configuration=true -Dgemfire.load-cluster-configuration-from-dir=false -Dgemfire.launcher.registerSignalHandlers=true -Djava.awt.headless=true -Dsun.rmi.dgc.server.gcInterval=9223372036854775806
-Class-Path: /apache-geode-1.6.0/lib/geode-core-1.6.0.jar:/apache-geode-1.6.0/lib/geode-dependencies.jar
-
-Successfully connected to: JMX Manager [host=10.118.33.178, port=1099]
-
-Cluster configuration service is up and running.
-
-
-(2) Executing - deploy --jar=../../javaobject.jar
-
-
-
-(3) Executing - start server --name=the-server --server-port=40404
-
-....
-Server in /nc_install/examples/cpp/function-execution/the-server on 10.118.33.178[40404] as the-server is currently online.
-Process ID: 63778
-Uptime: 5 seconds
-Geode Version: 1.6.0
-Java Version: 1.8.0_162
-Log File: /nc_install/examples/cpp/function-execution/the-server/the-server.log
-JVM Arguments: -Dgemfire.default.locators=10.118.33.178[10334] -Dgemfire.start-dev-rest-api=false -Dgemfire.use-cluster-configuration=true -XX:OnOutOfMemoryError=kill -KILL %p -Dgemfire.launcher.registerSignalHandlers=true -Djava.awt.headless=true -Dsun.rmi.dgc.server.gcInterval=9223372036854775806
-Class-Path: /apache-geode-1.6.0/lib/geode-core-1.6.0.jar:/apache-geode-1.6.0/lib/geode-dependencies.jar
-
-
-(4) Executing - create region --name=partition_region --type=PARTITION
-
- Member | Status
----------- | --------------------------------------------------
-the-server | Region "/partition_region" created on "the-server"
-
-
-(5) Executing - start server --name=the-second-server --server-port=50505
-
-....
-Server in /nc_install/examples/cpp/function-execution/the-second-server on 10.118.33.178[50505] as the-second-server is currently online.
-Process ID: 63779
-Uptime: 4 seconds
-Geode Version: 1.6.0
-Java Version: 1.8.0_162
-Log File: /nc_install/examples/cpp/function-execution/the-second-server/the-second-server.log
-JVM Arguments: -Dgemfire.default.locators=10.118.33.178[10334] -Dgemfire.start-dev-rest-api=false -Dgemfire.use-cluster-configuration=true -XX:OnOutOfMemoryError=kill -KILL %p -Dgemfire.launcher.registerSignalHandlers=true -Djava.awt.headless=true -Dsun.rmi.dgc.server.gcInterval=9223372036854775806
-Class-Path: /apache-geode-1.6.0/lib/geode-core-1.6.0.jar:/apache-geode-1.6.0/lib/geode-dependencies.jar
-1. Execute `function-execution`:
+ Member | Status
+ ---------- | ----------------------------------------------
+ the-server | Region "/partition_region" created on "the-server"
+
+1. Run the `function-execution` example:
```
+ $ ./function-execution
+ Result count = 3
- $./function-execution
-Created CacheFactory
-Created the Region
-test data independent function with result on one server
-get: result count = 17
-get result[0]=VALUE--1
-get result[1]=VALUE--3
-get result[2]=VALUE--5
-get result[3]=VALUE--7
-get result[4]=VALUE--9
-get result[5]=VALUE--11
-get result[6]=VALUE--13
-get result[7]=VALUE--15
-get result[8]=VALUE--17
-get result[9]=VALUE--19
-get result[10]=VALUE--21
-get result[11]=VALUE--23
-get result[12]=VALUE--25
-get result[13]=VALUE--27
-get result[14]=VALUE--29
-get result[15]=VALUE--31
-get result[16]=VALUE--33
-test data independent function without result on one server
-test data independent function with result on all servers
-get: result count = 34
-get result[0]=KEY--1
-get result[1]=KEY--3
-get result[2]=KEY--5
-get result[3]=KEY--7
-get result[4]=KEY--9
-get result[5]=KEY--11
-get result[6]=KEY--13
-get result[7]=KEY--15
-get result[8]=VALUE--17
-get result[9]=VALUE--19
-get result[10]=VALUE--21
-get result[11]=VALUE--23
-get result[12]=VALUE--25
-get result[13]=VALUE--27
-get result[14]=VALUE--29
-get result[15]=VALUE--31
-get result[16]=VALUE--33
-get result[17]=KEY--1
-get result[18]=KEY--3
-get result[19]=KEY--5
-get result[20]=KEY--7
-get result[21]=KEY--9
-get result[22]=KEY--11
-get result[23]=KEY--13
-get result[24]=KEY--15
-get result[25]=KEY--17
-get result[26]=KEY--19
-get result[27]=KEY--21
-get result[28]=KEY--23
-get result[29]=KEY--25
-get result[30]=KEY--27
-get result[31]=KEY--29
-get result[32]=KEY--31
-get result[33]=KEY--33
-test data independent function without result on all servers
-test data dependent function with result
-Execute on Region: result count = 4
-Execute on Region: result count = 34
-Execute on Region: result[0]=KEY--11
-Execute on Region: result[1]=KEY--5
-Execute on Region: result[2]=KEY--17
-Execute on Region: result[3]=KEY--27
-Execute on Region: result[4]=KEY--9
-Execute on Region: result[5]=KEY--29
-Execute on Region: result[6]=KEY--13
-Execute on Region: result[7]=KEY--23
-Execute on Region: result[8]=KEY--15
-Execute on Region: result[9]=KEY--11
-Execute on Region: result[10]=KEY--5
-Execute on Region: result[11]=KEY--17
-Execute on Region: result[12]=KEY--27
-Execute on Region: result[13]=KEY--9
-Execute on Region: result[14]=KEY--29
-Execute on Region: result[15]=KEY--13
-Execute on Region: result[16]=KEY--23
-Execute on Region: result[17]=KEY--15
-Execute on Region: result[18]=KEY--31
-Execute on Region: result[19]=KEY--1
-Execute on Region: result[20]=KEY--33
-Execute on Region: result[21]=KEY--21
-Execute on Region: result[22]=KEY--3
-Execute on Region: result[23]=KEY--7
-Execute on Region: result[24]=KEY--19
-Execute on Region: result[25]=KEY--25
-Execute on Region: result[26]=KEY--31
-Execute on Region: result[27]=KEY--1
-Execute on Region: result[28]=KEY--33
-Execute on Region: result[29]=KEY--21
-Execute on Region: result[30]=KEY--3
-Execute on Region: result[31]=KEY--7
-Execute on Region: result[32]=KEY--19
-Execute on Region: result[33]=KEY--25
-test data dependent function without result
-Closed the Geode Cache
-```
+ Result[0]=VALUE--1
+ Result[1]=VALUE--2
+ Result[2]=VALUE--3
+ ```
1. Stop the server
@@ -199,9 +55,8 @@
/Users/user/geode/bin/gfsh
(1) Executing - connect
...
- (2) Executing - stop server --name=server
- ...
- (3) Executing - stop locator --name=locator
- ....
+ (2) Executing - shutdown --include-locators=true
+
+ Shutdown is triggered
```
diff --git a/examples/cpp/function-execution/main.cpp b/examples/cpp/function-execution/main.cpp
index 6b57734..e3f239f 100644
--- a/examples/cpp/function-execution/main.cpp
+++ b/examples/cpp/function-execution/main.cpp
@@ -16,17 +16,12 @@
*/
/*
- * The Execute Function QuickStart Example.
- *
* This example takes the following steps:
*
- * 1. Create a Geode Cache.
- * 2. Create the example Region Programmatically.
+ * 1. Create a Geode Cache, Pool, and example Region Programmatically.
* 3. Populate some objects on the Region.
- * 4. Create Execute Objects
- * 5. Execute Functions
- * 6. Close the Cache.
- *
+ * 4. Create Execute Object
+ * 5. Execute Function
*/
#include <iostream>
#include <memory>
@@ -38,147 +33,113 @@
#include <geode/FunctionService.hpp>
#include <geode/CacheableString.hpp>
-// Use the "geode" namespace.
-using namespace apache::geode::client;
+using apache::geode::client::Cache;
+using apache::geode::client::CacheableArrayList;
+using apache::geode::client::CacheableKey;
+using apache::geode::client::CacheableString;
+using apache::geode::client::CacheableVector;
+using apache::geode::client::CacheFactory;
+using apache::geode::client::Exception;
+using apache::geode::client::FunctionService;
+using apache::geode::client::Region;
+using apache::geode::client::RegionShortcut;
-const auto getFuncIName = std::string("MultiGetFunctionI");
-const auto putFuncIName = std::string("MultiPutFunctionI");
-const auto getFuncName = std::string("MultiGetFunction");
+const auto getFuncIName = std::string("ExampleMultiGetFunction");
-const int EXAMPLE_ITEM_COUNT = 34;
+const int EXAMPLE_SERVER_PORT = 50505;
-// The Execute Function QuickStart example.
+const std::vector<std::string> keys = {
+ "KEY--1",
+ "KEY--2",
+ "KEY--3",
+};
+
+const std::vector<std::string> values = {
+ "VALUE--1",
+ "VALUE--2",
+ "VALUE--3"
+};
+
+Cache setupCache() {
+ return CacheFactory()
+ .set("log-level", "none")
+ .create();
+}
+
+void createPool(const Cache& cache) {
+ auto pool = cache.getPoolManager()
+ .createFactory()
+ .addServer("localhost", EXAMPLE_SERVER_PORT)
+ .create("pool");
+}
+
+std::shared_ptr<Region> createRegion(Cache& cache) {
+ auto regionFactory = cache.createRegionFactory(RegionShortcut::PROXY);
+ auto region = regionFactory.setPoolName("pool").create("partition_region");
+
+ return region;
+}
+
+void populateRegion(const std::shared_ptr<Region>& region) {
+ for (int i = 0; i < keys.size(); i++) {
+ region->put(keys[i], values[i]);
+ }
+}
+
+std::shared_ptr<CacheableVector> populateArguments() {
+ auto arguments = CacheableVector::create();
+ for (int i = 0; i < keys.size(); i++) {
+ arguments->push_back(CacheableKey::create(keys[i]));
+ }
+ return arguments;
+}
+
+std::vector<std::string> executeFunctionOnServer(const std::shared_ptr<Region> region,
+ const std::shared_ptr<CacheableVector> arguments) {
+ std::vector<std::string> resultList;
+
+ auto functionService = FunctionService::onServer(region->getRegionService());
+ if(auto executeFunctionResult = functionService.withArgs(arguments).execute(getFuncIName)->getResult()) {
+ for (auto &arrayList: *executeFunctionResult) {
+ for (auto &cachedString: *std::dynamic_pointer_cast<CacheableArrayList>(arrayList)) {
+ resultList.push_back(std::dynamic_pointer_cast<CacheableString>(cachedString)->value());
+ }
+ }
+ } else {
+ std::cout << "get executeFunctionResult is NULL\n";
+ }
+
+ return resultList;
+}
+
+void printResults(const std::vector<std::string>& resultList) {
+ std::cout << "Result count = " << resultList.size() << std::endl << std::endl;
+ int i = 0;
+ for (auto &cachedString: resultList) {
+ std::cout << "\tResult[" << i << "]=" << cachedString << std::endl;
+ ++i;
+ }
+}
+
int main(int argc, char** argv) {
try {
- // Create CacheFactory using the settings from the geode.properties file by
- // default.
- auto cache = CacheFactory()
- .set("log-level", "none")
- .create();
+ auto cache = setupCache();
- std::cout << "Created CacheFactory\n";
+ createPool(cache);
- auto pool = cache.getPoolManager()
- .createFactory()
- .setSubscriptionEnabled(true)
- .addServer("localhost", 50505)
- .addServer("localhost", 40404)
- .create("pool");
+ auto region = createRegion(cache);
- // Create the example Region Programmatically
- auto regionFactory = cache.createRegionFactory(RegionShortcut::PROXY);
- auto regPtr0 = regionFactory.setPoolName("pool").create("partition_region");
+ populateRegion(region);
- std::cout << "Created the Region\n";
+ auto arguments = populateArguments();
- regPtr0->registerAllKeys();
- char buf[128];
+ auto resultList = executeFunctionOnServer(region, arguments);
- auto resultList = CacheableVector::create();
- for (int i = 0; i < EXAMPLE_ITEM_COUNT; i++) {
- sprintf(buf, "VALUE--%d", i);
- auto value(CacheableString::create(buf));
-
- sprintf(buf, "KEY--%d", i);
- auto key = CacheableKey::create(buf);
- regPtr0->put(key, value);
- }
-
- auto routingObj = CacheableVector::create();
- for (int i = 1; i < EXAMPLE_ITEM_COUNT; i+=2) {
- sprintf(buf, "KEY--%d", i);
- auto key = CacheableKey::create(buf);
- routingObj->push_back(key);
- }
-
- std::cout << "test data independent function with result on one server\n";
- auto exc = FunctionService::onServer(regPtr0->getRegionService());
- if(auto executeFunctionResult = exc.withArgs(routingObj).execute(getFuncIName)->getResult()) {
- for (auto &arrayList: *executeFunctionResult) {
- for (auto &cachedString: *std::dynamic_pointer_cast<CacheableArrayList>(arrayList)) {
- resultList->push_back(cachedString);
- }
- }
- sprintf(buf, "get: result count = %lu\n", resultList->size());
- std::cout << buf;
- int i = 0;
- for (auto &cachedString: *resultList) {
- sprintf(
- buf, "get result[%d]=%s\n", i,
- std::dynamic_pointer_cast<CacheableString>(cachedString)->value().c_str());
- std::cout << buf;
- ++i;
- }
- } else {
- std::cout << "get executeFunctionResult is NULL\n";
- }
-
- std::cout << "test data independent function without result on one server\n";
-
- exc.withArgs(routingObj).execute(putFuncIName, std::chrono::milliseconds(15));
-
- std::cout << "test data independent function with result on all servers\n";
-
- exc = FunctionService::onServers(regPtr0->getRegionService());
- if(auto executeFunctionResult = exc.withArgs(routingObj).execute(getFuncIName)->getResult()) {
- resultList->clear();
- for (auto &arrayList: *executeFunctionResult) {
- for (auto &cachedString: *std::dynamic_pointer_cast<CacheableArrayList>(arrayList)) {
- resultList->push_back(cachedString);
- }
- }
- sprintf(buf, "get: result count = %lu\n", resultList->size());
- std::cout << buf;
- int i = 0;
- for (auto &cachedString: *resultList) {
- sprintf(
- buf, "get result[%d]=%s\n", i,
- std::dynamic_pointer_cast<CacheableString>(cachedString)->value().c_str());
- std::cout << buf;
- ++i;
- }
- } else {
- std::cout << "get executeFunctionResult is NULL\n";
- }
-
-
- std::cout << "test data independent function without result on all servers\n";
- exc.withArgs(routingObj).execute(putFuncIName, std::chrono::milliseconds(15));
- std::cout << "test data dependent function with result\n";
-
- auto args = CacheableBoolean::create(1);
- exc = FunctionService::onRegion(regPtr0);
- if(auto executeFunctionResult = exc.withFilter(routingObj)
- .withArgs(args)
- .execute(getFuncName)
- ->getResult()) {
- resultList->clear();
- std::cout << "Execute on Region: result count = " << executeFunctionResult->size() << '\n';
- for (auto &arrayList: *executeFunctionResult) {
- for (auto &cachedString: *std::dynamic_pointer_cast<CacheableArrayList>(arrayList)) {
- resultList->push_back(cachedString);
- }
- }
- sprintf(buf, "Execute on Region: result count = %lu\n", resultList->size());
- std::cout << buf;
- int i = 0;
- for (auto &cachedString: *resultList) {
- sprintf(
- buf, "Execute on Region: result[%d]=%s\n", i,
- std::dynamic_pointer_cast<CacheableString>(cachedString)->value().c_str());
- std::cout << buf;
- ++i;
- }
- } else {
- std::cout << "execute on region: executeFunctionResult is NULL\n";
- }
-
- return 0;
+ printResults(resultList);
}
- // An exception should not occur
catch (const Exception& geodeExcp) {
std::cerr << "Function Execution Geode Exception: " << geodeExcp.getMessage() << '\n';
-
return 1;
}
}
+
diff --git a/examples/cpp/function-execution/startserver.sh b/examples/cpp/function-execution/startserver.sh
index 24e2a9f..b5b8562 100755
--- a/examples/cpp/function-execution/startserver.sh
+++ b/examples/cpp/function-execution/startserver.sh
@@ -1,5 +1,3 @@
-#!/bin/env bash
-
# 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.
@@ -15,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+#!/usr/bin/env bash
GFSH_PATH=""
which gfsh 2> /dev/null
@@ -29,6 +28,6 @@
fi
fi
-$GFSH_PATH -e "start locator --name=locator" -e "deploy --jar=../../javaobject.jar" -e "start server --name=the-server --server-port=40404" -e "create region --name=partition_region --type=PARTITION" -e "start server --name=the-second-server --server-port=50505"
+$GFSH_PATH -e "start locator --name=locator" -e "deploy --jar=../../utilities/example.jar" -e "start server --name=the-server --server-port=50505" -e "create region --name=partition_region --type=PARTITION"
diff --git a/examples/cpp/function-execution/stopserver.sh b/examples/cpp/function-execution/stopserver.sh
index 7891cf6..a9d0c5b 100755
--- a/examples/cpp/function-execution/stopserver.sh
+++ b/examples/cpp/function-execution/stopserver.sh
@@ -1,5 +1,3 @@
-#!/bin/env bash
-
# 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.
@@ -15,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+#!/usr/bin/env bash
GFSH_PATH=""
which gfsh 2> /dev/null
diff --git a/examples/cpp/pdxserializable/README.md b/examples/cpp/pdxserializable/README.md
index 785e0b2..7f5e8bd 100644
--- a/examples/cpp/pdxserializable/README.md
+++ b/examples/cpp/pdxserializable/README.md
@@ -35,7 +35,7 @@
1. Execute `pdxserializable`:
```
- $ build/pdxserializable
+ $ ./pdxserializable
Create orders
Storing orders in the region
Getting the orders from the region
diff --git a/examples/cpp/pdxserializable/startserver.sh b/examples/cpp/pdxserializable/startserver.sh
index 2c947ea..7342182 100755
--- a/examples/cpp/pdxserializable/startserver.sh
+++ b/examples/cpp/pdxserializable/startserver.sh
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-#!/bin/env bash
+#!/usr/bin/env bash
GFSH_PATH=""
which gfsh 2> /dev/null
diff --git a/examples/cpp/pdxserializable/stopserver.sh b/examples/cpp/pdxserializable/stopserver.sh
index f406a23..f80cd6e 100755
--- a/examples/cpp/pdxserializable/stopserver.sh
+++ b/examples/cpp/pdxserializable/stopserver.sh
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-#!/bin/env bash
+#!/usr/bin/env bash
GFSH_PATH=""
which gfsh 2> /dev/null
diff --git a/examples/cpp/pdxserializer/README.md b/examples/cpp/pdxserializer/README.md
index e913d26..eaed594 100644
--- a/examples/cpp/pdxserializer/README.md
+++ b/examples/cpp/pdxserializer/README.md
@@ -35,7 +35,7 @@
1. Execute `pdxserializer`:
```
- $ build/pdxserializer
+ $ ./pdxserializer
Storing orders in the region
Getting the orders from the region
OrderID: 1
diff --git a/examples/cpp/pdxserializer/startserver.sh b/examples/cpp/pdxserializer/startserver.sh
index 2c947ea..7342182 100755
--- a/examples/cpp/pdxserializer/startserver.sh
+++ b/examples/cpp/pdxserializer/startserver.sh
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-#!/bin/env bash
+#!/usr/bin/env bash
GFSH_PATH=""
which gfsh 2> /dev/null
diff --git a/examples/cpp/pdxserializer/stopserver.sh b/examples/cpp/pdxserializer/stopserver.sh
index f406a23..f80cd6e 100755
--- a/examples/cpp/pdxserializer/stopserver.sh
+++ b/examples/cpp/pdxserializer/stopserver.sh
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-#!/bin/env bash
+#!/usr/bin/env bash
GFSH_PATH=""
which gfsh 2> /dev/null
diff --git a/examples/cpp/put-get-remove/README.md b/examples/cpp/put-get-remove/README.md
index 9de0a6c..9f4bd91 100644
--- a/examples/cpp/put-get-remove/README.md
+++ b/examples/cpp/put-get-remove/README.md
@@ -37,7 +37,7 @@
1. Execute `put-get-remove`:
```
- $ build/put-get-remove
+ $ ./put-get-remove
Storing id and username in the region
Getting the user info from the region
rtimmons = Robert Timmons
diff --git a/examples/cpp/put-get-remove/startserver.sh b/examples/cpp/put-get-remove/startserver.sh
index 70ff419..54e12f0 100755
--- a/examples/cpp/put-get-remove/startserver.sh
+++ b/examples/cpp/put-get-remove/startserver.sh
@@ -1,5 +1,3 @@
-#!/bin/env bash
-
# 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.
@@ -15,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+#!/usr/bin/env bash
GFSH_PATH=""
which gfsh 2> /dev/null
diff --git a/examples/cpp/put-get-remove/stopserver.sh b/examples/cpp/put-get-remove/stopserver.sh
index 8c914a4..67a0f85 100755
--- a/examples/cpp/put-get-remove/stopserver.sh
+++ b/examples/cpp/put-get-remove/stopserver.sh
@@ -1,5 +1,3 @@
-#!/bin/env bash
-
# 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.
@@ -15,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+#!/usr/bin/env bash
GFSH_PATH=""
which gfsh 2> /dev/null
diff --git a/examples/cpp/remotequery/CMakeLists.txt b/examples/cpp/remotequery/CMakeLists.txt
index a9d5efc..7743452 100644
--- a/examples/cpp/remotequery/CMakeLists.txt
+++ b/examples/cpp/remotequery/CMakeLists.txt
@@ -20,11 +20,6 @@
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../../cmake)
set(CMAKE_CXX_STANDARD 11)
-if(CMAKE_CXX_COMPILER_ID STREQUAL "SunPro")
- add_compile_options(-m64)
- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m64")
-endif()
-
find_package(GeodeNative REQUIRED COMPONENTS cpp)
add_executable(${PROJECT_NAME} main.cpp;Order.cpp;Order.hpp)
diff --git a/examples/cpp/remotequery/README.md b/examples/cpp/remotequery/README.md
index 61bdda0..d47d991 100644
--- a/examples/cpp/remotequery/README.md
+++ b/examples/cpp/remotequery/README.md
@@ -35,7 +35,7 @@
1. Execute `remotequery`:
```
- $ build/remotequery
+ $ ./remotequery
Create orders
Storing orders in the region
Getting the orders from the region
diff --git a/examples/cpp/remotequery/startserver.sh b/examples/cpp/remotequery/startserver.sh
index 2c947ea..7342182 100755
--- a/examples/cpp/remotequery/startserver.sh
+++ b/examples/cpp/remotequery/startserver.sh
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-#!/bin/env bash
+#!/usr/bin/env bash
GFSH_PATH=""
which gfsh 2> /dev/null
diff --git a/examples/cpp/remotequery/stopserver.sh b/examples/cpp/remotequery/stopserver.sh
index f406a23..f80cd6e 100755
--- a/examples/cpp/remotequery/stopserver.sh
+++ b/examples/cpp/remotequery/stopserver.sh
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-#!/bin/env bash
+#!/usr/bin/env bash
GFSH_PATH=""
which gfsh 2> /dev/null
diff --git a/examples/cpp/transaction/README.md b/examples/cpp/transaction/README.md
new file mode 100644
index 0000000..51c7d33
--- /dev/null
+++ b/examples/cpp/transaction/README.md
@@ -0,0 +1,61 @@
+# Transaction example
+This is a very simple example showing how to use TransactionManager. This example shows
+how to begin a transaction, commit a transaction, and rollback a transaction while showing
+exception handling. We commit two keys and rollback adding a third key and destroying an
+existing key while showing how to handle exceptions.
+
+## Prerequisites
+* An installation of Apache Geode.
+* Apache Geode Native, built and installed.
+* Apache Geode Native examples, built and installed.
+* A `GEODE_HOME` environment variable set to the location of the Apache Geode installation.
+* `GEODE_HOME/bin` in the execution path.
+
+## Running
+1. Set the current directory to the `transaction` directory in your example workspace.
+
+ ```
+ $ cd workspace/examples/cpp/transaction
+ ```
+
+1. Run the `startserver.sh` script to start the Geode server, create a region, and populate the region with sample data.
+
+ ```
+ $ sh ./startserver.sh
+ /Users/user/geode/bin/gfsh
+
+ (1) Executing - start locator --name=locator
+ ...
+ (2) Executing - start server --name=server
+ ...
+ (3) Executing - create region --name=exampleRegion --type=PARTITION
+
+ Member | Status
+ ------ | ----------------------------------------------
+ server | Region "/exampleRegion" created on "server"
+ ```
+
+1. Execute `transaction`:
+
+ ```
+ $ ./transaction
+ Created cache
+ Created region 'exampleRegion'
+ Rolled back transaction - retrying(4)
+ Rolled back transaction - retrying(3)
+ Rolled back transaction - retrying(2)
+ Committed transaction - exiting
+ ```
+
+1. Stop the server
+
+ ```
+ $ sh ./stopserver.sh
+ /Users/user/geode/bin/gfsh
+ (1) Executing - connect
+ ...
+ (2) Executing - stop server --name=server
+ ...
+ (3) Executing - stop locator --name=locator
+ ....
+ ```
diff --git a/examples/cpp/transaction/main.cpp b/examples/cpp/transaction/main.cpp
new file mode 100644
index 0000000..9104644
--- /dev/null
+++ b/examples/cpp/transaction/main.cpp
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <iostream>
+#include <random>
+
+#include <geode/CacheFactory.hpp>
+#include <geode/CacheTransactionManager.hpp>
+#include <geode/PoolManager.hpp>
+#include <geode/RegionFactory.hpp>
+#include <geode/RegionShortcut.hpp>
+
+using apache::geode::client::Cache;
+using apache::geode::client::CacheFactory;
+using apache::geode::client::CacheTransactionManager;
+using apache::geode::client::RegionShortcut;
+
+auto keys = {
+ "Key1",
+ "Key2",
+ "Key3",
+ "Key4",
+ "Key5",
+ "Key6",
+ "Key7",
+ "Key8",
+ "Key9",
+ "Key10"
+};
+
+
+int getValueFromExternalSystem() {
+ static thread_local std::default_random_engine generator(std::random_device{}());
+ auto value = std::uniform_int_distribution<int32_t>{0, 9}(generator);
+
+ if (!value) {
+ throw "failed to get from external system";
+ }
+
+ return value;
+}
+
+int main(int argc, char** argv) {
+ auto cache = CacheFactory().set("log-level", "none").create();
+ auto poolFactory = cache.getPoolManager().createFactory();
+
+ std::cout << "Created cache" << std::endl;
+
+ poolFactory.addLocator("localhost", 10334);
+ auto pool = poolFactory.create("pool");
+ auto regionFactory = cache.createRegionFactory(RegionShortcut::PROXY);
+ auto region = regionFactory.setPoolName("pool").create("exampleRegion");
+
+ std::cout << "Created region 'exampleRegion'" << std::endl;
+
+ auto transactionManager = cache.getCacheTransactionManager();
+
+ auto retries = 5;
+ while (retries--) {
+ try {
+ transactionManager->begin();
+ for (auto& key : keys) {
+ auto value = getValueFromExternalSystem();
+ region->put(key, value);
+ }
+ transactionManager->commit();
+ std::cout << "Committed transaction - exiting" << std::endl;
+ break;
+ } catch ( ... ) {
+ transactionManager->rollback();
+ std::cout << "Rolled back transaction - retrying(" << retries << ")" << std::endl;
+ }
+ }
+}
+
diff --git a/contrib/pdxautoserializer/src/CMakeLists.txt b/examples/cpp/transaction/startserver.sh
old mode 100644
new mode 100755
similarity index 62%
copy from contrib/pdxautoserializer/src/CMakeLists.txt
copy to examples/cpp/transaction/startserver.sh
index 895cd74..fce5f21
--- a/contrib/pdxautoserializer/src/CMakeLists.txt
+++ b/examples/cpp/transaction/startserver.sh
@@ -4,24 +4,28 @@
# 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.
-cmake_minimum_required(VERSION 3.4)
-project(pdxautoserializer)
-file(GLOB_RECURSE SOURCES "*.cpp")
+#!/usr/bin/env bash
+GFSH_PATH=""
+which gfsh 2> /dev/null
-add_executable(pdxautoserializer ${SOURCES})
-target_link_libraries(pdxautoserializer
- PRIVATE
- antlr
-)
+if [ $? -eq 0 ]; then
+ GFSH_PATH="gfsh"
+else
+ if [ "$GEODE_HOME" == "" ]; then
+ echo "Could not find gfsh. Please set the GEODE_HOME path."
+ echo "e.g. export GEODE_HOME=<path to Geode>"
+ else
+ GFSH_PATH=$GEODE_HOME/bin/gfsh
+ fi
+fi
-install(TARGETS pdxautoserializer DESTINATION bin)
-include_directories(${CMAKE_SOURCE_DIR}/../../src/cppcache/include)
+$GFSH_PATH -e "start locator --name=locator" -e "start server --name=server" -e "create region --name=exampleRegion --type=PARTITION"
diff --git a/contrib/pdxautoserializer/src/CMakeLists.txt b/examples/cpp/transaction/stopserver.sh
old mode 100644
new mode 100755
similarity index 64%
copy from contrib/pdxautoserializer/src/CMakeLists.txt
copy to examples/cpp/transaction/stopserver.sh
index 895cd74..67a0f85
--- a/contrib/pdxautoserializer/src/CMakeLists.txt
+++ b/examples/cpp/transaction/stopserver.sh
@@ -4,24 +4,28 @@
# 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.
-cmake_minimum_required(VERSION 3.4)
-project(pdxautoserializer)
-file(GLOB_RECURSE SOURCES "*.cpp")
+#!/usr/bin/env bash
+GFSH_PATH=""
+which gfsh 2> /dev/null
-add_executable(pdxautoserializer ${SOURCES})
-target_link_libraries(pdxautoserializer
- PRIVATE
- antlr
-)
+if [ $? -eq 0 ]; then
+ GFSH_PATH="gfsh"
+else
+ if [ "$GEODE_HOME" == "" ]; then
+ echo "Could not find gfsh. Please set the GEODE_HOME path."
+ echo "e.g. export GEODE_HOME=<path to Geode>"
+ else
+ GFSH_PATH=$GEODE_HOME/bin/gfsh
+ fi
+fi
-install(TARGETS pdxautoserializer DESTINATION bin)
-include_directories(${CMAKE_SOURCE_DIR}/../../src/cppcache/include)
+$GFSH_PATH -e "connect" -e "stop server --name=server" -e "stop locator --name=locator"
diff --git a/examples/dotnet/AuthInitialize/ExampleAuthInitialize.cs b/examples/dotnet/AuthInitialize/ExampleAuthInitialize.cs
index 583ac23..103e6ff 100644
--- a/examples/dotnet/AuthInitialize/ExampleAuthInitialize.cs
+++ b/examples/dotnet/AuthInitialize/ExampleAuthInitialize.cs
@@ -1,4 +1,21 @@
-using System;
+/*
+ * 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.
+ */
+
+using System;
using Apache.Geode.Client;
namespace Apache.Geode.Examples.AuthInitialize
@@ -23,8 +40,8 @@
Console.Out.WriteLine("ExampleAuthInitialize::GetCredentials called");
var credentials = new Properties<string, object>();
- credentials.Insert("username", "john");
- credentials.Insert("password", "secret");
+ credentials.Insert("security-username", "root");
+ credentials.Insert("security-password", "root");
return credentials;
}
}
diff --git a/examples/dotnet/AuthInitialize/Program.cs b/examples/dotnet/AuthInitialize/Program.cs
index 91ff1c5..23f8a2e 100644
--- a/examples/dotnet/AuthInitialize/Program.cs
+++ b/examples/dotnet/AuthInitialize/Program.cs
@@ -1,4 +1,4 @@
-/*
+/*
* 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.
diff --git a/examples/dotnet/AuthInitialize/README.md b/examples/dotnet/AuthInitialize/README.md
index c79fc8c..45da800 100644
--- a/examples/dotnet/AuthInitialize/README.md
+++ b/examples/dotnet/AuthInitialize/README.md
@@ -1,24 +1,29 @@
-# AuthInitialize Example
+# AuthInitialize Example
This example shows how to create and register a custom `IAuthIntialize` authentication
-handler.
+handler on the client that authenticates against a server that was started with the corresponding authenticator.
## Prerequisites
* Install [Apache Geode](https://geode.apache.org)
* Build and install [Apache Geode Native](https://github.com/apache/geode-native)
+* Apache Geode Native examples, built and installed.
+* A `GEODE_HOME` environment variable set to the location of the Apache Geode installation.
+* `GEODE_HOME/bin` in the execution path.
## Running
-* Start Geode Server and create region.
+1. Set the current directory to the `AuthInitialize` directory in your example workspace.
+
```
- gfsh>start locator --name=locator
- gfsh>start server --name=server
- gfsh>create region --name=region --type=PARTITION
+ $ cd workspace/examples/dotnet/AuthInitialize
```
-* Execute `Apache.Geode.Examples.AuthInitialize.exe`.
-
- output:
+
+2. Run the `startserver.ps1` script to start the Geode cluster with authentication and create a region.
+
+3. Execute `AuthInitialize.exe`:
+
```
- ExampleAuthInitialize::ExampleAuthInitialize called
- ExampleAuthInitialize::GetCredentials called
- a = 1
- b = 2
+.\AuthInitialize.exe
+ExampleAuthInitialize::ExampleAuthInitialize called
+ExampleAuthInitialize::GetCredentials called
+a = 1
+b = 2
```
diff --git a/examples/dotnet/AuthInitialize/startserver.ps1 b/examples/dotnet/AuthInitialize/startserver.ps1
index 8bbe074..354e7c3 100644
--- a/examples/dotnet/AuthInitialize/startserver.ps1
+++ b/examples/dotnet/AuthInitialize/startserver.ps1
@@ -1,4 +1,4 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
+# 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
@@ -35,5 +35,11 @@
if ($GFSH_PATH -ne "")
{
- Invoke-Expression "$GFSH_PATH -e 'start locator --name=locator --dir=$PSScriptRoot\locator' -e 'start server --name=server --dir=$PSScriptRoot\server' -e 'create region --name=region --type=PARTITION'"
-}
\ No newline at end of file
+ # Set this variable to include your java object that implements the Authenticator class
+ $RESOLVEDPATH = Resolve-Path -Path "$PSScriptRoot/../../utilities/example.jar"
+
+ # Set this variable to the full name of your Authenticator.create function
+ $AUTHENTICATOR = 'javaobject.SimpleAuthenticator.create'
+
+ Invoke-Expression "$GFSH_PATH -e 'start locator --name=locator --dir=$PSScriptRoot\locator' -e 'start server --name=server --classpath=$RESOLVEDPATH --J=-Dgemfire.security-client-authenticator=$AUTHENTICATOR --dir=$PSScriptRoot\server' -e 'create region --name=region --type=PARTITION'"
+}
diff --git a/examples/dotnet/AuthInitialize/stopserver.ps1 b/examples/dotnet/AuthInitialize/stopserver.ps1
index 04da3cf..ec2c218 100644
--- a/examples/dotnet/AuthInitialize/stopserver.ps1
+++ b/examples/dotnet/AuthInitialize/stopserver.ps1
@@ -1,4 +1,4 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
+# 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
diff --git a/examples/dotnet/BUILD-DOTNET-EXAMPLES.md b/examples/dotnet/BUILD-DOTNET-EXAMPLES.md
deleted file mode 100644
index abc2cea..0000000
--- a/examples/dotnet/BUILD-DOTNET-EXAMPLES.md
+++ /dev/null
@@ -1,36 +0,0 @@
-# Geode Native .NET Examples
-
-## Prerequisites
-* Install [Apache Geode](https://geode.apache.org)
-* Install [CMake](https://cmake.org/download/)
-* Build and install [Apache Geode Native](https://github.com/apache/geode-native)
-
-## Examples
-* [Apache.Geode.Examples.AuthInitialize](Apache.Geode.Examples.Cache/README.md)
-* [Apache.Geode.Examples.Cache](Apache.Geode.Examples.Cache/README.md)
-
-## Building the Examples
-
-1. Copy the `examples` directory from the native client installation folder to a folder in your workspace.
-
-1. Use cmake to generate the .sln and .vcxproj files for the examples:
-
- ```
- cd workspace\examples\dotnet
- mkdir build
- cd build
- cmake .. -G"Visual Studio 14 2015 Win64" -DGeodeNative_ROOT="<NC-install-root-dir>"
- ```
-The result is a Visual Studio solution for the .NET examples.
-1. Open the solution file, `examples.sln`, in [Visual Studio 2015](https://www.visualstudio.com/) or newer and build all projects.
-
-
-## Running the Examples
-To run the examples,
-
-1. Decide which example to try first. Follow directions in the README file in the source directory for that example to start the server and create a region.
-
-1. Assuming you are still in Visual Studio, select the desired example as your StartUp project and execute it.
-
-The example's README file describes the expected output.
-
diff --git a/examples/dotnet/CMakeLists.txt b/examples/dotnet/CMakeLists.txt
index e50ff75..aeedcb7 100644
--- a/examples/dotnet/CMakeLists.txt
+++ b/examples/dotnet/CMakeLists.txt
@@ -21,7 +21,6 @@
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt
- BUILD-DOTNET-EXAMPLES.md
DESTINATION examples/dotnet)
function(add_example)
@@ -56,6 +55,9 @@
add_example(NAME DataSerializableCs
SOURCE Order.cs Program.cs)
+add_example(NAME FunctionExecutionCs
+ SOURCE Program.cs)
+
add_example(NAME PdxAutoSerializer
SOURCE Order.cs Program.cs)
diff --git a/examples/dotnet/CMakeLists.txt.in b/examples/dotnet/CMakeLists.txt.in
index 5035bec..2257e75 100644
--- a/examples/dotnet/CMakeLists.txt.in
+++ b/examples/dotnet/CMakeLists.txt.in
@@ -20,6 +20,7 @@
add_subdirectory(AuthInitialize)
add_subdirectory(ContinuousQueryCs)
add_subdirectory(DataSerializableCs)
+add_subdirectory(FunctionExecutionCs)
add_subdirectory(PdxAutoSerializer)
add_subdirectory(PdxSerializableCs)
add_subdirectory(PutGetRemove)
diff --git a/examples/dotnet/ContinuousQueryCs/MyCqListener.cs b/examples/dotnet/ContinuousQueryCs/MyCqListener.cs
index d61c065..9d186b4 100644
--- a/examples/dotnet/ContinuousQueryCs/MyCqListener.cs
+++ b/examples/dotnet/ContinuousQueryCs/MyCqListener.cs
@@ -1,4 +1,4 @@
-/*
+/*
* 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.
@@ -21,48 +21,48 @@
namespace Apache.Geode.Examples.ContinuousQuery
{
- public class MyCqListener<TKey, TResult> : ICqListener<TKey, TResult>
+ public class MyCqListener<TKey, TResult> : ICqListener<TKey, TResult>
+ {
+ public virtual void OnEvent(CqEvent<TKey, TResult> ev)
{
- public virtual void OnEvent(CqEvent<TKey, TResult> ev)
- {
- Order val = ev.getNewValue() as Order;
- TKey key = ev.getKey();
- string operationType = "UNKNOWN";
+ Order val = ev.getNewValue() as Order;
+ TKey key = ev.getKey();
+ string operationType = "UNKNOWN";
- switch (ev.getQueryOperation())
- {
- case CqOperation.OP_TYPE_CREATE:
- operationType = "CREATE";
- break;
- case CqOperation.OP_TYPE_UPDATE:
- operationType = "UPDATE";
- break;
- case CqOperation.OP_TYPE_DESTROY:
- operationType = "DESTROY";
- break;
- default:
- Console.WriteLine("Unexpected operation encountered {0}", ev.getQueryOperation());
- break;
- }
+ switch (ev.getQueryOperation())
+ {
+ case CqOperation.OP_TYPE_CREATE:
+ operationType = "CREATE";
+ break;
+ case CqOperation.OP_TYPE_UPDATE:
+ operationType = "UPDATE";
+ break;
+ case CqOperation.OP_TYPE_DESTROY:
+ operationType = "DESTROY";
+ break;
+ default:
+ Console.WriteLine("Unexpected operation encountered {0}", ev.getQueryOperation());
+ break;
+ }
- if (val != null)
- {
- Console.WriteLine("MyCqListener::OnEvent({0}) called with key {1}, value {2}", operationType, key, val.ToString());
- }
- else
- {
- Console.WriteLine("MyCqListener::OnEvent({0}) called with key {1}, value null", operationType, key);
- }
- }
-
- public virtual void OnError(CqEvent<TKey, TResult> ev)
- {
- Console.WriteLine("MyCqListener::OnError called");
- }
-
- public virtual void Close()
- {
- Console.WriteLine("MyCqListener::close called");
- }
+ if (val != null)
+ {
+ Console.WriteLine("MyCqListener::OnEvent({0}) called with key {1}, value {2}", operationType, key, val.ToString());
+ }
+ else
+ {
+ Console.WriteLine("MyCqListener::OnEvent({0}) called with key {1}, value null", operationType, key);
+ }
}
+
+ public virtual void OnError(CqEvent<TKey, TResult> ev)
+ {
+ Console.WriteLine("MyCqListener::OnError called");
+ }
+
+ public virtual void Close()
+ {
+ Console.WriteLine("MyCqListener::close called");
+ }
+ }
}
diff --git a/examples/dotnet/ContinuousQueryCs/Order.cs b/examples/dotnet/ContinuousQueryCs/Order.cs
index ecb5875..011f94c 100644
--- a/examples/dotnet/ContinuousQueryCs/Order.cs
+++ b/examples/dotnet/ContinuousQueryCs/Order.cs
@@ -1,4 +1,4 @@
-/*
+/*
* 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.
@@ -19,53 +19,53 @@
namespace Apache.Geode.Examples.ContinuousQuery
{
- public class Order : IPdxSerializable
+ public class Order : IPdxSerializable
+ {
+ private const string ORDER_ID_KEY_ = "order_id";
+ private const string NAME_KEY_ = "name";
+ private const string QUANTITY_KEY_ = "quantity";
+
+ public long OrderId { get; set; }
+ public string Name { get; set; }
+ public short Quantity { get; set; }
+
+ // A default constructor is required for deserialization
+ public Order() { }
+
+ public Order(int orderId, string name, short quantity)
{
- private const string ORDER_ID_KEY_ = "order_id";
- private const string NAME_KEY_ = "name";
- private const string QUANTITY_KEY_ = "quantity";
-
- public long OrderId { get; set; }
- public string Name { get; set; }
- public short Quantity { get; set; }
-
- // A default constructor is required for deserialization
- public Order() { }
-
- public Order(int orderId, string name, short quantity)
- {
- OrderId = orderId;
- Name = name;
- Quantity = quantity;
- }
-
- public override string ToString()
- {
- return string.Format("Order: [{0}, {1}, {2}]", OrderId, Name, Quantity);
- }
-
- public void ToData(IPdxWriter output)
- {
- output.WriteLong(ORDER_ID_KEY_, OrderId);
- output.MarkIdentityField(ORDER_ID_KEY_);
-
- output.WriteString(NAME_KEY_, Name);
- output.MarkIdentityField(NAME_KEY_);
-
- output.WriteInt(QUANTITY_KEY_, Quantity);
- output.MarkIdentityField(QUANTITY_KEY_);
- }
-
- public void FromData(IPdxReader input)
- {
- OrderId = input.ReadLong(ORDER_ID_KEY_);
- Name = input.ReadString(NAME_KEY_);
- Quantity = (short)input.ReadInt(QUANTITY_KEY_);
- }
-
- public static IPdxSerializable CreateDeserializable()
- {
- return new Order();
- }
+ OrderId = orderId;
+ Name = name;
+ Quantity = quantity;
}
+
+ public override string ToString()
+ {
+ return string.Format("Order: [{0}, {1}, {2}]", OrderId, Name, Quantity);
+ }
+
+ public void ToData(IPdxWriter output)
+ {
+ output.WriteLong(ORDER_ID_KEY_, OrderId);
+ output.MarkIdentityField(ORDER_ID_KEY_);
+
+ output.WriteString(NAME_KEY_, Name);
+ output.MarkIdentityField(NAME_KEY_);
+
+ output.WriteInt(QUANTITY_KEY_, Quantity);
+ output.MarkIdentityField(QUANTITY_KEY_);
+ }
+
+ public void FromData(IPdxReader input)
+ {
+ OrderId = input.ReadLong(ORDER_ID_KEY_);
+ Name = input.ReadString(NAME_KEY_);
+ Quantity = (short)input.ReadInt(QUANTITY_KEY_);
+ }
+
+ public static IPdxSerializable CreateDeserializable()
+ {
+ return new Order();
+ }
+ }
}
diff --git a/examples/dotnet/ContinuousQueryCs/Program.cs b/examples/dotnet/ContinuousQueryCs/Program.cs
index 41b3d33..7d826de 100644
--- a/examples/dotnet/ContinuousQueryCs/Program.cs
+++ b/examples/dotnet/ContinuousQueryCs/Program.cs
@@ -1,4 +1,4 @@
-/*
+/*
* 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.
@@ -20,72 +20,75 @@
namespace Apache.Geode.Examples.ContinuousQuery
{
- public class Program
+ public class Program
+ {
+ public static void Main(string[] args)
{
- public static void Main(string[] args)
- {
- var cacheFactory = new CacheFactory()
- .Set("log-level", "none");
- var cache = cacheFactory.Create();
+ var cacheFactory = new CacheFactory()
+ .Set("log-level", "none");
+ var cache = cacheFactory.Create();
- Console.WriteLine("Registering for data serialization");
+ Console.WriteLine("Registering for data serialization");
- cache.TypeRegistry.RegisterPdxType(Order.CreateDeserializable);
+ cache.TypeRegistry.RegisterPdxType(Order.CreateDeserializable);
- var poolFactory = cache.GetPoolFactory()
- .AddLocator("localhost", 10334);
- var pool = poolFactory
- .SetSubscriptionEnabled(true)
- .Create("pool");
+ var poolFactory = cache.GetPoolFactory()
+ .AddLocator("localhost", 10334);
+ var pool = poolFactory
+ .SetSubscriptionEnabled(true)
+ .Create("pool");
- var regionFactory = cache.CreateRegionFactory(RegionShortcut.PROXY)
- .SetPoolName("pool");
- var orderRegion = regionFactory.Create<string, Order>("example_orderobject");
+ var regionFactory = cache.CreateRegionFactory(RegionShortcut.PROXY)
+ .SetPoolName("pool");
+ var orderRegion = regionFactory.Create<string, Order>("example_orderobject");
- var queryService = pool.GetQueryService();
+ var queryService = pool.GetQueryService();
- var cqAttributesFactory = new CqAttributesFactory<string, Order>();
+ var cqAttributesFactory = new CqAttributesFactory<string, Order>();
- var cqListener = new MyCqListener<string, Order>();
+ var cqListener = new MyCqListener<string, Order>();
- cqAttributesFactory.AddCqListener(cqListener);
+ cqAttributesFactory.AddCqListener(cqListener);
- var cqAttributes = cqAttributesFactory.Create();
- try {
- var query = queryService.NewCq("MyCq", "SELECT * FROM /example_orderobject WHERE quantity > 30", cqAttributes, false);
+ var cqAttributes = cqAttributesFactory.Create();
+ try
+ {
+ var query = queryService.NewCq("MyCq", "SELECT * FROM /example_orderobject WHERE quantity > 30", cqAttributes, false);
- Console.WriteLine("Executing continuous query");
- query.Execute();
-
- Console.WriteLine("Create orders");
- var order1 = new Order(1, "product x", 23);
- var order2 = new Order(2, "product y", 37);
- var order3 = new Order(3, "product z", 1);
- var order4 = new Order(4, "product z", 102);
- var order5 = new Order(5, "product x", 17);
- var order6 = new Order(6, "product z", 42);
-
- Console.WriteLine("Putting and changing Order objects in the region");
- orderRegion.Put("Order1", order1);
- orderRegion.Put("Order2", order2);
- orderRegion.Put("Order3", order3);
- orderRegion.Put("Order4", order4);
- orderRegion.Put("Order5", order5);
- orderRegion.Put("Order6", order6);
-
- orderRegion.Put("Order2", new Order(2, "product y", 45));
- orderRegion.Put("Order2", new Order(2, "product y", 29));
- orderRegion.Remove("Order6");
+ Console.WriteLine("Executing continuous query");
+ query.Execute();
- System.Threading.Thread.Sleep(2000);
+ Console.WriteLine("Create orders");
+ var order1 = new Order(1, "product x", 23);
+ var order2 = new Order(2, "product y", 37);
+ var order3 = new Order(3, "product z", 1);
+ var order4 = new Order(4, "product z", 102);
+ var order5 = new Order(5, "product x", 17);
+ var order6 = new Order(6, "product z", 42);
- query.Stop();
- query.Close();
- } catch (IllegalStateException ex) {
- Console.WriteLine(ex.Message);
- }
-
- cache.Close();
- }
+ Console.WriteLine("Putting and changing Order objects in the region");
+ orderRegion.Put("Order1", order1);
+ orderRegion.Put("Order2", order2);
+ orderRegion.Put("Order3", order3);
+ orderRegion.Put("Order4", order4);
+ orderRegion.Put("Order5", order5);
+ orderRegion.Put("Order6", order6);
+
+ orderRegion.Put("Order2", new Order(2, "product y", 45));
+ orderRegion.Put("Order2", new Order(2, "product y", 29));
+ orderRegion.Remove("Order6");
+
+ System.Threading.Thread.Sleep(2000);
+
+ query.Stop();
+ query.Close();
+ }
+ catch (IllegalStateException ex)
+ {
+ Console.WriteLine(ex.Message);
+ }
+
+ cache.Close();
}
+ }
}
diff --git a/examples/dotnet/ContinuousQueryCs/README.md b/examples/dotnet/ContinuousQueryCs/README.md
index d544412..a652043 100644
--- a/examples/dotnet/ContinuousQueryCs/README.md
+++ b/examples/dotnet/ContinuousQueryCs/README.md
@@ -1,4 +1,4 @@
-# ContinuousQuery Example
+# ContinuousQuery Example
This is a simple example showing how to execute a continuous query on a Goede region.
## Prerequisites
diff --git a/examples/dotnet/ContinuousQueryCs/startserver.ps1 b/examples/dotnet/ContinuousQueryCs/startserver.ps1
index c3d5735..347eda1 100644
--- a/examples/dotnet/ContinuousQueryCs/startserver.ps1
+++ b/examples/dotnet/ContinuousQueryCs/startserver.ps1
@@ -1,4 +1,4 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
+# 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
diff --git a/examples/dotnet/ContinuousQueryCs/stopserver.ps1 b/examples/dotnet/ContinuousQueryCs/stopserver.ps1
index a95b7a7..10d2352 100644
--- a/examples/dotnet/ContinuousQueryCs/stopserver.ps1
+++ b/examples/dotnet/ContinuousQueryCs/stopserver.ps1
@@ -1,4 +1,4 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
+# 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
diff --git a/examples/dotnet/DataSerializableCs/Order.cs b/examples/dotnet/DataSerializableCs/Order.cs
index e23078f..7fd6fdb 100644
--- a/examples/dotnet/DataSerializableCs/Order.cs
+++ b/examples/dotnet/DataSerializableCs/Order.cs
@@ -1,4 +1,4 @@
-/*
+/*
* 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.
diff --git a/examples/dotnet/DataSerializableCs/Program.cs b/examples/dotnet/DataSerializableCs/Program.cs
index 84e6529..b37010f 100644
--- a/examples/dotnet/DataSerializableCs/Program.cs
+++ b/examples/dotnet/DataSerializableCs/Program.cs
@@ -1,4 +1,4 @@
-/*
+/*
* 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.
@@ -20,43 +20,43 @@
namespace Apache.Geode.Examples.Serializer
{
- public class Program
+ public class Program
+ {
+ public static void Main(string[] args)
{
- public static void Main(string[] args)
- {
- var cacheFactory = new CacheFactory()
- .Set("log-level", "none");
- var cache = cacheFactory.Create();
+ var cacheFactory = new CacheFactory()
+ .Set("log-level", "none");
+ var cache = cacheFactory.Create();
- Console.WriteLine("Registering for data serialization");
+ Console.WriteLine("Registering for data serialization");
- cache.TypeRegistry.RegisterType(Order.CreateDeserializable, 7);
+ cache.TypeRegistry.RegisterType(Order.CreateDeserializable, 7);
- var poolFactory = cache.GetPoolFactory()
- .AddLocator("localhost", 10334);
- poolFactory.Create("pool");
+ var poolFactory = cache.GetPoolFactory()
+ .AddLocator("localhost", 10334);
+ poolFactory.Create("pool");
- var regionFactory = cache.CreateRegionFactory(RegionShortcut.PROXY)
- .SetPoolName("pool");
- var orderRegion = regionFactory.Create<int, Order>("example_orderobject");
+ var regionFactory = cache.CreateRegionFactory(RegionShortcut.PROXY)
+ .SetPoolName("pool");
+ var orderRegion = regionFactory.Create<int, Order>("example_orderobject");
- Console.WriteLine("Storing order object in the region");
+ Console.WriteLine("Storing order object in the region");
- const int orderKey = 65;
+ const int orderKey = 65;
- var order = new Order(orderKey, "Donuts", 12);
+ var order = new Order(orderKey, "Donuts", 12);
- Console.WriteLine("order to put is " + order);
- orderRegion.Put(orderKey, order, null);
+ Console.WriteLine("order to put is " + order);
+ orderRegion.Put(orderKey, order, null);
- Console.WriteLine("Successfully put order, getting now...");
- var orderRetrieved = orderRegion.Get(orderKey, null);
+ Console.WriteLine("Successfully put order, getting now...");
+ var orderRetrieved = orderRegion.Get(orderKey, null);
- Console.WriteLine("Order key: " + orderKey + " = " + orderRetrieved);
+ Console.WriteLine("Order key: " + orderKey + " = " + orderRetrieved);
- cache.Close();
- }
+ cache.Close();
}
+ }
}
diff --git a/examples/dotnet/DataSerializableCs/startserver.ps1 b/examples/dotnet/DataSerializableCs/startserver.ps1
index c3d5735..347eda1 100644
--- a/examples/dotnet/DataSerializableCs/startserver.ps1
+++ b/examples/dotnet/DataSerializableCs/startserver.ps1
@@ -1,4 +1,4 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
+# 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
diff --git a/examples/dotnet/DataSerializableCs/stopserver.ps1 b/examples/dotnet/DataSerializableCs/stopserver.ps1
index a95b7a7..10d2352 100644
--- a/examples/dotnet/DataSerializableCs/stopserver.ps1
+++ b/examples/dotnet/DataSerializableCs/stopserver.ps1
@@ -1,4 +1,4 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
+# 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
diff --git a/examples/dotnet/FunctionExecutionCs/Program.cs b/examples/dotnet/FunctionExecutionCs/Program.cs
new file mode 100644
index 0000000..3ad385d
--- /dev/null
+++ b/examples/dotnet/FunctionExecutionCs/Program.cs
@@ -0,0 +1,82 @@
+/*
+* 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.
+*/
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using Apache.Geode.Client;
+
+namespace Apache.Geode.Examples.FunctionExecution
+{
+ class Program
+ {
+ static void Main(string[] args)
+ {
+ var cacheFactory = new CacheFactory()
+ .Set("log-level", "none");
+ var cache = cacheFactory.Create();
+
+ var poolFactory = cache.GetPoolFactory()
+ .AddLocator("localhost", 10334);
+ var pool = poolFactory.Create("pool");
+
+ var regionFactory = cache.CreateRegionFactory(RegionShortcut.PROXY)
+ .SetPoolName("pool");
+ var region = regionFactory.Create<object, object>("partition_region");
+
+ Console.WriteLine("Storing id and username in the region");
+
+ string rtimmonsKey = "rtimmons";
+ string rtimmonsValue = "Robert Timmons";
+ string scharlesKey = "scharles";
+ string scharlesValue = "Sylvia Charles";
+
+ region.Put(rtimmonsKey, rtimmonsValue, null);
+ region.Put(scharlesKey, scharlesValue, null);
+
+ Console.WriteLine("Getting the user info from the region");
+ var user1 = region.Get(rtimmonsKey, null);
+ var user2 = region.Get(scharlesKey, null);
+
+ Console.WriteLine(rtimmonsKey + " = " + user1);
+ Console.WriteLine(scharlesKey + " = " + user2);
+
+ ArrayList keyArgs = new ArrayList();
+ keyArgs.Add(rtimmonsKey);
+ keyArgs.Add(scharlesKey);
+
+ var exc = Client.FunctionService<object>.OnRegion<object, object>(region);
+
+ Client.IResultCollector<object> rc = exc.WithArgs<object>(keyArgs).Execute("ExampleMultiGetFunction");
+
+ ICollection<object> res = rc.GetResult();
+
+ Console.WriteLine("Function Execution Results:");
+ Console.WriteLine(" Count = {0}", res.Count);
+
+ foreach (List<object> item in res)
+ {
+ foreach (object item2 in item)
+ {
+ Console.WriteLine(" value = {0}", item2.ToString());
+ }
+ }
+
+ cache.Close();
+ }
+ }
+}
diff --git a/examples/dotnet/FunctionExecutionCs/README.md b/examples/dotnet/FunctionExecutionCs/README.md
new file mode 100644
index 0000000..63045e6
--- /dev/null
+++ b/examples/dotnet/FunctionExecutionCs/README.md
@@ -0,0 +1,25 @@
+# FunctionExecution Example
+This example illustrates how to execute server side java functions.
+
+## Prerequisites
+* Install [Apache Geode](https://geode.apache.org)
+* Build and install [Apache Geode Native](https://github.com/apache/geode-native)
+
+## Running
+* Run the following Powershell script which starts the Geode Locator, deploys the jar file containing your function, starts the Geode Server, and creates the region.
+ ```
+ PS> startserver.ps1
+ ```
+* Execute `Apache.Geode.Examples.FunctionExecutionCs.exe`.
+
+ output:
+ ```
+ Storing id and username in the region
+ Getting the user info from the region
+ rtimmons = Robert Timmons
+ scharles = Sylvia Charles
+ Function Execution Results:
+ Count = 1
+ value = Robert Timmons
+ value = Sylvia Charles
+ ```
diff --git a/examples/dotnet/FunctionExecutionCs/startserver.ps1 b/examples/dotnet/FunctionExecutionCs/startserver.ps1
new file mode 100644
index 0000000..bc38327
--- /dev/null
+++ b/examples/dotnet/FunctionExecutionCs/startserver.ps1
@@ -0,0 +1,39 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+$GFSH_PATH = ""
+if (Get-Command gfsh -ErrorAction SilentlyContinue)
+{
+ $GFSH_PATH = "gfsh"
+}
+else
+{
+ if (-not (Test-Path env:GEODE_HOME))
+ {
+ Write-Host "Could not find gfsh. Please set the GEODE_HOME path. e.g. "
+ Write-Host "(Powershell) `$env:GEODE_HOME = <path to Geode>"
+ Write-Host " OR"
+ Write-Host "(Command-line) set %GEODE_HOME% = <path to Geode>"
+ }
+ else
+ {
+ $GFSH_PATH = "$env:GEODE_HOME\bin\gfsh.bat"
+ }
+}
+
+if ($GFSH_PATH -ne "")
+{
+ Invoke-Expression "$GFSH_PATH -e 'start locator --name=locator --dir=$PSScriptRoot/locator' -e 'deploy --jar=../../utilities/example.jar' -e 'start server --name=the-server --server-port=50505' -e 'create region --name=partition_region --type=PARTITION'"
+}
\ No newline at end of file
diff --git a/examples/dotnet/FunctionExecutionCs/stopserver.ps1 b/examples/dotnet/FunctionExecutionCs/stopserver.ps1
new file mode 100644
index 0000000..742ce8d
--- /dev/null
+++ b/examples/dotnet/FunctionExecutionCs/stopserver.ps1
@@ -0,0 +1,39 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+$GFSH_PATH = ""
+if (Get-Command gfsh -ErrorAction SilentlyContinue)
+{
+ $GFSH_PATH = "gfsh"
+}
+else
+{
+ if (-not (Test-Path env:GEODE_HOME))
+ {
+ Write-Host "Could not find gfsh. Please set the GEODE_HOME path. e.g. "
+ Write-Host "(Powershell) `$env:GEODE_HOME = <path to Geode>"
+ Write-Host " OR"
+ Write-Host "(Command-line) set %GEODE_HOME% = <path to Geode>"
+ }
+ else
+ {
+ $GFSH_PATH = "$env:GEODE_HOME\bin\gfsh.bat"
+ }
+}
+
+if ($GFSH_PATH -ne "")
+{
+ Invoke-Expression "$GFSH_PATH -e 'connect' -e 'shutdown --include-locators=true'"
+}
\ No newline at end of file
diff --git a/examples/dotnet/PdxAutoSerializer/Order.cs b/examples/dotnet/PdxAutoSerializer/Order.cs
index 7ffea67..7635f11 100644
--- a/examples/dotnet/PdxAutoSerializer/Order.cs
+++ b/examples/dotnet/PdxAutoSerializer/Order.cs
@@ -1,4 +1,4 @@
-/*
+/*
* 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.
@@ -17,27 +17,27 @@
namespace Apache.Geode.Examples.Serializer
{
- public class Order
+ public class Order
+ {
+ public int OrderId { get; set; }
+ public string Name { get; set; }
+ public short Quantity { get; set; }
+
+ // A default constructor is required for reflection based autoserialization
+ public Order() { }
+
+ public Order(int orderId, string name, short quantity)
{
- public int OrderId { get; set; }
- public string Name { get; set; }
- public short Quantity { get; set; }
-
- // A default constructor is required for reflection based autoserialization
- public Order() { }
-
- public Order(int orderId, string name, short quantity)
- {
- OrderId = orderId;
- Name = name;
- Quantity = quantity;
- }
-
- public override string ToString()
- {
- return "Order: [" + OrderId + ", " + Name + ", " + Quantity + "]";
- }
+ OrderId = orderId;
+ Name = name;
+ Quantity = quantity;
}
+
+ public override string ToString()
+ {
+ return "Order: [" + OrderId + ", " + Name + ", " + Quantity + "]";
+ }
+ }
}
diff --git a/examples/dotnet/PdxAutoSerializer/Program.cs b/examples/dotnet/PdxAutoSerializer/Program.cs
index 2005ec0..2cacc78 100644
--- a/examples/dotnet/PdxAutoSerializer/Program.cs
+++ b/examples/dotnet/PdxAutoSerializer/Program.cs
@@ -1,4 +1,4 @@
-/*
+/*
* 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.
@@ -20,43 +20,43 @@
namespace Apache.Geode.Examples.Serializer
{
- public class Program
+ public class Program
+ {
+ public static void Main(string[] args)
{
- public static void Main(string[] args)
- {
- var cacheFactory = new CacheFactory()
- .Set("log-level", "none");
- var cache = cacheFactory.Create();
+ var cacheFactory = new CacheFactory()
+ .Set("log-level", "none");
+ var cache = cacheFactory.Create();
- Console.WriteLine("Registering for reflection-based auto serialization");
+ Console.WriteLine("Registering for reflection-based auto serialization");
- cache.TypeRegistry.PdxSerializer = new ReflectionBasedAutoSerializer();
+ cache.TypeRegistry.PdxSerializer = new ReflectionBasedAutoSerializer();
- var poolFactory = cache.GetPoolFactory()
- .AddLocator("localhost", 10334);
- poolFactory.Create("pool");
+ var poolFactory = cache.GetPoolFactory()
+ .AddLocator("localhost", 10334);
+ poolFactory.Create("pool");
- var regionFactory = cache.CreateRegionFactory(RegionShortcut.PROXY)
- .SetPoolName("pool");
- var orderRegion = regionFactory.Create<int, Order>("example_orderobject");
+ var regionFactory = cache.CreateRegionFactory(RegionShortcut.PROXY)
+ .SetPoolName("pool");
+ var orderRegion = regionFactory.Create<int, Order>("example_orderobject");
- Console.WriteLine("Storing order object in the region");
+ Console.WriteLine("Storing order object in the region");
- const int orderKey = 65;
+ const int orderKey = 65;
- var order = new Order(orderKey, "Vox AC30", 11);
+ var order = new Order(orderKey, "Vox AC30", 11);
- Console.WriteLine("order to put is " + order);
- orderRegion.Put(orderKey, order, null);
+ Console.WriteLine("order to put is " + order);
+ orderRegion.Put(orderKey, order, null);
- Console.WriteLine("Successfully put order, getting now...");
- var orderRetrieved = orderRegion.Get(orderKey, null);
+ Console.WriteLine("Successfully put order, getting now...");
+ var orderRetrieved = orderRegion.Get(orderKey, null);
- Console.WriteLine("Order key: " + orderKey + " = " + orderRetrieved);
+ Console.WriteLine("Order key: " + orderKey + " = " + orderRetrieved);
- cache.Close();
- }
+ cache.Close();
}
+ }
}
diff --git a/examples/dotnet/PdxAutoSerializer/README.md b/examples/dotnet/PdxAutoSerializer/README.md
index bbe7ecd..26640ba 100644
--- a/examples/dotnet/PdxAutoSerializer/README.md
+++ b/examples/dotnet/PdxAutoSerializer/README.md
@@ -1,4 +1,4 @@
-# PdxAutoSerializer Example
+# PdxAutoSerializer Example
This is a simple example showing how to register for auto-serialization of custom objects using the ReflectionBasedAutoSerializer class.
## Prerequisites
diff --git a/examples/dotnet/PdxAutoSerializer/startserver.ps1 b/examples/dotnet/PdxAutoSerializer/startserver.ps1
index c3d5735..347eda1 100644
--- a/examples/dotnet/PdxAutoSerializer/startserver.ps1
+++ b/examples/dotnet/PdxAutoSerializer/startserver.ps1
@@ -1,4 +1,4 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
+# 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
diff --git a/examples/dotnet/PdxAutoSerializer/stopserver.ps1 b/examples/dotnet/PdxAutoSerializer/stopserver.ps1
index a95b7a7..10d2352 100644
--- a/examples/dotnet/PdxAutoSerializer/stopserver.ps1
+++ b/examples/dotnet/PdxAutoSerializer/stopserver.ps1
@@ -1,4 +1,4 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
+# 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
diff --git a/examples/dotnet/PdxSerializableCs/Order.cs b/examples/dotnet/PdxSerializableCs/Order.cs
index 85511fa..968eaf4 100644
--- a/examples/dotnet/PdxSerializableCs/Order.cs
+++ b/examples/dotnet/PdxSerializableCs/Order.cs
@@ -1,4 +1,4 @@
-/*
+/*
* 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.
@@ -19,55 +19,55 @@
namespace Apache.Geode.Examples.Serializer
{
- public class Order : IPdxSerializable
+ public class Order : IPdxSerializable
+ {
+ private const string ORDER_ID_KEY_ = "order_id";
+ private const string NAME_KEY_ = "name";
+ private const string QUANTITY_KEY_ = "quantity";
+
+ public long OrderId { get; set; }
+ public string Name { get; set; }
+ public short Quantity { get; set; }
+
+ // A default constructor is required for deserialization
+ public Order() { }
+
+ public Order(int orderId, string name, short quantity)
{
- private const string ORDER_ID_KEY_ = "order_id";
- private const string NAME_KEY_ = "name";
- private const string QUANTITY_KEY_ = "quantity";
-
- public long OrderId { get; set; }
- public string Name { get; set; }
- public short Quantity { get; set; }
-
- // A default constructor is required for deserialization
- public Order() { }
-
- public Order(int orderId, string name, short quantity)
- {
- OrderId = orderId;
- Name = name;
- Quantity = quantity;
- }
-
- public override string ToString()
- {
- return string.Format("Order: [{0}, {1}, {2}]", OrderId, Name, Quantity);
- }
-
- public void ToData(IPdxWriter output)
- {
- output.WriteLong(ORDER_ID_KEY_, OrderId);
- output.MarkIdentityField(ORDER_ID_KEY_);
-
- output.WriteString(NAME_KEY_, Name);
- output.MarkIdentityField(NAME_KEY_);
-
- output.WriteInt(QUANTITY_KEY_, Quantity);
- output.MarkIdentityField(QUANTITY_KEY_);
- }
-
- public void FromData(IPdxReader input)
- {
- OrderId = input.ReadLong(ORDER_ID_KEY_);
- Name = input.ReadString(NAME_KEY_);
- Quantity = (short)input.ReadInt(QUANTITY_KEY_);
- }
-
- public static IPdxSerializable CreateDeserializable()
- {
- return new Order();
- }
+ OrderId = orderId;
+ Name = name;
+ Quantity = quantity;
}
+
+ public override string ToString()
+ {
+ return string.Format("Order: [{0}, {1}, {2}]", OrderId, Name, Quantity);
+ }
+
+ public void ToData(IPdxWriter output)
+ {
+ output.WriteLong(ORDER_ID_KEY_, OrderId);
+ output.MarkIdentityField(ORDER_ID_KEY_);
+
+ output.WriteString(NAME_KEY_, Name);
+ output.MarkIdentityField(NAME_KEY_);
+
+ output.WriteInt(QUANTITY_KEY_, Quantity);
+ output.MarkIdentityField(QUANTITY_KEY_);
+ }
+
+ public void FromData(IPdxReader input)
+ {
+ OrderId = input.ReadLong(ORDER_ID_KEY_);
+ Name = input.ReadString(NAME_KEY_);
+ Quantity = (short)input.ReadInt(QUANTITY_KEY_);
+ }
+
+ public static IPdxSerializable CreateDeserializable()
+ {
+ return new Order();
+ }
+ }
}
diff --git a/examples/dotnet/PdxSerializableCs/Program.cs b/examples/dotnet/PdxSerializableCs/Program.cs
index ffed9dd..30a07ef 100644
--- a/examples/dotnet/PdxSerializableCs/Program.cs
+++ b/examples/dotnet/PdxSerializableCs/Program.cs
@@ -1,4 +1,4 @@
-/*
+/*
* 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.
@@ -20,43 +20,43 @@
namespace Apache.Geode.Examples.Serializer
{
- public class Program
+ public class Program
+ {
+ public static void Main(string[] args)
{
- public static void Main(string[] args)
- {
- var cacheFactory = new CacheFactory()
- .Set("log-level", "none");
- var cache = cacheFactory.Create();
+ var cacheFactory = new CacheFactory()
+ .Set("log-level", "none");
+ var cache = cacheFactory.Create();
- Console.WriteLine("Registering for data serialization");
+ Console.WriteLine("Registering for data serialization");
- cache.TypeRegistry.RegisterPdxType(Order.CreateDeserializable);
+ cache.TypeRegistry.RegisterPdxType(Order.CreateDeserializable);
- var poolFactory = cache.GetPoolFactory()
- .AddLocator("localhost", 10334);
- poolFactory.Create("pool");
+ var poolFactory = cache.GetPoolFactory()
+ .AddLocator("localhost", 10334);
+ poolFactory.Create("pool");
- var regionFactory = cache.CreateRegionFactory(RegionShortcut.PROXY)
- .SetPoolName("pool");
- var orderRegion = regionFactory.Create<int, Order>("example_orderobject");
+ var regionFactory = cache.CreateRegionFactory(RegionShortcut.PROXY)
+ .SetPoolName("pool");
+ var orderRegion = regionFactory.Create<int, Order>("example_orderobject");
- Console.WriteLine("Storing order object in the region");
+ Console.WriteLine("Storing order object in the region");
- const int orderKey = 65;
+ const int orderKey = 65;
- var order = new Order(orderKey, "Donuts", 12);
+ var order = new Order(orderKey, "Donuts", 12);
- Console.WriteLine("order to put is " + order);
- orderRegion.Put(orderKey, order, null);
+ Console.WriteLine("order to put is " + order);
+ orderRegion.Put(orderKey, order, null);
- Console.WriteLine("Successfully put order, getting now...");
- var orderRetrieved = orderRegion.Get(orderKey, null);
+ Console.WriteLine("Successfully put order, getting now...");
+ var orderRetrieved = orderRegion.Get(orderKey, null);
- Console.WriteLine("Order key: " + orderKey + " = " + orderRetrieved);
+ Console.WriteLine("Order key: " + orderKey + " = " + orderRetrieved);
- cache.Close();
- }
+ cache.Close();
}
+ }
}
diff --git a/examples/dotnet/PdxSerializableCs/README.md b/examples/dotnet/PdxSerializableCs/README.md
index 4859e84..0ee135e 100644
--- a/examples/dotnet/PdxSerializableCs/README.md
+++ b/examples/dotnet/PdxSerializableCs/README.md
@@ -1,4 +1,4 @@
-# PdxSerializable Example
+# PdxSerializable Example
This is a simple example showing how to register for serialization of custom objects using the IPDXSerializable class.
## Prerequisites
diff --git a/examples/dotnet/PdxSerializableCs/startserver.ps1 b/examples/dotnet/PdxSerializableCs/startserver.ps1
index c3d5735..347eda1 100644
--- a/examples/dotnet/PdxSerializableCs/startserver.ps1
+++ b/examples/dotnet/PdxSerializableCs/startserver.ps1
@@ -1,4 +1,4 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
+# 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
diff --git a/examples/dotnet/PdxSerializableCs/stopserver.ps1 b/examples/dotnet/PdxSerializableCs/stopserver.ps1
index a95b7a7..10d2352 100644
--- a/examples/dotnet/PdxSerializableCs/stopserver.ps1
+++ b/examples/dotnet/PdxSerializableCs/stopserver.ps1
@@ -1,4 +1,4 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
+# 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
diff --git a/examples/dotnet/PutGetRemove/Program.cs b/examples/dotnet/PutGetRemove/Program.cs
index 39f4abf..8bbe9f1 100644
--- a/examples/dotnet/PutGetRemove/Program.cs
+++ b/examples/dotnet/PutGetRemove/Program.cs
@@ -1,4 +1,4 @@
-/*
+/*
* 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.
@@ -20,51 +20,51 @@
namespace Apache.Geode.Examples.PutGetRemove
{
- class Program
+ class Program
+ {
+ static void Main(string[] args)
{
- static void Main(string[] args)
- {
- var cacheFactory = new CacheFactory()
- .Set("log-level", "none");
- var cache = cacheFactory.Create();
+ var cacheFactory = new CacheFactory()
+ .Set("log-level", "none");
+ var cache = cacheFactory.Create();
- var poolFactory = cache.GetPoolFactory()
- .AddLocator("localhost", 10334);
- poolFactory.Create("pool");
+ var poolFactory = cache.GetPoolFactory()
+ .AddLocator("localhost", 10334);
+ poolFactory.Create("pool");
- var regionFactory = cache.CreateRegionFactory(RegionShortcut.PROXY)
- .SetPoolName("pool");
- var region = regionFactory.Create<string, string>("example_userinfo");
+ var regionFactory = cache.CreateRegionFactory(RegionShortcut.PROXY)
+ .SetPoolName("pool");
+ var region = regionFactory.Create<string, string>("example_userinfo");
- Console.WriteLine("Storing id and username in the region");
+ Console.WriteLine("Storing id and username in the region");
- const string rtimmonsKey = "rtimmons";
- const string rtimmonsValue = "Robert Timmons";
- const string scharlesKey = "scharles";
- const string scharlesValue = "Sylvia Charles";
+ const string rtimmonsKey = "rtimmons";
+ const string rtimmonsValue = "Robert Timmons";
+ const string scharlesKey = "scharles";
+ const string scharlesValue = "Sylvia Charles";
- region.Put(rtimmonsKey, rtimmonsValue, null);
- region.Put(scharlesKey, scharlesValue, null);
+ region.Put(rtimmonsKey, rtimmonsValue, null);
+ region.Put(scharlesKey, scharlesValue, null);
- Console.WriteLine("Getting the user info from the region");
- var user1 = region.Get(rtimmonsKey, null);
- var user2 = region.Get(scharlesKey, null);
+ Console.WriteLine("Getting the user info from the region");
+ var user1 = region.Get(rtimmonsKey, null);
+ var user2 = region.Get(scharlesKey, null);
- Console.WriteLine(rtimmonsKey + " = " + user1);
- Console.WriteLine(scharlesKey + " = " + user2);
+ Console.WriteLine(rtimmonsKey + " = " + user1);
+ Console.WriteLine(scharlesKey + " = " + user2);
- Console.WriteLine("Removing " + rtimmonsKey + " info from the region");
+ Console.WriteLine("Removing " + rtimmonsKey + " info from the region");
- if (region.Remove(rtimmonsKey))
- {
- Console.WriteLine("Info for " + rtimmonsKey + " has been deleted");
- }
- else
- {
- Console.WriteLine("Info for " + rtimmonsKey + " has not been deleted");
- }
+ if (region.Remove(rtimmonsKey))
+ {
+ Console.WriteLine("Info for " + rtimmonsKey + " has been deleted");
+ }
+ else
+ {
+ Console.WriteLine("Info for " + rtimmonsKey + " has not been deleted");
+ }
- cache.Close();
- }
+ cache.Close();
}
+ }
}
diff --git a/examples/dotnet/PutGetRemove/README.md b/examples/dotnet/PutGetRemove/README.md
index 0d08e35..66f62cb 100644
--- a/examples/dotnet/PutGetRemove/README.md
+++ b/examples/dotnet/PutGetRemove/README.md
@@ -1,4 +1,4 @@
-# PutGetRemove Example
+# PutGetRemove Example
This is a very simple example showing how to create a `Cache` using the `CacheFactory`,
configure a `Pool` with a `PoolFactory`, and configure a `Region` with a `RegionFactory`.
We then put, get, and remove some primitive data in the region.
diff --git a/examples/dotnet/PutGetRemove/startserver.ps1 b/examples/dotnet/PutGetRemove/startserver.ps1
index bc14e1b..5cec56b 100644
--- a/examples/dotnet/PutGetRemove/startserver.ps1
+++ b/examples/dotnet/PutGetRemove/startserver.ps1
@@ -1,4 +1,4 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
+# 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
diff --git a/examples/dotnet/PutGetRemove/stopserver.ps1 b/examples/dotnet/PutGetRemove/stopserver.ps1
index 6ebd665..4857a2d 100644
--- a/examples/dotnet/PutGetRemove/stopserver.ps1
+++ b/examples/dotnet/PutGetRemove/stopserver.ps1
@@ -1,4 +1,4 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
+# 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
diff --git a/examples/dotnet/RemoteQueryCs/Order.cs b/examples/dotnet/RemoteQueryCs/Order.cs
index 85511fa..20ca913 100644
--- a/examples/dotnet/RemoteQueryCs/Order.cs
+++ b/examples/dotnet/RemoteQueryCs/Order.cs
@@ -1,4 +1,4 @@
-/*
+/*
* 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.
diff --git a/examples/dotnet/RemoteQueryCs/Program.cs b/examples/dotnet/RemoteQueryCs/Program.cs
index 71f2651..997ff6b 100644
--- a/examples/dotnet/RemoteQueryCs/Program.cs
+++ b/examples/dotnet/RemoteQueryCs/Program.cs
@@ -1,4 +1,4 @@
-/*
+/*
* 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.
diff --git a/examples/dotnet/RemoteQueryCs/README.md b/examples/dotnet/RemoteQueryCs/README.md
index 89b2b94..9876dd1 100644
--- a/examples/dotnet/RemoteQueryCs/README.md
+++ b/examples/dotnet/RemoteQueryCs/README.md
@@ -1,4 +1,4 @@
-# RemoteQuery Example
+# RemoteQuery Example
This is a simple example showing how to execute a query on a remote region.
## Prerequisites
diff --git a/examples/dotnet/RemoteQueryCs/startserver.ps1 b/examples/dotnet/RemoteQueryCs/startserver.ps1
index 0738fd6..4c5c849 100644
--- a/examples/dotnet/RemoteQueryCs/startserver.ps1
+++ b/examples/dotnet/RemoteQueryCs/startserver.ps1
@@ -1,4 +1,4 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
+# 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
diff --git a/examples/dotnet/RemoteQueryCs/stopserver.ps1 b/examples/dotnet/RemoteQueryCs/stopserver.ps1
index fed864b..5ac5117 100644
--- a/examples/dotnet/RemoteQueryCs/stopserver.ps1
+++ b/examples/dotnet/RemoteQueryCs/stopserver.ps1
@@ -1,4 +1,4 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
+# 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
diff --git a/contrib/pdxautoserializer/src/CMakeLists.txt b/examples/utilities/CMakeLists.txt
similarity index 60%
copy from contrib/pdxautoserializer/src/CMakeLists.txt
copy to examples/utilities/CMakeLists.txt
index 895cd74..0fe49ba 100644
--- a/contrib/pdxautoserializer/src/CMakeLists.txt
+++ b/examples/utilities/CMakeLists.txt
@@ -4,24 +4,26 @@
# 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.
-cmake_minimum_required(VERSION 3.4)
-project(pdxautoserializer)
-file(GLOB_RECURSE SOURCES "*.cpp")
+cmake_minimum_required(VERSION 3.10)
-add_executable(pdxautoserializer ${SOURCES})
-target_link_libraries(pdxautoserializer
- PRIVATE
- antlr
-)
+project(examples LANGUAGES NONE)
-install(TARGETS pdxautoserializer DESTINATION bin)
-include_directories(${CMAKE_SOURCE_DIR}/../../src/cppcache/include)
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt.in ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt COPYONLY)
+
+install(FILES
+ ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/ExampleMultiGetFunction.java
+ ${CMAKE_CURRENT_SOURCE_DIR}/SimpleAuthenticator.java
+ ${CMAKE_CURRENT_SOURCE_DIR}/UserPasswordAuthInit.java
+ ${CMAKE_CURRENT_SOURCE_DIR}/UsernamePrincipal.java
+ DESTINATION examples/utilities)
+
diff --git a/packer/windows/install-windows-8.1-2012-r2-wmf-5.ps1 b/examples/utilities/CMakeLists.txt.in
similarity index 72%
copy from packer/windows/install-windows-8.1-2012-r2-wmf-5.ps1
copy to examples/utilities/CMakeLists.txt.in
index 8cce796..3859d0d 100644
--- a/packer/windows/install-windows-8.1-2012-r2-wmf-5.ps1
+++ b/examples/utilities/CMakeLists.txt.in
@@ -12,9 +12,18 @@
# 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.
-$ErrorActionPreference = "Stop"
+cmake_minimum_required (VERSION 3.4)
+project (example)
-Import-Module Packer
+set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../cmake)
-Install-Package https://download.microsoft.com/download/2/C/6/2C6E1B4A-EBE5-48A6-B225-2D2058A9CEFB/Win8.1AndW2K12R2-KB3134758-x64.msu `
- -MsuPackage .\WindowsBlue-KB3134758-x64.cab
\ No newline at end of file
+find_package(Geode REQUIRED)
+find_package(Java REQUIRED)
+
+include(UseJava)
+
+file(GLOB_RECURSE SOURCES "*.java")
+
+add_jar(example ${SOURCES}
+ INCLUDE_JARS ${Geode_CLASSPATH}
+)
diff --git a/examples/utilities/ExampleMultiGetFunction.java b/examples/utilities/ExampleMultiGetFunction.java
new file mode 100755
index 0000000..dcd689b
--- /dev/null
+++ b/examples/utilities/ExampleMultiGetFunction.java
@@ -0,0 +1,67 @@
+/*
+ * 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.
+ */
+package example;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.Vector;
+
+import org.apache.geode.cache.Cache;
+import org.apache.geode.cache.CacheClosedException;
+import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.cache.Declarable;
+import org.apache.geode.cache.execute.FunctionAdapter;
+import org.apache.geode.cache.execute.FunctionContext;
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.execute.ResultSender;
+
+public class ExampleMultiGetFunction extends FunctionAdapter implements Declarable{
+
+ public void execute(FunctionContext context) {
+ ArrayList vals = new ArrayList();
+ if(context.getArguments() instanceof Vector ) {
+ Cache c = null;
+ try {
+ c = CacheFactory.getAnyInstance();
+ }
+ catch (CacheClosedException ex) {
+ vals.add("NoCacheResult");
+ context.getResultSender().lastResult(vals);
+ }
+
+ Region region = c.getRegion("partition_region");
+ Vector keys = (Vector)context.getArguments();
+ System.out.println("Context.getArguments " + keys);
+ Iterator itr = keys.iterator();
+ while (itr.hasNext()) {
+ Object k = itr.next();
+ vals.add(region.get(k));
+ System.out.println("vals " + vals);
+ }
+ }
+ context.getResultSender().lastResult(vals);
+ }
+
+ public String getId() {
+ return "ExampleMultiGetFunction";
+ }
+
+ public void init(Properties arg0) {
+ }
+
+}
diff --git a/examples/utilities/SimpleAuthenticator.java b/examples/utilities/SimpleAuthenticator.java
new file mode 100644
index 0000000..68f0909
--- /dev/null
+++ b/examples/utilities/SimpleAuthenticator.java
@@ -0,0 +1,84 @@
+/*
+ * 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.
+ */
+package javaobject;
+
+import java.security.Principal;
+import java.util.Properties;
+
+import org.apache.geode.LogWriter;
+import org.apache.geode.distributed.DistributedMember;
+import org.apache.geode.security.AuthenticationFailedException;
+import org.apache.geode.security.Authenticator;
+import javaobject.UserPasswordAuthInit;
+import javaobject.UsernamePrincipal;
+
+/**
+ * A dummy implementation of the {@link Authenticator} interface that expects a
+ * user name and password allowing authentication depending on the format of the
+ * user name.
+ *
+ */
+public class SimpleAuthenticator implements Authenticator {
+
+ public static Authenticator create() {
+ return new SimpleAuthenticator();
+ }
+
+ public SimpleAuthenticator() {
+ }
+
+ public void init(Properties systemProps, LogWriter systemLogger,
+ LogWriter securityLogger) throws AuthenticationFailedException {
+ }
+
+ public static boolean testValidName(String userName) {
+
+ return (userName.startsWith("user") || userName.startsWith("reader")
+ || userName.startsWith("writer") || userName.equals("admin")
+ || userName.equals("root") || userName.equals("administrator"));
+ }
+
+ public Principal authenticate(Properties props, DistributedMember member)
+ throws AuthenticationFailedException {
+
+ String userName = props.getProperty(UserPasswordAuthInit.USER_NAME);
+ if (userName == null) {
+ throw new AuthenticationFailedException(
+ "SimpleAuthenticator: user name property ["
+ + UserPasswordAuthInit.USER_NAME + "] not provided");
+ }
+ String password = props.getProperty(UserPasswordAuthInit.PASSWORD);
+ if (password == null) {
+ throw new AuthenticationFailedException(
+ "SimpleAuthenticator: password property ["
+ + UserPasswordAuthInit.PASSWORD + "] not provided");
+ }
+
+ if (userName.equals(password) && testValidName(userName)) {
+ return new UsernamePrincipal(userName);
+ }
+ else {
+ throw new AuthenticationFailedException(
+ "SimpleAuthenticator: Invalid user name [" + userName
+ + "], password supplied.");
+ }
+ }
+
+ public void close() {
+ }
+
+}
diff --git a/examples/utilities/UserPasswordAuthInit.java b/examples/utilities/UserPasswordAuthInit.java
new file mode 100644
index 0000000..d40ba67
--- /dev/null
+++ b/examples/utilities/UserPasswordAuthInit.java
@@ -0,0 +1,81 @@
+/*
+ * 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.
+ */
+package javaobject;
+
+import java.util.Properties;
+
+import org.apache.geode.LogWriter;
+import org.apache.geode.distributed.DistributedMember;
+import org.apache.geode.security.AuthInitialize;
+import org.apache.geode.security.AuthenticationFailedException;
+
+/**
+ * An {@link AuthInitialize} implementation that obtains the user name and
+ * password as the credentials from the given set of properties.
+ *
+ * To use this class the <c>security-client-auth-init</c> property should be
+ * set to the fully qualified name the static <code>create</code> function
+ * viz. <code>templates.security.UserPasswordAuthInit.create</code>
+ *
+ */
+public class UserPasswordAuthInit implements AuthInitialize {
+
+ public static final String USER_NAME = "security-username";
+
+ public static final String PASSWORD = "security-password";
+
+ protected LogWriter securitylog;
+
+ protected LogWriter systemlog;
+
+ public static AuthInitialize create() {
+ return new UserPasswordAuthInit();
+ }
+
+ public void init(LogWriter systemLogger, LogWriter securityLogger)
+ throws AuthenticationFailedException {
+ this.systemlog = systemLogger;
+ this.securitylog = securityLogger;
+ }
+
+ public UserPasswordAuthInit() {
+ }
+
+ public Properties getCredentials(Properties props, DistributedMember server,
+ boolean isPeer) throws AuthenticationFailedException {
+
+ Properties newProps = new Properties();
+ String userName = props.getProperty(USER_NAME);
+ if (userName == null) {
+ throw new AuthenticationFailedException(
+ "UserPasswordAuthInit: user name property [" + USER_NAME
+ + "] not set.");
+ }
+ newProps.setProperty(USER_NAME, userName);
+ String passwd = props.getProperty(PASSWORD);
+ // If password is not provided then use empty string as the password.
+ if (passwd == null) {
+ passwd = "";
+ }
+ newProps.setProperty(PASSWORD, passwd);
+ return newProps;
+ }
+
+ public void close() {
+ }
+
+}
diff --git a/contrib/pdxautoserializer/src/ASCPPInclude.hpp b/examples/utilities/UsernamePrincipal.java
similarity index 61%
copy from contrib/pdxautoserializer/src/ASCPPInclude.hpp
copy to examples/utilities/UsernamePrincipal.java
index 3127313..faeb770 100644
--- a/contrib/pdxautoserializer/src/ASCPPInclude.hpp
+++ b/examples/utilities/UsernamePrincipal.java
@@ -1,8 +1,3 @@
-#pragma once
-
-#ifndef GEODE_PDXAUTOSERIALIZER_ASCPPINCLUDE_H_
-#define GEODE_PDXAUTOSERIALIZER_ASCPPINCLUDE_H_
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -10,29 +5,39 @@
* 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.
*/
+package javaobject;
-#define GFINCLUDE
-#define GFEXCLUDE
-#define GFARRAYSIZE(x)
+import java.io.Serializable;
+import java.security.Principal;
-// Helper defines to ignore some GNU g++ constructs
-/*
- #define __const const
- #define __volatile__ volatile
- #define __asm__ asm
- #define __restrict
- #define __attribute__(x)
- #define __extension__
- #define __builtin_va_list int
+/**
+ * An implementation of {@link Principal} class for a simple user name.
+ *
*/
+public class UsernamePrincipal implements Principal, Serializable {
-#endif // GEODE_PDXAUTOSERIALIZER_ASCPPINCLUDE_H_
+ private final String userName;
+
+ public UsernamePrincipal(String userName) {
+ this.userName = userName;
+ }
+
+ public String getName() {
+ return this.userName;
+ }
+
+ @Override
+ public String toString() {
+ return this.userName;
+ }
+
+}
diff --git a/examples/utilities/startserver.sh b/examples/utilities/startserver.sh
new file mode 100755
index 0000000..f26f4b3
--- /dev/null
+++ b/examples/utilities/startserver.sh
@@ -0,0 +1,34 @@
+#!/usr/bin/env bash
+
+# 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.
+
+GFSH_PATH=""
+which gfsh 2> /dev/null
+
+if [ $? -eq 0 ]; then
+ GFSH_PATH="gfsh"
+else
+ if [ "$GEODE_HOME" == "" ]; then
+ echo "Could not find gfsh. Please set the GEODE_HOME path."
+ echo "e.g. export GEODE_HOME=<path to Geode>"
+ else
+ GFSH_PATH=$GEODE_HOME/bin/gfsh
+ fi
+fi
+
+$GFSH_PATH -e "start locator --name=locator" -e "deploy --jar=../../build/utilities/example.jar" -e "start server --name=the-server --server-port=50505" -e "create region --name=partition_region --type=PARTITION"
+
+
diff --git a/packer/build-ubuntu.json b/packer/build-ubuntu.json
new file mode 100644
index 0000000..35c48a1
--- /dev/null
+++ b/packer/build-ubuntu.json
@@ -0,0 +1,88 @@
+{
+ "variables":{
+ "region":"us-west-2",
+ "source_ami":"ami-08718fb38f5f50f34",
+ "source_image_name":"X.vmx",
+ "image_name":"build-ubuntu"
+ },
+ "builders":[
+ {
+ "type":"amazon-ebs",
+ "instance_type":"t2.micro",
+ "ami_name":"native-{{user `version`}}-{{user `image_name`}} {{timestamp}}",
+ "access_key":"{{user `aws_access_key`}}",
+ "secret_key":"{{user `aws_secret_key`}}",
+ "region":"{{user `region`}}",
+ "source_ami":"{{user `source_ami`}}",
+ "subnet_id":"{{user `subnet_id`}}",
+ "vpc_id":"{{user `vpc_id`}}",
+ "tags":{
+ "team":"native",
+ "version":"{{user `version`}}",
+ "source_ami":"{{user `source_ami`}}"
+ },
+ "ssh_username":"ubuntu",
+ "ssh_pty":true
+ }
+ ],
+ "provisioners":[
+ {
+ "type":"shell",
+ "script":"ubuntu/wait-for-cloud-init.sh"
+ },
+ {
+ "type":"shell",
+ "execute_command":"{{.Vars}} sudo -E -S bash '{{.Path}}'",
+ "scripts":[
+ "ubuntu/update.sh"
+ ]
+ },
+ {
+ "type":"file",
+ "source":"ubuntu/files",
+ "destination":"/tmp"
+ },
+ {
+ "type":"shell",
+ "execute_command":"{{.Vars}} sudo -E -S bash '{{.Path}}'",
+ "inline":[
+ "cp -rv /tmp/files/* /",
+ "rm -rf /tmp/files",
+ "chmod +x /etc/init-user.sh",
+ "chmod +x /usr/local/bin/update-hosts.sh",
+ "systemctl daemon-reload",
+ "systemctl enable update-hosts.service",
+ "systemctl start update-hosts.service"
+ ]
+ },
+ {
+ "type":"shell",
+ "execute_command":"{{.Vars}} sudo -E -S bash '{{.Path}}'",
+ "scripts":[
+ "ubuntu/add-user-build.sh",
+ "ubuntu/install-packages.sh",
+ "ubuntu/install-coverage-tools.sh",
+ "ubuntu/install-cmake.sh"
+ ]
+ },
+ {
+ "type":"file",
+ "source":"{{user `gemfire_archive`}}",
+ "destination":"gemfire.tar.gz"
+ },
+ {
+ "type":"shell",
+ "execute_command":"{{.Vars}} sudo -E -S bash '{{.Path}}'",
+ "scripts":[
+ "ubuntu/install-gemfire.sh"
+ ]
+ },
+ {
+ "type":"shell",
+ "execute_command":"{{.Vars}} sudo -E -S bash '{{.Path}}'",
+ "scripts":[
+ "ubuntu/cleanup.sh"
+ ]
+ }
+ ]
+}
diff --git a/packer/build-windows.json b/packer/build-windows.json
index cde6f43..20020b2 100644
--- a/packer/build-windows.json
+++ b/packer/build-windows.json
@@ -30,59 +30,53 @@
{
"device_name":"/dev/sda1",
"delete_on_termination":true,
- "volume_size":60
+ "volume_size":100
}
]
}
],
- "provisioners":[
+ "provisioners": [
{
- "pause_before":"30s",
- "type":"powershell",
- "inline":[
- "Install-WindowsFeature -name NET-Framework-Core"
- ]
- },
- {
- "type":"powershell",
- "scripts":[
+ "pause_before":"60s",
+ "type": "powershell",
+ "scripts": [
"windows/install-dependencies.ps1"
]
},
{
- "type":"file",
- "source":"{{user `gemfire_archive`}}",
- "destination":"gemfire.tar.gz"
+ "type": "file",
+ "source": "{{user `gemfire_archive`}}",
+ "destination": "gemfire.tar.gz"
},
{
- "type":"powershell",
- "scripts":[
+ "type": "powershell",
+ "scripts": [
"windows/install-gemfire.ps1"
]
},
{
- "type":"powershell",
- "scripts":[
+ "type": "powershell",
+ "scripts": [
"windows/add-user-build.ps1"
]
},
{
- "type":"file",
- "source":"windows/init-user-build.ps1",
- "destination":"C:/Users/build/init-user-build.ps1"
+ "type": "file",
+ "source": "windows/init-user-build.ps1",
+ "destination": "C:/Users/build/init-user-build.ps1"
},
{
- "type":"powershell",
- "scripts":[
+ "type": "powershell",
+ "scripts": [
"windows/cleanup.ps1"
]
},
{
- "type":"powershell",
- "scripts":[
- "windows/setup-ec2config.ps1"
+ "type": "powershell",
+ "scripts": [
+ "windows/setup-ec2launch.ps1"
],
- "only":[
+ "only": [
"amazon-ebs"
]
}
diff --git a/packer/dev-windows-2012-r2.json b/packer/dev-windows-2012-r2.json
index 284c7d1..bd3f539 100644
--- a/packer/dev-windows-2012-r2.json
+++ b/packer/dev-windows-2012-r2.json
@@ -3,7 +3,7 @@
"region":"us-west-2",
"source_ami":"",
"source_image_name":"X.vmx",
- "image_name":"dev-windows-2012-r2"
+ "image_name":"dev-windows-2016"
},
"builders":[
{
diff --git a/packer/rhel/install-cmake.sh b/packer/rhel/install-cmake.sh
index ab3f79e..552faae 100644
--- a/packer/rhel/install-cmake.sh
+++ b/packer/rhel/install-cmake.sh
@@ -19,7 +19,7 @@
tmp=`mktemp`
-curl -o ${tmp} -v -L https://cmake.org/files/v3.10/cmake-3.10.3-Linux-x86_64.sh
+curl -o ${tmp} -v -L https://cmake.org/files/v3.12/cmake-3.12.4-Linux-x86_64.sh
bash ${tmp} --skip-license --prefix=/usr/local
diff --git a/packer/solaris/changepasswd b/packer/solaris/changepasswd
index 2cfe960..caae9c0 100755
--- a/packer/solaris/changepasswd
+++ b/packer/solaris/changepasswd
@@ -1,4 +1,18 @@
#!/usr/bin/env expect -f
+# 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.
set force_conservative 0 ;# set to 1 to force conservative mode even if
;# script wasn't run conservatively originally
diff --git a/packer/test-windows-2012-r2.json b/packer/test-windows-2012-r2.json
index 488d696..bfd284b 100644
--- a/packer/test-windows-2012-r2.json
+++ b/packer/test-windows-2012-r2.json
@@ -3,7 +3,7 @@
"region":"us-west-2",
"source_ami":"",
"source_image_name":"X.vmx",
- "image_name":"test-windows-2012-r2"
+ "image_name":"test-windows-2016"
},
"builders":[
{
diff --git a/packer/test-windows-2012.json b/packer/test-windows-2012.json
index 0763805..bfd284b 100644
--- a/packer/test-windows-2012.json
+++ b/packer/test-windows-2012.json
@@ -3,7 +3,7 @@
"region":"us-west-2",
"source_ami":"",
"source_image_name":"X.vmx",
- "image_name":"test-windows-2012"
+ "image_name":"test-windows-2016"
},
"builders":[
{
diff --git a/packer/ubuntu-16.04-base.json b/packer/ubuntu-16.04-base.json
new file mode 100644
index 0000000..abdb064
--- /dev/null
+++ b/packer/ubuntu-16.04-base.json
@@ -0,0 +1,48 @@
+{
+ "variables":{
+ "region":"us-west-2",
+ "source_ami":"ami-0afae182eed9d2b46",
+ "source_image_name":"X.vmx",
+ "image_name":"ubuntu-16.04-base"
+ },
+ "builders":[
+ {
+ "type":"amazon-ebs",
+ "instance_type":"t2.micro",
+ "ami_name":"native-{{user `version`}}-{{user `image_name`}} {{timestamp}}",
+ "access_key":"{{user `aws_access_key`}}",
+ "secret_key":"{{user `aws_secret_key`}}",
+ "region":"{{user `region`}}",
+ "source_ami":"{{user `source_ami`}}",
+ "subnet_id":"{{user `subnet_id`}}",
+ "vpc_id":"{{user `vpc_id`}}",
+ "tags":{
+ "team":"native",
+ "version":"{{user `version`}}",
+ "source_ami":"{{user `source_ami`}}"
+ },
+ "ssh_username":"ubuntu",
+ "ssh_pty":true
+ }
+ ],
+ "provisioners":[
+ {
+ "type":"shell",
+ "script":"ubuntu/wait-for-cloud-init.sh"
+ },
+ {
+ "type":"shell",
+ "execute_command":"{{.Vars}} sudo -E -S bash '{{.Path}}'",
+ "scripts":[
+ "ubuntu/update.sh"
+ ]
+ },
+ {
+ "type":"shell",
+ "execute_command":"{{.Vars}} sudo -E -S bash '{{.Path}}'",
+ "scripts":[
+ "ubuntu/cleanup.sh"
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/contrib/pdxautoserializer/CMakeLists.txt b/packer/ubuntu/add-user-build.sh
old mode 100644
new mode 100755
similarity index 82%
copy from contrib/pdxautoserializer/CMakeLists.txt
copy to packer/ubuntu/add-user-build.sh
index b817deb..e3ddd21
--- a/contrib/pdxautoserializer/CMakeLists.txt
+++ b/packer/ubuntu/add-user-build.sh
@@ -1,3 +1,5 @@
+#!/usr/bin/env bash
+
# 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.
@@ -12,8 +14,9 @@
# 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.
-cmake_minimum_required(VERSION 3.4)
-project(geode-native-tools)
-add_subdirectory(dependencies)
-add_subdirectory(src)
+#set -x -e -o pipefail
+
+useradd -m build
+
+(crontab -l -u build ; echo "@reboot /etc/init-user.sh") | sort - | uniq - | crontab -u build -
diff --git a/contrib/pdxautoserializer/CMakeLists.txt b/packer/ubuntu/cleanup.sh
similarity index 86%
rename from contrib/pdxautoserializer/CMakeLists.txt
rename to packer/ubuntu/cleanup.sh
index b817deb..1398249 100644
--- a/contrib/pdxautoserializer/CMakeLists.txt
+++ b/packer/ubuntu/cleanup.sh
@@ -1,3 +1,5 @@
+#!/usr/bin/env bash
+
# 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.
@@ -12,8 +14,8 @@
# 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.
-cmake_minimum_required(VERSION 3.4)
-project(geode-native-tools)
-add_subdirectory(dependencies)
-add_subdirectory(src)
+set -x -e -o pipefail
+
+apt-get autoclean
+
diff --git a/packer/ubuntu/files/etc/init-user.sh b/packer/ubuntu/files/etc/init-user.sh
new file mode 100644
index 0000000..2ceff71
--- /dev/null
+++ b/packer/ubuntu/files/etc/init-user.sh
@@ -0,0 +1,51 @@
+#!/usr/bin/env bash
+
+# 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.
+
+
+ATTEMPTS=5
+FAILED=0
+# Fetch public key using HTTP
+while [ ! -f ~/.ssh/authorized_keys ]; do
+ tmp_keys=`mktemp -p . -t authorized_keys.XXXXX` || exit $?
+ curl -f http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key > $tmp_keys 2>/dev/null
+ if [ $? -eq 0 ]; then
+ grep -f $tmp_keys ~/.ssh/authorized_keys 2>/dev/null
+ if [ $? -eq 0 ]; then
+ echo "AWS public key was already in authorized_keys, not adding it again"
+ else
+ if [ ! -d ~/.ssh ]; then
+ mkdir ~/.ssh
+ chmod 700 ~/.ssh
+ restorecon ~/.ssh
+ fi
+ cat $tmp_keys >> ~/.ssh/authorized_keys
+ chmod 0600 ~/.ssh/authorized_keys
+ restorecon ~/.ssh/authorized_keys
+ echo "Successfully retrieved AWS public key from instance metadata"
+ fi
+ else
+ FAILED=$(($FAILED + 1))
+ if [ $FAILED -ge $ATTEMPTS ]; then
+ echo "Failed to retrieve AWS public key after $FAILED attempts, quitting"
+ rm -f
+ break
+ fi
+ echo "Could not retrieve AWS public key (attempt #$FAILED/$ATTEMPTS), retrying in 5 seconds..."
+ sleep 5
+ fi
+ rm -f $tmp_keys
+done
diff --git a/packer/windows/install-windows-8.1-2012-r2-wmf-5.ps1 b/packer/ubuntu/files/etc/systemd/system/update-hosts.service
similarity index 75%
rename from packer/windows/install-windows-8.1-2012-r2-wmf-5.ps1
rename to packer/ubuntu/files/etc/systemd/system/update-hosts.service
index 8cce796..cd954ce 100644
--- a/packer/windows/install-windows-8.1-2012-r2-wmf-5.ps1
+++ b/packer/ubuntu/files/etc/systemd/system/update-hosts.service
@@ -12,9 +12,15 @@
# 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.
-$ErrorActionPreference = "Stop"
-Import-Module Packer
+[Unit]
+Description=Ensure an A record exists for local hostname in /etc/hosts
+After=network.target
+After=network-online.target
+Wants=network-online.target
-Install-Package https://download.microsoft.com/download/2/C/6/2C6E1B4A-EBE5-48A6-B225-2D2058A9CEFB/Win8.1AndW2K12R2-KB3134758-x64.msu `
- -MsuPackage .\WindowsBlue-KB3134758-x64.cab
\ No newline at end of file
+[Service]
+ExecStart=/usr/local/bin/update-hosts.sh
+
+[Install]
+WantedBy=multi-user.target
diff --git a/contrib/pdxautoserializer/CMakeLists.txt b/packer/ubuntu/files/usr/local/bin/update-hosts.sh
similarity index 83%
copy from contrib/pdxautoserializer/CMakeLists.txt
copy to packer/ubuntu/files/usr/local/bin/update-hosts.sh
index b817deb..43921de 100644
--- a/contrib/pdxautoserializer/CMakeLists.txt
+++ b/packer/ubuntu/files/usr/local/bin/update-hosts.sh
@@ -1,3 +1,5 @@
+#!/bin/bash
+
# 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.
@@ -12,8 +14,8 @@
# 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.
-cmake_minimum_required(VERSION 3.4)
-project(geode-native-tools)
-add_subdirectory(dependencies)
-add_subdirectory(src)
+# add hostname to /etc/hosts if not set
+if (! getent hosts `hostname` >/dev/null); then
+ echo `hostname -I` `hostname` >> /etc/hosts
+fi
diff --git a/contrib/pdxautoserializer/CMakeLists.txt b/packer/ubuntu/install-cmake.sh
similarity index 78%
copy from contrib/pdxautoserializer/CMakeLists.txt
copy to packer/ubuntu/install-cmake.sh
index b817deb..552faae 100644
--- a/contrib/pdxautoserializer/CMakeLists.txt
+++ b/packer/ubuntu/install-cmake.sh
@@ -1,3 +1,5 @@
+#!/usr/bin/env bash
+
# 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.
@@ -12,8 +14,13 @@
# 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.
-cmake_minimum_required(VERSION 3.4)
-project(geode-native-tools)
-add_subdirectory(dependencies)
-add_subdirectory(src)
+set -x -e -o pipefail
+
+tmp=`mktemp`
+
+curl -o ${tmp} -v -L https://cmake.org/files/v3.12/cmake-3.12.4-Linux-x86_64.sh
+
+bash ${tmp} --skip-license --prefix=/usr/local
+
+rm -f ${tmp}
diff --git a/contrib/pdxautoserializer/CMakeLists.txt b/packer/ubuntu/install-coverage-tools.sh
similarity index 84%
copy from contrib/pdxautoserializer/CMakeLists.txt
copy to packer/ubuntu/install-coverage-tools.sh
index b817deb..8d268af 100644
--- a/contrib/pdxautoserializer/CMakeLists.txt
+++ b/packer/ubuntu/install-coverage-tools.sh
@@ -1,19 +1,24 @@
+#!/usr/bin/env bash
+
# 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.
-cmake_minimum_required(VERSION 3.4)
-project(geode-native-tools)
-add_subdirectory(dependencies)
-add_subdirectory(src)
+set -x -e -o pipefail
+
+# for coveralls.io
+pip install cpp-coveralls
+
+# For codecov.ip
+apt-get -y install lcov
\ No newline at end of file
diff --git a/contrib/pdxautoserializer/CMakeLists.txt b/packer/ubuntu/install-gemfire.sh
similarity index 86%
copy from contrib/pdxautoserializer/CMakeLists.txt
copy to packer/ubuntu/install-gemfire.sh
index b817deb..64382af 100644
--- a/contrib/pdxautoserializer/CMakeLists.txt
+++ b/packer/ubuntu/install-gemfire.sh
@@ -1,3 +1,5 @@
+#!/usr/bin/env bash
+
# 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.
@@ -12,8 +14,9 @@
# 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.
-cmake_minimum_required(VERSION 3.4)
-project(geode-native-tools)
-add_subdirectory(dependencies)
-add_subdirectory(src)
+set -x -e -o pipefail
+
+mkdir /gemfire
+tar -zxf gemfire.tar.gz -C /gemfire
+rm gemfire.tar.gz
diff --git a/contrib/pdxautoserializer/CMakeLists.txt b/packer/ubuntu/install-packages.sh
similarity index 78%
copy from contrib/pdxautoserializer/CMakeLists.txt
copy to packer/ubuntu/install-packages.sh
index b817deb..6466945 100644
--- a/contrib/pdxautoserializer/CMakeLists.txt
+++ b/packer/ubuntu/install-packages.sh
@@ -1,19 +1,22 @@
+#!/usr/bin/env bash
+
# 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.
-cmake_minimum_required(VERSION 3.4)
-project(geode-native-tools)
-add_subdirectory(dependencies)
-add_subdirectory(src)
+set -x -e -o pipefail
+
+apt-get -y install libc++-dev libc++abi-dev wget doxygen openjdk-8-jdk zlib1g-dev graphviz build-essential python python-pip
+
+pip install --upgrade pip
diff --git a/contrib/pdxautoserializer/CMakeLists.txt b/packer/ubuntu/update.sh
similarity index 83%
copy from contrib/pdxautoserializer/CMakeLists.txt
copy to packer/ubuntu/update.sh
index b817deb..13bc1d1 100644
--- a/contrib/pdxautoserializer/CMakeLists.txt
+++ b/packer/ubuntu/update.sh
@@ -1,3 +1,5 @@
+#!/usr/bin/env bash
+
# 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.
@@ -12,8 +14,8 @@
# 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.
-cmake_minimum_required(VERSION 3.4)
-project(geode-native-tools)
-add_subdirectory(dependencies)
-add_subdirectory(src)
+set -x -e -o pipefail
+
+export DEBIAN_FRONTEND=noninteractive
+apt update && apt -yq full-upgrade && apt-get -y autoremove
diff --git a/packer/windows/install-windows-8.1-2012-r2-wmf-5.ps1 b/packer/ubuntu/wait-for-cloud-init.sh
similarity index 73%
copy from packer/windows/install-windows-8.1-2012-r2-wmf-5.ps1
copy to packer/ubuntu/wait-for-cloud-init.sh
index 8cce796..86b394c 100644
--- a/packer/windows/install-windows-8.1-2012-r2-wmf-5.ps1
+++ b/packer/ubuntu/wait-for-cloud-init.sh
@@ -1,3 +1,5 @@
+#!/usr/bin/env bash
+
# 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.
@@ -12,9 +14,13 @@
# 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.
-$ErrorActionPreference = "Stop"
-Import-Module Packer
-Install-Package https://download.microsoft.com/download/2/C/6/2C6E1B4A-EBE5-48A6-B225-2D2058A9CEFB/Win8.1AndW2K12R2-KB3134758-x64.msu `
- -MsuPackage .\WindowsBlue-KB3134758-x64.cab
\ No newline at end of file
+#set -x
+set -e
+set -o pipefail
+
+# leaves tail running but we should be restarting anyway
+{ tail -n +1 -f /var/log/cloud-init.log /var/log/cloud-init-output.log & } | sed \
+ -e '/Cloud-init .* finished/q' \
+ -e '/Failed at merging in cloud config/q1'
diff --git a/packer/windows-2012-r2-base.json b/packer/windows-2016-base.json
similarity index 83%
rename from packer/windows-2012-r2-base.json
rename to packer/windows-2016-base.json
index 50ed0c0..cefb0ad 100644
--- a/packer/windows-2012-r2-base.json
+++ b/packer/windows-2016-base.json
@@ -3,7 +3,7 @@
"region":"us-west-2",
"source_ami":"",
"source_image_name":"X.vmx",
- "image_name":"windows-2012-r2-base"
+ "image_name":"windows-2016-base"
},
"builders":[
{
@@ -36,19 +36,13 @@
{
"type":"powershell",
"scripts":[
- "windows/install-windows-8.1-2012-r2-wmf-5.ps1"
- ]
- },
- {
- "type":"powershell",
- "scripts":[
"windows/install-chocolatey.ps1"
]
},
{
"type":"file",
"source":"windows/init-ssh.ps1",
- "destination":"$Env:ProgramFiles/Amazon/Ec2ConfigService/Scripts/init-ssh.ps1"
+ "destination":"$Env:ProgramData/Amazon/EC2-Windows/Launch/Scripts/init-ssh.ps1"
},
{
"type":"powershell",
@@ -65,7 +59,7 @@
{
"type":"powershell",
"scripts":[
- "windows/setup-ec2config.ps1"
+ "windows/setup-ec2launch.ps1"
],
"only":[
"amazon-ebs"
diff --git a/packer/windows-2012-r2-vs-2015.json b/packer/windows-2016-vs-2017.json
similarity index 66%
rename from packer/windows-2012-r2-vs-2015.json
rename to packer/windows-2016-vs-2017.json
index f795d92..9ebe9c3 100644
--- a/packer/windows-2012-r2-vs-2015.json
+++ b/packer/windows-2016-vs-2017.json
@@ -3,7 +3,7 @@
"region":"us-west-2",
"source_ami":"ami-ac5395cc",
"source_image_name":"X.vmx",
- "image_name":"windows-2012-vs-2015"
+ "image_name":"windows-2016-vs-2017"
},
"builders":[
{
@@ -29,36 +29,37 @@
{
"device_name":"/dev/sda1",
"delete_on_termination":true,
- "volume_size":60
+ "volume_size":100
}
]
}
],
- "provisioners":[
+ "provisioners": [
{
- "pause_before":"30s",
- "type":"file",
- "source":"windows/vs-2015-admin.xml",
- "destination":"vs-2015-admin.xml"
- },
- {
- "type":"powershell",
- "inline":[
- "choco install visualstudio2015community -y --ignore-package-exit-codes --ia \"/AdminFile C:\\Users\\Administrator\\vs-2015-admin.xml\""
+ "pause_before":"60s",
+ "type": "powershell",
+ "scripts": [
+ "windows/install-vs-2017-community.ps1"
]
},
{
- "type":"powershell",
- "scripts":[
+ "type": "powershell",
+ "inline": [
+ "Install-WindowsFeature -name NET-Framework-Core"
+ ]
+ },
+ {
+ "type": "powershell",
+ "scripts": [
"windows/cleanup.ps1"
]
},
{
- "type":"powershell",
- "scripts":[
- "windows/setup-ec2config.ps1"
+ "type": "powershell",
+ "scripts": [
+ "windows/setup-ec2launch.ps1"
],
- "only":[
+ "only": [
"amazon-ebs"
]
}
diff --git a/packer/windows/Packer.psm1 b/packer/windows/Packer.psm1
index 062e23f..6ca5962 100644
--- a/packer/windows/Packer.psm1
+++ b/packer/windows/Packer.psm1
@@ -12,6 +12,7 @@
# 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.
+
Set-PSDebug -Trace 0
function Install-Package {
diff --git a/packer/windows/add-user-build.ps1 b/packer/windows/add-user-build.ps1
index 042d0e6..31606d6 100644
--- a/packer/windows/add-user-build.ps1
+++ b/packer/windows/add-user-build.ps1
@@ -12,6 +12,7 @@
# 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.
+
$user = "build"
$pass = "p1votal!"
diff --git a/packer/windows/cleanup.ps1 b/packer/windows/cleanup.ps1
index 979a36e..c6a9366 100644
--- a/packer/windows/cleanup.ps1
+++ b/packer/windows/cleanup.ps1
@@ -12,25 +12,10 @@
# 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.
+
# Remove admin ssh keys
Remove-Item C:\Users\Administrator\.ssh -Recurse -Force -ErrorAction SilentlyContinue
# Cleanup temp
Get-ChildItem $env:tmp -Recurse | Remove-Item -Recurse -force -ErrorAction SilentlyContinue
Get-ChildItem ([environment]::GetEnvironmentVariable("temp","machine")) -Recurse| Remove-Item -Recurse -Force -ErrorAction SilentlyContinue
-
-# Cleanup Ec2ConfigService
-Remove-Item $Env:ProgramFiles\Amazon\Ec2ConfigService\Scripts\UserScript.ps1 -Force -ErrorAction SilentlyContinue
-Remove-Item $Env:ProgramFiles\Amazon\Ec2ConfigService\Logs -Recurse -Force -ErrorAction SilentlyContinue
-
-# TODO debuggin
-exit 0
-
-# Cleanup Windows SxS
-Dism.exe /online /Cleanup-Image /StartComponentCleanup
-
-# Cleanup Event Log
-Get-EventLog -List | foreach {Clear-EventLog -Log $_.Log}
-
-# Defrag
-defrag.exe C: /h /u /v /x
diff --git a/packer/windows/init-ssh.ps1 b/packer/windows/init-ssh.ps1
index 71fcb8f..bff7ea1 100644
--- a/packer/windows/init-ssh.ps1
+++ b/packer/windows/init-ssh.ps1
@@ -21,18 +21,9 @@
mkdir -p $ssh -ErrorAction SilentlyContinue
- Invoke-WebRequest -Uri 'http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key' -OutFile $authorized_keys
+ Invoke-WebRequest -Uri "http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key" -OutFile $authorized_keys
- # Give sshd permission to read authorized_keys
- Import-Module 'C:\Program Files\OpenSSH-Win64\OpenSSHUtils' -force
+ Import-Module "$Env:ProgramFiles\OpenSSH-Win64\OpenSSHUtils" -force
- $currentUserSid = Get-UserSID -User "NT SERVICE\sshd"
- $account = Get-UserAccount -UserSid $currentUserSid
- $ace = New-Object System.Security.AccessControl.FileSystemAccessRule `
- ($account, "Read", "None", "None", "Allow")
- $acl = Get-Acl $authorized_keys
- $acl.AddAccessRule($ace)
- Enable-Privilege SeRestorePrivilege | out-null
- Set-Acl -Path $authorized_keys -AclObject $acl -Confirm:$false
-
+ Repair-AuthorizedKeyPermission $authorized_keys -Confirm:$false
}
diff --git a/packer/windows/install-chocolatey.ps1 b/packer/windows/install-chocolatey.ps1
index 9fa384d..60bdd85 100644
--- a/packer/windows/install-chocolatey.ps1
+++ b/packer/windows/install-chocolatey.ps1
@@ -12,6 +12,7 @@
# 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.
+
$ErrorActionPreference = "Stop"
write-host "Installing Chocolatey"
diff --git a/packer/windows/install-gemfire.ps1 b/packer/windows/install-gemfire.ps1
index 1a4ed54..d228157 100644
--- a/packer/windows/install-gemfire.ps1
+++ b/packer/windows/install-gemfire.ps1
@@ -12,6 +12,7 @@
# 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.
+
$ErrorActionPreference = "Stop"
Import-Module Packer -Force
diff --git a/packer/windows/install-ssh.ps1 b/packer/windows/install-ssh.ps1
index 8cdfa18..0b4165b 100644
--- a/packer/windows/install-ssh.ps1
+++ b/packer/windows/install-ssh.ps1
@@ -18,6 +18,9 @@
$ErrorActionPreference = "Stop"
write-host "Installing OpenSSH"
-choco install openssh -params '"/SSHServerFeature"' --version 0.0.24.0 -confirm
+choco install openssh -params '/SSHServerFeature' -confirm
-schtasks.exe /Create /TN init-ssh /RU SYSTEM /SC ONSTART /TR "powershell.exe -File 'C:\Program Files\Amazon\Ec2ConfigService\Scripts\init-ssh.ps1'"
+(Get-Content -Path $Env:ProgramData\ssh\sshd_config -Raw) -replace '.*Match Group administrators.*','' -replace '.*administrators_authorized_keys.*','' | Set-Content -Path $Env:ProgramData\ssh\sshd_config
+
+schtasks.exe /Create /TN init-ssh /RU SYSTEM /SC ONSTART /TR "powershell.exe -File '${Env:ProgramData}\Amazon\EC2-Windows\Launch\Scripts\init-ssh.ps1'"
+
diff --git a/packer/windows/install-vs-2017-community.ps1 b/packer/windows/install-vs-2017-community.ps1
new file mode 100644
index 0000000..8c0e196
--- /dev/null
+++ b/packer/windows/install-vs-2017-community.ps1
@@ -0,0 +1,50 @@
+# 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.
+# TODO AdminDeploy.xml
+# vs_community.exe /AdminFile C:\Users\Administrator\AdminDeployment.xml /Log setup.log /Passive
+
+Set-PSDebug -Trace 0
+
+$vs_community_bootstrapper_uri = "https://download.visualstudio.microsoft.com/download/pr/5df30b3f-9db2-4195-bce3-c5518277da5d/18edc9dd7697111f993c5c06f18b51e5/vs_community.exe"
+$vs_community_bootstrapper = "C:\vs_community.exe"
+
+$args = @('--installPath "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community"'
+ '--add microsoft.net.component.4.targetingpack'
+ '--add microsoft.net.component.4.5.1.targetingpack'
+ '--add microsoft.visualstudio.component.debugger.justintime'
+ '--add microsoft.visualstudio.component.web'
+ '--add microsoft.visualstudio.component.vc.coreide'
+ '--add microsoft.visualstudio.component.vc.redist.14.latest'
+ '--add microsoft.visualstudio.component.graphics.win81'
+ '--add microsoft.visualstudio.component.vc.cmake.project'
+ '--add microsoft.visualstudio.component.vc.testadapterforgoogletest'
+ '--add microsoft.component.vc.runtime.ucrtsdk'
+ '--add microsoft.visualstudio.component.windows81sdk'
+ '--add microsoft.visualstudio.component.vc.cli.support'
+ '--add microsoft.visualstudio.component.windows10sdk.17134'
+ '--add microsoft.visualstudio.component.windows10sdk.16299.desktop'
+ '--add microsoft.visualstudio.component.webdeploy'
+ '--add microsoft.component.pythontools'
+ '--add component.cpython2.x64'
+ '--add microsoft.net.component.3.5.developertools'
+ '--add microsoft.visualstudio.component.typescript.3.0'
+ '--quiet'
+ )
+
+Invoke-WebRequest -Uri $vs_community_bootstrapper_uri -OutFile $vs_community_bootstrapper
+
+Start-Process -Filepath $vs_community_bootstrapper -ArgumentList $args -Wait
+
+Exit 0
diff --git a/packer/windows/setup-ec2config.ps1 b/packer/windows/setup-ec2config.ps1
index 4fefd66..04124b1 100644
--- a/packer/windows/setup-ec2config.ps1
+++ b/packer/windows/setup-ec2config.ps1
@@ -12,6 +12,7 @@
# 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.
+
# Enable the system password to be retrieved from the AWS Console after this AMI is built and used to launch code
$ec2config = [xml] (get-content 'C:\Program Files\Amazon\Ec2ConfigService\Settings\config.xml')
($ec2config.ec2configurationsettings.plugins.plugin | where {$_.name -eq "Ec2SetPassword"}).state = "Enabled"
@@ -20,3 +21,13 @@
($ec2config.ec2configurationsettings.plugins.plugin | where {$_.name -eq "Ec2SetComputerName"}).state = "Enabled"
($ec2config.ec2configurationsettings.plugins.plugin | where {$_.name -eq "Ec2EventLog"}).state = "Enabled"
$ec2config.save("C:\Program Files\Amazon\Ec2ConfigService\Settings\config.xml")
+$ec2DiskConfig = [xml] (get-content 'C:\Program Files\Amazon\Ec2ConfigService\Settings\DriveLetterConfig.xml')
+$mappingElement = $ec2DiskConfig.SelectNodes("DriveLetterMapping")[0].Mapping;
+if (!$mappingElement) {
+ $mappingElement = $ec2DiskConfig.SelectNodes("DriveLetterMapping")[0].AppendChild($ec2DiskConfig.CreateElement("Mapping"))
+ $volumeNameElement = $mappingElement.AppendChild($ec2DiskConfig.CreateElement("VolumeName"))
+ $volumeName = $volumeNameElement.AppendChild($ec2DiskConfig.CreateTextNode("Temporary Storage 0"))
+ $driveLetterElement = $mappingElement.AppendChild($ec2DiskConfig.CreateElement("DriveLetter"))
+ $driveLetter = $driveLetterElement.AppendChild($ec2DiskConfig.CreateTextNode("D:"))
+ $ec2DiskConfig.save("C:\Program Files\Amazon\Ec2ConfigService\Settings\DriveLetterConfig.xml")
+}
\ No newline at end of file
diff --git a/packer/windows/setup-ec2launch.ps1 b/packer/windows/setup-ec2launch.ps1
new file mode 100644
index 0000000..d48d1ac
--- /dev/null
+++ b/packer/windows/setup-ec2launch.ps1
@@ -0,0 +1,26 @@
+# 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.
+
+$launchConfig = Get-Content -Path C:\ProgramData\Amazon\EC2-Windows\Launch\Config\LaunchConfig.json | ConvertFrom-Json
+$launchConfig.adminPasswordType = 'Random'
+$launchConfig.adminPassword = ''
+$launchConfig.setComputerName = ${True}
+$launchConfig.extendBootVolumeSize = ${True}
+$launchConfig.handleUserData = ${True}
+
+Set-Content -Value ($launchConfig | ConvertTo-Json) -Path C:\ProgramData\Amazon\EC2-Windows\Launch\Config\LaunchConfig.json
+
+C:\ProgramData\Amazon\EC2-Windows\Launch\Scripts\InitializeInstance.ps1 -Schedule
+C:\ProgramData\Amazon\EC2-Windows\Launch\Scripts\InitializeDisks.ps1 -Schedule
diff --git a/packer/windows/install-windows-8.1-2012-r2-wmf-5.ps1 b/packer/windows/uninstall-doxygen.ps1
similarity index 62%
copy from packer/windows/install-windows-8.1-2012-r2-wmf-5.ps1
copy to packer/windows/uninstall-doxygen.ps1
index 8cce796..5175f1d 100644
--- a/packer/windows/install-windows-8.1-2012-r2-wmf-5.ps1
+++ b/packer/windows/uninstall-doxygen.ps1
@@ -4,17 +4,20 @@
# 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.
-$ErrorActionPreference = "Stop"
-Import-Module Packer
+# Enable the system password to be retrieved from the AWS Console after this AMI is built and used to launch code
-Install-Package https://download.microsoft.com/download/2/C/6/2C6E1B4A-EBE5-48A6-B225-2D2058A9CEFB/Win8.1AndW2K12R2-KB3134758-x64.msu `
- -MsuPackage .\WindowsBlue-KB3134758-x64.cab
\ No newline at end of file
+$package = 'doxygen.install'
+$uninstallRegKey = 'HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\doxygen_is1'
+
+Import-Module C:\ProgramData\chocolatey\helpers\chocolateyInstaller.psm1
+$uninstallPath = (Get-ItemProperty $uninstallRegKey UninstallString).UninstallString
+Uninstall-ChocolateyPackage $package 'exe' '/VERYSILENT' $uninstallPath
diff --git a/sqliteimpl/CMakeLists.txt b/sqliteimpl/CMakeLists.txt
index ea81bf2..976b113 100644
--- a/sqliteimpl/CMakeLists.txt
+++ b/sqliteimpl/CMakeLists.txt
@@ -23,8 +23,12 @@
SqLiteImpl.hpp
)
+if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
+ set_source_files_properties(SqLiteImpl.cpp PROPERTIES COMPILE_FLAGS -Wno-unused-result)
+endif()
+
set_target_properties(SqLiteImpl PROPERTIES
- FOLDER cpp/test/integration
+ FOLDER cpp/test/integration
)
include(GenerateExportHeader)
@@ -32,12 +36,12 @@
target_include_directories(SqLiteImpl
PUBLIC
- $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>)
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>)
target_link_libraries(SqLiteImpl
PUBLIC
apache-geode
- sqlite
+ SQLite::sqlite3
PRIVATE
_WarningsAsError
)
diff --git a/templates/security/CMakeLists.txt b/templates/security/CMakeLists.txt
index df57aa2..b20760e 100644
--- a/templates/security/CMakeLists.txt
+++ b/templates/security/CMakeLists.txt
@@ -25,7 +25,7 @@
)
set_target_properties(securityImpl PROPERTIES
- FOLDER cpp/test/integration
+ FOLDER cpp/test/integration
)
include(GenerateExportHeader)
@@ -33,12 +33,13 @@
target_include_directories(securityImpl
PUBLIC
- $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>)
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
+)
target_link_libraries(securityImpl
PUBLIC
apache-geode
- crypto
+ OpenSSL::Crypto
PRIVATE
_WarningsAsError
)
diff --git a/templates/security/CMakeLists.txt.forInstall b/templates/security/CMakeLists.txt.forInstall
index 91cfd16..9662c22 100644
--- a/templates/security/CMakeLists.txt.forInstall
+++ b/templates/security/CMakeLists.txt.forInstall
@@ -1,12 +1,12 @@
-#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
+# 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
+# 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,
diff --git a/tests/cli/FwkClient/App.config b/tests/cli/FwkClient/App.config
index f2cb128..3de0bb8 100644
--- a/tests/cli/FwkClient/App.config
+++ b/tests/cli/FwkClient/App.config
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8" ?>
+<?xml version="1.0" encoding="utf-8" ?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
diff --git a/tests/cli/PdxClassLibrary/PdxType.cs b/tests/cli/PdxClassLibrary/PdxType.cs
index bdc86de..c55ca76 100644
--- a/tests/cli/PdxClassLibrary/PdxType.cs
+++ b/tests/cli/PdxClassLibrary/PdxType.cs
@@ -18,6 +18,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
+using System.Diagnostics;
using System.Text;
using Apache.Geode.Client;
using Apache.Geode.Client.Internal;
@@ -48,13 +49,13 @@
public override bool Equals(object obj)
{
- Console.WriteLine("in addredd equal");
+ Debug.WriteLine("in addredd equal");
if (obj == null)
return false;
Address other = obj as Address;
if (other == null)
return false;
- Console.WriteLine("in addredd equal2 " + this.ToString() + " : : " + other.ToString());
+ Debug.WriteLine("in addredd equal2 " + this.ToString() + " : : " + other.ToString());
if (_aptNumber == other._aptNumber
&& _street == other._street
&& _city == other._city)
@@ -168,7 +169,7 @@
DateTime n = new DateTime((62135596800000/*epoch*/ + 1310447869154) * 10000, DateTimeKind.Utc);
m_dateTime = n.ToLocalTime();
- Console.WriteLine(m_dateTime.Ticks);
+ Debug.WriteLine(m_dateTime.Ticks);
m_int16Array = new short[] { 0x2332, 0x4545 };
m_uint16Array = new short[] { 0x3243, 0x3232 };
@@ -288,13 +289,13 @@
}
public static byte[] compareByteArray(byte[] a, byte[] a2)
{
- Console.WriteLine("Compare byte array " + a.Length + " ; " + a2.Length);
+ Debug.WriteLine("Compare byte array " + a.Length + " ; " + a2.Length);
if (a.Length == a2.Length)
{
int i = 0;
while (i < a.Length)
{
- Console.WriteLine("Compare byte array " + a[i] + " : " + a2[i]);
+ Debug.WriteLine("Compare byte array " + a[i] + " : " + a2[i]);
if (a[i] != a2[i])
break;
else
@@ -366,7 +367,7 @@
*/
public static DateTime compareData(DateTime b, DateTime b2)
{
- Console.WriteLine("date " + b.Ticks + " : " + b2.Ticks);
+ Debug.WriteLine("date " + b.Ticks + " : " + b2.Ticks);
//TODO:
// return b;
if ((b.Ticks / 10000L) == (b2.Ticks / 10000L))
@@ -869,8 +870,8 @@
{
if (!m_address[i].Equals(addressArray[i]))
{
- Console.WriteLine(m_address[i]);
- Console.WriteLine(addressArray[i]);
+ Debug.WriteLine(m_address[i]);
+ Debug.WriteLine(addressArray[i]);
throw new Exception("Address array not mateched " + i);
}
}
diff --git a/tests/cli/PdxClassLibrary/PdxTypesReflectionTest.cs b/tests/cli/PdxClassLibrary/PdxTypesReflectionTest.cs
index e7c12c3..340c3a8 100755
--- a/tests/cli/PdxClassLibrary/PdxTypesReflectionTest.cs
+++ b/tests/cli/PdxClassLibrary/PdxTypesReflectionTest.cs
@@ -18,6 +18,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
+using System.Diagnostics;
using System.Text;
using Apache.Geode.Client;
using Apache.Geode.Client.Internal;
@@ -45,13 +46,13 @@
public override bool Equals(object obj)
{
- Console.WriteLine("in addreddR equal");
+ Debug.WriteLine("in addreddR equal");
if (obj == null)
return false;
AddressR other = obj as AddressR;
if (other == null)
return false;
- Console.WriteLine("in addreddr equal2 " + this.ToString() + " : : " + other.ToString());
+ Debug.WriteLine("in addreddr equal2 " + this.ToString() + " : : " + other.ToString());
if (_aptNumber == other._aptNumber
&& _street == other._street
&& _city == other._city)
@@ -148,7 +149,7 @@
long ticks = 634460644691540000L;
m_dateTime = new DateTime(ticks);
- Console.WriteLine(m_dateTime.Ticks);
+ Debug.WriteLine(m_dateTime.Ticks);
m_int16Array = new short[] { 0x2332, 0x4545 };
m_uint16Array = new short[] { 0x3243, 0x3232 };
@@ -283,13 +284,13 @@
}
byte[] compareByteArray(byte[] a, byte[] a2)
{
- Console.WriteLine("Compare byte array " + a.Length + " ; " + a2.Length);
+ Debug.WriteLine("Compare byte array " + a.Length + " ; " + a2.Length);
if (a.Length == a2.Length)
{
int i = 0;
while (i < a.Length)
{
- Console.WriteLine("Compare byte array " + a[i] + " : " + a2[i]);
+ Debug.WriteLine("Compare byte array " + a[i] + " : " + a2[i]);
if (a[i] != a2[i])
break;
else
@@ -356,7 +357,7 @@
DateTime compareData(DateTime b, DateTime b2)
{
- Console.WriteLine("date " + b.Ticks + " : " + b2.Ticks);
+ Debug.WriteLine("date " + b.Ticks + " : " + b2.Ticks);
//TODO:
// return b;
if ((b.Ticks / 10000L) == (b2.Ticks / 10000L))
diff --git a/tests/cpp/fwklib/CMakeLists.txt b/tests/cpp/fwklib/CMakeLists.txt
index f57c01e..8aeec6a 100644
--- a/tests/cpp/fwklib/CMakeLists.txt
+++ b/tests/cpp/fwklib/CMakeLists.txt
@@ -17,7 +17,7 @@
project(framework LANGUAGES CXX)
add_library(framework STATIC
- FwkBB.hpp
+ FwkBB.hpp
FwkBBClient.cpp
FwkBBClient.hpp
FwkBBServer.cpp
@@ -26,22 +26,27 @@
FwkExport.hpp
FwkLog.cpp
FwkLog.hpp
- FwkStrCvt.cpp
+ FwkStrCvt.cpp
FwkStrCvt.hpp
GsRandom.cpp
GsRandom.hpp
IpcHandler.cpp
IpcHandler.hpp
- Service.cpp
+ Service.cpp
Service.hpp
- TcpIpc.cpp
+ TcpIpc.cpp
TcpIpc.hpp
- TimeBomb.cpp
+ TimeBomb.cpp
TimeBomb.hpp
- UDPIpc.cpp
+ UDPIpc.cpp
UDPIpc.hpp
)
+set_target_properties(framework PROPERTIES
+ CXX_VISIBILITY_PRESET hidden
+ VISIBILITY_INLINES_HIDDEN ON
+)
+
target_compile_options(framework
PRIVATE
# Add PIC flags to link later with shared library
@@ -53,16 +58,16 @@
# headers for this library are referenced relative to the parent
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
PRIVATE
- $<TARGET_PROPERTY:apache-geode,SOURCE_DIR>/../src
+ $<TARGET_PROPERTY:apache-geode,SOURCE_DIR>/../src
)
target_link_libraries(framework
PUBLIC
apache-geode
PRIVATE
- ACE
- internal
- _WarningsAsError
+ ACE::ACE
+ internal
+ _WarningsAsError
)
add_clangformat(framework)
diff --git a/tests/cpp/fwklib/FwkBBClient.cpp b/tests/cpp/fwklib/FwkBBClient.cpp
index a80134a..644cbdf 100644
--- a/tests/cpp/fwklib/FwkBBClient.cpp
+++ b/tests/cpp/fwklib/FwkBBClient.cpp
@@ -24,10 +24,11 @@
#include "FwkBBClient.hpp"
+#include <ace/OS.h>
+#include <ace/Synch.h>
+
#include "FwkLog.hpp"
#include "FwkStrCvt.hpp"
-#include "ace/OS.h"
-#include "ace/Synch.h"
namespace apache {
namespace geode {
diff --git a/tests/cpp/fwklib/FwkStrCvt.hpp b/tests/cpp/fwklib/FwkStrCvt.hpp
index c0b878f..c7914ce 100644
--- a/tests/cpp/fwklib/FwkStrCvt.hpp
+++ b/tests/cpp/fwklib/FwkStrCvt.hpp
@@ -28,9 +28,9 @@
#include <string>
-#include <geode/internal/geode_globals.hpp>
+#include <ace/OS.h>
-#include "ace/OS.h"
+#include <geode/internal/geode_globals.hpp>
// ----------------------------------------------------------------------------
diff --git a/tests/cpp/fwklib/Service.hpp b/tests/cpp/fwklib/Service.hpp
index 566b12a..fea7d71 100644
--- a/tests/cpp/fwklib/Service.hpp
+++ b/tests/cpp/fwklib/Service.hpp
@@ -25,11 +25,10 @@
#include <string>
#include <ace/Condition_T.h>
+#include <ace/Task.h>
#include <geode/internal/geode_base.hpp>
-#include "ace/Task.h"
-
namespace apache {
namespace geode {
namespace client {
diff --git a/tests/cpp/fwklib/TimeBomb.hpp b/tests/cpp/fwklib/TimeBomb.hpp
index 8b5c1bf..bfb9650 100644
--- a/tests/cpp/fwklib/TimeBomb.hpp
+++ b/tests/cpp/fwklib/TimeBomb.hpp
@@ -23,10 +23,9 @@
#include <fwklib/FwkLog.hpp>
#include <ace/OS.h>
+#include <ace/Task.h>
#include <ace/Time_Value.h>
-#include "ace/Task.h"
-
namespace apache {
namespace geode {
namespace client {
diff --git a/tests/cpp/security/CMakeLists.txt b/tests/cpp/security/CMakeLists.txt
index e82b470..ce1b499 100644
--- a/tests/cpp/security/CMakeLists.txt
+++ b/tests/cpp/security/CMakeLists.txt
@@ -27,7 +27,7 @@
PkcsAuthInit.cpp
PkcsAuthInit.hpp
PkcsCredentialGenerator.hpp
- typedefs.hpp
+ typedefs.hpp
XmlAuthzCredentialGenerator.hpp
)
@@ -36,20 +36,20 @@
target_include_directories(security
PUBLIC
- $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
PRIVATE
- $<TARGET_PROPERTY:apache-geode,SOURCE_DIR>/../src
+ $<TARGET_PROPERTY:apache-geode,SOURCE_DIR>/../src
)
target_link_libraries(security
PUBLIC
framework
testobject
- crypto
- ssl
+ OpenSSL::Crypto
+ OpenSSL::SSL
PRIVATE
- ACE
- _WarningsAsError
+ ACE::ACE
+ _WarningsAsError
)
add_clangformat(security)
diff --git a/tests/cpp/testobject/CMakeLists.txt b/tests/cpp/testobject/CMakeLists.txt
index eddd919..253b9ce 100644
--- a/tests/cpp/testobject/CMakeLists.txt
+++ b/tests/cpp/testobject/CMakeLists.txt
@@ -73,7 +73,8 @@
target_include_directories(testobject
PUBLIC
- $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>)
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
+)
target_compile_definitions(testobject
PRIVATE
@@ -89,12 +90,12 @@
)
target_link_libraries(testobject
- PUBLIC
+ PUBLIC
apache-geode
framework
PRIVATE
- ACE
- _WarningsAsError
+ ACE::ACE
+ _WarningsAsError
)
add_clangformat(testobject)
diff --git a/tests/javaobject/CMakeLists.txt b/tests/javaobject/CMakeLists.txt
index a6f61fd..f65806b 100644
--- a/tests/javaobject/CMakeLists.txt
+++ b/tests/javaobject/CMakeLists.txt
@@ -28,9 +28,3 @@
set(EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR}/javaobject.jar)
-install(DIRECTORY ${COMMON_INCLUDE_DIR} DESTINATION .)
-install(FILES
- ${EXPORT_FILE_NAME}
- DESTINATION examples/
- )
-
diff --git a/xsds/cpp-cache-1.0.xsd b/xsds/cpp-cache-1.0.xsd
index 4a5f3b0..a6c0073 100644
--- a/xsds/cpp-cache-1.0.xsd
+++ b/xsds/cpp-cache-1.0.xsd
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with