Remove unused or obsolete classes and files

This commit is contained in:
Vinnie Falco
2016-04-11 05:32:30 -04:00
parent d60426a19f
commit db8fb177b8
222 changed files with 108 additions and 34423 deletions

2
.gitignore vendored
View File

@@ -1,4 +1,4 @@
Docs
docs/
._*
*.mode1v3
*.pbxuser

302
Doxyfile
View File

@@ -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

View File

@@ -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'))

View File

@@ -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.
*/
//==============================================================================
#ifndef BEAST_BOOST_H_INCLUDED
#define BEAST_BOOST_H_INCLUDED
// These classes require boost in order to be used.
#include <beast/boost/ErrorCode.h>
#endif

View File

@@ -1,298 +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_BYTEORDER_H_INCLUDED
#define BEAST_BYTEORDER_H_INCLUDED
#include <beast/Config.h>
#include <cstdint>
namespace beast {
//==============================================================================
/** Contains static methods for converting the byte order between different
endiannesses.
*/
class ByteOrder
{
public:
//==============================================================================
/** Swaps the upper and lower bytes of a 16-bit integer. */
static std::uint16_t swap (std::uint16_t value);
/** Reverses the order of the 4 bytes in a 32-bit integer. */
static std::uint32_t swap (std::uint32_t value);
/** Reverses the order of the 8 bytes in a 64-bit integer. */
static std::uint64_t swap (std::uint64_t value);
//==============================================================================
/** Swaps the byte order of a 16-bit int if the CPU is big-endian */
static std::uint16_t swapIfBigEndian (std::uint16_t value);
/** Swaps the byte order of a 32-bit int if the CPU is big-endian */
static std::uint32_t swapIfBigEndian (std::uint32_t value);
/** Swaps the byte order of a 64-bit int if the CPU is big-endian */
static std::uint64_t swapIfBigEndian (std::uint64_t value);
/** Swaps the byte order of a 16-bit int if the CPU is little-endian */
static std::uint16_t swapIfLittleEndian (std::uint16_t value);
/** Swaps the byte order of a 32-bit int if the CPU is little-endian */
static std::uint32_t swapIfLittleEndian (std::uint32_t value);
/** Swaps the byte order of a 64-bit int if the CPU is little-endian */
static std::uint64_t swapIfLittleEndian (std::uint64_t value);
//==============================================================================
/** Turns 2 bytes into a little-endian integer. */
static std::uint16_t littleEndianShort (const void* bytes);
/** Turns 4 bytes into a little-endian integer. */
static std::uint32_t littleEndianInt (const void* bytes);
/** Turns 4 bytes into a little-endian integer. */
static std::uint64_t littleEndianInt64 (const void* bytes);
/** Turns 2 bytes into a big-endian integer. */
static std::uint16_t bigEndianShort (const void* bytes);
/** Turns 4 bytes into a big-endian integer. */
static std::uint32_t bigEndianInt (const void* bytes);
/** Turns 4 bytes into a big-endian integer. */
static std::uint64_t bigEndianInt64 (const void* bytes);
//==============================================================================
/** Converts 3 little-endian bytes into a signed 24-bit value (which is sign-extended to 32 bits). */
static int littleEndian24Bit (const char* bytes);
/** Converts 3 big-endian bytes into a signed 24-bit value (which is sign-extended to 32 bits). */
static int bigEndian24Bit (const char* bytes);
/** Copies a 24-bit number to 3 little-endian bytes. */
static void littleEndian24BitToChars (int value, char* destBytes);
/** Copies a 24-bit number to 3 big-endian bytes. */
static void bigEndian24BitToChars (int value, char* destBytes);
//==============================================================================
/** Returns true if the current CPU is big-endian. */
static bool isBigEndian();
private:
ByteOrder();
ByteOrder(ByteOrder const&) = delete;
ByteOrder& operator= (ByteOrder const&) = delete;
};
//==============================================================================
#if BEAST_USE_INTRINSICS && ! defined (__INTEL_COMPILER)
#pragma intrinsic (_byteswap_ulong)
#endif
inline std::uint16_t ByteOrder::swap (std::uint16_t n)
{
#if BEAST_USE_INTRINSICSxxx // agh - the MS compiler has an internal error when you try to use this intrinsic!
return static_cast <std::uint16_t> (_byteswap_ushort (n));
#else
return static_cast <std::uint16_t> ((n << 8) | (n >> 8));
#endif
}
inline std::uint32_t ByteOrder::swap (std::uint32_t n)
{
#if BEAST_MAC || BEAST_IOS
return OSSwapInt32 (n);
#elif BEAST_GCC && BEAST_INTEL && ! BEAST_NO_INLINE_ASM
asm("bswap %%eax" : "=a"(n) : "a"(n));
return n;
#elif BEAST_USE_INTRINSICS
return _byteswap_ulong (n);
#elif BEAST_MSVC && ! BEAST_NO_INLINE_ASM
__asm {
mov eax, n
bswap eax
mov n, eax
}
return n;
#elif BEAST_ANDROID
return bswap_32 (n);
#else
return (n << 24) | (n >> 24) | ((n & 0xff00) << 8) | ((n & 0xff0000) >> 8);
#endif
}
inline std::uint64_t ByteOrder::swap (std::uint64_t value)
{
#if BEAST_MAC || BEAST_IOS
return OSSwapInt64 (value);
#elif BEAST_USE_INTRINSICS
return _byteswap_uint64 (value);
#else
return (((std::int64_t) swap ((std::uint32_t) value)) << 32) | swap ((std::uint32_t) (value >> 32));
#endif
}
#if BEAST_LITTLE_ENDIAN
inline std::uint16_t ByteOrder::swapIfBigEndian (const std::uint16_t v) { return v; }
inline std::uint32_t ByteOrder::swapIfBigEndian (const std::uint32_t v) { return v; }
inline std::uint64_t ByteOrder::swapIfBigEndian (const std::uint64_t v) { return v; }
inline std::uint16_t ByteOrder::swapIfLittleEndian (const std::uint16_t v) { return swap (v); }
inline std::uint32_t ByteOrder::swapIfLittleEndian (const std::uint32_t v) { return swap (v); }
inline std::uint64_t ByteOrder::swapIfLittleEndian (const std::uint64_t v) { return swap (v); }
inline std::uint16_t ByteOrder::littleEndianShort (const void* const bytes) { return *static_cast <const std::uint16_t*> (bytes); }
inline std::uint32_t ByteOrder::littleEndianInt (const void* const bytes) { return *static_cast <const std::uint32_t*> (bytes); }
inline std::uint64_t ByteOrder::littleEndianInt64 (const void* const bytes) { return *static_cast <const std::uint64_t*> (bytes); }
inline std::uint16_t ByteOrder::bigEndianShort (const void* const bytes) { return swap (*static_cast <const std::uint16_t*> (bytes)); }
inline std::uint32_t ByteOrder::bigEndianInt (const void* const bytes) { return swap (*static_cast <const std::uint32_t*> (bytes)); }
inline std::uint64_t ByteOrder::bigEndianInt64 (const void* const bytes) { return swap (*static_cast <const std::uint64_t*> (bytes)); }
inline bool ByteOrder::isBigEndian() { return false; }
#else
inline std::uint16_t ByteOrder::swapIfBigEndian (const std::uint16_t v) { return swap (v); }
inline std::uint32_t ByteOrder::swapIfBigEndian (const std::uint32_t v) { return swap (v); }
inline std::uint64_t ByteOrder::swapIfBigEndian (const std::uint64_t v) { return swap (v); }
inline std::uint16_t ByteOrder::swapIfLittleEndian (const std::uint16_t v) { return v; }
inline std::uint32_t ByteOrder::swapIfLittleEndian (const std::uint32_t v) { return v; }
inline std::uint64_t ByteOrder::swapIfLittleEndian (const std::uint64_t v) { return v; }
inline std::uint32_t ByteOrder::littleEndianInt (const void* const bytes) { return swap (*static_cast <const std::uint32_t*> (bytes)); }
inline std::uint16_t ByteOrder::littleEndianShort (const void* const bytes) { return swap (*static_cast <const std::uint16_t*> (bytes)); }
inline std::uint16_t ByteOrder::bigEndianShort (const void* const bytes) { return *static_cast <const std::uint16_t*> (bytes); }
inline std::uint32_t ByteOrder::bigEndianInt (const void* const bytes) { return *static_cast <const std::uint32_t*> (bytes); }
inline std::uint64_t ByteOrder::bigEndianInt64 (const void* const bytes) { return *static_cast <const std::uint64_t*> (bytes); }
inline bool ByteOrder::isBigEndian() { return true; }
#endif
inline int ByteOrder::littleEndian24Bit (const char* const bytes) { return (((int) bytes[2]) << 16) | (((int) (std::uint8_t) bytes[1]) << 8) | ((int) (std::uint8_t) bytes[0]); }
inline int ByteOrder::bigEndian24Bit (const char* const bytes) { return (((int) bytes[0]) << 16) | (((int) (std::uint8_t) bytes[1]) << 8) | ((int) (std::uint8_t) bytes[2]); }
inline void ByteOrder::littleEndian24BitToChars (const int value, char* const destBytes) { destBytes[0] = (char)(value & 0xff); destBytes[1] = (char)((value >> 8) & 0xff); destBytes[2] = (char)((value >> 16) & 0xff); }
inline void ByteOrder::bigEndian24BitToChars (const int value, char* const destBytes) { destBytes[0] = (char)((value >> 16) & 0xff); destBytes[1] = (char)((value >> 8) & 0xff); destBytes[2] = (char)(value & 0xff); }
namespace detail
{
/** Specialized helper class template for swapping bytes.
Normally you won't use this directly, use the helper function
byteSwap instead. You can specialize this class for your
own user defined types, as was done for uint24.
@see swapBytes, uint24
*/
template <typename IntegralType>
struct SwapBytes
{
inline IntegralType operator() (IntegralType value) const noexcept
{
return ByteOrder::swap (value);
}
};
// Specializations for signed integers
template <>
struct SwapBytes <std::int16_t>
{
inline std::int16_t operator() (std::int16_t value) const noexcept
{
return static_cast <std::int16_t> (ByteOrder::swap (static_cast <std::uint16_t> (value)));
}
};
template <>
struct SwapBytes <std::int32_t>
{
inline std::int32_t operator() (std::int32_t value) const noexcept
{
return static_cast <std::int32_t> (ByteOrder::swap (static_cast <std::uint32_t> (value)));
}
};
template <>
struct SwapBytes <std::int64_t>
{
inline std::int64_t operator() (std::int64_t value) const noexcept
{
return static_cast <std::int64_t> (ByteOrder::swap (static_cast <std::uint64_t> (value)));
}
};
}
//------------------------------------------------------------------------------
/** Returns a type with the bytes swapped.
Little endian becomes big endian and vice versa. The underlying
type must be an integral type or behave like one.
*/
template <class IntegralType>
inline IntegralType swapBytes (IntegralType value) noexcept
{
return detail::SwapBytes <IntegralType> () (value);
}
/** Returns the machine byte-order value to little-endian byte order. */
template <typename IntegralType>
inline IntegralType toLittleEndian (IntegralType value) noexcept
{
#if BEAST_LITTLE_ENDIAN
return value;
#else
return swapBytes (value);
#endif
}
/** Returns the machine byte-order value to big-endian byte order. */
template <typename IntegralType>
inline IntegralType toBigEndian (IntegralType value) noexcept
{
#if BEAST_LITTLE_ENDIAN
return swapBytes (value);
#else
return value;
#endif
}
/** Returns the machine byte-order value to network byte order. */
template <typename IntegralType>
inline IntegralType toNetworkByteOrder (IntegralType value) noexcept
{
return toBigEndian (value);
}
/** Converts from network byte order to machine byte order. */
template <typename IntegralType>
inline IntegralType fromNetworkByteOrder (IntegralType value) noexcept
{
#if BEAST_LITTLE_ENDIAN
return swapBytes (value);
#else
return value;
#endif
}
}
#endif

