mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-02 08:25:55 +00:00
Remove unused or obsolete classes and files
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
22
SConstruct
22
SConstruct
@@ -901,6 +901,15 @@ def get_classic_sources(toolchain):
|
|||||||
'src/soci/src/core',
|
'src/soci/src/core',
|
||||||
'src/sqlite']
|
'src/sqlite']
|
||||||
)
|
)
|
||||||
|
append_sources(result, *list_sources('src/beast/beast/clock', '.cpp'))
|
||||||
|
append_sources(result, *list_sources('src/beast/beast/crypto', '.cpp'))
|
||||||
|
append_sources(result, *list_sources('src/beast/beast/streams', '.cpp'))
|
||||||
|
append_sources(result, *list_sources('src/beast/beast/test', '.cpp'))
|
||||||
|
append_sources(result, *list_sources('src/ripple/beast/container', '.cpp'))
|
||||||
|
append_sources(result, *list_sources('src/ripple/beast/insight', '.cpp'))
|
||||||
|
append_sources(result, *list_sources('src/ripple/beast/net', '.cpp'))
|
||||||
|
append_sources(result, *list_sources('src/ripple/beast/nudb', '.cpp'))
|
||||||
|
append_sources(result, *list_sources('src/ripple/beast/utility', '.cpp'))
|
||||||
append_sources(result, *list_sources('src/ripple/app', '.cpp'))
|
append_sources(result, *list_sources('src/ripple/app', '.cpp'))
|
||||||
append_sources(result, *list_sources('src/ripple/basics', '.cpp'))
|
append_sources(result, *list_sources('src/ripple/basics', '.cpp'))
|
||||||
append_sources(result, *list_sources('src/ripple/crypto', '.cpp'))
|
append_sources(result, *list_sources('src/ripple/crypto', '.cpp'))
|
||||||
@@ -940,6 +949,15 @@ def get_unity_sources(toolchain):
|
|||||||
result = []
|
result = []
|
||||||
append_sources(
|
append_sources(
|
||||||
result,
|
result,
|
||||||
|
'src/beast/beast/unity/beast_clock_unity.cpp',
|
||||||
|
'src/beast/beast/unity/beast_crypto_unity.cpp',
|
||||||
|
'src/beast/beast/unity/beast_streams_unity.cpp',
|
||||||
|
'src/beast/beast/unity/beast_test_unity.cpp',
|
||||||
|
'src/ripple/beast/unity/beast_container_unity.cpp',
|
||||||
|
'src/ripple/beast/unity/beast_insight_unity.cpp',
|
||||||
|
'src/ripple/beast/unity/beast_net_unity.cpp',
|
||||||
|
'src/ripple/beast/unity/beast_nudb_unity.cpp',
|
||||||
|
'src/ripple/beast/unity/beast_utility_unity.cpp',
|
||||||
'src/ripple/unity/app_ledger.cpp',
|
'src/ripple/unity/app_ledger.cpp',
|
||||||
'src/ripple/unity/app_main.cpp',
|
'src/ripple/unity/app_main.cpp',
|
||||||
'src/ripple/unity/app_misc.cpp',
|
'src/ripple/unity/app_misc.cpp',
|
||||||
@@ -1097,7 +1115,7 @@ for tu_style in ['classic', 'unity']:
|
|||||||
cc_flags = {}
|
cc_flags = {}
|
||||||
|
|
||||||
object_builder.add_source_files(
|
object_builder.add_source_files(
|
||||||
'src/beast/beast/unity/hash_unity.cpp',
|
'src/beast/beast/unity/beast_hash_unity.cpp',
|
||||||
'src/ripple/unity/beast.cpp',
|
'src/ripple/unity/beast.cpp',
|
||||||
'src/ripple/unity/lz4.c',
|
'src/ripple/unity/lz4.c',
|
||||||
'src/ripple/unity/protobuf.cpp',
|
'src/ripple/unity/protobuf.cpp',
|
||||||
@@ -1108,7 +1126,7 @@ for tu_style in ['classic', 'unity']:
|
|||||||
)
|
)
|
||||||
|
|
||||||
object_builder.add_source_files(
|
object_builder.add_source_files(
|
||||||
'src/ripple/unity/beastc.c',
|
'src/sqlite/sqlite_unity.c',
|
||||||
CCFLAGS = ([] if toolchain == 'msvc' else ['-Wno-array-bounds']))
|
CCFLAGS = ([] if toolchain == 'msvc' else ['-Wno-array-bounds']))
|
||||||
|
|
||||||
if 'gcc' in toolchain:
|
if 'gcc' in toolchain:
|
||||||
|
|||||||
2
src/beast/.gitignore
vendored
2
src/beast/.gitignore
vendored
@@ -1,4 +1,4 @@
|
|||||||
Docs
|
docs/
|
||||||
._*
|
._*
|
||||||
*.mode1v3
|
*.mode1v3
|
||||||
*.pbxuser
|
*.pbxuser
|
||||||
|
|||||||
@@ -1,302 +0,0 @@
|
|||||||
# Doxyfile 1.8.3.1
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# Project related configuration options
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
DOXYFILE_ENCODING = UTF-8
|
|
||||||
PROJECT_NAME = "Beast"
|
|
||||||
PROJECT_NUMBER =
|
|
||||||
PROJECT_BRIEF =
|
|
||||||
PROJECT_LOGO =
|
|
||||||
OUTPUT_DIRECTORY = Docs
|
|
||||||
CREATE_SUBDIRS = NO
|
|
||||||
OUTPUT_LANGUAGE = English
|
|
||||||
BRIEF_MEMBER_DESC = YES
|
|
||||||
REPEAT_BRIEF = YES
|
|
||||||
ABBREVIATE_BRIEF =
|
|
||||||
ALWAYS_DETAILED_SEC = NO
|
|
||||||
INLINE_INHERITED_MEMB = NO
|
|
||||||
FULL_PATH_NAMES = YES
|
|
||||||
STRIP_FROM_PATH =
|
|
||||||
STRIP_FROM_INC_PATH =
|
|
||||||
SHORT_NAMES = NO
|
|
||||||
JAVADOC_AUTOBRIEF = NO
|
|
||||||
QT_AUTOBRIEF = NO
|
|
||||||
MULTILINE_CPP_IS_BRIEF = NO
|
|
||||||
INHERIT_DOCS = YES
|
|
||||||
SEPARATE_MEMBER_PAGES = NO
|
|
||||||
TAB_SIZE = 4
|
|
||||||
ALIASES =
|
|
||||||
TCL_SUBST =
|
|
||||||
OPTIMIZE_OUTPUT_FOR_C = NO
|
|
||||||
OPTIMIZE_OUTPUT_JAVA = NO
|
|
||||||
OPTIMIZE_FOR_FORTRAN = NO
|
|
||||||
OPTIMIZE_OUTPUT_VHDL = NO
|
|
||||||
EXTENSION_MAPPING =
|
|
||||||
MARKDOWN_SUPPORT = YES
|
|
||||||
AUTOLINK_SUPPORT = YES
|
|
||||||
BUILTIN_STL_SUPPORT = NO
|
|
||||||
CPP_CLI_SUPPORT = NO
|
|
||||||
SIP_SUPPORT = NO
|
|
||||||
IDL_PROPERTY_SUPPORT = YES
|
|
||||||
DISTRIBUTE_GROUP_DOC = NO
|
|
||||||
SUBGROUPING = YES
|
|
||||||
INLINE_GROUPED_CLASSES = NO
|
|
||||||
INLINE_SIMPLE_STRUCTS = NO
|
|
||||||
TYPEDEF_HIDES_STRUCT = NO
|
|
||||||
SYMBOL_CACHE_SIZE = 0
|
|
||||||
LOOKUP_CACHE_SIZE = 0
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# Build related configuration options
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
EXTRACT_ALL = NO
|
|
||||||
EXTRACT_PRIVATE = NO
|
|
||||||
EXTRACT_PACKAGE = NO
|
|
||||||
EXTRACT_STATIC = NO
|
|
||||||
EXTRACT_LOCAL_CLASSES = YES
|
|
||||||
EXTRACT_LOCAL_METHODS = NO
|
|
||||||
EXTRACT_ANON_NSPACES = NO
|
|
||||||
HIDE_UNDOC_MEMBERS = NO
|
|
||||||
HIDE_UNDOC_CLASSES = NO
|
|
||||||
HIDE_FRIEND_COMPOUNDS = NO
|
|
||||||
HIDE_IN_BODY_DOCS = NO
|
|
||||||
INTERNAL_DOCS = NO
|
|
||||||
CASE_SENSE_NAMES = NO
|
|
||||||
HIDE_SCOPE_NAMES = NO
|
|
||||||
SHOW_INCLUDE_FILES = YES
|
|
||||||
FORCE_LOCAL_INCLUDES = NO
|
|
||||||
INLINE_INFO = YES
|
|
||||||
SORT_MEMBER_DOCS = YES
|
|
||||||
SORT_BRIEF_DOCS = NO
|
|
||||||
SORT_MEMBERS_CTORS_1ST = NO
|
|
||||||
SORT_GROUP_NAMES = NO
|
|
||||||
SORT_BY_SCOPE_NAME = NO
|
|
||||||
STRICT_PROTO_MATCHING = NO
|
|
||||||
GENERATE_TODOLIST = YES
|
|
||||||
GENERATE_TESTLIST = YES
|
|
||||||
GENERATE_BUGLIST = YES
|
|
||||||
GENERATE_DEPRECATEDLIST= YES
|
|
||||||
ENABLED_SECTIONS =
|
|
||||||
MAX_INITIALIZER_LINES = 30
|
|
||||||
SHOW_USED_FILES = YES
|
|
||||||
SHOW_FILES = YES
|
|
||||||
SHOW_NAMESPACES = YES
|
|
||||||
FILE_VERSION_FILTER =
|
|
||||||
LAYOUT_FILE =
|
|
||||||
CITE_BIB_FILES =
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# configuration options related to warning and progress messages
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
QUIET = NO
|
|
||||||
WARNINGS = YES
|
|
||||||
WARN_IF_UNDOCUMENTED = YES
|
|
||||||
WARN_IF_DOC_ERROR = YES
|
|
||||||
WARN_NO_PARAMDOC = NO
|
|
||||||
WARN_FORMAT = "$file:$line: $text"
|
|
||||||
WARN_LOGFILE =
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# configuration options related to the input files
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
INPUT = modules
|
|
||||||
INPUT_ENCODING = UTF-8
|
|
||||||
FILE_PATTERNS =
|
|
||||||
RECURSIVE = YES
|
|
||||||
EXCLUDE = modules/beast_core/beast_core.h \
|
|
||||||
modules/beast_core/beast_core.unity.cpp \
|
|
||||||
modules/beast_basics/beast_basics.cpp \
|
|
||||||
modules/beast_basics/native \
|
|
||||||
modules/beast_basics/zip/zlib
|
|
||||||
EXCLUDE_SYMLINKS = NO
|
|
||||||
EXCLUDE_PATTERNS =
|
|
||||||
EXCLUDE_SYMBOLS =
|
|
||||||
EXAMPLE_PATH =
|
|
||||||
EXAMPLE_PATTERNS =
|
|
||||||
EXAMPLE_RECURSIVE = NO
|
|
||||||
IMAGE_PATH =
|
|
||||||
INPUT_FILTER =
|
|
||||||
FILTER_PATTERNS =
|
|
||||||
FILTER_SOURCE_FILES = NO
|
|
||||||
FILTER_SOURCE_PATTERNS =
|
|
||||||
USE_MDFILE_AS_MAINPAGE =
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# configuration options related to source browsing
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
SOURCE_BROWSER = NO
|
|
||||||
INLINE_SOURCES = NO
|
|
||||||
STRIP_CODE_COMMENTS = YES
|
|
||||||
REFERENCED_BY_RELATION = NO
|
|
||||||
REFERENCES_RELATION = NO
|
|
||||||
REFERENCES_LINK_SOURCE = YES
|
|
||||||
USE_HTAGS = NO
|
|
||||||
VERBATIM_HEADERS = YES
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# configuration options related to the alphabetical class index
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
ALPHABETICAL_INDEX = YES
|
|
||||||
COLS_IN_ALPHA_INDEX = 5
|
|
||||||
IGNORE_PREFIX =
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# configuration options related to the HTML output
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
GENERATE_HTML = YES
|
|
||||||
HTML_OUTPUT = .
|
|
||||||
HTML_FILE_EXTENSION = .html
|
|
||||||
HTML_HEADER =
|
|
||||||
HTML_FOOTER =
|
|
||||||
HTML_STYLESHEET =
|
|
||||||
HTML_EXTRA_STYLESHEET =
|
|
||||||
HTML_EXTRA_FILES =
|
|
||||||
HTML_COLORSTYLE_HUE = 220
|
|
||||||
HTML_COLORSTYLE_SAT = 100
|
|
||||||
HTML_COLORSTYLE_GAMMA = 80
|
|
||||||
HTML_TIMESTAMP = YES
|
|
||||||
HTML_DYNAMIC_SECTIONS = NO
|
|
||||||
HTML_INDEX_NUM_ENTRIES = 100
|
|
||||||
GENERATE_DOCSET = NO
|
|
||||||
DOCSET_FEEDNAME = "Doxygen generated docs"
|
|
||||||
DOCSET_BUNDLE_ID = org.doxygen.Project
|
|
||||||
DOCSET_PUBLISHER_ID = org.doxygen.Publisher
|
|
||||||
DOCSET_PUBLISHER_NAME = Publisher
|
|
||||||
GENERATE_HTMLHELP = NO
|
|
||||||
CHM_FILE =
|
|
||||||
HHC_LOCATION =
|
|
||||||
GENERATE_CHI = NO
|
|
||||||
CHM_INDEX_ENCODING =
|
|
||||||
BINARY_TOC = NO
|
|
||||||
TOC_EXPAND = NO
|
|
||||||
GENERATE_QHP = NO
|
|
||||||
QCH_FILE =
|
|
||||||
QHP_NAMESPACE = org.doxygen.Project
|
|
||||||
QHP_VIRTUAL_FOLDER = doc
|
|
||||||
QHP_CUST_FILTER_NAME =
|
|
||||||
QHP_CUST_FILTER_ATTRS =
|
|
||||||
QHP_SECT_FILTER_ATTRS =
|
|
||||||
QHG_LOCATION =
|
|
||||||
GENERATE_ECLIPSEHELP = NO
|
|
||||||
ECLIPSE_DOC_ID = org.doxygen.Project
|
|
||||||
DISABLE_INDEX = NO
|
|
||||||
GENERATE_TREEVIEW = NO
|
|
||||||
ENUM_VALUES_PER_LINE = 4
|
|
||||||
TREEVIEW_WIDTH = 250
|
|
||||||
EXT_LINKS_IN_WINDOW = NO
|
|
||||||
FORMULA_FONTSIZE = 10
|
|
||||||
FORMULA_TRANSPARENT = YES
|
|
||||||
USE_MATHJAX = NO
|
|
||||||
MATHJAX_FORMAT = HTML-CSS
|
|
||||||
MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
|
|
||||||
MATHJAX_EXTENSIONS =
|
|
||||||
SEARCHENGINE = YES
|
|
||||||
SERVER_BASED_SEARCH = NO
|
|
||||||
EXTERNAL_SEARCH = NO
|
|
||||||
SEARCHENGINE_URL =
|
|
||||||
SEARCHDATA_FILE = searchdata.xml
|
|
||||||
EXTERNAL_SEARCH_ID =
|
|
||||||
EXTRA_SEARCH_MAPPINGS =
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# configuration options related to the LaTeX output
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
GENERATE_LATEX = NO
|
|
||||||
LATEX_OUTPUT = latex
|
|
||||||
LATEX_CMD_NAME = latex
|
|
||||||
MAKEINDEX_CMD_NAME = makeindex
|
|
||||||
COMPACT_LATEX = NO
|
|
||||||
PAPER_TYPE = a4
|
|
||||||
EXTRA_PACKAGES =
|
|
||||||
LATEX_HEADER =
|
|
||||||
LATEX_FOOTER =
|
|
||||||
PDF_HYPERLINKS = YES
|
|
||||||
USE_PDFLATEX = YES
|
|
||||||
LATEX_BATCHMODE = NO
|
|
||||||
LATEX_HIDE_INDICES = NO
|
|
||||||
LATEX_SOURCE_CODE = NO
|
|
||||||
LATEX_BIB_STYLE = plain
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# configuration options related to the RTF output
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
GENERATE_RTF = NO
|
|
||||||
RTF_OUTPUT = rtf
|
|
||||||
COMPACT_RTF = NO
|
|
||||||
RTF_HYPERLINKS = NO
|
|
||||||
RTF_STYLESHEET_FILE =
|
|
||||||
RTF_EXTENSIONS_FILE =
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# configuration options related to the man page output
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
GENERATE_MAN = NO
|
|
||||||
MAN_OUTPUT = man
|
|
||||||
MAN_EXTENSION = .3
|
|
||||||
MAN_LINKS = NO
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# configuration options related to the XML output
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
GENERATE_XML = NO
|
|
||||||
XML_OUTPUT = xml
|
|
||||||
XML_SCHEMA =
|
|
||||||
XML_DTD =
|
|
||||||
XML_PROGRAMLISTING = YES
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# configuration options for the AutoGen Definitions output
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
GENERATE_AUTOGEN_DEF = NO
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# configuration options related to the Perl module output
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
GENERATE_PERLMOD = NO
|
|
||||||
PERLMOD_LATEX = NO
|
|
||||||
PERLMOD_PRETTY = YES
|
|
||||||
PERLMOD_MAKEVAR_PREFIX =
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# Configuration options related to the preprocessor
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
ENABLE_PREPROCESSING = YES
|
|
||||||
MACRO_EXPANSION = NO
|
|
||||||
EXPAND_ONLY_PREDEF = NO
|
|
||||||
SEARCH_INCLUDES = YES
|
|
||||||
INCLUDE_PATH =
|
|
||||||
INCLUDE_FILE_PATTERNS =
|
|
||||||
PREDEFINED =
|
|
||||||
EXPAND_AS_DEFINED =
|
|
||||||
SKIP_FUNCTION_MACROS = YES
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# Configuration::additions related to external references
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
TAGFILES =
|
|
||||||
GENERATE_TAGFILE =
|
|
||||||
ALLEXTERNALS = NO
|
|
||||||
EXTERNAL_GROUPS = YES
|
|
||||||
PERL_PATH = /usr/bin/perl
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# Configuration options related to the dot tool
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
CLASS_DIAGRAMS = YES
|
|
||||||
MSCGEN_PATH =
|
|
||||||
HIDE_UNDOC_RELATIONS = YES
|
|
||||||
HAVE_DOT = YES
|
|
||||||
DOT_NUM_THREADS = 0
|
|
||||||
DOT_FONTNAME = Helvetica
|
|
||||||
DOT_FONTSIZE = 10
|
|
||||||
DOT_FONTPATH =
|
|
||||||
CLASS_GRAPH = YES
|
|
||||||
COLLABORATION_GRAPH = YES
|
|
||||||
GROUP_GRAPHS = YES
|
|
||||||
UML_LOOK = NO
|
|
||||||
UML_LIMIT_NUM_FIELDS = 10
|
|
||||||
TEMPLATE_RELATIONS = NO
|
|
||||||
INCLUDE_GRAPH = YES
|
|
||||||
INCLUDED_BY_GRAPH = YES
|
|
||||||
CALL_GRAPH = NO
|
|
||||||
CALLER_GRAPH = NO
|
|
||||||
GRAPHICAL_HIERARCHY = YES
|
|
||||||
DIRECTORY_GRAPH = YES
|
|
||||||
DOT_IMAGE_FORMAT = png
|
|
||||||
INTERACTIVE_SVG = NO
|
|
||||||
DOT_PATH =
|
|
||||||
DOTFILE_DIRS =
|
|
||||||
MSCFILE_DIRS =
|
|
||||||
DOT_GRAPH_MAX_NODES = 50
|
|
||||||
MAX_DOT_GRAPH_DEPTH = 0
|
|
||||||
DOT_TRANSPARENT = NO
|
|
||||||
DOT_MULTI_TARGETS = NO
|
|
||||||
GENERATE_LEGEND = YES
|
|
||||||
DOT_CLEANUP = YES
|
|
||||||
|
|
||||||
@@ -1,139 +0,0 @@
|
|||||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
|
||||||
|
|
||||||
import copy
|
|
||||||
import itertools
|
|
||||||
import ntpath
|
|
||||||
import os
|
|
||||||
import random
|
|
||||||
import sys
|
|
||||||
|
|
||||||
def add_beast_to_path():
|
|
||||||
python_home = os.path.join(os.getcwd(), 'python')
|
|
||||||
if python_home not in sys.path:
|
|
||||||
sys.path.append(python_home)
|
|
||||||
|
|
||||||
add_beast_to_path()
|
|
||||||
|
|
||||||
from beast.env.AddCommonFlags import add_common_flags
|
|
||||||
from beast.env.AddUserEnv import add_user_env
|
|
||||||
from beast.env import Print
|
|
||||||
from beast.platform import GetEnvironment
|
|
||||||
from beast.util import Boost
|
|
||||||
from beast.util import File
|
|
||||||
from beast.util import Tests
|
|
||||||
|
|
||||||
VARIANT_DIRECTORIES = {
|
|
||||||
'beast': ('bin', 'beast'),
|
|
||||||
'modules': ('bin', 'modules'),
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOST_LIBRARIES = '' #boost_system'
|
|
||||||
MAIN_PROGRAM_FILE = 'beast/unit_test/tests/main.cpp'
|
|
||||||
DOTFILE = '~/.scons'
|
|
||||||
|
|
||||||
def main():
|
|
||||||
File.validate_libraries(Boost.LIBPATH, BOOST_LIBRARIES)
|
|
||||||
defaults = GetEnvironment.get_environment(ARGUMENTS)
|
|
||||||
working = copy.deepcopy(defaults)
|
|
||||||
add_common_flags(defaults)
|
|
||||||
|
|
||||||
add_user_env(working, DOTFILE)
|
|
||||||
add_common_flags(working)
|
|
||||||
Print.print_build_config(working, defaults)
|
|
||||||
|
|
||||||
env = Environment(**working)
|
|
||||||
|
|
||||||
for name, path in VARIANT_DIRECTORIES.items():
|
|
||||||
env.VariantDir(os.path.join(*path), name, duplicate=0)
|
|
||||||
env.Replace(PRINT_CMD_LINE_FUNC=Print.print_cmd_line)
|
|
||||||
#Tests.run_tests(env, MAIN_PROGRAM_FILE, '.', '.test.cpp')
|
|
||||||
|
|
||||||
#main()
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
def is_unity(path):
|
|
||||||
b, e = os.path.splitext(path)
|
|
||||||
return os.path.splitext(b)[1] == '.unity' and e in ['.c', '.cpp']
|
|
||||||
|
|
||||||
def files(base):
|
|
||||||
for parent, _, files in os.walk(base):
|
|
||||||
for path in files:
|
|
||||||
path = os.path.join(parent, path)
|
|
||||||
yield os.path.normpath(path)
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
'''
|
|
||||||
/MP /GS /W3 /wd"4018" /wd"4244" /wd"4267" /Gy- /Zc:wchar_t
|
|
||||||
/I"D:\lib\OpenSSL-Win64\include" /I"D:\lib\boost_1_55_0"
|
|
||||||
/I"..\..\src\protobuf\src" /I"..\..\src\protobuf\vsprojects"
|
|
||||||
/I"..\..\src\leveldb" /I"..\..\src\leveldb\include" /I"..\..\build\proto"
|
|
||||||
/Zi /Gm- /Od /Fd"..\..\build\obj\VisualStudio2013\Debug.x64\vc120.pdb"
|
|
||||||
/fp:precise /D "_CRTDBG_MAP_ALLOC" /D "WIN32" /D "_DEBUG" /D "_CONSOLE"
|
|
||||||
/D "_VARIADIC_MAX=10" /D "_WIN32_WINNT=0x0600" /D "_SCL_SECURE_NO_WARNINGS"
|
|
||||||
/D "_CRT_SECURE_NO_WARNINGS" /D "_MBCS" /errorReport:prompt /WX- /Zc:forScope
|
|
||||||
/RTC1 /GR /Gd /MTd /openmp- /Fa"..\..\build\obj\VisualStudio2013\Debug.x64\"
|
|
||||||
/EHa /nologo /Fo"..\..\build\obj\VisualStudio2013\Debug.x64\"
|
|
||||||
/Fp"..\..\build\obj\VisualStudio2013\Debug.x64\rippled.pch"
|
|
||||||
'''
|
|
||||||
|
|
||||||
# Path to this SConstruct file
|
|
||||||
base_dir = Dir('#').srcnode().get_abspath()
|
|
||||||
|
|
||||||
base_env = Environment(
|
|
||||||
tools = ['default', 'VSProject'],
|
|
||||||
CCCOMSTR = '',
|
|
||||||
CMDLINE_QUIET = 1,
|
|
||||||
CPPPATH = [
|
|
||||||
os.environ['BOOST_ROOT'],
|
|
||||||
os.environ['OPENSSL_ROOT']
|
|
||||||
],
|
|
||||||
CPPDEFINES = [
|
|
||||||
'_WIN32_WINNT=0x6000']
|
|
||||||
)
|
|
||||||
|
|
||||||
#base_env.Replace(PRINT_CMD_LINE_FUNC=Print.print_cmd_line)
|
|
||||||
|
|
||||||
env = base_env
|
|
||||||
|
|
||||||
bin_dir = os.path.join(base_dir, 'bin')
|
|
||||||
|
|
||||||
srcs = filter(is_unity, list(files('beast')) + list(files('modules')))
|
|
||||||
for variant in ['Debug']: #, 'Release']:
|
|
||||||
for platform in ['Win32']:
|
|
||||||
#env = base_env.Clone()
|
|
||||||
#env.Replace(PRINT_CMD_LINE_FUNC=Print.print_cmd_line)
|
|
||||||
variant_dir = os.path.join(bin_dir, variant + '.' + platform)
|
|
||||||
env.VariantDir(os.path.join(variant_dir, 'beast'), 'beast', duplicate=0)
|
|
||||||
env.VariantDir(os.path.join(variant_dir, 'modules'), 'modules', duplicate=0)
|
|
||||||
env.Append(CCFLAGS=[
|
|
||||||
'/EHsc',
|
|
||||||
'/bigobj',
|
|
||||||
'/Fd${TARGET}.pdb'
|
|
||||||
])
|
|
||||||
if variant == 'Debug':
|
|
||||||
env.Append(CCFLAGS=[
|
|
||||||
'/MTd',
|
|
||||||
'/Od',
|
|
||||||
'/Zi'
|
|
||||||
])
|
|
||||||
else:
|
|
||||||
env.Append(CCFLAGS=[
|
|
||||||
'/MT',
|
|
||||||
'/Ox'
|
|
||||||
])
|
|
||||||
variant_srcs = [os.path.join(variant_dir, os.path.relpath(f, base_dir)) for f in srcs]
|
|
||||||
|
|
||||||
beast = env.StaticLibrary(
|
|
||||||
target = os.path.join(variant_dir, 'beast.lib'),
|
|
||||||
source = variant_srcs)
|
|
||||||
|
|
||||||
env.VSProject (
|
|
||||||
'out',
|
|
||||||
buildtarget = beast,
|
|
||||||
source = filter(is_unity, list(files('beast')) + list(files('modules'))))
|
|
||||||
|
|
||||||
env.Default ('out.vcxproj')
|
|
||||||
#env.Default (os.path.join(bin_dir,'Debug.Win32', 'beast.lib'))
|
|
||||||
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
|
||||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
|
||||||
|
|
||||||
Portions of this file are from JUCE.
|
|
||||||
Copyright (c) 2013 - Raw Material Software Ltd.
|
|
||||||
Please visit http://www.juce.com
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
#ifndef BEAST_CONFIG_H_INCLUDED
|
|
||||||
#define BEAST_CONFIG_H_INCLUDED
|
|
||||||
|
|
||||||
// VFALCO NOTE this is analogous to <boost/config.hpp>
|
|
||||||
|
|
||||||
#if !defined(BEAST_COMPILER_CONFIG) && !defined(BEAST_NO_COMPILER_CONFIG) && !defined(BEAST_NO_CONFIG)
|
|
||||||
#include <beast/config/SelectCompilerConfig.h>
|
|
||||||
#endif
|
|
||||||
#ifdef BEAST_COMPILER_CONFIG
|
|
||||||
#include BEAST_COMPILER_CONFIG
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(BEAST_STDLIB_CONFIG) && !defined(BEAST_NO_STDLIB_CONFIG) && !defined(BEAST_NO_CONFIG) && defined(__cplusplus)
|
|
||||||
#include <beast/config/SelectStdlibConfig.h>
|
|
||||||
#endif
|
|
||||||
#ifdef BEAST_STDLIB_CONFIG
|
|
||||||
#include BEAST_STDLIB_CONFIG
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(BEAST_PLATFORM_CONFIG) && !defined(BEAST_NO_PLATFORM_CONFIG) && !defined(BEAST_NO_CONFIG)
|
|
||||||
#include <beast/config/SelectCompilerConfig.h>
|
|
||||||
#endif
|
|
||||||
#ifdef BEAST_PLATFORM_CONFIG
|
|
||||||
#include BEAST_PLATFORM_CONFIG
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Legacy
|
|
||||||
#include <beast/Version.h>
|
|
||||||
#include <beast/config/PlatformConfig.h>
|
|
||||||
#include <beast/config/CompilerConfig.h>
|
|
||||||
#include <beast/config/StandardConfig.h>
|
|
||||||
#include <beast/config/ConfigCheck.h>
|
|
||||||
|
|
||||||
// Suffix
|
|
||||||
#include <beast/config/Suffix.h>
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
|
||||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
#ifndef BEAST_SMARTPTR_H_INCLUDED
|
|
||||||
#define BEAST_SMARTPTR_H_INCLUDED
|
|
||||||
|
|
||||||
#include <beast/Config.h>
|
|
||||||
|
|
||||||
#include <beast/smart_ptr/SharedObject.h>
|
|
||||||
#include <beast/smart_ptr/SharedPtr.h>
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
|
||||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
#ifndef BEAST_THREADS_H_INCLUDED
|
|
||||||
#define BEAST_THREADS_H_INCLUDED
|
|
||||||
|
|
||||||
#include <beast/threads/Stoppable.h>
|
|
||||||
#include <beast/threads/Thread.h>
|
|
||||||
#include <beast/threads/WaitableEvent.h>
|
|
||||||
|
|
||||||
#include <beast/threads/semaphore.h>
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
|
||||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
#ifndef BEAST_VERSION_H_INCLUDED
|
|
||||||
#define BEAST_VERSION_H_INCLUDED
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
/** Current BEAST version number. */
|
|
||||||
unsigned int const BEAST_VERSION_MAJOR = 1;
|
|
||||||
unsigned int const BEAST_VERSION_MINOR = 0;
|
|
||||||
unsigned int const BEAST_VERSION_BUILD = 0;
|
|
||||||
|
|
||||||
unsigned int const BEAST_VERSION =
|
|
||||||
(BEAST_VERSION_MAJOR << 16) +
|
|
||||||
(BEAST_VERSION_MINOR << 8) +
|
|
||||||
BEAST_VERSION_BUILD;
|
|
||||||
|
|
||||||
inline
|
|
||||||
std::string
|
|
||||||
getBeastVersion()
|
|
||||||
{
|
|
||||||
return "Beast v" + std::to_string (BEAST_VERSION_MAJOR) +
|
|
||||||
"." + std::to_string (BEAST_VERSION_MINOR) +
|
|
||||||
"." + std::to_string (BEAST_VERSION_BUILD);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
@@ -21,7 +21,6 @@
|
|||||||
#include <BeastConfig.h>
|
#include <BeastConfig.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <beast/asio/impl/IPAddressConversion.cpp>
|
|
||||||
#include <beast/asio/impl/error.cpp>
|
#include <beast/asio/impl/error.cpp>
|
||||||
#include <beast/asio/tests/bind_handler.test.cpp>
|
#include <beast/asio/tests/bind_handler.test.cpp>
|
||||||
#include <beast/asio/tests/streambuf.test.cpp>
|
#include <beast/asio/tests/streambuf.test.cpp>
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
# beast::asio
|
|
||||||
|
|
||||||
Wrappers and utilities to make working with boost::asio easier.
|
|
||||||
|
|
||||||
## Rules for asynchronous objects
|
|
||||||
|
|
||||||
If an object calls asynchronous initiating functions it must either:
|
|
||||||
|
|
||||||
1. Manage its lifetime by being reference counted
|
|
||||||
|
|
||||||
or
|
|
||||||
|
|
||||||
2. Wait for all pending completion handlers to be called before
|
|
||||||
allowing itself to be destroyed.
|
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
#ifndef BEAST_ASIO_STREAMBUF_H_INCLUDED
|
#ifndef BEAST_ASIO_STREAMBUF_H_INCLUDED
|
||||||
#define BEAST_ASIO_STREAMBUF_H_INCLUDED
|
#define BEAST_ASIO_STREAMBUF_H_INCLUDED
|
||||||
|
|
||||||
#include <beast/utility/empty_base_optimization.h>
|
#include <beast/empty_base_optimization.h>
|
||||||
#include <boost/asio/buffer.hpp>
|
#include <boost/asio/buffer.hpp>
|
||||||
#include <boost/intrusive/list.hpp>
|
#include <boost/intrusive/list.hpp>
|
||||||
#include <boost/iterator/transform_iterator.hpp>
|
#include <boost/iterator/transform_iterator.hpp>
|
||||||
|
|||||||
@@ -1,315 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
|
||||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
#ifndef BEAST_ASIO_WAITABLE_EXECUTOR_H_INCLUDED
|
|
||||||
#define BEAST_ASIO_WAITABLE_EXECUTOR_H_INCLUDED
|
|
||||||
|
|
||||||
#include <boost/asio/handler_alloc_hook.hpp>
|
|
||||||
#include <boost/asio/handler_continuation_hook.hpp>
|
|
||||||
#include <boost/asio/handler_invoke_hook.hpp>
|
|
||||||
#include <condition_variable>
|
|
||||||
#include <functional>
|
|
||||||
#include <memory>
|
|
||||||
#include <mutex>
|
|
||||||
#include <type_traits>
|
|
||||||
#include <utility>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
namespace beast {
|
|
||||||
namespace asio {
|
|
||||||
|
|
||||||
namespace detail {
|
|
||||||
|
|
||||||
template <class Owner, class Handler>
|
|
||||||
class waitable_executor_wrapped_handler
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
static_assert (std::is_same <std::decay_t <Owner>, Owner>::value,
|
|
||||||
"Owner cannot be a const or reference type");
|
|
||||||
|
|
||||||
Handler handler_;
|
|
||||||
std::reference_wrapper <Owner> owner_;
|
|
||||||
bool cont_;
|
|
||||||
|
|
||||||
public:
|
|
||||||
waitable_executor_wrapped_handler (Owner& owner,
|
|
||||||
Handler&& handler, bool continuation = false)
|
|
||||||
: handler_ (std::move(handler))
|
|
||||||
, owner_ (owner)
|
|
||||||
{
|
|
||||||
using boost::asio::asio_handler_is_continuation;
|
|
||||||
cont_ = continuation ? true :
|
|
||||||
asio_handler_is_continuation(
|
|
||||||
std::addressof(handler_));
|
|
||||||
owner_.get().increment();
|
|
||||||
}
|
|
||||||
|
|
||||||
waitable_executor_wrapped_handler (Owner& owner,
|
|
||||||
Handler const& handler, bool continuation = false)
|
|
||||||
: handler_ (handler)
|
|
||||||
, owner_ (owner)
|
|
||||||
{
|
|
||||||
using boost::asio::asio_handler_is_continuation;
|
|
||||||
cont_ = continuation ? true :
|
|
||||||
asio_handler_is_continuation(
|
|
||||||
std::addressof(handler_));
|
|
||||||
owner_.get().increment();
|
|
||||||
}
|
|
||||||
|
|
||||||
~waitable_executor_wrapped_handler()
|
|
||||||
{
|
|
||||||
owner_.get().decrement();
|
|
||||||
}
|
|
||||||
|
|
||||||
waitable_executor_wrapped_handler (
|
|
||||||
waitable_executor_wrapped_handler const& other)
|
|
||||||
: handler_ (other.handler_)
|
|
||||||
, owner_ (other.owner_)
|
|
||||||
, cont_ (other.cont_)
|
|
||||||
{
|
|
||||||
owner_.get().increment();
|
|
||||||
}
|
|
||||||
|
|
||||||
waitable_executor_wrapped_handler (
|
|
||||||
waitable_executor_wrapped_handler&& other)
|
|
||||||
: handler_ (std::move(other.handler_))
|
|
||||||
, owner_ (other.owner_)
|
|
||||||
, cont_ (other.cont_)
|
|
||||||
{
|
|
||||||
owner_.get().increment();
|
|
||||||
}
|
|
||||||
|
|
||||||
waitable_executor_wrapped_handler& operator=(
|
|
||||||
waitable_executor_wrapped_handler const&) = delete;
|
|
||||||
|
|
||||||
template <class... Args>
|
|
||||||
void
|
|
||||||
operator()(Args&&... args)
|
|
||||||
{
|
|
||||||
handler_(std::forward<Args>(args)...);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class... Args>
|
|
||||||
void
|
|
||||||
operator()(Args&&... args) const
|
|
||||||
{
|
|
||||||
handler_(std::forward<Args>(args)...);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class Function>
|
|
||||||
friend
|
|
||||||
void
|
|
||||||
asio_handler_invoke (Function& f,
|
|
||||||
waitable_executor_wrapped_handler* h)
|
|
||||||
{
|
|
||||||
using boost::asio::asio_handler_invoke;
|
|
||||||
asio_handler_invoke(f,
|
|
||||||
std::addressof(h->handler_));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class Function>
|
|
||||||
friend
|
|
||||||
void
|
|
||||||
asio_handler_invoke (Function const& f,
|
|
||||||
waitable_executor_wrapped_handler* h)
|
|
||||||
{
|
|
||||||
using boost::asio::asio_handler_invoke;
|
|
||||||
asio_handler_invoke(f,
|
|
||||||
std::addressof(h->handler_));
|
|
||||||
}
|
|
||||||
|
|
||||||
friend
|
|
||||||
void*
|
|
||||||
asio_handler_allocate (std::size_t size,
|
|
||||||
waitable_executor_wrapped_handler* h)
|
|
||||||
{
|
|
||||||
using boost::asio::asio_handler_allocate;
|
|
||||||
return asio_handler_allocate(
|
|
||||||
size, std::addressof(h->handler_));
|
|
||||||
}
|
|
||||||
|
|
||||||
friend
|
|
||||||
void
|
|
||||||
asio_handler_deallocate (void* p, std::size_t size,
|
|
||||||
waitable_executor_wrapped_handler* h)
|
|
||||||
{
|
|
||||||
using boost::asio::asio_handler_deallocate;
|
|
||||||
asio_handler_deallocate(
|
|
||||||
p, size, std::addressof(h->handler_));
|
|
||||||
}
|
|
||||||
|
|
||||||
friend
|
|
||||||
bool
|
|
||||||
asio_handler_is_continuation (
|
|
||||||
waitable_executor_wrapped_handler* h)
|
|
||||||
{
|
|
||||||
return h->cont_;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
} // detail
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/** Executor which provides blocking until all handlers are called. */
|
|
||||||
class waitable_executor
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
template <class, class>
|
|
||||||
friend class detail::waitable_executor_wrapped_handler;
|
|
||||||
|
|
||||||
std::mutex mutex_;
|
|
||||||
std::condition_variable cond_;
|
|
||||||
std::size_t count_ = 0;
|
|
||||||
std::vector<std::function<void(void)>> notify_;
|
|
||||||
|
|
||||||
public:
|
|
||||||
/** Block until all handlers are called. */
|
|
||||||
template <class = void>
|
|
||||||
void
|
|
||||||
wait();
|
|
||||||
|
|
||||||
/** Blocks until all handlers are called or time elapses.
|
|
||||||
@return `true` if all handlers are done or `false` if the time elapses.
|
|
||||||
*/
|
|
||||||
template <class Rep, class Period>
|
|
||||||
bool
|
|
||||||
wait_for (std::chrono::duration<
|
|
||||||
Rep, Period> const& elapsed_time);
|
|
||||||
|
|
||||||
/** Blocks until all handlers are called or a time is reached.
|
|
||||||
@return `true` if all handlers are done or `false` on timeout.
|
|
||||||
*/
|
|
||||||
template <class Clock, class Duration>
|
|
||||||
bool
|
|
||||||
wait_until (std::chrono::time_point<
|
|
||||||
Clock, Duration> const& timeout_time);
|
|
||||||
|
|
||||||
/** Call a function asynchronously after all handlers are called.
|
|
||||||
The function may be called on the callers thread.
|
|
||||||
*/
|
|
||||||
template <class = void>
|
|
||||||
void
|
|
||||||
async_wait(std::function<void(void)> f);
|
|
||||||
|
|
||||||
/** Create a new handler that dispatches the wrapped handler on the Context. */
|
|
||||||
template <class Handler>
|
|
||||||
detail::waitable_executor_wrapped_handler<waitable_executor,
|
|
||||||
std::remove_reference_t<Handler>>
|
|
||||||
wrap (Handler&& handler);
|
|
||||||
|
|
||||||
private:
|
|
||||||
template <class = void>
|
|
||||||
void
|
|
||||||
increment();
|
|
||||||
|
|
||||||
template <class = void>
|
|
||||||
void
|
|
||||||
decrement();
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class>
|
|
||||||
void
|
|
||||||
waitable_executor::wait()
|
|
||||||
{
|
|
||||||
std::unique_lock<std::mutex> lock(mutex_);
|
|
||||||
cond_.wait(lock,
|
|
||||||
[this]() { return count_ == 0; });
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class Rep, class Period>
|
|
||||||
bool
|
|
||||||
waitable_executor::wait_for (std::chrono::duration<
|
|
||||||
Rep, Period> const& elapsed_time)
|
|
||||||
{
|
|
||||||
std::unique_lock<std::mutex> lock(mutex_);
|
|
||||||
return cond_.wait_for(lock, elapsed_time,
|
|
||||||
[this]() { return count_ == 0; }) ==
|
|
||||||
std::cv_status::no_timeout;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class Clock, class Duration>
|
|
||||||
bool
|
|
||||||
waitable_executor::wait_until (std::chrono::time_point<
|
|
||||||
Clock, Duration> const& timeout_time)
|
|
||||||
{
|
|
||||||
std::unique_lock<std::mutex> lock(mutex_);
|
|
||||||
return cond_.wait_until(lock, timeout_time,
|
|
||||||
[this]() { return count_ == 0; }) ==
|
|
||||||
std::cv_status::no_timeout;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class>
|
|
||||||
void
|
|
||||||
waitable_executor::async_wait(std::function<void(void)> f)
|
|
||||||
{
|
|
||||||
bool busy;
|
|
||||||
{
|
|
||||||
std::lock_guard<std::mutex> _(mutex_);
|
|
||||||
busy = count_ > 0;
|
|
||||||
if (busy)
|
|
||||||
notify_.emplace_back(std::move(f));
|
|
||||||
}
|
|
||||||
if (! busy)
|
|
||||||
f();
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class Handler>
|
|
||||||
detail::waitable_executor_wrapped_handler<waitable_executor,
|
|
||||||
std::remove_reference_t<Handler>>
|
|
||||||
waitable_executor::wrap (Handler&& handler)
|
|
||||||
{
|
|
||||||
return detail::waitable_executor_wrapped_handler<
|
|
||||||
waitable_executor, std::remove_reference_t<Handler>>(
|
|
||||||
*this, std::forward<Handler>(handler));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class>
|
|
||||||
void
|
|
||||||
waitable_executor::increment()
|
|
||||||
{
|
|
||||||
std::lock_guard<std::mutex> _(mutex_);
|
|
||||||
++count_;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class>
|
|
||||||
void
|
|
||||||
waitable_executor::decrement()
|
|
||||||
{
|
|
||||||
bool notify;
|
|
||||||
std::vector<std::function<void(void)>> list;
|
|
||||||
{
|
|
||||||
std::lock_guard<std::mutex> _(mutex_);
|
|
||||||
notify = --count_ == 0;
|
|
||||||
if (notify)
|
|
||||||
std::swap(list, notify_);
|
|
||||||
}
|
|
||||||
if (notify)
|
|
||||||
{
|
|
||||||
cond_.notify_all();
|
|
||||||
for(auto& _ : list)
|
|
||||||
_();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // asio
|
|
||||||
} // beast
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
|
||||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
#ifndef BEAST_BOOST_ERRORCODE_H_INCLUDED
|
|
||||||
#define BEAST_BOOST_ERRORCODE_H_INCLUDED
|
|
||||||
|
|
||||||
#include <boost/system/error_code.hpp>
|
|
||||||
|
|
||||||
namespace beast {
|
|
||||||
|
|
||||||
// Lift this into our namespace. For now we will
|
|
||||||
// use boost, and then switch to std::error_code when
|
|
||||||
// it is available on all our supported platforms.
|
|
||||||
//
|
|
||||||
using ErrorCode = boost::system::error_code;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
|
||||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
#if BEAST_INCLUDE_BEASTCONFIG
|
|
||||||
#include <BeastConfig.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <beast/Config.h>
|
|
||||||
|
|
||||||
#include <beast/chrono/impl/RelativeTime.cpp>
|
|
||||||
|
|
||||||
#include <beast/chrono/tests/abstract_clock.test.cpp>
|
|
||||||
#include <beast/chrono/tests/basic_seconds_clock.test.cpp>
|
|
||||||
@@ -1,622 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
|
||||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
// ratio_io
|
|
||||||
//
|
|
||||||
// (C) Copyright Howard Hinnant
|
|
||||||
// Use, modification and distribution are subject to the Boost Software License,
|
|
||||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
|
||||||
// http://www.boost.org/LICENSE_1_0.txt).
|
|
||||||
|
|
||||||
#ifndef BEAST_CHRONO_RATIO_IO_H_INCLUDED
|
|
||||||
#define BEAST_CHRONO_RATIO_IO_H_INCLUDED
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
ratio_io synopsis
|
|
||||||
|
|
||||||
#include <ratio>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
namespace std
|
|
||||||
{
|
|
||||||
|
|
||||||
template <class Ratio, class charT>
|
|
||||||
struct ratio_string
|
|
||||||
{
|
|
||||||
static basic_string<charT> symbol();
|
|
||||||
static basic_string<charT> prefix();
|
|
||||||
};
|
|
||||||
|
|
||||||
} // std
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <ratio>
|
|
||||||
#include <string>
|
|
||||||
#include <sstream>
|
|
||||||
|
|
||||||
//_LIBCPP_BEGIN_NAMESPACE_STD
|
|
||||||
namespace std {
|
|
||||||
|
|
||||||
template <class _Ratio, class _CharT>
|
|
||||||
struct ratio_string
|
|
||||||
{
|
|
||||||
static basic_string<_CharT> symbol() {return prefix();}
|
|
||||||
static basic_string<_CharT> prefix();
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class _Ratio, class _CharT>
|
|
||||||
basic_string<_CharT>
|
|
||||||
ratio_string<_Ratio, _CharT>::prefix()
|
|
||||||
{
|
|
||||||
basic_ostringstream<_CharT> __os;
|
|
||||||
__os << _CharT('[') << _Ratio::num << _CharT('/')
|
|
||||||
<< _Ratio::den << _CharT(']');
|
|
||||||
return __os.str();
|
|
||||||
}
|
|
||||||
|
|
||||||
// atto
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<atto, char>
|
|
||||||
{
|
|
||||||
static string symbol() {return string(1, 'a');}
|
|
||||||
static string prefix() {return string("atto");}
|
|
||||||
};
|
|
||||||
|
|
||||||
#if HAS_UNICODE_SUPPORT
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<atto, char16_t>
|
|
||||||
{
|
|
||||||
static u16string symbol() {return u16string(1, u'a');}
|
|
||||||
static u16string prefix() {return u16string(u"atto");}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<atto, char32_t>
|
|
||||||
{
|
|
||||||
static u32string symbol() {return u32string(1, U'a');}
|
|
||||||
static u32string prefix() {return u32string(U"atto");}
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<atto, wchar_t>
|
|
||||||
{
|
|
||||||
static wstring symbol() {return wstring(1, L'a');}
|
|
||||||
static wstring prefix() {return wstring(L"atto");}
|
|
||||||
};
|
|
||||||
|
|
||||||
// femto
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<femto, char>
|
|
||||||
{
|
|
||||||
static string symbol() {return string(1, 'f');}
|
|
||||||
static string prefix() {return string("femto");}
|
|
||||||
};
|
|
||||||
|
|
||||||
#if HAS_UNICODE_SUPPORT
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<femto, char16_t>
|
|
||||||
{
|
|
||||||
static u16string symbol() {return u16string(1, u'f');}
|
|
||||||
static u16string prefix() {return u16string(u"femto");}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<femto, char32_t>
|
|
||||||
{
|
|
||||||
static u32string symbol() {return u32string(1, U'f');}
|
|
||||||
static u32string prefix() {return u32string(U"femto");}
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<femto, wchar_t>
|
|
||||||
{
|
|
||||||
static wstring symbol() {return wstring(1, L'f');}
|
|
||||||
static wstring prefix() {return wstring(L"femto");}
|
|
||||||
};
|
|
||||||
|
|
||||||
// pico
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<pico, char>
|
|
||||||
{
|
|
||||||
static string symbol() {return string(1, 'p');}
|
|
||||||
static string prefix() {return string("pico");}
|
|
||||||
};
|
|
||||||
|
|
||||||
#if HAS_UNICODE_SUPPORT
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<pico, char16_t>
|
|
||||||
{
|
|
||||||
static u16string symbol() {return u16string(1, u'p');}
|
|
||||||
static u16string prefix() {return u16string(u"pico");}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<pico, char32_t>
|
|
||||||
{
|
|
||||||
static u32string symbol() {return u32string(1, U'p');}
|
|
||||||
static u32string prefix() {return u32string(U"pico");}
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<pico, wchar_t>
|
|
||||||
{
|
|
||||||
static wstring symbol() {return wstring(1, L'p');}
|
|
||||||
static wstring prefix() {return wstring(L"pico");}
|
|
||||||
};
|
|
||||||
|
|
||||||
// nano
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<nano, char>
|
|
||||||
{
|
|
||||||
static string symbol() {return string(1, 'n');}
|
|
||||||
static string prefix() {return string("nano");}
|
|
||||||
};
|
|
||||||
|
|
||||||
#if HAS_UNICODE_SUPPORT
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<nano, char16_t>
|
|
||||||
{
|
|
||||||
static u16string symbol() {return u16string(1, u'n');}
|
|
||||||
static u16string prefix() {return u16string(u"nano");}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<nano, char32_t>
|
|
||||||
{
|
|
||||||
static u32string symbol() {return u32string(1, U'n');}
|
|
||||||
static u32string prefix() {return u32string(U"nano");}
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<nano, wchar_t>
|
|
||||||
{
|
|
||||||
static wstring symbol() {return wstring(1, L'n');}
|
|
||||||
static wstring prefix() {return wstring(L"nano");}
|
|
||||||
};
|
|
||||||
|
|
||||||
// micro
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<micro, char>
|
|
||||||
{
|
|
||||||
static string symbol() {return string("\xC2\xB5");}
|
|
||||||
static string prefix() {return string("micro");}
|
|
||||||
};
|
|
||||||
|
|
||||||
#if HAS_UNICODE_SUPPORT
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<micro, char16_t>
|
|
||||||
{
|
|
||||||
static u16string symbol() {return u16string(1, u'\xB5');}
|
|
||||||
static u16string prefix() {return u16string(u"micro");}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<micro, char32_t>
|
|
||||||
{
|
|
||||||
static u32string symbol() {return u32string(1, U'\xB5');}
|
|
||||||
static u32string prefix() {return u32string(U"micro");}
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<micro, wchar_t>
|
|
||||||
{
|
|
||||||
static wstring symbol() {return wstring(1, L'\xB5');}
|
|
||||||
static wstring prefix() {return wstring(L"micro");}
|
|
||||||
};
|
|
||||||
|
|
||||||
// milli
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<milli, char>
|
|
||||||
{
|
|
||||||
static string symbol() {return string(1, 'm');}
|
|
||||||
static string prefix() {return string("milli");}
|
|
||||||
};
|
|
||||||
|
|
||||||
#if HAS_UNICODE_SUPPORT
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<milli, char16_t>
|
|
||||||
{
|
|
||||||
static u16string symbol() {return u16string(1, u'm');}
|
|
||||||
static u16string prefix() {return u16string(u"milli");}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<milli, char32_t>
|
|
||||||
{
|
|
||||||
static u32string symbol() {return u32string(1, U'm');}
|
|
||||||
static u32string prefix() {return u32string(U"milli");}
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<milli, wchar_t>
|
|
||||||
{
|
|
||||||
static wstring symbol() {return wstring(1, L'm');}
|
|
||||||
static wstring prefix() {return wstring(L"milli");}
|
|
||||||
};
|
|
||||||
|
|
||||||
// centi
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<centi, char>
|
|
||||||
{
|
|
||||||
static string symbol() {return string(1, 'c');}
|
|
||||||
static string prefix() {return string("centi");}
|
|
||||||
};
|
|
||||||
|
|
||||||
#if HAS_UNICODE_SUPPORT
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<centi, char16_t>
|
|
||||||
{
|
|
||||||
static u16string symbol() {return u16string(1, u'c');}
|
|
||||||
static u16string prefix() {return u16string(u"centi");}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<centi, char32_t>
|
|
||||||
{
|
|
||||||
static u32string symbol() {return u32string(1, U'c');}
|
|
||||||
static u32string prefix() {return u32string(U"centi");}
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<centi, wchar_t>
|
|
||||||
{
|
|
||||||
static wstring symbol() {return wstring(1, L'c');}
|
|
||||||
static wstring prefix() {return wstring(L"centi");}
|
|
||||||
};
|
|
||||||
|
|
||||||
// deci
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<deci, char>
|
|
||||||
{
|
|
||||||
static string symbol() {return string(1, 'd');}
|
|
||||||
static string prefix() {return string("deci");}
|
|
||||||
};
|
|
||||||
|
|
||||||
#if HAS_UNICODE_SUPPORT
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<deci, char16_t>
|
|
||||||
{
|
|
||||||
static u16string symbol() {return u16string(1, u'd');}
|
|
||||||
static u16string prefix() {return u16string(u"deci");}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<deci, char32_t>
|
|
||||||
{
|
|
||||||
static u32string symbol() {return u32string(1, U'd');}
|
|
||||||
static u32string prefix() {return u32string(U"deci");}
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<deci, wchar_t>
|
|
||||||
{
|
|
||||||
static wstring symbol() {return wstring(1, L'd');}
|
|
||||||
static wstring prefix() {return wstring(L"deci");}
|
|
||||||
};
|
|
||||||
|
|
||||||
// deca
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<deca, char>
|
|
||||||
{
|
|
||||||
static string symbol() {return string("da");}
|
|
||||||
static string prefix() {return string("deca");}
|
|
||||||
};
|
|
||||||
|
|
||||||
#if HAS_UNICODE_SUPPORT
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<deca, char16_t>
|
|
||||||
{
|
|
||||||
static u16string symbol() {return u16string(u"da");}
|
|
||||||
static u16string prefix() {return u16string(u"deca");}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<deca, char32_t>
|
|
||||||
{
|
|
||||||
static u32string symbol() {return u32string(U"da");}
|
|
||||||
static u32string prefix() {return u32string(U"deca");}
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<deca, wchar_t>
|
|
||||||
{
|
|
||||||
static wstring symbol() {return wstring(L"da");}
|
|
||||||
static wstring prefix() {return wstring(L"deca");}
|
|
||||||
};
|
|
||||||
|
|
||||||
// hecto
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<hecto, char>
|
|
||||||
{
|
|
||||||
static string symbol() {return string(1, 'h');}
|
|
||||||
static string prefix() {return string("hecto");}
|
|
||||||
};
|
|
||||||
|
|
||||||
#if HAS_UNICODE_SUPPORT
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<hecto, char16_t>
|
|
||||||
{
|
|
||||||
static u16string symbol() {return u16string(1, u'h');}
|
|
||||||
static u16string prefix() {return u16string(u"hecto");}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<hecto, char32_t>
|
|
||||||
{
|
|
||||||
static u32string symbol() {return u32string(1, U'h');}
|
|
||||||
static u32string prefix() {return u32string(U"hecto");}
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<hecto, wchar_t>
|
|
||||||
{
|
|
||||||
static wstring symbol() {return wstring(1, L'h');}
|
|
||||||
static wstring prefix() {return wstring(L"hecto");}
|
|
||||||
};
|
|
||||||
|
|
||||||
// kilo
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<kilo, char>
|
|
||||||
{
|
|
||||||
static string symbol() {return string(1, 'k');}
|
|
||||||
static string prefix() {return string("kilo");}
|
|
||||||
};
|
|
||||||
|
|
||||||
#if HAS_UNICODE_SUPPORT
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<kilo, char16_t>
|
|
||||||
{
|
|
||||||
static u16string symbol() {return u16string(1, u'k');}
|
|
||||||
static u16string prefix() {return u16string(u"kilo");}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<kilo, char32_t>
|
|
||||||
{
|
|
||||||
static u32string symbol() {return u32string(1, U'k');}
|
|
||||||
static u32string prefix() {return u32string(U"kilo");}
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<kilo, wchar_t>
|
|
||||||
{
|
|
||||||
static wstring symbol() {return wstring(1, L'k');}
|
|
||||||
static wstring prefix() {return wstring(L"kilo");}
|
|
||||||
};
|
|
||||||
|
|
||||||
// mega
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<mega, char>
|
|
||||||
{
|
|
||||||
static string symbol() {return string(1, 'M');}
|
|
||||||
static string prefix() {return string("mega");}
|
|
||||||
};
|
|
||||||
|
|
||||||
#if HAS_UNICODE_SUPPORT
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<mega, char16_t>
|
|
||||||
{
|
|
||||||
static u16string symbol() {return u16string(1, u'M');}
|
|
||||||
static u16string prefix() {return u16string(u"mega");}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<mega, char32_t>
|
|
||||||
{
|
|
||||||
static u32string symbol() {return u32string(1, U'M');}
|
|
||||||
static u32string prefix() {return u32string(U"mega");}
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<mega, wchar_t>
|
|
||||||
{
|
|
||||||
static wstring symbol() {return wstring(1, L'M');}
|
|
||||||
static wstring prefix() {return wstring(L"mega");}
|
|
||||||
};
|
|
||||||
|
|
||||||
// giga
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<giga, char>
|
|
||||||
{
|
|
||||||
static string symbol() {return string(1, 'G');}
|
|
||||||
static string prefix() {return string("giga");}
|
|
||||||
};
|
|
||||||
|
|
||||||
#if HAS_UNICODE_SUPPORT
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<giga, char16_t>
|
|
||||||
{
|
|
||||||
static u16string symbol() {return u16string(1, u'G');}
|
|
||||||
static u16string prefix() {return u16string(u"giga");}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<giga, char32_t>
|
|
||||||
{
|
|
||||||
static u32string symbol() {return u32string(1, U'G');}
|
|
||||||
static u32string prefix() {return u32string(U"giga");}
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<giga, wchar_t>
|
|
||||||
{
|
|
||||||
static wstring symbol() {return wstring(1, L'G');}
|
|
||||||
static wstring prefix() {return wstring(L"giga");}
|
|
||||||
};
|
|
||||||
|
|
||||||
// tera
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<tera, char>
|
|
||||||
{
|
|
||||||
static string symbol() {return string(1, 'T');}
|
|
||||||
static string prefix() {return string("tera");}
|
|
||||||
};
|
|
||||||
|
|
||||||
#if HAS_UNICODE_SUPPORT
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<tera, char16_t>
|
|
||||||
{
|
|
||||||
static u16string symbol() {return u16string(1, u'T');}
|
|
||||||
static u16string prefix() {return u16string(u"tera");}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<tera, char32_t>
|
|
||||||
{
|
|
||||||
static u32string symbol() {return u32string(1, U'T');}
|
|
||||||
static u32string prefix() {return u32string(U"tera");}
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<tera, wchar_t>
|
|
||||||
{
|
|
||||||
static wstring symbol() {return wstring(1, L'T');}
|
|
||||||
static wstring prefix() {return wstring(L"tera");}
|
|
||||||
};
|
|
||||||
|
|
||||||
// peta
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<peta, char>
|
|
||||||
{
|
|
||||||
static string symbol() {return string(1, 'P');}
|
|
||||||
static string prefix() {return string("peta");}
|
|
||||||
};
|
|
||||||
|
|
||||||
#if HAS_UNICODE_SUPPORT
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<peta, char16_t>
|
|
||||||
{
|
|
||||||
static u16string symbol() {return u16string(1, u'P');}
|
|
||||||
static u16string prefix() {return u16string(u"peta");}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<peta, char32_t>
|
|
||||||
{
|
|
||||||
static u32string symbol() {return u32string(1, U'P');}
|
|
||||||
static u32string prefix() {return u32string(U"peta");}
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<peta, wchar_t>
|
|
||||||
{
|
|
||||||
static wstring symbol() {return wstring(1, L'P');}
|
|
||||||
static wstring prefix() {return wstring(L"peta");}
|
|
||||||
};
|
|
||||||
|
|
||||||
// exa
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<exa, char>
|
|
||||||
{
|
|
||||||
static string symbol() {return string(1, 'E');}
|
|
||||||
static string prefix() {return string("exa");}
|
|
||||||
};
|
|
||||||
|
|
||||||
#if HAS_UNICODE_SUPPORT
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<exa, char16_t>
|
|
||||||
{
|
|
||||||
static u16string symbol() {return u16string(1, u'E');}
|
|
||||||
static u16string prefix() {return u16string(u"exa");}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<exa, char32_t>
|
|
||||||
{
|
|
||||||
static u32string symbol() {return u32string(1, U'E');}
|
|
||||||
static u32string prefix() {return u32string(U"exa");}
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ratio_string<exa, wchar_t>
|
|
||||||
{
|
|
||||||
static wstring symbol() {return wstring(1, L'E');}
|
|
||||||
static wstring prefix() {return wstring(L"exa");}
|
|
||||||
};
|
|
||||||
|
|
||||||
//_LIBCPP_END_NAMESPACE_STD
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // _RATIO_IO
|
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
#ifndef BEAST_CHRONO_BASIC_SECONDS_CLOCK_H_INCLUDED
|
#ifndef BEAST_CHRONO_BASIC_SECONDS_CLOCK_H_INCLUDED
|
||||||
#define BEAST_CHRONO_BASIC_SECONDS_CLOCK_H_INCLUDED
|
#define BEAST_CHRONO_BASIC_SECONDS_CLOCK_H_INCLUDED
|
||||||
|
|
||||||
#include <beast/chrono/chrono_util.h>
|
#include <beast/clock/chrono_util.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
#ifndef BEAST_CHRONO_MANUAL_CLOCK_H_INCLUDED
|
#ifndef BEAST_CHRONO_MANUAL_CLOCK_H_INCLUDED
|
||||||
#define BEAST_CHRONO_MANUAL_CLOCK_H_INCLUDED
|
#define BEAST_CHRONO_MANUAL_CLOCK_H_INCLUDED
|
||||||
|
|
||||||
#include <beast/chrono/abstract_clock.h>
|
#include <beast/clock/abstract_clock.h>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
namespace beast {
|
namespace beast {
|
||||||
@@ -19,8 +19,8 @@
|
|||||||
|
|
||||||
// MODULES: ../impl/chrono_io.cpp
|
// MODULES: ../impl/chrono_io.cpp
|
||||||
|
|
||||||
#include <beast/chrono/abstract_clock.h>
|
#include <beast/clock/abstract_clock.h>
|
||||||
#include <beast/chrono/manual_clock.h>
|
#include <beast/clock/manual_clock.h>
|
||||||
#include <beast/unit_test/suite.h>
|
#include <beast/unit_test/suite.h>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
#include <beast/unit_test/suite.h>
|
#include <beast/unit_test/suite.h>
|
||||||
|
|
||||||
#include <beast/chrono/basic_seconds_clock.h>
|
#include <beast/clock/basic_seconds_clock.h>
|
||||||
|
|
||||||
namespace beast {
|
namespace beast {
|
||||||
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
|
||||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
// Ideas from boost
|
|
||||||
|
|
||||||
// Intel
|
|
||||||
#ifndef BEAST_CONFIG_SELECTCOMPILERCONFIG_H_INCLUDED
|
|
||||||
#define BEAST_CONFIG_SELECTCOMPILERCONFIG_H_INCLUDED
|
|
||||||
|
|
||||||
#if defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)
|
|
||||||
#define BEAST_COMPILER_CONFIG "config/compiler/Intel.h"
|
|
||||||
|
|
||||||
// Clang C++ emulates GCC, so it has to appear early.
|
|
||||||
#elif defined __clang__
|
|
||||||
#define BEAST_COMPILER_CONFIG "config/compiler/Clang.h"
|
|
||||||
|
|
||||||
// GNU C++:
|
|
||||||
#elif defined __GNUC__
|
|
||||||
#define BEAST_COMPILER_CONFIG "config/compiler/Gcc.h"
|
|
||||||
|
|
||||||
// Microsoft Visual C++
|
|
||||||
//
|
|
||||||
// Must remain the last #elif since some other vendors (Metrowerks, for
|
|
||||||
// example) also #define _MSC_VER
|
|
||||||
#elif defined _MSC_VER
|
|
||||||
#define BEAST_COMPILER_CONFIG "config/compiler/VisualC.h"
|
|
||||||
|
|
||||||
#else
|
|
||||||
#error "Unsupported compiler."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
|
||||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
// Ideas from boost
|
|
||||||
|
|
||||||
// Android, which must be manually set by defining BEAST_ANDROID
|
|
||||||
#ifndef BEAST_CONFIG_SELECTPLATFORMCONFIG_H_INCLUDED
|
|
||||||
#define BEAST_CONFIG_SELECTPLATFORMCONFIG_H_INCLUDED
|
|
||||||
|
|
||||||
#if defined(BEAST_ANDROID)
|
|
||||||
#define BEAST_PLATFORM_CONFIG "config/platform/Android.h"
|
|
||||||
|
|
||||||
// linux, also other platforms (Hurd etc) that use GLIBC
|
|
||||||
#elif (defined(linux) || defined(__linux) || defined(__linux__) || defined(__GNU__) || defined(__GLIBC__)) && !defined(_CRAYC)
|
|
||||||
#define BEAST_PLATFORM_CONFIG "config/platform/Linux.h"
|
|
||||||
|
|
||||||
// BSD
|
|
||||||
#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
|
|
||||||
#define BEAST_PLATFORM_CONFIG "config/platform/Bsd.h"
|
|
||||||
|
|
||||||
// win32
|
|
||||||
#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(_WIN64)
|
|
||||||
#define BEAST_PLATFORM_CONFIG "config/platform/Win32.h"
|
|
||||||
|
|
||||||
// MacOS
|
|
||||||
#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) || defined(__APPLE_CPP__)
|
|
||||||
#define BEAST_PLATFORM_CONFIG "config/platform/MacOS.h"
|
|
||||||
|
|
||||||
#else
|
|
||||||
#error "Unsupported platform."
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
|
||||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
// Ideas from boost
|
|
||||||
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
|
||||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
#ifndef BEAST_CONFIG_SUFFIX_H_INCLUDED
|
|
||||||
#define BEAST_CONFIG_SUFFIX_H_INCLUDED
|
|
||||||
|
|
||||||
// Included at the end of Config.h
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
|
||||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
// Microsoft Visual C++ compiler configuration
|
|
||||||
|
|
||||||
#ifndef BEAST_CONFIG_COMPILER_VISUALC_H_INCLUDED
|
|
||||||
#define BEAST_CONFIG_COMPILER_VISUALC_H_INCLUDED
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
|
||||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
// Android platform configuration
|
|
||||||
|
|
||||||
#ifndef BEAST_CONFIG_PLATFORM_ANDROID_H_INCLUDED
|
|
||||||
#define BEAST_CONFIG_PLATFORM_ANDROID_H_INCLUDED
|
|
||||||
|
|
||||||
#ifdef BEAST_ANDROID
|
|
||||||
#undef BEAST_ANDROID
|
|
||||||
#endif
|
|
||||||
#define BEAST_ANDROID 1
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
|
||||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
// BSD, FreeBSD platform configuration
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
|
||||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
// MacOS and iOS platform configuration
|
|
||||||
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
|
||||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
// Win32 platform configuration
|
|
||||||
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
|
||||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
#if BEAST_INCLUDE_BEASTCONFIG
|
|
||||||
#include <BeastConfig.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <beast/container/tests/aged_associative_container.test.cpp>
|
|
||||||
@@ -1,520 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
|
||||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
#ifndef BEAST_CONTAINER_BUFFER_VIEW_H_INCLUDED
|
|
||||||
#define BEAST_CONTAINER_BUFFER_VIEW_H_INCLUDED
|
|
||||||
|
|
||||||
#include <beast/Config.h>
|
|
||||||
|
|
||||||
#include <array>
|
|
||||||
#include <beast/cxx14/algorithm.h> // <algorithm>
|
|
||||||
#include <cstddef>
|
|
||||||
#include <iterator>
|
|
||||||
#include <memory>
|
|
||||||
#include <string>
|
|
||||||
#include <type_traits>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
namespace beast {
|
|
||||||
|
|
||||||
namespace detail {
|
|
||||||
|
|
||||||
template <class T, class U,
|
|
||||||
bool = std::is_const <std::remove_reference_t <T>>::value>
|
|
||||||
struct apply_const
|
|
||||||
{
|
|
||||||
using type = U;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class T, class U>
|
|
||||||
struct apply_const <T, U, true>
|
|
||||||
{
|
|
||||||
using type = const U;
|
|
||||||
};
|
|
||||||
|
|
||||||
// is_contiguous is true if C is a contiguous container
|
|
||||||
template <class C>
|
|
||||||
struct is_contiguous
|
|
||||||
: public std::false_type
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class C>
|
|
||||||
struct is_contiguous <C const>
|
|
||||||
: public is_contiguous <C>
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class T, class Alloc>
|
|
||||||
struct is_contiguous <std::vector <T, Alloc>>
|
|
||||||
: public std::true_type
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class CharT, class Traits, class Alloc>
|
|
||||||
struct is_contiguous <std::basic_string<
|
|
||||||
CharT, Traits, Alloc>>
|
|
||||||
: public std::true_type
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class T, std::size_t N>
|
|
||||||
struct is_contiguous <std::array<T, N>>
|
|
||||||
: public std::true_type
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
// True if T is const or U is not const
|
|
||||||
template <class T, class U>
|
|
||||||
struct buffer_view_const_compatible : std::integral_constant <bool,
|
|
||||||
std::is_const<T>::value || ! std::is_const<U>::value
|
|
||||||
>
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
// True if T and U are the same or differ only in const, or
|
|
||||||
// if T and U are equally sized integral types.
|
|
||||||
template <class T, class U>
|
|
||||||
struct buffer_view_ptr_compatible : std::integral_constant <bool,
|
|
||||||
(std::is_same <std::remove_const <T>, std::remove_const <U>>::value) ||
|
|
||||||
(std::is_integral <T>::value && std::is_integral <U>::value &&
|
|
||||||
sizeof (U) == sizeof (T))
|
|
||||||
>
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
// Determine if buffer_view <T, ..> is constructible from U*
|
|
||||||
template <class T, class U>
|
|
||||||
struct buffer_view_convertible : std::integral_constant <bool,
|
|
||||||
buffer_view_const_compatible <T, U>::value &&
|
|
||||||
buffer_view_ptr_compatible <T, U>::value
|
|
||||||
>
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
// True if C is a container that can be used to construct a buffer_view<T>
|
|
||||||
template <class T, class C>
|
|
||||||
struct buffer_view_container_compatible : std::integral_constant <bool,
|
|
||||||
is_contiguous <C>::value && buffer_view_convertible <T,
|
|
||||||
typename apply_const <C, typename C::value_type>::type>::value
|
|
||||||
>
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
} // detail
|
|
||||||
|
|
||||||
struct buffer_view_default_tag
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/** A view into a range of contiguous container elements.
|
|
||||||
|
|
||||||
The size of the view is determined at the time of construction.
|
|
||||||
This tries to emulate the interface of std::vector as closely as possible,
|
|
||||||
with the constraint that the size of the container cannot be changed.
|
|
||||||
|
|
||||||
@tparam T The underlying element type. If T is const, member functions
|
|
||||||
which can modify elements are removed from the interface.
|
|
||||||
|
|
||||||
@tparam Tag A type used to prevent two views with the same T from being
|
|
||||||
comparable or assignable.
|
|
||||||
*/
|
|
||||||
template <
|
|
||||||
class T,
|
|
||||||
class Tag = buffer_view_default_tag
|
|
||||||
>
|
|
||||||
class buffer_view
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
T* m_base;
|
|
||||||
std::size_t m_size;
|
|
||||||
|
|
||||||
static_assert (std::is_same <T, std::remove_reference_t <T>>::value,
|
|
||||||
"T may not be a reference type");
|
|
||||||
|
|
||||||
static_assert (! std::is_same <T, void>::value,
|
|
||||||
"T may not be void");
|
|
||||||
|
|
||||||
static_assert (std::is_same <std::add_const_t <T>,
|
|
||||||
std::remove_reference_t <T> const>::value,
|
|
||||||
"Expected std::add_const to produce T const");
|
|
||||||
|
|
||||||
template <class Iter>
|
|
||||||
void
|
|
||||||
assign (Iter first, Iter last) noexcept
|
|
||||||
{
|
|
||||||
using U = typename std::iterator_traits <Iter>::value_type;
|
|
||||||
|
|
||||||
static_assert (detail::buffer_view_const_compatible <T, U>::value,
|
|
||||||
"Cannot convert from 'U const' to 'T', "
|
|
||||||
"conversion loses const qualifiers");
|
|
||||||
|
|
||||||
static_assert (detail::buffer_view_ptr_compatible <T, U>::value,
|
|
||||||
"Cannot convert from 'U*' to 'T*, "
|
|
||||||
"types are incompatible");
|
|
||||||
|
|
||||||
if (first == last)
|
|
||||||
{
|
|
||||||
m_base = nullptr;
|
|
||||||
m_size = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
// fails on gcc
|
|
||||||
m_base = reinterpret_cast <T*> (
|
|
||||||
std::addressof (*first));
|
|
||||||
#else
|
|
||||||
m_base = reinterpret_cast <T*> (&*first);
|
|
||||||
#endif
|
|
||||||
m_size = std::distance (first, last);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
using value_type = T;
|
|
||||||
using size_type = std::size_t;
|
|
||||||
using difference_type = std::ptrdiff_t;
|
|
||||||
using reference = T&;
|
|
||||||
using const_reference = T const&;
|
|
||||||
using pointer = T*;
|
|
||||||
using const_pointer = T const*;
|
|
||||||
using iterator = T*;
|
|
||||||
using const_iterator = T const*;
|
|
||||||
using reverse_iterator = std::reverse_iterator <iterator>;
|
|
||||||
using const_reverse_iterator = std::reverse_iterator <const_iterator>;
|
|
||||||
|
|
||||||
// default construct
|
|
||||||
buffer_view () noexcept
|
|
||||||
: m_base (nullptr)
|
|
||||||
, m_size (0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// copy construct
|
|
||||||
template <class U,
|
|
||||||
class = std::enable_if_t <
|
|
||||||
detail::buffer_view_convertible <T, U>::value>
|
|
||||||
>
|
|
||||||
buffer_view (buffer_view <U, Tag> v) noexcept
|
|
||||||
{
|
|
||||||
assign (v.begin(), v.end());
|
|
||||||
}
|
|
||||||
|
|
||||||
// construct from container
|
|
||||||
template <class C,
|
|
||||||
class = std::enable_if_t <
|
|
||||||
detail::buffer_view_container_compatible <T, C>::value
|
|
||||||
>
|
|
||||||
>
|
|
||||||
buffer_view (C& c) noexcept
|
|
||||||
{
|
|
||||||
assign (c.begin(), c.end());
|
|
||||||
}
|
|
||||||
|
|
||||||
// construct from pointer range
|
|
||||||
template <class U,
|
|
||||||
class = std::enable_if_t <
|
|
||||||
detail::buffer_view_convertible <T, U>::value>
|
|
||||||
>
|
|
||||||
buffer_view (U* first, U* last) noexcept
|
|
||||||
{
|
|
||||||
assign (first, last);
|
|
||||||
}
|
|
||||||
|
|
||||||
// construct from base and size
|
|
||||||
template <class U,
|
|
||||||
class = std::enable_if_t <
|
|
||||||
detail::buffer_view_convertible <T, U>::value>
|
|
||||||
>
|
|
||||||
buffer_view (U* u, std::size_t n) noexcept
|
|
||||||
: m_base (u)
|
|
||||||
, m_size (n)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// assign from container
|
|
||||||
template <class C,
|
|
||||||
class = std::enable_if_t <
|
|
||||||
detail::buffer_view_container_compatible <T, C>::value
|
|
||||||
>
|
|
||||||
>
|
|
||||||
buffer_view&
|
|
||||||
operator= (C& c) noexcept
|
|
||||||
{
|
|
||||||
assign (c.begin(), c.end());
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Element access
|
|
||||||
//
|
|
||||||
|
|
||||||
reference
|
|
||||||
at (size_type pos)
|
|
||||||
{
|
|
||||||
if (! (pos < size()))
|
|
||||||
throw std::out_of_range ("bad array index");
|
|
||||||
return m_base [pos];
|
|
||||||
}
|
|
||||||
|
|
||||||
const_reference
|
|
||||||
at (size_type pos) const
|
|
||||||
{
|
|
||||||
if (! (pos < size()))
|
|
||||||
throw std::out_of_range ("bad array index");
|
|
||||||
return m_base [pos];
|
|
||||||
}
|
|
||||||
|
|
||||||
reference
|
|
||||||
operator[] (size_type pos) noexcept
|
|
||||||
{
|
|
||||||
return m_base [pos];
|
|
||||||
}
|
|
||||||
|
|
||||||
const_reference
|
|
||||||
operator[] (size_type pos) const noexcept
|
|
||||||
{
|
|
||||||
return m_base [pos];
|
|
||||||
}
|
|
||||||
|
|
||||||
reference
|
|
||||||
back() noexcept
|
|
||||||
{
|
|
||||||
return m_base [m_size - 1];
|
|
||||||
}
|
|
||||||
|
|
||||||
const_reference
|
|
||||||
back() const noexcept
|
|
||||||
{
|
|
||||||
return m_base [m_size - 1];
|
|
||||||
}
|
|
||||||
|
|
||||||
reference
|
|
||||||
front() noexcept
|
|
||||||
{
|
|
||||||
return *m_base;
|
|
||||||
}
|
|
||||||
|
|
||||||
const_reference
|
|
||||||
front() const noexcept
|
|
||||||
{
|
|
||||||
return *m_base;
|
|
||||||
}
|
|
||||||
|
|
||||||
pointer
|
|
||||||
data() noexcept
|
|
||||||
{
|
|
||||||
return m_base;
|
|
||||||
}
|
|
||||||
|
|
||||||
const_pointer
|
|
||||||
data() const noexcept
|
|
||||||
{
|
|
||||||
return m_base;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Iterators
|
|
||||||
//
|
|
||||||
|
|
||||||
iterator
|
|
||||||
begin() noexcept
|
|
||||||
{
|
|
||||||
return m_base;
|
|
||||||
}
|
|
||||||
|
|
||||||
const_iterator
|
|
||||||
begin() const noexcept
|
|
||||||
{
|
|
||||||
return m_base;
|
|
||||||
}
|
|
||||||
|
|
||||||
const_iterator
|
|
||||||
cbegin() const noexcept
|
|
||||||
{
|
|
||||||
return m_base;
|
|
||||||
}
|
|
||||||
|
|
||||||
iterator
|
|
||||||
end() noexcept
|
|
||||||
{
|
|
||||||
return m_base + m_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
const_iterator
|
|
||||||
end() const noexcept
|
|
||||||
{
|
|
||||||
return m_base + m_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
const_iterator
|
|
||||||
cend() const noexcept
|
|
||||||
{
|
|
||||||
return m_base + m_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
reverse_iterator
|
|
||||||
rbegin() noexcept
|
|
||||||
{
|
|
||||||
return reverse_iterator (end());
|
|
||||||
}
|
|
||||||
|
|
||||||
const_reverse_iterator
|
|
||||||
rbegin() const noexcept
|
|
||||||
{
|
|
||||||
return const_reverse_iterator (cend());
|
|
||||||
}
|
|
||||||
|
|
||||||
const_reverse_iterator
|
|
||||||
crbegin() const noexcept
|
|
||||||
{
|
|
||||||
return const_reverse_iterator (cend());
|
|
||||||
}
|
|
||||||
|
|
||||||
reverse_iterator
|
|
||||||
rend() noexcept
|
|
||||||
{
|
|
||||||
return reverse_iterator (begin());
|
|
||||||
}
|
|
||||||
|
|
||||||
const_reverse_iterator
|
|
||||||
rend() const noexcept
|
|
||||||
{
|
|
||||||
return const_reverse_iterator (cbegin());
|
|
||||||
}
|
|
||||||
|
|
||||||
const_reverse_iterator
|
|
||||||
crend() const noexcept
|
|
||||||
{
|
|
||||||
return const_reverse_iterator (cbegin());
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Capacity
|
|
||||||
//
|
|
||||||
|
|
||||||
bool
|
|
||||||
empty() const noexcept
|
|
||||||
{
|
|
||||||
return m_size == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_type
|
|
||||||
size() const noexcept
|
|
||||||
{
|
|
||||||
return m_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_type
|
|
||||||
max_size() const noexcept
|
|
||||||
{
|
|
||||||
return size();
|
|
||||||
}
|
|
||||||
|
|
||||||
size_type
|
|
||||||
capacity() const noexcept
|
|
||||||
{
|
|
||||||
return size();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Modifiers
|
|
||||||
//
|
|
||||||
|
|
||||||
template <class U, class K>
|
|
||||||
friend void swap (buffer_view <U, K>& lhs,
|
|
||||||
buffer_view <U, K>& rhs) noexcept;
|
|
||||||
};
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
template <class T, class Tag>
|
|
||||||
inline
|
|
||||||
bool
|
|
||||||
operator== (buffer_view <T, Tag> lhs, buffer_view <T, Tag> rhs)
|
|
||||||
{
|
|
||||||
return std::equal (
|
|
||||||
lhs.cbegin(), lhs.cend(), rhs.cbegin(), rhs.cend());
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T, class Tag>
|
|
||||||
inline
|
|
||||||
bool
|
|
||||||
operator!= (buffer_view <T, Tag> lhs, buffer_view <T, Tag> rhs)
|
|
||||||
{
|
|
||||||
return ! (lhs == rhs);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T, class Tag>
|
|
||||||
inline
|
|
||||||
bool
|
|
||||||
operator< (buffer_view <T, Tag> lhs, buffer_view <T, Tag> rhs)
|
|
||||||
{
|
|
||||||
return std::lexicographical_compare (
|
|
||||||
lhs.cbegin(), lhs.cend(), rhs.cbegin(), rhs.cend());
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T, class Tag>
|
|
||||||
inline
|
|
||||||
bool
|
|
||||||
operator>= (buffer_view <T, Tag> lhs, buffer_view <T, Tag> rhs)
|
|
||||||
{
|
|
||||||
return ! (lhs < rhs);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T, class Tag>
|
|
||||||
inline
|
|
||||||
bool
|
|
||||||
operator> (buffer_view <T, Tag> lhs, buffer_view <T, Tag> rhs)
|
|
||||||
{
|
|
||||||
return rhs < lhs;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T, class Tag>
|
|
||||||
inline
|
|
||||||
bool
|
|
||||||
operator<= (buffer_view <T, Tag> lhs, buffer_view <T, Tag> rhs)
|
|
||||||
{
|
|
||||||
return ! (rhs < lhs);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T, class Tag>
|
|
||||||
inline
|
|
||||||
void
|
|
||||||
swap (buffer_view <T, Tag>& lhs, buffer_view <T, Tag>& rhs) noexcept
|
|
||||||
{
|
|
||||||
std::swap (lhs.m_base, rhs.m_base);
|
|
||||||
std::swap (lhs.m_size, rhs.m_size);
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
template <
|
|
||||||
class T,
|
|
||||||
class Tag = buffer_view_default_tag
|
|
||||||
>
|
|
||||||
using const_buffer_view = buffer_view <
|
|
||||||
std::add_const_t <T>, Tag>;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,513 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
|
||||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
|
||||||
|
|
||||||
Based on work with these copyrights:
|
|
||||||
Copyright Carl Philipp Reh 2009 - 2013.
|
|
||||||
Copyright Philipp Middendorf 2009 - 2013.
|
|
||||||
Distributed under the Boost Software License, Version 1.0.
|
|
||||||
(See accompanying file LICENSE_1_0.txt or copy at
|
|
||||||
http://www.boost.org/LICENSE_1_0.txt)
|
|
||||||
|
|
||||||
Original code taken from
|
|
||||||
https://github.com/freundlich/fcppt
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
#ifndef BEAST_CONTAINER_CYCLIC_ITERATOR_H_INCLUDED
|
|
||||||
#define BEAST_CONTAINER_CYCLIC_ITERATOR_H_INCLUDED
|
|
||||||
|
|
||||||
#include <iterator>
|
|
||||||
#include <boost/iterator/iterator_facade.hpp>
|
|
||||||
|
|
||||||
namespace beast {
|
|
||||||
|
|
||||||
//
|
|
||||||
// cyclic_iterator_fwd.hpp
|
|
||||||
//
|
|
||||||
|
|
||||||
template<
|
|
||||||
typename ContainerIterator
|
|
||||||
>
|
|
||||||
class cyclic_iterator;
|
|
||||||
|
|
||||||
//
|
|
||||||
// cyclic_iterator_category.hpp
|
|
||||||
//
|
|
||||||
|
|
||||||
namespace detail
|
|
||||||
{
|
|
||||||
|
|
||||||
template<
|
|
||||||
typename SourceCategory
|
|
||||||
>
|
|
||||||
struct cyclic_iterator_category;
|
|
||||||
|
|
||||||
template<>
|
|
||||||
struct cyclic_iterator_category<
|
|
||||||
std::forward_iterator_tag
|
|
||||||
>
|
|
||||||
{
|
|
||||||
using type = std::forward_iterator_tag;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<>
|
|
||||||
struct cyclic_iterator_category<
|
|
||||||
std::bidirectional_iterator_tag
|
|
||||||
>
|
|
||||||
{
|
|
||||||
using type = std::bidirectional_iterator_tag;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<>
|
|
||||||
struct cyclic_iterator_category<
|
|
||||||
std::random_access_iterator_tag
|
|
||||||
>
|
|
||||||
{
|
|
||||||
using type = std::bidirectional_iterator_tag;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// cyclic_iterator_base.hpp
|
|
||||||
//
|
|
||||||
|
|
||||||
namespace detail
|
|
||||||
{
|
|
||||||
|
|
||||||
template<
|
|
||||||
typename ContainerIterator
|
|
||||||
>
|
|
||||||
struct cyclic_iterator_base
|
|
||||||
{
|
|
||||||
using type = boost::iterator_facade<
|
|
||||||
cyclic_iterator<
|
|
||||||
ContainerIterator
|
|
||||||
>,
|
|
||||||
typename std::iterator_traits<
|
|
||||||
ContainerIterator
|
|
||||||
>::value_type,
|
|
||||||
typename detail::cyclic_iterator_category<
|
|
||||||
typename std::iterator_traits<
|
|
||||||
ContainerIterator
|
|
||||||
>::iterator_category
|
|
||||||
>::type,
|
|
||||||
typename std::iterator_traits<
|
|
||||||
ContainerIterator
|
|
||||||
>::reference
|
|
||||||
>;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// cyclic_iterator_decl.hpp
|
|
||||||
//
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief An iterator adaptor that cycles through a range
|
|
||||||
|
|
||||||
\ingroup fcpptmain
|
|
||||||
|
|
||||||
\tparam ContainerIterator The underlying iterator which must be at least a
|
|
||||||
forward iterator
|
|
||||||
|
|
||||||
A cyclic iterator can be useful in cases where you want <code>end()</code> to
|
|
||||||
become <code>begin()</code> again. For example, imagine a cycling through a
|
|
||||||
list of items which means if you skip over the last, you will return to the
|
|
||||||
first one.
|
|
||||||
|
|
||||||
This class can only increment or decrement its underlying iterator, random
|
|
||||||
access is not supported. The iterator category will be at most bidirectional.
|
|
||||||
It inherits all capabilities from <code>boost::iterator_facade</code> which
|
|
||||||
means that it will have the usual iterator operations with their semantics.
|
|
||||||
|
|
||||||
Here is a short example demonstrating its use.
|
|
||||||
|
|
||||||
\snippet cyclic_iterator.cpp cyclic_iterator
|
|
||||||
*/
|
|
||||||
template<
|
|
||||||
typename ContainerIterator
|
|
||||||
>
|
|
||||||
class cyclic_iterator
|
|
||||||
:
|
|
||||||
public detail::cyclic_iterator_base<
|
|
||||||
ContainerIterator
|
|
||||||
>::type
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
\brief The base type which is a <code>boost::iterator_facade</code>
|
|
||||||
*/
|
|
||||||
using base_type = typename detail::cyclic_iterator_base<
|
|
||||||
ContainerIterator
|
|
||||||
>::type;
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief The underlying iterator type
|
|
||||||
*/
|
|
||||||
using container_iterator_type = ContainerIterator;
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief The value type adapted from \a ContainerIterator
|
|
||||||
*/
|
|
||||||
using value_type = typename base_type::value_type;
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief The reference type adapted from \a ContainerIterator
|
|
||||||
*/
|
|
||||||
using reference = typename base_type::reference;
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief The pointer type adapted from \a ContainerIterator
|
|
||||||
*/
|
|
||||||
using pointer = typename base_type::pointer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief The difference type adapted from \a ContainerIterator
|
|
||||||
*/
|
|
||||||
using difference_type = typename base_type::difference_type;
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief The iterator category, either Forward or Bidirectional
|
|
||||||
*/
|
|
||||||
using iterator_category = typename base_type::iterator_category;
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Creates a singular iterator
|
|
||||||
*/
|
|
||||||
cyclic_iterator();
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Copy constructs from another cyclic iterator
|
|
||||||
|
|
||||||
Copy constructs from another cyclic iterator \a other. This only works
|
|
||||||
if the underlying iterators are convertible.
|
|
||||||
|
|
||||||
\param other The iterator to copy construct from
|
|
||||||
*/
|
|
||||||
template<
|
|
||||||
typename OtherIterator
|
|
||||||
>
|
|
||||||
explicit
|
|
||||||
cyclic_iterator(
|
|
||||||
cyclic_iterator<OtherIterator> const &other
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Constructs a new cyclic iterator
|
|
||||||
|
|
||||||
Constructs a new cyclic iterator, starting at \a it, inside
|
|
||||||
a range from \a begin to \a end.
|
|
||||||
|
|
||||||
\param pos The start of the iterator
|
|
||||||
\param begin The beginning of the range
|
|
||||||
\param end The end of the range
|
|
||||||
|
|
||||||
\warning The behaviour is undefined if \a pos isn't between \a begin
|
|
||||||
and \a end. Also, the behaviour is undefined, if \a begin and \a end
|
|
||||||
don't form a valid range.
|
|
||||||
*/
|
|
||||||
cyclic_iterator(
|
|
||||||
container_iterator_type const &pos,
|
|
||||||
container_iterator_type const &begin,
|
|
||||||
container_iterator_type const &end
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Assigns from another cyclic iterator
|
|
||||||
|
|
||||||
Assigns from another cyclic iterator \a other. This only works if the
|
|
||||||
underlying iterators are convertible.
|
|
||||||
|
|
||||||
\param other The iterator to assign from
|
|
||||||
|
|
||||||
\return <code>*this</code>
|
|
||||||
*/
|
|
||||||
template<
|
|
||||||
typename OtherIterator
|
|
||||||
>
|
|
||||||
cyclic_iterator<ContainerIterator> &
|
|
||||||
operator=(
|
|
||||||
cyclic_iterator<OtherIterator> const &other
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Returns the beginning of the range
|
|
||||||
*/
|
|
||||||
container_iterator_type
|
|
||||||
begin() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Returns the end of the range
|
|
||||||
*/
|
|
||||||
container_iterator_type
|
|
||||||
end() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Returns the underlying iterator
|
|
||||||
*/
|
|
||||||
container_iterator_type
|
|
||||||
get() const;
|
|
||||||
private:
|
|
||||||
friend class boost::iterator_core_access;
|
|
||||||
|
|
||||||
void
|
|
||||||
increment();
|
|
||||||
|
|
||||||
void
|
|
||||||
decrement();
|
|
||||||
|
|
||||||
bool
|
|
||||||
equal(
|
|
||||||
cyclic_iterator const &
|
|
||||||
) const;
|
|
||||||
|
|
||||||
reference
|
|
||||||
dereference() const;
|
|
||||||
|
|
||||||
difference_type
|
|
||||||
distance_to(
|
|
||||||
cyclic_iterator const &
|
|
||||||
) const;
|
|
||||||
private:
|
|
||||||
container_iterator_type
|
|
||||||
it_,
|
|
||||||
begin_,
|
|
||||||
end_;
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
// cyclic_iterator_impl.hpp
|
|
||||||
//
|
|
||||||
|
|
||||||
template<
|
|
||||||
typename ContainerIterator
|
|
||||||
>
|
|
||||||
cyclic_iterator<
|
|
||||||
ContainerIterator
|
|
||||||
>::cyclic_iterator()
|
|
||||||
:
|
|
||||||
it_(),
|
|
||||||
begin_(),
|
|
||||||
end_()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
template<
|
|
||||||
typename ContainerIterator
|
|
||||||
>
|
|
||||||
template<
|
|
||||||
typename OtherIterator
|
|
||||||
>
|
|
||||||
cyclic_iterator<
|
|
||||||
ContainerIterator
|
|
||||||
>::cyclic_iterator(
|
|
||||||
cyclic_iterator<
|
|
||||||
OtherIterator
|
|
||||||
> const &_other
|
|
||||||
)
|
|
||||||
:
|
|
||||||
it_(
|
|
||||||
_other.it_
|
|
||||||
),
|
|
||||||
begin_(
|
|
||||||
_other.begin_
|
|
||||||
),
|
|
||||||
end_(
|
|
||||||
_other.end_
|
|
||||||
)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
template<
|
|
||||||
typename ContainerIterator
|
|
||||||
>
|
|
||||||
cyclic_iterator<
|
|
||||||
ContainerIterator
|
|
||||||
>::cyclic_iterator(
|
|
||||||
container_iterator_type const &_it,
|
|
||||||
container_iterator_type const &_begin,
|
|
||||||
container_iterator_type const &_end
|
|
||||||
)
|
|
||||||
:
|
|
||||||
it_(
|
|
||||||
_it
|
|
||||||
),
|
|
||||||
begin_(
|
|
||||||
_begin
|
|
||||||
),
|
|
||||||
end_(
|
|
||||||
_end
|
|
||||||
)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
template<
|
|
||||||
typename ContainerIterator
|
|
||||||
>
|
|
||||||
template<
|
|
||||||
typename OtherIterator
|
|
||||||
>
|
|
||||||
cyclic_iterator<
|
|
||||||
ContainerIterator
|
|
||||||
> &
|
|
||||||
cyclic_iterator<
|
|
||||||
ContainerIterator
|
|
||||||
>::operator=(
|
|
||||||
cyclic_iterator<
|
|
||||||
OtherIterator
|
|
||||||
> const &_other
|
|
||||||
)
|
|
||||||
{
|
|
||||||
it_ = _other.it_;
|
|
||||||
|
|
||||||
begin_ = _other.begin_;
|
|
||||||
|
|
||||||
end_ = _other.end_;
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<
|
|
||||||
typename ContainerIterator
|
|
||||||
>
|
|
||||||
typename cyclic_iterator<
|
|
||||||
ContainerIterator
|
|
||||||
>::container_iterator_type
|
|
||||||
cyclic_iterator<
|
|
||||||
ContainerIterator
|
|
||||||
>::begin() const
|
|
||||||
{
|
|
||||||
return begin_;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<
|
|
||||||
typename ContainerIterator
|
|
||||||
>
|
|
||||||
typename cyclic_iterator<
|
|
||||||
ContainerIterator
|
|
||||||
>::container_iterator_type
|
|
||||||
cyclic_iterator<
|
|
||||||
ContainerIterator
|
|
||||||
>::end() const
|
|
||||||
{
|
|
||||||
return end_;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<
|
|
||||||
typename ContainerIterator
|
|
||||||
>
|
|
||||||
typename cyclic_iterator<
|
|
||||||
ContainerIterator
|
|
||||||
>::container_iterator_type
|
|
||||||
cyclic_iterator<
|
|
||||||
ContainerIterator
|
|
||||||
>::get() const
|
|
||||||
{
|
|
||||||
return it_;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<
|
|
||||||
typename ContainerIterator
|
|
||||||
>
|
|
||||||
void
|
|
||||||
cyclic_iterator<
|
|
||||||
ContainerIterator
|
|
||||||
>::increment()
|
|
||||||
{
|
|
||||||
if(
|
|
||||||
begin_ != end_
|
|
||||||
&& ++it_ == end_
|
|
||||||
)
|
|
||||||
it_ = begin_;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<
|
|
||||||
typename ContainerIterator
|
|
||||||
>
|
|
||||||
void
|
|
||||||
cyclic_iterator<
|
|
||||||
ContainerIterator
|
|
||||||
>::decrement()
|
|
||||||
{
|
|
||||||
if(
|
|
||||||
begin_ == end_
|
|
||||||
)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if(
|
|
||||||
it_ == begin_
|
|
||||||
)
|
|
||||||
it_ =
|
|
||||||
std::prev(
|
|
||||||
end_
|
|
||||||
);
|
|
||||||
else
|
|
||||||
--it_;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<
|
|
||||||
typename ContainerIterator
|
|
||||||
>
|
|
||||||
bool
|
|
||||||
cyclic_iterator<
|
|
||||||
ContainerIterator
|
|
||||||
>::equal(
|
|
||||||
cyclic_iterator const &_other
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
return it_ == _other.it;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<
|
|
||||||
typename ContainerIterator
|
|
||||||
>
|
|
||||||
typename cyclic_iterator<
|
|
||||||
ContainerIterator
|
|
||||||
>::reference
|
|
||||||
cyclic_iterator<
|
|
||||||
ContainerIterator
|
|
||||||
>::dereference() const
|
|
||||||
{
|
|
||||||
return *it_;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<
|
|
||||||
typename ContainerIterator
|
|
||||||
>
|
|
||||||
typename cyclic_iterator<
|
|
||||||
ContainerIterator
|
|
||||||
>::difference_type
|
|
||||||
cyclic_iterator<
|
|
||||||
ContainerIterator
|
|
||||||
>::distance_to(
|
|
||||||
cyclic_iterator const &_other
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
return _other.it_ - it_;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convenience function for template argument deduction
|
|
||||||
template <typename ContainerIterator>
|
|
||||||
cyclic_iterator <ContainerIterator> make_cyclic (
|
|
||||||
ContainerIterator const& pos,
|
|
||||||
ContainerIterator const& begin,
|
|
||||||
ContainerIterator const& end);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
|
||||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
#if BEAST_INCLUDE_BEASTCONFIG
|
|
||||||
#include <BeastConfig.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <beast/crypto/tests/base64.test.cpp>
|
|
||||||
@@ -18,8 +18,8 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
#ifndef BEAST_UTILITY_EMPTY_BASE_OPTIMIZATION_H_INCLUDED
|
#ifndef BEAST_EMPTY_BASE_OPTIMIZATION_H_INCLUDED
|
||||||
#define BEAST_UTILITY_EMPTY_BASE_OPTIMIZATION_H_INCLUDED
|
#define BEAST_EMPTY_BASE_OPTIMIZATION_H_INCLUDED
|
||||||
|
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
@@ -21,9 +21,8 @@
|
|||||||
#ifndef BEAST_HASH_HASH_APPEND_H_INCLUDED
|
#ifndef BEAST_HASH_HASH_APPEND_H_INCLUDED
|
||||||
#define BEAST_HASH_HASH_APPEND_H_INCLUDED
|
#define BEAST_HASH_HASH_APPEND_H_INCLUDED
|
||||||
|
|
||||||
#include <beast/config/CompilerConfig.h> // for constexpr
|
|
||||||
#include <beast/hash/endian.h>
|
#include <beast/hash/endian.h>
|
||||||
#include <beast/utility/meta.h>
|
#include <beast/hash/meta.h>
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
#ifndef BEAST_UTILITY_META_H_INCLUDED
|
#ifndef BEAST_HASH_META_H_INCLUDED
|
||||||
#define BEAST_UTILITY_META_H_INCLUDED
|
#define BEAST_HASH_META_H_INCLUDED
|
||||||
|
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
#include <beast/hash/hash_append.h>
|
#include <beast/hash/hash_append.h>
|
||||||
#include <beast/xor_shift_engine.h>
|
#include <beast/xor_shift_engine.h>
|
||||||
#include <beast/unit_test/suite.h>
|
#include <beast/unit_test/suite.h>
|
||||||
#include <beast/utility/type_name.h>
|
#include <beast/type_name.h>
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|||||||
@@ -17,13 +17,9 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
#if BEAST_INCLUDE_BEASTCONFIG
|
|
||||||
#include <BeastConfig.h>
|
|
||||||
#endif
|
|
||||||
#include <beast/hash/fnv1a.h>
|
#include <beast/hash/fnv1a.h>
|
||||||
#include <beast/hash/siphash.h>
|
#include <beast/hash/siphash.h>
|
||||||
#include <beast/hash/xxhasher.h>
|
#include <beast/hash/xxhasher.h>
|
||||||
#include <beast/rngfill.h>
|
|
||||||
#include <beast/xor_shift_engine.h>
|
#include <beast/xor_shift_engine.h>
|
||||||
#include <beast/unit_test/suite.h>
|
#include <beast/unit_test/suite.h>
|
||||||
#include <array>
|
#include <array>
|
||||||
@@ -38,6 +34,44 @@ namespace beast {
|
|||||||
class hash_speed_test : public beast::unit_test::suite
|
class hash_speed_test : public beast::unit_test::suite
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
template <class Generator>
|
||||||
|
static
|
||||||
|
void
|
||||||
|
rngfill (void* buffer, std::size_t bytes,
|
||||||
|
Generator& g)
|
||||||
|
{
|
||||||
|
using result_type =
|
||||||
|
typename Generator::result_type;
|
||||||
|
while (bytes >= sizeof(result_type))
|
||||||
|
{
|
||||||
|
auto const v = g();
|
||||||
|
std::memcpy(buffer, &v, sizeof(v));
|
||||||
|
buffer = reinterpret_cast<
|
||||||
|
std::uint8_t*>(buffer) + sizeof(v);
|
||||||
|
bytes -= sizeof(v);
|
||||||
|
}
|
||||||
|
if (bytes > 0)
|
||||||
|
{
|
||||||
|
auto const v = g();
|
||||||
|
std::memcpy(buffer, &v, bytes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class Generator, std::size_t N,
|
||||||
|
class = std::enable_if_t<
|
||||||
|
N % sizeof(typename Generator::result_type) == 0>>
|
||||||
|
static
|
||||||
|
void
|
||||||
|
rngfill (std::array<std::uint8_t, N>& a, Generator& g)
|
||||||
|
{
|
||||||
|
using result_type =
|
||||||
|
typename Generator::result_type;
|
||||||
|
auto i = N / sizeof(result_type);
|
||||||
|
result_type* p =
|
||||||
|
reinterpret_cast<result_type*>(a.data());
|
||||||
|
while (i--)
|
||||||
|
*p++ = g();
|
||||||
|
}
|
||||||
using clock_type =
|
using clock_type =
|
||||||
std::chrono::high_resolution_clock;
|
std::chrono::high_resolution_clock;
|
||||||
template <class Hasher, std::size_t KeySize>
|
template <class Hasher, std::size_t KeySize>
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
#ifndef BEAST_HASH_UHASH_H_INCLUDED
|
#ifndef BEAST_HASH_UHASH_H_INCLUDED
|
||||||
#define BEAST_HASH_UHASH_H_INCLUDED
|
#define BEAST_HASH_UHASH_H_INCLUDED
|
||||||
|
|
||||||
|
#include <beast/hash/hash_append.h>
|
||||||
#include <beast/hash/spooky.h>
|
#include <beast/hash/spooky.h>
|
||||||
|
|
||||||
namespace beast {
|
namespace beast {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
#ifndef BEAST_HTTP_HEADERS_H_INCLUDED
|
#ifndef BEAST_HTTP_HEADERS_H_INCLUDED
|
||||||
#define BEAST_HTTP_HEADERS_H_INCLUDED
|
#define BEAST_HTTP_HEADERS_H_INCLUDED
|
||||||
|
|
||||||
#include <beast/utility/ci_char_traits.h>
|
#include <beast/ci_char_traits.h>
|
||||||
#include <boost/intrusive/list.hpp>
|
#include <boost/intrusive/list.hpp>
|
||||||
#include <boost/intrusive/set.hpp>
|
#include <boost/intrusive/set.hpp>
|
||||||
#include <boost/iterator/transform_iterator.hpp>
|
#include <boost/iterator/transform_iterator.hpp>
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
#include <beast/http/basic_parser.h>
|
#include <beast/http/basic_parser.h>
|
||||||
#include <beast/http/method.h>
|
#include <beast/http/method.h>
|
||||||
#include <beast/http/headers.h>
|
#include <beast/http/headers.h>
|
||||||
#include <beast/utility/ci_char_traits.h>
|
#include <beast/ci_char_traits.h>
|
||||||
#include <boost/intrusive/list.hpp>
|
#include <boost/intrusive/list.hpp>
|
||||||
#include <boost/intrusive/set.hpp>
|
#include <boost/intrusive/set.hpp>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#ifndef BEAST_HTTP_METHOD_H_INCLUDED
|
#ifndef BEAST_HTTP_METHOD_H_INCLUDED
|
||||||
#define BEAST_HTTP_METHOD_H_INCLUDED
|
#define BEAST_HTTP_METHOD_H_INCLUDED
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|||||||
@@ -1,34 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
|
||||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
#if BEAST_INCLUDE_BEASTCONFIG
|
|
||||||
#include <BeastConfig.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <beast/Config.h>
|
|
||||||
|
|
||||||
#include <beast/Insight.h>
|
|
||||||
|
|
||||||
#include <beast/insight/impl/Collector.cpp>
|
|
||||||
#include <beast/insight/impl/Group.cpp>
|
|
||||||
#include <beast/insight/impl/Groups.cpp>
|
|
||||||
#include <beast/insight/impl/Hook.cpp>
|
|
||||||
#include <beast/insight/impl/Metric.cpp>
|
|
||||||
#include <beast/insight/impl/NullCollector.cpp>
|
|
||||||
#include <beast/insight/impl/StatsDCollector.cpp>
|
|
||||||
@@ -1,98 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
|
||||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
#ifndef BEAST_MODULE_ASIO_ASYNCOBJECT_H_INCLUDED
|
|
||||||
#define BEAST_MODULE_ASIO_ASYNCOBJECT_H_INCLUDED
|
|
||||||
|
|
||||||
#include <atomic>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
namespace beast {
|
|
||||||
namespace asio {
|
|
||||||
|
|
||||||
/** Mix-in to track when all pending I/O is complete.
|
|
||||||
Derived classes must be callable with this signature:
|
|
||||||
void asyncHandlersComplete()
|
|
||||||
*/
|
|
||||||
template <class Derived>
|
|
||||||
class AsyncObject
|
|
||||||
{
|
|
||||||
protected:
|
|
||||||
AsyncObject ()
|
|
||||||
: m_pending (0)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
public:
|
|
||||||
~AsyncObject ()
|
|
||||||
{
|
|
||||||
// Destroying the object with I/O pending? Not a clean exit!
|
|
||||||
assert (m_pending.load () == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** RAII container that maintains the count of pending I/O.
|
|
||||||
Bind this into the argument list of every handler passed
|
|
||||||
to an initiating function.
|
|
||||||
*/
|
|
||||||
class CompletionCounter
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit CompletionCounter (Derived* owner)
|
|
||||||
: m_owner (owner)
|
|
||||||
{
|
|
||||||
++m_owner->m_pending;
|
|
||||||
}
|
|
||||||
|
|
||||||
CompletionCounter (CompletionCounter const& other)
|
|
||||||
: m_owner (other.m_owner)
|
|
||||||
{
|
|
||||||
++m_owner->m_pending;
|
|
||||||
}
|
|
||||||
|
|
||||||
~CompletionCounter ()
|
|
||||||
{
|
|
||||||
if (--m_owner->m_pending == 0)
|
|
||||||
m_owner->asyncHandlersComplete ();
|
|
||||||
}
|
|
||||||
|
|
||||||
CompletionCounter& operator= (CompletionCounter const&) = delete;
|
|
||||||
|
|
||||||
private:
|
|
||||||
Derived* m_owner;
|
|
||||||
};
|
|
||||||
|
|
||||||
void addReference ()
|
|
||||||
{
|
|
||||||
++m_pending;
|
|
||||||
}
|
|
||||||
|
|
||||||
void removeReference ()
|
|
||||||
{
|
|
||||||
if (--m_pending == 0)
|
|
||||||
(static_cast<Derived*>(this))->asyncHandlersComplete();
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
// The number of handlers pending.
|
|
||||||
std::atomic <int> m_pending;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,78 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
|
||||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
|
||||||
|
|
||||||
Portions of this file are from JUCE.
|
|
||||||
Copyright (c) 2013 - Raw Material Software Ltd.
|
|
||||||
Please visit http://www.juce.com
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
#ifndef BEAST_MODULE_CORE_CORE_H_INCLUDED
|
|
||||||
#define BEAST_MODULE_CORE_CORE_H_INCLUDED
|
|
||||||
|
|
||||||
// TargetPlatform.h should not use anything from BeastConfig.h
|
|
||||||
#include <beast/Config.h>
|
|
||||||
|
|
||||||
#if BEAST_MSVC
|
|
||||||
# pragma warning (disable: 4251) // (DLL build warning, must be disabled before pushing the warning state)
|
|
||||||
# pragma warning (push)
|
|
||||||
# pragma warning (disable: 4786) // (long class name warning)
|
|
||||||
# ifdef __INTEL_COMPILER
|
|
||||||
# pragma warning (disable: 1125)
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// New header-only library modeled more closely according to boost
|
|
||||||
#include <beast/SmartPtr.h>
|
|
||||||
#include <beast/ByteOrder.h>
|
|
||||||
#include <beast/HeapBlock.h>
|
|
||||||
#include <beast/Memory.h>
|
|
||||||
#include <beast/Intrusive.h>
|
|
||||||
#include <beast/Threads.h>
|
|
||||||
|
|
||||||
#include <beast/utility/Debug.h>
|
|
||||||
#include <beast/utility/Journal.h>
|
|
||||||
#include <beast/utility/PropertyStream.h>
|
|
||||||
|
|
||||||
#include <beast/module/core/system/StandardIncludes.h>
|
|
||||||
|
|
||||||
// Order matters, since headers don't have their own #include lines.
|
|
||||||
// Add new includes to the bottom.
|
|
||||||
|
|
||||||
#include <beast/module/core/threads/ScopedLock.h>
|
|
||||||
|
|
||||||
#include <beast/module/core/diagnostic/FatalError.h>
|
|
||||||
#include <beast/module/core/text/LexicalCast.h>
|
|
||||||
#include <beast/module/core/logging/Logger.h>
|
|
||||||
|
|
||||||
#include <beast/module/core/system/SystemStats.h>
|
|
||||||
#include <beast/module/core/diagnostic/SemanticVersion.h>
|
|
||||||
#include <beast/module/core/diagnostic/UnitTestUtilities.h>
|
|
||||||
|
|
||||||
#include <beast/module/core/diagnostic/MeasureFunctionCallTime.h>
|
|
||||||
|
|
||||||
#include <beast/module/core/thread/DeadlineTimer.h>
|
|
||||||
|
|
||||||
#include <beast/module/core/thread/Workers.h>
|
|
||||||
|
|
||||||
#if BEAST_MSVC
|
|
||||||
#pragma warning (pop)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
|
||||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
namespace beast {
|
|
||||||
namespace UnitTestUtilities {
|
|
||||||
|
|
||||||
} // UnitTestUtilities
|
|
||||||
} // beast
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
|
||||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
#ifndef BEAST_MODULE_CORE_THREAD_MUTEXTRAITS_H_INCLUDED
|
|
||||||
#define BEAST_MODULE_CORE_THREAD_MUTEXTRAITS_H_INCLUDED
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
|
||||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
#include <beast/Config.h>
|
|
||||||
|
|
||||||
#include <beast/net/impl/IPAddressV4.cpp>
|
|
||||||
#include <beast/net/impl/IPAddressV6.cpp>
|
|
||||||
#include <beast/net/impl/IPEndpoint.cpp>
|
|
||||||
|
|
||||||
#include <beast/net/tests/IPEndpoint.test.cpp>
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
|
||||||
Copyright 2014, Vinnie Falco <vinnie.falco@gmail.com>
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
#include <beast/nudb/tests/callgrind_test.cpp>
|
|
||||||
#include <beast/nudb/tests/recover_test.cpp>
|
|
||||||
#include <beast/nudb/tests/store_test.cpp>
|
|
||||||
#include <beast/nudb/tests/varint_test.cpp>
|
|
||||||
#include <beast/nudb/tests/verify_test.cpp>
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
|
||||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
#include <beast/streams/tests/basic_abstract_ostream.test.cpp>
|
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
#include <BeastConfig.h>
|
#include <BeastConfig.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <beast/utility/empty_base_optimization.h>
|
#include <beast/empty_base_optimization.h>
|
||||||
|
|
||||||
#include <beast/unit_test/suite.h>
|
#include <beast/unit_test/suite.h>
|
||||||
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
|
||||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
#if BEAST_INCLUDE_BEASTCONFIG
|
|
||||||
#include <BeastConfig.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <beast/threads/impl/Stoppable.cpp>
|
|
||||||
#include <beast/threads/impl/Stoppable.test.cpp>
|
|
||||||
#include <beast/threads/impl/Thread.cpp>
|
|
||||||
#include <beast/threads/impl/WaitableEvent.cpp>
|
|
||||||
@@ -17,8 +17,8 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
#ifndef BEAST_UTILITY_TYPE_NAME_H_INCLUDED
|
#ifndef BEAST_TYPE_NAME_H_INCLUDED
|
||||||
#define BEAST_UTILITY_TYPE_NAME_H_INCLUDED
|
#define BEAST_TYPE_NAME_H_INCLUDED
|
||||||
|
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <typeinfo>
|
#include <typeinfo>
|
||||||
@@ -17,8 +17,8 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
#ifndef BEAST_CONTAINER_CONST_CONTAINER_H_INCLUDED
|
#ifndef BEAST_UNIT_TEST_CONST_CONTAINER_H_INCLUDED
|
||||||
#define BEAST_CONTAINER_CONST_CONTAINER_H_INCLUDED
|
#define BEAST_UNIT_TEST_CONST_CONTAINER_H_INCLUDED
|
||||||
|
|
||||||
namespace beast {
|
namespace beast {
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
#ifndef BEAST_UNIT_TEST_RESULTS_H_INCLUDED
|
#ifndef BEAST_UNIT_TEST_RESULTS_H_INCLUDED
|
||||||
#define BEAST_UNIT_TEST_RESULTS_H_INCLUDED
|
#define BEAST_UNIT_TEST_RESULTS_H_INCLUDED
|
||||||
|
|
||||||
#include <beast/container/const_container.h>
|
#include <beast/unit_test/const_container.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|||||||
@@ -21,11 +21,8 @@
|
|||||||
#define BEAST_UNIT_TEST_SUITE_LIST_H_INCLUDED
|
#define BEAST_UNIT_TEST_SUITE_LIST_H_INCLUDED
|
||||||
|
|
||||||
#include <beast/unit_test/suite_info.h>
|
#include <beast/unit_test/suite_info.h>
|
||||||
|
#include <beast/unit_test/const_container.h>
|
||||||
#include <beast/container/const_container.h>
|
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
//#include <list>
|
|
||||||
#include <typeindex>
|
#include <typeindex>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
|
|||||||
@@ -17,57 +17,67 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
#ifndef BEAST_MODULE_CORE_DIAGNOSTIC_UNITTESTUTILITIES_H_INCLUDED
|
#ifndef BEAST_UNITTEST_TEMP_DIR_H_INCLUDED
|
||||||
#define BEAST_MODULE_CORE_DIAGNOSTIC_UNITTESTUTILITIES_H_INCLUDED
|
#define BEAST_UNITTEST_TEMP_DIR_H_INCLUDED
|
||||||
|
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace beast {
|
namespace beast {
|
||||||
namespace UnitTestUtilities {
|
|
||||||
|
|
||||||
class TempDirectory
|
/** RAII temporary directory.
|
||||||
|
|
||||||
|
The directory and all its contents are deleted when
|
||||||
|
the instance of `temp_dir` is destroyed.
|
||||||
|
*/
|
||||||
|
class temp_dir
|
||||||
{
|
{
|
||||||
public:
|
boost::filesystem::path path_;
|
||||||
TempDirectory ()
|
|
||||||
{
|
|
||||||
auto const tempDir =
|
|
||||||
boost::filesystem::temp_directory_path();
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
#if ! GENERATING_DOCS
|
||||||
|
temp_dir(const temp_dir&) = delete;
|
||||||
|
temp_dir& operator=(const temp_dir&) = delete;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/// Construct a temporary directory.
|
||||||
|
temp_dir()
|
||||||
|
{
|
||||||
|
auto const dir =
|
||||||
|
boost::filesystem::temp_directory_path();
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
tempPath =
|
path_ =
|
||||||
tempDir / boost::filesystem::unique_path();
|
dir / boost::filesystem::unique_path();
|
||||||
} while (boost::filesystem::exists(tempPath));
|
}
|
||||||
|
while(boost::filesystem::exists(path_));
|
||||||
boost::filesystem::create_directory (tempPath);
|
boost::filesystem::create_directory (path_);
|
||||||
}
|
}
|
||||||
|
|
||||||
~TempDirectory()
|
/// Destroy a temporary directory.
|
||||||
|
~temp_dir()
|
||||||
{
|
{
|
||||||
boost::filesystem::remove_all (tempPath);
|
boost::filesystem::remove_all (path_);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the native path for the temporary folder */
|
/// Get the native path for the temporary directory
|
||||||
std::string path() const
|
std::string
|
||||||
|
path() const
|
||||||
{
|
{
|
||||||
return tempPath.string();
|
return path_.string();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the native for the given file */
|
/** Get the native path for the a file.
|
||||||
std::string file (std::string const& name) const
|
|
||||||
|
The file does not need to exist.
|
||||||
|
*/
|
||||||
|
std::string
|
||||||
|
file(std::string const& name) const
|
||||||
{
|
{
|
||||||
return (tempPath / name).string();
|
return (path_ / name).string();
|
||||||
}
|
}
|
||||||
|
|
||||||
TempDirectory(const TempDirectory&) = delete;
|
|
||||||
TempDirectory& operator=(const TempDirectory&) = delete;
|
|
||||||
|
|
||||||
private:
|
|
||||||
boost::filesystem::path tempPath;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // UnitTestUtilities
|
|
||||||
} // beast
|
} // beast
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -17,10 +17,5 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
#ifndef BEAST_CRYPTO_H_INCLUDED
|
#include <beast/clock/tests/beast_abstract_clock_test.cpp>
|
||||||
#define BEAST_CRYPTO_H_INCLUDED
|
#include <beast/clock/tests/beast_basic_seconds_clock_test.cpp>
|
||||||
|
|
||||||
#include <beast/crypto/Sha256.h>
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
@@ -17,5 +17,5 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
// Linux-compatible platform configuration
|
#include <beast/crypto/tests/beast_base64_test.cpp>
|
||||||
|
|
||||||
@@ -17,4 +17,4 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
// Clang compiler configuration
|
#include <beast/streams/tests/beast_basic_abstract_ostream_test.cpp>
|
||||||
@@ -17,4 +17,4 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
// Intel compiler configuration
|
#include <beast/test/beast_empty_base_optimization_test.cpp>
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
|
||||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
#if BEAST_INCLUDE_BEASTCONFIG
|
|
||||||
#include <BeastConfig.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <beast/utility/impl/Debug.cpp>
|
|
||||||
#include <beast/utility/impl/Journal.cpp>
|
|
||||||
#include <beast/utility/impl/PropertyStream.cpp>
|
|
||||||
|
|
||||||
#include <beast/utility/tests/empty_base_optimization.test.cpp>
|
|
||||||
#include <beast/utility/tests/Journal.test.cpp>
|
|
||||||
#include <beast/utility/tests/tagged_integer.test.cpp>
|
|
||||||
#include <beast/utility/tests/weak_fn.test.cpp>
|
|
||||||
#include <beast/utility/tests/Zero.test.cpp>
|
|
||||||
@@ -20,7 +20,6 @@
|
|||||||
#ifndef BEAST_RANDOM_XOR_SHIFT_ENGINE_H_INCLUDED
|
#ifndef BEAST_RANDOM_XOR_SHIFT_ENGINE_H_INCLUDED
|
||||||
#define BEAST_RANDOM_XOR_SHIFT_ENGINE_H_INCLUDED
|
#define BEAST_RANDOM_XOR_SHIFT_ENGINE_H_INCLUDED
|
||||||
|
|
||||||
#include <beast/config/CompilerConfig.h>
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
@@ -48,14 +47,14 @@ public:
|
|||||||
operator()();
|
operator()();
|
||||||
|
|
||||||
static
|
static
|
||||||
result_type BEAST_CONSTEXPR
|
result_type constexpr
|
||||||
min()
|
min()
|
||||||
{
|
{
|
||||||
return std::numeric_limits<result_type>::min();
|
return std::numeric_limits<result_type>::min();
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
result_type BEAST_CONSTEXPR
|
result_type constexpr
|
||||||
max()
|
max()
|
||||||
{
|
{
|
||||||
return std::numeric_limits<result_type>::max();
|
return std::numeric_limits<result_type>::max();
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Runs all the tests in bin/
|
|
||||||
|
|
||||||
for f in bin/*.test
|
|
||||||
do
|
|
||||||
{
|
|
||||||
echo -e "\033[94m$f\033[0m"
|
|
||||||
$f
|
|
||||||
}
|
|
||||||
done
|
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include <ripple/app/ledger/InboundLedger.h>
|
#include <ripple/app/ledger/InboundLedger.h>
|
||||||
#include <ripple/protocol/RippleLedgerHash.h>
|
#include <ripple/protocol/RippleLedgerHash.h>
|
||||||
#include <beast/threads/Stoppable.h>
|
#include <ripple/core/Stoppable.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
@@ -86,7 +86,7 @@ public:
|
|||||||
|
|
||||||
std::unique_ptr<InboundLedgers>
|
std::unique_ptr<InboundLedgers>
|
||||||
make_InboundLedgers (Application& app,
|
make_InboundLedgers (Application& app,
|
||||||
InboundLedgers::clock_type& clock, beast::Stoppable& parent,
|
InboundLedgers::clock_type& clock, Stoppable& parent,
|
||||||
beast::insight::Collector::ptr const& collector);
|
beast::insight::Collector::ptr const& collector);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -22,8 +22,8 @@
|
|||||||
|
|
||||||
#include <ripple/overlay/Peer.h>
|
#include <ripple/overlay/Peer.h>
|
||||||
#include <ripple/shamap/SHAMap.h>
|
#include <ripple/shamap/SHAMap.h>
|
||||||
#include <beast/chrono/abstract_clock.h>
|
#include <beast/clock/abstract_clock.h>
|
||||||
#include <beast/threads/Stoppable.h>
|
#include <ripple/core/Stoppable.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
@@ -75,7 +75,7 @@ std::unique_ptr <InboundTransactions>
|
|||||||
make_InboundTransactions (
|
make_InboundTransactions (
|
||||||
Application& app,
|
Application& app,
|
||||||
InboundTransactions::clock_type& clock,
|
InboundTransactions::clock_type& clock,
|
||||||
beast::Stoppable& parent,
|
Stoppable& parent,
|
||||||
beast::insight::Collector::ptr const& collector,
|
beast::insight::Collector::ptr const& collector,
|
||||||
std::function
|
std::function
|
||||||
<void (uint256 const&,
|
<void (uint256 const&,
|
||||||
|
|||||||
@@ -48,7 +48,7 @@
|
|||||||
#include <ripple/protocol/SecretKey.h>
|
#include <ripple/protocol/SecretKey.h>
|
||||||
#include <ripple/protocol/HashPrefix.h>
|
#include <ripple/protocol/HashPrefix.h>
|
||||||
#include <ripple/protocol/types.h>
|
#include <ripple/protocol/types.h>
|
||||||
#include <beast/module/core/text/LexicalCast.h>
|
#include <ripple/beast/core/LexicalCast.h>
|
||||||
#include <beast/unit_test/suite.h>
|
#include <beast/unit_test/suite.h>
|
||||||
#include <boost/optional.hpp>
|
#include <boost/optional.hpp>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
#include <ripple/protocol/Serializer.h>
|
#include <ripple/protocol/Serializer.h>
|
||||||
#include <ripple/protocol/Book.h>
|
#include <ripple/protocol/Book.h>
|
||||||
#include <ripple/shamap/SHAMap.h>
|
#include <ripple/shamap/SHAMap.h>
|
||||||
#include <beast/utility/Journal.h>
|
#include <ripple/beast/utility/Journal.h>
|
||||||
#include <boost/optional.hpp>
|
#include <boost/optional.hpp>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
|
|||||||
@@ -22,9 +22,9 @@
|
|||||||
|
|
||||||
#include <ripple/app/main/Application.h>
|
#include <ripple/app/main/Application.h>
|
||||||
#include <ripple/json/json_value.h>
|
#include <ripple/json/json_value.h>
|
||||||
#include <beast/threads/Stoppable.h>
|
#include <ripple/core/Stoppable.h>
|
||||||
#include <beast/utility/PropertyStream.h>
|
#include <ripple/beast/utility/PropertyStream.h>
|
||||||
#include <beast/utility/Journal.h>
|
#include <ripple/beast/utility/Journal.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
@@ -32,7 +32,7 @@ namespace detail {
|
|||||||
|
|
||||||
/** Check the ledger/transaction databases to make sure they have continuity */
|
/** Check the ledger/transaction databases to make sure they have continuity */
|
||||||
class LedgerCleaner
|
class LedgerCleaner
|
||||||
: public beast::Stoppable
|
: public Stoppable
|
||||||
, public beast::PropertyStream::Source
|
, public beast::PropertyStream::Source
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
@@ -57,7 +57,7 @@ public:
|
|||||||
|
|
||||||
std::unique_ptr<LedgerCleaner>
|
std::unique_ptr<LedgerCleaner>
|
||||||
make_LedgerCleaner (Application& app,
|
make_LedgerCleaner (Application& app,
|
||||||
beast::Stoppable& parent, beast::Journal journal);
|
Stoppable& parent, beast::Journal journal);
|
||||||
|
|
||||||
} // detail
|
} // detail
|
||||||
} // ripple
|
} // ripple
|
||||||
|
|||||||
@@ -23,8 +23,8 @@
|
|||||||
#include <ripple/app/ledger/Ledger.h>
|
#include <ripple/app/ledger/Ledger.h>
|
||||||
#include <ripple/app/main/Application.h>
|
#include <ripple/app/main/Application.h>
|
||||||
#include <ripple/protocol/RippleLedgerHash.h>
|
#include <ripple/protocol/RippleLedgerHash.h>
|
||||||
#include <beast/insight/Collector.h>
|
#include <ripple/beast/insight/Collector.h>
|
||||||
#include <beast/insight/Event.h>
|
#include <ripple/beast/insight/Event.h>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
|
|||||||
@@ -28,13 +28,13 @@
|
|||||||
#include <ripple/app/misc/CanonicalTXSet.h>
|
#include <ripple/app/misc/CanonicalTXSet.h>
|
||||||
#include <ripple/basics/chrono.h>
|
#include <ripple/basics/chrono.h>
|
||||||
#include <ripple/basics/RangeSet.h>
|
#include <ripple/basics/RangeSet.h>
|
||||||
|
#include <ripple/basics/ScopedLock.h>
|
||||||
#include <ripple/basics/StringUtilities.h>
|
#include <ripple/basics/StringUtilities.h>
|
||||||
#include <ripple/protocol/RippleLedgerHash.h>
|
#include <ripple/protocol/RippleLedgerHash.h>
|
||||||
#include <ripple/protocol/STValidation.h>
|
#include <ripple/protocol/STValidation.h>
|
||||||
#include <beast/insight/Collector.h>
|
#include <ripple/beast/insight/Collector.h>
|
||||||
#include <beast/module/core/threads/ScopedLock.h>
|
#include <ripple/core/Stoppable.h>
|
||||||
#include <beast/threads/Stoppable.h>
|
#include <ripple/beast/utility/PropertyStream.h>
|
||||||
#include <beast/utility/PropertyStream.h>
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
#include "ripple.pb.h"
|
#include "ripple.pb.h"
|
||||||
@@ -60,7 +60,7 @@ struct LedgerReplay
|
|||||||
// It sounds like this holds all the ledgers...
|
// It sounds like this holds all the ledgers...
|
||||||
//
|
//
|
||||||
class LedgerMaster
|
class LedgerMaster
|
||||||
: public beast::Stoppable
|
: public Stoppable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit
|
explicit
|
||||||
@@ -275,7 +275,7 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
using ScopedLockType = std::lock_guard <std::recursive_mutex>;
|
using ScopedLockType = std::lock_guard <std::recursive_mutex>;
|
||||||
using ScopedUnlockType = beast::GenericScopedUnlock <std::recursive_mutex>;
|
using ScopedUnlockType = GenericScopedUnlock <std::recursive_mutex>;
|
||||||
|
|
||||||
Application& app_;
|
Application& app_;
|
||||||
beast::Journal m_journal;
|
beast::Journal m_journal;
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
#include <ripple/basics/Log.h>
|
#include <ripple/basics/Log.h>
|
||||||
#include <ripple/basics/UnorderedContainers.h>
|
#include <ripple/basics/UnorderedContainers.h>
|
||||||
#include <ripple/core/Config.h>
|
#include <ripple/core/Config.h>
|
||||||
#include <beast/utility/Journal.h>
|
#include <ripple/beast/utility/Journal.h>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
class OrderBookDB
|
class OrderBookDB
|
||||||
: public beast::Stoppable
|
: public Stoppable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
OrderBookDB (Application& app, Stoppable& parent);
|
OrderBookDB (Application& app, Stoppable& parent);
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
#include <ripple/basics/Log.h>
|
#include <ripple/basics/Log.h>
|
||||||
#include <ripple/protocol/STValidation.h>
|
#include <ripple/protocol/STValidation.h>
|
||||||
#include <ripple/shamap/SHAMap.h>
|
#include <ripple/shamap/SHAMap.h>
|
||||||
#include <beast/utility/Journal.h>
|
#include <ripple/beast/utility/Journal.h>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
#include <ripple/protocol/UintTypes.h>
|
#include <ripple/protocol/UintTypes.h>
|
||||||
#include <ripple/protocol/Serializer.h>
|
#include <ripple/protocol/Serializer.h>
|
||||||
#include <ripple/basics/base_uint.h>
|
#include <ripple/basics/base_uint.h>
|
||||||
#include <beast/utility/Journal.h>
|
#include <ripple/beast/utility/Journal.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|||||||
@@ -26,8 +26,8 @@
|
|||||||
#include <ripple/basics/Log.h>
|
#include <ripple/basics/Log.h>
|
||||||
#include <ripple/core/JobQueue.h>
|
#include <ripple/core/JobQueue.h>
|
||||||
#include <ripple/protocol/JsonFields.h>
|
#include <ripple/protocol/JsonFields.h>
|
||||||
#include <beast/module/core/text/LexicalCast.h>
|
#include <ripple/beast/core/LexicalCast.h>
|
||||||
#include <beast/container/aged_map.h>
|
#include <ripple/beast/container/aged_map.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ namespace ripple {
|
|||||||
|
|
||||||
class InboundLedgersImp
|
class InboundLedgersImp
|
||||||
: public InboundLedgers
|
: public InboundLedgers
|
||||||
, public beast::Stoppable
|
, public Stoppable
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
Application& app_;
|
Application& app_;
|
||||||
@@ -441,7 +441,7 @@ InboundLedgers::~InboundLedgers()
|
|||||||
|
|
||||||
std::unique_ptr<InboundLedgers>
|
std::unique_ptr<InboundLedgers>
|
||||||
make_InboundLedgers (Application& app,
|
make_InboundLedgers (Application& app,
|
||||||
InboundLedgers::clock_type& clock, beast::Stoppable& parent,
|
InboundLedgers::clock_type& clock, Stoppable& parent,
|
||||||
beast::insight::Collector::ptr const& collector)
|
beast::insight::Collector::ptr const& collector)
|
||||||
{
|
{
|
||||||
return std::make_unique<InboundLedgersImp> (app, clock, parent, collector);
|
return std::make_unique<InboundLedgersImp> (app, clock, parent, collector);
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ public:
|
|||||||
|
|
||||||
class InboundTransactionsImp
|
class InboundTransactionsImp
|
||||||
: public InboundTransactions
|
: public InboundTransactions
|
||||||
, public beast::Stoppable
|
, public Stoppable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Application& app_;
|
Application& app_;
|
||||||
@@ -296,7 +296,7 @@ std::unique_ptr <InboundTransactions>
|
|||||||
make_InboundTransactions (
|
make_InboundTransactions (
|
||||||
Application& app,
|
Application& app,
|
||||||
InboundLedgers::clock_type& clock,
|
InboundLedgers::clock_type& clock,
|
||||||
beast::Stoppable& parent,
|
Stoppable& parent,
|
||||||
beast::insight::Collector::ptr const& collector,
|
beast::insight::Collector::ptr const& collector,
|
||||||
std::function <void (uint256 const&,
|
std::function <void (uint256 const&,
|
||||||
std::shared_ptr <SHAMap> const&)> gotSet)
|
std::shared_ptr <SHAMap> const&)> gotSet)
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
#include <ripple/app/ledger/LedgerMaster.h>
|
#include <ripple/app/ledger/LedgerMaster.h>
|
||||||
#include <ripple/core/LoadFeeTrack.h>
|
#include <ripple/core/LoadFeeTrack.h>
|
||||||
#include <ripple/protocol/JsonFields.h>
|
#include <ripple/protocol/JsonFields.h>
|
||||||
#include <beast/threads/Thread.h>
|
#include <ripple/beast/core/Thread.h>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
namespace detail {
|
namespace detail {
|
||||||
@@ -499,7 +499,7 @@ LedgerCleaner::~LedgerCleaner ()
|
|||||||
|
|
||||||
std::unique_ptr<LedgerCleaner>
|
std::unique_ptr<LedgerCleaner>
|
||||||
make_LedgerCleaner (Application& app,
|
make_LedgerCleaner (Application& app,
|
||||||
beast::Stoppable& parent, beast::Journal journal)
|
Stoppable& parent, beast::Journal journal)
|
||||||
{
|
{
|
||||||
return std::make_unique<LedgerCleanerImp>(app, parent, journal);
|
return std::make_unique<LedgerCleanerImp>(app, parent, journal);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,8 +47,8 @@
|
|||||||
#include <ripple/overlay/predicates.h>
|
#include <ripple/overlay/predicates.h>
|
||||||
#include <ripple/protocol/st.h>
|
#include <ripple/protocol/st.h>
|
||||||
#include <ripple/protocol/Feature.h>
|
#include <ripple/protocol/Feature.h>
|
||||||
#include <beast/module/core/text/LexicalCast.h>
|
#include <ripple/beast/core/LexicalCast.h>
|
||||||
#include <beast/utility/make_lock.h>
|
#include <ripple/basics/make_lock.h>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
@@ -1136,9 +1136,9 @@ void LedgerConsensusImp::accept (std::shared_ptr<SHAMap> set)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Build new open ledger
|
// Build new open ledger
|
||||||
auto lock = beast::make_lock(
|
auto lock = make_lock(
|
||||||
app_.getMasterMutex(), std::defer_lock);
|
app_.getMasterMutex(), std::defer_lock);
|
||||||
auto sl = beast::make_lock(
|
auto sl = make_lock(
|
||||||
ledgerMaster_.peekMutex (), std::defer_lock);
|
ledgerMaster_.peekMutex (), std::defer_lock);
|
||||||
std::lock(lock, sl);
|
std::lock(lock, sl);
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
#include <ripple/app/main/Application.h>
|
#include <ripple/app/main/Application.h>
|
||||||
#include <ripple/app/misc/NetworkOPs.h>
|
#include <ripple/app/misc/NetworkOPs.h>
|
||||||
#include <ripple/overlay/Overlay.h>
|
#include <ripple/overlay/Overlay.h>
|
||||||
#include <beast/utility/make_lock.h>
|
#include <ripple/basics/make_lock.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|||||||
@@ -54,6 +54,7 @@
|
|||||||
#include <ripple/json/json_reader.h>
|
#include <ripple/json/json_reader.h>
|
||||||
#include <ripple/json/to_string.h>
|
#include <ripple/json/to_string.h>
|
||||||
#include <ripple/core/ConfigSections.h>
|
#include <ripple/core/ConfigSections.h>
|
||||||
|
#include <ripple/core/DeadlineTimer.h>
|
||||||
#include <ripple/core/LoadFeeTrack.h>
|
#include <ripple/core/LoadFeeTrack.h>
|
||||||
#include <ripple/core/TimeKeeper.h>
|
#include <ripple/core/TimeKeeper.h>
|
||||||
#include <ripple/ledger/CachedSLEs.h>
|
#include <ripple/ledger/CachedSLEs.h>
|
||||||
@@ -72,8 +73,7 @@
|
|||||||
#include <ripple/websocket/MakeServer.h>
|
#include <ripple/websocket/MakeServer.h>
|
||||||
#include <ripple/crypto/csprng.h>
|
#include <ripple/crypto/csprng.h>
|
||||||
#include <beast/asio/io_latency_probe.h>
|
#include <beast/asio/io_latency_probe.h>
|
||||||
#include <beast/module/core/text/LexicalCast.h>
|
#include <ripple/beast/core/LexicalCast.h>
|
||||||
#include <beast/module/core/thread/DeadlineTimer.h>
|
|
||||||
#include <boost/asio/signal_set.hpp>
|
#include <boost/asio/signal_set.hpp>
|
||||||
#include <boost/optional.hpp>
|
#include <boost/optional.hpp>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
@@ -237,8 +237,8 @@ supportedAmendments ();
|
|||||||
// VFALCO TODO Move the function definitions into the class declaration
|
// VFALCO TODO Move the function definitions into the class declaration
|
||||||
class ApplicationImp
|
class ApplicationImp
|
||||||
: public Application
|
: public Application
|
||||||
, public beast::RootStoppable
|
, public RootStoppable
|
||||||
, public beast::DeadlineTimer::Listener
|
, public DeadlineTimer::Listener
|
||||||
, public BasicApp
|
, public BasicApp
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
@@ -354,14 +354,14 @@ public:
|
|||||||
std::unique_ptr <Validations> mValidations;
|
std::unique_ptr <Validations> mValidations;
|
||||||
std::unique_ptr <LoadManager> m_loadManager;
|
std::unique_ptr <LoadManager> m_loadManager;
|
||||||
std::unique_ptr <TxQ> txQ_;
|
std::unique_ptr <TxQ> txQ_;
|
||||||
beast::DeadlineTimer m_sweepTimer;
|
DeadlineTimer m_sweepTimer;
|
||||||
beast::DeadlineTimer m_entropyTimer;
|
DeadlineTimer m_entropyTimer;
|
||||||
|
|
||||||
std::unique_ptr <DatabaseCon> mTxnDB;
|
std::unique_ptr <DatabaseCon> mTxnDB;
|
||||||
std::unique_ptr <DatabaseCon> mLedgerDB;
|
std::unique_ptr <DatabaseCon> mLedgerDB;
|
||||||
std::unique_ptr <DatabaseCon> mWalletDB;
|
std::unique_ptr <DatabaseCon> mWalletDB;
|
||||||
std::unique_ptr <Overlay> m_overlay;
|
std::unique_ptr <Overlay> m_overlay;
|
||||||
std::vector <std::unique_ptr<beast::Stoppable>> websocketServers_;
|
std::vector <std::unique_ptr<Stoppable>> websocketServers_;
|
||||||
|
|
||||||
boost::asio::signal_set m_signals;
|
boost::asio::signal_set m_signals;
|
||||||
beast::WaitableEvent m_stop;
|
beast::WaitableEvent m_stop;
|
||||||
@@ -869,7 +869,7 @@ public:
|
|||||||
std::exit(code);
|
std::exit(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onDeadlineTimer (beast::DeadlineTimer& timer) override
|
void onDeadlineTimer (DeadlineTimer& timer) override
|
||||||
{
|
{
|
||||||
if (timer == m_entropyTimer)
|
if (timer == m_entropyTimer)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
#include <ripple/shamap/TreeNodeCache.h>
|
#include <ripple/shamap/TreeNodeCache.h>
|
||||||
#include <ripple/basics/TaggedCache.h>
|
#include <ripple/basics/TaggedCache.h>
|
||||||
#include <ripple/core/Config.h>
|
#include <ripple/core/Config.h>
|
||||||
#include <beast/utility/PropertyStream.h>
|
#include <ripple/beast/utility/PropertyStream.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
#include <BeastConfig.h>
|
#include <BeastConfig.h>
|
||||||
#include <ripple/app/main/BasicApp.h>
|
#include <ripple/app/main/BasicApp.h>
|
||||||
#include <beast/threads/Thread.h>
|
#include <ripple/beast/core/Thread.h>
|
||||||
|
|
||||||
BasicApp::BasicApp(std::size_t numberOfThreads)
|
BasicApp::BasicApp(std::size_t numberOfThreads)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
#define RIPPLE_APP_MAIN_COLLECTORMANAGER_H_INCLUDED
|
#define RIPPLE_APP_MAIN_COLLECTORMANAGER_H_INCLUDED
|
||||||
|
|
||||||
#include <ripple/basics/BasicConfig.h>
|
#include <ripple/basics/BasicConfig.h>
|
||||||
#include <beast/Insight.h>
|
#include <ripple/beast/insight/Insight.h>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
#include <ripple/basics/UptimeTimer.h>
|
#include <ripple/basics/UptimeTimer.h>
|
||||||
#include <ripple/core/LoadFeeTrack.h>
|
#include <ripple/core/LoadFeeTrack.h>
|
||||||
#include <ripple/json/to_string.h>
|
#include <ripple/json/to_string.h>
|
||||||
#include <beast/threads/Thread.h>
|
#include <ripple/beast/core/Thread.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
@@ -201,7 +201,7 @@ void LoadManager::run ()
|
|||||||
|
|
||||||
std::unique_ptr<LoadManager>
|
std::unique_ptr<LoadManager>
|
||||||
make_LoadManager (Application& app,
|
make_LoadManager (Application& app,
|
||||||
beast::Stoppable& parent, beast::Journal journal)
|
Stoppable& parent, beast::Journal journal)
|
||||||
{
|
{
|
||||||
return std::make_unique<LoadManager>(app, parent, journal);
|
return std::make_unique<LoadManager>(app, parent, journal);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
#ifndef RIPPLE_APP_MAIN_LOADMANAGER_H_INCLUDED
|
#ifndef RIPPLE_APP_MAIN_LOADMANAGER_H_INCLUDED
|
||||||
#define RIPPLE_APP_MAIN_LOADMANAGER_H_INCLUDED
|
#define RIPPLE_APP_MAIN_LOADMANAGER_H_INCLUDED
|
||||||
|
|
||||||
#include <beast/threads/Stoppable.h>
|
#include <ripple/core/Stoppable.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
@@ -40,7 +40,7 @@ class Application;
|
|||||||
The warning system is used instead of merely dropping, because hostile
|
The warning system is used instead of merely dropping, because hostile
|
||||||
peers can just reconnect anyway.
|
peers can just reconnect anyway.
|
||||||
*/
|
*/
|
||||||
class LoadManager : public beast::Stoppable
|
class LoadManager : public Stoppable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// It would be better if the LoadManager constructor could be private
|
// It would be better if the LoadManager constructor could be private
|
||||||
@@ -112,7 +112,7 @@ private:
|
|||||||
|
|
||||||
std::unique_ptr<LoadManager>
|
std::unique_ptr<LoadManager>
|
||||||
make_LoadManager (
|
make_LoadManager (
|
||||||
Application& app, beast::Stoppable& parent, beast::Journal journal);
|
Application& app, Stoppable& parent, beast::Journal journal);
|
||||||
|
|
||||||
} // ripple
|
} // ripple
|
||||||
|
|
||||||
|
|||||||
@@ -36,10 +36,10 @@
|
|||||||
#include <ripple/rpc/RPCHandler.h>
|
#include <ripple/rpc/RPCHandler.h>
|
||||||
#include <ripple/server/Role.h>
|
#include <ripple/server/Role.h>
|
||||||
#include <ripple/protocol/BuildInfo.h>
|
#include <ripple/protocol/BuildInfo.h>
|
||||||
#include <beast/chrono/basic_seconds_clock.h>
|
#include <beast/clock/basic_seconds_clock.h>
|
||||||
#include <beast/module/core/time/Time.h>
|
#include <ripple/beast/core/Time.h>
|
||||||
#include <beast/unit_test.h>
|
#include <beast/unit_test.h>
|
||||||
#include <beast/utility/Debug.h>
|
#include <ripple/beast/utility/Debug.h>
|
||||||
#include <beast/streams/debug_ostream.h>
|
#include <beast/streams/debug_ostream.h>
|
||||||
#include <google/protobuf/stubs/common.h>
|
#include <google/protobuf/stubs/common.h>
|
||||||
#include <boost/program_options.hpp>
|
#include <boost/program_options.hpp>
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include <ripple/nodestore/Scheduler.h>
|
#include <ripple/nodestore/Scheduler.h>
|
||||||
#include <ripple/core/JobQueue.h>
|
#include <ripple/core/JobQueue.h>
|
||||||
#include <beast/threads/Stoppable.h>
|
#include <ripple/core/Stoppable.h>
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
@@ -30,7 +30,7 @@ namespace ripple {
|
|||||||
/** A NodeStore::Scheduler which uses the JobQueue and implements the Stoppable API. */
|
/** A NodeStore::Scheduler which uses the JobQueue and implements the Stoppable API. */
|
||||||
class NodeStoreScheduler
|
class NodeStoreScheduler
|
||||||
: public NodeStore::Scheduler
|
: public NodeStore::Scheduler
|
||||||
, public beast::Stoppable
|
, public Stoppable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NodeStoreScheduler (Stoppable& parent);
|
NodeStoreScheduler (Stoppable& parent);
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
#include <ripple/app/main/Application.h>
|
#include <ripple/app/main/Application.h>
|
||||||
#include <ripple/app/misc/Validations.h>
|
#include <ripple/app/misc/Validations.h>
|
||||||
#include <ripple/basics/BasicConfig.h>
|
#include <ripple/basics/BasicConfig.h>
|
||||||
#include <beast/utility/Journal.h>
|
#include <ripple/beast/utility/Journal.h>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
#include <ripple/basics/chrono.h>
|
#include <ripple/basics/chrono.h>
|
||||||
#include <ripple/basics/CountedObject.h>
|
#include <ripple/basics/CountedObject.h>
|
||||||
#include <ripple/basics/UnorderedContainers.h>
|
#include <ripple/basics/UnorderedContainers.h>
|
||||||
#include <beast/container/aged_unordered_map.h>
|
#include <ripple/beast/container/aged_unordered_map.h>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
|
|||||||
@@ -51,6 +51,7 @@
|
|||||||
#include <ripple/basics/UptimeTimer.h>
|
#include <ripple/basics/UptimeTimer.h>
|
||||||
#include <ripple/protocol/JsonFields.h>
|
#include <ripple/protocol/JsonFields.h>
|
||||||
#include <ripple/core/Config.h>
|
#include <ripple/core/Config.h>
|
||||||
|
#include <ripple/core/DeadlineTimer.h>
|
||||||
#include <ripple/core/LoadFeeTrack.h>
|
#include <ripple/core/LoadFeeTrack.h>
|
||||||
#include <ripple/core/TimeKeeper.h>
|
#include <ripple/core/TimeKeeper.h>
|
||||||
#include <ripple/crypto/csprng.h>
|
#include <ripple/crypto/csprng.h>
|
||||||
@@ -67,11 +68,10 @@
|
|||||||
#include <ripple/resource/Fees.h>
|
#include <ripple/resource/Fees.h>
|
||||||
#include <ripple/resource/Gossip.h>
|
#include <ripple/resource/Gossip.h>
|
||||||
#include <ripple/resource/ResourceManager.h>
|
#include <ripple/resource/ResourceManager.h>
|
||||||
#include <beast/module/core/text/LexicalCast.h>
|
#include <ripple/beast/core/LexicalCast.h>
|
||||||
#include <beast/module/core/thread/DeadlineTimer.h>
|
#include <ripple/beast/core/SystemStats.h>
|
||||||
#include <beast/module/core/system/SystemStats.h>
|
#include <ripple/beast/utility/rngfill.h>
|
||||||
#include <beast/rngfill.h>
|
#include <ripple/basics/make_lock.h>
|
||||||
#include <beast/utility/make_lock.h>
|
|
||||||
#include <boost/optional.hpp>
|
#include <boost/optional.hpp>
|
||||||
#include <condition_variable>
|
#include <condition_variable>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@@ -82,7 +82,7 @@ namespace ripple {
|
|||||||
|
|
||||||
class NetworkOPsImp final
|
class NetworkOPsImp final
|
||||||
: public NetworkOPs
|
: public NetworkOPs
|
||||||
, public beast::DeadlineTimer::Listener
|
, public DeadlineTimer::Listener
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Transaction with input flags and results to be applied in batches.
|
* Transaction with input flags and results to be applied in batches.
|
||||||
@@ -474,7 +474,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
void setHeartbeatTimer ();
|
void setHeartbeatTimer ();
|
||||||
void setClusterTimer ();
|
void setClusterTimer ();
|
||||||
void onDeadlineTimer (beast::DeadlineTimer& timer) override;
|
void onDeadlineTimer (DeadlineTimer& timer) override;
|
||||||
void processHeartbeatTimer ();
|
void processHeartbeatTimer ();
|
||||||
void processClusterTimer ();
|
void processClusterTimer ();
|
||||||
|
|
||||||
@@ -518,8 +518,8 @@ private:
|
|||||||
std::atomic <bool> mNeedNetworkLedger;
|
std::atomic <bool> mNeedNetworkLedger;
|
||||||
bool m_amendmentBlocked;
|
bool m_amendmentBlocked;
|
||||||
|
|
||||||
beast::DeadlineTimer m_heartbeatTimer;
|
DeadlineTimer m_heartbeatTimer;
|
||||||
beast::DeadlineTimer m_clusterTimer;
|
DeadlineTimer m_clusterTimer;
|
||||||
|
|
||||||
std::unique_ptr<Consensus> mConsensus;
|
std::unique_ptr<Consensus> mConsensus;
|
||||||
std::shared_ptr<LedgerConsensus> mLedgerConsensus;
|
std::shared_ptr<LedgerConsensus> mLedgerConsensus;
|
||||||
@@ -623,7 +623,7 @@ void NetworkOPsImp::setClusterTimer ()
|
|||||||
m_clusterTimer.setExpiration (10.0);
|
m_clusterTimer.setExpiration (10.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkOPsImp::onDeadlineTimer (beast::DeadlineTimer& timer)
|
void NetworkOPsImp::onDeadlineTimer (DeadlineTimer& timer)
|
||||||
{
|
{
|
||||||
if (timer == m_heartbeatTimer)
|
if (timer == m_heartbeatTimer)
|
||||||
{
|
{
|
||||||
@@ -640,7 +640,7 @@ void NetworkOPsImp::onDeadlineTimer (beast::DeadlineTimer& timer)
|
|||||||
void NetworkOPsImp::processHeartbeatTimer ()
|
void NetworkOPsImp::processHeartbeatTimer ()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
auto lock = beast::make_lock(app_.getMasterMutex());
|
auto lock = make_lock(app_.getMasterMutex());
|
||||||
|
|
||||||
// VFALCO NOTE This is for diagnosing a crash on exit
|
// VFALCO NOTE This is for diagnosing a crash on exit
|
||||||
LoadManager& mgr (app_.getLoadManager ());
|
LoadManager& mgr (app_.getLoadManager ());
|
||||||
@@ -931,7 +931,7 @@ void NetworkOPsImp::apply (std::unique_lock<std::mutex>& batchLock)
|
|||||||
batchLock.unlock();
|
batchLock.unlock();
|
||||||
|
|
||||||
{
|
{
|
||||||
auto lock = beast::make_lock(app_.getMasterMutex());
|
auto lock = make_lock(app_.getMasterMutex());
|
||||||
{
|
{
|
||||||
std::lock_guard <std::recursive_mutex> lock (
|
std::lock_guard <std::recursive_mutex> lock (
|
||||||
m_ledgerMaster.peekMutex());
|
m_ledgerMaster.peekMutex());
|
||||||
@@ -3168,7 +3168,7 @@ std::unique_ptr<NetworkOPs>
|
|||||||
make_NetworkOPs (Application& app, NetworkOPs::clock_type& clock, bool standalone,
|
make_NetworkOPs (Application& app, NetworkOPs::clock_type& clock, bool standalone,
|
||||||
std::size_t network_quorum, bool startvalid,
|
std::size_t network_quorum, bool startvalid,
|
||||||
JobQueue& job_queue, LedgerMaster& ledgerMaster,
|
JobQueue& job_queue, LedgerMaster& ledgerMaster,
|
||||||
beast::Stoppable& parent, beast::Journal journal)
|
Stoppable& parent, beast::Journal journal)
|
||||||
{
|
{
|
||||||
return std::make_unique<NetworkOPsImp> (app, clock, standalone, network_quorum,
|
return std::make_unique<NetworkOPsImp> (app, clock, standalone, network_quorum,
|
||||||
startvalid, job_queue, ledgerMaster, parent, journal);
|
startvalid, job_queue, ledgerMaster, parent, journal);
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
#include <ripple/ledger/ReadView.h>
|
#include <ripple/ledger/ReadView.h>
|
||||||
#include <ripple/net/InfoSub.h>
|
#include <ripple/net/InfoSub.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <beast/threads/Stoppable.h>
|
#include <ripple/core/Stoppable.h>
|
||||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
@@ -243,7 +243,7 @@ std::unique_ptr<NetworkOPs>
|
|||||||
make_NetworkOPs (Application& app, NetworkOPs::clock_type& clock, bool standalone,
|
make_NetworkOPs (Application& app, NetworkOPs::clock_type& clock, bool standalone,
|
||||||
std::size_t network_quorum, bool start_valid,
|
std::size_t network_quorum, bool start_valid,
|
||||||
JobQueue& job_queue, LedgerMaster& ledgerMaster,
|
JobQueue& job_queue, LedgerMaster& ledgerMaster,
|
||||||
beast::Stoppable& parent, beast::Journal journal);
|
Stoppable& parent, beast::Journal journal);
|
||||||
|
|
||||||
} // ripple
|
} // ripple
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user