View File

@@ -1,31 +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_CHRONO_H_INCLUDED
#define BEAST_CHRONO_H_INCLUDED
#include <beast/chrono/abstract_clock.h>
#include <beast/chrono/basic_seconds_clock.h>
#include <beast/chrono/chrono_util.h>
#include <beast/chrono/manual_clock.h>
#include <beast/chrono/ratio_io.h>
#include <beast/chrono/RelativeTime.h>
#endif

View File

@@ -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

View File

@@ -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.
*/
//==============================================================================
#ifndef BEAST_CRYPTO_H_INCLUDED
#define BEAST_CRYPTO_H_INCLUDED
#include <beast/crypto/Sha256.h>
#endif

View File

@@ -1,360 +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_HEAPBLOCK_H_INCLUDED
#define BEAST_HEAPBLOCK_H_INCLUDED
#include <cstddef>
#include <cstdlib>
#include <stdexcept>
#include <beast/Memory.h>
// If the MSVC debug heap headers were included, disable
// the macros during the juce include since they conflict.
#ifdef _CRTDBG_MAP_ALLOC
#pragma push_macro("calloc")
#pragma push_macro("free")
#pragma push_macro("malloc")
#pragma push_macro("realloc")
#pragma push_macro("_recalloc")
#pragma push_macro("_aligned_free")
#pragma push_macro("_aligned_malloc")
#pragma push_macro("_aligned_offset_malloc")
#pragma push_macro("_aligned_realloc")
#pragma push_macro("_aligned_recalloc")
#pragma push_macro("_aligned_offset_realloc")
#pragma push_macro("_aligned_offset_recalloc")
#pragma push_macro("_aligned_msize")
#undef calloc
#undef free
#undef malloc
#undef realloc
#undef _recalloc
#undef _aligned_free
#undef _aligned_malloc
#undef _aligned_offset_malloc
#undef _aligned_realloc
#undef _aligned_recalloc
#undef _aligned_offset_realloc
#undef _aligned_offset_recalloc
#undef _aligned_msize
#endif
namespace beast {
#ifndef DOXYGEN
namespace HeapBlockHelper
{
template <bool shouldThrow>
struct ThrowOnFail { static void check (void*) {} };
template<>
struct ThrowOnFail <true> { static void check (void* data) { if (data == nullptr) throw std::bad_alloc(); } };
}
#endif
//==============================================================================
/**
Very simple container class to hold a pointer to some data on the heap.
When you need to allocate some heap storage for something, always try to use
this class instead of allocating the memory directly using malloc/free.
A HeapBlock<char> object can be treated in pretty much exactly the same way
as an char*, but as long as you allocate it on the stack or as a class member,
it's almost impossible for it to leak memory.
It also makes your code much more concise and readable than doing the same thing
using direct allocations,
E.g. instead of this:
@code
int* temp = (int*) malloc (1024 * sizeof (int));
memcpy (temp, xyz, 1024 * sizeof (int));
free (temp);
temp = (int*) calloc (2048 * sizeof (int));
temp[0] = 1234;
memcpy (foobar, temp, 2048 * sizeof (int));
free (temp);
@endcode
..you could just write this:
@code
HeapBlock <int> temp (1024);
memcpy (temp, xyz, 1024 * sizeof (int));
temp.calloc (2048);
temp[0] = 1234;
memcpy (foobar, temp, 2048 * sizeof (int));
@endcode
The class is extremely lightweight, containing only a pointer to the
data, and exposes malloc/realloc/calloc/free methods that do the same jobs
as their less object-oriented counterparts. Despite adding safety, you probably
won't sacrifice any performance by using this in place of normal pointers.
The throwOnFailure template parameter can be set to true if you'd like the class
to throw a std::bad_alloc exception when an allocation fails. If this is false,
then a failed allocation will just leave the heapblock with a null pointer (assuming
that the system's malloc() function doesn't throw).
@see Array, MemoryBlock
*/
template <class ElementType, bool throwOnFailure = false>
class HeapBlock
{
public:
//==============================================================================
/** Creates a HeapBlock which is initially just a null pointer.
After creation, you can resize the array using the malloc(), calloc(),
or realloc() methods.
*/
HeapBlock() noexcept
: data (nullptr)
{
}
/** Creates a HeapBlock containing a number of elements.
The contents of the block are undefined, as it will have been created by a
malloc call.
If you want an array of zero values, you can use the calloc() method or the
other constructor that takes an InitialisationState parameter.
*/
explicit HeapBlock (const size_t numElements)
: data (static_cast <ElementType*> (std::malloc (numElements * sizeof (ElementType))))
{
throwOnAllocationFailure();
}
/** Creates a HeapBlock containing a number of elements.
The initialiseToZero parameter determines whether the new memory should be cleared,
or left uninitialised.
*/
HeapBlock (const size_t numElements, const bool initialiseToZero)
: data (static_cast <ElementType*> (initialiseToZero
? std::calloc (numElements, sizeof (ElementType))
: std::malloc (numElements * sizeof (ElementType))))
{
throwOnAllocationFailure();
}
HeapBlock(HeapBlock const&) = delete;
HeapBlock& operator= (HeapBlock const&) = delete;
/** Destructor.
This will free the data, if any has been allocated.
*/
~HeapBlock()
{
std::free (data);
}
#if BEAST_COMPILER_SUPPORTS_MOVE_SEMANTICS
HeapBlock (HeapBlock&& other) noexcept
: data (other.data)
{
other.data = nullptr;
}
HeapBlock& operator= (HeapBlock&& other) noexcept
{
std::swap (data, other.data);
return *this;
}
#endif
//==============================================================================
/** Returns a raw pointer to the allocated data.
This may be a null pointer if the data hasn't yet been allocated, or if it has been
freed by calling the free() method.
*/
inline operator ElementType*() const noexcept { return data; }
/** Returns a raw pointer to the allocated data.
This may be a null pointer if the data hasn't yet been allocated, or if it has been
freed by calling the free() method.
*/
inline ElementType* getData() const noexcept { return data; }
/** Returns a void pointer to the allocated data.
This may be a null pointer if the data hasn't yet been allocated, or if it has been
freed by calling the free() method.
*/
inline operator void*() const noexcept { return static_cast <void*> (data); }
/** Returns a void pointer to the allocated data.
This may be a null pointer if the data hasn't yet been allocated, or if it has been
freed by calling the free() method.
*/
inline operator const void*() const noexcept { return static_cast <const void*> (data); }
/** Lets you use indirect calls to the first element in the array.
Obviously this will cause problems if the array hasn't been initialised, because it'll
be referencing a null pointer.
*/
inline ElementType* operator->() const noexcept { return data; }
/** Returns a reference to one of the data elements.
Obviously there's no bounds-checking here, as this object is just a dumb pointer and
has no idea of the size it currently has allocated.
*/
template <typename IndexType>
inline ElementType& operator[] (IndexType index) const noexcept { return data [index]; }
/** Returns a pointer to a data element at an offset from the start of the array.
This is the same as doing pointer arithmetic on the raw pointer itself.
*/
template <typename IndexType>
inline ElementType* operator+ (IndexType index) const noexcept { return data + index; }
//==============================================================================
/** Compares the pointer with another pointer.
This can be handy for checking whether this is a null pointer.
*/
inline bool operator== (const ElementType* const otherPointer) const noexcept { return otherPointer == data; }
/** Compares the pointer with another pointer.
This can be handy for checking whether this is a null pointer.
*/
inline bool operator!= (const ElementType* const otherPointer) const noexcept { return otherPointer != data; }
//==============================================================================
/** Allocates a specified amount of memory.
This uses the normal malloc to allocate an amount of memory for this object.
Any previously allocated memory will be freed by this method.
The number of bytes allocated will be (newNumElements * elementSize). Normally
you wouldn't need to specify the second parameter, but it can be handy if you need
to allocate a size in bytes rather than in terms of the number of elements.
The data that is allocated will be freed when this object is deleted, or when you
call free() or any of the allocation methods.
*/
void malloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType))
{
std::free (data);
data = static_cast <ElementType*> (std::malloc (newNumElements * elementSize));
throwOnAllocationFailure();
}
/** Allocates a specified amount of memory and clears it.
This does the same job as the malloc() method, but clears the memory that it allocates.
*/
void calloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType))
{
std::free (data);
data = static_cast <ElementType*> (std::calloc (newNumElements, elementSize));
throwOnAllocationFailure();
}
/** Allocates a specified amount of memory and optionally clears it.
This does the same job as either malloc() or calloc(), depending on the
initialiseToZero parameter.
*/
void allocate (const size_t newNumElements, bool initialiseToZero)
{
std::free (data);
data = static_cast <ElementType*> (initialiseToZero
? std::calloc (newNumElements, sizeof (ElementType))
: std::malloc (newNumElements * sizeof (ElementType)));
throwOnAllocationFailure();
}
/** Re-allocates a specified amount of memory.
The semantics of this method are the same as malloc() and calloc(), but it
uses realloc() to keep as much of the existing data as possible.
*/
void reallocate (const size_t newNumElements, const size_t elementSize = sizeof (ElementType))
{
data = static_cast <ElementType*> (data == nullptr ? std::malloc (newNumElements * elementSize)
: std::realloc (data, newNumElements * elementSize));
throwOnAllocationFailure();
}
/** Frees any currently-allocated data.
This will free the data and reset this object to be a null pointer.
*/
void free_up()
{
std::free (data);
data = nullptr;
}
/** Swaps this object's data with the data of another HeapBlock.
The two objects simply exchange their data pointers.
*/
template <bool otherBlockThrows>
void swapWith (HeapBlock <ElementType, otherBlockThrows>& other) noexcept
{
std::swap (data, other.data);
}
/** This fills the block with zeros, up to the number of elements specified.
Since the block has no way of knowing its own size, you must make sure that the number of
elements you specify doesn't exceed the allocated size.
*/
void clear (size_t numElements) noexcept
{
zeromem (data, sizeof (ElementType) * numElements);
}
/** This type alias can be used to get the type of the heapblock's elements. */
using Type = ElementType;
private:
//==============================================================================
ElementType* data;
void throwOnAllocationFailure() const
{
HeapBlockHelper::ThrowOnFail<throwOnFailure>::check (data);
}
};
}
#ifdef _CRTDBG_MAP_ALLOC
#pragma pop_macro("_aligned_msize")
#pragma pop_macro("_aligned_offset_recalloc")
#pragma pop_macro("_aligned_offset_realloc")
#pragma pop_macro("_aligned_recalloc")
#pragma pop_macro("_aligned_realloc")
#pragma pop_macro("_aligned_offset_malloc")
#pragma pop_macro("_aligned_malloc")
#pragma pop_macro("_aligned_free")
#pragma pop_macro("_recalloc")
#pragma pop_macro("realloc")
#pragma pop_macro("malloc")
#pragma pop_macro("free")
#pragma pop_macro("calloc")
#endif
#endif

View File

@@ -1,37 +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_INSIGHT_H_INCLUDED
#define BEAST_INSIGHT_H_INCLUDED
#include <beast/insight/Counter.h>
#include <beast/insight/CounterImpl.h>
#include <beast/insight/Event.h>
#include <beast/insight/EventImpl.h>
#include <beast/insight/Gauge.h>
#include <beast/insight/GaugeImpl.h>
#include <beast/insight/Group.h>
#include <beast/insight/Groups.h>
#include <beast/insight/Hook.h>
#include <beast/insight/HookImpl.h>
#include <beast/insight/Collector.h>
#include <beast/insight/NullCollector.h>
#include <beast/insight/StatsDCollector.h>
#endif

View File

@@ -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.
*/
//==============================================================================
#ifndef BEAST_INTRUSIVE_H_INCLUDED
#define BEAST_INTRUSIVE_H_INCLUDED
#include <beast/intrusive/List.h>
#include <beast/intrusive/LockFreeStack.h>
#endif

View File

@@ -1,81 +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_MEMORY_H_INCLUDED
#define BEAST_MEMORY_H_INCLUDED
#include <cstring>
#include <beast/Config.h>
namespace beast {
//==============================================================================
/** Fills a block of memory with zeros. */
inline void zeromem (void* memory, size_t numBytes) noexcept
{ memset (memory, 0, numBytes); }
/** Overwrites a structure or object with zeros. */
template <typename Type>
void zerostruct (Type& structure) noexcept
{ memset (&structure, 0, sizeof (structure)); }
//==============================================================================
#if BEAST_MAC || BEAST_IOS || DOXYGEN
/** A handy C++ wrapper that creates and deletes an NSAutoreleasePool object using RAII.
You should use the BEAST_AUTORELEASEPOOL macro to create a local auto-release pool on the stack.
*/
class ScopedAutoReleasePool
{
public:
ScopedAutoReleasePool();
~ScopedAutoReleasePool();
ScopedAutoReleasePool(ScopedAutoReleasePool const&) = delete;
ScopedAutoReleasePool& operator= (ScopedAutoReleasePool const&) = delete;
private:
void* pool;
};
/** A macro that can be used to easily declare a local ScopedAutoReleasePool
object for RAII-based obj-C autoreleasing.
Because this may use the \@autoreleasepool syntax, you must follow the macro with
a set of braces to mark the scope of the pool.
*/
#if (BEAST_COMPILER_SUPPORTS_ARC && defined (__OBJC__)) || DOXYGEN
#define BEAST_AUTORELEASEPOOL @autoreleasepool
#else
#define BEAST_AUTORELEASEPOOL const beast::ScopedAutoReleasePool BEAST_JOIN_MACRO (autoReleasePool_, __LINE__);
#endif
#else
#define BEAST_AUTORELEASEPOOL
#endif
}
#endif

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -21,7 +21,6 @@
#include <BeastConfig.h>
#endif
#include <beast/asio/impl/IPAddressConversion.cpp>
#include <beast/asio/impl/error.cpp>
#include <beast/asio/tests/bind_handler.test.cpp>
#include <beast/asio/tests/streambuf.test.cpp>

View File

@@ -1,68 +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_IPADDRESSCONVERSION_H_INCLUDED
#define BEAST_ASIO_IPADDRESSCONVERSION_H_INCLUDED
#include <beast/net/IPEndpoint.h>
#include <sstream>
#include <boost/asio.hpp>
namespace beast {
namespace IP {
/** Convert to Endpoint.
The port is set to zero.
*/
Endpoint from_asio (boost::asio::ip::address const& address);
/** Convert to Endpoint. */
Endpoint from_asio (boost::asio::ip::tcp::endpoint const& endpoint);
/** Convert to asio::ip::address.
The port is ignored.
*/
boost::asio::ip::address to_asio_address (Endpoint const& endpoint);
/** Convert to asio::ip::tcp::endpoint. */
boost::asio::ip::tcp::endpoint to_asio_endpoint (Endpoint const& endpoint);
}
}
namespace beast {
// DEPRECATED
struct IPAddressConversion
{
static IP::Endpoint from_asio (boost::asio::ip::address const& address)
{ return IP::from_asio (address); }
static IP::Endpoint from_asio (boost::asio::ip::tcp::endpoint const& endpoint)
{ return IP::from_asio (endpoint); }
static boost::asio::ip::address to_asio_address (IP::Endpoint const& address)
{ return IP::to_asio_address (address); }
static boost::asio::ip::tcp::endpoint to_asio_endpoint (IP::Endpoint const& address)
{ return IP::to_asio_endpoint (address); }
};
}
#endif

View File

@@ -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.

View File

@@ -1,67 +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/asio/IPAddressConversion.h>
namespace beast {
namespace IP {
Endpoint from_asio (boost::asio::ip::address const& address)
{
if (address.is_v4 ())
{
boost::asio::ip::address_v4::bytes_type const bytes (
address.to_v4().to_bytes());
return Endpoint (AddressV4 (
bytes [0], bytes [1], bytes [2], bytes [3]));
}
// VFALCO TODO IPv6 support
assert(false);
return Endpoint();
}
Endpoint from_asio (boost::asio::ip::tcp::endpoint const& endpoint)
{
return from_asio (endpoint.address()).at_port (endpoint.port());
}
boost::asio::ip::address to_asio_address (Endpoint const& endpoint)
{
if (endpoint.address().is_v4())
{
return boost::asio::ip::address (
boost::asio::ip::address_v4 (
endpoint.address().to_v4().value));
}
// VFALCO TODO IPv6 support
assert(false);
return boost::asio::ip::address (
boost::asio::ip::address_v6 ());
}
boost::asio::ip::tcp::endpoint to_asio_endpoint (Endpoint const& endpoint)
{
return boost::asio::ip::tcp::endpoint (
to_asio_address (endpoint), endpoint.port());
}
}
}

View File

@@ -20,7 +20,7 @@
#ifndef 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/intrusive/list.hpp>
#include <boost/iterator/transform_iterator.hpp>

View File

@@ -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

View File

@@ -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/boost/ErrorCode.h>
namespace detail {
// to squelch linker warnings
int boostUnusedVariable = 0;
}

View File

@@ -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

View File

@@ -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>

View File

@@ -1,190 +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_CHRONO_RELATIVETIME_H_INCLUDED
#define BEAST_CHRONO_RELATIVETIME_H_INCLUDED
#include <beast/Config.h>
#include <string>
#include <sstream>
namespace beast {
//==============================================================================
/** A relative measure of time.
The time is stored as a number of seconds, at double-precision floating
point accuracy, and may be positive or negative.
If you need an absolute time, (i.e. a date + time), see the Time class.
*/
class RelativeTime
{
public:
//==============================================================================
/** The underlying data type used by RelativeTime.
If you need to get to the underlying time and manipulate it
you can use this to declare a type that is guaranteed to
work cleanly.
*/
using value_type = double;
//==============================================================================
/** Creates a RelativeTime.
@param seconds the number of seconds, which may be +ve or -ve.
@see milliseconds, minutes, hours, days, weeks
*/
explicit RelativeTime (value_type seconds = 0.0) noexcept;
/** Copies another relative time. */
RelativeTime (const RelativeTime& other) noexcept;
/** Copies another relative time. */
RelativeTime& operator= (const RelativeTime& other) noexcept;
/** Destructor. */
~RelativeTime() noexcept;
bool isZero() const
{ return numSeconds == 0; }
bool isNotZero() const
{ return numSeconds != 0; }
/** Returns the amount of time since the process was started. */
static RelativeTime fromStartup ();
//==============================================================================
/** Creates a new RelativeTime object representing a number of milliseconds.
@see seconds, minutes, hours, days, weeks
*/
static RelativeTime milliseconds (int milliseconds) noexcept;
/** Creates a new RelativeTime object representing a number of milliseconds.
@see seconds, minutes, hours, days, weeks
*/
static RelativeTime milliseconds (std::int64_t milliseconds) noexcept;
/** Creates a new RelativeTime object representing a number of seconds.
@see milliseconds, minutes, hours, days, weeks
*/
static RelativeTime seconds (value_type seconds) noexcept;
/** Creates a new RelativeTime object representing a number of minutes.
@see milliseconds, hours, days, weeks
*/
static RelativeTime minutes (value_type numberOfMinutes) noexcept;
/** Creates a new RelativeTime object representing a number of hours.
@see milliseconds, minutes, days, weeks
*/
static RelativeTime hours (value_type numberOfHours) noexcept;
/** Creates a new RelativeTime object representing a number of days.
@see milliseconds, minutes, hours, weeks
*/
static RelativeTime days (value_type numberOfDays) noexcept;
/** Creates a new RelativeTime object representing a number of weeks.
@see milliseconds, minutes, hours, days
*/
static RelativeTime weeks (value_type numberOfWeeks) noexcept;
//==============================================================================
/** Returns the number of milliseconds this time represents.
@see milliseconds, inSeconds, inMinutes, inHours, inDays, inWeeks
*/
std::int64_t inMilliseconds() const noexcept;
/** Returns the number of seconds this time represents.
@see inMilliseconds, inMinutes, inHours, inDays, inWeeks
*/
value_type inSeconds() const noexcept { return numSeconds; }
/** Returns the number of minutes this time represents.
@see inMilliseconds, inSeconds, inHours, inDays, inWeeks
*/
value_type inMinutes() const noexcept;
/** Returns the number of hours this time represents.
@see inMilliseconds, inSeconds, inMinutes, inDays, inWeeks
*/
value_type inHours() const noexcept;
/** Returns the number of days this time represents.
@see inMilliseconds, inSeconds, inMinutes, inHours, inWeeks
*/
value_type inDays() const noexcept;
/** Returns the number of weeks this time represents.
@see inMilliseconds, inSeconds, inMinutes, inHours, inDays
*/
value_type inWeeks() const noexcept;
template <typename Number>
RelativeTime operator+ (Number seconds) const noexcept
{ return RelativeTime (numSeconds + seconds); }
template <typename Number>
RelativeTime operator- (Number seconds) const noexcept
{ return RelativeTime (numSeconds - seconds); }
/** Adds another RelativeTime to this one. */
RelativeTime operator+= (RelativeTime timeToAdd) noexcept;
/** Subtracts another RelativeTime from this one. */
RelativeTime operator-= (RelativeTime timeToSubtract) noexcept;
/** Adds a number of seconds to this time. */
RelativeTime operator+= (value_type secondsToAdd) noexcept;
/** Subtracts a number of seconds from this time. */
RelativeTime operator-= (value_type secondsToSubtract) noexcept;
private:
value_type numSeconds;
};
//------------------------------------------------------------------------------
bool operator== (RelativeTime t1, RelativeTime t2) noexcept;
bool operator!= (RelativeTime t1, RelativeTime t2) noexcept;
bool operator> (RelativeTime t1, RelativeTime t2) noexcept;
bool operator< (RelativeTime t1, RelativeTime t2) noexcept;
bool operator>= (RelativeTime t1, RelativeTime t2) noexcept;
bool operator<= (RelativeTime t1, RelativeTime t2) noexcept;
//------------------------------------------------------------------------------
/** Adds two RelativeTimes together. */
RelativeTime operator+ (RelativeTime t1, RelativeTime t2) noexcept;
/** Subtracts two RelativeTimes. */
RelativeTime operator- (RelativeTime t1, RelativeTime t2) noexcept;
}
#endif

View File

@@ -1,291 +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.
*/
//==============================================================================
#include <beast/chrono/RelativeTime.h>
namespace beast {
RelativeTime::RelativeTime (const RelativeTime::value_type secs) noexcept
: numSeconds (secs)
{
}
RelativeTime::RelativeTime (const RelativeTime& other) noexcept
: numSeconds (other.numSeconds)
{
}
RelativeTime::~RelativeTime() noexcept {}
//==============================================================================
RelativeTime RelativeTime::milliseconds (const int milliseconds) noexcept
{
return RelativeTime (milliseconds * 0.001);
}
RelativeTime RelativeTime::milliseconds (const std::int64_t milliseconds) noexcept
{
return RelativeTime (milliseconds * 0.001);
}
RelativeTime RelativeTime::seconds (RelativeTime::value_type s) noexcept
{
return RelativeTime (s);
}
RelativeTime RelativeTime::minutes (const RelativeTime::value_type numberOfMinutes) noexcept
{
return RelativeTime (numberOfMinutes * 60.0);
}
RelativeTime RelativeTime::hours (const RelativeTime::value_type numberOfHours) noexcept
{
return RelativeTime (numberOfHours * (60.0 * 60.0));
}
RelativeTime RelativeTime::days (const RelativeTime::value_type numberOfDays) noexcept
{
return RelativeTime (numberOfDays * (60.0 * 60.0 * 24.0));
}
RelativeTime RelativeTime::weeks (const RelativeTime::value_type numberOfWeeks) noexcept
{
return RelativeTime (numberOfWeeks * (60.0 * 60.0 * 24.0 * 7.0));
}
//==============================================================================
std::int64_t RelativeTime::inMilliseconds() const noexcept
{
return (std::int64_t) (numSeconds * 1000.0);
}
RelativeTime::value_type RelativeTime::inMinutes() const noexcept
{
return numSeconds / 60.0;
}
RelativeTime::value_type RelativeTime::inHours() const noexcept
{
return numSeconds / (60.0 * 60.0);
}
RelativeTime::value_type RelativeTime::inDays() const noexcept
{
return numSeconds / (60.0 * 60.0 * 24.0);
}
RelativeTime::value_type RelativeTime::inWeeks() const noexcept
{
return numSeconds / (60.0 * 60.0 * 24.0 * 7.0);
}
//==============================================================================
RelativeTime& RelativeTime::operator= (const RelativeTime& other) noexcept { numSeconds = other.numSeconds; return *this; }
RelativeTime RelativeTime::operator+= (RelativeTime t) noexcept
{
numSeconds += t.numSeconds; return *this;
}
RelativeTime RelativeTime::operator-= (RelativeTime t) noexcept
{
numSeconds -= t.numSeconds; return *this;
}
RelativeTime RelativeTime::operator+= (const RelativeTime::value_type secs) noexcept
{
numSeconds += secs; return *this;
}
RelativeTime RelativeTime::operator-= (const RelativeTime::value_type secs) noexcept
{
numSeconds -= secs; return *this;
}
RelativeTime operator+ (RelativeTime t1, RelativeTime t2) noexcept
{
return t1 += t2;
}
RelativeTime operator- (RelativeTime t1, RelativeTime t2) noexcept
{
return t1 -= t2;
}
bool operator== (RelativeTime t1, RelativeTime t2) noexcept
{
return t1.inSeconds() == t2.inSeconds();
}
bool operator!= (RelativeTime t1, RelativeTime t2) noexcept
{
return t1.inSeconds() != t2.inSeconds();
}
bool operator> (RelativeTime t1, RelativeTime t2) noexcept
{
return t1.inSeconds() > t2.inSeconds();
}
bool operator< (RelativeTime t1, RelativeTime t2) noexcept
{
return t1.inSeconds() < t2.inSeconds();
}
bool operator>= (RelativeTime t1, RelativeTime t2) noexcept
{
return t1.inSeconds() >= t2.inSeconds();
}
bool operator<= (RelativeTime t1, RelativeTime t2) noexcept
{
return t1.inSeconds() <= t2.inSeconds();
}
}
#if BEAST_WINDOWS
#include <windows.h>
namespace beast {
namespace detail {
static double monotonicCurrentTimeInSeconds()
{
return GetTickCount64() / 1000.0;
}
}
}
#elif BEAST_MAC || BEAST_IOS
#include <mach/mach_time.h>
#include <mach/mach.h>
namespace beast {
namespace detail {
static double monotonicCurrentTimeInSeconds()
{
struct StaticInitializer
{
StaticInitializer ()
{
double numerator;
double denominator;
mach_timebase_info_data_t timebase;
(void) mach_timebase_info (&timebase);
if (timebase.numer % 1000000 == 0)
{
numerator = timebase.numer / 1000000.0;
denominator = timebase.denom * 1000.0;
}
else
{
numerator = timebase.numer;
// VFALCO NOTE I don't understand this code
//denominator = timebase.denom * (std::uint64_t) 1000000 * 1000.0;
denominator = timebase.denom * 1000000000.0;
}
ratio = numerator / denominator;
}
double ratio;
};
static StaticInitializer const data;
return mach_absolute_time() * data.ratio;
}
}
}
#else
#include <time.h>
namespace beast {
namespace detail {
static double monotonicCurrentTimeInSeconds()
{
timespec t;
clock_gettime (CLOCK_MONOTONIC, &t);
return t.tv_sec + t.tv_nsec / 1000000000.0;
}
}
}
#endif
namespace beast {
namespace detail {
// Records and returns the time from process startup
static double getStartupTime()
{
struct StaticInitializer
{
StaticInitializer ()
{
when = detail::monotonicCurrentTimeInSeconds();
}
double when;
};
static StaticInitializer const data;
return data.when;
}
// Used to call getStartupTime as early as possible
struct StartupTimeStaticInitializer
{
StartupTimeStaticInitializer ()
{
getStartupTime();
}
};
static StartupTimeStaticInitializer startupTimeStaticInitializer;
}
RelativeTime RelativeTime::fromStartup ()
{
return RelativeTime (
detail::monotonicCurrentTimeInSeconds() - detail::getStartupTime());
}
}

View File

@@ -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

View File

@@ -20,7 +20,7 @@
#ifndef 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 <chrono>

View File

@@ -20,7 +20,7 @@
#ifndef 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>
namespace beast {

View File

@@ -19,8 +19,8 @@
// MODULES: ../impl/chrono_io.cpp
#include <beast/chrono/abstract_clock.h>
#include <beast/chrono/manual_clock.h>
#include <beast/clock/abstract_clock.h>
#include <beast/clock/manual_clock.h>
#include <beast/unit_test/suite.h>
#include <sstream>
#include <string>

View File

@@ -19,7 +19,7 @@
#include <beast/unit_test/suite.h>
#include <beast/chrono/basic_seconds_clock.h>
#include <beast/clock/basic_seconds_clock.h>
namespace beast {

View File

@@ -1,151 +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_COMPILERCONFIG_H_INCLUDED
#define BEAST_CONFIG_COMPILERCONFIG_H_INCLUDED
#include <assert.h>
#include <beast/config/PlatformConfig.h>
// This file defines miscellaneous macros for debugging, assertions, etc.
#if BEAST_FORCE_DEBUG
# undef BEAST_DEBUG
# define BEAST_DEBUG 1
#endif
/** This macro defines the C calling convention used as the standard for Beast calls.
*/
#if BEAST_MSVC
# define BEAST_CDECL __cdecl
#else
# define BEAST_CDECL
#endif
/** This macro fixes C++'s constexpr for VS2012, which doesn't understand it.
*/
#if BEAST_MSVC
# define BEAST_CONSTEXPR const
#else
# define BEAST_CONSTEXPR constexpr
#endif
//------------------------------------------------------------------------------
#if ! DOXYGEN
#define BEAST_JOIN_MACRO_HELPER(a, b) a ## b
#define BEAST_STRINGIFY_MACRO_HELPER(a) #a
#endif
/** A good old-fashioned C macro concatenation helper.
This combines two items (which may themselves be macros) into a single string,
avoiding the pitfalls of the ## macro operator.
*/
#define BEAST_JOIN_MACRO(item1, item2) BEAST_JOIN_MACRO_HELPER (item1, item2)
/** A handy C macro for stringifying any symbol, rather than just a macro parameter.
*/
#define BEAST_STRINGIFY(item) BEAST_STRINGIFY_MACRO_HELPER (item)
//------------------------------------------------------------------------------
#if BEAST_MSVC || DOXYGEN
/** This can be placed before a stack or member variable declaration to tell
the compiler to align it to the specified number of bytes.
*/
#define BEAST_ALIGN(bytes) __declspec (align (bytes))
#else
#define BEAST_ALIGN(bytes) __attribute__ ((aligned (bytes)))
#endif
//------------------------------------------------------------------------------
// Cross-compiler deprecation macros..
#ifdef DOXYGEN
/** This macro can be used to wrap a function which has been deprecated. */
#define BEAST_DEPRECATED(functionDef)
#elif BEAST_MSVC && ! BEAST_NO_DEPRECATION_WARNINGS
#define BEAST_DEPRECATED(functionDef) __declspec(deprecated) functionDef
#elif BEAST_GCC && ! BEAST_NO_DEPRECATION_WARNINGS
#define BEAST_DEPRECATED(functionDef) functionDef __attribute__ ((deprecated))
#else
#define BEAST_DEPRECATED(functionDef) functionDef
#endif
//------------------------------------------------------------------------------
#if BEAST_GCC
# define BEAST_PACKED __attribute__((packed))
#elif ! DOXYGEN
# define BEAST_PACKED
#endif
//------------------------------------------------------------------------------
// Here, we'll check for C++11 compiler support, and if it's not available, define
// a few workarounds, so that we can still use some of the newer language features.
#if defined (__GXX_EXPERIMENTAL_CXX0X__) && defined (__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 405
# define BEAST_COMPILER_SUPPORTS_NOEXCEPT 1
# define BEAST_COMPILER_SUPPORTS_NULLPTR 1
# define BEAST_COMPILER_SUPPORTS_MOVE_SEMANTICS 1
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && ! defined (BEAST_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL)
# define BEAST_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL 1
# endif
#endif
#if BEAST_CLANG && defined (__has_feature)
# if __has_feature (cxx_nullptr)
# define BEAST_COMPILER_SUPPORTS_NULLPTR 1
# endif
# if __has_feature (cxx_noexcept)
# define BEAST_COMPILER_SUPPORTS_NOEXCEPT 1
# endif
# if __has_feature (cxx_rvalue_references)
# define BEAST_COMPILER_SUPPORTS_MOVE_SEMANTICS 1
# endif
# ifndef BEAST_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL
# define BEAST_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL 1
# endif
# ifndef BEAST_COMPILER_SUPPORTS_ARC
# define BEAST_COMPILER_SUPPORTS_ARC 1
# endif
#endif
#if defined (_MSC_VER) && _MSC_VER >= 1600
# define BEAST_COMPILER_SUPPORTS_NULLPTR 1
# define BEAST_COMPILER_SUPPORTS_MOVE_SEMANTICS 1
#endif
#if defined (_MSC_VER) && _MSC_VER >= 1700
# define BEAST_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL 1
#endif
#if BEAST_COMPILER_SUPPORTS_MOVE_SEMANTICS
# define BEAST_MOVE_ARG(type) type&&
# define BEAST_MOVE_CAST(type) static_cast<type&&>
#else
# define BEAST_MOVE_ARG(type) type
# define BEAST_MOVE_CAST(type) type
#endif
#endif

View File

@@ -1,69 +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_CONFIGCHECK_H_INCLUDED
#define BEAST_CONFIG_CONFIGCHECK_H_INCLUDED
//
// Apply sensible defaults for the configuration settings
//
#ifndef BEAST_FORCE_DEBUG
#define BEAST_FORCE_DEBUG 0
#endif
#ifndef BEAST_LOG_ASSERTIONS
# if BEAST_ANDROID
# define BEAST_LOG_ASSERTIONS 1
# else
# define BEAST_LOG_ASSERTIONS 0
# endif
#endif
#if BEAST_DEBUG && ! defined (BEAST_CHECK_MEMORY_LEAKS)
#define BEAST_CHECK_MEMORY_LEAKS 1
#endif
#ifndef BEAST_DISABLE_CONTRACT_CHECKS
#define BEAST_DISABLE_CONTRACT_CHECKS 0
#endif
//------------------------------------------------------------------------------
#ifndef BEAST_DONT_AUTOLINK_TO_WIN32_LIBRARIES
#define BEAST_DONT_AUTOLINK_TO_WIN32_LIBRARIES 0
#endif
#ifndef BEAST_INCLUDE_ZLIB_CODE
#define BEAST_INCLUDE_ZLIB_CODE 1
#endif
#ifndef BEAST_ZLIB_INCLUDE_PATH
#define BEAST_ZLIB_INCLUDE_PATH <zlib.h>
#endif
#ifndef BEAST_SQLITE_FORCE_NDEBUG
#define BEAST_SQLITE_FORCE_NDEBUG 0
#endif
#ifndef BEAST_STRING_UTF_TYPE
#define BEAST_STRING_UTF_TYPE 8
#endif
#endif

View File

@@ -1,211 +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_PLATFORMCONFIG_H_INCLUDED
#define BEAST_CONFIG_PLATFORMCONFIG_H_INCLUDED
//==============================================================================
/* This file figures out which platform is being built, and defines some macros
that the rest of the code can use for OS-specific compilation.
Macros that will be set here are:
- One of BEAST_WINDOWS, BEAST_MAC BEAST_LINUX, BEAST_IOS, BEAST_ANDROID, etc.
- Either BEAST_32BIT or BEAST_64BIT, depending on the architecture.
- Either BEAST_LITTLE_ENDIAN or BEAST_BIG_ENDIAN.
- Either BEAST_INTEL or BEAST_PPC
- Either BEAST_GCC or BEAST_MSVC
*/
//==============================================================================
#if (defined (_WIN32) || defined (_WIN64))
#define BEAST_WIN32 1
#define BEAST_WINDOWS 1
#elif defined (BEAST_ANDROID)
#undef BEAST_ANDROID
#define BEAST_ANDROID 1
#elif defined (LINUX) || defined (__linux__)
#define BEAST_LINUX 1
#elif defined (__APPLE_CPP__) || defined(__APPLE_CC__)
#define Point CarbonDummyPointName // (workaround to avoid definition of "Point" by old Carbon headers)
#define Component CarbonDummyCompName
#include <CoreFoundation/CoreFoundation.h> // (needed to find out what platform we're using)
#undef Point
#undef Component
#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
#define BEAST_IPHONE 1
#define BEAST_IOS 1
#else
#define BEAST_MAC 1
#endif
#elif defined (__FreeBSD__)
#define BEAST_BSD 1
#else
#error "Unknown platform!"
#endif
//==============================================================================
#if BEAST_WINDOWS
#ifdef _MSC_VER
#ifdef _WIN64
#define BEAST_64BIT 1
#else
#define BEAST_32BIT 1
#endif
#endif
#ifdef _DEBUG
#define BEAST_DEBUG 1
#endif
#ifdef __MINGW32__
#define BEAST_MINGW 1
#ifdef __MINGW64__
#define BEAST_64BIT 1
#else
#define BEAST_32BIT 1
#endif
#endif
/** If defined, this indicates that the processor is little-endian. */
#define BEAST_LITTLE_ENDIAN 1
#define BEAST_INTEL 1
#endif
//==============================================================================
#if BEAST_MAC || BEAST_IOS
#if defined (DEBUG) || defined (_DEBUG) || ! (defined (NDEBUG) || defined (_NDEBUG))
#define BEAST_DEBUG 1
#endif
#ifdef __LITTLE_ENDIAN__
#define BEAST_LITTLE_ENDIAN 1
#else
#define BEAST_BIG_ENDIAN 1
#endif
#endif
#if BEAST_MAC
#if defined (__ppc__) || defined (__ppc64__)
#define BEAST_PPC 1
#elif defined (__arm__)
#define BEAST_ARM 1
#else
#define BEAST_INTEL 1
#endif
#ifdef __LP64__
#define BEAST_64BIT 1
#else
#define BEAST_32BIT 1
#endif
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_4
#error "Building for OSX 10.3 is no longer supported!"
#endif
#ifndef MAC_OS_X_VERSION_10_5
#error "To build with 10.4 compatibility, use a 10.5 or 10.6 SDK and set the deployment target to 10.4"
#endif
#endif
//==============================================================================
#if BEAST_LINUX || BEAST_ANDROID || BEAST_BSD
#ifdef _DEBUG
#define BEAST_DEBUG 1
#endif
// Allow override for big-endian Linux platforms
#if defined (__LITTLE_ENDIAN__) || ! defined (BEAST_BIG_ENDIAN)
#define BEAST_LITTLE_ENDIAN 1
#undef BEAST_BIG_ENDIAN
#else
#undef BEAST_LITTLE_ENDIAN
#define BEAST_BIG_ENDIAN 1
#endif
#if defined (__LP64__) || defined (_LP64)
#define BEAST_64BIT 1
#else
#define BEAST_32BIT 1
#endif
#if __MMX__ || __SSE__ || __amd64__
#ifdef __arm__
#define BEAST_ARM 1
#else
#define BEAST_INTEL 1
#endif
#endif
#endif
//==============================================================================
// Compiler type macros.
#ifdef __clang__
#define BEAST_CLANG 1
#elif defined (__GNUC__)
#define BEAST_GCC 1
#elif defined (_MSC_VER)
#define BEAST_MSVC 1
#if _MSC_VER < 1500
#define BEAST_VC8_OR_EARLIER 1
#if _MSC_VER < 1400
#define BEAST_VC7_OR_EARLIER 1
#if _MSC_VER < 1300
#warning "MSVC 6.0 is no longer supported!"
#endif
#endif
#endif
#if BEAST_64BIT || ! BEAST_VC7_OR_EARLIER
#define BEAST_USE_INTRINSICS 1
#endif
#else
#error unknown compiler
#endif
//------------------------------------------------------------------------------
// Handy macro that lets pragma warnings be clicked in the output window
//
// Usage: #pragma message(BEAST_FILEANDLINE_ "Advertise here!")
//
// Note that a space following the macro is mandatory for C++11.
//
// This is here so it can be used in C compilations that include this directly.
//
#define BEAST_PP_STR2_(x) #x
#define BEAST_PP_STR1_(x) BEAST_PP_STR2_(x)
#define BEAST_FILEANDLINE_ __FILE__ "(" BEAST_PP_STR1_(__LINE__) "): warning:"
#endif

View File

@@ -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

View File

@@ -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

View File

@@ -1,77 +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_STANDARDCONFIG_H_INCLUDED
#define BEAST_CONFIG_STANDARDCONFIG_H_INCLUDED
#ifndef BEAST_CONFIG_COMPILERCONFIG_H_INCLUDED
#error "CompilerConfig.h must be included first"
#endif
// Now we'll include some common OS headers..
#if BEAST_MSVC
#pragma warning (push)
#pragma warning (disable: 4514 4245 4100)
#endif
#if BEAST_USE_INTRINSICS
#include <intrin.h>
#endif
#if BEAST_MAC || BEAST_IOS
#include <libkern/OSAtomic.h>
#endif
#if BEAST_LINUX
#include <signal.h>
# if __INTEL_COMPILER
# if __ia64__
#include <ia64intrin.h>
# else
#include <ia32intrin.h>
# endif
# endif
#endif
#if BEAST_MSVC && BEAST_DEBUG
#include <crtdbg.h>
#include <stdlib.h>
#include <malloc.h>
#endif
#if BEAST_MSVC
#pragma warning (pop)
#endif
#if BEAST_ANDROID
#include <sys/atomics.h>
#include <byteswap.h>
#endif
// undef symbols that are sometimes set by misguided 3rd-party headers..
#undef check
#undef TYPE_BOOL
#undef max
#undef min
#endif

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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.
*/
//==============================================================================
// Linux-compatible platform configuration

View File

@@ -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

View File

@@ -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

View File

@@ -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>

View File

@@ -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_CONTAINER_AGED_CONTAINER_H_INCLUDED
#define BEAST_CONTAINER_AGED_CONTAINER_H_INCLUDED
#include <type_traits>
namespace beast {
template <class T>
struct is_aged_container
: std::false_type
{
};
}
#endif

View File

@@ -1,51 +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_AGED_CONTAINER_UTILITY_H_INCLUDED
#define BEAST_CONTAINER_AGED_CONTAINER_UTILITY_H_INCLUDED
#include <beast/container/aged_container.h>
#include <type_traits>
namespace beast {
/** Expire aged container items past the specified age. */
template <class AgedContainer, class Rep, class Period>
typename std::enable_if <
is_aged_container <AgedContainer>::value,
std::size_t
>::type
expire (AgedContainer& c, std::chrono::duration <Rep, Period> const& age)
{
std::size_t n (0);
auto const expired (c.clock().now() - age);
for (auto iter (c.chronological.cbegin());
iter != c.chronological.cend() &&
iter.when() <= expired;)
{
iter = c.erase (iter);
++n;
}
return n;
}
}
#endif

View File

@@ -1,43 +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_AGED_MAP_H_INCLUDED
#define BEAST_CONTAINER_AGED_MAP_H_INCLUDED
#include <beast/container/detail/aged_ordered_container.h>
#include <chrono>
#include <functional>
#include <memory>
namespace beast {
template <
class Key,
class T,
class Clock = std::chrono::steady_clock,
class Compare = std::less <Key>,
class Allocator = std::allocator <std::pair <Key const, T>>
>
using aged_map = detail::aged_ordered_container <
false, true, Key, T, Clock, Compare, Allocator>;
}
#endif

View File

@@ -1,43 +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_AGED_MULTIMAP_H_INCLUDED
#define BEAST_CONTAINER_AGED_MULTIMAP_H_INCLUDED
#include <beast/container/detail/aged_ordered_container.h>
#include <chrono>
#include <functional>
#include <memory>
namespace beast {
template <
class Key,
class T,
class Clock = std::chrono::steady_clock,
class Compare = std::less <Key>,
class Allocator = std::allocator <std::pair <Key const, T>>
>
using aged_multimap = detail::aged_ordered_container <
true, true, Key, T, Clock, Compare, Allocator>;
}
#endif

View File

@@ -1,42 +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_AGED_MULTISET_H_INCLUDED
#define BEAST_CONTAINER_AGED_MULTISET_H_INCLUDED
#include <beast/container/detail/aged_ordered_container.h>
#include <chrono>
#include <functional>
#include <memory>
namespace beast {
template <
class Key,
class Clock = std::chrono::steady_clock,
class Compare = std::less <Key>,
class Allocator = std::allocator <Key>
>
using aged_multiset = detail::aged_ordered_container <
true, false, Key, void, Clock, Compare, Allocator>;
}
#endif

View File

@@ -1,42 +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_AGED_SET_H_INCLUDED
#define BEAST_CONTAINER_AGED_SET_H_INCLUDED
#include <beast/container/detail/aged_ordered_container.h>
#include <chrono>
#include <functional>
#include <memory>
namespace beast {
template <
class Key,
class Clock = std::chrono::steady_clock,
class Compare = std::less <Key>,
class Allocator = std::allocator <Key>
>
using aged_set = detail::aged_ordered_container <
false, false, Key, void, Clock, Compare, Allocator>;
}
#endif

View File

@@ -1,44 +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_AGED_UNORDERED_MAP_H_INCLUDED
#define BEAST_CONTAINER_AGED_UNORDERED_MAP_H_INCLUDED
#include <beast/container/detail/aged_unordered_container.h>
#include <chrono>
#include <functional>
#include <memory>
namespace beast {
template <
class Key,
class T,
class Clock = std::chrono::steady_clock,
class Hash = std::hash <Key>,
class KeyEqual = std::equal_to <Key>,
class Allocator = std::allocator <std::pair <Key const, T>>
>
using aged_unordered_map = detail::aged_unordered_container <
false, true, Key, T, Clock, Hash, KeyEqual, Allocator>;
}
#endif

View File

@@ -1,44 +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_AGED_UNORDERED_MULTIMAP_H_INCLUDED
#define BEAST_CONTAINER_AGED_UNORDERED_MULTIMAP_H_INCLUDED
#include <beast/container/detail/aged_unordered_container.h>
#include <chrono>
#include <functional>
#include <memory>
namespace beast {
template <
class Key,
class T,
class Clock = std::chrono::steady_clock,
class Hash = std::hash <Key>,
class KeyEqual = std::equal_to <Key>,
class Allocator = std::allocator <std::pair <Key const, T>>
>
using aged_unordered_multimap = detail::aged_unordered_container <
true, true, Key, T, Clock, Hash, KeyEqual, Allocator>;
}
#endif

View File

@@ -1,43 +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_AGED_UNORDERED_MULTISET_H_INCLUDED
#define BEAST_CONTAINER_AGED_UNORDERED_MULTISET_H_INCLUDED
#include <beast/container/detail/aged_unordered_container.h>
#include <chrono>
#include <functional>
#include <memory>
namespace beast {
template <
class Key,
class Clock = std::chrono::steady_clock,
class Hash = std::hash <Key>,
class KeyEqual = std::equal_to <Key>,
class Allocator = std::allocator <Key>
>
using aged_unordered_multiset = detail::aged_unordered_container <
true, false, Key, void, Clock, Hash, KeyEqual, Allocator>;
}
#endif

View File

@@ -1,43 +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_AGED_UNORDERED_SET_H_INCLUDED
#define BEAST_CONTAINER_AGED_UNORDERED_SET_H_INCLUDED
#include <beast/container/detail/aged_unordered_container.h>
#include <chrono>
#include <functional>
#include <memory>
namespace beast {
template <
class Key,
class Clock = std::chrono::steady_clock,
class Hash = std::hash <Key>,
class KeyEqual = std::equal_to <Key>,
class Allocator = std::allocator <Key>
>
using aged_unordered_set = detail::aged_unordered_container <
false, false, Key, void, Clock, Hash, KeyEqual, Allocator>;
}
#endif

View File

@@ -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

View File

@@ -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

View File

@@ -1,54 +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_DETAIL_AGED_ASSOCIATIVE_CONTAINER_H_INCLUDED
#define BEAST_CONTAINER_DETAIL_AGED_ASSOCIATIVE_CONTAINER_H_INCLUDED
#include <type_traits>
namespace beast {
namespace detail {
// Extracts the key portion of value
template <bool maybe_map>
struct aged_associative_container_extract_t
{
template <class Value>
decltype (Value::first) const&
operator() (Value const& value) const
{
return value.first;
}
};
template <>
struct aged_associative_container_extract_t <false>
{
template <class Value>
Value const&
operator() (Value const& value) const
{
return value;
}
};
}
}
#endif

View File

@@ -1,182 +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_DETAIL_AGED_CONTAINER_ITERATOR_H_INCLUDED
#define BEAST_CONTAINER_DETAIL_AGED_CONTAINER_ITERATOR_H_INCLUDED
#include <iterator>
#include <type_traits>
namespace beast {
template <bool, bool, class, class, class, class, class>
class aged_ordered_container;
namespace detail {
// Idea for Base template argument to prevent having to repeat
// the base class declaration comes from newbiz on ##c++/Freenode
//
// If Iterator is SCARY then this iterator will be as well.
template <
bool is_const,
class Iterator,
class Base =
std::iterator <
typename std::iterator_traits <Iterator>::iterator_category,
typename std::conditional <is_const,
typename Iterator::value_type::stashed::value_type const,
typename Iterator::value_type::stashed::value_type>::type,
typename std::iterator_traits <Iterator>::difference_type>
>
class aged_container_iterator
: public Base
{
public:
using time_point = typename Iterator::value_type::stashed::time_point;
// Could be '= default', but Visual Studio 2013 chokes on it [Aug 2014]
aged_container_iterator ()
{
}
// copy constructor
aged_container_iterator (
aged_container_iterator<is_const, Iterator, Base>
const& other) = default;
// Disable constructing a const_iterator from a non-const_iterator.
// Converting between reverse and non-reverse iterators should be explicit.
template <bool other_is_const, class OtherIterator, class OtherBase,
class = typename std::enable_if <
(other_is_const == false || is_const == true) &&
std::is_same<Iterator, OtherIterator>::value == false>::type>
explicit aged_container_iterator (aged_container_iterator <
other_is_const, OtherIterator, OtherBase> const& other)
: m_iter (other.m_iter)
{
}
// Disable constructing a const_iterator from a non-const_iterator.
template <bool other_is_const, class OtherBase,
class = typename std::enable_if <
other_is_const == false || is_const == true>::type>
aged_container_iterator (aged_container_iterator <
other_is_const, Iterator, OtherBase> const& other)
: m_iter (other.m_iter)
{
}
// Disable assigning a const_iterator to a non-const iterator
template <bool other_is_const, class OtherIterator, class OtherBase>
auto
operator= (aged_container_iterator <
other_is_const, OtherIterator, OtherBase> const& other) ->
typename std::enable_if <
other_is_const == false || is_const == true,
aged_container_iterator&>::type
{
m_iter = other.m_iter;
return *this;
}
template <bool other_is_const, class OtherIterator, class OtherBase>
bool operator== (aged_container_iterator <
other_is_const, OtherIterator, OtherBase> const& other) const
{
return m_iter == other.m_iter;
}
template <bool other_is_const, class OtherIterator, class OtherBase>
bool operator!= (aged_container_iterator <
other_is_const, OtherIterator, OtherBase> const& other) const
{
return m_iter != other.m_iter;
}
aged_container_iterator& operator++ ()
{
++m_iter;
return *this;
}
aged_container_iterator operator++ (int)
{
aged_container_iterator const prev (*this);
++m_iter;
return prev;
}
aged_container_iterator& operator-- ()
{
--m_iter;
return *this;
}
aged_container_iterator operator-- (int)
{
aged_container_iterator const prev (*this);
--m_iter;
return prev;
}
typename Base::reference operator* () const
{
return m_iter->value;
}
typename Base::pointer operator-> () const
{
return &m_iter->value;
}
time_point const& when () const
{
return m_iter->when;
}
private:
template <bool, bool, class, class, class, class, class>
friend class aged_ordered_container;
template <bool, bool, class, class, class, class, class, class>
friend class aged_unordered_container;
template <bool, class, class>
friend class aged_container_iterator;
template <class OtherIterator>
aged_container_iterator (OtherIterator const& iter)
: m_iter (iter)
{
}
Iterator const& iterator() const
{
return m_iter;
}
Iterator m_iter;
};
}
}
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -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>

View File

@@ -18,8 +18,8 @@
*/
//==============================================================================
#ifndef BEAST_UTILITY_EMPTY_BASE_OPTIMIZATION_H_INCLUDED
#define BEAST_UTILITY_EMPTY_BASE_OPTIMIZATION_H_INCLUDED
#ifndef BEAST_EMPTY_BASE_OPTIMIZATION_H_INCLUDED
#define BEAST_EMPTY_BASE_OPTIMIZATION_H_INCLUDED
#include <type_traits>
#include <utility>

View File

@@ -21,9 +21,8 @@
#ifndef 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/utility/meta.h>
#include <beast/hash/meta.h>
#include <array>
#include <chrono>
#include <cstdint>

View File

@@ -17,8 +17,8 @@
*/
//==============================================================================
#ifndef BEAST_UTILITY_META_H_INCLUDED
#define BEAST_UTILITY_META_H_INCLUDED
#ifndef BEAST_HASH_META_H_INCLUDED
#define BEAST_HASH_META_H_INCLUDED
#include <type_traits>

View File

@@ -26,7 +26,7 @@
#include <beast/hash/hash_append.h>
#include <beast/xor_shift_engine.h>
#include <beast/unit_test/suite.h>
#include <beast/utility/type_name.h>
#include <beast/type_name.h>
#include <array>
#include <algorithm>
#include <cstring>

View File

@@ -17,13 +17,9 @@
*/
//==============================================================================
#if BEAST_INCLUDE_BEASTCONFIG
#include <BeastConfig.h>
#endif
#include <beast/hash/fnv1a.h>
#include <beast/hash/siphash.h>
#include <beast/hash/xxhasher.h>
#include <beast/rngfill.h>
#include <beast/xor_shift_engine.h>
#include <beast/unit_test/suite.h>
#include <array>
@@ -38,6 +34,44 @@ namespace beast {
class hash_speed_test : public beast::unit_test::suite
{
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 =
std::chrono::high_resolution_clock;
template <class Hasher, std::size_t KeySize>

View File

@@ -21,6 +21,7 @@
#ifndef BEAST_HASH_UHASH_H_INCLUDED
#define BEAST_HASH_UHASH_H_INCLUDED
#include <beast/hash/hash_append.h>
#include <beast/hash/spooky.h>
namespace beast {

View File

@@ -20,7 +20,7 @@
#ifndef 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/set.hpp>
#include <boost/iterator/transform_iterator.hpp>

View File

@@ -23,7 +23,7 @@
#include <beast/http/basic_parser.h>
#include <beast/http/method.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/set.hpp>
#include <algorithm>

View File

@@ -20,6 +20,7 @@
#ifndef BEAST_HTTP_METHOD_H_INCLUDED
#define BEAST_HTTP_METHOD_H_INCLUDED
#include <cassert>
#include <memory>
#include <string>

View File

@@ -1,38 +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_INSIGHT_BASE_H_INCLUDED
#define BEAST_INSIGHT_BASE_H_INCLUDED
#include <memory>
namespace beast {
namespace insight {
/** Base for all metrics and hooks. */
class Base
{
public:
virtual ~Base () = 0;
};
}
}
#endif

View File

@@ -1,43 +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_INSIGHT_BASEIMPL_H_INCLUDED
#define BEAST_INSIGHT_BASEIMPL_H_INCLUDED
#include <chrono>
#include <cstdint>
#include <functional>
#include <memory>
namespace beast {
namespace insight {
/** Base for all metrics and hook implementations. */
class BaseImpl
{
public:
using ptr = std::shared_ptr <BaseImpl>;
virtual ~BaseImpl () = 0;
};
}
}
#endif

View File

@@ -1,133 +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_INSIGHT_COLLECTOR_H_INCLUDED
#define BEAST_INSIGHT_COLLECTOR_H_INCLUDED
#include <beast/insight/Counter.h>
#include <beast/insight/Event.h>
#include <beast/insight/Gauge.h>
#include <beast/insight/Hook.h>
#include <beast/insight/Meter.h>
#include <string>
namespace beast {
namespace insight {
/** Interface for a manager that allows collection of metrics.
To export metrics from a class, pass and save a shared_ptr to this
interface in the class constructor. Create the metric objects
as desired (counters, events, gauges, meters, and an optional hook)
using the interface.
@see Counter, Event, Gauge, Hook, Meter
@see NullCollector, StatsDCollector
*/
class Collector
{
public:
using ptr = std::shared_ptr <Collector>;
virtual ~Collector() = 0;
/** Create a hook.
A hook is called at each collection interval, on an implementation
defined thread. This is a convenience facility for gathering metrics
in the polling style. The typical usage is to update all the metrics
of interest in the handler.
Handler will be called with this signature:
void handler (void)
@see Hook
*/
/** @{ */
template <class Handler>
Hook make_hook (Handler handler)
{
return make_hook (HookImpl::HandlerType (handler));
}
virtual Hook make_hook (HookImpl::HandlerType const& handler) = 0;
/** @} */
/** Create a counter with the specified name.
@see Counter
*/
/** @{ */
virtual Counter make_counter (std::string const& name) = 0;
Counter make_counter (std::string const& prefix, std::string const& name)
{
if (prefix.empty ())
return make_counter (name);
return make_counter (prefix + "." + name);
}
/** @} */
/** Create an event with the specified name.
@see Event
*/
/** @{ */
virtual Event make_event (std::string const& name) = 0;
Event make_event (std::string const& prefix, std::string const& name)
{
if (prefix.empty ())
return make_event (name);
return make_event (prefix + "." + name);
}
/** @} */
/** Create a gauge with the specified name.
@see Gauge
*/
/** @{ */
virtual Gauge make_gauge (std::string const& name) = 0;
Gauge make_gauge (std::string const& prefix, std::string const& name)
{
if (prefix.empty ())
return make_gauge (name);
return make_gauge (prefix + "." + name);
}
/** @} */
/** Create a meter with the specified name.
@see Meter
*/
/** @{ */
virtual Meter make_meter (std::string const& name) = 0;
Meter make_meter (std::string const& prefix, std::string const& name)
{
if (prefix.empty ())
return make_meter (name);
return make_meter (prefix + "." + name);
}
/** @} */
};
}
}
#endif

View File

@@ -1,126 +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_INSIGHT_COUNTER_H_INCLUDED
#define BEAST_INSIGHT_COUNTER_H_INCLUDED
#include <beast/insight/Base.h>
#include <beast/insight/CounterImpl.h>
#include <memory>
namespace beast {
namespace insight {
/** A metric for measuring an integral value.
A counter is a gauge calculated at the server. The owner of the counter
may increment and decrement the value by an amount.
This is a lightweight reference wrapper which is cheap to copy and assign.
When the last reference goes away, the metric is no longer collected.
*/
class Counter : public Base
{
public:
using value_type = CounterImpl::value_type;
/** Create a null metric.
A null metric reports no information.
*/
Counter ()
{
}
/** Create the metric reference the specified implementation.
Normally this won't be called directly. Instead, call the appropriate
factory function in the Collector interface.
@see Collector.
*/
explicit Counter (std::shared_ptr <CounterImpl> const& impl)
: m_impl (impl)
{
}
/** Increment the counter. */
/** @{ */
void
increment (value_type amount) const
{
if (m_impl)
m_impl->increment (amount);
}
Counter const&
operator+= (value_type amount) const
{
increment (amount);
return *this;
}
Counter const&
operator-= (value_type amount) const
{
increment (-amount);
return *this;
}
Counter const&
operator++ () const
{
increment (1);
return *this;
}
Counter const&
operator++ (int) const
{
increment (1);
return *this;
}
Counter const&
operator-- () const
{
increment (-1);
return *this;
}
Counter const&
operator-- (int) const
{
increment (-1);
return *this;
}
/** @} */
std::shared_ptr <CounterImpl> const&
impl () const
{
return m_impl;
}
private:
std::shared_ptr <CounterImpl> m_impl;
};
}
}
#endif

View File

@@ -1,44 +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_INSIGHT_COUNTERIMPL_H_INCLUDED
#define BEAST_INSIGHT_COUNTERIMPL_H_INCLUDED
#include <beast/insight/BaseImpl.h>
namespace beast {
namespace insight {
class Counter;
class CounterImpl
: public std::enable_shared_from_this <CounterImpl>
, public BaseImpl
{
public:
using value_type = std::int64_t;
virtual ~CounterImpl () = 0;
virtual void increment (value_type amount) = 0;
};
}
}
#endif

View File

@@ -1,85 +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_INSIGHT_EVENT_H_INCLUDED
#define BEAST_INSIGHT_EVENT_H_INCLUDED
#include <beast/insight/Base.h>
#include <beast/insight/EventImpl.h>
#include <beast/chrono/chrono_util.h>
#include <chrono>
#include <memory>
namespace beast {
namespace insight {
/** A metric for reporting event timing.
An event is an operation that has an associated millisecond time, or
other integral value. Because events happen at a specific moment, the
metric only supports a push-style interface.
This is a lightweight reference wrapper which is cheap to copy and assign.
When the last reference goes away, the metric is no longer collected.
*/
class Event : public Base
{
public:
using value_type = EventImpl::value_type;
/** Create a null metric.
A null metric reports no information.
*/
Event ()
{ }
/** Create the metric reference the specified implementation.
Normally this won't be called directly. Instead, call the appropriate
factory function in the Collector interface.
@see Collector.
*/
explicit Event (std::shared_ptr <EventImpl> const& impl)
: m_impl (impl)
{ }
/** Push an event notification. */
template <class Rep, class Period>
void
notify (std::chrono::duration <Rep, Period> const& value) const
{
using namespace std::chrono;
if (m_impl)
m_impl->notify (ceil <value_type> (value));
}
std::shared_ptr <EventImpl> const& impl () const
{
return m_impl;
}
private:
std::shared_ptr <EventImpl> m_impl;
};
}
}
#endif

View File

@@ -1,44 +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_INSIGHT_EVENTIMPL_H_INCLUDED
#define BEAST_INSIGHT_EVENTIMPL_H_INCLUDED
#include <beast/insight/BaseImpl.h>
namespace beast {
namespace insight {
class Event;
class EventImpl
: public std::enable_shared_from_this <EventImpl>
, public BaseImpl
{
public:
using value_type = std::chrono::milliseconds;
virtual ~EventImpl () = 0;
virtual void notify (value_type const& value) = 0;
};
}
}
#endif

View File

@@ -1,143 +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_INSIGHT_GAUGE_H_INCLUDED
#define BEAST_INSIGHT_GAUGE_H_INCLUDED
#include <beast/insight/Base.h>
#include <beast/insight/GaugeImpl.h>
#include <memory>
namespace beast {
namespace insight {
/** A metric for measuring an integral value.
A gauge is an instantaneous measurement of a value, like the gas gauge
in a car. The caller directly sets the value, or adjusts it by a
specified amount. The value is kept in the client rather than the collector.
This is a lightweight reference wrapper which is cheap to copy and assign.
When the last reference goes away, the metric is no longer collected.
*/
class Gauge : public Base
{
public:
using value_type = GaugeImpl::value_type;
using difference_type = GaugeImpl::difference_type;
/** Create a null metric.
A null metric reports no information.
*/
Gauge ()
{
}
/** Create the metric reference the specified implementation.
Normally this won't be called directly. Instead, call the appropriate
factory function in the Collector interface.
@see Collector.
*/
explicit Gauge (std::shared_ptr <GaugeImpl> const& impl)
: m_impl (impl)
{
}
/** Set the value on the gauge.
A Collector implementation should combine multiple calls to value
changes into a single change if the calls occur within a single
collection interval.
*/
/** @{ */
void set (value_type value) const
{
if (m_impl)
m_impl->set (value);
}
Gauge const& operator= (value_type value) const
{ set (value); return *this; }
/** @} */
/** Adjust the value of the gauge. */
/** @{ */
void increment (difference_type amount) const
{
if (m_impl)
m_impl->increment (amount);
}
Gauge const&
operator+= (difference_type amount) const
{
increment (amount);
return *this;
}
Gauge const&
operator-= (difference_type amount) const
{
increment (-amount);
return *this;
}
Gauge const&
operator++ () const
{
increment (1);
return *this;
}
Gauge const&
operator++ (int) const
{
increment (1);
return *this;
}
Gauge const&
operator-- () const
{
increment (-1);
return *this;
}
Gauge const&
operator-- (int) const
{
increment (-1);
return *this;
}
/** @} */
std::shared_ptr <GaugeImpl> const&
impl () const
{
return m_impl;
}
private:
std::shared_ptr <GaugeImpl> m_impl;
};
}
}
#endif

View File

@@ -1,46 +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_INSIGHT_GAUGEIMPL_H_INCLUDED
#define BEAST_INSIGHT_GAUGEIMPL_H_INCLUDED
#include <beast/insight/BaseImpl.h>
namespace beast {
namespace insight {
class Gauge;
class GaugeImpl
: public std::enable_shared_from_this <GaugeImpl>
, public BaseImpl
{
public:
using value_type = std::uint64_t;
using difference_type = std::int64_t;
virtual ~GaugeImpl () = 0;
virtual void set (value_type value) = 0;
virtual void increment (difference_type amount) = 0;
};
}
}
#endif

View File

@@ -1,44 +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_INSIGHT_GROUP_H_INCLUDED
#define BEAST_INSIGHT_GROUP_H_INCLUDED
#include <beast/insight/Collector.h>
#include <memory>
#include <string>
namespace beast {
namespace insight {
/** A collector front-end that manages a group of metrics. */
class Group : public Collector
{
public:
using ptr = std::shared_ptr <Group>;
/** Returns the name of this group, for diagnostics. */
virtual std::string const& name () const = 0;
};
}
}
#endif

View File

@@ -1,58 +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_INSIGHT_GROUPS_H_INCLUDED
#define BEAST_INSIGHT_GROUPS_H_INCLUDED
#include <beast/insight/Collector.h>
#include <beast/insight/Group.h>
#include <memory>
#include <string>
namespace beast {
namespace insight {
/** A container for managing a set of metric groups. */
class Groups
{
public:
virtual ~Groups() = 0;
/** Find or create a new collector with a given name. */
/** @{ */
virtual
Group::ptr const&
get (std::string const& name) = 0;
Group::ptr const&
operator[] (std::string const& name)
{
return get (name);
}
/** @} */
};
/** Create a group container that uses the specified collector. */
std::unique_ptr <Groups> make_Groups (Collector::ptr const& collector);
}
}
#endif

View File

@@ -1,62 +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_INSIGHT_HOOK_H_INCLUDED
#define BEAST_INSIGHT_HOOK_H_INCLUDED
#include <beast/insight/Base.h>
#include <beast/insight/HookImpl.h>
#include <memory>
namespace beast {
namespace insight {
/** A reference to a handler for performing polled collection. */
class Hook : public Base
{
public:
/** Create a null hook.
A null hook has no associated handler.
*/
Hook ()
{ }
/** Create a hook referencing the specified implementation.
Normally this won't be called directly. Instead, call the appropriate
factory function in the Collector interface.
@see Collector.
*/
explicit Hook (std::shared_ptr <HookImpl> const& impl)
: m_impl (impl)
{ }
std::shared_ptr <HookImpl> const& impl () const
{
return m_impl;
}
private:
std::shared_ptr <HookImpl> m_impl;
};
}
}
#endif

View File

@@ -1,41 +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_INSIGHT_HOOKIMPL_H_INCLUDED
#define BEAST_INSIGHT_HOOKIMPL_H_INCLUDED
#include <beast/insight/BaseImpl.h>
namespace beast {
namespace insight {
class HookImpl
: public std::enable_shared_from_this <HookImpl>
, public BaseImpl
{
public:
using HandlerType = std::function <void (void)>;
virtual ~HookImpl () = 0;
};
}
}
#endif

View File

@@ -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>

View File

@@ -1,97 +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_INSIGHT_METER_H_INCLUDED
#define BEAST_INSIGHT_METER_H_INCLUDED
#include <memory>
#include <beast/insight/Base.h>
#include <beast/insight/MeterImpl.h>
namespace beast {
namespace insight {
/** A metric for measuring an integral value.
A meter may be thought of as an increment-only counter.
This is a lightweight reference wrapper which is cheap to copy and assign.
When the last reference goes away, the metric is no longer collected.
*/
class Meter : public Base
{
public:
using value_type = MeterImpl::value_type;
/** Create a null metric.
A null metric reports no information.
*/
Meter ()
{ }
/** Create the metric reference the specified implementation.
Normally this won't be called directly. Instead, call the appropriate
factory function in the Collector interface.
@see Collector.
*/
explicit Meter (std::shared_ptr <MeterImpl> const& impl)
: m_impl (impl)
{ }
/** Increment the meter. */
/** @{ */
void increment (value_type amount) const
{
if (m_impl)
m_impl->increment (amount);
}
Meter const& operator+= (value_type amount) const
{
increment (amount);
return *this;
}
Meter const& operator++ () const
{
increment (1);
return *this;
}
Meter const& operator++ (int) const
{
increment (1);
return *this;
}
/** @} */
std::shared_ptr <MeterImpl> const& impl () const
{
return m_impl;
}
private:
std::shared_ptr <MeterImpl> m_impl;
};
}
}
#endif

View File

@@ -1,44 +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_INSIGHT_METERIMPL_H_INCLUDED
#define BEAST_INSIGHT_METERIMPL_H_INCLUDED
#include <beast/insight/BaseImpl.h>
namespace beast {
namespace insight {
class Meter;
class MeterImpl
: public std::enable_shared_from_this <MeterImpl>
, public BaseImpl
{
public:
using value_type = std::uint64_t;
virtual ~MeterImpl () = 0;
virtual void increment (value_type amount) = 0;
};
}
}
#endif

View File

@@ -1,38 +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_INSIGHT_NULLCOLLECTOR_H_INCLUDED
#define BEAST_INSIGHT_NULLCOLLECTOR_H_INCLUDED
#include <beast/insight/Collector.h>
namespace beast {
namespace insight {
/** A Collector which does not collect metrics. */
class NullCollector : public Collector
{
public:
static std::shared_ptr <Collector> New ();
};
}
}
#endif

View File

@@ -1,52 +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_INSIGHT_STATSDCOLLECTOR_H_INCLUDED
#define BEAST_INSIGHT_STATSDCOLLECTOR_H_INCLUDED
#include <beast/insight/Collector.h>
#include <beast/utility/Journal.h>
#include <beast/net/IPEndpoint.h>
namespace beast {
namespace insight {
/** A Collector that reports metrics to a StatsD server.
Reference:
https://github.com/b/statsd_spec
*/
class StatsDCollector : public Collector
{
public:
/** Create a StatsD collector.
@param address The IP address and port of the StatsD server.
@param prefix A string pre-pended before each metric name.
@param journal Destination for logging output.
*/
static
std::shared_ptr <StatsDCollector>
New (IP::Endpoint const& address,
std::string const& prefix, Journal journal);
};
}
}
#endif

View File

@@ -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.
*/
//==============================================================================
namespace beast {
namespace insight {
Collector::~Collector ()
{
}
}
}

View File

@@ -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.
*/
//==============================================================================
namespace beast {
namespace insight {
namespace detail {
}
}
}

View File

@@ -1,133 +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 <unordered_map>
#include <beast/hash/uhash.h>
#include <memory>
namespace beast {
namespace insight {
namespace detail {
class GroupImp
: public std::enable_shared_from_this <GroupImp>
, public Group
{
public:
using Items = std::vector <std::shared_ptr <BaseImpl>>;
std::string const m_name;
Collector::ptr m_collector;
GroupImp (std::string const& name_,
Collector::ptr const& collector)
: m_name (name_)
, m_collector (collector)
{
}
~GroupImp ()
{
}
std::string const& name () const
{
return m_name;
}
std::string make_name (std::string const& name)
{
return m_name + "." + name;
}
Hook make_hook (HookImpl::HandlerType const& handler)
{
return m_collector->make_hook (handler);
}
Counter make_counter (std::string const& name)
{
return m_collector->make_counter (make_name (name));
}
Event make_event (std::string const& name)
{
return m_collector->make_event (make_name (name));
}
Gauge make_gauge (std::string const& name)
{
return m_collector->make_gauge (make_name (name));
}
Meter make_meter (std::string const& name)
{
return m_collector->make_meter (make_name (name));
}
private:
GroupImp& operator= (GroupImp const&);
};
//------------------------------------------------------------------------------
class GroupsImp : public Groups
{
public:
using Items = std::unordered_map <std::string, std::shared_ptr <Group>, uhash <>>;
Collector::ptr m_collector;
Items m_items;
GroupsImp (Collector::ptr const& collector)
: m_collector (collector)
{
}
~GroupsImp ()
{
}
Group::ptr const& get (std::string const& name)
{
std::pair <Items::iterator, bool> result (
m_items.emplace (name, Group::ptr ()));
Group::ptr& group (result.first->second);
if (result.second)
group = std::make_shared <GroupImp> (name, m_collector);
return group;
}
};
}
//------------------------------------------------------------------------------
Groups::~Groups ()
{
}
std::unique_ptr <Groups> make_Groups (Collector::ptr const& collector)
{
return std::make_unique <detail::GroupsImp> (collector);
}
}
}

View File

@@ -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.
*/
//==============================================================================
namespace beast {
namespace insight {
HookImpl::~HookImpl ()
{
}
}
}

View File

@@ -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.
*/
//==============================================================================
namespace beast {
namespace insight {
Base::~Base ()
{
}
BaseImpl::~BaseImpl ()
{
}
CounterImpl::~CounterImpl ()
{
}
EventImpl::~EventImpl ()
{
}
GaugeImpl::~GaugeImpl ()
{
}
MeterImpl::~MeterImpl ()
{
}
}
}

View File

@@ -1,137 +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 insight {
namespace detail {
class NullHookImpl : public HookImpl
{
private:
NullHookImpl& operator= (NullHookImpl const&);
};
//------------------------------------------------------------------------------
class NullCounterImpl : public CounterImpl
{
public:
void increment (value_type)
{
}
private:
NullCounterImpl& operator= (NullCounterImpl const&);
};
//------------------------------------------------------------------------------
class NullEventImpl : public EventImpl
{
public:
void notify (value_type const&)
{
}
private:
NullEventImpl& operator= (NullEventImpl const&);
};
//------------------------------------------------------------------------------
class NullGaugeImpl : public GaugeImpl
{
public:
void set (value_type)
{
}
void increment (difference_type)
{
}
private:
NullGaugeImpl& operator= (NullGaugeImpl const&);
};
//------------------------------------------------------------------------------
class NullMeterImpl : public MeterImpl
{
public:
void increment (value_type)
{
}
private:
NullMeterImpl& operator= (NullMeterImpl const&);
};
//------------------------------------------------------------------------------
class NullCollectorImp : public NullCollector
{
private:
public:
NullCollectorImp ()
{
}
~NullCollectorImp ()
{
}
Hook make_hook (HookImpl::HandlerType const&)
{
return Hook (std::make_shared <detail::NullHookImpl> ());
}
Counter make_counter (std::string const&)
{
return Counter (std::make_shared <detail::NullCounterImpl> ());
}
Event make_event (std::string const&)
{
return Event (std::make_shared <detail::NullEventImpl> ());
}
Gauge make_gauge (std::string const&)
{
return Gauge (std::make_shared <detail::NullGaugeImpl> ());
}
Meter make_meter (std::string const&)
{
return Meter (std::make_shared <detail::NullMeterImpl> ());
}
};
}
//------------------------------------------------------------------------------
std::shared_ptr <Collector> NullCollector::New ()
{
return std::make_shared <detail::NullCollectorImp> ();
}
}
}

Some files were not shown because too many files have changed in this diff Show More