linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #05811
[Merge] lp:~dcplusplus-team/dcplusplus/dcpp-plugins into lp:dcplusplus
iceman50 has proposed merging lp:~dcplusplus-team/dcplusplus/dcpp-plugins into lp:dcplusplus.
Requested reviews:
Dcplusplus-team (dcplusplus-team)
For more details, see:
https://code.launchpad.net/~dcplusplus-team/dcplusplus/dcpp-plugins/+merge/112937
This introduces the PluginAPI to DC++
--
The attached diff has been truncated due to its size.
https://code.launchpad.net/~dcplusplus-team/dcplusplus/dcpp-plugins/+merge/112937
Your team Dcplusplus-team is requested to review the proposed merge of lp:~dcplusplus-team/dcplusplus/dcpp-plugins into lp:dcplusplus.
=== added file '.bzrignore'
--- .bzrignore 1970-01-01 00:00:00 +0000
+++ .bzrignore 2012-07-01 17:31:20 +0000
@@ -0,0 +1,23 @@
+./build
+./.project
+./.cproject
+./.sconsign.dblite
+./.settings
+custom.py
+*.lib
+*.pdb
+./dcpp/version-revno.inc
+./htmlhelp/include/htmlhelp.h
+./htmlhelp/lib/htmlhelp.lib
+natupnp.h
+./help/changelog.html
+./help/compile.html
+./help/cshelp.h
+./.pydevproject
+./doc
+.sconf_temp
+config.log
+.sconsign.dblite
+openssl/build/openssl*
+./msvc/debug-*
+./msvc/release-*
=== renamed file '.bzrignore' => '.bzrignore.moved'
=== added file 'ADC.txt'
--- ADC.txt 1970-01-01 00:00:00 +0000
+++ ADC.txt 2012-07-01 17:31:20 +0000
@@ -0,0 +1,1 @@
+See <http://adc.sourceforge.net/> for ADC documentation.
=== renamed file 'ADC.txt' => 'ADC.txt.moved'
=== added file 'COPYING.TXT'
--- COPYING.TXT 1970-01-01 00:00:00 +0000
+++ COPYING.TXT 2012-07-01 17:31:20 +0000
@@ -0,0 +1,30 @@
+DC++ COPYING.TXT
+
+--------------------------------------------------
+DC++
+Copyright (C) 2001-2012 Jacek Sieka, arnetheduck on gmail com
+License
+
+This program is licensed under GPL-2 with the notable exception
+that you may compile and link it with OpenSSL (www.openssl.org)
+and WTL (wtl.sourceforge.net).
+You can find the full text of the license in License.txt that
+should have been distributed with the rest of the application.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+GeoIP database Copyright (c) 2003 MaxMind LLC. All Rights Reserved.
+This product includes GeoIP data created by MaxMind, available from
+http://maxmind.com/
=== renamed file 'COPYING.TXT' => 'COPYING.TXT.moved'
=== added file 'Compile.txt'
--- Compile.txt 1970-01-01 00:00:00 +0000
+++ Compile.txt 2012-07-01 17:31:20 +0000
@@ -0,0 +1,156 @@
+= Compiling DC++
+
+
+1. Application and Dependency versions needed
+
+ * A modern C++ compiler; see #2.
+
+ * Python - 2.5.x
+ <http://www.python.org>
+
+ Note: Python 3.x is incompatible with SCons as of writing this.
+ Make sure that Python is in your PATH environment variable.
+
+ * SCons - 0.98.5 but using the most recent version is recommended
+ <http://www.scons.org/download.php>
+
+ Note: SCons relies on Python so you need to have Python installed first.
+ Make sure that SCons is in your PATH environment variable.
+
+ * Perl - 5.12.0.1 (from MSYS, Cygwin or ActivePerl; only needed to build help files)
+ <http://www.perl.org/get.html>
+
+ Make sure that Perl is in your PATH environment variable.
+
+ * gettext runtime & tools - 0.17 or later
+ <http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/>
+
+ Make sure that the gettext tools are in your PATH environment variable.
+
+ * Html Help Workshop (only needed to build help files)
+ <http://msdn.microsoft.com/en-us/library/ms669985%28VS.85%29.aspx>
+
+ Go to your HTML Help Workshop include directory (HTML Help Workshop/include) and copy
+ htmlhelp.h to the htmlhelp/include directory of the DC++ source.
+ Go to your HTML Help Workshop lib directory (HTML Help Workshop/lib) and copy htmlhelp.lib
+ to the htmlhelp/lib directory of the DC++ source.
+ Make sure that hhc.exe is in your PATH environment variable.
+
+ * asciidoc (only needed to build help files)
+ <http://www.methods.co.nz/asciidoc/>
+
+ Make sure that asciidoc is in your PATH environment variable.
+
+ * Unicode NSIS (only needed to build the installer)
+ <http://code.google.com/p/unsis/>
+
+ Make sure that makensis.exe is in your PATH environment variable.
+ Make sure that you are using the Unicode version of the installer builder.
+
+ * zip (from MSYS or Cygwin; only needed to build the official distro)
+
+ Make sure that zip is in your PATH environment variable.
+
+
+2. Compiler
+
+ a. MinGW (GCC 4.7 or later):
+ <http://sourceforge.net/projects/mingw/files/>
+
+ The easiest way to install is via mingw-get. Extract it to C:\MinGW and run:
+ mingw-get install gcc g++
+ A graphical installer around mingw-get is also available to facilitate the above.
+
+ Make sure that MinGW\bin is in your PATH environment variable.
+
+ Alternatively, if you have Cygwin, a MinGW compiler can be installed as part of Cygwin:
+ select it in the "Devel" category when running the Cygwin installer.
+ To make DC++ use it, add "prefix=i686-pc-mingw32-" to the scons arguments or create a
+ custom.py file containing:
+ prefix='i686-pc-mingw32-'
+ Make sure that Cygwin\bin is in your PATH environment variable.
+
+ Also grab natupnp.h from the Windows SDK and place it in the root of the repository.
+ <http://msdn.microsoft.com/en-us/windows/bb980924>
+
+ b. Microsoft Visual Studio 2012:
+ <http://msdn.microsoft.com/en-us/visualc/default.aspx>
+
+ Download OpenSSL from www.openssl.org and compile it. You should get libraries called
+ libeay32.lib and ssleay32.lib; copy them in openssl/lib.
+
+ To compile DC++ in debug mode, OpenSSL libraries have to be compiled in debug mode too
+ (read their instructions file; it's a matter of adding "debug" in the do_* file you use).
+ Rename debug libraries to libeay32d.lib and ssleay32d.lib; put them in openssl/lib.
+
+ To generate project files for MSVC, run "scons" with "msvcproj=1" and "tools=default".
+ [Temporary until SCons fully supports VS 2012: the above command has to be run from a VS
+ command prompt.]
+ The resulting solution file (DCPlusPlus.sln) will be in msvc/[mode-arch]/.
+
+
+3. Starting the build process
+
+ Open a command prompt and type "scons" followed by some options:
+
+ "tools=mingw" - Use mingw for building (default)
+ "tools=default" - Use msvc for building (yes, the option value is strange)
+ "mode=debug" - Compile a debug build (default)
+ "mode=release" - Compile an optimized release build
+
+ To see more options, type "scons -h".
+
+ Tip: You can create a file custom.py and put your options in there.
+
+ You can choose which targets to build; eg:
+ scons build/debug-mingw/dwt
+ will only build DWT with MinGW in debug mode. By default, when no target is specified, SCons builds all targets.
+ For more possible arguments, consult the SCons manual.
+
+ If you have problems, use google. It works for me.
+
+
+4. Other information and submitting patches
+
+ a. With doxygen, graphviz and some luck, you can use the supplied doxygen configuration
+ file to generate some nice docs. Just check that the paths in the doxyfile are correct.
+
+ b. In the event you experience crashing you can check the howto guide for debugging
+ at <https://answers.launchpad.net/dcplusplus/+faq/337>
+
+ Note that DCPlusPlus.exe is stripped by default when it has been built with MinGW;
+ debugging symbols instead reside in DCPlusPlus.pdb. To get GDB to swallow it, start it with
+ the following command:
+ gdb -e DCPlusPlus.exe -s DCPlusPlus.pdb
+
+ c. Linux / Unix:
+
+ Look at <http://launchpad.net/linuxdcpp> for the *nix port of DC++ - they'll gladly accept any help.
+
+ d. Submitting patches
+
+ If you think you've done something that more people could use, you can always submit a
+ patch for inclusion in the original distribution. I will then consider whether I like
+ the patch or not based on things that might seem to be completely random, which just
+ might be the case. Popular reasons for rejecting a patch include, but are not limited
+ to, ugly code, abusable features, features that I don't like that bloat the application
+ and incompatibility with other modifications I've already done.
+
+ To increase the chances of your patch being accepted, do it like this:
+ 1) Check out the latest code from BZR (see <https://code.launchpad.net/dcplusplus> for instructions)
+ 2) Make your modification. If you make other modifications apart from the one you want to submit, do them
+ on a separate copy of the DC++ source code and then copy them to this folder.
+ 3) In the source root folder (the one with this file in it) do "bzr diff > my-patch.diff". In alternative,
+ commit to your local branch and send a merge instruction using bzr send. See a bzr howto for detailed instructions.
+ 4) Open a bug at https://bugs.launchpad.net/dcplusplus and attach your patch. If this doesn't suit you,
+ send the patch along with a description to the dcplusplus-devel mailing list (more information here:
+ <http://sourceforge.net/mail/?group_id=40287>). Please make sure to include a copyright handover notice (see below).
+
+
+ e. Licensing issues with submitted patches
+
+ In order to avoid future licensing issues, I ask you to give me copyright over any submitted code.
+ If you don't like this policy, you are free to start your own distribution (as
+ many have done), and if you're lucky it might become more popular than the original =). Please
+ state explicitly when submitting the patch that you give me copyright over the code if the submission is larger
+ than trivial.
=== renamed file 'Compile.txt' => 'Compile.txt.moved'
=== added file 'Doxyfile'
--- Doxyfile 1970-01-01 00:00:00 +0000
+++ Doxyfile 2012-07-01 17:31:20 +0000
@@ -0,0 +1,1517 @@
+# Doxyfile 1.5.8
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+# TAG = value [value, ...]
+# For lists items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+DOXYFILE_ENCODING = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME = DC++
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number.
+# This could be handy for archiving the generated documentation or
+# if some version control system is used.
+
+PROJECT_NUMBER =
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY = doc
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# Croatian, Czech, Danish, Dutch, Farsi, Finnish, French, German, Greek,
+# Hungarian, Italian, Japanese, Japanese-en (Japanese with English messages),
+# Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, Polish,
+# Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, Slovene,
+# Spanish, Swedish, and Ukrainian.
+
+OUTPUT_LANGUAGE = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF =
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip.
+
+STRIP_FROM_PATH =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful is your file systems
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like regular Qt-style comments
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF = YES
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
+# interpret the first line (until the first dot) of a Qt-style
+# comment as the brief description. If set to NO, the comments
+# will behave just like regular Qt-style comments (thus requiring
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# re-implements.
+
+INHERIT_DOCS = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE = 4
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
+# sources only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for
+# Java. For instance, namespaces will be presented as packages, qualified
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources only. Doxygen will then generate output that is more tailored for
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it parses.
+# With this tag you can assign which parser to use for a given extension.
+# Doxygen has a built-in mapping, but you can override or extend it using this tag.
+# The format is ext=language, where ext is a file extension, and language is one of
+# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP,
+# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat
+# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran),
+# use: inc=Fortran f=C
+
+EXTENSION_MAPPING =
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should
+# set this tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
+# func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT = YES
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
+# Doxygen will parse them like normal C++ but will assume all classes use public
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate getter
+# and setter methods for a property. Setting this option to YES (the default)
+# will make doxygen to replace the get and set methods by a property in the
+# documentation. This will only work if the methods are indeed getting or
+# setting a simple type. If this is not the case, or you want to show the
+# methods anyway, you should set this option to NO.
+
+IDL_PROPERTY_SUPPORT = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
+SUBGROUPING = YES
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
+# is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically
+# be useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT = NO
+
+# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
+# determine which symbols to keep in memory and which to flush to disk.
+# When the cache is full, less often used symbols will be written to disk.
+# For small to medium size projects (<1000 input files) the default value is
+# probably good enough. For larger projects a too small cache size can cause
+# doxygen to be busy swapping symbols to and from disk most of the time
+# causing a significant performance penality.
+# If the system has enough physical memory increasing the cache will improve the
+# performance by keeping more symbols in memory. Note that the value works on
+# a logarithmic scale so increasing the size by one will rougly double the
+# memory usage. The cache size is given by this formula:
+# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
+# corresponding to a cache size of 2^16 = 65536 symbols
+
+SYMBOL_CACHE_SIZE = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE = YES
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base
+# name of the file that contains the anonymous namespace. By default
+# anonymous namespace are hidden.
+
+EXTRACT_ANON_NSPACES = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS = YES
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES = NO
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
+# declaration order.
+
+SORT_BRIEF_DOCS = YES
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
+# hierarchy of group names into alphabetical order. If set to NO (the default)
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or define consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and defines in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES = NO
+
+# If the sources in your project are distributed over multiple directories
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
+# This will remove the Files entry from the Quick Index and from the
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
+# Namespaces page.
+# This will remove the Namespaces entry from the Quick Index
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
+# provided by doxygen. Whatever the program writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by
+# doxygen. The layout file controls the global structure of the generated output files
+# in an output format independent way. The create the layout file that represents
+# doxygen's defaults, run doxygen with the -l option. You can optionally specify a
+# file name after the option, if omitted DoxygenLayout.xml will be used as the name
+# of the layout file.
+
+LAYOUT_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED = NO
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for
+# functions that are documented, but have no documentation for their parameters
+# or return value. If set to NO (the default) doxygen will only warn about
+# wrong or incomplete parameter documentation, but not about the absence of
+# documentation.
+
+WARN_NO_PARAMDOC = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT = dcpp \
+ win32 \
+ dwt
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
+# also the default input encoding. Doxygen uses libiconv (or the iconv built
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
+# the list of possible encodings.
+
+INPUT_ENCODING = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
+
+FILE_PATTERNS =
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE =
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
+# directories that are symbolic links (a Unix filesystem feature) are excluded
+# from the input.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS =
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output.
+# If FILTER_PATTERNS is specified, this tag will be
+# ignored.
+
+INPUT_FILTER =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis.
+# Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match.
+# The filters are a list of the form:
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
+# is applied to all files.
+
+FILTER_PATTERNS =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+# Note: To get rid of all source code in the generated output, make sure also
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER = YES
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES
+# then for each documented function all documented
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = YES
+
+# If the REFERENCES_RELATION tag is set to YES
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION = YES
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code.
+# Otherwise they will link to the documentation.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code
+# will point to the HTML generated by the htags(1) tool instead of doxygen
+# built-in source browser. The htags tool is part of GNU's global source
+# tagging system (see http://www.gnu.org/software/global/global.html). You
+# will need version 4.8.6 or higher.
+
+USE_HTAGS = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX = YES
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX = 4
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header.
+
+HTML_HEADER =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet. Note that doxygen will try to copy
+# the style sheet file to the HTML output directory, so don't put your own
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET = doxygen.css
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
+# files or namespaces will be aligned in HTML using tables. If set to
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded. For this to work a browser that supports
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS = NO
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files
+# will be generated that can be used as input for Apple's Xcode 3
+# integrated development environment, introduced with OSX 10.5 (Leopard).
+# To create a documentation set, doxygen will generate a Makefile in the
+# HTML output directory. Running make will produce the docset in that
+# directory and running "make install" will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
+# it at startup.
+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information.
+
+GENERATE_DOCSET = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
+# feed. A documentation feed provides an umbrella under which multiple
+# documentation sets from a single provider (such as a company or product suite)
+# can be grouped.
+
+DOCSET_FEEDNAME = "Doxygen generated docs"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
+# should uniquely identify the documentation set bundle. This should be a
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID = org.doxygen.Project
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP = YES
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output directory.
+
+CHM_FILE =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI = YES
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file
+# content.
+
+CHM_INDEX_ENCODING =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND = YES
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER
+# are set, an additional index file will be generated that can be used as input for
+# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated
+# HTML documentation.
+
+GENERATE_QHP = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
+# be used to specify the file name of the resulting .qch file.
+# The path specified is relative to the HTML output folder.
+
+QCH_FILE =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#namespace
+
+QHP_NAMESPACE =
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#virtual-folders
+
+QHP_VIRTUAL_FOLDER = doc
+
+# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add.
+# For more information please see
+# http://doc.trolltech.com/qthelpproject.html#custom-filters
+
+QHP_CUST_FILTER_NAME =
+
+# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see
+# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">Qt Help Project / Custom Filters</a>.
+
+QHP_CUST_FILTER_ATTRS =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's
+# filter section matches.
+# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">Qt Help Project / Filter Attributes</a>.
+
+QHP_SECT_FILTER_ATTRS =
+
+# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
+# be used to specify the location of Qt's qhelpgenerator.
+# If non-empty doxygen will try to run qhelpgenerator on the generated
+# .qhp file.
+
+QHG_LOCATION =
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it.
+
+DISABLE_INDEX = NO
+
+# This tag can be used to set the number of enum values (range [1..20])
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE = 6
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information.
+# If the tag value is set to FRAME, a side panel will be generated
+# containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+,
+# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are
+# probably better off using the HTML help feature. Other possible values
+# for this tag are: HIERARCHIES, which will generate the Groups, Directories,
+# and Class Hierarchy pages using a tree view instead of an ordered list;
+# ALL, which combines the behavior of FRAME and HIERARCHIES; and NONE, which
+# disables this behavior completely. For backwards compatibility with previous
+# releases of Doxygen, the values YES and NO are equivalent to FRAME and NONE
+# respectively.
+
+GENERATE_TREEVIEW = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH = 250
+
+# Use this tag to change the font size of Latex formulas included
+# as images in the HTML documentation. The default is 10. Note that
+# when you change the font size after a successful doxygen run you need
+# to manually remove any form_*.png images from the HTML output directory
+# to force them to be regenerated.
+
+FORMULA_FONTSIZE = 10
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
+
+LATEX_CMD_NAME = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, a4wide, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS = NO
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX = NO
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
+# in the output.
+
+LATEX_HIDE_INDICES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation.
+
+GENERATE_XML = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD =
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_PERLMOD = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader.
+# This is useful
+# if you want to understand what is going on.
+# On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION = YES
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF = YES
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed. To prevent a macro definition from being
+# undefined via #undef or recursively expanded use the := operator
+# instead of the = operator.
+
+PREDEFINED = UNICODE \
+ _UNICODE \
+ _WIN32 \
+ REENTRANT \
+ "GETSETREF(a,b,c)=private: a b; public: const a& get##c() const {}; void set##c(const a&) {};" \
+ "GETSET(a,b,c)=private: a b; public: a get##c() const {}; void set##c(a) {};"
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all function-like macros that are alone
+# on a line, have an all uppercase name, and do not end with a semicolon. Such
+# function macros are typically used for boiler-plate code, and will confuse
+# the parser if not removed.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles.
+# Optionally an initial location of the external documentation
+# can be added for each tagfile. The format of a tag file without
+# this location is as follows:
+#
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+#
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where "loc1" and "loc2" can be relative or absolute paths or
+# URLs. If a location is present for each tag, the installdox tool
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
+EXTERNAL_GROUPS = NO
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
+# or super classes. Setting the tag to NO turns the diagrams off. Note that
+# this option is superseded by the HAVE_DOT option below. This is only a
+# fallback. It is recommended to install and use dot, since it yields more
+# powerful graphs.
+
+CLASS_DIAGRAMS = YES
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH =
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS = NO
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT = YES
+
+# By default doxygen will write a font called FreeSans.ttf to the output
+# directory and reference it in all dot files that doxygen generates. This
+# font does not include all possible unicode characters however, so when you need
+# these (or just want a differently looking font) you can specify the font name
+# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
+# which can be done by putting it in a standard location or by setting the
+# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
+# containing the font.
+
+DOT_FONTNAME = FreeSans
+
+# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
+# The default size is 10pt.
+
+DOT_FONTSIZE = 10
+
+# By default doxygen will tell dot to use the output directory to look for the
+# FreeSans.ttf font (which doxygen will put there itself). If you specify a
+# different font using DOT_FONTNAME you can set the path where dot
+# can find it using this tag.
+
+DOT_FONTPATH =
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH = YES
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+
+UML_LOOK = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH = YES
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then
+# doxygen will generate a call dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable call graphs
+# for selected functions only using the \callgraph command.
+
+CALL_GRAPH = YES
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
+# doxygen will generate a caller dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable caller
+# graphs for selected functions only using the \callergraph command.
+
+CALLER_GRAPH = YES
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY = YES
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
+# then doxygen will show the dependencies a directory has on other directories
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+DOTFILE_DIRS =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
+# nodes that will be shown in the graph. If the number of nodes in a graph
+# becomes larger than this value, doxygen will truncate the graph, which is
+# visualized by representing a node as a red box. Note that doxygen if the
+# number of direct children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES = 200
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not
+# seem to support this out of the box. Warning: Depending on the platform used,
+# enabling this option may lead to badly anti-aliased labels on the edges of
+# a graph (i.e. they become hard to read).
+
+DOT_TRANSPARENT = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS = YES
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP = YES
+
+#---------------------------------------------------------------------------
+# Options related to the search engine
+#---------------------------------------------------------------------------
+
+# The SEARCHENGINE tag specifies whether or not a search engine should be
+# used. If set to NO the values of all tags below this one will be ignored.
+
+SEARCHENGINE = NO
=== renamed file 'Doxyfile' => 'Doxyfile.moved'
=== added file 'Extensions.txt'
--- Extensions.txt 1970-01-01 00:00:00 +0000
+++ Extensions.txt 2012-07-01 17:31:20 +0000
@@ -0,0 +1,265 @@
+This document describes the extensions I've made to the DC protocol, to be
+able to support extra functionality. Those are of course subject to change
+and discussion but I'll try to keep it as up to date as possible. Other
+clients are most welcome to follow this scheme and use the features
+presented here as they wish. The main scheme stems from a discussion
+sometime ago on the javadc-devel list on sourceforge...
+
+Note; I assume familiarity with the dc protocol as used in neomodus dc
+1.00091...
+
+The main idea behind the protocol is that when setting up the connection,
+each client tells the other one about all commands it understands, and
+after that, use those commands as pleased...to be able to do this we need
+to add a command to the protocol that tells the other client about the
+features it supports. We also need to make sure that only clients that
+have a fair chance of understanding this command (to avoid unneccesary
+data being sent and to avoid confusing other clients). The scheme I've
+chosen is based on the $Lock information being sent upon setting up a
+connection, where a client that supports the extension command sends a
+special string in the lock, to let the other one know that it supports
+the extended commands. When having found such a client, it sends
+information about all features it supports before sending a correctly
+computed $Key.
+
+On a side note; DC++ requires commands to come in a certain order to be
+able to efficiently use resources and will ignore any commands out of
+order (such as multiple $Send commands). This also improves the
+determinism of the protocol.
+
+
+*** Client-Client communication ***
+
+Feature: Supports
+Since: 0.17
+
+Purpose: To identify which features a certain client supports
+
+Usage: "$Supports <feature1> <feature2> ... <featureN>|"
+<featurename> = Case sensitive string describing the feature that a
+certain client supports. This should be the name of the command being
+sent, i e if a client supports a command "$GetBZListLen|", featurename
+should be GetBZListLen, unless of course, this is not a feature that
+requires sending extra data. Feature names may (obviously) not contain
+spaces. Empty $Supports should not be sent.
+
+Should be sent: After receiving $Lock but before sending $Key
+
+Notes: In the initial discussions, we thought about adding version
+information (something like "$Supports <name> <version>|"), but I've
+decided not to use this because 1) There could be problems with old
+versions, i e client x supports version 1.2, does that mean that it
+supports version 1.1 and 1.0 as well? 2) It's really easy to add a new
+version, i e "$Supports GetBZListLen GetBZListLen2|" to advertise an
+upgraded $GetBZListLen command.
+This command should only be sent if the $Lock starts with the exact string
+EXTENDEDPROTOCOL", to avoid confusing clients that don't understand it
+anyway. DC++ also uses the Pk part of the lock to identify exact client
+version, so a full $Lock string from a dc++ client is
+"$Lock EXTENDEDPROTOCOLxxxx Pk=DCPLUSPLUS0.164xxxx" where xxxx denotes
+some random data (not beginning with a number...=).
+
+--------------------------------------------------------------------
+
+Feature: MiniSlots
+Since: 0.304
+
+Usage: This allows the other client to use a free slot for small files /
+file list. $Supports is needed because nmdc closes the file list browser
+when the connection is broken, which it becomes when the client on the
+other side tries to download its first file and fails because it has no
+real slot (there were lots of nmdc users bitching about this...).
+
+--------------------------------------------------------------------
+
+Feature: GetZBlock
+Since: 0.307
+Deprecated - replaced by ADCGet
+
+Usage: Instead of $Get and $Send, use
+"$GetZBlock <start> <numbytes> <filename>|" where <start> is the 0-based
+(yes, 0-based, not like get that's 1-based) starting index of the file
+used, <numbytes> is the number of bytes to send and <filename> obviously
+is the filename. The other client then responds
+"$Sending <bytes>|<compressed data>", if the sending is ok or
+"$Failed <errordescription>|" if it isn't. If everything's ok, the data is
+sent until the whole uncompressed length has been sent. <bytes> specifies
+how many uncompressed bytes will be sent, not compressed, as the sending
+client doesn't know how well the file will compress. $Sending is
+needed to be able to distinguish the failure command from file data. Only
+one roundtrip is done for each block though, minimizing the need for
+maintaining states.
+
+Compression: Compression is done using ZLib (v 1.1.4 in DC++ 0.21's case),
+using dynamic compression level. The compression level can of course be
+changed by the implementator to reduce CPU usage, or even just store
+compression in the case of non-compressible files, which then works as
+adler32 check of the transferred data.
+
+Support of $GetZBlock also implies support for $UGetZBlock. The syntax
+and semantics of $UGetZBlock are the same as the $GetZBlock, but the
+filename must be given in utf-8 encoding.
+
+--------------------------------------------------------------------
+
+Feature: XmlBZList
+Since: 0.307
+
+Usage: Supporing this means supporting utf-8 XML file lists with the
+following general structure:
+
+<FileList Version="1" Generator="dc client name and version">
+ <Directory Name="xxx">
+ <Directory Name="yyy">
+ <File Name="zzz" Size="1"/>
+ </Directory>
+ </Directory>
+</FileList>
+
+In each directory, including the root, the name of the entity must be
+case-insensitive unique in that level of the hierarchy.
+
+Other fields may be added as necessary. DC++ for instance adds the
+TTH attribute to each file it knows the TTH root of in base32 encoding.
+
+The file list is available as "files.xml.bz2" (vs MyList.DcLst), and is
+compressed using bzip2.
+
+To retrieve unicode files from the file list, the client may also support
+the above GetZBlock and its utf-8 derivatives. Support for XmlBZList
+implies support for $UGetBlock, so files are guaranteed to be retrievable.
+
+$UGetBlock follows $UGetZBlock semantics, but without compressing
+the data. The <bytes> parameter of $Sending specifies how many bytes
+will be sent.
+
+Don't touch Version. Add your own, with a different name, if you feel
+compelled.
+
+Don't trust Generator to determine features of the file list. It's there
+mainly for debugging and informative purposes.
+
+--------------------------------------------------------------------
+
+Feature: ADCGet
+Since: 0.402
+
+Usage:
+
+"$ADCGET <type> <filename> <startpos> <bytes> <flag0>...<flagN>"
+A complete replacement for all binary data transfers using an ADC-like syntax.
+See the ADC specs to see how GET behaves. (http://dcplusplus.sf.net/ADC.html)
+
+--------------------------------------------------------------------
+
+Feature: TTHL
+Since: 0.402
+
+Usage:
+
+Supporting this means supporting the upload of tth leaf data. Instead
+of transfering the file itself, the TTH data of all leaves is transferred
+in binary. The size transferred back is the number of bytes of leaf data,
+from this and the file size the receiving client can calculate which
+level (tree depth) the sending client is offering. The receiver should
+obviosly check that the received leaf data is correct by rebuilding the
+tree and checking that it's recorded root matches.
+
+--------------------------------------------------------------------
+
+Feature: TTHF
+Since: 0.402
+
+Usage:
+
+Supporting this means supporting file identification by TTH root. This
+means supporting downloads by TTH root instead of share directory and
+name. The advantage is that moved files can still be found by the
+downloader without requeuing the file.
+
+The extension adds a namespace "TTH" before the ADC file root. A TTHF
+filename has the following syntax:
+
+TTH/<TTH root in base32, 192 binary bits>
+
+i e the TTH namespace consists of TTH root values directly under the
+"TTH/" root.
+
+The naming scheme is valid in all types (i e also for getting TTH leaves)
+
+--------------------------------------------------------------------
+
+Feature: ZLIG
+Since: 0.402
+
+Usage:
+
+Supporting this means that zlib compressed $ADCGET transfers are supported.
+
+--------------------------------------------------------------------
+
+*** Client-Hub communication ***
+
+Feature: Supports
+Since: 0.300
+
+Usage: "$Supports <feature1> <feature2> ... <featureN>|"
+This is mostly analogous to the client-client communcation part. The hub
+must send a $Lock that begins with "EXTENDEDPROTOCOL", which will prompt
+the client to answer with $Supports. Then, when a hub receives "$Supports"
+it _must_ answer with "$Supports" to tell the client about its features
+(which may differ from the ones the client supports). See client-client
+part for details. The hub must not send "EXTENDEDPROTOCOL" unless it
+supports at least one feature.
+
+Should be sent: After $Lock, before $Key
+
+--------------------------------------------------------------------
+
+Feature: UserCommand
+Since: 0.300
+
+Usage: See http://dcplusplus.sf.net/wiki/
+
+--------------------------------------------------------------------
+
+Feature: NoGetINFO
+Since: 0.302
+
+Usage: This indicates that hub doesn't need $GetINFO's to send out $MyINFO's
+at connect. This is a sort of light-weight QuickList that's very easy to
+implement and does half of QuickList's job.
+
+--------------------------------------------------------------------
+
+Feature: UserIP2
+Since: 0.305
+
+Usage: This indicates support for $UserIP, see http://dcplusplus.sf.net/wiki/
+
+--------------------------------------------------------------------
+
+Feature: NoHello
+Since: 0.305
+
+Usage: This indicates that the client doesn't need neither $Hello nor $NickList
+when connecting to a hub and receiving its users (i e $myinfo for each user is
+enough). It still accepts $Hello though (to add bots to the user list),
+and will still send getnicklist to indicate that it indeed is interested
+in the user list. It still requires a $hello to be sent about itself during login!
+--------------------------------------------------------------------
+
+Feature: GetZBlock
+Since: 0.307
+
+Usage: This indicates that the client is capable of compressed
+transfers, and has the option to use them enabled.
+
+--------------------------------------------------------------------
+
+Feature: TTHSearch
+Since: 0.307
+
+Usage: This indicates that the client supports searching for queued
+files by TTH, if there is one available to it. TTH searching is more
+CPU efficient than the previous method.
=== renamed file 'Extensions.txt' => 'Extensions.txt.moved'
=== added file 'License.txt'
--- License.txt 1970-01-01 00:00:00 +0000
+++ License.txt 2012-07-01 17:31:20 +0000
@@ -0,0 +1,290 @@
+DC++
+Copyright (C) 2001-2012 Jacek Sieka, arnetheduck at gmail dot com
+
+This program is licensed under GPL-2 with the notable exception
+that you may compile and link it with OpenSSL (www.openssl.org)
+and WTL (wtl.sourceforge.net).
+
+Here follows the full text of the GPL-2:
+
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
=== renamed file 'License.txt' => 'License.txt.moved'
=== added file 'SConstruct'
--- SConstruct 1970-01-01 00:00:00 +0000
+++ SConstruct 2012-07-01 17:31:20 +0000
@@ -0,0 +1,282 @@
+# vim: set filetype: py
+
+EnsureSConsVersion(0, 98, 5)
+
+import os,sys
+from build_util import Dev, gen_po_name
+
+# force DWARF 4 in order to benefit from the typed DWARF stack (duplicated type info entries are
+# grouped in a new .debug_types section). reduces the pdb size by 15MB and improves type resolution
+# in the crash logger.
+# TODO switch to DWARF 4 in the future when the following bugs are fixed:
+# - ICE when building in release mode
+# - GDB crash: <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47308>
+
+# TODO the ipa-cp-clone optimization is disabled; it causes a crash when starting a DL.
+
+# TODO enable LTO when it doesn't ICE... (-flto)
+
+gcc_flags = {
+ 'common': ['-g', '-Wall', '-Wextra', '-Wno-unused-parameter', '-Wno-unused-value', '-Wno-missing-field-initializers', '-Wno-address', '-fexceptions', '-mthreads'],
+ 'debug': [],
+ 'release' : ['-O3', '-fno-ipa-cp-clone', '-mwindows']
+}
+
+gcc_xxflags = {
+ 'common' : ['-std=gnu++11'],
+ 'debug' : [],
+ 'release' : []
+}
+
+msvc_flags = {
+ # 4100: unreferenced formal parameter
+ # 4121: alignment of member sensitive to packing
+ # 4127: conditional expression is constant
+ # 4189: var init'd, unused
+ # 4244: possible loss of data on conversion
+ # 4290: exception spec ignored
+ # 4355: "this" used in a constructor
+ # 4510: no default constructor
+ # 4512: assn not generated
+ # 4610: no default constructor
+ # 4706: assignment within conditional expression
+ # 4800: converting from BOOL to bool
+ # 4996: fn unsafe, use fn_s
+ 'common' : ['/W4', '/EHsc', '/Zi', '/Zm200', '/GR', '/FC', '/wd4100', '/wd4121', '/wd4127', '/wd4189', '/wd4244', '/wd4290', '/wd4355', '/wd4510', '/wd4512', '/wd4610', '/wd4706', '/wd4800', '/wd4996'],
+ 'debug' : ['/MDd'],
+ 'release' : ['/MD', '/O2']
+}
+
+msvc_xxflags = {
+ 'common' : [],
+ 'debug' : [],
+ 'release' : []
+}
+
+gcc_link_flags = {
+ 'common' : ['-g', '-static-libgcc', '-static-libstdc++', '-Wl,--no-undefined,--nxcompat,--dynamicbase', '-time', '-mthreads'],
+ 'debug' : [],
+ 'release' : ['-O3', '-mwindows']
+}
+
+msvc_link_flags = {
+ 'common' : ['/DEBUG', '/FIXED:NO', '/INCREMENTAL:NO', '/SUBSYSTEM:WINDOWS', '/MANIFESTUAC:NO'],
+ 'debug' : [],
+ 'release' : []
+}
+
+# TODO remove _VARIADIC_MAX if/when VC has proper variadic template support
+msvc_defs = {
+ 'common' : ['_REENTRANT', '_VARIADIC_MAX=10', 'snprintf=_snprintf'],
+ 'debug' : ['_DEBUG', '_HAS_ITERATOR_DEBUGGING=0', '_SECURE_SCL=0'],
+ 'release' : ['NDEBUG']
+}
+
+gcc_defs = {
+ 'common' : ['_REENTRANT', 'NO_VIZ'],
+ 'debug' : ['_DEBUG'],
+ 'release' : ['NDEBUG']
+}
+
+# --- cut ---
+
+# defEnv will hold a temporary Environment used to get options that can't be set after the actual
+# Environment has been created
+defEnv = Environment(ENV = os.environ)
+opts = Variables('custom.py', ARGUMENTS)
+opts.AddVariables(
+ EnumVariable('tools', 'Toolset to compile with, default = platform default (msvc under windows)', 'mingw', ['mingw', 'default']),
+ EnumVariable('mode', 'Compile mode', 'debug', ['debug', 'release']),
+ BoolVariable('pch', 'Use precompiled headers', 'yes'),
+ BoolVariable('verbose', 'Show verbose command lines', 'no'),
+ BoolVariable('savetemps', 'Save intermediate compilation files (assembly output)', 'no'),
+ BoolVariable('unicode', 'Build a Unicode version which fully supports international characters', 'yes'),
+ BoolVariable('stdatomic', 'Use a standard implementation of <atomic> (turn off to switch to Boost.Atomic)', 'no'),
+ BoolVariable('i18n', 'Rebuild i18n files', 'no'),
+ BoolVariable('help', 'Build help files (requires i18n=1)', 'yes'),
+ BoolVariable('webhelp', 'Build help files for the web (requires help=1)', 'no'),
+ ('prefix', 'Prefix to use when cross compiling', ''),
+ EnumVariable('arch', 'Target architecture', 'x86', ['x86', 'x64', 'ia64']),
+ BoolVariable('msvcproj', 'Build MSVC project files', 'no'),
+ BoolVariable('distro', 'Produce the official distro (forces tools=mingw, mode=release, unicode=1, i18n=1, help=1, webhelp=1, arch=x86)', 'no')
+)
+
+opts.Update(defEnv)
+Help(opts.GenerateHelpText(defEnv))
+
+if defEnv['distro']:
+ defEnv['tools'] = 'mingw'
+ defEnv['mode'] = 'release'
+ defEnv['unicode'] = 1
+ defEnv['i18n'] = 1
+ defEnv['help'] = 1
+ defEnv['webhelp'] = 1
+ defEnv['arch'] = 'x86'
+
+# workaround for SCons 1.2 which hard-codes possible archs (only allows 'x86' and 'amd64'...)
+# TODO remove when SCons knows about all available archs
+TARGET_ARCH = defEnv['arch']
+if TARGET_ARCH == 'x64':
+ TARGET_ARCH = 'amd64'
+
+env = Environment(ENV = os.environ, tools = [defEnv['tools']], options = opts,
+ TARGET_ARCH = TARGET_ARCH, MSVS_ARCH = TARGET_ARCH,
+ MSVC_USE_SCRIPT = False) # TODO this disables SCons' automatic env setup as it doesn't know about VC 11 yet
+
+if 'mingw' not in env['TOOLS'] and 'gcc' in env['TOOLS']:
+ raise Exception('Non-mingw gcc builds not supported')
+
+if env['distro']:
+ env['tools'] = 'mingw'
+ env['mode'] = 'release'
+ env['unicode'] = 1
+ env['i18n'] = 1
+ env['help'] = 1
+ env['webhelp'] = 1
+ env['arch'] = 'x86'
+
+# filter out boost from dependencies to get a speedier rebuild scan
+# this means that if boost changes, scons -c needs to be run
+# delete .sconsign.dblite to see the effects of this if you're upgrading
+def filterBoost(x):
+ return [y for y in x if str(y).find('boost') == -1]
+
+SourceFileScanner.function['.c'].recurse_nodes = filterBoost
+SourceFileScanner.function['.cpp'].recurse_nodes = filterBoost
+SourceFileScanner.function['.h'].recurse_nodes = filterBoost
+SourceFileScanner.function['.hpp'].recurse_nodes = filterBoost
+
+dev = Dev(env)
+dev.prepare()
+
+env.SConsignFile()
+
+env.Append(CPPPATH = ['#/', '#/boost/', '#/intl/', '#/atomic/'])
+
+if dev.is_win32():
+ # Windows header defines <http://msdn.microsoft.com/en-us/library/aa383745(VS.85).aspx>
+ env.Append(CPPDEFINES = [
+ '_WIN32_WINNT=0x502', # Windows XP SP2
+ 'WINVER=0x502', # Windows XP SP2
+ '_WIN32_IE=0x600', # Common Controls 6
+
+ # other defs that influence Windows headers
+ 'NOMINMAX', 'STRICT', 'WIN32_LEAN_AND_MEAN'])
+
+ # boost defines
+ env.Append(CPPDEFINES = ['BOOST_ALL_NO_LIB', 'BOOST_USE_WINDOWS_H'])
+
+if 'gcc' in env['TOOLS']:
+ if env['savetemps']:
+ env.Append(CCFLAGS = ['-save-temps', '-fverbose-asm'])
+ else:
+ env.Append(CCFLAGS = ['-pipe'])
+
+if env['pch']:
+ env.Append(CPPDEFINES = ['HAS_PCH'])
+
+if env['unicode']:
+ env.Append(CPPDEFINES = ['UNICODE', '_UNICODE'])
+
+if 'msvc' in env['TOOLS']:
+ flags = msvc_flags
+ xxflags = msvc_xxflags
+ link_flags = msvc_link_flags
+ defs = msvc_defs
+
+ env.Append(LIBS = ['User32', 'shell32', 'Advapi32'])
+
+else:
+ flags = gcc_flags
+ xxflags = gcc_xxflags
+ link_flags = gcc_link_flags
+ defs = gcc_defs
+
+ if env['mode'] == 'debug':
+ import sys
+ if sys.platform == 'win32':
+ env.Append(CCFLAGS = ['-mwindows'])
+ env.Append(LINKFLAGS = ['-mwindows'])
+ else:
+ env.Append(CPPDEFINES = ['CONSOLE'])
+
+ env.Tool("gch", toolpath=".")
+
+ env.Append(CPPPATH = ['#/htmlhelp/preload/', '#/htmlhelp/include/'])
+ html_lib = '#/htmlhelp/lib/'
+ if env['arch'] != 'x86':
+ html_lib = html_lib + env['arch'] + '/'
+ env.Append(LIBPATH = [html_lib])
+
+ # for MinGW64 to accept natupnp.h
+ env.Append(CPPDEFINES = ['__MIDL_user_allocate_free_DEFINED__'])
+
+env.Append(CPPDEFINES = defs[env['mode']])
+env.Append(CPPDEFINES = defs['common'])
+
+env.Append(CCFLAGS = flags[env['mode']])
+env.Append(CCFLAGS = flags['common'])
+
+env.Append(CXXFLAGS = xxflags[env['mode']])
+env.Append(CXXFLAGS = xxflags['common'])
+
+env.Append(LINKFLAGS = link_flags[env['mode']])
+env.Append(LINKFLAGS = link_flags['common'])
+
+env.SourceCode('.', None)
+
+import SCons.Scanner
+SWIGScanner = SCons.Scanner.ClassicCPP(
+ "SWIGScan",
+ ".i",
+ "CPPPATH",
+ '^[ \t]*[%,#][ \t]*(?:include|import)[ \t]*(<|")([^>"]+)(>|")'
+)
+env.Append(SCANNERS=[SWIGScanner])
+
+#
+# internationalization (ardour.org provided the initial idea)
+#
+
+po_args = ['msgmerge', '-q', '--update', '--backup=none', '$TARGET', '$SOURCE']
+po_bld = Builder (action = Action([po_args], 'Updating translation $TARGET from $SOURCES'))
+env.Append(BUILDERS = {'PoBuild' : po_bld})
+
+mo_args = ['msgfmt', '-c', '-o', '$TARGET', '$SOURCE']
+mo_bld = Builder (action = [Action([mo_args], 'Compiling message catalog $TARGET from $SOURCES'),
+ Action(lambda target, source, env: gen_po_name(source[0], env), 'Generating $NAME_FILE')])
+env.Append(BUILDERS = {'MoBuild' : mo_bld})
+
+pot_args = ['xgettext', '--from-code=UTF-8', '--foreign-user', '--package-name=$PACKAGE',
+ '--copyright-holder=Jacek Sieka', '--msgid-bugs-address=dcplusplus-devel@xxxxxxxxxxxxxxxxxxxxx',
+ '--no-wrap', '--keyword=_', '--keyword=T_', '--keyword=TF_', '--keyword=TFN_:1,2',
+ '--keyword=F_', '--keyword=gettext_noop', '--keyword=N_', '--keyword=CT_', '--boost', '-s',
+ '--output=$TARGET', '$SOURCES']
+
+pot_bld = Builder (action = Action([pot_args], 'Extracting messages to $TARGET from $SOURCES'))
+env.Append(BUILDERS = {'PotBuild' : pot_bld})
+
+conf = Configure(env, conf_dir = dev.get_build_path('.sconf_temp'), log_file = dev.get_build_path('config.log'), clean = False, help = False)
+if conf.CheckCXXHeader(['windows.h', 'htmlhelp.h'], '<>'):
+ conf.env.Append(CPPDEFINES='HAVE_HTMLHELP_H')
+if conf.CheckCXXHeader('natupnp.h', '<>'):
+ conf.env.Append(CPPDEFINES='HAVE_NATUPNP_H')
+env = conf.Finish()
+
+dev.boost = dev.build('boost/')
+dev.dwarf = dev.build('dwarf/')
+dev.zlib = dev.build('zlib/')
+dev.bzip2 = dev.build('bzip2/')
+dev.geoip = dev.build('geoip/')
+dev.intl = dev.build('intl/')
+dev.miniupnpc = dev.build('miniupnpc/')
+dev.natpmp = dev.build('natpmp/')
+dev.dwt = dev.build('dwt/src/')
+dev.dwt_test = dev.build('dwt/test/')
+dev.client = dev.build('dcpp/')
+dev.help = dev.build('help/')
+dev.test = dev.build('test/')
+dev.utils = dev.build('utils/')
+dev.win32 = dev.build('win32/')
+dev.installer = dev.build('installer/')
+dev.finalize()
=== renamed file 'SConstruct' => 'SConstruct.moved'
=== added file 'ThirdPartyLicenses.txt'
--- ThirdPartyLicenses.txt 1970-01-01 00:00:00 +0000
+++ ThirdPartyLicenses.txt 2012-07-01 17:31:20 +0000
@@ -0,0 +1,267 @@
+Licenses contained in this file:
+- GeoIP license
+- MiniUPnPc license
+- libnatpmp license
+- OpenSSL license
+
+--- GeoIP license ---
+
+There are two licenses, one for the C library software, and one for
+the database.
+
+SOFTWARE LICENSE (C library)
+
+The GeoIP C Library is licensed under the GPL. For details see
+the COPYING file.
+
+OPEN DATA LICENSE (GeoIP Standard Edition Database)
+
+Copyright (c) 2003 MaxMind LLC. All Rights Reserved.
+
+All advertising materials and documentation mentioning features or use of
+this database must display the following acknowledgment:
+"This product includes GeoIP data created by MaxMind, available from
+http://maxmind.com/"
+
+Redistribution and use with or without modification, are permitted provided
+that the following conditions are met:
+1. Redistributions must retain the above copyright notice, this list of
+conditions and the following disclaimer in the documentation and/or other
+materials provided with the distribution.
+2. All advertising materials and documentation mentioning features or use of
+this database must display the following acknowledgement:
+"This product includes GeoIP data created by MaxMind, available from
+http://maxmind.com/"
+3. "MaxMind" may not be used to endorse or promote products derived from this
+database without specific prior written permission.
+
+THIS DATABASE IS PROVIDED BY MAXMIND.COM ``AS IS'' AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL MAXMIND.COM BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+DATABASE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+Some parts of this software distribution are derived from the APNIC, ARIN and
+RIPE databases (copyright details below). The author of this module makes no
+claims of ownership on those parts.
+
+APNIC conditions of use:
+
+The files are freely available for download and use on the condition that APNIC
+will not be held responsible for any loss or damage arising from the application
+of the information contained in these reports.
+
+APNIC endeavours to the best of its ability to ensure the accuracy of these
+reports; however, APNIC makes no guarantee in this regard.
+
+In particular, it should be noted that these reports seek to indicate the
+country where resources were first allocated or assigned. It is not intended
+that these reports be considered as an authoritative statement of the location
+in which any specific resource may currently be in use.
+
+ARIN database copyright:
+
+Copyright (c) American Registry for Internet Numbers. All rights reserved.
+
+RIPE database copyright:
+
+The information in the RIPE Database is available to the public for agreed
+Internet operation purposes, but is under copyright. The copyright statement is:
+
+"Except for agreed Internet operational purposes, no part of this publication
+may be reproduced, stored in a retrieval system, or transmitted, in any form or
+by any means, electronic, mechanical, recording, or otherwise, without prior
+permission of the RIPE NCC on behalf of the copyright holders. Any use of this
+material to target advertising or similar activities is explicitly forbidden and
+may be prosecuted. The RIPE NCC requests to be notified of any such activities
+or suspicions thereof."
+
+--- MiniUPnPc license ---
+
+MiniUPnPc
+Copyright (c) 2005-2011, Thomas BERNARD
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+--- libnatpmp license ---
+
+Copyright (c) 2007-2011, Thomas BERNARD
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+--- OpenSSL license ---
+
+ LICENSE ISSUES
+ ==============
+
+ The OpenSSL toolkit stays under a dual license, i.e. both the conditions of
+ the OpenSSL License and the original SSLeay license apply to the toolkit.
+ See below for the actual license texts. Actually both licenses are BSD-style
+ Open Source licenses. In case of any license issues related to OpenSSL
+ please contact openssl-core@xxxxxxxxxxx.
+
+ OpenSSL License
+ ---------------
+
+/* ====================================================================
+ * Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * openssl-core@xxxxxxxxxxx.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@xxxxxxxxxxxxx). This product includes software written by Tim
+ * Hudson (tjh@xxxxxxxxxxxxx).
+ *
+ */
+
+ Original SSLeay License
+ -----------------------
+
+/* Copyright (C) 1995-1998 Eric Young (eay@xxxxxxxxxxxxx)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@xxxxxxxxxxxxx).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to. The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code. The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@xxxxxxxxxxxxx).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * "This product includes cryptographic software written by
+ * Eric Young (eay@xxxxxxxxxxxxx)"
+ * The word 'cryptographic' can be left out if the rouines from the library
+ * being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ * the apps directory (application code) you must include an acknowledgement:
+ * "This product includes software written by Tim Hudson (tjh@xxxxxxxxxxxxx)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed. i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
=== renamed file 'ThirdPartyLicenses.txt' => 'ThirdPartyLicenses.txt.moved'
=== added directory 'atomic'
=== renamed directory 'atomic' => 'atomic.moved'
=== added directory 'atomic/boost'
=== added directory 'atomic/boost/atomic'
=== added file 'atomic/boost/atomic.hpp'
--- atomic/boost/atomic.hpp 1970-01-01 00:00:00 +0000
+++ atomic/boost/atomic.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,168 @@
+#ifndef BOOST_ATOMIC_HPP
+#define BOOST_ATOMIC_HPP
+
+// Copyright (c) 2011 Helge Bahmann
+//
+// 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)
+
+#include <cstddef>
+#include <boost/cstdint.hpp>
+
+#include <boost/atomic/detail/base.hpp>
+#if !defined(BOOST_ATOMIC_FORCE_FALLBACK)
+#include <boost/atomic/platform.hpp>
+#endif
+#include <boost/atomic/detail/type-classifier.hpp>
+#include <boost/type_traits/is_signed.hpp>
+
+namespace boost {
+
+#ifndef BOOST_ATOMIC_CHAR_LOCK_FREE
+#define BOOST_ATOMIC_CHAR_LOCK_FREE 0
+#endif
+
+#ifndef BOOST_ATOMIC_CHAR16_T_LOCK_FREE
+#define BOOST_ATOMIC_CHAR16_T_LOCK_FREE 0
+#endif
+
+#ifndef BOOST_ATOMIC_CHAR32_T_LOCK_FREE
+#define BOOST_ATOMIC_CHAR32_T_LOCK_FREE 0
+#endif
+
+#ifndef BOOST_ATOMIC_WCHAR_T_LOCK_FREE
+#define BOOST_ATOMIC_WCHAR_T_LOCK_FREE 0
+#endif
+
+#ifndef BOOST_ATOMIC_SHORT_LOCK_FREE
+#define BOOST_ATOMIC_SHORT_LOCK_FREE 0
+#endif
+
+#ifndef BOOST_ATOMIC_INT_LOCK_FREE
+#define BOOST_ATOMIC_INT_LOCK_FREE 0
+#endif
+
+#ifndef BOOST_ATOMIC_LONG_LOCK_FREE
+#define BOOST_ATOMIC_LONG_LOCK_FREE 0
+#endif
+
+#ifndef BOOST_ATOMIC_LLONG_LOCK_FREE
+#define BOOST_ATOMIC_LLONG_LOCK_FREE 0
+#endif
+
+#ifndef BOOST_ATOMIC_ADDRESS_LOCK_FREE
+#define BOOST_ATOMIC_ADDRESS_LOCK_FREE 0
+#endif
+
+#ifndef BOOST_ATOMIC_BOOL_LOCK_FREE
+#define BOOST_ATOMIC_BOOL_LOCK_FREE 0
+#endif
+
+#ifndef BOOST_ATOMIC_THREAD_FENCE
+#define BOOST_ATOMIC_THREAD_FENCE 0
+inline void
+atomic_thread_fence(memory_order)
+{
+}
+#endif
+
+#ifndef BOOST_ATOMIC_SIGNAL_FENCE
+#define BOOST_ATOMIC_SIGNAL_FENCE 0
+inline void
+atomic_signal_fence(memory_order order)
+{
+ atomic_thread_fence(order);
+}
+#endif
+
+template<typename T>
+class atomic : public detail::atomic::base_atomic<T, typename detail::atomic::type_classifier<T>::test, sizeof(T), boost::is_signed<T>::value > {
+private:
+ typedef T value_type;
+ typedef detail::atomic::base_atomic<T, typename detail::atomic::type_classifier<T>::test, sizeof(T), boost::is_signed<T>::value > super;
+public:
+ atomic(void) : super() {}
+ explicit atomic(const value_type & v) : super(v) {}
+
+ atomic & operator=(value_type v) volatile
+ {
+ super::operator=(v);
+ return *const_cast<atomic *>(this);
+ }
+private:
+ atomic(const atomic &) /* =delete */ ;
+ atomic & operator=(const atomic &) /* =delete */ ;
+};
+
+typedef atomic<char> atomic_char;
+typedef atomic<unsigned char> atomic_uchar;
+typedef atomic<signed char> atomic_schar;
+typedef atomic<uint8_t> atomic_uint8_t;
+typedef atomic<int8_t> atomic_int8_t;
+typedef atomic<unsigned short> atomic_ushort;
+typedef atomic<short> atomic_short;
+typedef atomic<uint16_t> atomic_uint16_t;
+typedef atomic<int16_t> atomic_int16_t;
+typedef atomic<unsigned int> atomic_uint;
+typedef atomic<int> atomic_int;
+typedef atomic<uint32_t> atomic_uint32_t;
+typedef atomic<int32_t> atomic_int32_t;
+typedef atomic<unsigned long> atomic_ulong;
+typedef atomic<long> atomic_long;
+typedef atomic<uint64_t> atomic_uint64_t;
+typedef atomic<int64_t> atomic_int64_t;
+#ifdef BOOST_HAS_LONG_LONG
+typedef atomic<unsigned long long> atomic_ullong;
+typedef atomic<long long> atomic_llong;
+#endif
+typedef atomic<void*> atomic_address;
+typedef atomic<bool> atomic_bool;
+
+class atomic_flag {
+public:
+ atomic_flag() : v_(false) {}
+ atomic_flag(bool b) : v_(b) {}
+
+ bool
+ test_and_set(memory_order order = memory_order_seq_cst)
+ {
+ return v_.exchange(true, order);
+ }
+
+ void
+ clear(memory_order order = memory_order_seq_cst) volatile
+ {
+ v_.store(false, order);
+ }
+private:
+ atomic_flag(const atomic_flag &) /* = delete */ ;
+ atomic_flag & operator=(const atomic_flag &) /* = delete */ ;
+ atomic<bool> v_;
+};
+
+typedef atomic<char> atomic_char;
+typedef atomic<unsigned char> atomic_uchar;
+typedef atomic<signed char> atomic_schar;
+typedef atomic<uint8_t> atomic_uint8_t;
+typedef atomic<int8_t> atomic_int8_t;
+typedef atomic<unsigned short> atomic_ushort;
+typedef atomic<short> atomic_short;
+typedef atomic<uint16_t> atomic_uint16_t;
+typedef atomic<int16_t> atomic_int16_t;
+typedef atomic<unsigned int> atomic_uint;
+typedef atomic<int> atomic_int;
+typedef atomic<uint32_t> atomic_uint32_t;
+typedef atomic<int32_t> atomic_int32_t;
+typedef atomic<unsigned long> atomic_ulong;
+typedef atomic<long> atomic_long;
+typedef atomic<uint64_t> atomic_uint64_t;
+typedef atomic<int64_t> atomic_int64_t;
+typedef atomic<unsigned long long> atomic_ullong;
+typedef atomic<long long> atomic_llong;
+typedef atomic<void*> atomic_address;
+typedef atomic<bool> atomic_bool;
+
+}
+
+#endif
=== added directory 'atomic/boost/atomic/detail'
=== added file 'atomic/boost/atomic/detail/base.hpp'
--- atomic/boost/atomic/detail/base.hpp 1970-01-01 00:00:00 +0000
+++ atomic/boost/atomic/detail/base.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,513 @@
+#ifndef BOOST_DETAIL_ATOMIC_BASE_HPP
+#define BOOST_DETAIL_ATOMIC_BASE_HPP
+
+// Copyright (c) 2009 Helge Bahmann
+//
+// 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)
+
+// Base class definition and fallback implementation.
+// To be overridden (through partial specialization) by
+// platform implementations.
+
+#include <string.h>
+
+#include <boost/memory_order.hpp>
+#include <boost/smart_ptr/detail/spinlock_pool.hpp>
+
+#define BOOST_ATOMIC_DECLARE_BASE_OPERATORS \
+ operator value_type(void) volatile const \
+ { \
+ return load(memory_order_seq_cst); \
+ } \
+ \
+ this_type & \
+ operator=(value_type v) volatile \
+ { \
+ store(v, memory_order_seq_cst); \
+ return *const_cast<this_type *>(this); \
+ } \
+ \
+ bool \
+ compare_exchange_strong( \
+ value_type & expected, \
+ value_type desired, \
+ memory_order order = memory_order_seq_cst) volatile \
+ { \
+ return compare_exchange_strong(expected, desired, order, calculate_failure_order(order)); \
+ } \
+ \
+ bool \
+ compare_exchange_weak( \
+ value_type & expected, \
+ value_type desired, \
+ memory_order order = memory_order_seq_cst) volatile \
+ { \
+ return compare_exchange_weak(expected, desired, order, calculate_failure_order(order)); \
+ } \
+ \
+
+#define BOOST_ATOMIC_DECLARE_ADDITIVE_OPERATORS \
+ value_type \
+ operator++(int) volatile \
+ { \
+ return fetch_add(1); \
+ } \
+ \
+ value_type \
+ operator++(void) volatile \
+ { \
+ return fetch_add(1) + 1; \
+ } \
+ \
+ value_type \
+ operator--(int) volatile \
+ { \
+ return fetch_sub(1); \
+ } \
+ \
+ value_type \
+ operator--(void) volatile \
+ { \
+ return fetch_sub(1) - 1; \
+ } \
+ \
+ value_type \
+ operator+=(difference_type v) volatile \
+ { \
+ return fetch_add(v) + v; \
+ } \
+ \
+ value_type \
+ operator-=(difference_type v) volatile \
+ { \
+ return fetch_sub(v) - v; \
+ } \
+
+#define BOOST_ATOMIC_DECLARE_BIT_OPERATORS \
+ value_type \
+ operator&=(difference_type v) volatile \
+ { \
+ return fetch_and(v) & v; \
+ } \
+ \
+ value_type \
+ operator|=(difference_type v) volatile \
+ { \
+ return fetch_or(v) | v; \
+ } \
+ \
+ value_type \
+ operator^=(difference_type v) volatile \
+ { \
+ return fetch_xor(v) ^ v; \
+ } \
+
+#define BOOST_ATOMIC_DECLARE_POINTER_OPERATORS \
+ BOOST_ATOMIC_DECLARE_BASE_OPERATORS \
+ BOOST_ATOMIC_DECLARE_ADDITIVE_OPERATORS \
+
+#define BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS \
+ BOOST_ATOMIC_DECLARE_BASE_OPERATORS \
+ BOOST_ATOMIC_DECLARE_ADDITIVE_OPERATORS \
+ BOOST_ATOMIC_DECLARE_BIT_OPERATORS \
+
+namespace boost {
+namespace detail {
+namespace atomic {
+
+static inline memory_order
+calculate_failure_order(memory_order order)
+{
+ switch(order) {
+ case memory_order_acq_rel:
+ return memory_order_acquire;
+ case memory_order_release:
+ return memory_order_relaxed;
+ default:
+ return order;
+ }
+}
+
+template<typename T, typename C , unsigned int Size, bool Sign>
+class base_atomic {
+private:
+ typedef base_atomic this_type;
+ typedef T value_type;
+ typedef detail::spinlock_pool<0>::scoped_lock guard_type;
+public:
+ base_atomic(void) {}
+
+ explicit base_atomic(const value_type & v)
+ {
+ memcpy(&v_, &v, Size);
+ }
+
+ void
+ store(value_type v, memory_order /*order*/ = memory_order_seq_cst) volatile
+ {
+ guard_type guard(const_cast<char *>(v_));
+
+ memcpy(const_cast<char *>(v_), &v, Size);
+ }
+
+ value_type
+ load(memory_order /*order*/ = memory_order_seq_cst) volatile const
+ {
+ guard_type guard(const_cast<const char *>(v_));
+
+ value_type v;
+ memcpy(&v, const_cast<const char *>(v_), Size);
+ return v;
+ }
+
+ bool
+ compare_exchange_strong(
+ value_type & expected,
+ value_type desired,
+ memory_order /*success_order*/,
+ memory_order /*failure_order*/) volatile
+ {
+ guard_type guard(const_cast<char *>(v_));
+
+ if (memcmp(const_cast<char *>(v_), &expected, Size) == 0) {
+ memcpy(const_cast<char *>(v_), &desired, Size);
+ return true;
+ } else {
+ memcpy(&expected, const_cast<char *>(v_), Size);
+ return false;
+ }
+ }
+
+ bool
+ compare_exchange_weak(
+ value_type & expected,
+ value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+ return compare_exchange_strong(expected, desired, success_order, failure_order);
+ }
+
+ value_type
+ exchange(value_type v, memory_order /*order*/=memory_order_seq_cst) volatile
+ {
+ guard_type guard(const_cast<char *>(v_));
+
+ value_type tmp;
+ memcpy(&tmp, const_cast<char *>(v_), Size);
+
+ memcpy(const_cast<char *>(v_), &v, Size);
+ return tmp;
+ }
+
+ bool
+ is_lock_free(void) const volatile
+ {
+ return false;
+ }
+
+ BOOST_ATOMIC_DECLARE_BASE_OPERATORS
+private:
+ base_atomic(const base_atomic &) /* = delete */ ;
+ void operator=(const base_atomic &) /* = delete */ ;
+
+ char v_[Size];
+};
+
+template<typename T, unsigned int Size, bool Sign>
+class base_atomic<T, int, Size, Sign> {
+private:
+ typedef base_atomic this_type;
+ typedef T value_type;
+ typedef T difference_type;
+ typedef detail::spinlock_pool<0>::scoped_lock guard_type;
+public:
+ explicit base_atomic(value_type v) : v_(v) {}
+ base_atomic(void) {}
+
+ void
+ store(value_type v, memory_order /*order*/ = memory_order_seq_cst) volatile
+ {
+ guard_type guard(const_cast<value_type *>(&v_));
+
+ v_ = v;
+ }
+
+ value_type
+ load(memory_order /*order*/ = memory_order_seq_cst) const volatile
+ {
+ guard_type guard(const_cast<value_type *>(&v_));
+
+ value_type v = const_cast<const volatile value_type &>(v_);
+ return v;
+ }
+
+ value_type
+ exchange(value_type v, memory_order /*order*/ = memory_order_seq_cst) volatile
+ {
+ guard_type guard(const_cast<value_type *>(&v_));
+
+ value_type old = v_;
+ v_ = v;
+ return old;
+ }
+
+ bool
+ compare_exchange_strong(value_type & expected, value_type desired,
+ memory_order /*success_order*/,
+ memory_order /*failure_order*/) volatile
+ {
+ guard_type guard(const_cast<value_type *>(&v_));
+
+ if (v_ == expected) {
+ v_ = desired;
+ return true;
+ } else {
+ expected = v_;
+ return false;
+ }
+ }
+
+ bool
+ compare_exchange_weak(value_type & expected, value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+ return compare_exchange_strong(expected, desired, success_order, failure_order);
+ }
+
+ value_type
+ fetch_add(difference_type v, memory_order /*order*/ = memory_order_seq_cst) volatile
+ {
+ guard_type guard(const_cast<value_type *>(&v_));
+
+ value_type old = v_;
+ v_ += v;
+ return old;
+ }
+
+ value_type
+ fetch_sub(difference_type v, memory_order /*order*/ = memory_order_seq_cst) volatile
+ {
+ guard_type guard(const_cast<value_type *>(&v_));
+
+ value_type old = v_;
+ v_ -= v;
+ return old;
+ }
+
+ value_type
+ fetch_and(value_type v, memory_order /*order*/ = memory_order_seq_cst) volatile
+ {
+ guard_type guard(const_cast<value_type *>(&v_));
+
+ value_type old = v_;
+ v_ &= v;
+ return old;
+ }
+
+ value_type
+ fetch_or(value_type v, memory_order /*order*/ = memory_order_seq_cst) volatile
+ {
+ guard_type guard(const_cast<value_type *>(&v_));
+
+ value_type old = v_;
+ v_ |= v;
+ return old;
+ }
+
+ value_type
+ fetch_xor(value_type v, memory_order /*order*/ = memory_order_seq_cst) volatile
+ {
+ guard_type guard(const_cast<value_type *>(&v_));
+
+ value_type old = v_;
+ v_ ^= v;
+ return old;
+ }
+
+ bool
+ is_lock_free(void) const volatile
+ {
+ return false;
+ }
+
+ BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS
+private:
+ base_atomic(const base_atomic &) /* = delete */ ;
+ void operator=(const base_atomic &) /* = delete */ ;
+ value_type v_;
+};
+
+template<typename T, unsigned int Size, bool Sign>
+class base_atomic<T *, void *, Size, Sign> {
+private:
+ typedef base_atomic this_type;
+ typedef T * value_type;
+ typedef ptrdiff_t difference_type;
+ typedef detail::spinlock_pool<0>::scoped_lock guard_type;
+public:
+ explicit base_atomic(value_type v) : v_(v) {}
+ base_atomic(void) {}
+
+ void
+ store(value_type v, memory_order /*order*/ = memory_order_seq_cst) volatile
+ {
+ guard_type guard(const_cast<value_type *>(&v_));
+ v_ = v;
+ }
+
+ value_type
+ load(memory_order /*order*/ = memory_order_seq_cst) const volatile
+ {
+ guard_type guard(const_cast<value_type *>(&v_));
+
+ value_type v = const_cast<const volatile value_type &>(v_);
+ return v;
+ }
+
+ value_type
+ exchange(value_type v, memory_order /*order*/ = memory_order_seq_cst) volatile
+ {
+ guard_type guard(const_cast<value_type *>(&v_));
+
+ value_type old = v_;
+ v_ = v;
+ return old;
+ }
+
+ bool
+ compare_exchange_strong(value_type & expected, value_type desired,
+ memory_order /*success_order*/,
+ memory_order /*failure_order*/) volatile
+ {
+ guard_type guard(const_cast<value_type *>(&v_));
+
+ if (v_ == expected) {
+ v_ = desired;
+ return true;
+ } else {
+ expected = v_;
+ return false;
+ }
+ }
+
+ bool
+ compare_exchange_weak(value_type & expected, value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+ return compare_exchange_strong(expected, desired, success_order, failure_order);
+ }
+
+ value_type fetch_add(difference_type v, memory_order /*order*/ = memory_order_seq_cst) volatile
+ {
+ guard_type guard(const_cast<value_type *>(&v_));
+
+ value_type old = v_;
+ v_ += v;
+ return old;
+ }
+
+ value_type fetch_sub(difference_type v, memory_order /*order*/ = memory_order_seq_cst) volatile
+ {
+ guard_type guard(const_cast<value_type *>(&v_));
+
+ value_type old = v_;
+ v_ -= v;
+ return old;
+ }
+
+ bool
+ is_lock_free(void) const volatile
+ {
+ return false;
+ }
+
+ BOOST_ATOMIC_DECLARE_POINTER_OPERATORS
+private:
+ base_atomic(const base_atomic &) /* = delete */ ;
+ void operator=(const base_atomic &) /* = delete */ ;
+ value_type v_;
+};
+
+template<unsigned int Size, bool Sign>
+class base_atomic<void *, void *, Size, Sign> {
+private:
+ typedef base_atomic this_type;
+ typedef void * value_type;
+ typedef detail::spinlock_pool<0>::scoped_lock guard_type;
+public:
+ explicit base_atomic(value_type v) : v_(v) {}
+ base_atomic(void) {}
+
+ void
+ store(value_type v, memory_order /*order*/ = memory_order_seq_cst) volatile
+ {
+ guard_type guard(const_cast<value_type *>(&v_));
+ v_ = v;
+ }
+
+ value_type
+ load(memory_order /*order*/ = memory_order_seq_cst) const volatile
+ {
+ guard_type guard(const_cast<value_type *>(&v_));
+
+ value_type v = const_cast<const volatile value_type &>(v_);
+ return v;
+ }
+
+ value_type
+ exchange(value_type v, memory_order /*order*/ = memory_order_seq_cst) volatile
+ {
+ guard_type guard(const_cast<value_type *>(&v_));
+
+ value_type old = v_;
+ v_ = v;
+ return old;
+ }
+
+ bool
+ compare_exchange_strong(value_type & expected, value_type desired,
+ memory_order /*success_order*/,
+ memory_order /*failure_order*/) volatile
+ {
+ guard_type guard(const_cast<value_type *>(&v_));
+
+ if (v_ == expected) {
+ v_ = desired;
+ return true;
+ } else {
+ expected = v_;
+ return false;
+ }
+ }
+
+ bool
+ compare_exchange_weak(value_type & expected, value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+ return compare_exchange_strong(expected, desired, success_order, failure_order);
+ }
+
+ bool
+ is_lock_free(void) const volatile
+ {
+ return false;
+ }
+
+ BOOST_ATOMIC_DECLARE_BASE_OPERATORS
+private:
+ base_atomic(const base_atomic &) /* = delete */ ;
+ void operator=(const base_atomic &) /* = delete */ ;
+ value_type v_;
+};
+
+}
+}
+}
+
+#endif
=== added file 'atomic/boost/atomic/detail/cas32strong.hpp'
--- atomic/boost/atomic/detail/cas32strong.hpp 1970-01-01 00:00:00 +0000
+++ atomic/boost/atomic/detail/cas32strong.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,866 @@
+#ifndef BOOST_DETAIL_ATOMIC_CAS32STRONG_HPP
+#define BOOST_DETAIL_ATOMIC_CAS32STRONG_HPP
+
+// 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)
+//
+// Copyright (c) 2011 Helge Bahmann
+
+// Build 8-, 16- and 32-bit atomic operations from
+// a platform_cmpxchg32_strong primitive.
+
+#include <boost/memory_order.hpp>
+#include <boost/atomic/detail/base.hpp>
+
+namespace boost {
+namespace detail {
+namespace atomic {
+
+/* integral types */
+
+template<typename T, bool Sign>
+class base_atomic<T, int, 1, Sign> {
+ typedef base_atomic this_type;
+ typedef T value_type;
+ typedef T difference_type;
+ typedef uint32_t storage_type;
+public:
+ explicit base_atomic(value_type v) : v_(v) {}
+ base_atomic(void) {}
+
+ void
+ store(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ platform_fence_before_store(order);
+ const_cast<volatile storage_type &>(v_) = v;
+ platform_fence_after_store(order);
+ }
+
+ value_type
+ load(memory_order order = memory_order_seq_cst) const volatile
+ {
+ value_type v = const_cast<const volatile storage_type &>(v_);
+ platform_fence_after_load(order);
+ return v;
+ }
+
+ value_type
+ exchange(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type original = load(memory_order_relaxed);
+ do {
+ } while (!compare_exchange_weak(original, v, order, memory_order_relaxed));
+ return original;
+ }
+
+ bool
+ compare_exchange_weak(
+ value_type & expected,
+ value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+ return compare_exchange_strong(expected, desired, success_order, failure_order);
+ }
+
+ bool
+ compare_exchange_strong(
+ value_type & expected,
+ value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+ platform_fence_before(success_order);
+
+ storage_type expected_s = (storage_type) expected;
+ storage_type desired_s = (storage_type) desired;
+
+ bool success = platform_cmpxchg32_strong(expected_s, desired_s, &v_);
+
+ if (success) {
+ platform_fence_after(success_order);
+ } else {
+ platform_fence_after(failure_order);
+ expected = (value_type) expected_s;
+ }
+
+ return success;
+ }
+
+ value_type
+ fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type original = load(memory_order_relaxed);
+ do {
+ } while (!compare_exchange_weak(original, original + v, order, memory_order_relaxed));
+ return original;
+ }
+
+ value_type
+ fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type original = load(memory_order_relaxed);
+ do {
+ } while (!compare_exchange_weak(original, original - v, order, memory_order_relaxed));
+ return original;
+ }
+
+ value_type
+ fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type original = load(memory_order_relaxed);
+ do {
+ } while (!compare_exchange_weak(original, original & v, order, memory_order_relaxed));
+ return original;
+ }
+
+ value_type
+ fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type original = load(memory_order_relaxed);
+ do {
+ } while (!compare_exchange_weak(original, original | v, order, memory_order_relaxed));
+ return original;
+ }
+
+ value_type
+ fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type original = load(memory_order_relaxed);
+ do {
+ } while (!compare_exchange_weak(original, original ^ v, order, memory_order_relaxed));
+ return original;
+ }
+
+ bool
+ is_lock_free(void) const volatile
+ {
+ return true;
+ }
+
+ BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS
+private:
+ base_atomic(const base_atomic &) /* = delete */ ;
+ void operator=(const base_atomic &) /* = delete */ ;
+ storage_type v_;
+};
+
+template<typename T, bool Sign>
+class base_atomic<T, int, 2, Sign> {
+ typedef base_atomic this_type;
+ typedef T value_type;
+ typedef T difference_type;
+ typedef uint32_t storage_type;
+public:
+ explicit base_atomic(value_type v) : v_(v) {}
+ base_atomic(void) {}
+
+ void
+ store(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ platform_fence_before_store(order);
+ const_cast<volatile storage_type &>(v_) = v;
+ platform_fence_after_store(order);
+ }
+
+ value_type
+ load(memory_order order = memory_order_seq_cst) const volatile
+ {
+ value_type v = const_cast<const volatile storage_type &>(v_);
+ platform_fence_after_load(order);
+ return v;
+ }
+
+ value_type
+ exchange(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type original = load(memory_order_relaxed);
+ do {
+ } while (!compare_exchange_weak(original, v, order, memory_order_relaxed));
+ return original;
+ }
+
+ bool
+ compare_exchange_weak(
+ value_type & expected,
+ value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+ return compare_exchange_strong(expected, desired, success_order, failure_order);
+ }
+
+ bool
+ compare_exchange_strong(
+ value_type & expected,
+ value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+ platform_fence_before(success_order);
+
+ storage_type expected_s = (storage_type) expected;
+ storage_type desired_s = (storage_type) desired;
+
+ bool success = platform_cmpxchg32_strong(expected_s, desired_s, &v_);
+
+ if (success) {
+ platform_fence_after(success_order);
+ } else {
+ platform_fence_after(failure_order);
+ expected = (value_type) expected_s;
+ }
+
+ return success;
+ }
+
+ value_type
+ fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type original = load(memory_order_relaxed);
+ do {
+ } while (!compare_exchange_weak(original, original + v, order, memory_order_relaxed));
+ return original;
+ }
+
+ value_type
+ fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type original = load(memory_order_relaxed);
+ do {
+ } while (!compare_exchange_weak(original, original - v, order, memory_order_relaxed));
+ return original;
+ }
+
+ value_type
+ fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type original = load(memory_order_relaxed);
+ do {
+ } while (!compare_exchange_weak(original, original & v, order, memory_order_relaxed));
+ return original;
+ }
+
+ value_type
+ fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type original = load(memory_order_relaxed);
+ do {
+ } while (!compare_exchange_weak(original, original | v, order, memory_order_relaxed));
+ return original;
+ }
+
+ value_type
+ fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type original = load(memory_order_relaxed);
+ do {
+ } while (!compare_exchange_weak(original, original ^ v, order, memory_order_relaxed));
+ return original;
+ }
+
+ bool
+ is_lock_free(void) const volatile
+ {
+ return true;
+ }
+
+ BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS
+private:
+ base_atomic(const base_atomic &) /* = delete */ ;
+ void operator=(const base_atomic &) /* = delete */ ;
+ storage_type v_;
+};
+
+template<typename T, bool Sign>
+class base_atomic<T, int, 4, Sign> {
+ typedef base_atomic this_type;
+ typedef T value_type;
+ typedef T difference_type;
+public:
+ explicit base_atomic(value_type v) : v_(v) {}
+ base_atomic(void) {}
+
+ void
+ store(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ platform_fence_before_store(order);
+ const_cast<volatile value_type &>(v_) = v;
+ platform_fence_after_store(order);
+ }
+
+ value_type
+ load(memory_order order = memory_order_seq_cst) const volatile
+ {
+ value_type v = const_cast<const volatile value_type &>(v_);
+ platform_fence_after_load(order);
+ return v;
+ }
+
+ value_type
+ exchange(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type original = load(memory_order_relaxed);
+ do {
+ } while (!compare_exchange_weak(original, v, order, memory_order_relaxed));
+ return original;
+ }
+
+ bool
+ compare_exchange_weak(
+ value_type & expected,
+ value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+ return compare_exchange_strong(expected, desired, success_order, failure_order);
+ }
+
+ bool
+ compare_exchange_strong(
+ value_type & expected,
+ value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+ platform_fence_before(success_order);
+
+ bool success = platform_cmpxchg32_strong(expected, desired, &v_);
+
+ if (success) {
+ platform_fence_after(success_order);
+ } else {
+ platform_fence_after(failure_order);
+ }
+
+ return success;
+ }
+
+ value_type
+ fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type original = load(memory_order_relaxed);
+ do {
+ } while (!compare_exchange_weak(original, original + v, order, memory_order_relaxed));
+ return original;
+ }
+
+ value_type
+ fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type original = load(memory_order_relaxed);
+ do {
+ } while (!compare_exchange_weak(original, original - v, order, memory_order_relaxed));
+ return original;
+ }
+
+ value_type
+ fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type original = load(memory_order_relaxed);
+ do {
+ } while (!compare_exchange_weak(original, original & v, order, memory_order_relaxed));
+ return original;
+ }
+
+ value_type
+ fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type original = load(memory_order_relaxed);
+ do {
+ } while (!compare_exchange_weak(original, original | v, order, memory_order_relaxed));
+ return original;
+ }
+
+ value_type
+ fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type original = load(memory_order_relaxed);
+ do {
+ } while (!compare_exchange_weak(original, original ^ v, order, memory_order_relaxed));
+ return original;
+ }
+
+ bool
+ is_lock_free(void) const volatile
+ {
+ return true;
+ }
+
+ BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS
+private:
+ base_atomic(const base_atomic &) /* = delete */ ;
+ void operator=(const base_atomic &) /* = delete */ ;
+ value_type v_;
+};
+
+/* pointer types */
+
+template<bool Sign>
+class base_atomic<void *, void *, 4, Sign> {
+ typedef base_atomic this_type;
+ typedef void * value_type;
+ typedef ptrdiff_t difference_type;
+public:
+ explicit base_atomic(value_type v) : v_(v) {}
+ base_atomic(void) {}
+
+ void
+ store(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ platform_fence_before_store(order);
+ const_cast<volatile value_type &>(v_) = v;
+ platform_fence_after_store(order);
+ }
+
+ value_type
+ load(memory_order order = memory_order_seq_cst) const volatile
+ {
+ value_type v = const_cast<const volatile value_type &>(v_);
+ platform_fence_after_load(order);
+ return v;
+ }
+
+ value_type
+ exchange(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type original = load(memory_order_relaxed);
+ do {
+ } while (!compare_exchange_weak(original, v, order, memory_order_relaxed));
+ return original;
+ }
+
+ bool
+ compare_exchange_weak(
+ value_type & expected,
+ value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+ return compare_exchange_strong(expected, desired, success_order, failure_order);
+ }
+
+ bool
+ compare_exchange_strong(
+ value_type & expected,
+ value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+ platform_fence_before(success_order);
+
+ bool success = platform_cmpxchg32_strong(expected, desired, &v_);
+
+ if (success) {
+ platform_fence_after(success_order);
+ } else {
+ platform_fence_after(failure_order);
+ }
+
+ return success;
+ }
+
+ value_type
+ fetch_add(difference_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type original = load(memory_order_relaxed);
+ do {
+ } while (!compare_exchange_weak(original, original + v, order, memory_order_relaxed));
+ return original;
+ }
+
+ value_type
+ fetch_sub(difference_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type original = load(memory_order_relaxed);
+ do {
+ } while (!compare_exchange_weak(original, original - v, order, memory_order_relaxed));
+ return original;
+ }
+
+ bool
+ is_lock_free(void) const volatile
+ {
+ return true;
+ }
+
+ BOOST_ATOMIC_DECLARE_BASE_OPERATORS
+private:
+ base_atomic(const base_atomic &) /* = delete */ ;
+ void operator=(const base_atomic &) /* = delete */ ;
+ value_type v_;
+};
+
+template<typename T, bool Sign>
+class base_atomic<T *, void *, 4, Sign> {
+ typedef base_atomic this_type;
+ typedef T * value_type;
+ typedef ptrdiff_t difference_type;
+public:
+ explicit base_atomic(value_type v) : v_(v) {}
+ base_atomic(void) {}
+
+ void
+ store(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ platform_fence_before_store(order);
+ const_cast<volatile value_type &>(v_) = v;
+ platform_fence_after_store(order);
+ }
+
+ value_type
+ load(memory_order order = memory_order_seq_cst) const volatile
+ {
+ value_type v = const_cast<const volatile value_type &>(v_);
+ platform_fence_after_load(order);
+ return v;
+ }
+
+ value_type
+ exchange(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type original = load(memory_order_relaxed);
+ do {
+ } while (!compare_exchange_weak(original, v, order, memory_order_relaxed));
+ return original;
+ }
+
+ bool
+ compare_exchange_weak(
+ value_type & expected,
+ value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+ return compare_exchange_strong(expected, desired, success_order, failure_order);
+ }
+
+ bool
+ compare_exchange_strong(
+ value_type & expected,
+ value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+ platform_fence_before(success_order);
+
+ bool success = platform_cmpxchg32_strong(expected, desired, &v_);
+
+ if (success) {
+ platform_fence_after(success_order);
+ } else {
+ platform_fence_after(failure_order);
+ }
+
+ return success;
+ }
+
+ value_type
+ fetch_add(difference_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type original = load(memory_order_relaxed);
+ do {
+ } while (!compare_exchange_weak(original, original + v, order, memory_order_relaxed));
+ return original;
+ }
+
+ value_type
+ fetch_sub(difference_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type original = load(memory_order_relaxed);
+ do {
+ } while (!compare_exchange_weak(original, original - v, order, memory_order_relaxed));
+ return original;
+ }
+
+ bool
+ is_lock_free(void) const volatile
+ {
+ return true;
+ }
+
+ BOOST_ATOMIC_DECLARE_POINTER_OPERATORS
+private:
+ base_atomic(const base_atomic &) /* = delete */ ;
+ void operator=(const base_atomic &) /* = delete */ ;
+ value_type v_;
+};
+
+/* generic types */
+
+template<typename T, bool Sign>
+class base_atomic<T, void, 1, Sign> {
+ typedef base_atomic this_type;
+ typedef T value_type;
+ typedef uint32_t storage_type;
+public:
+ explicit base_atomic(value_type v) : v_(0)
+ {
+ memcpy(&v_, &v, sizeof(value_type));
+ }
+ base_atomic(void) : v_(0) {}
+
+ void
+ store(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ storage_type tmp = 0;
+ memcpy(&tmp, &v, sizeof(value_type));
+ platform_fence_before_store(order);
+ const_cast<volatile storage_type &>(v_) = tmp;
+ platform_fence_after_store(order);
+ }
+
+ value_type
+ load(memory_order order = memory_order_seq_cst) const volatile
+ {
+ storage_type tmp = const_cast<const volatile storage_type &>(v_);
+ platform_fence_after_load(order);
+
+ value_type v;
+ memcpy(&v, &tmp, sizeof(value_type));
+ return v;
+ }
+
+ value_type
+ exchange(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type original = load(memory_order_relaxed);
+ do {
+ } while (!compare_exchange_weak(original, v, order, memory_order_relaxed));
+ return original;
+ }
+
+ bool
+ compare_exchange_weak(
+ value_type & expected,
+ value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+ return compare_exchange_strong(expected, desired, success_order, failure_order);
+ }
+
+ bool
+ compare_exchange_strong(
+ value_type & expected,
+ value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+
+ storage_type expected_s = 0, desired_s = 0;
+ memcpy(&expected_s, &expected, sizeof(value_type));
+ memcpy(&desired_s, &desired, sizeof(value_type));
+
+ platform_fence_before(success_order);
+ bool success = platform_cmpxchg32_strong(expected_s, desired_s, &v_);
+
+ if (success) {
+ platform_fence_after(success_order);
+ } else {
+ platform_fence_after(failure_order);
+ memcpy(&expected, &expected_s, sizeof(value_type));
+ }
+
+ return success;
+ }
+
+ bool
+ is_lock_free(void) const volatile
+ {
+ return true;
+ }
+
+ BOOST_ATOMIC_DECLARE_BASE_OPERATORS
+private:
+ base_atomic(const base_atomic &) /* = delete */ ;
+ void operator=(const base_atomic &) /* = delete */ ;
+ storage_type v_;
+};
+
+template<typename T, bool Sign>
+class base_atomic<T, void, 2, Sign> {
+ typedef base_atomic this_type;
+ typedef T value_type;
+ typedef uint32_t storage_type;
+public:
+ explicit base_atomic(value_type v) : v_(0)
+ {
+ memcpy(&v_, &v, sizeof(value_type));
+ }
+ base_atomic(void) : v_(0) {}
+
+ void
+ store(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ storage_type tmp = 0;
+ memcpy(&tmp, &v, sizeof(value_type));
+ platform_fence_before_store(order);
+ const_cast<volatile storage_type &>(v_) = tmp;
+ platform_fence_after_store(order);
+ }
+
+ value_type
+ load(memory_order order = memory_order_seq_cst) const volatile
+ {
+ storage_type tmp = const_cast<const volatile storage_type &>(v_);
+ platform_fence_after_load(order);
+
+ value_type v;
+ memcpy(&v, &tmp, sizeof(value_type));
+ return v;
+ }
+
+ value_type
+ exchange(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type original = load(memory_order_relaxed);
+ do {
+ } while (!compare_exchange_weak(original, v, order, memory_order_relaxed));
+ return original;
+ }
+
+ bool
+ compare_exchange_weak(
+ value_type & expected,
+ value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+ return compare_exchange_strong(expected, desired, success_order, failure_order);
+ }
+
+ bool
+ compare_exchange_strong(
+ value_type & expected,
+ value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+
+ storage_type expected_s = 0, desired_s = 0;
+ memcpy(&expected_s, &expected, sizeof(value_type));
+ memcpy(&desired_s, &desired, sizeof(value_type));
+
+ platform_fence_before(success_order);
+ bool success = platform_cmpxchg32_strong(expected_s, desired_s, &v_);
+
+ if (success) {
+ platform_fence_after(success_order);
+ } else {
+ platform_fence_after(failure_order);
+ memcpy(&expected, &expected_s, sizeof(value_type));
+ }
+
+ return success;
+ }
+
+ bool
+ is_lock_free(void) const volatile
+ {
+ return true;
+ }
+
+ BOOST_ATOMIC_DECLARE_BASE_OPERATORS
+private:
+ base_atomic(const base_atomic &) /* = delete */ ;
+ void operator=(const base_atomic &) /* = delete */ ;
+ storage_type v_;
+};
+
+template<typename T, bool Sign>
+class base_atomic<T, void, 4, Sign> {
+ typedef base_atomic this_type;
+ typedef T value_type;
+ typedef uint32_t storage_type;
+public:
+ explicit base_atomic(value_type v) : v_(0)
+ {
+ memcpy(&v_, &v, sizeof(value_type));
+ }
+ base_atomic(void) : v_(0) {}
+
+ void
+ store(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ storage_type tmp = 0;
+ memcpy(&tmp, &v, sizeof(value_type));
+ platform_fence_before_store(order);
+ const_cast<volatile storage_type &>(v_) = tmp;
+ platform_fence_after_store(order);
+ }
+
+ value_type
+ load(memory_order order = memory_order_seq_cst) const volatile
+ {
+ storage_type tmp = const_cast<const volatile storage_type &>(v_);
+ platform_fence_after_load(order);
+
+ value_type v;
+ memcpy(&v, &tmp, sizeof(value_type));
+ return v;
+ }
+
+ value_type
+ exchange(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type original = load(memory_order_relaxed);
+ do {
+ } while (!compare_exchange_weak(original, v, order, memory_order_relaxed));
+ return original;
+ }
+
+ bool
+ compare_exchange_weak(
+ value_type & expected,
+ value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+ return compare_exchange_strong(expected, desired, success_order, failure_order);
+ }
+
+ bool
+ compare_exchange_strong(
+ value_type & expected,
+ value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+
+ storage_type expected_s = 0, desired_s = 0;
+ memcpy(&expected_s, &expected, sizeof(value_type));
+ memcpy(&desired_s, &desired, sizeof(value_type));
+
+ platform_fence_before(success_order);
+ bool success = platform_cmpxchg32_strong(expected_s, desired_s, &v_);
+
+ if (success) {
+ platform_fence_after(success_order);
+ } else {
+ platform_fence_after(failure_order);
+ memcpy(&expected, &expected_s, sizeof(value_type));
+ }
+
+ return success;
+ }
+
+ bool
+ is_lock_free(void) const volatile
+ {
+ return true;
+ }
+
+ BOOST_ATOMIC_DECLARE_BASE_OPERATORS
+private:
+ base_atomic(const base_atomic &) /* = delete */ ;
+ void operator=(const base_atomic &) /* = delete */ ;
+ storage_type v_;
+};
+
+}
+}
+}
+
+#endif
=== added file 'atomic/boost/atomic/detail/cas64strong.hpp'
--- atomic/boost/atomic/detail/cas64strong.hpp 1970-01-01 00:00:00 +0000
+++ atomic/boost/atomic/detail/cas64strong.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,434 @@
+#ifndef BOOST_DETAIL_ATOMIC_CAS64STRONG_HPP
+#define BOOST_DETAIL_ATOMIC_CAS64STRONG_HPP
+
+// 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)
+//
+// Copyright (c) 2011 Helge Bahmann
+
+// Build 64-bit atomic operation from platform_cmpxchg64_strong
+// primitive. It is assumed that 64-bit loads/stores are not
+// atomic, so they are funnelled through cmpxchg as well.
+
+#include <boost/memory_order.hpp>
+#include <boost/atomic/detail/base.hpp>
+
+namespace boost {
+namespace detail {
+namespace atomic {
+
+/* integral types */
+
+template<typename T, bool Sign>
+class base_atomic<T, int, 8, Sign> {
+ typedef base_atomic this_type;
+ typedef T value_type;
+ typedef T difference_type;
+public:
+ explicit base_atomic(value_type v) : v_(v) {}
+ base_atomic(void) {}
+
+ void
+ store(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type expected = v_;
+ do {
+ } while (!compare_exchange_strong(expected, v, order, memory_order_relaxed));
+ }
+
+ value_type
+ load(memory_order order = memory_order_seq_cst) const volatile
+ {
+ value_type v = const_cast<const volatile value_type &>(v_);
+ do {
+ } while (!const_cast<base_atomic *>(this)->compare_exchange_strong(v, v, order, memory_order_relaxed));
+ return v;
+ }
+
+ value_type
+ exchange(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type original = load(memory_order_relaxed);
+ do {
+ } while (!compare_exchange_weak(original, v, order, memory_order_relaxed));
+ return original;
+ }
+
+ bool
+ compare_exchange_weak(
+ value_type & expected,
+ value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+ return compare_exchange_strong(expected, desired, success_order, failure_order);
+ }
+
+ bool
+ compare_exchange_strong(
+ value_type & expected,
+ value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+ platform_fence_before(success_order);
+
+ bool success = platform_cmpxchg64_strong(expected, desired, &v_);
+
+ if (success) {
+ platform_fence_after(success_order);
+ } else {
+ platform_fence_after(failure_order);
+ }
+
+ return success;
+ }
+
+ value_type
+ fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type original = load(memory_order_relaxed);
+ do {
+ } while (!compare_exchange_weak(original, original + v, order, memory_order_relaxed));
+ return original;
+ }
+
+ value_type
+ fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type original = load(memory_order_relaxed);
+ do {
+ } while (!compare_exchange_weak(original, original - v, order, memory_order_relaxed));
+ return original;
+ }
+
+ value_type
+ fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type original = load(memory_order_relaxed);
+ do {
+ } while (!compare_exchange_weak(original, original & v, order, memory_order_relaxed));
+ return original;
+ }
+
+ value_type
+ fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type original = load(memory_order_relaxed);
+ do {
+ } while (!compare_exchange_weak(original, original | v, order, memory_order_relaxed));
+ return original;
+ }
+
+ value_type
+ fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type original = load(memory_order_relaxed);
+ do {
+ } while (!compare_exchange_weak(original, original ^ v, order, memory_order_relaxed));
+ return original;
+ }
+
+ bool
+ is_lock_free(void) const volatile
+ {
+ return true;
+ }
+
+ BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS
+private:
+ base_atomic(const base_atomic &) /* = delete */ ;
+ void operator=(const base_atomic &) /* = delete */ ;
+ value_type v_;
+};
+
+/* pointer types */
+
+template<bool Sign>
+class base_atomic<void *, void *, 8, Sign> {
+ typedef base_atomic this_type;
+ typedef void * value_type;
+ typedef ptrdiff_t difference_type;
+public:
+ explicit base_atomic(value_type v) : v_(v) {}
+ base_atomic(void) {}
+
+ void
+ store(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type expected = v_;
+ do {
+ } while (!compare_exchange_strong(expected, v, order, memory_order_relaxed));
+ }
+
+ value_type
+ load(memory_order order = memory_order_seq_cst) const volatile
+ {
+ value_type v = const_cast<const volatile value_type &>(v_);
+ do {
+ } while (!const_cast<base_atomic *>(this)->compare_exchange_strong(v, v, order, memory_order_relaxed));
+ return v;
+ }
+
+ value_type
+ exchange(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type original = load(memory_order_relaxed);
+ do {
+ } while (!compare_exchange_weak(original, v, order, memory_order_relaxed));
+ return original;
+ }
+
+ bool
+ compare_exchange_weak(
+ value_type & expected,
+ value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+ return compare_exchange_strong(expected, desired, success_order, failure_order);
+ }
+
+ bool
+ compare_exchange_strong(
+ value_type & expected,
+ value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+ platform_fence_before(success_order);
+
+ bool success = platform_cmpxchg64_strong(expected, desired, &v_);
+
+ if (success) {
+ platform_fence_after(success_order);
+ } else {
+ platform_fence_after(failure_order);
+ }
+
+ return success;
+ }
+
+ value_type
+ fetch_add(difference_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type original = load(memory_order_relaxed);
+ do {
+ } while (!compare_exchange_weak(original, original + v, order, memory_order_relaxed));
+ return original;
+ }
+
+ value_type
+ fetch_sub(difference_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type original = load(memory_order_relaxed);
+ do {
+ } while (!compare_exchange_weak(original, original - v, order, memory_order_relaxed));
+ return original;
+ }
+
+ bool
+ is_lock_free(void) const volatile
+ {
+ return true;
+ }
+
+ BOOST_ATOMIC_DECLARE_BASE_OPERATORS
+private:
+ base_atomic(const base_atomic &) /* = delete */ ;
+ void operator=(const base_atomic &) /* = delete */ ;
+ value_type v_;
+};
+
+template<typename T, bool Sign>
+class base_atomic<T *, void *, 8, Sign> {
+ typedef base_atomic this_type;
+ typedef T * value_type;
+ typedef ptrdiff_t difference_type;
+public:
+ explicit base_atomic(value_type v) : v_(v) {}
+ base_atomic(void) {}
+
+ void
+ store(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type expected = v_;
+ do {
+ } while (!compare_exchange_strong(expected, v, order, memory_order_relaxed));
+ }
+
+ value_type
+ load(memory_order order = memory_order_seq_cst) const volatile
+ {
+ value_type v = const_cast<const volatile value_type &>(v_);
+ do {
+ } while (!const_cast<base_atomic *>(this)->compare_exchange_strong(v, v, order, memory_order_relaxed));
+ return v;
+ }
+
+ value_type
+ exchange(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type original = load(memory_order_relaxed);
+ do {
+ } while (!compare_exchange_weak(original, v, order, memory_order_relaxed));
+ return original;
+ }
+
+ bool
+ compare_exchange_weak(
+ value_type & expected,
+ value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+ return compare_exchange_strong(expected, desired, success_order, failure_order);
+ }
+
+ bool
+ compare_exchange_strong(
+ value_type & expected,
+ value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+ platform_fence_before(success_order);
+
+ bool success = platform_cmpxchg64_strong(expected, desired, &v_);
+
+ if (success) {
+ platform_fence_after(success_order);
+ } else {
+ platform_fence_after(failure_order);
+ }
+
+ return success;
+ }
+
+ value_type
+ fetch_add(difference_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type original = load(memory_order_relaxed);
+ do {
+ } while (!compare_exchange_weak(original, original + v, order, memory_order_relaxed));
+ return original;
+ }
+
+ value_type
+ fetch_sub(difference_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type original = load(memory_order_relaxed);
+ do {
+ } while (!compare_exchange_weak(original, original - v, order, memory_order_relaxed));
+ return original;
+ }
+
+ bool
+ is_lock_free(void) const volatile
+ {
+ return true;
+ }
+
+ BOOST_ATOMIC_DECLARE_POINTER_OPERATORS
+private:
+ base_atomic(const base_atomic &) /* = delete */ ;
+ void operator=(const base_atomic &) /* = delete */ ;
+ value_type v_;
+};
+
+/* generic types */
+
+template<typename T, bool Sign>
+class base_atomic<T, void, 8, Sign> {
+ typedef base_atomic this_type;
+ typedef T value_type;
+ typedef uint64_t storage_type;
+public:
+ explicit base_atomic(value_type v) : v_(0)
+ {
+ memcpy(&v_, &v, sizeof(value_type));
+ }
+ base_atomic(void) : v_(0) {}
+
+ void
+ store(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type expected;
+ memcpy(&expected, const_cast<storage_type *>(&v_), sizeof(value_type));
+ do {
+ } while (!compare_exchange_strong(expected, v, order, memory_order_relaxed));
+ }
+
+ value_type
+ load(memory_order order = memory_order_seq_cst) const volatile
+ {
+ value_type v;
+ memcpy(&v, const_cast<storage_type *>(&v_), sizeof(value_type));
+ do {
+ } while (!const_cast<base_atomic *>(this)->compare_exchange_strong(v, v, order, memory_order_relaxed));
+ return v;
+ }
+
+ value_type
+ exchange(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type original = load(memory_order_relaxed);
+ do {
+ } while (!compare_exchange_weak(original, v, order, memory_order_relaxed));
+ return original;
+ }
+
+ bool
+ compare_exchange_weak(
+ value_type & expected,
+ value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+ return compare_exchange_strong(expected, desired, success_order, failure_order);
+ }
+
+ bool
+ compare_exchange_strong(
+ value_type & expected,
+ value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+
+ storage_type expected_s = 0, desired_s = 0;
+ memcpy(&expected_s, &expected, sizeof(value_type));
+ memcpy(&desired_s, &desired, sizeof(value_type));
+
+ platform_fence_before(success_order);
+ bool success = platform_cmpxchg64_strong(expected_s, desired_s, &v_);
+
+ if (success) {
+ platform_fence_after(success_order);
+ } else {
+ platform_fence_after(failure_order);
+ memcpy(&expected, &expected_s, sizeof(value_type));
+ }
+
+ return success;
+ }
+
+ bool
+ is_lock_free(void) const volatile
+ {
+ return true;
+ }
+
+ BOOST_ATOMIC_DECLARE_BASE_OPERATORS
+private:
+ base_atomic(const base_atomic &) /* = delete */ ;
+ void operator=(const base_atomic &) /* = delete */ ;
+ storage_type v_;
+};
+
+}
+}
+}
+
+#endif
=== added file 'atomic/boost/atomic/detail/gcc-x86.hpp'
--- atomic/boost/atomic/detail/gcc-x86.hpp 1970-01-01 00:00:00 +0000
+++ atomic/boost/atomic/detail/gcc-x86.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,1464 @@
+#ifndef BOOST_DETAIL_ATOMIC_GCC_X86_HPP
+#define BOOST_DETAIL_ATOMIC_GCC_X86_HPP
+
+// Copyright (c) 2009 Helge Bahmann
+//
+// 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)
+
+#define BOOST_ATOMIC_CHAR_LOCK_FREE 2
+#define BOOST_ATOMIC_CHAR16_T_LOCK_FREE 2
+#define BOOST_ATOMIC_CHAR32_T_LOCK_FREE 2
+#define BOOST_ATOMIC_WCHAR_T_LOCK_FREE 2
+#define BOOST_ATOMIC_SHORT_LOCK_FREE 2
+#define BOOST_ATOMIC_INT_LOCK_FREE 2
+#define BOOST_ATOMIC_LONG_LOCK_FREE 2
+
+#if defined(__x86_64__)
+#define BOOST_ATOMIC_LLONG_LOCK_FREE 2
+#else
+#define BOOST_ATOMIC_LLONG_LOCK_FREE 1
+#endif
+
+#define BOOST_ATOMIC_ADDRESS_LOCK_FREE 2
+#define BOOST_ATOMIC_BOOL_LOCK_FREE 2
+
+namespace boost {
+
+#if defined(__x86_64__)
+# define BOOST_ATOMIC_X86_FENCE_INSTR "mfence\n"
+#else
+# define BOOST_ATOMIC_X86_FENCE_INSTR "lock ; addl $0, (%%esp)\n"
+#endif
+
+#define BOOST_ATOMIC_THREAD_FENCE 2
+static inline void
+atomic_thread_fence(memory_order order)
+{
+ switch(order) {
+ case memory_order_relaxed:
+ break;
+ case memory_order_release:
+ __asm__ __volatile__ ("" ::: "memory");
+ break;
+ case memory_order_acquire:
+ __asm__ __volatile__ ("" ::: "memory");
+ break;
+ case memory_order_acq_rel:
+ __asm__ __volatile__ ("" ::: "memory");
+ break;
+ case memory_order_consume:
+ break;
+ case memory_order_seq_cst:
+ __asm__ __volatile__ (BOOST_ATOMIC_X86_FENCE_INSTR ::: "memory");
+ break;
+ default:;
+ }
+}
+
+#define BOOST_ATOMIC_SIGNAL_FENCE 2
+static inline void
+atomic_signal_fence(memory_order)
+{
+ __asm__ __volatile__ ("" ::: "memory");
+}
+
+namespace detail {
+namespace atomic {
+
+static inline void
+platform_fence_before(memory_order order)
+{
+ switch(order) {
+ case memory_order_relaxed:
+ case memory_order_acquire:
+ case memory_order_consume:
+ break;
+ case memory_order_release:
+ case memory_order_acq_rel:
+ __asm__ __volatile__ ("" ::: "memory");
+ /* release */
+ break;
+ case memory_order_seq_cst:
+ __asm__ __volatile__ ("" ::: "memory");
+ /* seq */
+ break;
+ }
+}
+
+static inline void
+platform_fence_after(memory_order order)
+{
+ switch(order) {
+ case memory_order_relaxed:
+ case memory_order_release:
+ break;
+ case memory_order_acquire:
+ case memory_order_acq_rel:
+ __asm__ __volatile__ ("" ::: "memory");
+ /* acquire */
+ break;
+ case memory_order_consume:
+ /* consume */
+ break;
+ case memory_order_seq_cst:
+ __asm__ __volatile__ ("" ::: "memory");
+ /* seq */
+ break;
+ default:;
+ }
+}
+
+static inline void
+platform_fence_after_load(memory_order order)
+{
+ switch(order) {
+ case memory_order_relaxed:
+ case memory_order_release:
+ break;
+ case memory_order_acquire:
+ case memory_order_acq_rel:
+ __asm__ __volatile__ ("" ::: "memory");
+ break;
+ case memory_order_consume:
+ break;
+ case memory_order_seq_cst:
+ __asm__ __volatile__ (BOOST_ATOMIC_X86_FENCE_INSTR ::: "memory");
+ break;
+ default:;
+ }
+}
+
+template<typename T, bool Sign>
+class base_atomic<T, int, 1, Sign> {
+ typedef base_atomic this_type;
+ typedef T value_type;
+ typedef T difference_type;
+public:
+ explicit base_atomic(value_type v) : v_(v) {}
+ base_atomic(void) {}
+
+ void
+ store(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ if (order != memory_order_seq_cst) {
+ platform_fence_before(order);
+ const_cast<volatile value_type &>(v_) = v;
+ } else {
+ exchange(v, order);
+ }
+ }
+
+ value_type
+ load(memory_order order = memory_order_seq_cst) const volatile
+ {
+ value_type v = const_cast<const volatile value_type &>(v_);
+ platform_fence_after_load(order);
+ return v;
+ }
+
+ value_type
+ fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ platform_fence_before(order);
+ __asm__ (
+ "lock ; xaddb %0, %1"
+ : "+q" (v), "+m" (v_)
+ );
+ platform_fence_after(order);
+ return v;
+ }
+
+ value_type
+ fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ return fetch_add(-v, order);
+ }
+
+ value_type
+ exchange(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ platform_fence_before(order);
+ __asm__ (
+ "xchgb %0, %1"
+ : "+q" (v), "+m" (v_)
+ );
+ platform_fence_after(order);
+ return v;
+ }
+
+ bool
+ compare_exchange_strong(
+ value_type & expected,
+ value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+ value_type previous = expected;
+ platform_fence_before(success_order);
+ __asm__ (
+ "lock ; cmpxchgb %2, %1"
+ : "+a" (previous), "+m" (v_)
+ : "q" (desired)
+ );
+ bool success = (previous == expected);
+ if (success)
+ platform_fence_after(success_order);
+ else
+ platform_fence_after(failure_order);
+ expected = previous;
+ return success;
+ }
+
+ bool
+ compare_exchange_weak(
+ value_type & expected,
+ value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+ return compare_exchange_strong(expected, desired, success_order, failure_order);
+ }
+
+ value_type
+ fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type tmp = load(memory_order_relaxed);
+ do {} while(!compare_exchange_weak(tmp, tmp & v, order, memory_order_relaxed));
+ return tmp;
+ }
+
+ value_type
+ fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type tmp = load(memory_order_relaxed);
+ do {} while(!compare_exchange_weak(tmp, tmp | v, order, memory_order_relaxed));
+ return tmp;
+ }
+
+ value_type
+ fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type tmp = load(memory_order_relaxed);
+ do {} while(!compare_exchange_weak(tmp, tmp ^ v, order, memory_order_relaxed));
+ return tmp;
+ }
+
+ bool
+ is_lock_free(void) const volatile
+ {
+ return true;
+ }
+
+ BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS
+private:
+ base_atomic(const base_atomic &) /* = delete */ ;
+ void operator=(const base_atomic &) /* = delete */ ;
+ value_type v_;
+};
+
+template<typename T, bool Sign>
+class base_atomic<T, int, 2, Sign> {
+ typedef base_atomic this_type;
+ typedef T value_type;
+ typedef T difference_type;
+public:
+ explicit base_atomic(value_type v) : v_(v) {}
+ base_atomic(void) {}
+
+ void
+ store(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ if (order != memory_order_seq_cst) {
+ platform_fence_before(order);
+ const_cast<volatile value_type &>(v_) = v;
+ } else {
+ exchange(v, order);
+ }
+ }
+
+ value_type
+ load(memory_order order = memory_order_seq_cst) const volatile
+ {
+ value_type v = const_cast<const volatile value_type &>(v_);
+ platform_fence_after_load(order);
+ return v;
+ }
+
+ value_type
+ fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ platform_fence_before(order);
+ __asm__ (
+ "lock ; xaddw %0, %1"
+ : "+q" (v), "+m" (v_)
+ );
+ platform_fence_after(order);
+ return v;
+ }
+
+ value_type
+ fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ return fetch_add(-v, order);
+ }
+
+ value_type
+ exchange(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ platform_fence_before(order);
+ __asm__ (
+ "xchgw %0, %1"
+ : "+q" (v), "+m" (v_)
+ );
+ platform_fence_after(order);
+ return v;
+ }
+
+ bool
+ compare_exchange_strong(
+ value_type & expected,
+ value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+ value_type previous = expected;
+ platform_fence_before(success_order);
+ __asm__ (
+ "lock ; cmpxchgw %2, %1"
+ : "+a" (previous), "+m" (v_)
+ : "q" (desired)
+ );
+ bool success = (previous == expected);
+ if (success)
+ platform_fence_after(success_order);
+ else
+ platform_fence_after(failure_order);
+ expected = previous;
+ return success;
+ }
+
+ bool
+ compare_exchange_weak(
+ value_type & expected,
+ value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+ return compare_exchange_strong(expected, desired, success_order, failure_order);
+ }
+
+ value_type
+ fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type tmp = load(memory_order_relaxed);
+ do {} while(!compare_exchange_weak(tmp, tmp & v, order, memory_order_relaxed));
+ return tmp;
+ }
+
+ value_type
+ fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type tmp = load(memory_order_relaxed);
+ do {} while(!compare_exchange_weak(tmp, tmp | v, order, memory_order_relaxed));
+ return tmp;
+ }
+
+ value_type
+ fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type tmp = load(memory_order_relaxed);
+ do {} while(!compare_exchange_weak(tmp, tmp ^ v, order, memory_order_relaxed));
+ return tmp;
+ }
+
+ bool
+ is_lock_free(void) const volatile
+ {
+ return true;
+ }
+
+ BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS
+private:
+ base_atomic(const base_atomic &) /* = delete */ ;
+ void operator=(const base_atomic &) /* = delete */ ;
+ value_type v_;
+};
+
+template<typename T, bool Sign>
+class base_atomic<T, int, 4, Sign> {
+ typedef base_atomic this_type;
+ typedef T value_type;
+ typedef T difference_type;
+public:
+ explicit base_atomic(value_type v) : v_(v) {}
+ base_atomic(void) {}
+
+ void
+ store(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ if (order != memory_order_seq_cst) {
+ platform_fence_before(order);
+ const_cast<volatile value_type &>(v_) = v;
+ } else {
+ exchange(v, order);
+ }
+ }
+
+ value_type
+ load(memory_order order = memory_order_seq_cst) const volatile
+ {
+ value_type v = const_cast<const volatile value_type &>(v_);
+ platform_fence_after_load(order);
+ return v;
+ }
+
+ value_type
+ fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ platform_fence_before(order);
+ __asm__ (
+ "lock ; xaddl %0, %1"
+ : "+r" (v), "+m" (v_)
+ );
+ platform_fence_after(order);
+ return v;
+ }
+
+ value_type
+ fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ return fetch_add(-v, order);
+ }
+
+ value_type
+ exchange(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ platform_fence_before(order);
+ __asm__ (
+ "xchgl %0, %1"
+ : "+r" (v), "+m" (v_)
+ );
+ platform_fence_after(order);
+ return v;
+ }
+
+ bool
+ compare_exchange_strong(
+ value_type & expected,
+ value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+ value_type previous = expected;
+ platform_fence_before(success_order);
+ __asm__ (
+ "lock ; cmpxchgl %2, %1"
+ : "+a" (previous), "+m" (v_)
+ : "r" (desired)
+ );
+ bool success = (previous == expected);
+ if (success)
+ platform_fence_after(success_order);
+ else
+ platform_fence_after(failure_order);
+ expected = previous;
+ return success;
+ }
+
+ bool
+ compare_exchange_weak(
+ value_type & expected,
+ value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+ return compare_exchange_strong(expected, desired, success_order, failure_order);
+ }
+
+ value_type
+ fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type tmp = load(memory_order_relaxed);
+ do {} while(!compare_exchange_weak(tmp, tmp & v, order, memory_order_relaxed));
+ return tmp;
+ }
+
+ value_type
+ fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type tmp = load(memory_order_relaxed);
+ do {} while(!compare_exchange_weak(tmp, tmp | v, order, memory_order_relaxed));
+ return tmp;
+ }
+
+ value_type
+ fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type tmp = load(memory_order_relaxed);
+ do {} while(!compare_exchange_weak(tmp, tmp ^ v, order, memory_order_relaxed));
+ return tmp;
+ }
+
+ bool
+ is_lock_free(void) const volatile
+ {
+ return true;
+ }
+
+ BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS
+private:
+ base_atomic(const base_atomic &) /* = delete */ ;
+ void operator=(const base_atomic &) /* = delete */ ;
+ value_type v_;
+};
+
+#if defined(__x86_64__)
+template<typename T, bool Sign>
+class base_atomic<T, int, 8, Sign> {
+ typedef base_atomic this_type;
+ typedef T value_type;
+ typedef T difference_type;
+public:
+ explicit base_atomic(value_type v) : v_(v) {}
+ base_atomic(void) {}
+
+ void
+ store(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ if (order != memory_order_seq_cst) {
+ platform_fence_before(order);
+ const_cast<volatile value_type &>(v_) = v;
+ } else {
+ exchange(v, order);
+ }
+ }
+
+ value_type
+ load(memory_order order = memory_order_seq_cst) const volatile
+ {
+ value_type v = const_cast<const volatile value_type &>(v_);
+ platform_fence_after_load(order);
+ return v;
+ }
+
+ value_type
+ fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ platform_fence_before(order);
+ __asm__ (
+ "lock ; xaddq %0, %1"
+ : "+r" (v), "+m" (v_)
+ );
+ platform_fence_after(order);
+ return v;
+ }
+
+ value_type
+ fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ return fetch_add(-v, order);
+ }
+
+ value_type
+ exchange(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ platform_fence_before(order);
+ __asm__ (
+ "xchgq %0, %1"
+ : "+r" (v), "+m" (v_)
+ );
+ platform_fence_after(order);
+ return v;
+ }
+
+ bool
+ compare_exchange_strong(
+ value_type & expected,
+ value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+ value_type previous = expected;
+ platform_fence_before(success_order);
+ __asm__ (
+ "lock ; cmpxchgq %2, %1"
+ : "+a" (previous), "+m" (v_)
+ : "r" (desired)
+ );
+ bool success = (previous == expected);
+ if (success)
+ platform_fence_after(success_order);
+ else
+ platform_fence_after(failure_order);
+ expected = previous;
+ return success;
+ }
+
+ bool
+ compare_exchange_weak(
+ value_type & expected,
+ value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+ return compare_exchange_strong(expected, desired, success_order, failure_order);
+ }
+
+ value_type
+ fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type tmp = load(memory_order_relaxed);
+ do {} while(!compare_exchange_weak(tmp, tmp & v, order, memory_order_relaxed));
+ return tmp;
+ }
+
+ value_type
+ fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type tmp = load(memory_order_relaxed);
+ do {} while(!compare_exchange_weak(tmp, tmp | v, order, memory_order_relaxed));
+ return tmp;
+ }
+
+ value_type
+ fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ value_type tmp = load(memory_order_relaxed);
+ do {} while(!compare_exchange_weak(tmp, tmp ^ v, order, memory_order_relaxed));
+ return tmp;
+ }
+
+ bool
+ is_lock_free(void) const volatile
+ {
+ return true;
+ }
+
+ BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS
+private:
+ base_atomic(const base_atomic &) /* = delete */ ;
+ void operator=(const base_atomic &) /* = delete */ ;
+ value_type v_;
+};
+
+#endif
+
+/* pointers */
+
+#if !defined(__x86_64__)
+
+template<bool Sign>
+class base_atomic<void *, void *, 4, Sign> {
+ typedef base_atomic this_type;
+ typedef void * value_type;
+public:
+ explicit base_atomic(value_type v) : v_(v) {}
+ base_atomic(void) {}
+
+ void
+ store(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ if (order != memory_order_seq_cst) {
+ platform_fence_before(order);
+ const_cast<volatile value_type &>(v_) = v;
+ } else {
+ exchange(v, order);
+ }
+ }
+
+ value_type load(memory_order order = memory_order_seq_cst) const volatile
+ {
+ value_type v = const_cast<const volatile value_type &>(v_);
+ platform_fence_after_load(order);
+ return v;
+ }
+
+ value_type exchange(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ platform_fence_before(order);
+ __asm__ (
+ "xchgl %0, %1"
+ : "+r" (v), "+m" (v_)
+ );
+ platform_fence_after(order);
+ return v;
+ }
+
+ bool compare_exchange_strong(value_type & expected, value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+ value_type previous = expected;
+ platform_fence_before(success_order);
+ __asm__ (
+ "lock ; cmpxchgl %2, %1"
+ : "+a" (previous), "+m" (v_)
+ : "r" (desired)
+ );
+ bool success = (previous == expected);
+ if (success)
+ platform_fence_after(success_order);
+ else
+ platform_fence_after(failure_order);
+ expected = previous;
+ return success;
+ }
+
+ bool compare_exchange_weak(value_type & expected, value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+ return compare_exchange_strong(expected, desired, success_order, failure_order);
+ }
+
+ bool
+ is_lock_free(void) const volatile
+ {
+ return true;
+ }
+
+ BOOST_ATOMIC_DECLARE_BASE_OPERATORS
+private:
+ base_atomic(const base_atomic &) /* = delete */ ;
+ void operator=(const base_atomic &) /* = delete */ ;
+ value_type v_;
+};
+
+template<typename T, bool Sign>
+class base_atomic<T *, void *, 4, Sign> {
+ typedef base_atomic this_type;
+ typedef T * value_type;
+ typedef ptrdiff_t difference_type;
+public:
+ explicit base_atomic(value_type v) : v_(v) {}
+ base_atomic(void) {}
+
+ void
+ store(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ if (order != memory_order_seq_cst) {
+ platform_fence_before(order);
+ const_cast<volatile value_type &>(v_) = v;
+ } else {
+ exchange(v, order);
+ }
+ }
+
+ value_type
+ load(memory_order order = memory_order_seq_cst) const volatile
+ {
+ value_type v = const_cast<const volatile value_type &>(v_);
+ platform_fence_after_load(order);
+ return v;
+ }
+
+ value_type
+ exchange(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ platform_fence_before(order);
+ __asm__ (
+ "xchgl %0, %1"
+ : "+r" (v), "+m" (v_)
+ );
+ platform_fence_after(order);
+ return v;
+ }
+
+ bool
+ compare_exchange_strong(
+ value_type & expected,
+ value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+ value_type previous = expected;
+ platform_fence_before(success_order);
+ __asm__ (
+ "lock ; cmpxchgl %2, %1"
+ : "+a" (previous), "+m" (v_)
+ : "r" (desired)
+ );
+ bool success = (previous == expected);
+ if (success)
+ platform_fence_after(success_order);
+ else
+ platform_fence_after(failure_order);
+ expected = previous;
+ return success;
+ }
+
+ bool
+ compare_exchange_weak(
+ value_type & expected,
+ value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+ return compare_exchange_strong(expected, desired, success_order, failure_order);
+ }
+
+ value_type
+ fetch_add(difference_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ v = v * sizeof(*v_);
+ platform_fence_before(order);
+ __asm__ (
+ "lock ; xaddl %0, %1"
+ : "+r" (v), "+m" (v_)
+ );
+ platform_fence_after(order);
+ return reinterpret_cast<value_type>(v);
+ }
+
+ value_type
+ fetch_sub(difference_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ return fetch_add(-v, order);
+ }
+
+ bool
+ is_lock_free(void) const volatile
+ {
+ return true;
+ }
+
+ BOOST_ATOMIC_DECLARE_POINTER_OPERATORS
+private:
+ base_atomic(const base_atomic &) /* = delete */ ;
+ void operator=(const base_atomic &) /* = delete */ ;
+ value_type v_;
+};
+
+#else
+
+template<bool Sign>
+class base_atomic<void *, void *, 8, Sign> {
+ typedef base_atomic this_type;
+ typedef void * value_type;
+public:
+ explicit base_atomic(value_type v) : v_(v) {}
+ base_atomic(void) {}
+
+ void
+ store(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ if (order != memory_order_seq_cst) {
+ platform_fence_before(order);
+ const_cast<volatile value_type &>(v_) = v;
+ } else {
+ exchange(v, order);
+ }
+ }
+
+ value_type load(memory_order order = memory_order_seq_cst) const volatile
+ {
+ value_type v = const_cast<const volatile value_type &>(v_);
+ platform_fence_after_load(order);
+ return v;
+ }
+
+ value_type exchange(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ platform_fence_before(order);
+ __asm__ (
+ "xchgq %0, %1"
+ : "+r" (v), "+m" (v_)
+ );
+ platform_fence_after(order);
+ return v;
+ }
+
+ bool compare_exchange_strong(value_type & expected, value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+ value_type previous = expected;
+ platform_fence_before(success_order);
+ __asm__ (
+ "lock ; cmpxchgq %2, %1"
+ : "+a" (previous), "+m" (v_)
+ : "r" (desired)
+ );
+ bool success = (previous == expected);
+ if (success)
+ platform_fence_after(success_order);
+ else
+ platform_fence_after(failure_order);
+ expected = previous;
+ return success;
+ }
+
+ bool compare_exchange_weak(value_type & expected, value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+ return compare_exchange_strong(expected, desired, success_order, failure_order);
+ }
+
+ bool
+ is_lock_free(void) const volatile
+ {
+ return true;
+ }
+
+ BOOST_ATOMIC_DECLARE_BASE_OPERATORS
+private:
+ base_atomic(const base_atomic &) /* = delete */ ;
+ void operator=(const base_atomic &) /* = delete */ ;
+ value_type v_;
+};
+
+template<typename T, bool Sign>
+class base_atomic<T *, void *, 8, Sign> {
+ typedef base_atomic this_type;
+ typedef T * value_type;
+ typedef ptrdiff_t difference_type;
+public:
+ explicit base_atomic(value_type v) : v_(v) {}
+ base_atomic(void) {}
+
+ void
+ store(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ if (order != memory_order_seq_cst) {
+ platform_fence_before(order);
+ const_cast<volatile value_type &>(v_) = v;
+ } else {
+ exchange(v, order);
+ }
+ }
+
+ value_type
+ load(memory_order order = memory_order_seq_cst) const volatile
+ {
+ value_type v = const_cast<const volatile value_type &>(v_);
+ platform_fence_after_load(order);
+ return v;
+ }
+
+ value_type
+ exchange(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ platform_fence_before(order);
+ __asm__ (
+ "xchgq %0, %1"
+ : "+r" (v), "+m" (v_)
+ );
+ platform_fence_after(order);
+ return v;
+ }
+
+ bool
+ compare_exchange_strong(
+ value_type & expected,
+ value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+ value_type previous = expected;
+ platform_fence_before(success_order);
+ __asm__ (
+ "lock ; cmpxchgq %2, %1"
+ : "+a" (previous), "+m" (v_)
+ : "r" (desired)
+ );
+ bool success = (previous == expected);
+ if (success)
+ platform_fence_after(success_order);
+ else
+ platform_fence_after(failure_order);
+ expected = previous;
+ return success;
+ }
+
+ bool
+ compare_exchange_weak(
+ value_type & expected,
+ value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+ return compare_exchange_strong(expected, desired, success_order, failure_order);
+ }
+
+ value_type
+ fetch_add(difference_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ v = v * sizeof(*v_);
+ platform_fence_before(order);
+ __asm__ (
+ "lock ; xaddq %0, %1"
+ : "+r" (v), "+m" (v_)
+ );
+ platform_fence_after(order);
+ return reinterpret_cast<value_type>(v);
+ }
+
+ value_type
+ fetch_sub(difference_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ return fetch_add(-v, order);
+ }
+
+ bool
+ is_lock_free(void) const volatile
+ {
+ return true;
+ }
+
+ BOOST_ATOMIC_DECLARE_POINTER_OPERATORS
+private:
+ base_atomic(const base_atomic &) /* = delete */ ;
+ void operator=(const base_atomic &) /* = delete */ ;
+ value_type v_;
+};
+
+#endif
+
+template<typename T, bool Sign>
+class base_atomic<T, void, 1, Sign> {
+ typedef base_atomic this_type;
+ typedef T value_type;
+ typedef uint8_t storage_type;
+public:
+ explicit base_atomic(value_type v)
+ {
+ memcpy(&v_, &v, sizeof(value_type));
+ }
+ base_atomic(void) {}
+
+ void
+ store(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ if (order != memory_order_seq_cst) {
+ storage_type tmp;
+ memcpy(&tmp, &v, sizeof(value_type));
+ platform_fence_before(order);
+ const_cast<volatile storage_type &>(v_) = tmp;
+ } else {
+ exchange(v, order);
+ }
+ }
+
+ value_type
+ load(memory_order order = memory_order_seq_cst) const volatile
+ {
+ storage_type tmp = const_cast<volatile storage_type &>(v_);
+ platform_fence_after_load(order);
+ value_type v;
+ memcpy(&v, &tmp, sizeof(value_type));
+ return v;
+ }
+
+ value_type
+ exchange(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ storage_type tmp;
+ memcpy(&tmp, &v, sizeof(value_type));
+ platform_fence_before(order);
+ __asm__ (
+ "xchgb %0, %1"
+ : "+q" (tmp), "+m" (v_)
+ );
+ platform_fence_after(order);
+ memcpy(&v, &tmp, sizeof(value_type));
+ return v;
+ }
+
+ bool
+ compare_exchange_strong(
+ value_type & expected,
+ value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+ storage_type expected_s, desired_s;
+ memcpy(&expected_s, &expected, sizeof(value_type));
+ memcpy(&desired_s, &desired, sizeof(value_type));
+ storage_type previous_s = expected_s;
+ platform_fence_before(success_order);
+ __asm__ (
+ "lock ; cmpxchgb %2, %1"
+ : "+a" (previous_s), "+m" (v_)
+ : "q" (desired_s)
+ );
+ bool success = (previous_s == expected_s);
+ if (success)
+ platform_fence_after(success_order);
+ else
+ platform_fence_after(failure_order);
+ memcpy(&expected, &previous_s, sizeof(value_type));
+ return success;
+ }
+
+ bool
+ compare_exchange_weak(
+ value_type & expected,
+ value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+ return compare_exchange_strong(expected, desired, success_order, failure_order);
+ }
+
+ bool
+ is_lock_free(void) const volatile
+ {
+ return true;
+ }
+
+ BOOST_ATOMIC_DECLARE_BASE_OPERATORS
+private:
+ base_atomic(const base_atomic &) /* = delete */ ;
+ void operator=(const base_atomic &) /* = delete */ ;
+ storage_type v_;
+};
+
+template<typename T, bool Sign>
+class base_atomic<T, void, 2, Sign> {
+ typedef base_atomic this_type;
+ typedef T value_type;
+ typedef uint16_t storage_type;
+public:
+ explicit base_atomic(value_type v)
+ {
+ memcpy(&v_, &v, sizeof(value_type));
+ }
+ base_atomic(void) {}
+
+ void
+ store(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ if (order != memory_order_seq_cst) {
+ storage_type tmp;
+ memcpy(&tmp, &v, sizeof(value_type));
+ platform_fence_before(order);
+ const_cast<volatile storage_type &>(v_) = tmp;
+ } else {
+ exchange(v, order);
+ }
+ }
+
+ value_type
+ load(memory_order order = memory_order_seq_cst) const volatile
+ {
+ storage_type tmp = const_cast<volatile storage_type &>(v_);
+ platform_fence_after_load(order);
+ value_type v;
+ memcpy(&v, &tmp, sizeof(value_type));
+ return v;
+ }
+
+ value_type
+ exchange(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ storage_type tmp;
+ memcpy(&tmp, &v, sizeof(value_type));
+ platform_fence_before(order);
+ __asm__ (
+ "xchgw %0, %1"
+ : "+q" (tmp), "+m" (v_)
+ );
+ platform_fence_after(order);
+ memcpy(&v, &tmp, sizeof(value_type));
+ return v;
+ }
+
+ bool
+ compare_exchange_strong(
+ value_type & expected,
+ value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+ storage_type expected_s, desired_s;
+ memcpy(&expected_s, &expected, sizeof(value_type));
+ memcpy(&desired_s, &desired, sizeof(value_type));
+ storage_type previous_s = expected_s;
+ platform_fence_before(success_order);
+ __asm__ (
+ "lock ; cmpxchgw %2, %1"
+ : "+a" (previous_s), "+m" (v_)
+ : "q" (desired_s)
+ );
+ bool success = (previous_s == expected_s);
+ if (success)
+ platform_fence_after(success_order);
+ else
+ platform_fence_after(failure_order);
+ memcpy(&expected, &previous_s, sizeof(value_type));
+ return success;
+ }
+
+ bool
+ compare_exchange_weak(
+ value_type & expected,
+ value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+ return compare_exchange_strong(expected, desired, success_order, failure_order);
+ }
+
+ bool
+ is_lock_free(void) const volatile
+ {
+ return true;
+ }
+
+ BOOST_ATOMIC_DECLARE_BASE_OPERATORS
+private:
+ base_atomic(const base_atomic &) /* = delete */ ;
+ void operator=(const base_atomic &) /* = delete */ ;
+ storage_type v_;
+};
+
+template<typename T, bool Sign>
+class base_atomic<T, void, 4, Sign> {
+ typedef base_atomic this_type;
+ typedef T value_type;
+ typedef uint32_t storage_type;
+public:
+ explicit base_atomic(value_type v)
+ {
+ memcpy(&v_, &v, sizeof(value_type));
+ }
+ base_atomic(void) {}
+
+ void
+ store(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ if (order != memory_order_seq_cst) {
+ storage_type tmp;
+ memcpy(&tmp, &v, sizeof(value_type));
+ platform_fence_before(order);
+ const_cast<volatile storage_type &>(v_) = tmp;
+ } else {
+ exchange(v, order);
+ }
+ }
+
+ value_type
+ load(memory_order order = memory_order_seq_cst) const volatile
+ {
+ storage_type tmp = const_cast<volatile storage_type &>(v_);
+ platform_fence_after_load(order);
+ value_type v;
+ memcpy(&v, &tmp, sizeof(value_type));
+ return v;
+ }
+
+ value_type
+ exchange(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ storage_type tmp;
+ memcpy(&tmp, &v, sizeof(value_type));
+ platform_fence_before(order);
+ __asm__ (
+ "xchgl %0, %1"
+ : "+q" (tmp), "+m" (v_)
+ );
+ platform_fence_after(order);
+ memcpy(&v, &tmp, sizeof(value_type));
+ return v;
+ }
+
+ bool
+ compare_exchange_strong(
+ value_type & expected,
+ value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+ storage_type expected_s, desired_s;
+ memcpy(&expected_s, &expected, sizeof(value_type));
+ memcpy(&desired_s, &desired, sizeof(value_type));
+ storage_type previous_s = expected_s;
+ platform_fence_before(success_order);
+ __asm__ (
+ "lock ; cmpxchgl %2, %1"
+ : "+a" (previous_s), "+m" (v_)
+ : "q" (desired_s)
+ );
+ bool success = (previous_s == expected_s);
+ if (success)
+ platform_fence_after(success_order);
+ else
+ platform_fence_after(failure_order);
+ memcpy(&expected, &previous_s, sizeof(value_type));
+ return success;
+ }
+
+ bool
+ compare_exchange_weak(
+ value_type & expected,
+ value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+ return compare_exchange_strong(expected, desired, success_order, failure_order);
+ }
+
+ bool
+ is_lock_free(void) const volatile
+ {
+ return true;
+ }
+
+ BOOST_ATOMIC_DECLARE_BASE_OPERATORS
+private:
+ base_atomic(const base_atomic &) /* = delete */ ;
+ void operator=(const base_atomic &) /* = delete */ ;
+ storage_type v_;
+};
+
+#if defined(__x86_64__)
+template<typename T, bool Sign>
+class base_atomic<T, void, 8, Sign> {
+ typedef base_atomic this_type;
+ typedef T value_type;
+ typedef uint64_t storage_type;
+public:
+ explicit base_atomic(value_type v)
+ {
+ memcpy(&v_, &v, sizeof(value_type));
+ }
+ base_atomic(void) {}
+
+ void
+ store(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ if (order != memory_order_seq_cst) {
+ storage_type tmp;
+ memcpy(&tmp, &v, sizeof(value_type));
+ platform_fence_before(order);
+ const_cast<volatile storage_type &>(v_) = tmp;
+ } else {
+ exchange(v, order);
+ }
+ }
+
+ value_type
+ load(memory_order order = memory_order_seq_cst) const volatile
+ {
+ storage_type tmp = const_cast<volatile storage_type &>(v_);
+ platform_fence_after_load(order);
+ value_type v;
+ memcpy(&v, &tmp, sizeof(value_type));
+ return v;
+ }
+
+ value_type
+ exchange(value_type v, memory_order order = memory_order_seq_cst) volatile
+ {
+ storage_type tmp;
+ memcpy(&tmp, &v, sizeof(value_type));
+ platform_fence_before(order);
+ __asm__ (
+ "xchgq %0, %1"
+ : "+q" (tmp), "+m" (v_)
+ );
+ platform_fence_after(order);
+ memcpy(&v, &tmp, sizeof(value_type));
+ return v;
+ }
+
+ bool
+ compare_exchange_strong(
+ value_type & expected,
+ value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+ storage_type expected_s, desired_s;
+ memcpy(&expected_s, &expected, sizeof(value_type));
+ memcpy(&desired_s, &desired, sizeof(value_type));
+ storage_type previous_s = expected_s;
+ platform_fence_before(success_order);
+ __asm__ (
+ "lock ; cmpxchgq %2, %1"
+ : "+a" (previous_s), "+m" (v_)
+ : "q" (desired_s)
+ );
+ bool success = (previous_s == expected_s);
+ if (success)
+ platform_fence_after(success_order);
+ else
+ platform_fence_after(failure_order);
+ memcpy(&expected, &previous_s, sizeof(value_type));
+ return success;
+ }
+
+ bool
+ compare_exchange_weak(
+ value_type & expected,
+ value_type desired,
+ memory_order success_order,
+ memory_order failure_order) volatile
+ {
+ return compare_exchange_strong(expected, desired, success_order, failure_order);
+ }
+
+ bool
+ is_lock_free(void) const volatile
+ {
+ return true;
+ }
+
+ BOOST_ATOMIC_DECLARE_BASE_OPERATORS
+private:
+ base_atomic(const base_atomic &) /* = delete */ ;
+ void operator=(const base_atomic &) /* = delete */ ;
+ storage_type v_;
+};
+#endif
+
+#if defined(__i686__)
+
+template<typename T>
+bool
+platform_cmpxchg64_strong(T & expected, T desired, volatile T * ptr)
+{
+ int scratch;
+ T prev = expected;
+ /* Make sure ebx is saved and restored properly in case
+ this object is compiled as "position independent". Since
+ programmers on x86 tend to forget specifying -DPIC or
+ similar, always assume PIC.
+
+ To make this work uniformly even in the non-PIC case,
+ setup register constraints such that ebx can not be
+ used by accident e.g. as base address for the variable
+ to be modified. Accessing "scratch" should always be okay,
+ as it can only be placed on the stack (and therefore
+ accessed through ebp or esp only).
+
+ In theory, could push/pop ebx onto/off the stack, but movs
+ to a prepared stack slot turn out to be faster. */
+ __asm__ __volatile__ (
+ "movl %%ebx, %1\n"
+ "movl %2, %%ebx\n"
+ "lock; cmpxchg8b 0(%4)\n"
+ "movl %1, %%ebx\n"
+ : "=A" (prev), "=m" (scratch)
+ : "D" ((int)desired), "c" ((int)(desired >> 32)), "S" (ptr), "0" (prev)
+ : "memory");
+ bool success = (prev == expected);
+ expected = prev;
+ return success;
+}
+
+#endif
+
+}
+}
+}
+
+/* pull in 64-bit atomic type using cmpxchg8b above */
+#if defined(__i686__)
+#include <boost/atomic/detail/cas64strong.hpp>
+#endif
+
+#endif
\ No newline at end of file
=== added file 'atomic/boost/atomic/detail/interlocked.hpp'
--- atomic/boost/atomic/detail/interlocked.hpp 1970-01-01 00:00:00 +0000
+++ atomic/boost/atomic/detail/interlocked.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,99 @@
+#ifndef BOOST_DETAIL_ATOMIC_INTERLOCKED_HPP
+#define BOOST_DETAIL_ATOMIC_INTERLOCKED_HPP
+
+// Copyright (c) 2009 Helge Bahmann
+//
+// 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)
+
+#include <boost/detail/interlocked.hpp>
+
+#define BOOST_ATOMIC_CHAR_LOCK_FREE 2
+#define BOOST_ATOMIC_SHORT_LOCK_FREE 2
+#define BOOST_ATOMIC_INT_LOCK_FREE 2
+#define BOOST_ATOMIC_LONG_LOCK_FREE (sizeof(long) <= 4 ? 2 : 0)
+#define BOOST_ATOMIC_LLONG_LOCK_FREE (sizeof(long long) <= 4 ? 2 : 0)
+#define BOOST_ATOMIC_ADDRESS_LOCK_FREE (sizeof(void *) <= 4 ? 2 : 0)
+#define BOOST_ATOMIC_BOOL_LOCK_FREE 2
+
+namespace boost {
+namespace detail {
+namespace atomic {
+
+static inline void
+x86_full_fence(void)
+{
+ long tmp;
+ BOOST_INTERLOCKED_EXCHANGE(&tmp, 0);
+}
+
+static inline void
+platform_fence_before(memory_order)
+{
+}
+
+static inline void
+platform_fence_after(memory_order)
+{
+}
+
+static inline void
+platform_fence_before_store(memory_order)
+{
+}
+
+static inline void
+platform_fence_after_store(memory_order order)
+{
+ if (order == memory_order_seq_cst)
+ x86_full_fence();
+}
+
+static inline void
+platform_fence_after_load(memory_order order)
+{
+ if (order == memory_order_seq_cst) {
+ x86_full_fence();
+ }
+}
+
+template<typename T>
+bool
+platform_cmpxchg32_strong(T & expected, T desired, volatile T * ptr)
+{
+ T prev = expected;
+ expected = (T)BOOST_INTERLOCKED_COMPARE_EXCHANGE((long *)(ptr), (long)desired, (long)expected);
+ bool success = (prev==expected);
+ return success;
+}
+
+#if defined(_WIN64)
+template<typename T>
+bool
+platform_cmpxchg64_strong(T & expected, T desired, volatile T * ptr)
+{
+ T prev = expected;
+ expected = (T) _InterlockedCompareExchange64((long long *)(ptr), (long long)desired, (long long)expected);
+ bool success = (prev==expected);
+ return success;
+}
+#endif
+
+}
+}
+
+#define BOOST_ATOMIC_THREAD_FENCE 2
+inline void
+atomic_thread_fence(memory_order order)
+{
+ if (order == memory_order_seq_cst) {
+ detail::atomic::x86_full_fence();
+ }
+}
+
+}
+
+#include <boost/atomic/detail/cas32strong.hpp>
+
+#endif
=== added file 'atomic/boost/atomic/detail/type-classifier.hpp'
--- atomic/boost/atomic/detail/type-classifier.hpp 1970-01-01 00:00:00 +0000
+++ atomic/boost/atomic/detail/type-classifier.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,79 @@
+#ifndef BOOST_DETAIL_ATOMIC_TYPE_CLASSIFIER_HPP
+#define BOOST_DETAIL_ATOMIC_TYPE_CLASSIFIER_HPP
+
+// Copyright (c) 2011 Helge Bahmann
+//
+// 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)
+
+namespace boost { namespace detail { namespace atomic {
+
+template<typename T>
+struct type_classifier {
+ typedef void test;
+};
+
+template<>
+struct type_classifier<char> {typedef int test;};
+template<>
+struct type_classifier<unsigned char> {typedef int test;};
+template<>
+struct type_classifier<signed char> {typedef int test;};
+template<>
+struct type_classifier<unsigned short> {typedef int test;};
+template<>
+struct type_classifier<signed short> {typedef int test;};
+template<>
+struct type_classifier<unsigned int> {typedef int test;};
+template<>
+struct type_classifier<signed int> {typedef int test;};
+template<>
+struct type_classifier<unsigned long> {typedef int test;};
+template<>
+struct type_classifier<long> {typedef int test;};
+#ifdef BOOST_HAS_LONG_LONG
+template<> struct type_classifier<unsigned long long>
+{typedef int test;};
+template<> struct type_classifier<signed long long>
+{typedef int test;};
+#endif
+
+template<typename T>
+struct type_classifier<T *> {typedef void * test;};
+
+template<typename T>
+struct sign_trait {
+ typedef void test;
+};
+
+template<>
+struct sign_trait<char> {typedef int test;};
+template<>
+struct sign_trait<unsigned char> {typedef unsigned int test;};
+template<>
+struct sign_trait<signed char> {typedef int test;};
+template<>
+struct sign_trait<unsigned short> {typedef unsigned int test;};
+template<>
+struct sign_trait<signed short> {typedef int test;};
+template<>
+struct sign_trait<unsigned int> {typedef unsigned int test;};
+template<>
+struct sign_trait<signed int> {typedef int test;};
+template<>
+struct sign_trait<unsigned long> {typedef unsigned int test;};
+template<>
+struct sign_trait<long> {typedef int test;};
+#ifdef BOOST_HAS_LONG_LONG
+template<> struct sign_trait<unsigned long long>
+{typedef unsigned int test;};
+template<> struct sign_trait<signed long long>
+{typedef int test;};
+#endif
+
+
+
+}}}
+
+#endif
=== added file 'atomic/boost/atomic/platform.hpp'
--- atomic/boost/atomic/platform.hpp 1970-01-01 00:00:00 +0000
+++ atomic/boost/atomic/platform.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,47 @@
+// Copyright (c) 2009 Helge Bahmann
+//
+// 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)
+
+// Platform selection file
+
+#include <boost/config.hpp>
+
+#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
+
+ #include <boost/atomic/detail/gcc-x86.hpp>
+
+#elif defined(__GNUC__) && defined(__alpha__)
+
+ #include <boost/atomic/detail/gcc-alpha.hpp>
+
+#elif defined(__GNUC__) && (defined(__POWERPC__) || defined(__PPC__))
+
+ #include <boost/atomic/detail/gcc-ppc.hpp>
+
+// This list of ARM architecture versions comes from Apple's arm/arch.h header.
+// I don't know how complete it is.
+#elif defined(__GNUC__) && (defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \
+ || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) \
+ || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_7A__))
+
+ #include <boost/atomic/detail/gcc-armv6+.hpp>
+
+#elif defined(__linux__) && defined(__arm__)
+
+ #include <boost/atomic/detail/linux-arm.hpp>
+
+#elif defined(__GNUC__) && defined(__sparc_v9__)
+
+ #include <boost/atomic/detail/gcc-sparcv9.hpp>
+
+#elif defined(BOOST_USE_WINDOWS_H) || defined(_WIN32_CE) || defined(BOOST_MSVC) || defined(BOOST_INTEL_WIN) || defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+
+ #include <boost/atomic/detail/interlocked.hpp>
+
+#elif defined(__GNUC__)
+
+ #include <boost/atomic/detail/gcc-cas.hpp>
+
+#endif
=== added directory 'boost'
=== renamed directory 'boost' => 'boost.moved'
=== added file 'boost/LICENSE_1_0.txt'
--- boost/LICENSE_1_0.txt 1970-01-01 00:00:00 +0000
+++ boost/LICENSE_1_0.txt 2012-07-01 17:31:20 +0000
@@ -0,0 +1,23 @@
+Boost Software License - Version 1.0 - August 17th, 2003
+
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
=== added file 'boost/SConscript'
--- boost/SConscript 1970-01-01 00:00:00 +0000
+++ boost/SConscript 2012-07-01 17:31:20 +0000
@@ -0,0 +1,9 @@
+Import('dev')
+
+ret = []
+
+glob = dev.env.Glob('libs/*/src', strings = 1)
+for path in glob:
+ ret.append(dev.build(path + '/'))
+
+Return('ret')
=== added directory 'boost/boost'
=== added directory 'boost/boost/accumulators'
=== added file 'boost/boost/accumulators/accumulators.hpp'
--- boost/boost/accumulators/accumulators.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/accumulators.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,27 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file accumulators.hpp
+/// Includes all of the Accumulators Framework
+//
+// Copyright 2005 Eric Niebler. 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)
+
+#ifndef BOOST_ACCUMULATORS_ACCUMULATORS_HPP_EAN_28_10_2005
+#define BOOST_ACCUMULATORS_ACCUMULATORS_HPP_EAN_28_10_2005
+
+#include <boost/accumulators/framework/accumulator_set.hpp>
+#include <boost/accumulators/framework/accumulator_concept.hpp>
+#include <boost/accumulators/framework/accumulator_base.hpp>
+#include <boost/accumulators/framework/extractor.hpp>
+#include <boost/accumulators/framework/external.hpp>
+#include <boost/accumulators/framework/features.hpp>
+#include <boost/accumulators/framework/parameters/accumulator.hpp>
+#include <boost/accumulators/framework/parameters/sample.hpp>
+#include <boost/accumulators/framework/parameters/weight.hpp>
+#include <boost/accumulators/framework/parameters/weights.hpp>
+#include <boost/accumulators/framework/accumulators/external_accumulator.hpp>
+#include <boost/accumulators/framework/accumulators/droppable_accumulator.hpp>
+#include <boost/accumulators/framework/accumulators/reference_accumulator.hpp>
+#include <boost/accumulators/framework/accumulators/value_accumulator.hpp>
+
+#endif
=== added file 'boost/boost/accumulators/accumulators_fwd.hpp'
--- boost/boost/accumulators/accumulators_fwd.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/accumulators_fwd.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,219 @@
+///////////////////////////////////////////////////////////////////////////////
+// accumulators_fwd.hpp
+//
+// Copyright 2005 Eric Niebler. 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)
+
+#ifndef BOOST_ACCUMULATORS_ACCUMULATORS_FWD_HPP_EAN_28_10_2005
+#define BOOST_ACCUMULATORS_ACCUMULATORS_FWD_HPP_EAN_28_10_2005
+
+#include <boost/config.hpp>
+#include <boost/mpl/apply_fwd.hpp> // for mpl::na
+#include <boost/mpl/limits/vector.hpp>
+#include <boost/preprocessor/arithmetic/inc.hpp>
+#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
+#include <boost/preprocessor/repetition/enum_trailing_params.hpp>
+#include <boost/preprocessor/repetition/enum_trailing_binary_params.hpp>
+#include <boost/preprocessor/repetition/repeat_from_to.hpp>
+#include <boost/accumulators/numeric/functional_fwd.hpp>
+
+#ifndef BOOST_ACCUMULATORS_MAX_FEATURES
+ /// The maximum number of accumulators that may be put in an accumulator_set.
+ /// Defaults to BOOST_MPL_LIMIT_VECTOR_SIZE (which defaults to 20).
+# define BOOST_ACCUMULATORS_MAX_FEATURES BOOST_MPL_LIMIT_VECTOR_SIZE
+#endif
+
+#if BOOST_ACCUMULATORS_MAX_FEATURES > BOOST_MPL_LIMIT_VECTOR_SIZE
+# error BOOST_ACCUMULATORS_MAX_FEATURES cannot be larger than BOOST_MPL_LIMIT_VECTOR_SIZE
+#endif
+
+#ifndef BOOST_ACCUMULATORS_MAX_ARGS
+ /// The maximum number of arguments that may be specified to an accumulator_set's
+ /// accumulation function. Defaults to 15.
+# define BOOST_ACCUMULATORS_MAX_ARGS 15
+#endif
+
+#if BOOST_WORKAROUND(__GNUC__, == 3) \
+ || BOOST_WORKAROUND(__EDG_VERSION__, BOOST_TESTED_AT(306))
+# define BOOST_ACCUMULATORS_BROKEN_CONST_OVERLOADS
+#endif
+
+#ifdef BOOST_ACCUMULATORS_BROKEN_CONST_OVERLOADS
+# include <boost/utility/enable_if.hpp>
+# include <boost/type_traits/is_const.hpp>
+# define BOOST_ACCUMULATORS_PROTO_DISABLE_IF_IS_CONST(T)\
+ , typename boost::disable_if<boost::is_const<T> >::type * = 0
+#else
+# define BOOST_ACCUMULATORS_PROTO_DISABLE_IF_IS_CONST(T)
+#endif
+
+#define BOOST_ACCUMULATORS_GCC_VERSION \
+ (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
+
+namespace boost { namespace accumulators
+{
+
+///////////////////////////////////////////////////////////////////////////////
+// Named parameters tags
+//
+namespace tag
+{
+ struct sample;
+ struct weight;
+ struct accumulator;
+ struct weights;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// User-level features
+//
+namespace tag
+{
+ template<typename ValueType, typename Tag>
+ struct value;
+
+ template<typename Tag>
+ struct value_tag;
+
+ template<typename Referent, typename Tag>
+ struct reference;
+
+ template<typename Tag>
+ struct reference_tag;
+
+ template<typename Type, typename Tag = void, typename AccumulatorSet = void>
+ struct external;
+
+ template<typename Feature>
+ struct droppable;
+}
+
+template<typename Accumulator>
+struct droppable_accumulator_base;
+
+template<typename Accumulator>
+struct droppable_accumulator;
+
+template<typename Accumulator>
+struct with_cached_result;
+
+template<typename Sample, typename Features, typename Weight = void>
+struct accumulator_set;
+
+template<typename Feature>
+struct extractor;
+
+template<typename Feature>
+struct feature_of;
+
+template<typename Feature>
+struct as_feature;
+
+template<typename Feature>
+struct as_weighted_feature;
+
+template<BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_ACCUMULATORS_MAX_FEATURES, typename Feature, mpl::na)>
+struct depends_on;
+
+template<BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_ACCUMULATORS_MAX_FEATURES, typename Feature, mpl::na)>
+struct features;
+
+template<typename Feature, typename AccumulatorSet>
+typename mpl::apply<AccumulatorSet, Feature>::type const &
+find_accumulator(AccumulatorSet const &acc);
+
+template<typename Feature, typename AccumulatorSet>
+typename mpl::apply<AccumulatorSet, Feature>::type::result_type
+extract_result(AccumulatorSet const &acc);
+
+template<typename Feature, typename AccumulatorSet, typename A1>
+typename mpl::apply<AccumulatorSet, Feature>::type::result_type
+extract_result(AccumulatorSet const &acc, A1 const &a1);
+
+// ... other overloads generated by Boost.Preprocessor:
+
+/// INTERNAL ONLY
+///
+#define BOOST_ACCUMULATORS_EXTRACT_RESULT_FWD(z, n, _) \
+ template< \
+ typename Feature \
+ , typename AccumulatorSet \
+ BOOST_PP_ENUM_TRAILING_PARAMS_Z(z, n, typename A) \
+ > \
+ typename mpl::apply<AccumulatorSet, Feature>::type::result_type \
+ extract_result( \
+ AccumulatorSet const &acc \
+ BOOST_PP_ENUM_TRAILING_BINARY_PARAMS_Z(z, n, A, const &a) \
+ );
+
+/// INTERNAL ONLY
+///
+BOOST_PP_REPEAT_FROM_TO(
+ 2
+ , BOOST_PP_INC(BOOST_ACCUMULATORS_MAX_ARGS)
+ , BOOST_ACCUMULATORS_EXTRACT_RESULT_FWD
+ , _
+)
+
+#ifdef BOOST_ACCUMULATORS_DOXYGEN_INVOKED
+template<typename Feature, typename AccumulatorSet, typename A1, typename A2 ...>
+typename mpl::apply<AccumulatorSet, Feature>::type::result_type
+extract_result(AccumulatorSet const &acc, A1 const &a1, A2 const &a2 ...);
+#endif
+
+namespace impl
+{
+ using namespace numeric::operators;
+
+ template<typename Accumulator, typename Tag>
+ struct external_impl;
+}
+
+namespace detail
+{
+ template<typename Accumulator>
+ struct feature_tag;
+
+ template<typename Feature, typename Sample, typename Weight>
+ struct to_accumulator;
+
+ struct accumulator_set_base;
+
+ template<typename T>
+ struct is_accumulator_set;
+
+ inline void ignore_variable(void const *) {}
+
+ #define BOOST_ACCUMULATORS_IGNORE_GLOBAL(X)\
+ namespace detail { inline void BOOST_PP_CAT(ignore_, X)() { boost::accumulators::detail::ignore_variable(&X); } }
+}
+
+}} // namespace boost::accumulators
+
+// For defining boost::parameter keywords that can be inherited from to
+// get a nested, class-scoped keyword with the requested alias
+#define BOOST_PARAMETER_NESTED_KEYWORD(tag_namespace, name, alias) \
+ namespace tag_namespace \
+ { \
+ template<int Dummy = 0> \
+ struct name ## _ \
+ { \
+ static char const* keyword_name() \
+ { \
+ return #name; \
+ } \
+ static ::boost::parameter::keyword<name ## _<Dummy> > &alias; \
+ }; \
+ template<int Dummy> \
+ ::boost::parameter::keyword<name ## _<Dummy> > &name ## _<Dummy>::alias = \
+ ::boost::parameter::keyword<name ## _<Dummy> >::get(); \
+ typedef name ## _ <> name; \
+ } \
+ namespace \
+ { \
+ ::boost::parameter::keyword<tag_namespace::name> &name = \
+ ::boost::parameter::keyword<tag_namespace::name>::get(); \
+ }
+
+#endif
=== added directory 'boost/boost/accumulators/framework'
=== added file 'boost/boost/accumulators/framework/accumulator_base.hpp'
--- boost/boost/accumulators/framework/accumulator_base.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/framework/accumulator_base.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,65 @@
+///////////////////////////////////////////////////////////////////////////////
+// accumulator_base.hpp
+//
+// Copyright 2005 Eric Niebler. 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)
+
+#ifndef BOOST_ACCUMULATORS_FRAMEWORK_ACCUMULATORS_BASE_HPP_EAN_28_10_2005
+#define BOOST_ACCUMULATORS_FRAMEWORK_ACCUMULATORS_BASE_HPP_EAN_28_10_2005
+
+#include <boost/mpl/placeholders.hpp>
+#include <boost/mpl/joint_view.hpp>
+#include <boost/mpl/single_view.hpp>
+#include <boost/mpl/fold.hpp>
+#include <boost/mpl/contains.hpp>
+#include <boost/mpl/empty_sequence.hpp>
+#include <boost/accumulators/framework/accumulator_concept.hpp>
+
+namespace boost { namespace accumulators
+{
+
+namespace detail
+{
+ typedef void void_;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// dont_care
+//
+struct dont_care
+{
+ template<typename Args>
+ dont_care(Args const &)
+ {
+ }
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// accumulator_base
+//
+struct accumulator_base
+{
+ // hidden if defined in derived classes
+ detail::void_ operator ()(dont_care)
+ {
+ }
+
+ typedef mpl::false_ is_droppable;
+
+ detail::void_ add_ref(dont_care)
+ {
+ }
+
+ detail::void_ drop(dont_care)
+ {
+ }
+
+ detail::void_ on_drop(dont_care)
+ {
+ }
+};
+
+}} // namespace boost::accumulators
+
+#endif
=== added file 'boost/boost/accumulators/framework/accumulator_concept.hpp'
--- boost/boost/accumulators/framework/accumulator_concept.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/framework/accumulator_concept.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,29 @@
+///////////////////////////////////////////////////////////////////////////////
+// accumulator_concept.hpp
+//
+// Copyright 2005 Eric Niebler. 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)
+
+#ifndef BOOST_ACCUMULATORS_FRAMEWORK_ACCUMULATOR_CONCEPT_HPP_EAN_28_10_2005
+#define BOOST_ACCUMULATORS_FRAMEWORK_ACCUMULATOR_CONCEPT_HPP_EAN_28_10_2005
+
+#include <boost/concept_check.hpp>
+
+namespace boost { namespace accumulators
+{
+
+template<typename Stat>
+struct accumulator_concept
+{
+ void constraints()
+ {
+ // TODO: define the stat concept
+ }
+
+ Stat stat;
+};
+
+}} // namespace boost::accumulators
+
+#endif
=== added file 'boost/boost/accumulators/framework/accumulator_set.hpp'
--- boost/boost/accumulators/framework/accumulator_set.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/framework/accumulator_set.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,401 @@
+///////////////////////////////////////////////////////////////////////////////
+// accumulator_set.hpp
+//
+// Copyright 2005 Eric Niebler. 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)
+
+#ifndef BOOST_ACCUMULATORS_FRAMEWORK_ACCUMULATOR_SET_HPP_EAN_28_10_2005
+#define BOOST_ACCUMULATORS_FRAMEWORK_ACCUMULATOR_SET_HPP_EAN_28_10_2005
+
+#include <boost/version.hpp>
+#include <boost/mpl/apply.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/mpl/protect.hpp>
+#include <boost/mpl/identity.hpp>
+#include <boost/mpl/is_sequence.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/type_traits/is_base_and_derived.hpp>
+#include <boost/parameter/parameters.hpp>
+#include <boost/preprocessor/repetition/repeat_from_to.hpp>
+#include <boost/preprocessor/repetition/enum_binary_params.hpp>
+#include <boost/accumulators/accumulators_fwd.hpp>
+#include <boost/accumulators/framework/depends_on.hpp>
+#include <boost/accumulators/framework/accumulator_concept.hpp>
+#include <boost/accumulators/framework/parameters/accumulator.hpp>
+#include <boost/accumulators/framework/parameters/sample.hpp>
+#include <boost/accumulators/framework/accumulators/external_accumulator.hpp>
+#include <boost/accumulators/framework/accumulators/droppable_accumulator.hpp>
+#include <boost/fusion/include/any.hpp>
+#include <boost/fusion/include/find_if.hpp>
+#include <boost/fusion/include/for_each.hpp>
+#include <boost/fusion/include/filter_view.hpp>
+
+namespace boost { namespace accumulators
+{
+
+namespace detail
+{
+ ///////////////////////////////////////////////////////////////////////////////
+ // accumulator_visitor
+ // wrap a boost::parameter argument pack in a Fusion extractor object
+ template<typename Args>
+ struct accumulator_visitor
+ {
+ explicit accumulator_visitor(Args const &a)
+ : args(a)
+ {
+ }
+
+ template<typename Accumulator>
+ void operator ()(Accumulator &accumulator) const
+ {
+ accumulator(this->args);
+ }
+
+ private:
+ accumulator_visitor &operator =(accumulator_visitor const &);
+ Args const &args;
+ };
+
+ template<typename Args>
+ inline accumulator_visitor<Args> const make_accumulator_visitor(Args const &args)
+ {
+ return accumulator_visitor<Args>(args);
+ }
+
+ typedef
+ parameter::parameters<
+ parameter::required<tag::accumulator>
+ , parameter::optional<tag::sample>
+ // ... and others which are not specified here...
+ >
+ accumulator_params;
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // accumulator_set_base
+ struct accumulator_set_base
+ {
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // is_accumulator_set
+ template<typename T>
+ struct is_accumulator_set
+ : is_base_and_derived<accumulator_set_base, T>
+ {
+ };
+
+} // namespace detail
+
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable: 4355) // warning C4355: 'this' : used in base member initializer list
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief A set of accumulators.
+///
+/// accumulator_set resolves the dependencies between features and ensures that
+/// the accumulators in the set are updated in the proper order.
+///
+/// acccumulator_set provides a general mechanism to visit the accumulators
+/// in the set in order, with or without a filter. You can also fetch a reference
+/// to an accumulator that corresponds to a feature.
+///
+template<typename Sample, typename Features, typename Weight>
+struct accumulator_set
+ : detail::accumulator_set_base
+{
+ typedef Sample sample_type; ///< The type of the samples that will be accumulated
+ typedef Features features_type; ///< An MPL sequence of the features that should be accumulated.
+ typedef Weight weight_type; ///< The type of the weight parameter. Must be a scalar. Defaults to void.
+
+ /// INTERNAL ONLY
+ ///
+ typedef
+ typename detail::make_accumulator_tuple<
+ Features
+ , Sample
+ , Weight
+ >::type
+ accumulators_mpl_vector;
+
+ // generate a fusion::list of accumulators
+ /// INTERNAL ONLY
+ ///
+ typedef
+ typename detail::meta::make_acc_list<
+ accumulators_mpl_vector
+ >::type
+ accumulators_type;
+
+ /// INTERNAL ONLY
+ ///
+ //BOOST_MPL_ASSERT((mpl::is_sequence<accumulators_type>));
+
+ ///////////////////////////////////////////////////////////////////////////////
+ /// default-construct all contained accumulators
+ accumulator_set()
+ : accumulators(
+ detail::make_acc_list(
+ accumulators_mpl_vector()
+ , detail::accumulator_params()(*this)
+ )
+ )
+ {
+ // Add-ref the Features that the user has specified
+ this->template visit_if<detail::contains_feature_of_<Features> >(
+ detail::make_add_ref_visitor(detail::accumulator_params()(*this))
+ );
+ }
+
+ /// \overload
+ ///
+ /// \param a1 Optional named parameter to be passed to all the accumulators
+ template<typename A1>
+ explicit accumulator_set(A1 const &a1)
+ : accumulators(
+ detail::make_acc_list(
+ accumulators_mpl_vector()
+ , detail::accumulator_params()(*this, a1)
+ )
+ )
+ {
+ // Add-ref the Features that the user has specified
+ this->template visit_if<detail::contains_feature_of_<Features> >(
+ detail::make_add_ref_visitor(detail::accumulator_params()(*this))
+ );
+ }
+
+ // ... other overloads generated by Boost.Preprocessor:
+
+ /// INTERNAL ONLY
+ ///
+#define BOOST_ACCUMULATORS_ACCUMULATOR_SET_CTOR(z, n, _) \
+ template<BOOST_PP_ENUM_PARAMS_Z(z, n, typename A)> \
+ accumulator_set(BOOST_PP_ENUM_BINARY_PARAMS_Z(z, n, A, const &a)) \
+ : accumulators( \
+ detail::make_acc_list( \
+ accumulators_mpl_vector() \
+ , detail::accumulator_params()( \
+ *this BOOST_PP_ENUM_TRAILING_PARAMS_Z(z, n, a) \
+ ) \
+ ) \
+ ) \
+ { \
+ /* Add-ref the Features that the user has specified */ \
+ this->template visit_if<detail::contains_feature_of_<Features> >( \
+ detail::make_add_ref_visitor(detail::accumulator_params()(*this)) \
+ ); \
+ }
+
+ /// INTERNAL ONLY
+ ///
+ BOOST_PP_REPEAT_FROM_TO(
+ 2
+ , BOOST_PP_INC(BOOST_ACCUMULATORS_MAX_ARGS)
+ , BOOST_ACCUMULATORS_ACCUMULATOR_SET_CTOR
+ , _
+ )
+
+ #ifdef BOOST_ACCUMULATORS_DOXYGEN_INVOKED
+ /// \overload
+ ///
+ template<typename A1, typename A2, ...>
+ accumulator_set(A1 const &a1, A2 const &a2, ...);
+ #endif
+
+ // ... other overloads generated by Boost.Preprocessor below ...
+
+ ///////////////////////////////////////////////////////////////////////////////
+ /// Visitation
+ /// \param func UnaryFunction which is invoked with each accumulator in turn.
+ template<typename UnaryFunction>
+ void visit(UnaryFunction const &func)
+ {
+ fusion::for_each(this->accumulators, func);
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ /// Conditional visitation
+ /// \param func UnaryFunction which is invoked with each accumulator in turn,
+ /// provided the accumulator satisfies the MPL predicate FilterPred.
+ template<typename FilterPred, typename UnaryFunction>
+ void visit_if(UnaryFunction const &func)
+ {
+ fusion::filter_view<accumulators_type, FilterPred> filtered_accs(this->accumulators);
+ fusion::for_each(filtered_accs, func);
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ /// The return type of the operator() overloads is void.
+ typedef void result_type;
+
+ ///////////////////////////////////////////////////////////////////////////////
+ /// Accumulation
+ /// \param a1 Optional named parameter to be passed to all the accumulators
+ void operator ()()
+ {
+ this->visit(
+ detail::make_accumulator_visitor(
+ detail::accumulator_params()(*this)
+ )
+ );
+ }
+
+ template<typename A1>
+ void operator ()(A1 const &a1)
+ {
+ this->visit(
+ detail::make_accumulator_visitor(
+ detail::accumulator_params()(*this, a1)
+ )
+ );
+ }
+
+ // ... other overloads generated by Boost.Preprocessor:
+
+ /// INTERNAL ONLY
+ ///
+#define BOOST_ACCUMULATORS_ACCUMULATOR_SET_FUN_OP(z, n, _) \
+ template<BOOST_PP_ENUM_PARAMS_Z(z, n, typename A)> \
+ void operator ()(BOOST_PP_ENUM_BINARY_PARAMS_Z(z, n, A, const &a)) \
+ { \
+ this->visit( \
+ detail::make_accumulator_visitor( \
+ detail::accumulator_params()( \
+ *this BOOST_PP_ENUM_TRAILING_PARAMS_Z(z, n, a) \
+ ) \
+ ) \
+ ); \
+ }
+
+ /// INTERNAL ONLY
+ ///
+ BOOST_PP_REPEAT_FROM_TO(
+ 2
+ , BOOST_PP_INC(BOOST_ACCUMULATORS_MAX_ARGS)
+ , BOOST_ACCUMULATORS_ACCUMULATOR_SET_FUN_OP
+ , _
+ )
+
+ #ifdef BOOST_ACCUMULATORS_DOXYGEN_INVOKED
+ /// \overload
+ ///
+ template<typename A1, typename A2, ...>
+ void operator ()(A1 const &a1, A2 const &a2, ...);
+ #endif
+
+ ///////////////////////////////////////////////////////////////////////////////
+ /// Extraction
+ template<typename Feature>
+ struct apply
+ : fusion::result_of::value_of<
+ typename fusion::result_of::find_if<
+ accumulators_type
+ , detail::matches_feature<Feature>
+ >::type
+ >
+ {
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ /// Extraction
+ template<typename Feature>
+ typename apply<Feature>::type &extract()
+ {
+ return *fusion::find_if<detail::matches_feature<Feature> >(this->accumulators);
+ }
+
+ /// \overload
+ template<typename Feature>
+ typename apply<Feature>::type const &extract() const
+ {
+ return *fusion::find_if<detail::matches_feature<Feature> >(this->accumulators);
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ /// Drop
+ template<typename Feature>
+ void drop()
+ {
+ // You can only drop the features that you have specified explicitly
+ typedef typename apply<Feature>::type the_accumulator;
+ BOOST_MPL_ASSERT((detail::contains_feature_of<Features, the_accumulator>));
+
+ typedef
+ typename feature_of<typename as_feature<Feature>::type>::type
+ the_feature;
+
+ (*fusion::find_if<detail::matches_feature<Feature> >(this->accumulators))
+ .drop(detail::accumulator_params()(*this));
+
+ // Also drop accumulators that this feature depends on
+ typedef typename the_feature::dependencies dependencies;
+ this->template visit_if<detail::contains_feature_of_<dependencies> >(
+ detail::make_drop_visitor(detail::accumulator_params()(*this))
+ );
+ }
+
+private:
+
+ accumulators_type accumulators;
+};
+
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+// find_accumulator
+// find an accumulator in an accumulator_set corresponding to a feature
+template<typename Feature, typename AccumulatorSet>
+typename mpl::apply<AccumulatorSet, Feature>::type &
+find_accumulator(AccumulatorSet &acc BOOST_ACCUMULATORS_PROTO_DISABLE_IF_IS_CONST(AccumulatorSet))
+{
+ return acc.template extract<Feature>();
+}
+
+/// \overload
+template<typename Feature, typename AccumulatorSet>
+typename mpl::apply<AccumulatorSet, Feature>::type const &
+find_accumulator(AccumulatorSet const &acc)
+{
+ return acc.template extract<Feature>();
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// extract_result
+// extract a result from an accumulator set
+/// INTERNAL ONLY
+///
+#define BOOST_ACCUMULATORS_EXTRACT_RESULT_FUN(z, n, _) \
+ template< \
+ typename Feature \
+ , typename AccumulatorSet \
+ BOOST_PP_ENUM_TRAILING_PARAMS_Z(z, n, typename A) \
+ > \
+ typename mpl::apply<AccumulatorSet, Feature>::type::result_type \
+ extract_result( \
+ AccumulatorSet const &acc \
+ BOOST_PP_ENUM_TRAILING_BINARY_PARAMS_Z(z, n, A, const &a) \
+ ) \
+ { \
+ return find_accumulator<Feature>(acc).result( \
+ detail::accumulator_params()( \
+ acc \
+ BOOST_PP_ENUM_TRAILING_PARAMS_Z(z, n, a) \
+ ) \
+ ); \
+ }
+
+BOOST_PP_REPEAT(
+ BOOST_PP_INC(BOOST_ACCUMULATORS_MAX_ARGS)
+ , BOOST_ACCUMULATORS_EXTRACT_RESULT_FUN
+ , _
+)
+
+}} // namespace boost::accumulators
+
+#endif
=== added directory 'boost/boost/accumulators/framework/accumulators'
=== added file 'boost/boost/accumulators/framework/accumulators/droppable_accumulator.hpp'
--- boost/boost/accumulators/framework/accumulators/droppable_accumulator.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/framework/accumulators/droppable_accumulator.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,317 @@
+///////////////////////////////////////////////////////////////////////////////
+// droppable_accumulator.hpp
+//
+// Copyright 2005 Eric Niebler. 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)
+
+#ifndef BOOST_ACCUMULATORS_FRAMEWORK_ACCUMULATORS_DROPPABLE_ACCUMULATOR_HPP_EAN_13_12_2005
+#define BOOST_ACCUMULATORS_FRAMEWORK_ACCUMULATORS_DROPPABLE_ACCUMULATOR_HPP_EAN_13_12_2005
+
+#include <new>
+#include <boost/assert.hpp>
+#include <boost/mpl/apply.hpp>
+#include <boost/aligned_storage.hpp>
+#include <boost/accumulators/framework/depends_on.hpp> // for feature_of
+#include <boost/accumulators/framework/parameters/accumulator.hpp> // for accumulator
+
+namespace boost { namespace accumulators
+{
+
+ template<typename Accumulator>
+ struct droppable_accumulator;
+
+ namespace detail
+ {
+ ///////////////////////////////////////////////////////////////////////////////
+ // add_ref_visitor
+ // a fusion function object for add_ref'ing accumulators
+ template<typename Args>
+ struct add_ref_visitor
+ {
+ explicit add_ref_visitor(Args const &args)
+ : args_(args)
+ {
+ }
+
+ template<typename Accumulator>
+ void operator ()(Accumulator &acc) const
+ {
+ typedef typename Accumulator::feature_tag::dependencies dependencies;
+
+ acc.add_ref(this->args_);
+
+ // Also add_ref accumulators that this feature depends on
+ this->args_[accumulator].template
+ visit_if<detail::contains_feature_of_<dependencies> >(
+ *this
+ );
+ }
+
+ private:
+ add_ref_visitor &operator =(add_ref_visitor const &);
+ Args const &args_;
+ };
+
+ template<typename Args>
+ add_ref_visitor<Args> make_add_ref_visitor(Args const &args)
+ {
+ return add_ref_visitor<Args>(args);
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // drop_visitor
+ // a fusion function object for dropping accumulators
+ template<typename Args>
+ struct drop_visitor
+ {
+ explicit drop_visitor(Args const &args)
+ : args_(args)
+ {
+ }
+
+ template<typename Accumulator>
+ void operator ()(Accumulator &acc) const
+ {
+ if(typename Accumulator::is_droppable())
+ {
+ typedef typename Accumulator::feature_tag::dependencies dependencies;
+
+ acc.drop(this->args_);
+ // Also drop accumulators that this feature depends on
+ this->args_[accumulator].template
+ visit_if<detail::contains_feature_of_<dependencies> >(
+ *this
+ );
+ }
+ }
+
+ private:
+ drop_visitor &operator =(drop_visitor const &);
+ Args const &args_;
+ };
+
+ template<typename Args>
+ drop_visitor<Args> make_drop_visitor(Args const &args)
+ {
+ return drop_visitor<Args>(args);
+ }
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // droppable_accumulator_base
+ template<typename Accumulator>
+ struct droppable_accumulator_base
+ : Accumulator
+ {
+ typedef droppable_accumulator_base base;
+ typedef mpl::true_ is_droppable;
+ typedef typename Accumulator::result_type result_type;
+
+ template<typename Args>
+ droppable_accumulator_base(Args const &args)
+ : Accumulator(args)
+ , ref_count_(0)
+ {
+ }
+
+ template<typename Args>
+ void operator ()(Args const &args)
+ {
+ if(!this->is_dropped())
+ {
+ this->Accumulator::operator ()(args);
+ }
+ }
+
+ template<typename Args>
+ void add_ref(Args const &)
+ {
+ ++this->ref_count_;
+ }
+
+ template<typename Args>
+ void drop(Args const &args)
+ {
+ BOOST_ASSERT(0 < this->ref_count_);
+ if(1 == this->ref_count_)
+ {
+ static_cast<droppable_accumulator<Accumulator> *>(this)->on_drop(args);
+ }
+ --this->ref_count_;
+ }
+
+ bool is_dropped() const
+ {
+ return 0 == this->ref_count_;
+ }
+
+ private:
+ int ref_count_;
+ };
+
+ //////////////////////////////////////////////////////////////////////////
+ // droppable_accumulator
+ // this can be specialized for any type that needs special handling
+ template<typename Accumulator>
+ struct droppable_accumulator
+ : droppable_accumulator_base<Accumulator>
+ {
+ template<typename Args>
+ droppable_accumulator(Args const &args)
+ : droppable_accumulator::base(args)
+ {
+ }
+ };
+
+ //////////////////////////////////////////////////////////////////////////
+ // with_cached_result
+ template<typename Accumulator>
+ struct with_cached_result
+ : Accumulator
+ {
+ typedef typename Accumulator::result_type result_type;
+
+ template<typename Args>
+ with_cached_result(Args const &args)
+ : Accumulator(args)
+ , cache()
+ {
+ }
+
+ with_cached_result(with_cached_result const &that)
+ : Accumulator(*static_cast<Accumulator const *>(&that))
+ , cache()
+ {
+ if(that.has_result())
+ {
+ this->set(that.get());
+ }
+ }
+
+ ~with_cached_result()
+ {
+ // Since this is a base class of droppable_accumulator_base,
+ // this destructor is called before any of droppable_accumulator_base's
+ // members get cleaned up, including is_dropped, so the following
+ // call to has_result() is valid.
+ if(this->has_result())
+ {
+ this->get().~result_type();
+ }
+ }
+
+ template<typename Args>
+ void on_drop(Args const &args)
+ {
+ // cache the result at the point this calcuation was dropped
+ BOOST_ASSERT(!this->has_result());
+ this->set(this->Accumulator::result(args));
+ }
+
+ template<typename Args>
+ result_type result(Args const &args) const
+ {
+ return this->has_result() ? this->get() : this->Accumulator::result(args);
+ }
+
+ private:
+ with_cached_result &operator =(with_cached_result const &);
+
+ void set(result_type const &r)
+ {
+ ::new(this->cache.address()) result_type(r);
+ }
+
+ result_type const &get() const
+ {
+ return *static_cast<result_type const *>(this->cache.address());
+ }
+
+ bool has_result() const
+ {
+ typedef with_cached_result<Accumulator> this_type;
+ typedef droppable_accumulator_base<this_type> derived_type;
+ return static_cast<derived_type const *>(this)->is_dropped();
+ }
+
+ aligned_storage<sizeof(result_type)> cache;
+ };
+
+ namespace tag
+ {
+ template<typename Feature>
+ struct as_droppable
+ {
+ typedef droppable<Feature> type;
+ };
+
+ template<typename Feature>
+ struct as_droppable<droppable<Feature> >
+ {
+ typedef droppable<Feature> type;
+ };
+
+ //////////////////////////////////////////////////////////////////////////
+ // droppable
+ template<typename Feature>
+ struct droppable
+ : as_feature<Feature>::type
+ {
+ typedef typename as_feature<Feature>::type feature_type;
+ typedef typename feature_type::dependencies tmp_dependencies_;
+
+ typedef
+ typename mpl::transform<
+ typename feature_type::dependencies
+ , as_droppable<mpl::_1>
+ >::type
+ dependencies;
+
+ struct impl
+ {
+ template<typename Sample, typename Weight>
+ struct apply
+ {
+ typedef
+ droppable_accumulator<
+ typename mpl::apply2<typename feature_type::impl, Sample, Weight>::type
+ >
+ type;
+ };
+ };
+ };
+ }
+
+ // make droppable<tag::feature(modifier)> work
+ template<typename Feature>
+ struct as_feature<tag::droppable<Feature> >
+ {
+ typedef tag::droppable<typename as_feature<Feature>::type> type;
+ };
+
+ // make droppable<tag::mean> work with non-void weights (should become
+ // droppable<tag::weighted_mean>
+ template<typename Feature>
+ struct as_weighted_feature<tag::droppable<Feature> >
+ {
+ typedef tag::droppable<typename as_weighted_feature<Feature>::type> type;
+ };
+
+ // for the purposes of feature-based dependency resolution,
+ // droppable<Foo> provides the same feature as Foo
+ template<typename Feature>
+ struct feature_of<tag::droppable<Feature> >
+ : feature_of<Feature>
+ {
+ };
+
+ // Note: Usually, the extractor is pulled into the accumulators namespace with
+ // a using directive, not the tag. But the droppable<> feature doesn't have an
+ // extractor, so we can put the droppable tag in the accumulators namespace
+ // without fear of a name conflict.
+ using tag::droppable;
+
+}} // namespace boost::accumulators
+
+#endif
=== added file 'boost/boost/accumulators/framework/accumulators/external_accumulator.hpp'
--- boost/boost/accumulators/framework/accumulators/external_accumulator.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/framework/accumulators/external_accumulator.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,108 @@
+///////////////////////////////////////////////////////////////////////////////
+// external_accumulator.hpp
+//
+// Copyright 2005 Eric Niebler. 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)
+
+#ifndef BOOST_ACCUMULATORS_FRAMEWORK_ACCUMULATORS_EXTERNAL_ACCUMULATOR_HPP_EAN_01_12_2005
+#define BOOST_ACCUMULATORS_FRAMEWORK_ACCUMULATORS_EXTERNAL_ACCUMULATOR_HPP_EAN_01_12_2005
+
+#include <boost/mpl/placeholders.hpp>
+#include <boost/parameter/keyword.hpp>
+#include <boost/accumulators/framework/extractor.hpp>
+#include <boost/accumulators/framework/depends_on.hpp> // for feature_tag
+#include <boost/accumulators/framework/accumulator_base.hpp>
+#include <boost/accumulators/framework/accumulators/reference_accumulator.hpp>
+
+namespace boost { namespace accumulators { namespace impl
+{
+
+ //////////////////////////////////////////////////////////////////////////
+ // external_impl
+ /// INTERNAL ONLY
+ ///
+ template<typename Accumulator, typename Tag>
+ struct external_impl
+ : accumulator_base
+ {
+ typedef typename Accumulator::result_type result_type;
+ typedef typename detail::feature_tag<Accumulator>::type feature_tag;
+
+ external_impl(dont_care) {}
+
+ template<typename Args>
+ result_type result(Args const &args) const
+ {
+ return this->extract_(args, args[parameter::keyword<Tag>::get() | 0]);
+ }
+
+ private:
+
+ template<typename Args>
+ static result_type extract_(Args const &args, int)
+ {
+ // No named parameter passed to the extractor. Maybe the external
+ // feature is held by reference<>.
+ extractor<feature_tag> extract;
+ return extract(accumulators::reference_tag<Tag>(args));
+ }
+
+ template<typename Args, typename AccumulatorSet>
+ static result_type extract_(Args const &, AccumulatorSet const &acc)
+ {
+ // OK, a named parameter for this external feature was passed to the
+ // extractor, so use that.
+ extractor<feature_tag> extract;
+ return extract(acc);
+ }
+ };
+
+} // namespace impl
+
+namespace tag
+{
+ //////////////////////////////////////////////////////////////////////////
+ // external
+ template<typename Feature, typename Tag, typename AccumulatorSet>
+ struct external
+ : depends_on<reference<AccumulatorSet, Tag> >
+ {
+ typedef
+ accumulators::impl::external_impl<
+ detail::to_accumulator<Feature, mpl::_1, mpl::_2>
+ , Tag
+ >
+ impl;
+ };
+
+ template<typename Feature, typename Tag>
+ struct external<Feature, Tag, void>
+ : depends_on<>
+ {
+ typedef
+ accumulators::impl::external_impl<
+ detail::to_accumulator<Feature, mpl::_1, mpl::_2>
+ , Tag
+ >
+ impl;
+ };
+}
+
+// for the purposes of feature-based dependency resolution,
+// external_accumulator<Feature, Tag> provides the same feature as Feature
+template<typename Feature, typename Tag, typename AccumulatorSet>
+struct feature_of<tag::external<Feature, Tag, AccumulatorSet> >
+ : feature_of<Feature>
+{
+};
+
+// Note: Usually, the extractor is pulled into the accumulators namespace with
+// a using directive, not the tag. But the external<> feature doesn't have an
+// extractor, so we can put the external tag in the accumulators namespace
+// without fear of a name conflict.
+using tag::external;
+
+}} // namespace boost::accumulators
+
+#endif
=== added file 'boost/boost/accumulators/framework/accumulators/reference_accumulator.hpp'
--- boost/boost/accumulators/framework/accumulators/reference_accumulator.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/framework/accumulators/reference_accumulator.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,89 @@
+///////////////////////////////////////////////////////////////////////////////
+// reference_accumulator.hpp
+//
+// Copyright 2005 Eric Niebler. 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)
+
+#ifndef BOOST_ACCUMULATORS_FRAMEWORK_ACCUMULATORS_REFERENCE_ACCUMULATOR_HPP_EAN_03_23_2006
+#define BOOST_ACCUMULATORS_FRAMEWORK_ACCUMULATORS_REFERENCE_ACCUMULATOR_HPP_EAN_03_23_2006
+
+#include <boost/ref.hpp>
+#include <boost/mpl/always.hpp>
+#include <boost/parameter/keyword.hpp>
+#include <boost/accumulators/framework/depends_on.hpp> // for feature_tag
+#include <boost/accumulators/framework/accumulator_base.hpp>
+#include <boost/accumulators/framework/extractor.hpp>
+
+namespace boost { namespace accumulators
+{
+
+namespace impl
+{
+ //////////////////////////////////////////////////////////////////////////
+ // reference_accumulator_impl
+ //
+ template<typename Referent, typename Tag>
+ struct reference_accumulator_impl
+ : accumulator_base
+ {
+ typedef Referent &result_type;
+
+ template<typename Args>
+ reference_accumulator_impl(Args const &args)
+ : ref(args[parameter::keyword<Tag>::get()])
+ {
+ }
+
+ result_type result(dont_care) const
+ {
+ return this->ref;
+ }
+
+ private:
+ reference_wrapper<Referent> ref;
+ };
+} // namespace impl
+
+namespace tag
+{
+ //////////////////////////////////////////////////////////////////////////
+ // reference_tag
+ template<typename Tag>
+ struct reference_tag
+ {
+ };
+
+ //////////////////////////////////////////////////////////////////////////
+ // reference
+ template<typename Referent, typename Tag>
+ struct reference
+ : depends_on<>
+ {
+ /// INTERNAL ONLY
+ ///
+ typedef mpl::always<accumulators::impl::reference_accumulator_impl<Referent, Tag> > impl;
+ };
+}
+
+namespace extract
+{
+ BOOST_ACCUMULATORS_DEFINE_EXTRACTOR(tag, reference, (typename)(typename))
+ BOOST_ACCUMULATORS_DEFINE_EXTRACTOR(tag, reference_tag, (typename))
+}
+
+using extract::reference;
+using extract::reference_tag;
+
+// Map all reference<V,T> features to reference_tag<T> so
+// that references can be extracted using reference_tag<T>
+// without specifying the referent type.
+template<typename ValueType, typename Tag>
+struct feature_of<tag::reference<ValueType, Tag> >
+ : feature_of<tag::reference_tag<Tag> >
+{
+};
+
+}} // namespace boost::accumulators
+
+#endif
=== added file 'boost/boost/accumulators/framework/accumulators/value_accumulator.hpp'
--- boost/boost/accumulators/framework/accumulators/value_accumulator.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/framework/accumulators/value_accumulator.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,89 @@
+///////////////////////////////////////////////////////////////////////////////
+// value_accumulator.hpp
+//
+// Copyright 2005 Eric Niebler, Daniel Egloff. 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)
+
+#ifndef BOOST_ACCUMULATORS_FRAMEWORK_ACCUMULATORS_VALUE_ACCUMULATOR_HPP_EAN_03_23_2006
+#define BOOST_ACCUMULATORS_FRAMEWORK_ACCUMULATORS_VALUE_ACCUMULATOR_HPP_EAN_03_23_2006
+
+#include <boost/mpl/always.hpp>
+#include <boost/parameter/keyword.hpp>
+#include <boost/accumulators/framework/depends_on.hpp> // for feature_tag
+#include <boost/accumulators/framework/accumulator_base.hpp>
+#include <boost/accumulators/framework/extractor.hpp>
+
+namespace boost { namespace accumulators
+{
+
+namespace impl
+{
+
+ //////////////////////////////////////////////////////////////////////////
+ // value_accumulator_impl
+ template<typename ValueType, typename Tag>
+ struct value_accumulator_impl
+ : accumulator_base
+ {
+ typedef ValueType result_type;
+
+ template<typename Args>
+ value_accumulator_impl(Args const &args)
+ : val(args[parameter::keyword<Tag>::get()])
+ {
+ }
+
+ result_type result(dont_care) const
+ {
+ return this->val;
+ }
+
+ private:
+ ValueType val;
+ };
+
+} // namespace impl
+
+namespace tag
+{
+ //////////////////////////////////////////////////////////////////////////
+ // value_tag
+ template<typename Tag>
+ struct value_tag
+ {
+ };
+
+ //////////////////////////////////////////////////////////////////////////
+ // value
+ template<typename ValueType, typename Tag>
+ struct value
+ : depends_on<>
+ {
+ /// INTERNAL ONLY
+ ///
+ typedef mpl::always<accumulators::impl::value_accumulator_impl<ValueType, Tag> > impl;
+ };
+}
+
+namespace extract
+{
+ BOOST_ACCUMULATORS_DEFINE_EXTRACTOR(tag, value, (typename)(typename))
+ BOOST_ACCUMULATORS_DEFINE_EXTRACTOR(tag, value_tag, (typename))
+}
+
+using extract::value;
+using extract::value_tag;
+
+// Map all value<V,T> features to value_tag<T> so
+// that values can be extracted using value_tag<T>
+// without specifying the value type.
+template<typename ValueType, typename Tag>
+struct feature_of<tag::value<ValueType, Tag> >
+ : feature_of<tag::value_tag<Tag> >
+{
+};
+
+}} // namespace boost::accumulators
+
+#endif
=== added file 'boost/boost/accumulators/framework/depends_on.hpp'
--- boost/boost/accumulators/framework/depends_on.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/framework/depends_on.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,411 @@
+///////////////////////////////////////////////////////////////////////////////
+// depends_on.hpp
+//
+// Copyright 2005 Eric Niebler. 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)
+
+#ifndef BOOST_ACCUMULATORS_FRAMEWORK_DEPENDS_ON_HPP_EAN_28_10_2005
+#define BOOST_ACCUMULATORS_FRAMEWORK_DEPENDS_ON_HPP_EAN_28_10_2005
+
+#include <boost/version.hpp>
+#include <boost/mpl/end.hpp>
+#include <boost/mpl/map.hpp>
+#include <boost/mpl/fold.hpp>
+#include <boost/mpl/size.hpp>
+#include <boost/mpl/sort.hpp>
+#include <boost/mpl/insert.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/mpl/remove.hpp>
+#include <boost/mpl/vector.hpp>
+#include <boost/mpl/inherit.hpp>
+#include <boost/mpl/identity.hpp>
+#include <boost/mpl/equal_to.hpp>
+#include <boost/mpl/contains.hpp>
+#include <boost/mpl/transform.hpp>
+#include <boost/mpl/is_sequence.hpp>
+#include <boost/mpl/placeholders.hpp>
+#include <boost/mpl/insert_range.hpp>
+#include <boost/mpl/transform_view.hpp>
+#include <boost/mpl/inherit_linearly.hpp>
+#include <boost/type_traits/is_base_and_derived.hpp>
+#include <boost/preprocessor/repetition/repeat.hpp>
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/facilities/intercept.hpp>
+#include <boost/accumulators/accumulators_fwd.hpp>
+#include <boost/fusion/include/next.hpp>
+#include <boost/fusion/include/equal_to.hpp>
+#include <boost/fusion/include/value_of.hpp>
+#include <boost/fusion/include/mpl.hpp>
+#include <boost/fusion/include/end.hpp>
+#include <boost/fusion/include/begin.hpp>
+#include <boost/fusion/include/cons.hpp>
+
+namespace boost { namespace accumulators
+{
+ ///////////////////////////////////////////////////////////////////////////
+ // as_feature
+ template<typename Feature>
+ struct as_feature
+ {
+ typedef Feature type;
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+ // weighted_feature
+ template<typename Feature>
+ struct as_weighted_feature
+ {
+ typedef Feature type;
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+ // feature_of
+ template<typename Feature>
+ struct feature_of
+ {
+ typedef Feature type;
+ };
+
+ namespace detail
+ {
+ ///////////////////////////////////////////////////////////////////////////
+ // feature_tag
+ template<typename Accumulator>
+ struct feature_tag
+ {
+ typedef typename Accumulator::feature_tag type;
+ };
+
+ template<typename Feature>
+ struct undroppable
+ {
+ typedef Feature type;
+ };
+
+ template<typename Feature>
+ struct undroppable<tag::droppable<Feature> >
+ {
+ typedef Feature type;
+ };
+
+ // For the purpose of determining whether one feature depends on another,
+ // disregard whether the feature is droppable or not.
+ template<typename A, typename B>
+ struct is_dependent_on
+ : is_base_and_derived<
+ typename undroppable<B>::type
+ , typename undroppable<A>::type
+ >
+ {};
+
+ template<typename Features>
+ struct depends_on_base
+ : mpl::inherit_linearly<
+ typename mpl::sort<Features, is_dependent_on<mpl::_1, mpl::_2> >::type
+ // Don't inherit multiply from a feature
+ , mpl::if_<
+ is_dependent_on<mpl::_1, mpl::_2>
+ , mpl::_1
+ , mpl::inherit<mpl::_1, mpl::_2>
+ >
+ >::type
+ {
+ };
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ /// depends_on
+ template<BOOST_PP_ENUM_PARAMS(BOOST_ACCUMULATORS_MAX_FEATURES, typename Feature)>
+ struct depends_on
+ : detail::depends_on_base<
+ typename mpl::transform<
+ mpl::vector<BOOST_PP_ENUM_PARAMS(BOOST_ACCUMULATORS_MAX_FEATURES, Feature)>
+ , as_feature<mpl::_1>
+ >::type
+ >
+ {
+ typedef mpl::false_ is_weight_accumulator;
+ typedef
+ typename mpl::transform<
+ mpl::vector<BOOST_PP_ENUM_PARAMS(BOOST_ACCUMULATORS_MAX_FEATURES, Feature)>
+ , as_feature<mpl::_1>
+ >::type
+ dependencies;
+ };
+
+ namespace detail
+ {
+ template<typename Feature>
+ struct matches_feature
+ {
+ template<typename Accumulator>
+ struct apply
+ : is_same<
+ typename feature_of<typename as_feature<Feature>::type>::type
+ , typename feature_of<typename as_feature<typename feature_tag<Accumulator>::type>::type>::type
+ >
+ {};
+ };
+
+ template<typename Features, typename Accumulator>
+ struct contains_feature_of
+ {
+ typedef
+ mpl::transform_view<Features, feature_of<as_feature<mpl::_> > >
+ features_list;
+
+ typedef
+ typename feature_of<typename feature_tag<Accumulator>::type>::type
+ the_feature;
+
+ typedef
+ typename mpl::contains<features_list, the_feature>::type
+ type;
+ };
+
+ // This is to work around a bug in early versions of Fusion which caused
+ // a compile error if contains_feature_of<List, mpl::_> is used as a
+ // predicate to fusion::find_if
+ template<typename Features>
+ struct contains_feature_of_
+ {
+ template<typename Accumulator>
+ struct apply
+ : contains_feature_of<Features, Accumulator>
+ {};
+ };
+
+ template<
+ typename First
+ , typename Last
+ , bool is_empty = fusion::result_of::equal_to<First, Last>::value
+ >
+ struct build_acc_list;
+
+ template<typename First, typename Last>
+ struct build_acc_list<First, Last, true>
+ {
+ typedef fusion::nil type;
+
+ template<typename Args>
+ static fusion::nil
+ call(Args const &, First const&, Last const&)
+ {
+ return fusion::nil();
+ }
+ };
+
+ template<typename First, typename Last>
+ struct build_acc_list<First, Last, false>
+ {
+ typedef
+ build_acc_list<typename fusion::result_of::next<First>::type, Last>
+ next_build_acc_list;
+
+ typedef fusion::cons<
+ typename fusion::result_of::value_of<First>::type
+ , typename next_build_acc_list::type>
+ type;
+
+ template<typename Args>
+ static type
+ call(Args const &args, First const& f, Last const& l)
+ {
+ return type(args, next_build_acc_list::call(args, fusion::next(f), l));
+ }
+ };
+
+ namespace meta
+ {
+ template<typename Sequence>
+ struct make_acc_list
+ : build_acc_list<
+ typename fusion::result_of::begin<Sequence>::type
+ , typename fusion::result_of::end<Sequence>::type
+ >
+ {};
+ }
+
+ template<typename Sequence, typename Args>
+ typename meta::make_acc_list<Sequence>::type
+ make_acc_list(Sequence const &seq, Args const &args)
+ {
+ return meta::make_acc_list<Sequence>::call(args, fusion::begin(seq), fusion::end(seq));
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // checked_as_weighted_feature
+ template<typename Feature>
+ struct checked_as_weighted_feature
+ {
+ typedef typename as_feature<Feature>::type feature_type;
+ typedef typename as_weighted_feature<feature_type>::type type;
+ // weighted and non-weighted flavors should provide the same feature.
+ BOOST_MPL_ASSERT((
+ is_same<
+ typename feature_of<feature_type>::type
+ , typename feature_of<type>::type
+ >
+ ));
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+ // as_feature_list
+ template<typename Features, typename Weight>
+ struct as_feature_list
+ : mpl::transform_view<Features, checked_as_weighted_feature<mpl::_1> >
+ {
+ };
+
+ template<typename Features>
+ struct as_feature_list<Features, void>
+ : mpl::transform_view<Features, as_feature<mpl::_1> >
+ {
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+ // accumulator_wrapper
+ template<typename Accumulator, typename Feature>
+ struct accumulator_wrapper
+ : Accumulator
+ {
+ typedef Feature feature_tag;
+
+ accumulator_wrapper(accumulator_wrapper const &that)
+ : Accumulator(*static_cast<Accumulator const *>(&that))
+ {
+ }
+
+ template<typename Args>
+ accumulator_wrapper(Args const &args)
+ : Accumulator(args)
+ {
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+ // to_accumulator
+ template<typename Feature, typename Sample, typename Weight>
+ struct to_accumulator
+ {
+ typedef
+ accumulator_wrapper<
+ typename mpl::apply2<typename Feature::impl, Sample, Weight>::type
+ , Feature
+ >
+ type;
+ };
+
+ template<typename Feature, typename Sample, typename Weight, typename Tag, typename AccumulatorSet>
+ struct to_accumulator<Feature, Sample, tag::external<Weight, Tag, AccumulatorSet> >
+ {
+ BOOST_MPL_ASSERT((is_same<Tag, void>));
+ BOOST_MPL_ASSERT((is_same<AccumulatorSet, void>));
+
+ typedef
+ accumulator_wrapper<
+ typename mpl::apply2<typename Feature::impl, Sample, Weight>::type
+ , Feature
+ >
+ accumulator_type;
+
+ typedef
+ typename mpl::if_<
+ typename Feature::is_weight_accumulator
+ , accumulator_wrapper<impl::external_impl<accumulator_type, tag::weights>, Feature>
+ , accumulator_type
+ >::type
+ type;
+ };
+
+ // BUGBUG work around a MPL bug wrt map insertion
+ template<typename FeatureMap, typename Feature>
+ struct insert_feature
+ : mpl::eval_if<
+ mpl::has_key<FeatureMap, typename feature_of<Feature>::type>
+ , mpl::identity<FeatureMap>
+ , mpl::insert<FeatureMap, mpl::pair<typename feature_of<Feature>::type, Feature> >
+ >
+ {
+ };
+
+ template<typename FeatureMap, typename Feature, typename Weight>
+ struct insert_dependencies
+ : mpl::fold<
+ as_feature_list<typename Feature::dependencies, Weight>
+ , FeatureMap
+ , insert_dependencies<
+ insert_feature<mpl::_1, mpl::_2>
+ , mpl::_2
+ , Weight
+ >
+ >
+ {
+ };
+
+ template<typename FeatureMap, typename Features, typename Weight>
+ struct insert_sequence
+ : mpl::fold< // BUGBUG should use insert_range, but doesn't seem to work for maps
+ as_feature_list<Features, Weight>
+ , FeatureMap
+ , insert_feature<mpl::_1, mpl::_2>
+ >
+ {
+ };
+
+ template<typename Features, typename Sample, typename Weight>
+ struct make_accumulator_tuple
+ {
+ typedef
+ typename mpl::fold<
+ as_feature_list<Features, Weight>
+ , mpl::map0<>
+ , mpl::if_<
+ mpl::is_sequence<mpl::_2>
+ , insert_sequence<mpl::_1, mpl::_2, Weight>
+ , insert_feature<mpl::_1, mpl::_2>
+ >
+ >::type
+ feature_map;
+
+ // for each element in the map, add its dependencies also
+ typedef
+ typename mpl::fold<
+ feature_map
+ , feature_map
+ , insert_dependencies<mpl::_1, mpl::second<mpl::_2>, Weight>
+ >::type
+ feature_map_with_dependencies;
+
+ // turn the map into a vector so we can sort it
+ typedef
+ typename mpl::insert_range<
+ mpl::vector<>
+ , mpl::end<mpl::vector<> >::type
+ , mpl::transform_view<feature_map_with_dependencies, mpl::second<mpl::_1> >
+ >::type
+ feature_vector_with_dependencies;
+
+ // sort the features according to which is derived from which
+ typedef
+ typename mpl::sort<
+ feature_vector_with_dependencies
+ , is_dependent_on<mpl::_2, mpl::_1>
+ >::type
+ sorted_feature_vector;
+
+ // From the vector of features, construct a vector of accumulators
+ typedef
+ typename mpl::transform<
+ sorted_feature_vector
+ , to_accumulator<mpl::_1, Sample, Weight>
+ >::type
+ type;
+ };
+
+ } // namespace detail
+
+}} // namespace boost::accumulators
+
+#endif
=== added file 'boost/boost/accumulators/framework/external.hpp'
--- boost/boost/accumulators/framework/external.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/framework/external.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,27 @@
+///////////////////////////////////////////////////////////////////////////////
+// external.hpp
+//
+// Copyright 2005 Eric Niebler. 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)
+
+#ifndef BOOST_ACCUMULATORS_FRAMEWORK_EXTERNAL_HPP_EAN_01_12_2005
+#define BOOST_ACCUMULATORS_FRAMEWORK_EXTERNAL_HPP_EAN_01_12_2005
+
+#include <boost/mpl/apply.hpp>
+#include <boost/accumulators/framework/accumulators/external_accumulator.hpp>
+
+//namespace boost { namespace accumulators
+//{
+//
+/////////////////////////////////////////////////////////////////////////////////
+//// external
+////
+//template<typename Type>
+//struct external
+//{
+//};
+//
+//}} // namespace boost::accumulators
+
+#endif
=== added file 'boost/boost/accumulators/framework/extractor.hpp'
--- boost/boost/accumulators/framework/extractor.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/framework/extractor.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,229 @@
+///////////////////////////////////////////////////////////////////////////////
+// extractor.hpp
+//
+// Copyright 2005 Eric Niebler. 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)
+
+#ifndef BOOST_ACCUMULATORS_FRAMEWORK_EXTRACTOR_HPP_EAN_28_10_2005
+#define BOOST_ACCUMULATORS_FRAMEWORK_EXTRACTOR_HPP_EAN_28_10_2005
+
+#include <boost/preprocessor/tuple/rem.hpp>
+#include <boost/preprocessor/array/size.hpp>
+#include <boost/preprocessor/array/data.hpp>
+#include <boost/preprocessor/array/elem.hpp>
+#include <boost/preprocessor/seq/to_array.hpp>
+#include <boost/preprocessor/seq/transform.hpp>
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/repetition/enum_trailing_params.hpp>
+#include <boost/preprocessor/repetition/enum_trailing_binary_params.hpp>
+#include <boost/parameter/binding.hpp>
+#include <boost/mpl/apply.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/type_traits/remove_reference.hpp>
+#include <boost/accumulators/accumulators_fwd.hpp>
+#include <boost/accumulators/framework/parameters/accumulator.hpp>
+
+namespace boost { namespace accumulators
+{
+
+namespace detail
+{
+ template<typename AccumulatorSet, typename Feature>
+ struct accumulator_set_result
+ {
+ typedef typename as_feature<Feature>::type feature_type;
+ typedef typename mpl::apply<AccumulatorSet, feature_type>::type::result_type type;
+ };
+
+ template<typename Args, typename Feature>
+ struct argument_pack_result
+ : accumulator_set_result<
+ typename remove_reference<
+ typename parameter::binding<Args, tag::accumulator>::type
+ >::type
+ , Feature
+ >
+ {
+ };
+
+ template<typename A, typename Feature>
+ struct extractor_result
+ : mpl::eval_if<
+ detail::is_accumulator_set<A>
+ , accumulator_set_result<A, Feature>
+ , argument_pack_result<A, Feature>
+ >
+ {
+ };
+
+ template<typename Feature, typename AccumulatorSet>
+ typename extractor_result<AccumulatorSet, Feature>::type
+ do_extract(AccumulatorSet const &acc, mpl::true_)
+ {
+ typedef typename as_feature<Feature>::type feature_type;
+ return extract_result<feature_type>(acc);
+ }
+
+ template<typename Feature, typename Args>
+ typename extractor_result<Args, Feature>::type
+ do_extract(Args const &args, mpl::false_)
+ {
+ typedef typename as_feature<Feature>::type feature_type;
+ return find_accumulator<feature_type>(args[accumulator]).result(args);
+ }
+
+} // namespace detail
+
+
+///////////////////////////////////////////////////////////////////////////////
+/// Extracts the result associated with Feature from the specified accumulator_set.
+template<typename Feature>
+struct extractor
+{
+ typedef extractor<Feature> this_type;
+
+ /// The result meta-function for determining the return type of the extractor
+ template<typename F>
+ struct result;
+
+ template<typename A1>
+ struct result<this_type(A1)>
+ : detail::extractor_result<A1, Feature>
+ {
+ };
+
+ /// Extract the result associated with Feature from the accumulator set
+ /// \param acc The accumulator set object from which to extract the result
+ template<typename Arg1>
+ typename detail::extractor_result<Arg1, Feature>::type
+ operator ()(Arg1 const &arg1) const
+ {
+ // Arg1 could be an accumulator_set or an argument pack containing
+ // an accumulator_set. Dispatch accordingly.
+ return detail::do_extract<Feature>(arg1, detail::is_accumulator_set<Arg1>());
+ }
+
+ /// \overload
+ ///
+ /// \param a1 Optional named parameter to be passed to the accumulator's result() function.
+ template<typename AccumulatorSet, typename A1>
+ typename detail::extractor_result<AccumulatorSet, Feature>::type
+ operator ()(AccumulatorSet const &acc, A1 const &a1) const
+ {
+ BOOST_MPL_ASSERT((detail::is_accumulator_set<AccumulatorSet>));
+ typedef typename as_feature<Feature>::type feature_type;
+ return extract_result<feature_type>(acc, a1);
+ }
+
+ // ... other overloads generated by Boost.Preprocessor:
+
+ /// INTERNAL ONLY
+ ///
+#define BOOST_ACCUMULATORS_EXTRACTOR_FUN_OP(z, n, _) \
+ template<BOOST_PP_ENUM_PARAMS_Z(z, n, typename A)> \
+ struct result<this_type(BOOST_PP_ENUM_PARAMS_Z(z, n, A))> \
+ : detail::extractor_result<A1, Feature> \
+ {}; \
+ template< \
+ typename AccumulatorSet \
+ BOOST_PP_ENUM_TRAILING_PARAMS_Z(z, n, typename A) \
+ > \
+ typename detail::extractor_result<AccumulatorSet, Feature>::type \
+ operator ()( \
+ AccumulatorSet const &acc \
+ BOOST_PP_ENUM_TRAILING_BINARY_PARAMS_Z(z, n, A, const &a) \
+ ) const \
+ { \
+ BOOST_MPL_ASSERT((detail::is_accumulator_set<AccumulatorSet>)); \
+ typedef typename as_feature<Feature>::type feature_type; \
+ return extract_result<feature_type>(acc BOOST_PP_ENUM_TRAILING_PARAMS_Z(z, n, a));\
+ }
+
+ BOOST_PP_REPEAT_FROM_TO(
+ 2
+ , BOOST_PP_INC(BOOST_ACCUMULATORS_MAX_ARGS)
+ , BOOST_ACCUMULATORS_EXTRACTOR_FUN_OP
+ , _
+ )
+
+ #ifdef BOOST_ACCUMULATORS_DOXYGEN_INVOKED
+ /// \overload
+ ///
+ template<typename AccumulatorSet, typename A1, typename A2, ...>
+ typename detail::extractor_result<AccumulatorSet, Feature>::type
+ operator ()(AccumulatorSet const &acc, A1 const &a1, A2 const &a2, ...);
+ #endif
+};
+
+/// INTERNAL ONLY
+///
+#define BOOST_ACCUMULATORS_ARRAY_REM(Array) \
+ BOOST_PP_TUPLE_REM_CTOR(BOOST_PP_ARRAY_SIZE(Array), BOOST_PP_ARRAY_DATA(Array))
+
+/// INTERNAL ONLY
+///
+#define BOOST_ACCUMULATORS_SEQ_REM(Seq) \
+ BOOST_ACCUMULATORS_ARRAY_REM(BOOST_PP_SEQ_TO_ARRAY(Seq))
+
+/// INTERNAL ONLY
+///
+#define BOOST_ACCUMULATORS_ARGS_OP(s, data, elem) \
+ T ## s
+
+/// INTERNAL ONLY
+///
+#define BOOST_ACCUMULATORS_PARAMS_OP(s, data, elem) \
+ elem T ## s
+
+/// INTERNAL ONLY
+///
+#define BOOST_ACCUMULATORS_MAKE_FEATURE(Tag, Feature, ParamsSeq) \
+ Tag::Feature< \
+ BOOST_ACCUMULATORS_SEQ_REM( \
+ BOOST_PP_SEQ_TRANSFORM(BOOST_ACCUMULATORS_ARGS_OP, ~, ParamsSeq) \
+ ) \
+ >
+
+/// INTERNAL ONLY
+///
+#define BOOST_ACCUMULATORS_DEFINE_EXTRACTOR_FUN_IMPL(z, n, Tag, Feature, ParamsSeq) \
+ template< \
+ BOOST_ACCUMULATORS_SEQ_REM( \
+ BOOST_PP_SEQ_TRANSFORM(BOOST_ACCUMULATORS_PARAMS_OP, ~, ParamsSeq) \
+ ) \
+ , typename Arg1 \
+ BOOST_PP_ENUM_TRAILING_PARAMS_Z(z, n, typename A) \
+ > \
+ typename boost::accumulators::detail::extractor_result< \
+ Arg1 \
+ , BOOST_ACCUMULATORS_MAKE_FEATURE(Tag, Feature, ParamsSeq) \
+ >::type \
+ Feature(Arg1 const &arg1 BOOST_PP_ENUM_TRAILING_BINARY_PARAMS_Z(z, n, A, const &a) ) \
+ { \
+ typedef BOOST_ACCUMULATORS_MAKE_FEATURE(Tag, Feature, ParamsSeq) feature_type; \
+ return boost::accumulators::extractor<feature_type>()( \
+ arg1 BOOST_PP_ENUM_TRAILING_PARAMS_Z(z, n, a)); \
+ }
+
+/// INTERNAL ONLY
+///
+#define BOOST_ACCUMULATORS_DEFINE_EXTRACTOR_FUN(z, n, _) \
+ BOOST_ACCUMULATORS_DEFINE_EXTRACTOR_FUN_IMPL( \
+ z \
+ , n \
+ , BOOST_PP_ARRAY_ELEM(0, _) \
+ , BOOST_PP_ARRAY_ELEM(1, _) \
+ , BOOST_PP_ARRAY_ELEM(2, _) \
+ )
+
+#define BOOST_ACCUMULATORS_DEFINE_EXTRACTOR(Tag, Feature, ParamSeq) \
+ BOOST_PP_REPEAT( \
+ BOOST_PP_INC(BOOST_ACCUMULATORS_MAX_ARGS) \
+ , BOOST_ACCUMULATORS_DEFINE_EXTRACTOR_FUN \
+ , (3, (Tag, Feature, ParamSeq)) \
+ )
+
+}} // namespace boost::accumulators
+
+#endif
=== added file 'boost/boost/accumulators/framework/features.hpp'
--- boost/boost/accumulators/framework/features.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/framework/features.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,29 @@
+///////////////////////////////////////////////////////////////////////////////
+// features.hpp
+//
+// Copyright 2005 Eric Niebler. 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)
+
+#ifndef BOOST_ACCUMULATORS_STATISTICS_STATS_HPP_EAN_08_12_2005
+#define BOOST_ACCUMULATORS_STATISTICS_STATS_HPP_EAN_08_12_2005
+
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/mpl/vector.hpp>
+#include <boost/accumulators/accumulators_fwd.hpp>
+
+namespace boost { namespace accumulators
+{
+
+///////////////////////////////////////////////////////////////////////////////
+// features
+//
+template<BOOST_PP_ENUM_PARAMS(BOOST_ACCUMULATORS_MAX_FEATURES, typename Feature)>
+struct features
+ : mpl::vector<BOOST_PP_ENUM_PARAMS(BOOST_ACCUMULATORS_MAX_FEATURES, Feature)>
+{
+};
+
+}} // namespace boost::accumulators
+
+#endif
=== added directory 'boost/boost/accumulators/framework/parameters'
=== added file 'boost/boost/accumulators/framework/parameters/accumulator.hpp'
--- boost/boost/accumulators/framework/parameters/accumulator.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/framework/parameters/accumulator.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// accumulator.hpp
+//
+// Copyright 2005 Eric Niebler. 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)
+
+#ifndef BOOST_ACCUMULATORS_FRAMEWORK_PARAMETERS_ACCUMULATOR_HPP_EAN_31_10_2005
+#define BOOST_ACCUMULATORS_FRAMEWORK_PARAMETERS_ACCUMULATOR_HPP_EAN_31_10_2005
+
+#include <boost/parameter/keyword.hpp>
+
+namespace boost { namespace accumulators
+{
+
+BOOST_PARAMETER_KEYWORD(tag, accumulator)
+
+}} // namespace boost::accumulators
+
+#endif
=== added file 'boost/boost/accumulators/framework/parameters/sample.hpp'
--- boost/boost/accumulators/framework/parameters/sample.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/framework/parameters/sample.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// sample.hpp
+//
+// Copyright 2005 Eric Niebler. 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)
+
+#ifndef BOOST_ACCUMULATORS_FRAMEWORK_PARAMETERS_SAMPLE_HPP_EAN_31_10_2005
+#define BOOST_ACCUMULATORS_FRAMEWORK_PARAMETERS_SAMPLE_HPP_EAN_31_10_2005
+
+#include <boost/parameter/keyword.hpp>
+
+namespace boost { namespace accumulators
+{
+
+BOOST_PARAMETER_KEYWORD(tag, sample)
+
+}} // namespace boost::accumulators
+
+#endif
=== added file 'boost/boost/accumulators/framework/parameters/weight.hpp'
--- boost/boost/accumulators/framework/parameters/weight.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/framework/parameters/weight.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,21 @@
+///////////////////////////////////////////////////////////////////////////////
+// weight.hpp
+//
+// Copyright 2005 Eric Niebler. 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)
+
+#ifndef BOOST_ACCUMULATORS_FRAMEWORK_PARAMETERS_WEIGHT_HPP_EAN_31_10_2005
+#define BOOST_ACCUMULATORS_FRAMEWORK_PARAMETERS_WEIGHT_HPP_EAN_31_10_2005
+
+#include <boost/parameter/keyword.hpp>
+
+namespace boost { namespace accumulators
+{
+
+// The weight of a single sample
+BOOST_PARAMETER_KEYWORD(tag, weight)
+
+}} // namespace boost::accumulators
+
+#endif
=== added file 'boost/boost/accumulators/framework/parameters/weights.hpp'
--- boost/boost/accumulators/framework/parameters/weights.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/framework/parameters/weights.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,21 @@
+///////////////////////////////////////////////////////////////////////////////
+// weights.hpp
+//
+// Copyright 2005 Eric Niebler. 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)
+
+#ifndef BOOST_ACCUMULATORS_FRAMEWORK_PARAMETERS_WEIGHTS_HPP_EAN_28_10_2005
+#define BOOST_ACCUMULATORS_FRAMEWORK_PARAMETERS_WEIGHTS_HPP_EAN_28_10_2005
+
+#include <boost/parameter/keyword.hpp>
+
+namespace boost { namespace accumulators
+{
+
+// The weight accumulator
+BOOST_PARAMETER_KEYWORD(tag, weights)
+
+}} // namespace boost::accumulators
+
+#endif
=== added directory 'boost/boost/accumulators/numeric'
=== added directory 'boost/boost/accumulators/numeric/detail'
=== added file 'boost/boost/accumulators/numeric/detail/function1.hpp'
--- boost/boost/accumulators/numeric/detail/function1.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/numeric/detail/function1.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,75 @@
+// Copyright David Abrahams 2006. 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)
+#ifndef BOOST_DETAIL_FUNCTION1_DWA200655_HPP
+# define BOOST_DETAIL_FUNCTION1_DWA200655_HPP
+
+# include <boost/concept_check.hpp>
+# include <boost/type_traits/remove_reference.hpp>
+# include <boost/type_traits/add_const.hpp>
+# include <boost/mpl/apply.hpp>
+
+namespace boost { namespace detail {
+
+// A utility for creating unary function objects that play nicely with
+// boost::result_of and that handle the forwarding problem.
+//
+// mpl::apply<F, A0>::type is expected to be a stateless function
+// object that accepts an argument of type A0&. It is also expected
+// to have a nested ::result_type identical to its return type.
+template<typename F>
+struct function1
+{
+ template<typename Signature>
+ struct result
+ {};
+
+ template<typename This, typename A0>
+ struct result<This(A0)>
+ {
+ // How adding const to arguments handles rvalues.
+ //
+ // if A0 is arg0 is represents actual argument
+ // -------- ------- --------------------------
+ // T const & T const const T lvalue
+ // T & T non-const T lvalue
+ // T const T const const T rvalue
+ // T T const non-const T rvalue
+ typedef typename remove_reference<
+ typename add_const< A0 >::type
+ >::type arg0;
+
+ typedef typename mpl::apply1<F, arg0>::type impl;
+ typedef typename impl::result_type type;
+ };
+
+ // Handles mutable lvalues
+ template<typename A0>
+ typename result<function1(A0 &)>::type
+ operator ()(A0 &a0) const
+ {
+ typedef typename result<function1(A0 &)>::impl impl;
+ typedef typename result<function1(A0 &)>::type type;
+ typedef A0 &arg0;
+ BOOST_CONCEPT_ASSERT((UnaryFunction<impl, type, arg0>));
+ //boost::function_requires<UnaryFunctionConcept<impl, type, arg0> >();
+ return impl()(a0);
+ }
+
+ // Handles const lvalues and all rvalues
+ template<typename A0>
+ typename result<function1(A0 const &)>::type
+ operator ()(A0 const &a0) const
+ {
+ typedef typename result<function1(A0 const &)>::impl impl;
+ typedef typename result<function1(A0 const &)>::type type;
+ typedef A0 const &arg0;
+ BOOST_CONCEPT_ASSERT((UnaryFunction<impl, type, arg0>));
+ //boost::function_requires<UnaryFunctionConcept<impl, type, arg0> >();
+ return impl()(a0);
+ }
+};
+
+}} // namespace boost::detail
+
+#endif // BOOST_DETAIL_FUNCTION1_DWA200655_HPP
=== added file 'boost/boost/accumulators/numeric/detail/function2.hpp'
--- boost/boost/accumulators/numeric/detail/function2.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/numeric/detail/function2.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,10 @@
+// Copyright David Abrahams 2006. 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)
+#ifndef BOOST_DETAIL_FUNCTION2_DWA200655_HPP
+# define BOOST_DETAIL_FUNCTION2_DWA200655_HPP
+
+# define args (2)
+# include <boost/accumulators/numeric/detail/function_n.hpp>
+
+#endif // BOOST_DETAIL_FUNCTION2_DWA200655_HPP
=== added file 'boost/boost/accumulators/numeric/detail/function3.hpp'
--- boost/boost/accumulators/numeric/detail/function3.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/numeric/detail/function3.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,10 @@
+// Copyright David Abrahams 2006. 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)
+#ifndef BOOST_DETAIL_FUNCTION3_DWA2006514_HPP
+# define BOOST_DETAIL_FUNCTION3_DWA2006514_HPP
+
+# define args (3)
+# include <boost/accumulators/numeric/detail/function_n.hpp>
+
+#endif // BOOST_DETAIL_FUNCTION3_DWA2006514_HPP
=== added file 'boost/boost/accumulators/numeric/detail/function4.hpp'
--- boost/boost/accumulators/numeric/detail/function4.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/numeric/detail/function4.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,10 @@
+// Copyright David Abrahams 2006. 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)
+#ifndef BOOST_DETAIL_FUNCTION4_DWA2006514_HPP
+# define BOOST_DETAIL_FUNCTION4_DWA2006514_HPP
+
+# define args (4)
+# include <boost/accumulators/numeric/detail/function_n.hpp>
+
+#endif // BOOST_DETAIL_FUNCTION4_DWA2006514_HPP
=== added file 'boost/boost/accumulators/numeric/detail/function_n.hpp'
--- boost/boost/accumulators/numeric/detail/function_n.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/numeric/detail/function_n.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,148 @@
+// Copyright David Abrahams 2006. 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)
+//
+// #include guards intentionally disabled.
+// #ifndef BOOST_DETAIL_FUNCTION_N_DWA2006514_HPP
+// # define BOOST_DETAIL_FUNCTION_N_DWA2006514_HPP
+
+#include <boost/mpl/void.hpp>
+#include <boost/mpl/apply.hpp>
+
+#include <boost/preprocessor/control/if.hpp>
+#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/punctuation/comma_if.hpp>
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/repetition/enum_trailing_params.hpp>
+#include <boost/preprocessor/repetition/repeat.hpp>
+#include <boost/preprocessor/seq/fold_left.hpp>
+#include <boost/preprocessor/seq/seq.hpp>
+#include <boost/preprocessor/seq/for_each.hpp>
+#include <boost/preprocessor/seq/for_each_i.hpp>
+#include <boost/preprocessor/seq/for_each_product.hpp>
+#include <boost/preprocessor/seq/size.hpp>
+#include <boost/type_traits/add_const.hpp>
+#include <boost/type_traits/remove_reference.hpp>
+
+namespace boost { namespace detail {
+
+# define BOOST_DETAIL_default_arg(z, n, _) \
+ typedef mpl::void_ BOOST_PP_CAT(arg, n);
+
+# define BOOST_DETAIL_function_arg(z, n, _) \
+ typedef typename remove_reference< \
+ typename add_const< BOOST_PP_CAT(A, n) >::type \
+ >::type BOOST_PP_CAT(arg, n);
+
+#define BOOST_DETAIL_cat_arg_counts(s, state, n) \
+ BOOST_PP_IF( \
+ n \
+ , BOOST_PP_CAT(state, BOOST_PP_CAT(_, n)) \
+ , state \
+ ) \
+ /**/
+
+#define function_name \
+ BOOST_PP_SEQ_FOLD_LEFT( \
+ BOOST_DETAIL_cat_arg_counts \
+ , BOOST_PP_CAT(function, BOOST_PP_SEQ_HEAD(args)) \
+ , BOOST_PP_SEQ_TAIL(args)(0) \
+ ) \
+ /**/
+
+template<typename F>
+struct function_name
+{
+ BOOST_PP_REPEAT(
+ BOOST_MPL_LIMIT_METAFUNCTION_ARITY
+ , BOOST_DETAIL_default_arg
+ , ~
+ )
+
+ template<typename Signature>
+ struct result {};
+
+#define BOOST_DETAIL_function_result(r, _, n) \
+ template<typename This BOOST_PP_ENUM_TRAILING_PARAMS(n, typename A)> \
+ struct result<This(BOOST_PP_ENUM_PARAMS(n, A))> \
+ { \
+ BOOST_PP_REPEAT(n, BOOST_DETAIL_function_arg, ~) \
+ typedef \
+ typename BOOST_PP_CAT(mpl::apply, BOOST_MPL_LIMIT_METAFUNCTION_ARITY)<\
+ F \
+ BOOST_PP_ENUM_TRAILING_PARAMS( \
+ BOOST_MPL_LIMIT_METAFUNCTION_ARITY \
+ , arg \
+ ) \
+ >::type \
+ impl; \
+ typedef typename impl::result_type type; \
+ }; \
+ /**/
+
+ BOOST_PP_SEQ_FOR_EACH(BOOST_DETAIL_function_result, _, args)
+
+# define arg_type(r, _, i, is_const) \
+ BOOST_PP_COMMA_IF(i) BOOST_PP_CAT(A, i) BOOST_PP_CAT(const_if, is_const) &
+
+# define result_(r, n, constness) \
+ typename result< \
+ function_name( \
+ BOOST_PP_SEQ_FOR_EACH_I_R(r, arg_type, ~, constness) \
+ ) \
+ > \
+ /**/
+
+# define param(r, _, i, is_const) BOOST_PP_COMMA_IF(i) \
+ BOOST_PP_CAT(A, i) BOOST_PP_CAT(const_if, is_const) & BOOST_PP_CAT(x, i)
+
+# define param_list(r, n, constness) \
+ BOOST_PP_SEQ_FOR_EACH_I_R(r, param, ~, constness)
+
+# define call_operator(r, constness) \
+ template<BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(constness), typename A)> \
+ result_(r, BOOST_PP_SEQ_SIZE(constness), constness)::type \
+ operator ()( param_list(r, BOOST_PP_SEQ_SIZE(constness), constness) ) const \
+ { \
+ typedef result_(r, BOOST_PP_SEQ_SIZE(constness), constness)::impl impl; \
+ return impl()(BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(constness), x)); \
+ } \
+ /**/
+
+# define const_if0
+# define const_if1 const
+
+# define bits(z, n, _) ((0)(1))
+
+# define gen_operator(r, _, n) \
+ BOOST_PP_SEQ_FOR_EACH_PRODUCT_R( \
+ r \
+ , call_operator \
+ , BOOST_PP_REPEAT(n, bits, ~) \
+ ) \
+ /**/
+
+ BOOST_PP_SEQ_FOR_EACH(
+ gen_operator
+ , ~
+ , args
+ )
+
+# undef bits
+# undef const_if1
+# undef const_if0
+# undef call_operator
+# undef param_list
+# undef param
+# undef result_
+# undef default_
+# undef arg_type
+# undef gen_operator
+# undef function_name
+
+# undef args
+};
+
+}} // namespace boost::detail
+
+//#endif // BOOST_DETAIL_FUNCTION_N_DWA2006514_HPP
=== added file 'boost/boost/accumulators/numeric/detail/pod_singleton.hpp'
--- boost/boost/accumulators/numeric/detail/pod_singleton.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/numeric/detail/pod_singleton.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,20 @@
+// Copyright David Abrahams 2006. 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)
+#ifndef BOOST_DETAIL_POD_SINGLETON_DWA200655_HPP
+# define BOOST_DETAIL_POD_SINGLETON_DWA200655_HPP
+
+namespace boost { namespace detail {
+
+template<typename T>
+struct pod_singleton
+{
+ static T instance;
+};
+
+template<typename T>
+T pod_singleton<T>::instance;
+
+}} // namespace boost::detail
+
+#endif // BOOST_DETAIL_POD_SINGLETON_DWA200655_HPP
=== added directory 'boost/boost/accumulators/numeric/functional'
=== added file 'boost/boost/accumulators/numeric/functional.hpp'
--- boost/boost/accumulators/numeric/functional.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/numeric/functional.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,497 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file functional.hpp
+///
+// Copyright 2005 Eric Niebler. 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)
+
+#ifndef BOOST_NUMERIC_FUNCTIONAL_HPP_EAN_08_12_2005
+#define BOOST_NUMERIC_FUNCTIONAL_HPP_EAN_08_12_2005
+
+#include <limits>
+#include <functional>
+#include <boost/static_assert.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/and.hpp>
+#include <boost/type_traits/remove_const.hpp>
+#include <boost/type_traits/add_reference.hpp>
+#include <boost/type_traits/is_empty.hpp>
+#include <boost/type_traits/is_integral.hpp>
+#include <boost/type_traits/is_floating_point.hpp>
+#include <boost/utility/enable_if.hpp>
+#include <boost/typeof/typeof.hpp>
+#include <boost/accumulators/numeric/functional_fwd.hpp>
+#include <boost/accumulators/numeric/detail/function1.hpp>
+#include <boost/accumulators/numeric/detail/function2.hpp>
+#include <boost/accumulators/numeric/detail/pod_singleton.hpp>
+
+#ifdef BOOST_NUMERIC_FUNCTIONAL_STD_VECTOR_SUPPORT
+# include <boost/accumulators/numeric/functional/vector.hpp>
+#endif
+
+#ifdef BOOST_NUMERIC_FUNCTIONAL_STD_VALARRAY_SUPPORT
+# include <boost/accumulators/numeric/functional/valarray.hpp>
+#endif
+
+#ifdef BOOST_NUMERIC_FUNCTIONAL_STD_COMPLEX_SUPPORT
+# include <boost/accumulators/numeric/functional/complex.hpp>
+#endif
+
+/// INTERNAL ONLY
+///
+#define BOOST_NUMERIC_FUNCTIONAL_HPP_INCLUDED
+
+#ifdef BOOST_NUMERIC_FUNCTIONAL_DOXYGEN_INVOKED
+// Hack to make Doxygen show the inheritance relationships
+/// INTERNAL ONLY
+///
+namespace std
+{
+ /// INTERNAL ONLY
+ ///
+ template<class Arg, class Ret> struct unary_function {};
+ /// INTERNAL ONLY
+ ///
+ template<class Left, class Right, class Ret> struct binary_function {};
+}
+#endif
+
+namespace boost { namespace numeric
+{
+ namespace functional
+ {
+ /// INTERNAL ONLY
+ ///
+ template<typename A0, typename A1>
+ struct are_integral
+ : mpl::and_<is_integral<A0>, is_integral<A1> >
+ {};
+
+ template<typename Left, typename Right>
+ struct left_ref
+ {
+ typedef Left &type;
+ };
+
+ namespace detail
+ {
+ template<typename T>
+ T &lvalue_of();
+ }
+ }
+
+ // TODO: handle complex weight, valarray, MTL vectors
+
+ /// INTERNAL ONLY
+ ///
+#define BOOST_NUMERIC_FUNCTIONAL_DEFINE_UNARY_OP(Name, Op) \
+ namespace functional \
+ { \
+ template<typename Arg> \
+ struct result_of_ ## Name \
+ { \
+ BOOST_TYPEOF_NESTED_TYPEDEF_TPL( \
+ nested \
+ , Op boost::numeric::functional::detail::lvalue_of<Arg>() \
+ ) \
+ typedef typename nested::type type; \
+ }; \
+ template<typename Arg, typename EnableIf> \
+ struct Name ## _base \
+ : std::unary_function< \
+ typename remove_const<Arg>::type \
+ , typename result_of_ ## Name<Arg>::type \
+ > \
+ { \
+ typename result_of_ ## Name<Arg>::type operator ()(Arg &arg) const \
+ { \
+ return Op arg; \
+ } \
+ }; \
+ template<typename Arg, typename ArgTag> \
+ struct Name \
+ : Name ## _base<Arg, void> \
+ {}; \
+ } \
+ namespace op \
+ { \
+ struct Name \
+ : boost::detail::function1<functional::Name<_, functional::tag<_> > > \
+ {}; \
+ } \
+ namespace \
+ { \
+ op::Name const &Name = boost::detail::pod_singleton<op::Name>::instance; \
+ } \
+ /**/
+
+ /// INTERNAL ONLY
+ ///
+#define BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(Name, Op, RetType) \
+ namespace functional \
+ { \
+ template<typename Left, typename Right, typename EnableIf> \
+ struct result_of_ ## Name \
+ { \
+ RetType(Left, Op, Right) \
+ }; \
+ template<typename Left, typename Right, typename EnableIf> \
+ struct Name ## _base \
+ : std::binary_function< \
+ typename remove_const<Left>::type \
+ , typename remove_const<Right>::type \
+ , typename result_of_ ## Name<Left, Right>::type \
+ > \
+ { \
+ typename result_of_ ## Name<Left, Right>::type \
+ operator ()(Left &left, Right &right) const \
+ { \
+ return left Op right; \
+ } \
+ }; \
+ template<typename Left, typename Right, typename LeftTag, typename RightTag> \
+ struct Name \
+ : Name ## _base<Left, Right, void> \
+ {}; \
+ } \
+ namespace op \
+ { \
+ struct Name \
+ : boost::detail::function2< \
+ functional::Name<_1, _2, functional::tag<_1>, functional::tag<_2> > \
+ > \
+ {}; \
+ } \
+ namespace \
+ { \
+ op::Name const &Name = boost::detail::pod_singleton<op::Name>::instance; \
+ } \
+ /**/
+
+ /// INTERNAL ONLY
+ ///
+#define BOOST_NUMERIC_FUNCTIONAL_DEDUCED(Left, Op, Right) \
+ BOOST_TYPEOF_NESTED_TYPEDEF_TPL( \
+ nested \
+ , boost::numeric::functional::detail::lvalue_of<Left>() Op \
+ boost::numeric::functional::detail::lvalue_of<Right>() \
+ ) \
+ typedef typename nested::type type; \
+ /**/
+
+ /// INTERNAL ONLY
+ ///
+#define BOOST_NUMERIC_FUNCTIONAL_LEFT(Left, Op, Right) \
+ typedef Left &type; \
+ /**/
+
+ BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(plus, +, BOOST_NUMERIC_FUNCTIONAL_DEDUCED)
+ BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(minus, -, BOOST_NUMERIC_FUNCTIONAL_DEDUCED)
+ BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(multiplies, *, BOOST_NUMERIC_FUNCTIONAL_DEDUCED)
+ BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(divides, /, BOOST_NUMERIC_FUNCTIONAL_DEDUCED)
+ BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(modulus, %, BOOST_NUMERIC_FUNCTIONAL_DEDUCED)
+ BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(greater, >, BOOST_NUMERIC_FUNCTIONAL_DEDUCED)
+ BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(greater_equal, >=, BOOST_NUMERIC_FUNCTIONAL_DEDUCED)
+ BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(less, <, BOOST_NUMERIC_FUNCTIONAL_DEDUCED)
+ BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(less_equal, <=, BOOST_NUMERIC_FUNCTIONAL_DEDUCED)
+ BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(equal_to, ==, BOOST_NUMERIC_FUNCTIONAL_DEDUCED)
+ BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(not_equal_to, !=, BOOST_NUMERIC_FUNCTIONAL_DEDUCED)
+
+ BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(assign, =, BOOST_NUMERIC_FUNCTIONAL_LEFT)
+ BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(plus_assign, +=, BOOST_NUMERIC_FUNCTIONAL_LEFT)
+ BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(minus_assign, -=, BOOST_NUMERIC_FUNCTIONAL_LEFT)
+ BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(multiplies_assign, *=, BOOST_NUMERIC_FUNCTIONAL_LEFT)
+ BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(divides_assign, /=, BOOST_NUMERIC_FUNCTIONAL_LEFT)
+ BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(modulus_assign, %=, BOOST_NUMERIC_FUNCTIONAL_LEFT)
+
+ BOOST_NUMERIC_FUNCTIONAL_DEFINE_UNARY_OP(unary_plus, +)
+ BOOST_NUMERIC_FUNCTIONAL_DEFINE_UNARY_OP(unary_minus, -)
+ BOOST_NUMERIC_FUNCTIONAL_DEFINE_UNARY_OP(complement, ~)
+ BOOST_NUMERIC_FUNCTIONAL_DEFINE_UNARY_OP(logical_not, !)
+
+#undef BOOST_NUMERIC_FUNCTIONAL_LEFT
+#undef BOOST_NUMERIC_FUNCTIONAL_DEDUCED
+#undef BOOST_NUMERIC_FUNCTIONAL_DEFINE_UNARY_OP
+#undef BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP
+
+ namespace functional
+ {
+ template<typename Left, typename Right, typename EnableIf>
+ struct min_assign_base
+ : std::binary_function<Left, Right, void>
+ {
+ void operator ()(Left &left, Right &right) const
+ {
+ if(numeric::less(right, left))
+ {
+ left = right;
+ }
+ }
+ };
+
+ template<typename Left, typename Right, typename EnableIf>
+ struct max_assign_base
+ : std::binary_function<Left, Right, void>
+ {
+ void operator ()(Left &left, Right &right) const
+ {
+ if(numeric::greater(right, left))
+ {
+ left = right;
+ }
+ }
+ };
+
+ template<typename Left, typename Right, typename EnableIf>
+ struct average_base
+ : functional::divides<Left, Right>
+ {};
+
+ // partial specialization that promotes the arguments to double for
+ // integral division.
+ template<typename Left, typename Right>
+ struct average_base<Left, Right, typename enable_if<are_integral<Left, Right> >::type>
+ : functional::divides<double const, double const>
+ {};
+
+ template<typename To, typename From, typename EnableIf>
+ struct promote_base
+ : std::unary_function<From, To>
+ {
+ To operator ()(From &from) const
+ {
+ return from;
+ }
+ };
+
+ template<typename ToFrom>
+ struct promote_base<ToFrom, ToFrom, void>
+ : std::unary_function<ToFrom, ToFrom>
+ {
+ ToFrom &operator ()(ToFrom &tofrom)
+ {
+ return tofrom;
+ }
+ };
+
+ template<typename Arg, typename EnableIf>
+ struct as_min_base
+ : std::unary_function<Arg, typename remove_const<Arg>::type>
+ {
+ BOOST_STATIC_ASSERT(std::numeric_limits<typename remove_const<Arg>::type>::is_specialized);
+
+ typename remove_const<Arg>::type operator ()(Arg &) const
+ {
+ return (std::numeric_limits<typename remove_const<Arg>::type>::min)();
+ }
+ };
+
+ template<typename Arg>
+ struct as_min_base<Arg, typename enable_if<is_floating_point<Arg> >::type>
+ : std::unary_function<Arg, typename remove_const<Arg>::type>
+ {
+ BOOST_STATIC_ASSERT(std::numeric_limits<typename remove_const<Arg>::type>::is_specialized);
+
+ typename remove_const<Arg>::type operator ()(Arg &) const
+ {
+ return -(std::numeric_limits<typename remove_const<Arg>::type>::max)();
+ }
+ };
+
+ template<typename Arg, typename EnableIf>
+ struct as_max_base
+ : std::unary_function<Arg, typename remove_const<Arg>::type>
+ {
+ BOOST_STATIC_ASSERT(std::numeric_limits<typename remove_const<Arg>::type>::is_specialized);
+
+ typename remove_const<Arg>::type operator ()(Arg &) const
+ {
+ return (std::numeric_limits<typename remove_const<Arg>::type>::max)();
+ }
+ };
+
+ template<typename Arg, typename EnableIf>
+ struct as_zero_base
+ : std::unary_function<Arg, typename remove_const<Arg>::type>
+ {
+ typename remove_const<Arg>::type operator ()(Arg &) const
+ {
+ return numeric::zero<typename remove_const<Arg>::type>::value;
+ }
+ };
+
+ template<typename Arg, typename EnableIf>
+ struct as_one_base
+ : std::unary_function<Arg, typename remove_const<Arg>::type>
+ {
+ typename remove_const<Arg>::type operator ()(Arg &) const
+ {
+ return numeric::one<typename remove_const<Arg>::type>::value;
+ }
+ };
+
+ template<typename To, typename From, typename ToTag, typename FromTag>
+ struct promote
+ : promote_base<To, From, void>
+ {};
+
+ template<typename Left, typename Right, typename LeftTag, typename RightTag>
+ struct min_assign
+ : min_assign_base<Left, Right, void>
+ {};
+
+ template<typename Left, typename Right, typename LeftTag, typename RightTag>
+ struct max_assign
+ : max_assign_base<Left, Right, void>
+ {};
+
+ template<typename Left, typename Right, typename LeftTag, typename RightTag>
+ struct average
+ : average_base<Left, Right, void>
+ {};
+
+ template<typename Arg, typename Tag>
+ struct as_min
+ : as_min_base<Arg, void>
+ {};
+
+ template<typename Arg, typename Tag>
+ struct as_max
+ : as_max_base<Arg, void>
+ {};
+
+ template<typename Arg, typename Tag>
+ struct as_zero
+ : as_zero_base<Arg, void>
+ {};
+
+ template<typename Arg, typename Tag>
+ struct as_one
+ : as_one_base<Arg, void>
+ {};
+ }
+
+ namespace op
+ {
+ template<typename To>
+ struct promote
+ : boost::detail::function1<functional::promote<To, _, typename functional::tag<To>::type, functional::tag<_> > >
+ {};
+
+ struct min_assign
+ : boost::detail::function2<functional::min_assign<_1, _2, functional::tag<_1>, functional::tag<_2> > >
+ {};
+
+ struct max_assign
+ : boost::detail::function2<functional::max_assign<_1, _2, functional::tag<_1>, functional::tag<_2> > >
+ {};
+
+ struct average
+ : boost::detail::function2<functional::average<_1, _2, functional::tag<_1>, functional::tag<_2> > >
+ {};
+
+ struct as_min
+ : boost::detail::function1<functional::as_min<_, functional::tag<_> > >
+ {};
+
+ struct as_max
+ : boost::detail::function1<functional::as_max<_, functional::tag<_> > >
+ {};
+
+ struct as_zero
+ : boost::detail::function1<functional::as_zero<_, functional::tag<_> > >
+ {};
+
+ struct as_one
+ : boost::detail::function1<functional::as_one<_, functional::tag<_> > >
+ {};
+ }
+
+ namespace
+ {
+ op::min_assign const &min_assign = boost::detail::pod_singleton<op::min_assign>::instance;
+ op::max_assign const &max_assign = boost::detail::pod_singleton<op::max_assign>::instance;
+ op::average const &average = boost::detail::pod_singleton<op::average>::instance;
+ op::as_min const &as_min = boost::detail::pod_singleton<op::as_min>::instance;
+ op::as_max const &as_max = boost::detail::pod_singleton<op::as_max>::instance;
+ op::as_zero const &as_zero = boost::detail::pod_singleton<op::as_zero>::instance;
+ op::as_one const &as_one = boost::detail::pod_singleton<op::as_one>::instance;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // promote
+ template<typename To, typename From>
+ typename lazy_disable_if<is_const<From>, mpl::if_<is_same<To, From>, To &, To> >::type
+ promote(From &from)
+ {
+ return functional::promote<To, From>()(from);
+ }
+
+ template<typename To, typename From>
+ typename mpl::if_<is_same<To const, From const>, To const &, To const>::type
+ promote(From const &from)
+ {
+ return functional::promote<To const, From const>()(from);
+ }
+
+ template<typename T>
+ struct default_
+ {
+ typedef default_ type;
+ typedef T value_type;
+ static T const value;
+
+ operator T const & () const
+ {
+ return default_::value;
+ }
+ };
+
+ template<typename T>
+ T const default_<T>::value = T();
+
+ template<typename T>
+ struct one
+ {
+ typedef one type;
+ typedef T value_type;
+ static T const value;
+
+ operator T const & () const
+ {
+ return one::value;
+ }
+ };
+
+ template<typename T>
+ T const one<T>::value = T(1);
+
+ template<typename T>
+ struct zero
+ {
+ typedef zero type;
+ typedef T value_type;
+ static T const value;
+
+ operator T const & () const
+ {
+ return zero::value;
+ }
+ };
+
+ template<typename T>
+ T const zero<T>::value = T();
+
+ template<typename T>
+ struct one_or_default
+ : mpl::if_<is_empty<T>, default_<T>, one<T> >::type
+ {};
+
+ template<typename T>
+ struct zero_or_default
+ : mpl::if_<is_empty<T>, default_<T>, zero<T> >::type
+ {};
+
+}} // namespace boost::numeric
+
+#endif
=== added file 'boost/boost/accumulators/numeric/functional/complex.hpp'
--- boost/boost/accumulators/numeric/functional/complex.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/numeric/functional/complex.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,82 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file complex.hpp
+///
+// Copyright 2005 Eric Niebler. 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)
+
+#ifndef BOOST_NUMERIC_FUNCTIONAL_COMPLEX_HPP_EAN_01_17_2006
+#define BOOST_NUMERIC_FUNCTIONAL_COMPLEX_HPP_EAN_01_17_2006
+
+#ifdef BOOST_NUMERIC_FUNCTIONAL_HPP_INCLUDED
+# error Include this file before boost/accumulators/numeric/functional.hpp
+#endif
+
+#include <complex>
+#include <boost/mpl/or.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/utility/enable_if.hpp>
+#include <boost/typeof/std/complex.hpp>
+#include <boost/accumulators/numeric/functional_fwd.hpp>
+
+namespace boost { namespace numeric { namespace operators
+{
+ // So that the stats compile when Sample type is std::complex
+ template<typename T, typename U>
+ typename
+ disable_if<
+ mpl::or_<is_same<T, U>, is_same<std::complex<T>, U> >
+ , std::complex<T>
+ >::type
+ operator *(std::complex<T> ri, U const &u)
+ {
+ // BUGBUG promote result to typeof(T()*u) ?
+ return ri *= static_cast<T>(u);
+ }
+
+ template<typename T, typename U>
+ typename
+ disable_if<
+ mpl::or_<is_same<T, U>, is_same<std::complex<T>, U> >
+ , std::complex<T>
+ >::type
+ operator /(std::complex<T> ri, U const &u)
+ {
+ // BUGBUG promote result to typeof(T()*u) ?
+ return ri /= static_cast<T>(u);
+ }
+
+}}} // namespace boost::numeric::operators
+
+namespace boost { namespace numeric
+{
+ namespace detail
+ {
+ template<typename T>
+ struct one_complex
+ {
+ static std::complex<T> const value;
+ };
+
+ template<typename T>
+ std::complex<T> const one_complex<T>::value
+ = std::complex<T>(numeric::one<T>::value, numeric::one<T>::value);
+ }
+
+ /// INTERNAL ONLY
+ ///
+ template<typename T>
+ struct one<std::complex<T> >
+ : detail::one_complex<T>
+ {
+ typedef one type;
+ typedef std::complex<T> value_type;
+ operator value_type const & () const
+ {
+ return detail::one_complex<T>::value;
+ }
+ };
+
+}} // namespace boost::numeric
+
+#endif
=== added file 'boost/boost/accumulators/numeric/functional/valarray.hpp'
--- boost/boost/accumulators/numeric/functional/valarray.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/numeric/functional/valarray.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,360 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file valarray.hpp
+///
+// Copyright 2005 Eric Niebler. 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)
+
+#ifndef BOOST_NUMERIC_FUNCTIONAL_VALARRAY_HPP_EAN_12_12_2005
+#define BOOST_NUMERIC_FUNCTIONAL_VALARRAY_HPP_EAN_12_12_2005
+
+#ifdef BOOST_NUMERIC_FUNCTIONAL_HPP_INCLUDED
+# error Include this file before boost/accumulators/numeric/functional.hpp
+#endif
+
+#include <valarray>
+#include <functional>
+#include <boost/assert.hpp>
+#include <boost/mpl/and.hpp>
+#include <boost/mpl/not.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/utility/enable_if.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/type_traits/is_scalar.hpp>
+#include <boost/type_traits/remove_const.hpp>
+#include <boost/typeof/std/valarray.hpp>
+#include <boost/accumulators/numeric/functional_fwd.hpp>
+
+namespace boost { namespace numeric
+{
+ namespace operators
+ {
+ namespace acc_detail
+ {
+ template<typename Fun>
+ struct make_valarray
+ {
+ typedef std::valarray<typename Fun::result_type> type;
+ };
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // Handle valarray<Left> / Right where Right is a scalar and Right != Left.
+ template<typename Left, typename Right>
+ typename lazy_enable_if<
+ mpl::and_<is_scalar<Right>, mpl::not_<is_same<Left, Right> > >
+ , acc_detail::make_valarray<functional::divides<Left, Right> >
+ >::type
+ operator /(std::valarray<Left> const &left, Right const &right)
+ {
+ typedef typename functional::divides<Left, Right>::result_type value_type;
+ std::valarray<value_type> result(left.size());
+ for(std::size_t i = 0, size = result.size(); i != size; ++i)
+ {
+ result[i] = numeric::divides(left[i], right);
+ }
+ return result;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // Handle valarray<Left> * Right where Right is a scalar and Right != Left.
+ template<typename Left, typename Right>
+ typename lazy_enable_if<
+ mpl::and_<is_scalar<Right>, mpl::not_<is_same<Left, Right> > >
+ , acc_detail::make_valarray<functional::multiplies<Left, Right> >
+ >::type
+ operator *(std::valarray<Left> const &left, Right const &right)
+ {
+ typedef typename functional::multiplies<Left, Right>::result_type value_type;
+ std::valarray<value_type> result(left.size());
+ for(std::size_t i = 0, size = result.size(); i != size; ++i)
+ {
+ result[i] = numeric::multiplies(left[i], right);
+ }
+ return result;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // Handle valarray<Left> + valarray<Right> where Right != Left.
+ template<typename Left, typename Right>
+ typename lazy_disable_if<
+ is_same<Left, Right>
+ , acc_detail::make_valarray<functional::plus<Left, Right> >
+ >::type
+ operator +(std::valarray<Left> const &left, std::valarray<Right> const &right)
+ {
+ typedef typename functional::plus<Left, Right>::result_type value_type;
+ std::valarray<value_type> result(left.size());
+ for(std::size_t i = 0, size = result.size(); i != size; ++i)
+ {
+ result[i] = numeric::plus(left[i], right[i]);
+ }
+ return result;
+ }
+ }
+
+ namespace functional
+ {
+ struct std_valarray_tag;
+
+ template<typename T>
+ struct tag<std::valarray<T> >
+ {
+ typedef std_valarray_tag type;
+ };
+
+ #ifdef __GLIBCXX__
+ template<typename T, typename U>
+ struct tag<std::_Expr<T, U> >
+ {
+ typedef std_valarray_tag type;
+ };
+ #endif
+
+ /// INTERNAL ONLY
+ ///
+ // This is necessary because the GCC stdlib uses expression templates, and
+ // typeof(som-valarray-expression) is not an instance of std::valarray
+ #define BOOST_NUMERIC_FUNCTIONAL_DEFINE_VALARRAY_BIN_OP(Name, Op) \
+ template<typename Left, typename Right> \
+ struct Name<Left, Right, std_valarray_tag, std_valarray_tag> \
+ : std::binary_function< \
+ Left \
+ , Right \
+ , std::valarray< \
+ typename Name< \
+ typename Left::value_type \
+ , typename Right::value_type \
+ >::result_type \
+ > \
+ > \
+ { \
+ typedef typename Left::value_type left_value_type; \
+ typedef typename Right::value_type right_value_type; \
+ typedef \
+ std::valarray< \
+ typename Name<left_value_type, right_value_type>::result_type \
+ > \
+ result_type; \
+ result_type \
+ operator ()(Left &left, Right &right) const \
+ { \
+ return numeric::promote<std::valarray<left_value_type> >(left) \
+ Op numeric::promote<std::valarray<right_value_type> >(right); \
+ } \
+ }; \
+ template<typename Left, typename Right> \
+ struct Name<Left, Right, std_valarray_tag, void> \
+ : std::binary_function< \
+ Left \
+ , Right \
+ , std::valarray< \
+ typename Name<typename Left::value_type, Right>::result_type \
+ > \
+ > \
+ { \
+ typedef typename Left::value_type left_value_type; \
+ typedef \
+ std::valarray< \
+ typename Name<left_value_type, Right>::result_type \
+ > \
+ result_type; \
+ result_type \
+ operator ()(Left &left, Right &right) const \
+ { \
+ return numeric::promote<std::valarray<left_value_type> >(left) Op right;\
+ } \
+ }; \
+ template<typename Left, typename Right> \
+ struct Name<Left, Right, void, std_valarray_tag> \
+ : std::binary_function< \
+ Left \
+ , Right \
+ , std::valarray< \
+ typename Name<Left, typename Right::value_type>::result_type \
+ > \
+ > \
+ { \
+ typedef typename Right::value_type right_value_type; \
+ typedef \
+ std::valarray< \
+ typename Name<Left, right_value_type>::result_type \
+ > \
+ result_type; \
+ result_type \
+ operator ()(Left &left, Right &right) const \
+ { \
+ return left Op numeric::promote<std::valarray<right_value_type> >(right);\
+ } \
+ };
+
+ BOOST_NUMERIC_FUNCTIONAL_DEFINE_VALARRAY_BIN_OP(plus, +)
+ BOOST_NUMERIC_FUNCTIONAL_DEFINE_VALARRAY_BIN_OP(minus, -)
+ BOOST_NUMERIC_FUNCTIONAL_DEFINE_VALARRAY_BIN_OP(multiplies, *)
+ BOOST_NUMERIC_FUNCTIONAL_DEFINE_VALARRAY_BIN_OP(divides, /)
+ BOOST_NUMERIC_FUNCTIONAL_DEFINE_VALARRAY_BIN_OP(modulus, %)
+
+ #undef BOOST_NUMERIC_FUNCTIONAL_DEFINE_VALARRAY_BIN_OP
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // element-wise min of std::valarray
+ template<typename Left, typename Right>
+ struct min_assign<Left, Right, std_valarray_tag, std_valarray_tag>
+ : std::binary_function<Left, Right, void>
+ {
+ void operator ()(Left &left, Right &right) const
+ {
+ BOOST_ASSERT(left.size() == right.size());
+ for(std::size_t i = 0, size = left.size(); i != size; ++i)
+ {
+ if(numeric::less(right[i], left[i]))
+ {
+ left[i] = right[i];
+ }
+ }
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // element-wise max of std::valarray
+ template<typename Left, typename Right>
+ struct max_assign<Left, Right, std_valarray_tag, std_valarray_tag>
+ : std::binary_function<Left, Right, void>
+ {
+ void operator ()(Left &left, Right &right) const
+ {
+ BOOST_ASSERT(left.size() == right.size());
+ for(std::size_t i = 0, size = left.size(); i != size; ++i)
+ {
+ if(numeric::greater(right[i], left[i]))
+ {
+ left[i] = right[i];
+ }
+ }
+ }
+ };
+
+ // partial specialization of numeric::average<> for std::valarray.
+ template<typename Left, typename Right, typename RightTag>
+ struct average<Left, Right, std_valarray_tag, RightTag>
+ : mpl::if_<
+ are_integral<typename Left::value_type, Right>
+ , divides<Left, double const>
+ , divides<Left, Right>
+ >::type
+ {};
+
+ // promote
+ template<typename To, typename From>
+ struct promote<To, From, std_valarray_tag, std_valarray_tag>
+ : std::unary_function<From, To>
+ {
+ To operator ()(From &arr) const
+ {
+ typename remove_const<To>::type res(arr.size());
+ for(std::size_t i = 0, size = arr.size(); i != size; ++i)
+ {
+ res[i] = numeric::promote<typename To::value_type>(arr[i]);
+ }
+ return res;
+ }
+ };
+
+ template<typename ToFrom>
+ struct promote<ToFrom, ToFrom, std_valarray_tag, std_valarray_tag>
+ : std::unary_function<ToFrom, ToFrom>
+ {
+ ToFrom &operator ()(ToFrom &tofrom) const
+ {
+ return tofrom;
+ }
+ };
+
+ // for "promoting" a std::valarray<bool> to a bool, useful for
+ // comparing 2 valarrays for equality:
+ // if(numeric::promote<bool>(a == b))
+ template<typename From>
+ struct promote<bool, From, void, std_valarray_tag>
+ : std::unary_function<From, bool>
+ {
+ bool operator ()(From &arr) const
+ {
+ BOOST_MPL_ASSERT((is_same<bool, typename From::value_type>));
+ for(std::size_t i = 0, size = arr.size(); i != size; ++i)
+ {
+ if(!arr[i])
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+ };
+
+ template<typename From>
+ struct promote<bool const, From, void, std_valarray_tag>
+ : promote<bool, From, void, std_valarray_tag>
+ {};
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // functional::as_min
+ template<typename T>
+ struct as_min<T, std_valarray_tag>
+ : std::unary_function<T, typename remove_const<T>::type>
+ {
+ typename remove_const<T>::type operator ()(T &arr) const
+ {
+ return 0 == arr.size()
+ ? T()
+ : T(numeric::as_min(arr[0]), arr.size());
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // functional::as_max
+ template<typename T>
+ struct as_max<T, std_valarray_tag>
+ : std::unary_function<T, typename remove_const<T>::type>
+ {
+ typename remove_const<T>::type operator ()(T &arr) const
+ {
+ return 0 == arr.size()
+ ? T()
+ : T(numeric::as_max(arr[0]), arr.size());
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // functional::as_zero
+ template<typename T>
+ struct as_zero<T, std_valarray_tag>
+ : std::unary_function<T, typename remove_const<T>::type>
+ {
+ typename remove_const<T>::type operator ()(T &arr) const
+ {
+ return 0 == arr.size()
+ ? T()
+ : T(numeric::as_zero(arr[0]), arr.size());
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // functional::as_one
+ template<typename T>
+ struct as_one<T, std_valarray_tag>
+ : std::unary_function<T, typename remove_const<T>::type>
+ {
+ typename remove_const<T>::type operator ()(T &arr) const
+ {
+ return 0 == arr.size()
+ ? T()
+ : T(numeric::as_one(arr[0]), arr.size());
+ }
+ };
+
+ } // namespace functional
+
+}} // namespace boost::numeric
+
+#endif
+
=== added file 'boost/boost/accumulators/numeric/functional/vector.hpp'
--- boost/boost/accumulators/numeric/functional/vector.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/numeric/functional/vector.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,329 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file vector.hpp
+///
+// Copyright 2005 Eric Niebler. 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)
+
+#ifndef BOOST_NUMERIC_FUNCTIONAL_VECTOR_HPP_EAN_12_12_2005
+#define BOOST_NUMERIC_FUNCTIONAL_VECTOR_HPP_EAN_12_12_2005
+
+#ifdef BOOST_NUMERIC_FUNCTIONAL_HPP_INCLUDED
+# error Include this file before boost/accumulators/numeric/functional.hpp
+#endif
+
+#include <vector>
+#include <functional>
+#include <boost/assert.hpp>
+#include <boost/mpl/and.hpp>
+#include <boost/mpl/not.hpp>
+#include <boost/utility/enable_if.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/type_traits/is_scalar.hpp>
+#include <boost/type_traits/remove_const.hpp>
+#include <boost/typeof/std/vector.hpp>
+#include <boost/accumulators/numeric/functional_fwd.hpp>
+
+namespace boost { namespace numeric
+{
+ namespace operators
+ {
+ namespace acc_detail
+ {
+ template<typename Fun>
+ struct make_vector
+ {
+ typedef std::vector<typename Fun::result_type> type;
+ };
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // Handle vector<Left> / Right where Right is a scalar.
+ template<typename Left, typename Right>
+ typename lazy_enable_if<
+ is_scalar<Right>
+ , acc_detail::make_vector<functional::divides<Left, Right> >
+ >::type
+ operator /(std::vector<Left> const &left, Right const &right)
+ {
+ typedef typename functional::divides<Left, Right>::result_type value_type;
+ std::vector<value_type> result(left.size());
+ for(std::size_t i = 0, size = result.size(); i != size; ++i)
+ {
+ result[i] = numeric::divides(left[i], right);
+ }
+ return result;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // Handle vector<Left> / vector<Right>.
+ template<typename Left, typename Right>
+ std::vector<typename functional::divides<Left, Right>::result_type>
+ operator /(std::vector<Left> const &left, std::vector<Right> const &right)
+ {
+ typedef typename functional::divides<Left, Right>::result_type value_type;
+ std::vector<value_type> result(left.size());
+ for(std::size_t i = 0, size = result.size(); i != size; ++i)
+ {
+ result[i] = numeric::divides(left[i], right[i]);
+ }
+ return result;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // Handle vector<Left> * Right where Right is a scalar.
+ template<typename Left, typename Right>
+ typename lazy_enable_if<
+ is_scalar<Right>
+ , acc_detail::make_vector<functional::multiplies<Left, Right> >
+ >::type
+ operator *(std::vector<Left> const &left, Right const &right)
+ {
+ typedef typename functional::multiplies<Left, Right>::result_type value_type;
+ std::vector<value_type> result(left.size());
+ for(std::size_t i = 0, size = result.size(); i != size; ++i)
+ {
+ result[i] = numeric::multiplies(left[i], right);
+ }
+ return result;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // Handle Left * vector<Right> where Left is a scalar.
+ template<typename Left, typename Right>
+ typename lazy_enable_if<
+ is_scalar<Left>
+ , acc_detail::make_vector<functional::multiplies<Left, Right> >
+ >::type
+ operator *(Left const &left, std::vector<Right> const &right)
+ {
+ typedef typename functional::multiplies<Left, Right>::result_type value_type;
+ std::vector<value_type> result(right.size());
+ for(std::size_t i = 0, size = result.size(); i != size; ++i)
+ {
+ result[i] = numeric::multiplies(left, right[i]);
+ }
+ return result;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // Handle vector<Left> * vector<Right>
+ template<typename Left, typename Right>
+ std::vector<typename functional::multiplies<Left, Right>::result_type>
+ operator *(std::vector<Left> const &left, std::vector<Right> const &right)
+ {
+ typedef typename functional::multiplies<Left, Right>::result_type value_type;
+ std::vector<value_type> result(left.size());
+ for(std::size_t i = 0, size = result.size(); i != size; ++i)
+ {
+ result[i] = numeric::multiplies(left[i], right[i]);
+ }
+ return result;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // Handle vector<Left> + vector<Right>
+ template<typename Left, typename Right>
+ std::vector<typename functional::plus<Left, Right>::result_type>
+ operator +(std::vector<Left> const &left, std::vector<Right> const &right)
+ {
+ typedef typename functional::plus<Left, Right>::result_type value_type;
+ std::vector<value_type> result(left.size());
+ for(std::size_t i = 0, size = result.size(); i != size; ++i)
+ {
+ result[i] = numeric::plus(left[i], right[i]);
+ }
+ return result;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // Handle vector<Left> - vector<Right>
+ template<typename Left, typename Right>
+ std::vector<typename functional::minus<Left, Right>::result_type>
+ operator -(std::vector<Left> const &left, std::vector<Right> const &right)
+ {
+ typedef typename functional::minus<Left, Right>::result_type value_type;
+ std::vector<value_type> result(left.size());
+ for(std::size_t i = 0, size = result.size(); i != size; ++i)
+ {
+ result[i] = numeric::minus(left[i], right[i]);
+ }
+ return result;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // Handle vector<Left> += vector<Left>
+ template<typename Left>
+ std::vector<Left> &
+ operator +=(std::vector<Left> &left, std::vector<Left> const &right)
+ {
+ BOOST_ASSERT(left.size() == right.size());
+ for(std::size_t i = 0, size = left.size(); i != size; ++i)
+ {
+ numeric::plus_assign(left[i], right[i]);
+ }
+ return left;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // Handle -vector<Arg>
+ template<typename Arg>
+ std::vector<typename functional::unary_minus<Arg>::result_type>
+ operator -(std::vector<Arg> const &arg)
+ {
+ typedef typename functional::unary_minus<Arg>::result_type value_type;
+ std::vector<value_type> result(arg.size());
+ for(std::size_t i = 0, size = result.size(); i != size; ++i)
+ {
+ result[i] = numeric::unary_minus(arg[i]);
+ }
+ return result;
+ }
+ }
+
+ namespace functional
+ {
+ struct std_vector_tag;
+
+ template<typename T, typename Al>
+ struct tag<std::vector<T, Al> >
+ {
+ typedef std_vector_tag type;
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // element-wise min of std::vector
+ template<typename Left, typename Right>
+ struct min_assign<Left, Right, std_vector_tag, std_vector_tag>
+ : std::binary_function<Left, Right, void>
+ {
+ void operator ()(Left &left, Right &right) const
+ {
+ BOOST_ASSERT(left.size() == right.size());
+ for(std::size_t i = 0, size = left.size(); i != size; ++i)
+ {
+ if(numeric::less(right[i], left[i]))
+ {
+ left[i] = right[i];
+ }
+ }
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // element-wise max of std::vector
+ template<typename Left, typename Right>
+ struct max_assign<Left, Right, std_vector_tag, std_vector_tag>
+ : std::binary_function<Left, Right, void>
+ {
+ void operator ()(Left &left, Right &right) const
+ {
+ BOOST_ASSERT(left.size() == right.size());
+ for(std::size_t i = 0, size = left.size(); i != size; ++i)
+ {
+ if(numeric::greater(right[i], left[i]))
+ {
+ left[i] = right[i];
+ }
+ }
+ }
+ };
+
+ // partial specialization for std::vector.
+ template<typename Left, typename Right>
+ struct average<Left, Right, std_vector_tag, void>
+ : mpl::if_<
+ are_integral<typename Left::value_type, Right>
+ , divides<Left, double const>
+ , divides<Left, Right>
+ >::type
+ {};
+
+ // promote
+ template<typename To, typename From>
+ struct promote<To, From, std_vector_tag, std_vector_tag>
+ : std::unary_function<From, To>
+ {
+ To operator ()(From &arr) const
+ {
+ typename remove_const<To>::type res(arr.size());
+ for(std::size_t i = 0, size = arr.size(); i != size; ++i)
+ {
+ res[i] = numeric::promote<typename To::value_type>(arr[i]);
+ }
+ return res;
+ }
+ };
+
+ template<typename ToFrom>
+ struct promote<ToFrom, ToFrom, std_vector_tag, std_vector_tag>
+ : std::unary_function<ToFrom, ToFrom>
+ {
+ ToFrom &operator ()(ToFrom &tofrom) const
+ {
+ return tofrom;
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // functional::as_min
+ template<typename T>
+ struct as_min<T, std_vector_tag>
+ : std::unary_function<T, typename remove_const<T>::type>
+ {
+ typename remove_const<T>::type operator ()(T &arr) const
+ {
+ return 0 == arr.size()
+ ? T()
+ : T(arr.size(), numeric::as_min(arr[0]));
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // functional::as_max
+ template<typename T>
+ struct as_max<T, std_vector_tag>
+ : std::unary_function<T, typename remove_const<T>::type>
+ {
+ typename remove_const<T>::type operator ()(T &arr) const
+ {
+ return 0 == arr.size()
+ ? T()
+ : T(arr.size(), numeric::as_max(arr[0]));
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // functional::as_zero
+ template<typename T>
+ struct as_zero<T, std_vector_tag>
+ : std::unary_function<T, typename remove_const<T>::type>
+ {
+ typename remove_const<T>::type operator ()(T &arr) const
+ {
+ return 0 == arr.size()
+ ? T()
+ : T(arr.size(), numeric::as_zero(arr[0]));
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // functional::as_one
+ template<typename T>
+ struct as_one<T, std_vector_tag>
+ : std::unary_function<T, typename remove_const<T>::type>
+ {
+ typename remove_const<T>::type operator ()(T &arr) const
+ {
+ return 0 == arr.size()
+ ? T()
+ : T(arr.size(), numeric::as_one(arr[0]));
+ }
+ };
+
+ } // namespace functional
+
+}} // namespace boost::numeric
+
+#endif
+
=== added file 'boost/boost/accumulators/numeric/functional_fwd.hpp'
--- boost/boost/accumulators/numeric/functional_fwd.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/numeric/functional_fwd.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,221 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file functional_fwd.hpp
+///
+// Copyright 2005 Eric Niebler. 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)
+
+#ifndef BOOST_NUMERIC_FUNCTIONAL_FWD_HPP_EAN_08_12_2005
+#define BOOST_NUMERIC_FUNCTIONAL_FWD_HPP_EAN_08_12_2005
+
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/placeholders.hpp>
+#include <boost/utility/enable_if.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/type_traits/is_const.hpp>
+
+namespace boost { namespace numeric
+{
+ // For using directives -- this namespace may be re-opened elsewhere
+ namespace operators
+ {}
+
+ namespace op
+ {
+ using mpl::_;
+ using mpl::_1;
+ using mpl::_2;
+ }
+
+ namespace functional
+ {
+ using namespace operators;
+
+ template<typename T>
+ struct tag
+ {
+ typedef void type;
+ };
+
+ template<typename T>
+ struct tag<T const>
+ : tag<T>
+ {};
+
+ template<typename T>
+ struct tag<T volatile>
+ : tag<T>
+ {};
+
+ template<typename T>
+ struct tag<T const volatile>
+ : tag<T>
+ {};
+
+ template<typename T>
+ struct static_;
+
+ template<typename A0, typename A1>
+ struct are_integral;
+ }
+
+ /// INTERNAL ONLY
+ ///
+#define BOOST_NUMERIC_FUNCTIONAL_DECLARE_UNARY_OP(Name, Op) \
+ namespace functional \
+ { \
+ template<typename Arg, typename EnableIf = void> \
+ struct Name ## _base; \
+ template<typename Arg, typename ArgTag = typename tag<Arg>::type> \
+ struct Name; \
+ } \
+ namespace op \
+ { \
+ struct Name; \
+ } \
+ namespace \
+ { \
+ extern op::Name const &Name; \
+ }
+
+ /// INTERNAL ONLY
+ ///
+#define BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(Name) \
+ namespace functional \
+ { \
+ template<typename Left, typename Right, typename EnableIf = void> \
+ struct result_of_ ## Name; \
+ template<typename Left, typename Right, typename EnableIf = void> \
+ struct Name ## _base; \
+ template< \
+ typename Left \
+ , typename Right \
+ , typename LeftTag = typename tag<Left>::type \
+ , typename RightTag = typename tag<Right>::type \
+ > \
+ struct Name; \
+ } \
+ namespace op \
+ { \
+ struct Name; \
+ } \
+ namespace \
+ { \
+ extern op::Name const &Name; \
+ }
+
+ BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(plus)
+ BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(minus)
+ BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(multiplies)
+ BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(divides)
+ BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(modulus)
+ BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(greater)
+ BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(greater_equal)
+ BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(less)
+ BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(less_equal)
+ BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(equal_to)
+ BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(not_equal_to)
+
+ BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(assign)
+ BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(plus_assign)
+ BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(minus_assign)
+ BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(multiplies_assign)
+ BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(divides_assign)
+ BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(modulus_assign)
+
+ BOOST_NUMERIC_FUNCTIONAL_DECLARE_UNARY_OP(unary_plus, +)
+ BOOST_NUMERIC_FUNCTIONAL_DECLARE_UNARY_OP(unary_minus, -)
+ BOOST_NUMERIC_FUNCTIONAL_DECLARE_UNARY_OP(complement, ~)
+ BOOST_NUMERIC_FUNCTIONAL_DECLARE_UNARY_OP(logical_not, !)
+
+#undef BOOST_NUMERIC_FUNCTIONAL_DECLARE_UNARY_OP
+#undef BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP
+
+
+ namespace functional
+ {
+ template<typename To, typename From, typename EnableIf = void>
+ struct promote_base;
+ template<typename Left, typename Right, typename EnableIf = void>
+ struct min_assign_base;
+ template<typename Left, typename Right, typename EnableIf = void>
+ struct max_assign_base;
+ template<typename Left, typename Right, typename EnableIf = void>
+ struct average_base;
+ template<typename Arg, typename EnableIf = void>
+ struct as_min_base;
+ template<typename Arg, typename EnableIf = void>
+ struct as_max_base;
+ template<typename Arg, typename EnableIf = void>
+ struct as_zero_base;
+ template<typename Arg, typename EnableIf = void>
+ struct as_one_base;
+
+ template<typename To, typename From, typename ToTag = typename tag<To>::type, typename FromTag = typename tag<From>::type>
+ struct promote;
+ template<typename Left, typename Right, typename LeftTag = typename tag<Left>::type, typename RightTag = typename tag<Right>::type>
+ struct min_assign;
+ template<typename Left, typename Right, typename LeftTag = typename tag<Left>::type, typename RightTag = typename tag<Right>::type>
+ struct max_assign;
+ template<typename Left, typename Right, typename LeftTag = typename tag<Left>::type, typename RightTag = typename tag<Right>::type>
+ struct average;
+ template<typename Arg, typename Tag = typename tag<Arg>::type>
+ struct as_min;
+ template<typename Arg, typename Tag = typename tag<Arg>::type>
+ struct as_max;
+ template<typename Arg, typename Tag = typename tag<Arg>::type>
+ struct as_zero;
+ template<typename Arg, typename Tag = typename tag<Arg>::type>
+ struct as_one;
+ }
+
+ namespace op
+ {
+ template<typename To>
+ struct promote;
+ struct min_assign;
+ struct max_assign;
+ struct average;
+ struct as_min;
+ struct as_max;
+ struct as_zero;
+ struct as_one;
+ }
+
+ namespace
+ {
+ extern op::min_assign const &min_assign;
+ extern op::max_assign const &max_assign;
+ extern op::average const &average;
+ extern op::as_min const &as_min;
+ extern op::as_max const &as_max;
+ extern op::as_zero const &as_zero;
+ extern op::as_one const &as_one;
+ }
+
+ template<typename To, typename From>
+ typename lazy_disable_if<is_const<From>, mpl::if_<is_same<To, From>, To &, To> >::type
+ promote(From &from);
+
+ template<typename To, typename From>
+ typename mpl::if_<is_same<To const, From const>, To const &, To const>::type
+ promote(From const &from);
+
+ template<typename T>
+ struct default_;
+
+ template<typename T>
+ struct one;
+
+ template<typename T>
+ struct zero;
+
+ template<typename T>
+ struct one_or_default;
+
+ template<typename T>
+ struct zero_or_default;
+
+}} // namespace boost::numeric
+
+#endif
=== added directory 'boost/boost/accumulators/statistics'
=== added file 'boost/boost/accumulators/statistics.hpp'
--- boost/boost/accumulators/statistics.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/statistics.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,61 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file statistics.hpp
+/// Includes all of the Statistical Accumulators Library
+//
+// Copyright 2005 Eric Niebler. 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)
+
+#ifndef BOOST_ACCUMULATORS_STATISTICS_HPP_EAN_01_17_2006
+#define BOOST_ACCUMULATORS_STATISTICS_HPP_EAN_01_17_2006
+
+#include <boost/accumulators/statistics/count.hpp>
+#include <boost/accumulators/statistics/covariance.hpp>
+#include <boost/accumulators/statistics/density.hpp>
+#include <boost/accumulators/statistics/error_of.hpp>
+#include <boost/accumulators/statistics/error_of_mean.hpp>
+#include <boost/accumulators/statistics/extended_p_square.hpp>
+#include <boost/accumulators/statistics/extended_p_square_quantile.hpp>
+#include <boost/accumulators/statistics/kurtosis.hpp>
+#include <boost/accumulators/statistics/max.hpp>
+#include <boost/accumulators/statistics/mean.hpp>
+#include <boost/accumulators/statistics/median.hpp>
+#include <boost/accumulators/statistics/min.hpp>
+#include <boost/accumulators/statistics/moment.hpp>
+#include <boost/accumulators/statistics/peaks_over_threshold.hpp>
+#include <boost/accumulators/statistics/pot_tail_mean.hpp>
+#include <boost/accumulators/statistics/pot_quantile.hpp>
+#include <boost/accumulators/statistics/p_square_cumulative_distribution.hpp>
+#include <boost/accumulators/statistics/p_square_quantile.hpp>
+#include <boost/accumulators/statistics/skewness.hpp>
+#include <boost/accumulators/statistics/stats.hpp>
+#include <boost/accumulators/statistics/sum.hpp>
+#include <boost/accumulators/statistics/sum_kahan.hpp>
+#include <boost/accumulators/statistics/tail.hpp>
+#include <boost/accumulators/statistics/tail_quantile.hpp>
+#include <boost/accumulators/statistics/tail_mean.hpp>
+#include <boost/accumulators/statistics/tail_variate.hpp>
+#include <boost/accumulators/statistics/tail_variate_means.hpp>
+#include <boost/accumulators/statistics/variance.hpp>
+#include <boost/accumulators/statistics/weighted_covariance.hpp>
+#include <boost/accumulators/statistics/weighted_density.hpp>
+#include <boost/accumulators/statistics/weighted_kurtosis.hpp>
+#include <boost/accumulators/statistics/weighted_extended_p_square.hpp>
+#include <boost/accumulators/statistics/weighted_mean.hpp>
+#include <boost/accumulators/statistics/weighted_median.hpp>
+#include <boost/accumulators/statistics/weighted_moment.hpp>
+#include <boost/accumulators/statistics/weighted_peaks_over_threshold.hpp>
+#include <boost/accumulators/statistics/weighted_p_square_cumulative_distribution.hpp>
+#include <boost/accumulators/statistics/weighted_p_square_quantile.hpp>
+#include <boost/accumulators/statistics/weighted_skewness.hpp>
+#include <boost/accumulators/statistics/weighted_sum.hpp>
+#include <boost/accumulators/statistics/weighted_sum_kahan.hpp>
+#include <boost/accumulators/statistics/weighted_tail_quantile.hpp>
+#include <boost/accumulators/statistics/weighted_tail_mean.hpp>
+#include <boost/accumulators/statistics/weighted_tail_variate_means.hpp>
+#include <boost/accumulators/statistics/weighted_variance.hpp>
+#include <boost/accumulators/statistics/with_error.hpp>
+#include <boost/accumulators/statistics/parameters/quantile_probability.hpp>
+#include <boost/accumulators/statistics/variates/covariate.hpp>
+
+#endif
=== added file 'boost/boost/accumulators/statistics/count.hpp'
--- boost/boost/accumulators/statistics/count.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/statistics/count.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,80 @@
+///////////////////////////////////////////////////////////////////////////////
+// count.hpp
+//
+// Copyright 2005 Eric Niebler. 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)
+
+#ifndef BOOST_ACCUMULATORS_STATISTICS_COUNT_HPP_EAN_28_10_2005
+#define BOOST_ACCUMULATORS_STATISTICS_COUNT_HPP_EAN_28_10_2005
+
+#include <boost/mpl/always.hpp>
+#include <boost/accumulators/framework/accumulator_base.hpp>
+#include <boost/accumulators/framework/extractor.hpp>
+#include <boost/accumulators/framework/depends_on.hpp>
+#include <boost/accumulators/statistics_fwd.hpp>
+
+namespace boost { namespace accumulators
+{
+
+namespace impl
+{
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // count_impl
+ struct count_impl
+ : accumulator_base
+ {
+ // for boost::result_of
+ typedef std::size_t result_type;
+
+ count_impl(dont_care)
+ : cnt(0)
+ {
+ }
+
+ void operator ()(dont_care)
+ {
+ ++this->cnt;
+ }
+
+ result_type result(dont_care) const
+ {
+ return this->cnt;
+ }
+
+ private:
+ std::size_t cnt;
+ };
+
+} // namespace impl
+
+///////////////////////////////////////////////////////////////////////////////
+// tag::count
+//
+namespace tag
+{
+ struct count
+ : depends_on<>
+ {
+ /// INTERNAL ONLY
+ ///
+ typedef mpl::always<accumulators::impl::count_impl> impl;
+ };
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// extract::count
+//
+namespace extract
+{
+ extractor<tag::count> const count = {};
+
+ BOOST_ACCUMULATORS_IGNORE_GLOBAL(count)
+}
+
+using extract::count;
+
+}} // namespace boost::accumulators
+
+#endif
=== added file 'boost/boost/accumulators/statistics/covariance.hpp'
--- boost/boost/accumulators/statistics/covariance.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/statistics/covariance.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,220 @@
+///////////////////////////////////////////////////////////////////////////////
+// covariance.hpp
+//
+// Copyright 2006 Daniel Egloff, Olivier Gygi. 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)
+
+#ifndef BOOST_ACCUMULATORS_STATISTICS_COVARIANCE_HPP_DE_01_01_2006
+#define BOOST_ACCUMULATORS_STATISTICS_COVARIANCE_HPP_DE_01_01_2006
+
+#include <vector>
+#include <limits>
+#include <numeric>
+#include <functional>
+#include <complex>
+#include <boost/mpl/assert.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/range.hpp>
+#include <boost/parameter/keyword.hpp>
+#include <boost/mpl/placeholders.hpp>
+#include <boost/numeric/ublas/io.hpp>
+#include <boost/numeric/ublas/matrix.hpp>
+#include <boost/type_traits/is_scalar.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/accumulators/framework/accumulator_base.hpp>
+#include <boost/accumulators/framework/extractor.hpp>
+#include <boost/accumulators/numeric/functional.hpp>
+#include <boost/accumulators/framework/parameters/sample.hpp>
+#include <boost/accumulators/statistics_fwd.hpp>
+#include <boost/accumulators/statistics/count.hpp>
+#include <boost/accumulators/statistics/mean.hpp>
+
+namespace boost { namespace numeric
+{
+ namespace functional
+ {
+ struct std_vector_tag;
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // functional::outer_product
+ template<typename Left, typename Right, typename EnableIf = void>
+ struct outer_product_base
+ : functional::multiplies<Left, Right>
+ {};
+
+ template<typename Left, typename Right, typename LeftTag = typename tag<Left>::type, typename RightTag = typename tag<Right>::type>
+ struct outer_product
+ : outer_product_base<Left, Right, void>
+ {};
+
+ template<typename Left, typename Right>
+ struct outer_product<Left, Right, std_vector_tag, std_vector_tag>
+ : std::binary_function<
+ Left
+ , Right
+ , ublas::matrix<
+ typename functional::multiplies<
+ typename Left::value_type
+ , typename Right::value_type
+ >::result_type
+ >
+ >
+ {
+ typedef
+ ublas::matrix<
+ typename functional::multiplies<
+ typename Left::value_type
+ , typename Right::value_type
+ >::result_type
+ >
+ result_type;
+
+ result_type
+ operator ()(Left & left, Right & right) const
+ {
+ std::size_t left_size = left.size();
+ std::size_t right_size = right.size();
+ result_type result(left_size, right_size);
+ for (std::size_t i = 0; i < left_size; ++i)
+ for (std::size_t j = 0; j < right_size; ++j)
+ result(i,j) = numeric::multiplies(left[i], right[j]);
+ return result;
+ }
+ };
+ }
+
+ namespace op
+ {
+ struct outer_product
+ : boost::detail::function2<functional::outer_product<_1, _2, functional::tag<_1>, functional::tag<_2> > >
+ {};
+ }
+
+ namespace
+ {
+ op::outer_product const &outer_product = boost::detail::pod_singleton<op::outer_product>::instance;
+ }
+
+}}
+
+namespace boost { namespace accumulators
+{
+
+namespace impl
+{
+ ///////////////////////////////////////////////////////////////////////////////
+ // covariance_impl
+ //
+ /**
+ @brief Covariance Estimator
+
+ An iterative Monte Carlo estimator for the covariance \f$\mathrm{Cov}(X,X')\f$, where \f$X\f$ is a sample
+ and \f$X'\f$ is a variate, is given by:
+
+ \f[
+ \hat{c}_n = \frac{n-1}{n} \hat{c}_{n-1} + \frac{1}{n-1}(X_n - \hat{\mu}_n)(X_n' - \hat{\mu}_n'),\quad n\ge2,\quad\hat{c}_1 = 0,
+ \f]
+
+ \f$\hat{\mu}_n\f$ and \f$\hat{\mu}_n'\f$ being the means of the samples and variates.
+ */
+ template<typename Sample, typename VariateType, typename VariateTag>
+ struct covariance_impl
+ : accumulator_base
+ {
+ typedef typename numeric::functional::average<Sample, std::size_t>::result_type sample_type;
+ typedef typename numeric::functional::average<VariateType, std::size_t>::result_type variate_type;
+ // for boost::result_of
+ typedef typename numeric::functional::outer_product<sample_type, variate_type>::result_type result_type;
+
+ template<typename Args>
+ covariance_impl(Args const &args)
+ : cov_(
+ numeric::outer_product(
+ numeric::average(args[sample | Sample()], (std::size_t)1)
+ , numeric::average(args[parameter::keyword<VariateTag>::get() | VariateType()], (std::size_t)1)
+ )
+ )
+ {
+ }
+
+ template<typename Args>
+ void operator ()(Args const &args)
+ {
+ std::size_t cnt = count(args);
+
+ if (cnt > 1)
+ {
+ extractor<tag::mean_of_variates<VariateType, VariateTag> > const some_mean_of_variates = {};
+
+ this->cov_ = this->cov_*(cnt-1.)/cnt
+ + numeric::outer_product(
+ some_mean_of_variates(args) - args[parameter::keyword<VariateTag>::get()]
+ , mean(args) - args[sample]
+ ) / (cnt-1.);
+ }
+ }
+
+ result_type result(dont_care) const
+ {
+ return this->cov_;
+ }
+
+ private:
+ result_type cov_;
+ };
+
+} // namespace impl
+
+///////////////////////////////////////////////////////////////////////////////
+// tag::covariance
+//
+namespace tag
+{
+ template<typename VariateType, typename VariateTag>
+ struct covariance
+ : depends_on<count, mean, mean_of_variates<VariateType, VariateTag> >
+ {
+ typedef accumulators::impl::covariance_impl<mpl::_1, VariateType, VariateTag> impl;
+ };
+
+ struct abstract_covariance
+ : depends_on<>
+ {
+ };
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// extract::covariance
+//
+namespace extract
+{
+ extractor<tag::abstract_covariance> const covariance = {};
+
+ BOOST_ACCUMULATORS_IGNORE_GLOBAL(covariance)
+}
+
+using extract::covariance;
+
+template<typename VariateType, typename VariateTag>
+struct feature_of<tag::covariance<VariateType, VariateTag> >
+ : feature_of<tag::abstract_covariance>
+{
+};
+
+// So that covariance can be automatically substituted with
+// weighted_covariance when the weight parameter is non-void.
+template<typename VariateType, typename VariateTag>
+struct as_weighted_feature<tag::covariance<VariateType, VariateTag> >
+{
+ typedef tag::weighted_covariance<VariateType, VariateTag> type;
+};
+
+template<typename VariateType, typename VariateTag>
+struct feature_of<tag::weighted_covariance<VariateType, VariateTag> >
+ : feature_of<tag::covariance<VariateType, VariateTag> >
+{};
+
+}} // namespace boost::accumulators
+
+#endif
=== added file 'boost/boost/accumulators/statistics/density.hpp'
--- boost/boost/accumulators/statistics/density.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/statistics/density.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,246 @@
+
+///////////////////////////////////////////////////////////////////////////////
+// density.hpp
+//
+// Copyright 2006 Daniel Egloff, Olivier Gygi. 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)
+
+#ifndef BOOST_ACCUMULATORS_STATISTICS_DENSITY_HPP_DE_01_01_2006
+#define BOOST_ACCUMULATORS_STATISTICS_DENSITY_HPP_DE_01_01_2006
+
+#include <vector>
+#include <limits>
+#include <functional>
+#include <boost/range.hpp>
+#include <boost/parameter/keyword.hpp>
+#include <boost/mpl/placeholders.hpp>
+#include <boost/accumulators/framework/accumulator_base.hpp>
+#include <boost/accumulators/framework/extractor.hpp>
+#include <boost/accumulators/numeric/functional.hpp>
+#include <boost/accumulators/framework/parameters/sample.hpp>
+#include <boost/accumulators/framework/depends_on.hpp>
+#include <boost/accumulators/statistics_fwd.hpp>
+#include <boost/accumulators/statistics/count.hpp>
+#include <boost/accumulators/statistics/max.hpp>
+#include <boost/accumulators/statistics/min.hpp>
+
+namespace boost { namespace accumulators
+{
+
+///////////////////////////////////////////////////////////////////////////////
+// cache_size and num_bins named parameters
+//
+BOOST_PARAMETER_NESTED_KEYWORD(tag, density_cache_size, cache_size)
+BOOST_PARAMETER_NESTED_KEYWORD(tag, density_num_bins, num_bins)
+
+namespace impl
+{
+ ///////////////////////////////////////////////////////////////////////////////
+ // density_impl
+ // density histogram
+ /**
+ @brief Histogram density estimator
+
+ The histogram density estimator returns a histogram of the sample distribution. The positions and sizes of the bins
+ are determined using a specifiable number of cached samples (cache_size). The range between the minimum and the
+ maximum of the cached samples is subdivided into a specifiable number of bins (num_bins) of same size. Additionally,
+ an under- and an overflow bin is added to capture future under- and overflow samples. Once the bins are determined,
+ the cached samples and all subsequent samples are added to the correct bins. At the end, a range of std::pair is
+ return, where each pair contains the position of the bin (lower bound) and the samples count (normalized with the
+ total number of samples).
+
+ @param density_cache_size Number of first samples used to determine min and max.
+ @param density_num_bins Number of bins (two additional bins collect under- and overflow samples).
+ */
+ template<typename Sample>
+ struct density_impl
+ : accumulator_base
+ {
+ typedef typename numeric::functional::average<Sample, std::size_t>::result_type float_type;
+ typedef std::vector<std::pair<float_type, float_type> > histogram_type;
+ typedef std::vector<float_type> array_type;
+ // for boost::result_of
+ typedef iterator_range<typename histogram_type::iterator> result_type;
+
+ template<typename Args>
+ density_impl(Args const &args)
+ : cache_size(args[density_cache_size])
+ , cache(cache_size)
+ , num_bins(args[density_num_bins])
+ , samples_in_bin(num_bins + 2, 0.)
+ , bin_positions(num_bins + 2)
+ , histogram(
+ num_bins + 2
+ , std::make_pair(
+ numeric::average(args[sample | Sample()],(std::size_t)1)
+ , numeric::average(args[sample | Sample()],(std::size_t)1)
+ )
+ )
+ , is_dirty(true)
+ {
+ }
+
+ template<typename Args>
+ void operator ()(Args const &args)
+ {
+ this->is_dirty = true;
+
+ std::size_t cnt = count(args);
+
+ // Fill up cache with cache_size first samples
+ if (cnt <= this->cache_size)
+ {
+ this->cache[cnt - 1] = args[sample];
+ }
+
+ // Once cache_size samples have been accumulated, create num_bins bins of same size between
+ // the minimum and maximum of the cached samples as well as an under- and and an overflow bin.
+ // Store their lower bounds (bin_positions) and fill the bins with the cached samples (samples_in_bin).
+ if (cnt == this->cache_size)
+ {
+ float_type minimum = numeric::average((min)(args), (std::size_t)1);
+ float_type maximum = numeric::average((max)(args), (std::size_t)1);
+ float_type bin_size = numeric::average(maximum - minimum, this->num_bins );
+
+ // determine bin positions (their lower bounds)
+ for (std::size_t i = 0; i < this->num_bins + 2; ++i)
+ {
+ this->bin_positions[i] = minimum + (i - 1.) * bin_size;
+ }
+
+ for (typename array_type::const_iterator iter = this->cache.begin(); iter != this->cache.end(); ++iter)
+ {
+ if (*iter < this->bin_positions[1])
+ {
+ ++(this->samples_in_bin[0]);
+ }
+ else if (*iter >= this->bin_positions[this->num_bins + 1])
+ {
+ ++(this->samples_in_bin[this->num_bins + 1]);
+ }
+ else
+ {
+ typename array_type::iterator it = std::upper_bound(
+ this->bin_positions.begin()
+ , this->bin_positions.end()
+ , *iter
+ );
+
+ std::size_t d = std::distance(this->bin_positions.begin(), it);
+ ++(this->samples_in_bin[d - 1]);
+ }
+ }
+ }
+ // Add each subsequent sample to the correct bin
+ else if (cnt > this->cache_size)
+ {
+ if (args[sample] < this->bin_positions[1])
+ {
+ ++(this->samples_in_bin[0]);
+ }
+ else if (args[sample] >= this->bin_positions[this->num_bins + 1])
+ {
+ ++(this->samples_in_bin[this->num_bins + 1]);
+ }
+ else
+ {
+ typename array_type::iterator it = std::upper_bound(
+ this->bin_positions.begin()
+ , this->bin_positions.end()
+ , args[sample]
+ );
+
+ std::size_t d = std::distance(this->bin_positions.begin(), it);
+ ++(this->samples_in_bin[d - 1]);
+ }
+ }
+ }
+
+ /**
+ @pre The number of samples must meet or exceed the cache size
+ */
+ template<typename Args>
+ result_type result(Args const &args) const
+ {
+ if (this->is_dirty)
+ {
+ this->is_dirty = false;
+
+ // creates a vector of std::pair where each pair i holds
+ // the values bin_positions[i] (x-axis of histogram) and
+ // samples_in_bin[i] / cnt (y-axis of histogram).
+
+ for (std::size_t i = 0; i < this->num_bins + 2; ++i)
+ {
+ this->histogram[i] = std::make_pair(this->bin_positions[i], numeric::average(this->samples_in_bin[i], count(args)));
+ }
+ }
+ // returns a range of pairs
+ return make_iterator_range(this->histogram);
+ }
+
+ private:
+ std::size_t cache_size; // number of cached samples
+ array_type cache; // cache to store the first cache_size samples
+ std::size_t num_bins; // number of bins
+ array_type samples_in_bin; // number of samples in each bin
+ array_type bin_positions; // lower bounds of bins
+ mutable histogram_type histogram; // histogram
+ mutable bool is_dirty;
+ };
+
+} // namespace impl
+
+///////////////////////////////////////////////////////////////////////////////
+// tag::density
+//
+namespace tag
+{
+ struct density
+ : depends_on<count, min, max>
+ , density_cache_size
+ , density_num_bins
+ {
+ /// INTERNAL ONLY
+ ///
+ typedef accumulators::impl::density_impl<mpl::_1> impl;
+
+ #ifdef BOOST_ACCUMULATORS_DOXYGEN_INVOKED
+ /// tag::density::cache_size named parameter
+ /// tag::density::num_bins named parameter
+ static boost::parameter::keyword<density_cache_size> const cache_size;
+ static boost::parameter::keyword<density_num_bins> const num_bins;
+ #endif
+ };
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// extract::density
+//
+namespace extract
+{
+ extractor<tag::density> const density = {};
+
+ BOOST_ACCUMULATORS_IGNORE_GLOBAL(density)
+}
+
+using extract::density;
+
+// So that density can be automatically substituted
+// with weighted_density when the weight parameter is non-void.
+template<>
+struct as_weighted_feature<tag::density>
+{
+ typedef tag::weighted_density type;
+};
+
+template<>
+struct feature_of<tag::weighted_density>
+ : feature_of<tag::density>
+{
+};
+
+}} // namespace boost::accumulators
+
+#endif
=== added file 'boost/boost/accumulators/statistics/error_of.hpp'
--- boost/boost/accumulators/statistics/error_of.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/statistics/error_of.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,99 @@
+///////////////////////////////////////////////////////////////////////////////
+// error_of.hpp
+//
+// Copyright 2005 Eric Niebler. 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)
+
+#ifndef BOOST_ACCUMULATORS_STATISTICS_ERROR_OF_HPP_EAN_29_11_2005
+#define BOOST_ACCUMULATORS_STATISTICS_ERROR_OF_HPP_EAN_29_11_2005
+
+#include <boost/mpl/placeholders.hpp>
+#include <boost/accumulators/framework/accumulator_base.hpp>
+#include <boost/accumulators/framework/extractor.hpp>
+#include <boost/accumulators/framework/depends_on.hpp>
+#include <boost/accumulators/statistics_fwd.hpp>
+
+namespace boost { namespace accumulators
+{
+
+namespace impl
+{
+ /// INTERNAL ONLY
+ ///
+ template<typename Feature>
+ struct this_feature_has_no_error_calculation
+ : mpl::false_
+ {
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // error_of_impl
+ /// INTERNAL ONLY
+ ///
+ template<typename Sample, typename Feature>
+ struct error_of_impl
+ : accumulator_base
+ {
+ // TODO: specialize this on the specific features that have errors we're
+ // interested in.
+ BOOST_MPL_ASSERT((this_feature_has_no_error_calculation<Feature>));
+
+ // for boost::result_of
+ typedef int result_type;
+
+ error_of_impl(dont_care)
+ {
+ }
+
+ result_type result(dont_care) const
+ {
+ return 0;
+ }
+ };
+
+} // namespace impl
+
+///////////////////////////////////////////////////////////////////////////////
+// tag::error_of
+//
+namespace tag
+{
+ template<typename Feature>
+ struct error_of
+ : depends_on<Feature>
+ {
+ /// INTERNAL ONLY
+ ///
+ typedef accumulators::impl::error_of_impl<mpl::_1, Feature> impl;
+ };
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// extract::error_of
+//
+namespace extract
+{
+ BOOST_ACCUMULATORS_DEFINE_EXTRACTOR(tag, error_of, (typename))
+}
+
+using extract::error_of;
+
+// make tag::error_of<tag::feature(modifier)> work
+template<typename Feature>
+struct as_feature<tag::error_of<Feature> >
+{
+ typedef tag::error_of<typename as_feature<Feature>::type> type;
+};
+
+// make error_of<tag::mean> work with non-void weights (should become
+// error_of<tag::weighted_mean>
+template<typename Feature>
+struct as_weighted_feature<tag::error_of<Feature> >
+{
+ typedef tag::error_of<typename as_weighted_feature<Feature>::type> type;
+};
+
+}} // namespace boost::accumulators
+
+#endif
=== added file 'boost/boost/accumulators/statistics/error_of_mean.hpp'
--- boost/boost/accumulators/statistics/error_of_mean.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/statistics/error_of_mean.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,73 @@
+///////////////////////////////////////////////////////////////////////////////
+// error_of.hpp
+//
+// Copyright 2005 Eric Niebler. 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)
+
+#ifndef BOOST_ACCUMULATORS_STATISTICS_ERROR_OF_MEAN_HPP_EAN_27_03_2006
+#define BOOST_ACCUMULATORS_STATISTICS_ERROR_OF_MEAN_HPP_EAN_27_03_2006
+
+#include <boost/mpl/placeholders.hpp>
+#include <boost/accumulators/framework/accumulator_base.hpp>
+#include <boost/accumulators/framework/extractor.hpp>
+#include <boost/accumulators/framework/depends_on.hpp>
+#include <boost/accumulators/statistics_fwd.hpp>
+#include <boost/accumulators/statistics/error_of.hpp>
+#include <boost/accumulators/statistics/variance.hpp>
+#include <boost/accumulators/statistics/count.hpp>
+
+namespace boost { namespace accumulators
+{
+
+namespace impl
+{
+ ///////////////////////////////////////////////////////////////////////////////
+ // error_of_mean_impl
+ template<typename Sample, typename Variance>
+ struct error_of_mean_impl
+ : accumulator_base
+ {
+ // for boost::result_of
+ typedef typename numeric::functional::average<Sample, std::size_t>::result_type result_type;
+
+ error_of_mean_impl(dont_care) {}
+
+ template<typename Args>
+ result_type result(Args const &args) const
+ {
+ using namespace std;
+ extractor<Variance> const variance = {};
+ return sqrt(numeric::average(variance(args), count(args) - 1));
+ }
+ };
+
+} // namespace impl
+
+///////////////////////////////////////////////////////////////////////////////
+// tag::error_of
+//
+namespace tag
+{
+ template<>
+ struct error_of<mean>
+ : depends_on<lazy_variance, count>
+ {
+ /// INTERNAL ONLY
+ ///
+ typedef accumulators::impl::error_of_mean_impl<mpl::_1, lazy_variance> impl;
+ };
+
+ template<>
+ struct error_of<immediate_mean>
+ : depends_on<variance, count>
+ {
+ /// INTERNAL ONLY
+ ///
+ typedef accumulators::impl::error_of_mean_impl<mpl::_1, variance> impl;
+ };
+}
+
+}} // namespace boost::accumulators
+
+#endif
=== added file 'boost/boost/accumulators/statistics/extended_p_square.hpp'
--- boost/boost/accumulators/statistics/extended_p_square.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/statistics/extended_p_square.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,293 @@
+///////////////////////////////////////////////////////////////////////////////
+// extended_p_square.hpp
+//
+// Copyright 2005 Daniel Egloff. 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)
+
+#ifndef BOOST_ACCUMULATORS_STATISTICS_EXTENDED_SINGLE_HPP_DE_01_01_2006
+#define BOOST_ACCUMULATORS_STATISTICS_EXTENDED_SINGLE_HPP_DE_01_01_2006
+
+#include <vector>
+#include <functional>
+#include <boost/range/begin.hpp>
+#include <boost/range/end.hpp>
+#include <boost/range/iterator_range.hpp>
+#include <boost/iterator/transform_iterator.hpp>
+#include <boost/iterator/counting_iterator.hpp>
+#include <boost/iterator/permutation_iterator.hpp>
+#include <boost/parameter/keyword.hpp>
+#include <boost/mpl/placeholders.hpp>
+#include <boost/accumulators/framework/accumulator_base.hpp>
+#include <boost/accumulators/framework/extractor.hpp>
+#include <boost/accumulators/numeric/functional.hpp>
+#include <boost/accumulators/framework/parameters/sample.hpp>
+#include <boost/accumulators/framework/depends_on.hpp>
+#include <boost/accumulators/statistics_fwd.hpp>
+#include <boost/accumulators/statistics/count.hpp>
+#include <boost/accumulators/statistics/times2_iterator.hpp>
+
+namespace boost { namespace accumulators
+{
+///////////////////////////////////////////////////////////////////////////////
+// probabilities named parameter
+//
+BOOST_PARAMETER_NESTED_KEYWORD(tag, extended_p_square_probabilities, probabilities)
+
+namespace impl
+{
+ ///////////////////////////////////////////////////////////////////////////////
+ // extended_p_square_impl
+ // multiple quantile estimation
+ /**
+ @brief Multiple quantile estimation with the extended \f$P^2\f$ algorithm
+
+ Extended \f$P^2\f$ algorithm for estimation of several quantiles without storing samples.
+ Assume that \f$m\f$ quantiles \f$\xi_{p_1}, \ldots, \xi_{p_m}\f$ are to be estimated.
+ Instead of storing the whole sample cumulative distribution, the algorithm maintains only
+ \f$m+2\f$ principal markers and \f$m+1\f$ middle markers, whose positions are updated
+ with each sample and whose heights are adjusted (if necessary) using a piecewise-parablic
+ formula. The heights of these central markers are the current estimates of the quantiles
+ and returned as an iterator range.
+
+ For further details, see
+
+ K. E. E. Raatikainen, Simultaneous estimation of several quantiles, Simulation, Volume 49,
+ Number 4 (October), 1986, p. 159-164.
+
+ The extended \f$ P^2 \f$ algorithm generalizess the \f$ P^2 \f$ algorithm of
+
+ R. Jain and I. Chlamtac, The P^2 algorithmus for dynamic calculation of quantiles and
+ histograms without storing observations, Communications of the ACM,
+ Volume 28 (October), Number 10, 1985, p. 1076-1085.
+
+ @param extended_p_square_probabilities A vector of quantile probabilities.
+ */
+ template<typename Sample>
+ struct extended_p_square_impl
+ : accumulator_base
+ {
+ typedef typename numeric::functional::average<Sample, std::size_t>::result_type float_type;
+ typedef std::vector<float_type> array_type;
+ // for boost::result_of
+ typedef iterator_range<
+ detail::lvalue_index_iterator<
+ permutation_iterator<
+ typename array_type::const_iterator
+ , detail::times2_iterator
+ >
+ >
+ > result_type;
+
+ template<typename Args>
+ extended_p_square_impl(Args const &args)
+ : probabilities(
+ boost::begin(args[extended_p_square_probabilities])
+ , boost::end(args[extended_p_square_probabilities])
+ )
+ , heights(2 * probabilities.size() + 3)
+ , actual_positions(heights.size())
+ , desired_positions(heights.size())
+ , positions_increments(heights.size())
+ {
+ std::size_t num_quantiles = this->probabilities.size();
+ std::size_t num_markers = this->heights.size();
+
+ for(std::size_t i = 0; i < num_markers; ++i)
+ {
+ this->actual_positions[i] = i + 1;
+ }
+
+ this->positions_increments[0] = 0.;
+ this->positions_increments[num_markers - 1] = 1.;
+
+ for(std::size_t i = 0; i < num_quantiles; ++i)
+ {
+ this->positions_increments[2 * i + 2] = probabilities[i];
+ }
+
+ for(std::size_t i = 0; i <= num_quantiles; ++i)
+ {
+ this->positions_increments[2 * i + 1] =
+ 0.5 * (this->positions_increments[2 * i] + this->positions_increments[2 * i + 2]);
+ }
+
+ for(std::size_t i = 0; i < num_markers; ++i)
+ {
+ this->desired_positions[i] = 1. + 2. * (num_quantiles + 1.) * this->positions_increments[i];
+ }
+ }
+
+ template<typename Args>
+ void operator ()(Args const &args)
+ {
+ std::size_t cnt = count(args);
+
+ // m+2 principal markers and m+1 middle markers
+ std::size_t num_markers = 2 * this->probabilities.size() + 3;
+
+ // first accumulate num_markers samples
+ if(cnt <= num_markers)
+ {
+ this->heights[cnt - 1] = args[sample];
+
+ // complete the initialization of heights by sorting
+ if(cnt == num_markers)
+ {
+ std::sort(this->heights.begin(), this->heights.end());
+ }
+ }
+ else
+ {
+ std::size_t sample_cell = 1;
+
+ // find cell k = sample_cell such that heights[k-1] <= sample < heights[k]
+ if(args[sample] < this->heights[0])
+ {
+ this->heights[0] = args[sample];
+ sample_cell = 1;
+ }
+ else if(args[sample] >= this->heights[num_markers - 1])
+ {
+ this->heights[num_markers - 1] = args[sample];
+ sample_cell = num_markers - 1;
+ }
+ else
+ {
+ typedef typename array_type::iterator iterator;
+ iterator it = std::upper_bound(
+ this->heights.begin()
+ , this->heights.end()
+ , args[sample]
+ );
+
+ sample_cell = std::distance(this->heights.begin(), it);
+ }
+
+ // update actual positions of all markers above sample_cell index
+ for(std::size_t i = sample_cell; i < num_markers; ++i)
+ {
+ ++this->actual_positions[i];
+ }
+
+ // update desired positions of all markers
+ for(std::size_t i = 0; i < num_markers; ++i)
+ {
+ this->desired_positions[i] += this->positions_increments[i];
+ }
+
+ // adjust heights and actual positions of markers 1 to num_markers-2 if necessary
+ for(std::size_t i = 1; i <= num_markers - 2; ++i)
+ {
+ // offset to desired position
+ float_type d = this->desired_positions[i] - this->actual_positions[i];
+
+ // offset to next position
+ float_type dp = this->actual_positions[i+1] - this->actual_positions[i];
+
+ // offset to previous position
+ float_type dm = this->actual_positions[i-1] - this->actual_positions[i];
+
+ // height ds
+ float_type hp = (this->heights[i+1] - this->heights[i]) / dp;
+ float_type hm = (this->heights[i-1] - this->heights[i]) / dm;
+
+ if((d >= 1 && dp > 1) || (d <= -1 && dm < -1))
+ {
+ short sign_d = static_cast<short>(d / std::abs(d));
+
+ float_type h = this->heights[i] + sign_d / (dp - dm) * ((sign_d - dm)*hp
+ + (dp - sign_d) * hm);
+
+ // try adjusting heights[i] using p-squared formula
+ if(this->heights[i - 1] < h && h < this->heights[i + 1])
+ {
+ this->heights[i] = h;
+ }
+ else
+ {
+ // use linear formula
+ if(d > 0)
+ {
+ this->heights[i] += hp;
+ }
+ if(d < 0)
+ {
+ this->heights[i] -= hm;
+ }
+ }
+ this->actual_positions[i] += sign_d;
+ }
+ }
+ }
+ }
+
+ result_type result(dont_care) const
+ {
+ // for i in [1,probabilities.size()], return heights[i * 2]
+ detail::times2_iterator idx_begin = detail::make_times2_iterator(1);
+ detail::times2_iterator idx_end = detail::make_times2_iterator(this->probabilities.size() + 1);
+
+ return result_type(
+ make_permutation_iterator(this->heights.begin(), idx_begin)
+ , make_permutation_iterator(this->heights.begin(), idx_end)
+ );
+ }
+
+ private:
+ array_type probabilities; // the quantile probabilities
+ array_type heights; // q_i
+ array_type actual_positions; // n_i
+ array_type desired_positions; // d_i
+ array_type positions_increments; // f_i
+ };
+
+} // namespace impl
+
+///////////////////////////////////////////////////////////////////////////////
+// tag::extended_p_square
+//
+namespace tag
+{
+ struct extended_p_square
+ : depends_on<count>
+ , extended_p_square_probabilities
+ {
+ typedef accumulators::impl::extended_p_square_impl<mpl::_1> impl;
+
+ #ifdef BOOST_ACCUMULATORS_DOXYGEN_INVOKED
+ /// tag::extended_p_square::probabilities named paramter
+ static boost::parameter::keyword<tag::probabilities> const probabilities;
+ #endif
+ };
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// extract::extended_p_square
+//
+namespace extract
+{
+ extractor<tag::extended_p_square> const extended_p_square = {};
+
+ BOOST_ACCUMULATORS_IGNORE_GLOBAL(extended_p_square)
+}
+
+using extract::extended_p_square;
+
+// So that extended_p_square can be automatically substituted with
+// weighted_extended_p_square when the weight parameter is non-void
+template<>
+struct as_weighted_feature<tag::extended_p_square>
+{
+ typedef tag::weighted_extended_p_square type;
+};
+
+template<>
+struct feature_of<tag::weighted_extended_p_square>
+ : feature_of<tag::extended_p_square>
+{
+};
+
+}} // namespace boost::accumulators
+
+#endif
=== added file 'boost/boost/accumulators/statistics/extended_p_square_quantile.hpp'
--- boost/boost/accumulators/statistics/extended_p_square_quantile.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/statistics/extended_p_square_quantile.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,319 @@
+///////////////////////////////////////////////////////////////////////////////
+// extended_p_square_quantile.hpp
+//
+// Copyright 2005 Daniel Egloff. 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)
+
+#ifndef BOOST_ACCUMULATORS_STATISTICS_EXTENDED_SINGLE_QUANTILE_HPP_DE_01_01_2006
+#define BOOST_ACCUMULATORS_STATISTICS_EXTENDED_SINGLE_QUANTILE_HPP_DE_01_01_2006
+
+#include <vector>
+#include <functional>
+#include <boost/range/begin.hpp>
+#include <boost/range/end.hpp>
+#include <boost/range/iterator_range.hpp>
+#include <boost/iterator/transform_iterator.hpp>
+#include <boost/iterator/counting_iterator.hpp>
+#include <boost/iterator/permutation_iterator.hpp>
+#include <boost/parameter/keyword.hpp>
+#include <boost/mpl/placeholders.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/accumulators/framework/accumulator_base.hpp>
+#include <boost/accumulators/framework/extractor.hpp>
+#include <boost/accumulators/numeric/functional.hpp>
+#include <boost/accumulators/framework/parameters/sample.hpp>
+#include <boost/accumulators/framework/depends_on.hpp>
+#include <boost/accumulators/statistics_fwd.hpp>
+#include <boost/accumulators/statistics/count.hpp>
+#include <boost/accumulators/statistics/parameters/quantile_probability.hpp>
+#include <boost/accumulators/statistics/extended_p_square.hpp>
+#include <boost/accumulators/statistics/weighted_extended_p_square.hpp>
+#include <boost/accumulators/statistics/times2_iterator.hpp>
+
+#ifdef _MSC_VER
+# pragma warning(push)
+# pragma warning(disable: 4127) // conditional expression is constant
+#endif
+
+namespace boost { namespace accumulators
+{
+
+namespace impl
+{
+ ///////////////////////////////////////////////////////////////////////////////
+ // extended_p_square_quantile_impl
+ // single quantile estimation
+ /**
+ @brief Quantile estimation using the extended \f$P^2\f$ algorithm for weighted and unweighted samples
+
+ Uses the quantile estimates calculated by the extended \f$P^2\f$ algorithm to compute
+ intermediate quantile estimates by means of quadratic interpolation.
+
+ @param quantile_probability The probability of the quantile to be estimated.
+ */
+ template<typename Sample, typename Impl1, typename Impl2> // Impl1: weighted/unweighted // Impl2: linear/quadratic
+ struct extended_p_square_quantile_impl
+ : accumulator_base
+ {
+ typedef typename numeric::functional::average<Sample, std::size_t>::result_type float_type;
+ typedef std::vector<float_type> array_type;
+ typedef iterator_range<
+ detail::lvalue_index_iterator<
+ permutation_iterator<
+ typename array_type::const_iterator
+ , detail::times2_iterator
+ >
+ >
+ > range_type;
+ // for boost::result_of
+ typedef float_type result_type;
+
+ template<typename Args>
+ extended_p_square_quantile_impl(Args const &args)
+ : probabilities(
+ boost::begin(args[extended_p_square_probabilities])
+ , boost::end(args[extended_p_square_probabilities])
+ )
+ {
+ }
+
+ template<typename Args>
+ result_type result(Args const &args) const
+ {
+ typedef
+ typename mpl::if_<
+ is_same<Impl1, weighted>
+ , tag::weighted_extended_p_square
+ , tag::extended_p_square
+ >::type
+ extended_p_square_tag;
+
+ extractor<extended_p_square_tag> const some_extended_p_square = {};
+
+ array_type heights(some_extended_p_square(args).size());
+ std::copy(some_extended_p_square(args).begin(), some_extended_p_square(args).end(), heights.begin());
+
+ this->probability = args[quantile_probability];
+
+ typename array_type::const_iterator iter_probs = std::lower_bound(this->probabilities.begin(), this->probabilities.end(), this->probability);
+ std::size_t dist = std::distance(this->probabilities.begin(), iter_probs);
+ typename array_type::const_iterator iter_heights = heights.begin() + dist;
+
+ // If this->probability is not in a valid range return NaN or throw exception
+ if (this->probability < *this->probabilities.begin() || this->probability > *(this->probabilities.end() - 1))
+ {
+ if (std::numeric_limits<result_type>::has_quiet_NaN)
+ {
+ return std::numeric_limits<result_type>::quiet_NaN();
+ }
+ else
+ {
+ std::ostringstream msg;
+ msg << "probability = " << this->probability << " is not in valid range (";
+ msg << *this->probabilities.begin() << ", " << *(this->probabilities.end() - 1) << ")";
+ boost::throw_exception(std::runtime_error(msg.str()));
+ return Sample(0);
+ }
+
+ }
+
+ if (*iter_probs == this->probability)
+ {
+ return heights[dist];
+ }
+ else
+ {
+ result_type res;
+
+ if (is_same<Impl2, linear>::value)
+ {
+ /////////////////////////////////////////////////////////////////////////////////
+ // LINEAR INTERPOLATION
+ //
+ float_type p1 = *iter_probs;
+ float_type p0 = *(iter_probs - 1);
+ float_type h1 = *iter_heights;
+ float_type h0 = *(iter_heights - 1);
+
+ float_type a = numeric::average(h1 - h0, p1 - p0);
+ float_type b = h1 - p1 * a;
+
+ res = a * this->probability + b;
+ }
+ else
+ {
+ /////////////////////////////////////////////////////////////////////////////////
+ // QUADRATIC INTERPOLATION
+ //
+ float_type p0, p1, p2;
+ float_type h0, h1, h2;
+
+ if ( (dist == 1 || *iter_probs - this->probability <= this->probability - *(iter_probs - 1) ) && dist != this->probabilities.size() - 1 )
+ {
+ p0 = *(iter_probs - 1);
+ p1 = *iter_probs;
+ p2 = *(iter_probs + 1);
+ h0 = *(iter_heights - 1);
+ h1 = *iter_heights;
+ h2 = *(iter_heights + 1);
+ }
+ else
+ {
+ p0 = *(iter_probs - 2);
+ p1 = *(iter_probs - 1);
+ p2 = *iter_probs;
+ h0 = *(iter_heights - 2);
+ h1 = *(iter_heights - 1);
+ h2 = *iter_heights;
+ }
+
+ float_type hp21 = numeric::average(h2 - h1, p2 - p1);
+ float_type hp10 = numeric::average(h1 - h0, p1 - p0);
+ float_type p21 = numeric::average(p2 * p2 - p1 * p1, p2 - p1);
+ float_type p10 = numeric::average(p1 * p1 - p0 * p0, p1 - p0);
+
+ float_type a = numeric::average(hp21 - hp10, p21 - p10);
+ float_type b = hp21 - a * p21;
+ float_type c = h2 - a * p2 * p2 - b * p2;
+
+ res = a * this->probability * this-> probability + b * this->probability + c;
+ }
+
+ return res;
+ }
+
+ }
+ private:
+
+ array_type probabilities;
+ mutable float_type probability;
+
+ };
+
+} // namespace impl
+
+///////////////////////////////////////////////////////////////////////////////
+// tag::extended_p_square_quantile
+//
+namespace tag
+{
+ struct extended_p_square_quantile
+ : depends_on<extended_p_square>
+ {
+ typedef accumulators::impl::extended_p_square_quantile_impl<mpl::_1, unweighted, linear> impl;
+ };
+ struct extended_p_square_quantile_quadratic
+ : depends_on<extended_p_square>
+ {
+ typedef accumulators::impl::extended_p_square_quantile_impl<mpl::_1, unweighted, quadratic> impl;
+ };
+ struct weighted_extended_p_square_quantile
+ : depends_on<weighted_extended_p_square>
+ {
+ typedef accumulators::impl::extended_p_square_quantile_impl<mpl::_1, weighted, linear> impl;
+ };
+ struct weighted_extended_p_square_quantile_quadratic
+ : depends_on<weighted_extended_p_square>
+ {
+ typedef accumulators::impl::extended_p_square_quantile_impl<mpl::_1, weighted, quadratic> impl;
+ };
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// extract::extended_p_square_quantile
+// extract::weighted_extended_p_square_quantile
+//
+namespace extract
+{
+ extractor<tag::extended_p_square_quantile> const extended_p_square_quantile = {};
+ extractor<tag::extended_p_square_quantile_quadratic> const extended_p_square_quantile_quadratic = {};
+ extractor<tag::weighted_extended_p_square_quantile> const weighted_extended_p_square_quantile = {};
+ extractor<tag::weighted_extended_p_square_quantile_quadratic> const weighted_extended_p_square_quantile_quadratic = {};
+
+ BOOST_ACCUMULATORS_IGNORE_GLOBAL(extended_p_square_quantile)
+ BOOST_ACCUMULATORS_IGNORE_GLOBAL(extended_p_square_quantile_quadratic)
+ BOOST_ACCUMULATORS_IGNORE_GLOBAL(weighted_extended_p_square_quantile)
+ BOOST_ACCUMULATORS_IGNORE_GLOBAL(weighted_extended_p_square_quantile_quadratic)
+}
+
+using extract::extended_p_square_quantile;
+using extract::extended_p_square_quantile_quadratic;
+using extract::weighted_extended_p_square_quantile;
+using extract::weighted_extended_p_square_quantile_quadratic;
+
+// extended_p_square_quantile(linear) -> extended_p_square_quantile
+template<>
+struct as_feature<tag::extended_p_square_quantile(linear)>
+{
+ typedef tag::extended_p_square_quantile type;
+};
+
+// extended_p_square_quantile(quadratic) -> extended_p_square_quantile_quadratic
+template<>
+struct as_feature<tag::extended_p_square_quantile(quadratic)>
+{
+ typedef tag::extended_p_square_quantile_quadratic type;
+};
+
+// weighted_extended_p_square_quantile(linear) -> weighted_extended_p_square_quantile
+template<>
+struct as_feature<tag::weighted_extended_p_square_quantile(linear)>
+{
+ typedef tag::weighted_extended_p_square_quantile type;
+};
+
+// weighted_extended_p_square_quantile(quadratic) -> weighted_extended_p_square_quantile_quadratic
+template<>
+struct as_feature<tag::weighted_extended_p_square_quantile(quadratic)>
+{
+ typedef tag::weighted_extended_p_square_quantile_quadratic type;
+};
+
+// for the purposes of feature-based dependency resolution,
+// extended_p_square_quantile and weighted_extended_p_square_quantile
+// provide the same feature as quantile
+template<>
+struct feature_of<tag::extended_p_square_quantile>
+ : feature_of<tag::quantile>
+{
+};
+template<>
+struct feature_of<tag::extended_p_square_quantile_quadratic>
+ : feature_of<tag::quantile>
+{
+};
+// So that extended_p_square_quantile can be automatically substituted with
+// weighted_extended_p_square_quantile when the weight parameter is non-void
+template<>
+struct as_weighted_feature<tag::extended_p_square_quantile>
+{
+ typedef tag::weighted_extended_p_square_quantile type;
+};
+
+template<>
+struct feature_of<tag::weighted_extended_p_square_quantile>
+ : feature_of<tag::extended_p_square_quantile>
+{
+};
+
+// So that extended_p_square_quantile_quadratic can be automatically substituted with
+// weighted_extended_p_square_quantile_quadratic when the weight parameter is non-void
+template<>
+struct as_weighted_feature<tag::extended_p_square_quantile_quadratic>
+{
+ typedef tag::weighted_extended_p_square_quantile_quadratic type;
+};
+template<>
+struct feature_of<tag::weighted_extended_p_square_quantile_quadratic>
+ : feature_of<tag::extended_p_square_quantile_quadratic>
+{
+};
+
+}} // namespace boost::accumulators
+
+#ifdef _MSC_VER
+# pragma warning(pop)
+#endif
+
+#endif
=== added file 'boost/boost/accumulators/statistics/kurtosis.hpp'
--- boost/boost/accumulators/statistics/kurtosis.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/statistics/kurtosis.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,112 @@
+///////////////////////////////////////////////////////////////////////////////
+// kurtosis.hpp
+//
+// Copyright 2006 Olivier Gygi, Daniel Egloff. 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)
+
+#ifndef BOOST_ACCUMULATORS_STATISTICS_KURTOSIS_HPP_EAN_28_10_2005
+#define BOOST_ACCUMULATORS_STATISTICS_KURTOSIS_HPP_EAN_28_10_2005
+
+#include <limits>
+#include <boost/mpl/placeholders.hpp>
+#include <boost/accumulators/framework/accumulator_base.hpp>
+#include <boost/accumulators/framework/extractor.hpp>
+#include <boost/accumulators/framework/parameters/sample.hpp>
+#include <boost/accumulators/numeric/functional.hpp>
+#include <boost/accumulators/framework/depends_on.hpp>
+#include <boost/accumulators/statistics/mean.hpp>
+#include <boost/accumulators/statistics/moment.hpp>
+
+namespace boost { namespace accumulators
+{
+
+namespace impl
+{
+ ///////////////////////////////////////////////////////////////////////////////
+ // kurtosis_impl
+ /**
+ @brief Kurtosis estimation
+
+ The kurtosis of a sample distribution is defined as the ratio of the 4th central moment and the square of the 2nd central
+ moment (the variance) of the samples, minus 3. The term \f$ -3 \f$ is added in order to ensure that the normal distribution
+ has zero kurtosis. The kurtosis can also be expressed by the simple moments:
+
+ \f[
+ \hat{g}_2 =
+ \frac
+ {\widehat{m}_n^{(4)}-4\widehat{m}_n^{(3)}\hat{\mu}_n+6\widehat{m}_n^{(2)}\hat{\mu}_n^2-3\hat{\mu}_n^4}
+ {\left(\widehat{m}_n^{(2)} - \hat{\mu}_n^{2}\right)^2} - 3,
+ \f]
+
+ where \f$ \widehat{m}_n^{(i)} \f$ are the \f$ i \f$-th moment and \f$ \hat{\mu}_n \f$ the mean (first moment) of the
+ \f$ n \f$ samples.
+ */
+ template<typename Sample>
+ struct kurtosis_impl
+ : accumulator_base
+ {
+ // for boost::result_of
+ typedef typename numeric::functional::average<Sample, Sample>::result_type result_type;
+
+ kurtosis_impl(dont_care) {}
+
+ template<typename Args>
+ result_type result(Args const &args) const
+ {
+ return numeric::average(
+ accumulators::moment<4>(args)
+ - 4. * accumulators::moment<3>(args) * mean(args)
+ + 6. * accumulators::moment<2>(args) * mean(args) * mean(args)
+ - 3. * mean(args) * mean(args) * mean(args) * mean(args)
+ , ( accumulators::moment<2>(args) - mean(args) * mean(args) )
+ * ( accumulators::moment<2>(args) - mean(args) * mean(args) )
+ ) - 3.;
+ }
+ };
+
+} // namespace impl
+
+///////////////////////////////////////////////////////////////////////////////
+// tag::kurtosis
+//
+namespace tag
+{
+ struct kurtosis
+ : depends_on<mean, moment<2>, moment<3>, moment<4> >
+ {
+ /// INTERNAL ONLY
+ ///
+ typedef accumulators::impl::kurtosis_impl<mpl::_1> impl;
+ };
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// extract::kurtosis
+//
+namespace extract
+{
+ extractor<tag::kurtosis> const kurtosis = {};
+
+ BOOST_ACCUMULATORS_IGNORE_GLOBAL(kurtosis)
+}
+
+using extract::kurtosis;
+
+// So that kurtosis can be automatically substituted with
+// weighted_kurtosis when the weight parameter is non-void
+template<>
+struct as_weighted_feature<tag::kurtosis>
+{
+ typedef tag::weighted_kurtosis type;
+};
+
+template<>
+struct feature_of<tag::weighted_kurtosis>
+ : feature_of<tag::kurtosis>
+{
+};
+
+}} // namespace boost::accumulators
+
+#endif
=== added file 'boost/boost/accumulators/statistics/max.hpp'
--- boost/boost/accumulators/statistics/max.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/statistics/max.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,85 @@
+///////////////////////////////////////////////////////////////////////////////
+// max.hpp
+//
+// Copyright 2005 Eric Niebler. 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)
+
+#ifndef BOOST_ACCUMULATORS_STATISTICS_MAX_HPP_EAN_28_10_2005
+#define BOOST_ACCUMULATORS_STATISTICS_MAX_HPP_EAN_28_10_2005
+
+#include <limits>
+#include <boost/mpl/placeholders.hpp>
+#include <boost/accumulators/framework/accumulator_base.hpp>
+#include <boost/accumulators/framework/extractor.hpp>
+#include <boost/accumulators/framework/parameters/sample.hpp>
+#include <boost/accumulators/numeric/functional.hpp>
+#include <boost/accumulators/framework/depends_on.hpp>
+#include <boost/accumulators/statistics_fwd.hpp>
+
+namespace boost { namespace accumulators
+{
+
+namespace impl
+{
+ ///////////////////////////////////////////////////////////////////////////////
+ // max_impl
+ template<typename Sample>
+ struct max_impl
+ : accumulator_base
+ {
+ // for boost::result_of
+ typedef Sample result_type;
+
+ template<typename Args>
+ max_impl(Args const &args)
+ : max_(numeric::as_min(args[sample | Sample()]))
+ {
+ }
+
+ template<typename Args>
+ void operator ()(Args const &args)
+ {
+ numeric::max_assign(this->max_, args[sample]);
+ }
+
+ result_type result(dont_care) const
+ {
+ return this->max_;
+ }
+
+ private:
+ Sample max_;
+ };
+
+} // namespace impl
+
+///////////////////////////////////////////////////////////////////////////////
+// tag::max
+//
+namespace tag
+{
+ struct max
+ : depends_on<>
+ {
+ /// INTERNAL ONLY
+ ///
+ typedef accumulators::impl::max_impl<mpl::_1> impl;
+ };
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// extract::max
+//
+namespace extract
+{
+ extractor<tag::max> const max = {};
+
+ BOOST_ACCUMULATORS_IGNORE_GLOBAL(max)
+}
+
+using extract::max;
+
+}} // namespace boost::accumulators
+
+#endif
=== added file 'boost/boost/accumulators/statistics/mean.hpp'
--- boost/boost/accumulators/statistics/mean.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/statistics/mean.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,298 @@
+///////////////////////////////////////////////////////////////////////////////
+// mean.hpp
+//
+// Copyright 2005 Eric Niebler. 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)
+
+#ifndef BOOST_ACCUMULATORS_STATISTICS_MEAN_HPP_EAN_28_10_2005
+#define BOOST_ACCUMULATORS_STATISTICS_MEAN_HPP_EAN_28_10_2005
+
+#include <boost/mpl/placeholders.hpp>
+#include <boost/accumulators/framework/accumulator_base.hpp>
+#include <boost/accumulators/framework/extractor.hpp>
+#include <boost/accumulators/numeric/functional.hpp>
+#include <boost/accumulators/framework/parameters/sample.hpp>
+#include <boost/accumulators/framework/depends_on.hpp>
+#include <boost/accumulators/statistics_fwd.hpp>
+#include <boost/accumulators/statistics/count.hpp>
+#include <boost/accumulators/statistics/sum.hpp>
+
+namespace boost { namespace accumulators
+{
+
+namespace impl
+{
+ ///////////////////////////////////////////////////////////////////////////////
+ // mean_impl
+ // lazy, by default
+ template<typename Sample, typename SumFeature>
+ struct mean_impl
+ : accumulator_base
+ {
+ // for boost::result_of
+ typedef typename numeric::functional::average<Sample, std::size_t>::result_type result_type;
+
+ mean_impl(dont_care) {}
+
+ template<typename Args>
+ result_type result(Args const &args) const
+ {
+ extractor<SumFeature> sum;
+ return numeric::average(sum(args), count(args));
+ }
+ };
+
+ template<typename Sample, typename Tag>
+ struct immediate_mean_impl
+ : accumulator_base
+ {
+ // for boost::result_of
+ typedef typename numeric::functional::average<Sample, std::size_t>::result_type result_type;
+
+ template<typename Args>
+ immediate_mean_impl(Args const &args)
+ : mean(numeric::average(args[sample | Sample()], numeric::one<std::size_t>::value))
+ {
+ }
+
+ template<typename Args>
+ void operator ()(Args const &args)
+ {
+ std::size_t cnt = count(args);
+ this->mean = numeric::average(
+ (this->mean * (cnt - 1)) + args[parameter::keyword<Tag>::get()]
+ , cnt
+ );
+ }
+
+ result_type result(dont_care) const
+ {
+ return this->mean;
+ }
+
+ private:
+ result_type mean;
+ };
+
+} // namespace impl
+
+///////////////////////////////////////////////////////////////////////////////
+// tag::mean
+// tag::immediate_mean
+// tag::mean_of_weights
+// tag::immediate_mean_of_weights
+// tag::mean_of_variates
+// tag::immediate_mean_of_variates
+//
+namespace tag
+{
+ struct mean
+ : depends_on<count, sum>
+ {
+ /// INTERNAL ONLY
+ ///
+ typedef accumulators::impl::mean_impl<mpl::_1, sum> impl;
+ };
+ struct immediate_mean
+ : depends_on<count>
+ {
+ /// INTERNAL ONLY
+ ///
+ typedef accumulators::impl::immediate_mean_impl<mpl::_1, tag::sample> impl;
+ };
+ struct mean_of_weights
+ : depends_on<count, sum_of_weights>
+ {
+ typedef mpl::true_ is_weight_accumulator;
+ /// INTERNAL ONLY
+ ///
+ typedef accumulators::impl::mean_impl<mpl::_2, sum_of_weights> impl;
+ };
+ struct immediate_mean_of_weights
+ : depends_on<count>
+ {
+ typedef mpl::true_ is_weight_accumulator;
+ /// INTERNAL ONLY
+ ///
+ typedef accumulators::impl::immediate_mean_impl<mpl::_2, tag::weight> impl;
+ };
+ template<typename VariateType, typename VariateTag>
+ struct mean_of_variates
+ : depends_on<count, sum_of_variates<VariateType, VariateTag> >
+ {
+ /// INTERNAL ONLY
+ ///
+ typedef mpl::always<accumulators::impl::mean_impl<VariateType, sum_of_variates<VariateType, VariateTag> > > impl;
+ };
+ template<typename VariateType, typename VariateTag>
+ struct immediate_mean_of_variates
+ : depends_on<count>
+ {
+ /// INTERNAL ONLY
+ ///
+ typedef mpl::always<accumulators::impl::immediate_mean_impl<VariateType, VariateTag> > impl;
+ };
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// extract::mean
+// extract::mean_of_weights
+// extract::mean_of_variates
+//
+namespace extract
+{
+ extractor<tag::mean> const mean = {};
+ extractor<tag::mean_of_weights> const mean_of_weights = {};
+ BOOST_ACCUMULATORS_DEFINE_EXTRACTOR(tag, mean_of_variates, (typename)(typename))
+
+ BOOST_ACCUMULATORS_IGNORE_GLOBAL(mean)
+ BOOST_ACCUMULATORS_IGNORE_GLOBAL(mean_of_weights)
+}
+
+using extract::mean;
+using extract::mean_of_weights;
+using extract::mean_of_variates;
+
+// mean(lazy) -> mean
+template<>
+struct as_feature<tag::mean(lazy)>
+{
+ typedef tag::mean type;
+};
+
+// mean(immediate) -> immediate_mean
+template<>
+struct as_feature<tag::mean(immediate)>
+{
+ typedef tag::immediate_mean type;
+};
+
+// mean_of_weights(lazy) -> mean_of_weights
+template<>
+struct as_feature<tag::mean_of_weights(lazy)>
+{
+ typedef tag::mean_of_weights type;
+};
+
+// mean_of_weights(immediate) -> immediate_mean_of_weights
+template<>
+struct as_feature<tag::mean_of_weights(immediate)>
+{
+ typedef tag::immediate_mean_of_weights type;
+};
+
+// mean_of_variates<VariateType, VariateTag>(lazy) -> mean_of_variates<VariateType, VariateTag>
+template<typename VariateType, typename VariateTag>
+struct as_feature<tag::mean_of_variates<VariateType, VariateTag>(lazy)>
+{
+ typedef tag::mean_of_variates<VariateType, VariateTag> type;
+};
+
+// mean_of_variates<VariateType, VariateTag>(immediate) -> immediate_mean_of_variates<VariateType, VariateTag>
+template<typename VariateType, typename VariateTag>
+struct as_feature<tag::mean_of_variates<VariateType, VariateTag>(immediate)>
+{
+ typedef tag::immediate_mean_of_variates<VariateType, VariateTag> type;
+};
+
+// for the purposes of feature-based dependency resolution,
+// immediate_mean provides the same feature as mean
+template<>
+struct feature_of<tag::immediate_mean>
+ : feature_of<tag::mean>
+{
+};
+
+// for the purposes of feature-based dependency resolution,
+// immediate_mean provides the same feature as mean
+template<>
+struct feature_of<tag::immediate_mean_of_weights>
+ : feature_of<tag::mean_of_weights>
+{
+};
+
+// for the purposes of feature-based dependency resolution,
+// immediate_mean provides the same feature as mean
+template<typename VariateType, typename VariateTag>
+struct feature_of<tag::immediate_mean_of_variates<VariateType, VariateTag> >
+ : feature_of<tag::mean_of_variates<VariateType, VariateTag> >
+{
+};
+
+// So that mean can be automatically substituted with
+// weighted_mean when the weight parameter is non-void.
+template<>
+struct as_weighted_feature<tag::mean>
+{
+ typedef tag::weighted_mean type;
+};
+
+template<>
+struct feature_of<tag::weighted_mean>
+ : feature_of<tag::mean>
+{};
+
+// So that immediate_mean can be automatically substituted with
+// immediate_weighted_mean when the weight parameter is non-void.
+template<>
+struct as_weighted_feature<tag::immediate_mean>
+{
+ typedef tag::immediate_weighted_mean type;
+};
+
+template<>
+struct feature_of<tag::immediate_weighted_mean>
+ : feature_of<tag::immediate_mean>
+{};
+
+// So that mean_of_weights<> can be automatically substituted with
+// weighted_mean_of_variates<> when the weight parameter is non-void.
+template<typename VariateType, typename VariateTag>
+struct as_weighted_feature<tag::mean_of_variates<VariateType, VariateTag> >
+{
+ typedef tag::weighted_mean_of_variates<VariateType, VariateTag> type;
+};
+
+template<typename VariateType, typename VariateTag>
+struct feature_of<tag::weighted_mean_of_variates<VariateType, VariateTag> >
+ : feature_of<tag::mean_of_variates<VariateType, VariateTag> >
+{
+};
+
+// So that immediate_mean_of_weights<> can be automatically substituted with
+// immediate_weighted_mean_of_variates<> when the weight parameter is non-void.
+template<typename VariateType, typename VariateTag>
+struct as_weighted_feature<tag::immediate_mean_of_variates<VariateType, VariateTag> >
+{
+ typedef tag::immediate_weighted_mean_of_variates<VariateType, VariateTag> type;
+};
+
+template<typename VariateType, typename VariateTag>
+struct feature_of<tag::immediate_weighted_mean_of_variates<VariateType, VariateTag> >
+ : feature_of<tag::immediate_mean_of_variates<VariateType, VariateTag> >
+{
+};
+
+////////////////////////////////////////////////////////////////////////////
+//// droppable_accumulator<mean_impl>
+//// need to specialize droppable lazy mean to cache the result at the
+//// point the accumulator is dropped.
+///// INTERNAL ONLY
+/////
+//template<typename Sample, typename SumFeature>
+//struct droppable_accumulator<impl::mean_impl<Sample, SumFeature> >
+// : droppable_accumulator_base<
+// with_cached_result<impl::mean_impl<Sample, SumFeature> >
+// >
+//{
+// template<typename Args>
+// droppable_accumulator(Args const &args)
+// : droppable_accumulator::base(args)
+// {
+// }
+//};
+
+}} // namespace boost::accumulators
+
+#endif
=== added file 'boost/boost/accumulators/statistics/median.hpp'
--- boost/boost/accumulators/statistics/median.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/statistics/median.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,301 @@
+///////////////////////////////////////////////////////////////////////////////
+// median.hpp
+//
+// Copyright 2006 Eric Niebler, Olivier Gygi. 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)
+
+#ifndef BOOST_ACCUMULATORS_STATISTICS_MEDIAN_HPP_EAN_28_10_2005
+#define BOOST_ACCUMULATORS_STATISTICS_MEDIAN_HPP_EAN_28_10_2005
+
+#include <boost/mpl/placeholders.hpp>
+#include <boost/range/iterator_range.hpp>
+#include <boost/accumulators/framework/accumulator_base.hpp>
+#include <boost/accumulators/framework/extractor.hpp>
+#include <boost/accumulators/numeric/functional.hpp>
+#include <boost/accumulators/framework/parameters/sample.hpp>
+#include <boost/accumulators/framework/depends_on.hpp>
+#include <boost/accumulators/statistics_fwd.hpp>
+#include <boost/accumulators/statistics/count.hpp>
+#include <boost/accumulators/statistics/p_square_quantile.hpp>
+#include <boost/accumulators/statistics/density.hpp>
+#include <boost/accumulators/statistics/p_square_cumulative_distribution.hpp>
+
+namespace boost { namespace accumulators
+{
+
+namespace impl
+{
+ ///////////////////////////////////////////////////////////////////////////////
+ // median_impl
+ //
+ /**
+ @brief Median estimation based on the \f$P^2\f$ quantile estimator
+
+ The \f$P^2\f$ algorithm is invoked with a quantile probability of 0.5.
+ */
+ template<typename Sample>
+ struct median_impl
+ : accumulator_base
+ {
+ // for boost::result_of
+ typedef typename numeric::functional::average<Sample, std::size_t>::result_type result_type;
+
+ median_impl(dont_care) {}
+
+ template<typename Args>
+ result_type result(Args const &args) const
+ {
+ return p_square_quantile_for_median(args);
+ }
+ };
+ ///////////////////////////////////////////////////////////////////////////////
+ // with_density_median_impl
+ //
+ /**
+ @brief Median estimation based on the density estimator
+
+ The algorithm determines the bin in which the \f$0.5*cnt\f$-th sample lies, \f$cnt\f$ being
+ the total number of samples. It returns the approximate horizontal position of this sample,
+ based on a linear interpolation inside the bin.
+ */
+ template<typename Sample>
+ struct with_density_median_impl
+ : accumulator_base
+ {
+ typedef typename numeric::functional::average<Sample, std::size_t>::result_type float_type;
+ typedef std::vector<std::pair<float_type, float_type> > histogram_type;
+ typedef iterator_range<typename histogram_type::iterator> range_type;
+ // for boost::result_of
+ typedef float_type result_type;
+
+ template<typename Args>
+ with_density_median_impl(Args const &args)
+ : sum(numeric::average(args[sample | Sample()], (std::size_t)1))
+ , is_dirty(true)
+ {
+ }
+
+ void operator ()(dont_care)
+ {
+ this->is_dirty = true;
+ }
+
+
+ template<typename Args>
+ result_type result(Args const &args) const
+ {
+ if (this->is_dirty)
+ {
+ this->is_dirty = false;
+
+ std::size_t cnt = count(args);
+ range_type histogram = density(args);
+ typename range_type::iterator it = histogram.begin();
+ while (this->sum < 0.5 * cnt)
+ {
+ this->sum += it->second * cnt;
+ ++it;
+ }
+ --it;
+ float_type over = numeric::average(this->sum - 0.5 * cnt, it->second * cnt);
+ this->median = it->first * over + (it + 1)->first * (1. - over);
+ }
+
+ return this->median;
+ }
+
+ private:
+ mutable float_type sum;
+ mutable bool is_dirty;
+ mutable float_type median;
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // with_p_square_cumulative_distribution_median_impl
+ //
+ /**
+ @brief Median estimation based on the \f$P^2\f$ cumulative distribution estimator
+
+ The algorithm determines the first (leftmost) bin with a height exceeding 0.5. It
+ returns the approximate horizontal position of where the cumulative distribution
+ equals 0.5, based on a linear interpolation inside the bin.
+ */
+ template<typename Sample>
+ struct with_p_square_cumulative_distribution_median_impl
+ : accumulator_base
+ {
+ typedef typename numeric::functional::average<Sample, std::size_t>::result_type float_type;
+ typedef std::vector<std::pair<float_type, float_type> > histogram_type;
+ typedef iterator_range<typename histogram_type::iterator> range_type;
+ // for boost::result_of
+ typedef float_type result_type;
+
+ with_p_square_cumulative_distribution_median_impl(dont_care)
+ : is_dirty(true)
+ {
+ }
+
+ void operator ()(dont_care)
+ {
+ this->is_dirty = true;
+ }
+
+ template<typename Args>
+ result_type result(Args const &args) const
+ {
+ if (this->is_dirty)
+ {
+ this->is_dirty = false;
+
+ range_type histogram = p_square_cumulative_distribution(args);
+ typename range_type::iterator it = histogram.begin();
+ while (it->second < 0.5)
+ {
+ ++it;
+ }
+ float_type over = numeric::average(it->second - 0.5, it->second - (it - 1)->second);
+ this->median = it->first * over + (it + 1)->first * ( 1. - over );
+ }
+
+ return this->median;
+ }
+ private:
+
+ mutable bool is_dirty;
+ mutable float_type median;
+ };
+
+} // namespace impl
+
+///////////////////////////////////////////////////////////////////////////////
+// tag::median
+// tag::with_densisty_median
+// tag::with_p_square_cumulative_distribution_median
+//
+namespace tag
+{
+ struct median
+ : depends_on<p_square_quantile_for_median>
+ {
+ /// INTERNAL ONLY
+ ///
+ typedef accumulators::impl::median_impl<mpl::_1> impl;
+ };
+ struct with_density_median
+ : depends_on<count, density>
+ {
+ /// INTERNAL ONLY
+ ///
+ typedef accumulators::impl::with_density_median_impl<mpl::_1> impl;
+ };
+ struct with_p_square_cumulative_distribution_median
+ : depends_on<p_square_cumulative_distribution>
+ {
+ /// INTERNAL ONLY
+ ///
+ typedef accumulators::impl::with_p_square_cumulative_distribution_median_impl<mpl::_1> impl;
+ };
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// extract::median
+// extract::with_density_median
+// extract::with_p_square_cumulative_distribution_median
+//
+namespace extract
+{
+ extractor<tag::median> const median = {};
+ extractor<tag::with_density_median> const with_density_median = {};
+ extractor<tag::with_p_square_cumulative_distribution_median> const with_p_square_cumulative_distribution_median = {};
+
+ BOOST_ACCUMULATORS_IGNORE_GLOBAL(median)
+ BOOST_ACCUMULATORS_IGNORE_GLOBAL(with_density_median)
+ BOOST_ACCUMULATORS_IGNORE_GLOBAL(with_p_square_cumulative_distribution_median)
+}
+
+using extract::median;
+using extract::with_density_median;
+using extract::with_p_square_cumulative_distribution_median;
+
+// median(with_p_square_quantile) -> median
+template<>
+struct as_feature<tag::median(with_p_square_quantile)>
+{
+ typedef tag::median type;
+};
+
+// median(with_density) -> with_density_median
+template<>
+struct as_feature<tag::median(with_density)>
+{
+ typedef tag::with_density_median type;
+};
+
+// median(with_p_square_cumulative_distribution) -> with_p_square_cumulative_distribution_median
+template<>
+struct as_feature<tag::median(with_p_square_cumulative_distribution)>
+{
+ typedef tag::with_p_square_cumulative_distribution_median type;
+};
+
+// for the purposes of feature-based dependency resolution,
+// with_density_median and with_p_square_cumulative_distribution_median
+// provide the same feature as median
+template<>
+struct feature_of<tag::with_density_median>
+ : feature_of<tag::median>
+{
+};
+
+template<>
+struct feature_of<tag::with_p_square_cumulative_distribution_median>
+ : feature_of<tag::median>
+{
+};
+
+// So that median can be automatically substituted with
+// weighted_median when the weight parameter is non-void.
+template<>
+struct as_weighted_feature<tag::median>
+{
+ typedef tag::weighted_median type;
+};
+
+template<>
+struct feature_of<tag::weighted_median>
+ : feature_of<tag::median>
+{
+};
+
+// So that with_density_median can be automatically substituted with
+// with_density_weighted_median when the weight parameter is non-void.
+template<>
+struct as_weighted_feature<tag::with_density_median>
+{
+ typedef tag::with_density_weighted_median type;
+};
+
+template<>
+struct feature_of<tag::with_density_weighted_median>
+ : feature_of<tag::with_density_median>
+{
+};
+
+// So that with_p_square_cumulative_distribution_median can be automatically substituted with
+// with_p_square_cumulative_distribution_weighted_median when the weight parameter is non-void.
+template<>
+struct as_weighted_feature<tag::with_p_square_cumulative_distribution_median>
+{
+ typedef tag::with_p_square_cumulative_distribution_weighted_median type;
+};
+
+template<>
+struct feature_of<tag::with_p_square_cumulative_distribution_weighted_median>
+ : feature_of<tag::with_p_square_cumulative_distribution_median>
+{
+};
+
+}} // namespace boost::accumulators
+
+#endif
=== added file 'boost/boost/accumulators/statistics/min.hpp'
--- boost/boost/accumulators/statistics/min.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/statistics/min.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,85 @@
+///////////////////////////////////////////////////////////////////////////////
+// min.hpp
+//
+// Copyright 2005 Eric Niebler. 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)
+
+#ifndef BOOST_ACCUMULATORS_STATISTICS_MIN_HPP_EAN_28_10_2005
+#define BOOST_ACCUMULATORS_STATISTICS_MIN_HPP_EAN_28_10_2005
+
+#include <limits>
+#include <boost/mpl/placeholders.hpp>
+#include <boost/accumulators/framework/accumulator_base.hpp>
+#include <boost/accumulators/framework/extractor.hpp>
+#include <boost/accumulators/framework/parameters/sample.hpp>
+#include <boost/accumulators/numeric/functional.hpp>
+#include <boost/accumulators/framework/depends_on.hpp>
+#include <boost/accumulators/statistics_fwd.hpp>
+
+namespace boost { namespace accumulators
+{
+
+namespace impl
+{
+ ///////////////////////////////////////////////////////////////////////////////
+ // min_impl
+ template<typename Sample>
+ struct min_impl
+ : accumulator_base
+ {
+ // for boost::result_of
+ typedef Sample result_type;
+
+ template<typename Args>
+ min_impl(Args const &args)
+ : min_(numeric::as_max(args[sample | Sample()]))
+ {
+ }
+
+ template<typename Args>
+ void operator ()(Args const &args)
+ {
+ numeric::min_assign(this->min_, args[sample]);
+ }
+
+ result_type result(dont_care) const
+ {
+ return this->min_;
+ }
+
+ private:
+ Sample min_;
+ };
+
+} // namespace impl
+
+///////////////////////////////////////////////////////////////////////////////
+// tag::min
+//
+namespace tag
+{
+ struct min
+ : depends_on<>
+ {
+ /// INTERNAL ONLY
+ ///
+ typedef accumulators::impl::min_impl<mpl::_1> impl;
+ };
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// extract::min
+//
+namespace extract
+{
+ extractor<tag::min> const min = {};
+
+ BOOST_ACCUMULATORS_IGNORE_GLOBAL(min)
+}
+
+using extract::min;
+
+}} // namespace boost::accumulators
+
+#endif
=== added file 'boost/boost/accumulators/statistics/moment.hpp'
--- boost/boost/accumulators/statistics/moment.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/statistics/moment.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,125 @@
+///////////////////////////////////////////////////////////////////////////////
+// moment.hpp
+//
+// Copyright 2005 Eric Niebler. 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)
+
+#ifndef BOOST_ACCUMULATORS_STATISTICS_MOMENT_HPP_EAN_15_11_2005
+#define BOOST_ACCUMULATORS_STATISTICS_MOMENT_HPP_EAN_15_11_2005
+
+#include <boost/config/no_tr1/cmath.hpp>
+#include <boost/mpl/int.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/mpl/placeholders.hpp>
+#include <boost/accumulators/framework/accumulator_base.hpp>
+#include <boost/accumulators/framework/extractor.hpp>
+#include <boost/accumulators/numeric/functional.hpp>
+#include <boost/accumulators/framework/parameters/sample.hpp>
+#include <boost/accumulators/framework/depends_on.hpp>
+#include <boost/accumulators/statistics_fwd.hpp>
+#include <boost/accumulators/statistics/count.hpp>
+
+namespace boost { namespace numeric
+{
+ /// INTERNAL ONLY
+ ///
+ template<typename T>
+ T const &pow(T const &x, mpl::int_<1>)
+ {
+ return x;
+ }
+
+ /// INTERNAL ONLY
+ ///
+ template<typename T, int N>
+ T pow(T const &x, mpl::int_<N>)
+ {
+ using namespace operators;
+ T y = numeric::pow(x, mpl::int_<N/2>());
+ T z = y * y;
+ return (N % 2) ? (z * x) : z;
+ }
+}}
+
+namespace boost { namespace accumulators
+{
+
+namespace impl
+{
+ ///////////////////////////////////////////////////////////////////////////////
+ // moment_impl
+ template<typename N, typename Sample>
+ struct moment_impl
+ : accumulator_base // TODO: also depends_on sum of powers
+ {
+ BOOST_MPL_ASSERT_RELATION(N::value, >, 0);
+ // for boost::result_of
+ typedef typename numeric::functional::average<Sample, std::size_t>::result_type result_type;
+
+ template<typename Args>
+ moment_impl(Args const &args)
+ : sum(args[sample | Sample()])
+ {
+ }
+
+ template<typename Args>
+ void operator ()(Args const &args)
+ {
+ this->sum += numeric::pow(args[sample], N());
+ }
+
+ template<typename Args>
+ result_type result(Args const &args) const
+ {
+ return numeric::average(this->sum, count(args));
+ }
+
+ private:
+ Sample sum;
+ };
+
+} // namespace impl
+
+///////////////////////////////////////////////////////////////////////////////
+// tag::moment
+//
+namespace tag
+{
+ template<int N>
+ struct moment
+ : depends_on<count>
+ {
+ /// INTERNAL ONLY
+ ///
+ typedef accumulators::impl::moment_impl<mpl::int_<N>, mpl::_1> impl;
+ };
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// extract::moment
+//
+namespace extract
+{
+ BOOST_ACCUMULATORS_DEFINE_EXTRACTOR(tag, moment, (int))
+}
+
+using extract::moment;
+
+// So that moment<N> can be automatically substituted with
+// weighted_moment<N> when the weight parameter is non-void
+template<int N>
+struct as_weighted_feature<tag::moment<N> >
+{
+ typedef tag::weighted_moment<N> type;
+};
+
+template<int N>
+struct feature_of<tag::weighted_moment<N> >
+ : feature_of<tag::moment<N> >
+{
+};
+
+}} // namespace boost::accumulators
+
+#endif
=== added file 'boost/boost/accumulators/statistics/p_square_cumulative_distribution.hpp'
--- boost/boost/accumulators/statistics/p_square_cumulative_distribution.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/statistics/p_square_cumulative_distribution.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,260 @@
+///////////////////////////////////////////////////////////////////////////////
+// p_square_cumulative_distribution.hpp
+//
+// Copyright 2005 Daniel Egloff, Olivier Gygi. 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)
+
+#ifndef BOOST_ACCUMULATORS_STATISTICS_P_SQUARE_CUMULATIVE_DISTRIBUTION_HPP_DE_01_01_2006
+#define BOOST_ACCUMULATORS_STATISTICS_P_SQUARE_CUMULATIVE_DISTRIBUTION_HPP_DE_01_01_2006
+
+#include <vector>
+#include <functional>
+#include <boost/parameter/keyword.hpp>
+#include <boost/range.hpp>
+#include <boost/mpl/placeholders.hpp>
+#include <boost/accumulators/framework/accumulator_base.hpp>
+#include <boost/accumulators/framework/extractor.hpp>
+#include <boost/accumulators/numeric/functional.hpp>
+#include <boost/accumulators/framework/parameters/sample.hpp>
+#include <boost/accumulators/statistics_fwd.hpp>
+#include <boost/accumulators/statistics/count.hpp>
+
+namespace boost { namespace accumulators
+{
+///////////////////////////////////////////////////////////////////////////////
+// num_cells named parameter
+//
+BOOST_PARAMETER_NESTED_KEYWORD(tag, p_square_cumulative_distribution_num_cells, num_cells)
+
+namespace impl
+{
+ ///////////////////////////////////////////////////////////////////////////////
+ // p_square_cumulative_distribution_impl
+ // cumulative_distribution calculation (as histogram)
+ /**
+ @brief Histogram calculation of the cumulative distribution with the \f$P^2\f$ algorithm
+
+ A histogram of the sample cumulative distribution is computed dynamically without storing samples
+ based on the \f$ P^2 \f$ algorithm. The returned histogram has a specifiable amount (num_cells)
+ equiprobable (and not equal-sized) cells.
+
+ For further details, see
+
+ R. Jain and I. Chlamtac, The P^2 algorithmus for dynamic calculation of quantiles and
+ histograms without storing observations, Communications of the ACM,
+ Volume 28 (October), Number 10, 1985, p. 1076-1085.
+
+ @param p_square_cumulative_distribution_num_cells.
+ */
+ template<typename Sample>
+ struct p_square_cumulative_distribution_impl
+ : accumulator_base
+ {
+ typedef typename numeric::functional::average<Sample, std::size_t>::result_type float_type;
+ typedef std::vector<float_type> array_type;
+ typedef std::vector<std::pair<float_type, float_type> > histogram_type;
+ // for boost::result_of
+ typedef iterator_range<typename histogram_type::iterator> result_type;
+
+ template<typename Args>
+ p_square_cumulative_distribution_impl(Args const &args)
+ : num_cells(args[p_square_cumulative_distribution_num_cells])
+ , heights(num_cells + 1)
+ , actual_positions(num_cells + 1)
+ , desired_positions(num_cells + 1)
+ , positions_increments(num_cells + 1)
+ , histogram(num_cells + 1)
+ , is_dirty(true)
+ {
+ std::size_t b = this->num_cells;
+
+ for (std::size_t i = 0; i < b + 1; ++i)
+ {
+ this->actual_positions[i] = i + 1.;
+ this->desired_positions[i] = i + 1.;
+ this->positions_increments[i] = numeric::average(i, b);
+ }
+ }
+
+ template<typename Args>
+ void operator ()(Args const &args)
+ {
+ this->is_dirty = true;
+
+ std::size_t cnt = count(args);
+ std::size_t sample_cell = 1; // k
+ std::size_t b = this->num_cells;
+
+ // accumulate num_cells + 1 first samples
+ if (cnt <= b + 1)
+ {
+ this->heights[cnt - 1] = args[sample];
+
+ // complete the initialization of heights by sorting
+ if (cnt == b + 1)
+ {
+ std::sort(this->heights.begin(), this->heights.end());
+ }
+ }
+ else
+ {
+ // find cell k such that heights[k-1] <= args[sample] < heights[k] and adjust extreme values
+ if (args[sample] < this->heights[0])
+ {
+ this->heights[0] = args[sample];
+ sample_cell = 1;
+ }
+ else if (this->heights[b] <= args[sample])
+ {
+ this->heights[b] = args[sample];
+ sample_cell = b;
+ }
+ else
+ {
+ typename array_type::iterator it;
+ it = std::upper_bound(
+ this->heights.begin()
+ , this->heights.end()
+ , args[sample]
+ );
+
+ sample_cell = std::distance(this->heights.begin(), it);
+ }
+
+ // increment positions of markers above sample_cell
+ for (std::size_t i = sample_cell; i < b + 1; ++i)
+ {
+ ++this->actual_positions[i];
+ }
+
+ // update desired position of markers 2 to num_cells + 1
+ // (desired position of first marker is always 1)
+ for (std::size_t i = 1; i < b + 1; ++i)
+ {
+ this->desired_positions[i] += this->positions_increments[i];
+ }
+
+ // adjust heights of markers 2 to num_cells if necessary
+ for (std::size_t i = 1; i < b; ++i)
+ {
+ // offset to desire position
+ float_type d = this->desired_positions[i] - this->actual_positions[i];
+
+ // offset to next position
+ float_type dp = this->actual_positions[i + 1] - this->actual_positions[i];
+
+ // offset to previous position
+ float_type dm = this->actual_positions[i - 1] - this->actual_positions[i];
+
+ // height ds
+ float_type hp = (this->heights[i + 1] - this->heights[i]) / dp;
+ float_type hm = (this->heights[i - 1] - this->heights[i]) / dm;
+
+ if ( ( d >= 1. && dp > 1. ) || ( d <= -1. && dm < -1. ) )
+ {
+ short sign_d = static_cast<short>(d / std::abs(d));
+
+ // try adjusting heights[i] using p-squared formula
+ float_type h = this->heights[i] + sign_d / (dp - dm) * ( (sign_d - dm) * hp + (dp - sign_d) * hm );
+
+ if ( this->heights[i - 1] < h && h < this->heights[i + 1] )
+ {
+ this->heights[i] = h;
+ }
+ else
+ {
+ // use linear formula
+ if (d>0)
+ {
+ this->heights[i] += hp;
+ }
+ if (d<0)
+ {
+ this->heights[i] -= hm;
+ }
+ }
+ this->actual_positions[i] += sign_d;
+ }
+ }
+ }
+ }
+
+ template<typename Args>
+ result_type result(Args const &args) const
+ {
+ if (this->is_dirty)
+ {
+ this->is_dirty = false;
+
+ // creates a vector of std::pair where each pair i holds
+ // the values heights[i] (x-axis of histogram) and
+ // actual_positions[i] / cnt (y-axis of histogram)
+
+ std::size_t cnt = count(args);
+
+ for (std::size_t i = 0; i < this->histogram.size(); ++i)
+ {
+ this->histogram[i] = std::make_pair(this->heights[i], numeric::average(this->actual_positions[i], cnt));
+ }
+ }
+ //return histogram;
+ return make_iterator_range(this->histogram);
+ }
+
+ private:
+ std::size_t num_cells; // number of cells b
+ array_type heights; // q_i
+ array_type actual_positions; // n_i
+ array_type desired_positions; // n'_i
+ array_type positions_increments; // dn'_i
+ mutable histogram_type histogram; // histogram
+ mutable bool is_dirty;
+ };
+
+} // namespace detail
+
+///////////////////////////////////////////////////////////////////////////////
+// tag::p_square_cumulative_distribution
+//
+namespace tag
+{
+ struct p_square_cumulative_distribution
+ : depends_on<count>
+ , p_square_cumulative_distribution_num_cells
+ {
+ /// INTERNAL ONLY
+ ///
+ typedef accumulators::impl::p_square_cumulative_distribution_impl<mpl::_1> impl;
+ };
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// extract::p_square_cumulative_distribution
+//
+namespace extract
+{
+ extractor<tag::p_square_cumulative_distribution> const p_square_cumulative_distribution = {};
+
+ BOOST_ACCUMULATORS_IGNORE_GLOBAL(p_square_cumulative_distribution)
+}
+
+using extract::p_square_cumulative_distribution;
+
+// So that p_square_cumulative_distribution can be automatically substituted with
+// weighted_p_square_cumulative_distribution when the weight parameter is non-void
+template<>
+struct as_weighted_feature<tag::p_square_cumulative_distribution>
+{
+ typedef tag::weighted_p_square_cumulative_distribution type;
+};
+
+template<>
+struct feature_of<tag::weighted_p_square_cumulative_distribution>
+ : feature_of<tag::p_square_cumulative_distribution>
+{
+};
+
+}} // namespace boost::accumulators
+
+#endif
=== added file 'boost/boost/accumulators/statistics/p_square_quantile.hpp'
--- boost/boost/accumulators/statistics/p_square_quantile.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/statistics/p_square_quantile.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,257 @@
+///////////////////////////////////////////////////////////////////////////////
+// p_square_quantile.hpp
+//
+// Copyright 2005 Daniel Egloff. 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)
+
+#ifndef BOOST_ACCUMULATORS_STATISTICS_P_SQUARE_QUANTILE_HPP_DE_01_01_2006
+#define BOOST_ACCUMULATORS_STATISTICS_P_SQUARE_QUANTILE_HPP_DE_01_01_2006
+
+#include <cmath>
+#include <functional>
+#include <boost/array.hpp>
+#include <boost/mpl/placeholders.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/parameter/keyword.hpp>
+#include <boost/accumulators/framework/accumulator_base.hpp>
+#include <boost/accumulators/framework/extractor.hpp>
+#include <boost/accumulators/numeric/functional.hpp>
+#include <boost/accumulators/framework/parameters/sample.hpp>
+#include <boost/accumulators/framework/depends_on.hpp>
+#include <boost/accumulators/statistics_fwd.hpp>
+#include <boost/accumulators/statistics/count.hpp>
+#include <boost/accumulators/statistics/parameters/quantile_probability.hpp>
+
+namespace boost { namespace accumulators
+{
+
+namespace impl
+{
+ ///////////////////////////////////////////////////////////////////////////////
+ // p_square_quantile_impl
+ // single quantile estimation
+ /**
+ @brief Single quantile estimation with the \f$P^2\f$ algorithm
+
+ The \f$P^2\f$ algorithm estimates a quantile dynamically without storing samples. Instead of
+ storing the whole sample cumulative distribution, only five points (markers) are stored. The heights
+ of these markers are the minimum and the maximum of the samples and the current estimates of the
+ \f$(p/2)\f$-, \f$p\f$- and \f$(1+p)/2\f$-quantiles. Their positions are equal to the number
+ of samples that are smaller or equal to the markers. Each time a new samples is recorded, the
+ positions of the markers are updated and if necessary their heights are adjusted using a piecewise-
+ parabolic formula.
+
+ For further details, see
+
+ R. Jain and I. Chlamtac, The P^2 algorithmus fordynamic calculation of quantiles and
+ histograms without storing observations, Communications of the ACM,
+ Volume 28 (October), Number 10, 1985, p. 1076-1085.
+
+ @param quantile_probability
+ */
+ template<typename Sample, typename Impl>
+ struct p_square_quantile_impl
+ : accumulator_base
+ {
+ typedef typename numeric::functional::average<Sample, std::size_t>::result_type float_type;
+ typedef array<float_type, 5> array_type;
+ // for boost::result_of
+ typedef float_type result_type;
+
+ template<typename Args>
+ p_square_quantile_impl(Args const &args)
+ : p(is_same<Impl, for_median>::value ? 0.5 : args[quantile_probability | 0.5])
+ , heights()
+ , actual_positions()
+ , desired_positions()
+ , positions_increments()
+ {
+ for(std::size_t i = 0; i < 5; ++i)
+ {
+ this->actual_positions[i] = i + 1;
+ }
+
+ this->desired_positions[0] = 1.;
+ this->desired_positions[1] = 1. + 2. * this->p;
+ this->desired_positions[2] = 1. + 4. * this->p;
+ this->desired_positions[3] = 3. + 2. * this->p;
+ this->desired_positions[4] = 5.;
+
+ this->positions_increments[0] = 0.;
+ this->positions_increments[1] = this->p / 2.;
+ this->positions_increments[2] = this->p;
+ this->positions_increments[3] = (1. + this->p) / 2.;
+ this->positions_increments[4] = 1.;
+ }
+
+ template<typename Args>
+ void operator ()(Args const &args)
+ {
+ std::size_t cnt = count(args);
+
+ // accumulate 5 first samples
+ if(cnt <= 5)
+ {
+ this->heights[cnt - 1] = args[sample];
+
+ // complete the initialization of heights by sorting
+ if(cnt == 5)
+ {
+ std::sort(this->heights.begin(), this->heights.end());
+ }
+ }
+ else
+ {
+ std::size_t sample_cell = 1; // k
+
+ // find cell k such that heights[k-1] <= args[sample] < heights[k] and ajust extreme values
+ if (args[sample] < this->heights[0])
+ {
+ this->heights[0] = args[sample];
+ sample_cell = 1;
+ }
+ else if (this->heights[4] <= args[sample])
+ {
+ this->heights[4] = args[sample];
+ sample_cell = 4;
+ }
+ else
+ {
+ typedef typename array_type::iterator iterator;
+ iterator it = std::upper_bound(
+ this->heights.begin()
+ , this->heights.end()
+ , args[sample]
+ );
+
+ sample_cell = std::distance(this->heights.begin(), it);
+ }
+
+ // update positions of markers above sample_cell
+ for(std::size_t i = sample_cell; i < 5; ++i)
+ {
+ ++this->actual_positions[i];
+ }
+
+ // update desired positions of all markers
+ for(std::size_t i = 0; i < 5; ++i)
+ {
+ this->desired_positions[i] += this->positions_increments[i];
+ }
+
+ // adjust heights and actual positions of markers 1 to 3 if necessary
+ for(std::size_t i = 1; i <= 3; ++i)
+ {
+ // offset to desired positions
+ float_type d = this->desired_positions[i] - this->actual_positions[i];
+
+ // offset to next position
+ float_type dp = this->actual_positions[i + 1] - this->actual_positions[i];
+
+ // offset to previous position
+ float_type dm = this->actual_positions[i - 1] - this->actual_positions[i];
+
+ // height ds
+ float_type hp = (this->heights[i + 1] - this->heights[i]) / dp;
+ float_type hm = (this->heights[i - 1] - this->heights[i]) / dm;
+
+ if((d >= 1. && dp > 1.) || (d <= -1. && dm < -1.))
+ {
+ short sign_d = static_cast<short>(d / std::abs(d));
+
+ // try adjusting heights[i] using p-squared formula
+ float_type h = this->heights[i] + sign_d / (dp - dm) * ((sign_d - dm) * hp
+ + (dp - sign_d) * hm);
+
+ if(this->heights[i - 1] < h && h < this->heights[i + 1])
+ {
+ this->heights[i] = h;
+ }
+ else
+ {
+ // use linear formula
+ if(d > 0)
+ {
+ this->heights[i] += hp;
+ }
+ if(d < 0)
+ {
+ this->heights[i] -= hm;
+ }
+ }
+ this->actual_positions[i] += sign_d;
+ }
+ }
+ }
+ }
+
+ result_type result(dont_care) const
+ {
+ return this->heights[2];
+ }
+
+ private:
+ float_type p; // the quantile probability p
+ array_type heights; // q_i
+ array_type actual_positions; // n_i
+ array_type desired_positions; // n'_i
+ array_type positions_increments; // dn'_i
+ };
+
+} // namespace detail
+
+///////////////////////////////////////////////////////////////////////////////
+// tag::p_square_quantile
+//
+namespace tag
+{
+ struct p_square_quantile
+ : depends_on<count>
+ {
+ /// INTERNAL ONLY
+ ///
+ typedef accumulators::impl::p_square_quantile_impl<mpl::_1, regular> impl;
+ };
+ struct p_square_quantile_for_median
+ : depends_on<count>
+ {
+ /// INTERNAL ONLY
+ ///
+ typedef accumulators::impl::p_square_quantile_impl<mpl::_1, for_median> impl;
+ };
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// extract::p_square_quantile
+// extract::p_square_quantile_for_median
+//
+namespace extract
+{
+ extractor<tag::p_square_quantile> const p_square_quantile = {};
+ extractor<tag::p_square_quantile_for_median> const p_square_quantile_for_median = {};
+
+ BOOST_ACCUMULATORS_IGNORE_GLOBAL(p_square_quantile)
+ BOOST_ACCUMULATORS_IGNORE_GLOBAL(p_square_quantile_for_median)
+}
+
+using extract::p_square_quantile;
+using extract::p_square_quantile_for_median;
+
+// So that p_square_quantile can be automatically substituted with
+// weighted_p_square_quantile when the weight parameter is non-void
+template<>
+struct as_weighted_feature<tag::p_square_quantile>
+{
+ typedef tag::weighted_p_square_quantile type;
+};
+
+template<>
+struct feature_of<tag::weighted_p_square_quantile>
+ : feature_of<tag::p_square_quantile>
+{
+};
+
+}} // namespace boost::accumulators
+
+#endif
=== added directory 'boost/boost/accumulators/statistics/parameters'
=== added file 'boost/boost/accumulators/statistics/parameters/quantile_probability.hpp'
--- boost/boost/accumulators/statistics/parameters/quantile_probability.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/statistics/parameters/quantile_probability.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// quantile_probability.hpp
+//
+// Copyright 2005 Eric Niebler. 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)
+
+#ifndef BOOST_ACCUMULATORS_STATISTICS_PARAMETERS_QUANTILE_PROBABILITY_HPP_EAN_03_11_2005
+#define BOOST_ACCUMULATORS_STATISTICS_PARAMETERS_QUANTILE_PROBABILITY_HPP_EAN_03_11_2005
+
+#include <boost/parameter/keyword.hpp>
+
+namespace boost { namespace accumulators
+{
+
+BOOST_PARAMETER_KEYWORD(tag, quantile_probability)
+
+}} // namespace boost::accumulators
+
+#endif
=== added file 'boost/boost/accumulators/statistics/peaks_over_threshold.hpp'
--- boost/boost/accumulators/statistics/peaks_over_threshold.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/statistics/peaks_over_threshold.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,401 @@
+///////////////////////////////////////////////////////////////////////////////
+// peaks_over_threshold.hpp
+//
+// Copyright 2006 Daniel Egloff, Olivier Gygi. 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)
+
+#ifndef BOOST_ACCUMULATORS_STATISTICS_PEAKS_OVER_THRESHOLD_HPP_DE_01_01_2006
+#define BOOST_ACCUMULATORS_STATISTICS_PEAKS_OVER_THRESHOLD_HPP_DE_01_01_2006
+
+#include <vector>
+#include <limits>
+#include <numeric>
+#include <functional>
+#include <boost/config/no_tr1/cmath.hpp> // pow
+#include <sstream> // stringstream
+#include <stdexcept> // runtime_error
+#include <boost/throw_exception.hpp>
+#include <boost/range.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/int.hpp>
+#include <boost/mpl/placeholders.hpp>
+#include <boost/parameter/keyword.hpp>
+#include <boost/tuple/tuple.hpp>
+#include <boost/accumulators/framework/accumulator_base.hpp>
+#include <boost/accumulators/framework/extractor.hpp>
+#include <boost/accumulators/numeric/functional.hpp>
+#include <boost/accumulators/framework/parameters/sample.hpp>
+#include <boost/accumulators/framework/depends_on.hpp>
+#include <boost/accumulators/statistics_fwd.hpp>
+#include <boost/accumulators/statistics/parameters/quantile_probability.hpp>
+#include <boost/accumulators/statistics/count.hpp>
+#include <boost/accumulators/statistics/tail.hpp>
+
+#ifdef _MSC_VER
+# pragma warning(push)
+# pragma warning(disable: 4127) // conditional expression is constant
+#endif
+
+namespace boost { namespace accumulators
+{
+
+///////////////////////////////////////////////////////////////////////////////
+// threshold_probability and threshold named parameters
+//
+BOOST_PARAMETER_NESTED_KEYWORD(tag, pot_threshold_value, threshold_value)
+BOOST_PARAMETER_NESTED_KEYWORD(tag, pot_threshold_probability, threshold_probability)
+
+namespace impl
+{
+ ///////////////////////////////////////////////////////////////////////////////
+ // peaks_over_threshold_impl
+ // works with an explicit threshold value and does not depend on order statistics
+ /**
+ @brief Peaks over Threshold Method for Quantile and Tail Mean Estimation
+
+ According to the theorem of Pickands-Balkema-de Haan, the distribution function \f$F_u(x)\f$ of
+ the excesses \f$x\f$ over some sufficiently high threshold \f$u\f$ of a distribution function \f$F(x)\f$
+ may be approximated by a generalized Pareto distribution
+ \f[
+ G_{\xi,\beta}(x) =
+ \left\{
+ \begin{array}{ll}
+ \beta^{-1}\left(1+\frac{\xi x}{\beta}\right)^{-1/\xi-1} & \textrm{if }\xi\neq0\\
+ \beta^{-1}\exp\left(-\frac{x}{\beta}\right) & \textrm{if }\xi=0,
+ \end{array}
+ \right.
+ \f]
+ with suitable parameters \f$\xi\f$ and \f$\beta\f$ that can be estimated, e.g., with the method of moments, cf.
+ Hosking and Wallis (1987),
+ \f[
+ \begin{array}{lll}
+ \hat{\xi} & = & \frac{1}{2}\left[1-\frac{(\hat{\mu}-u)^2}{\hat{\sigma}^2}\right]\\
+ \hat{\beta} & = & \frac{\hat{\mu}-u}{2}\left[\frac{(\hat{\mu}-u)^2}{\hat{\sigma}^2}+1\right],
+ \end{array}
+ \f]
+ \f$\hat{\mu}\f$ and \f$\hat{\sigma}^2\f$ being the empirical mean and variance of the samples over
+ the threshold \f$u\f$. Equivalently, the distribution function
+ \f$F_u(x-u)\f$ of the exceedances \f$x-u\f$ can be approximated by
+ \f$G_{\xi,\beta}(x-u)=G_{\xi,\beta,u}(x)\f$. Since for \f$x\geq u\f$ the distribution function \f$F(x)\f$
+ can be written as
+ \f[
+ F(x) = [1 - \P(X \leq u)]F_u(x - u) + \P(X \leq u)
+ \f]
+ and the probability \f$\P(X \leq u)\f$ can be approximated by the empirical distribution function
+ \f$F_n(u)\f$ evaluated at \f$u\f$, an estimator of \f$F(x)\f$ is given by
+ \f[
+ \widehat{F}(x) = [1 - F_n(u)]G_{\xi,\beta,u}(x) + F_n(u).
+ \f]
+ It can be shown that \f$\widehat{F}(x)\f$ is a generalized
+ Pareto distribution \f$G_{\xi,\bar{\beta},\bar{u}}(x)\f$ with \f$\bar{\beta}=\beta[1-F_n(u)]^{\xi}\f$
+ and \f$\bar{u}=u-\bar{\beta}\left\{[1-F_n(u)]^{-\xi}-1\right\}/\xi\f$. By inverting \f$\widehat{F}(x)\f$,
+ one obtains an estimator for the \f$\alpha\f$-quantile,
+ \f[
+ \hat{q}_{\alpha} = \bar{u} + \frac{\bar{\beta}}{\xi}\left[(1-\alpha)^{-\xi}-1\right],
+ \f]
+ and similarly an estimator for the (coherent) tail mean,
+ \f[
+ \widehat{CTM}_{\alpha} = \hat{q}_{\alpha} - \frac{\bar{\beta}}{\xi-1}(1-\alpha)^{-\xi},
+ \f]
+ cf. McNeil and Frey (2000).
+
+ Note that in case extreme values of the left tail are fitted, the distribution is mirrored with respect to the
+ \f$y\f$ axis such that the left tail can be treated as a right tail. The computed fit parameters thus define
+ the Pareto distribution that fits the mirrored left tail. When quantities like a quantile or a tail mean are
+ computed using the fit parameters obtained from the mirrored data, the result is mirrored back, yielding the
+ correct result.
+
+ For further details, see
+
+ J. R. M. Hosking and J. R. Wallis, Parameter and quantile estimation for the generalized Pareto distribution,
+ Technometrics, Volume 29, 1987, p. 339-349
+
+ A. J. McNeil and R. Frey, Estimation of Tail-Related Risk Measures for Heteroscedastic Financial Time Series:
+ an Extreme Value Approach, Journal of Empirical Finance, Volume 7, 2000, p. 271-300
+
+ @param quantile_probability
+ @param pot_threshold_value
+ */
+ template<typename Sample, typename LeftRight>
+ struct peaks_over_threshold_impl
+ : accumulator_base
+ {
+ typedef typename numeric::functional::average<Sample, std::size_t>::result_type float_type;
+ // for boost::result_of
+ typedef boost::tuple<float_type, float_type, float_type> result_type;
+ // for left tail fitting, mirror the extreme values
+ typedef mpl::int_<is_same<LeftRight, left>::value ? -1 : 1> sign;
+
+ template<typename Args>
+ peaks_over_threshold_impl(Args const &args)
+ : Nu_(0)
+ , mu_(sign::value * numeric::average(args[sample | Sample()], (std::size_t)1))
+ , sigma2_(numeric::average(args[sample | Sample()], (std::size_t)1))
+ , threshold_(sign::value * args[pot_threshold_value])
+ , fit_parameters_(boost::make_tuple(0., 0., 0.))
+ , is_dirty_(true)
+ {
+ }
+
+ template<typename Args>
+ void operator ()(Args const &args)
+ {
+ this->is_dirty_ = true;
+
+ if (sign::value * args[sample] > this->threshold_)
+ {
+ this->mu_ += args[sample];
+ this->sigma2_ += args[sample] * args[sample];
+ ++this->Nu_;
+ }
+ }
+
+ template<typename Args>
+ result_type result(Args const &args) const
+ {
+ if (this->is_dirty_)
+ {
+ this->is_dirty_ = false;
+
+ std::size_t cnt = count(args);
+
+ this->mu_ = sign::value * numeric::average(this->mu_, this->Nu_);
+ this->sigma2_ = numeric::average(this->sigma2_, this->Nu_);
+ this->sigma2_ -= this->mu_ * this->mu_;
+
+ float_type threshold_probability = numeric::average(cnt - this->Nu_, cnt);
+
+ float_type tmp = numeric::average(( this->mu_ - this->threshold_ )*( this->mu_ - this->threshold_ ), this->sigma2_);
+ float_type xi_hat = 0.5 * ( 1. - tmp );
+ float_type beta_hat = 0.5 * ( this->mu_ - this->threshold_ ) * ( 1. + tmp );
+ float_type beta_bar = beta_hat * std::pow(1. - threshold_probability, xi_hat);
+ float_type u_bar = this->threshold_ - beta_bar * ( std::pow(1. - threshold_probability, -xi_hat) - 1.)/xi_hat;
+ this->fit_parameters_ = boost::make_tuple(u_bar, beta_bar, xi_hat);
+ }
+
+ return this->fit_parameters_;
+ }
+
+ private:
+ std::size_t Nu_; // number of samples larger than threshold
+ mutable float_type mu_; // mean of Nu_ largest samples
+ mutable float_type sigma2_; // variance of Nu_ largest samples
+ float_type threshold_;
+ mutable result_type fit_parameters_; // boost::tuple that stores fit parameters
+ mutable bool is_dirty_;
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // peaks_over_threshold_prob_impl
+ // determines threshold from a given threshold probability using order statistics
+ /**
+ @brief Peaks over Threshold Method for Quantile and Tail Mean Estimation
+
+ @sa peaks_over_threshold_impl
+
+ @param quantile_probability
+ @param pot_threshold_probability
+ */
+ template<typename Sample, typename LeftRight>
+ struct peaks_over_threshold_prob_impl
+ : accumulator_base
+ {
+ typedef typename numeric::functional::average<Sample, std::size_t>::result_type float_type;
+ // for boost::result_of
+ typedef boost::tuple<float_type, float_type, float_type> result_type;
+ // for left tail fitting, mirror the extreme values
+ typedef mpl::int_<is_same<LeftRight, left>::value ? -1 : 1> sign;
+
+ template<typename Args>
+ peaks_over_threshold_prob_impl(Args const &args)
+ : mu_(sign::value * numeric::average(args[sample | Sample()], (std::size_t)1))
+ , sigma2_(numeric::average(args[sample | Sample()], (std::size_t)1))
+ , threshold_probability_(args[pot_threshold_probability])
+ , fit_parameters_(boost::make_tuple(0., 0., 0.))
+ , is_dirty_(true)
+ {
+ }
+
+ void operator ()(dont_care)
+ {
+ this->is_dirty_ = true;
+ }
+
+ template<typename Args>
+ result_type result(Args const &args) const
+ {
+ if (this->is_dirty_)
+ {
+ this->is_dirty_ = false;
+
+ std::size_t cnt = count(args);
+
+ // the n'th cached sample provides an approximate threshold value u
+ std::size_t n = static_cast<std::size_t>(
+ std::ceil(
+ cnt * ( ( is_same<LeftRight, left>::value ) ? this->threshold_probability_ : 1. - this->threshold_probability_ )
+ )
+ );
+
+ // If n is in a valid range, return result, otherwise return NaN or throw exception
+ if ( n >= static_cast<std::size_t>(tail(args).size()))
+ {
+ if (std::numeric_limits<float_type>::has_quiet_NaN)
+ {
+ return boost::make_tuple(
+ std::numeric_limits<float_type>::quiet_NaN()
+ , std::numeric_limits<float_type>::quiet_NaN()
+ , std::numeric_limits<float_type>::quiet_NaN()
+ );
+ }
+ else
+ {
+ std::ostringstream msg;
+ msg << "index n = " << n << " is not in valid range [0, " << tail(args).size() << ")";
+ boost::throw_exception(std::runtime_error(msg.str()));
+ return boost::make_tuple(Sample(0), Sample(0), Sample(0));
+ }
+ }
+ else
+ {
+ float_type u = *(tail(args).begin() + n - 1) * sign::value;
+
+ // compute mean and variance of samples above/under threshold value u
+ for (std::size_t i = 0; i < n; ++i)
+ {
+ mu_ += *(tail(args).begin() + i);
+ sigma2_ += *(tail(args).begin() + i) * (*(tail(args).begin() + i));
+ }
+
+ this->mu_ = sign::value * numeric::average(this->mu_, n);
+ this->sigma2_ = numeric::average(this->sigma2_, n);
+ this->sigma2_ -= this->mu_ * this->mu_;
+
+ if (is_same<LeftRight, left>::value)
+ this->threshold_probability_ = 1. - this->threshold_probability_;
+
+ float_type tmp = numeric::average(( this->mu_ - u )*( this->mu_ - u ), this->sigma2_);
+ float_type xi_hat = 0.5 * ( 1. - tmp );
+ float_type beta_hat = 0.5 * ( this->mu_ - u ) * ( 1. + tmp );
+ float_type beta_bar = beta_hat * std::pow(1. - threshold_probability_, xi_hat);
+ float_type u_bar = u - beta_bar * ( std::pow(1. - threshold_probability_, -xi_hat) - 1.)/xi_hat;
+ this->fit_parameters_ = boost::make_tuple(u_bar, beta_bar, xi_hat);
+ }
+ }
+
+ return this->fit_parameters_;
+ }
+
+ private:
+ mutable float_type mu_; // mean of samples above threshold u
+ mutable float_type sigma2_; // variance of samples above threshold u
+ mutable float_type threshold_probability_;
+ mutable result_type fit_parameters_; // boost::tuple that stores fit parameters
+ mutable bool is_dirty_;
+ };
+
+} // namespace impl
+
+///////////////////////////////////////////////////////////////////////////////
+// tag::peaks_over_threshold
+//
+namespace tag
+{
+ template<typename LeftRight>
+ struct peaks_over_threshold
+ : depends_on<count>
+ , pot_threshold_value
+ {
+ /// INTERNAL ONLY
+ ///
+ typedef accumulators::impl::peaks_over_threshold_impl<mpl::_1, LeftRight> impl;
+ };
+
+ template<typename LeftRight>
+ struct peaks_over_threshold_prob
+ : depends_on<count, tail<LeftRight> >
+ , pot_threshold_probability
+ {
+ /// INTERNAL ONLY
+ ///
+ typedef accumulators::impl::peaks_over_threshold_prob_impl<mpl::_1, LeftRight> impl;
+ };
+
+ struct abstract_peaks_over_threshold
+ : depends_on<>
+ {
+ };
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// extract::peaks_over_threshold
+//
+namespace extract
+{
+ extractor<tag::abstract_peaks_over_threshold> const peaks_over_threshold = {};
+
+ BOOST_ACCUMULATORS_IGNORE_GLOBAL(peaks_over_threshold)
+}
+
+using extract::peaks_over_threshold;
+
+// peaks_over_threshold<LeftRight>(with_threshold_value) -> peaks_over_threshold<LeftRight>
+template<typename LeftRight>
+struct as_feature<tag::peaks_over_threshold<LeftRight>(with_threshold_value)>
+{
+ typedef tag::peaks_over_threshold<LeftRight> type;
+};
+
+// peaks_over_threshold<LeftRight>(with_threshold_probability) -> peaks_over_threshold_prob<LeftRight>
+template<typename LeftRight>
+struct as_feature<tag::peaks_over_threshold<LeftRight>(with_threshold_probability)>
+{
+ typedef tag::peaks_over_threshold_prob<LeftRight> type;
+};
+
+template<typename LeftRight>
+struct feature_of<tag::peaks_over_threshold<LeftRight> >
+ : feature_of<tag::abstract_peaks_over_threshold>
+{
+};
+
+template<typename LeftRight>
+struct feature_of<tag::peaks_over_threshold_prob<LeftRight> >
+ : feature_of<tag::abstract_peaks_over_threshold>
+{
+};
+
+// So that peaks_over_threshold can be automatically substituted
+// with weighted_peaks_over_threshold when the weight parameter is non-void.
+template<typename LeftRight>
+struct as_weighted_feature<tag::peaks_over_threshold<LeftRight> >
+{
+ typedef tag::weighted_peaks_over_threshold<LeftRight> type;
+};
+
+template<typename LeftRight>
+struct feature_of<tag::weighted_peaks_over_threshold<LeftRight> >
+ : feature_of<tag::peaks_over_threshold<LeftRight> >
+{};
+
+// So that peaks_over_threshold_prob can be automatically substituted
+// with weighted_peaks_over_threshold_prob when the weight parameter is non-void.
+template<typename LeftRight>
+struct as_weighted_feature<tag::peaks_over_threshold_prob<LeftRight> >
+{
+ typedef tag::weighted_peaks_over_threshold_prob<LeftRight> type;
+};
+
+template<typename LeftRight>
+struct feature_of<tag::weighted_peaks_over_threshold_prob<LeftRight> >
+ : feature_of<tag::peaks_over_threshold_prob<LeftRight> >
+{};
+
+}} // namespace boost::accumulators
+
+#ifdef _MSC_VER
+# pragma warning(pop)
+#endif
+
+#endif
=== added file 'boost/boost/accumulators/statistics/pot_quantile.hpp'
--- boost/boost/accumulators/statistics/pot_quantile.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/statistics/pot_quantile.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,205 @@
+///////////////////////////////////////////////////////////////////////////////
+// pot_quantile.hpp
+//
+// Copyright 2006 Daniel Egloff, Olivier Gygi. 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)
+
+#ifndef BOOST_ACCUMULATORS_STATISTICS_POT_QUANTILE_HPP_DE_01_01_2006
+#define BOOST_ACCUMULATORS_STATISTICS_POT_QUANTILE_HPP_DE_01_01_2006
+
+#include <vector>
+#include <limits>
+#include <numeric>
+#include <functional>
+#include <boost/parameter/keyword.hpp>
+#include <boost/tuple/tuple.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/mpl/placeholders.hpp>
+#include <boost/accumulators/framework/accumulator_base.hpp>
+#include <boost/accumulators/framework/extractor.hpp>
+#include <boost/accumulators/numeric/functional.hpp>
+#include <boost/accumulators/framework/parameters/sample.hpp>
+#include <boost/accumulators/statistics_fwd.hpp>
+#include <boost/accumulators/statistics/tail.hpp>
+#include <boost/accumulators/statistics/peaks_over_threshold.hpp>
+#include <boost/accumulators/statistics/weighted_peaks_over_threshold.hpp>
+
+namespace boost { namespace accumulators
+{
+
+namespace impl
+{
+ ///////////////////////////////////////////////////////////////////////////////
+ // pot_quantile_impl
+ //
+ /**
+ @brief Quantile Estimation based on Peaks over Threshold Method (for both left and right tails)
+
+ Computes an estimate
+ \f[
+ \hat{q}_{\alpha} = \bar{u} + \frac{\bar{\beta}}{\xi}\left[(1-\alpha)^{-\xi}-1\right]
+ \f]
+ for a right or left extreme quantile, \f$\bar[u]\f$, \f$\bar{\beta}\f$ and \f$\xi\f$ being the parameters of the
+ generalized Pareto distribution that approximates the right tail of the distribution (or the mirrored left tail,
+ in case the left tail is used). In the latter case, the result is mirrored back, yielding the correct result.
+ */
+ template<typename Sample, typename Impl, typename LeftRight>
+ struct pot_quantile_impl
+ : accumulator_base
+ {
+ typedef typename numeric::functional::average<Sample, std::size_t>::result_type float_type;
+ // for boost::result_of
+ typedef float_type result_type;
+
+ pot_quantile_impl(dont_care)
+ : sign_((is_same<LeftRight, left>::value) ? -1 : 1)
+ {
+ }
+
+ template<typename Args>
+ result_type result(Args const &args) const
+ {
+ typedef
+ typename mpl::if_<
+ is_same<Impl, weighted>
+ , tag::weighted_peaks_over_threshold<LeftRight>
+ , tag::peaks_over_threshold<LeftRight>
+ >::type
+ peaks_over_threshold_tag;
+
+ extractor<peaks_over_threshold_tag> const some_peaks_over_threshold = {};
+
+ float_type u_bar = some_peaks_over_threshold(args).template get<0>();
+ float_type beta_bar = some_peaks_over_threshold(args).template get<1>();
+ float_type xi_hat = some_peaks_over_threshold(args).template get<2>();
+
+ return this->sign_ * (u_bar + beta_bar/xi_hat * ( std::pow(
+ is_same<LeftRight, left>::value ? args[quantile_probability] : 1. - args[quantile_probability]
+ , -xi_hat
+ ) - 1.));
+ }
+
+ private:
+ short sign_; // if the fit parameters from the mirrored left tail extreme values are used, mirror back the result
+ };
+
+} // namespace impl
+
+///////////////////////////////////////////////////////////////////////////////
+// tag::pot_quantile<>
+// tag::pot_quantile_prob<>
+// tag::weighted_pot_quantile<>
+// tag::weighted_pot_quantile_prob<>
+//
+namespace tag
+{
+ template<typename LeftRight>
+ struct pot_quantile
+ : depends_on<peaks_over_threshold<LeftRight> >
+ {
+ /// INTERNAL ONLY
+ ///
+ typedef accumulators::impl::pot_quantile_impl<mpl::_1, unweighted, LeftRight> impl;
+ };
+ template<typename LeftRight>
+ struct pot_quantile_prob
+ : depends_on<peaks_over_threshold_prob<LeftRight> >
+ {
+ /// INTERNAL ONLY
+ ///
+ typedef accumulators::impl::pot_quantile_impl<mpl::_1, unweighted, LeftRight> impl;
+ };
+ template<typename LeftRight>
+ struct weighted_pot_quantile
+ : depends_on<weighted_peaks_over_threshold<LeftRight> >
+ {
+ /// INTERNAL ONLY
+ ///
+ typedef accumulators::impl::pot_quantile_impl<mpl::_1, weighted, LeftRight> impl;
+ };
+ template<typename LeftRight>
+ struct weighted_pot_quantile_prob
+ : depends_on<weighted_peaks_over_threshold_prob<LeftRight> >
+ {
+ /// INTERNAL ONLY
+ ///
+ typedef accumulators::impl::pot_quantile_impl<mpl::_1, weighted, LeftRight> impl;
+ };
+}
+
+// pot_quantile<LeftRight>(with_threshold_value) -> pot_quantile<LeftRight>
+template<typename LeftRight>
+struct as_feature<tag::pot_quantile<LeftRight>(with_threshold_value)>
+{
+ typedef tag::pot_quantile<LeftRight> type;
+};
+
+// pot_quantile<LeftRight>(with_threshold_probability) -> pot_quantile_prob<LeftRight>
+template<typename LeftRight>
+struct as_feature<tag::pot_quantile<LeftRight>(with_threshold_probability)>
+{
+ typedef tag::pot_quantile_prob<LeftRight> type;
+};
+
+// weighted_pot_quantile<LeftRight>(with_threshold_value) -> weighted_pot_quantile<LeftRight>
+template<typename LeftRight>
+struct as_feature<tag::weighted_pot_quantile<LeftRight>(with_threshold_value)>
+{
+ typedef tag::weighted_pot_quantile<LeftRight> type;
+};
+
+// weighted_pot_quantile<LeftRight>(with_threshold_probability) -> weighted_pot_quantile_prob<LeftRight>
+template<typename LeftRight>
+struct as_feature<tag::weighted_pot_quantile<LeftRight>(with_threshold_probability)>
+{
+ typedef tag::weighted_pot_quantile_prob<LeftRight> type;
+};
+
+// for the purposes of feature-based dependency resolution,
+// pot_quantile<LeftRight> and pot_quantile_prob<LeftRight> provide
+// the same feature as quantile
+template<typename LeftRight>
+struct feature_of<tag::pot_quantile<LeftRight> >
+ : feature_of<tag::quantile>
+{
+};
+
+template<typename LeftRight>
+struct feature_of<tag::pot_quantile_prob<LeftRight> >
+ : feature_of<tag::quantile>
+{
+};
+
+// So that pot_quantile can be automatically substituted
+// with weighted_pot_quantile when the weight parameter is non-void.
+template<typename LeftRight>
+struct as_weighted_feature<tag::pot_quantile<LeftRight> >
+{
+ typedef tag::weighted_pot_quantile<LeftRight> type;
+};
+
+template<typename LeftRight>
+struct feature_of<tag::weighted_pot_quantile<LeftRight> >
+ : feature_of<tag::pot_quantile<LeftRight> >
+{
+};
+
+// So that pot_quantile_prob can be automatically substituted
+// with weighted_pot_quantile_prob when the weight parameter is non-void.
+template<typename LeftRight>
+struct as_weighted_feature<tag::pot_quantile_prob<LeftRight> >
+{
+ typedef tag::weighted_pot_quantile_prob<LeftRight> type;
+};
+
+template<typename LeftRight>
+struct feature_of<tag::weighted_pot_quantile_prob<LeftRight> >
+ : feature_of<tag::pot_quantile_prob<LeftRight> >
+{
+};
+
+}} // namespace boost::accumulators
+
+#endif
=== added file 'boost/boost/accumulators/statistics/pot_tail_mean.hpp'
--- boost/boost/accumulators/statistics/pot_tail_mean.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/statistics/pot_tail_mean.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,211 @@
+///////////////////////////////////////////////////////////////////////////////
+// pot_tail_mean.hpp
+//
+// Copyright 2006 Daniel Egloff, Olivier Gygi. 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)
+
+#ifndef BOOST_ACCUMULATORS_STATISTICS_POT_TAIL_MEAN_HPP_DE_01_01_2006
+#define BOOST_ACCUMULATORS_STATISTICS_POT_TAIL_MEAN_HPP_DE_01_01_2006
+
+#include <vector>
+#include <limits>
+#include <numeric>
+#include <functional>
+#include <boost/range.hpp>
+#include <boost/parameter/keyword.hpp>
+#include <boost/tuple/tuple.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/placeholders.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/accumulators/framework/accumulator_base.hpp>
+#include <boost/accumulators/framework/extractor.hpp>
+#include <boost/accumulators/numeric/functional.hpp>
+#include <boost/accumulators/framework/parameters/sample.hpp>
+#include <boost/accumulators/statistics_fwd.hpp>
+#include <boost/accumulators/statistics/peaks_over_threshold.hpp>
+#include <boost/accumulators/statistics/weighted_peaks_over_threshold.hpp>
+#include <boost/accumulators/statistics/pot_quantile.hpp>
+#include <boost/accumulators/statistics/tail_mean.hpp>
+
+namespace boost { namespace accumulators
+{
+
+namespace impl
+{
+ ///////////////////////////////////////////////////////////////////////////////
+ // pot_tail_mean_impl
+ //
+ /**
+ @brief Estimation of the (coherent) tail mean based on the peaks over threshold method (for both left and right tails)
+
+ Computes an estimate for the (coherent) tail mean
+ \f[
+ \widehat{CTM}_{\alpha} = \hat{q}_{\alpha} - \frac{\bar{\beta}}{\xi-1}(1-\alpha)^{-\xi},
+ \f]
+ where \f$\bar[u]\f$, \f$\bar{\beta}\f$ and \f$\xi\f$ are the parameters of the
+ generalized Pareto distribution that approximates the right tail of the distribution (or the
+ mirrored left tail, in case the left tail is used). In the latter case, the result is mirrored
+ back, yielding the correct result.
+ */
+ template<typename Sample, typename Impl, typename LeftRight>
+ struct pot_tail_mean_impl
+ : accumulator_base
+ {
+ typedef typename numeric::functional::average<Sample, std::size_t>::result_type float_type;
+ // for boost::result_of
+ typedef float_type result_type;
+
+ pot_tail_mean_impl(dont_care)
+ : sign_((is_same<LeftRight, left>::value) ? -1 : 1)
+ {
+ }
+
+ template<typename Args>
+ result_type result(Args const &args) const
+ {
+ typedef
+ typename mpl::if_<
+ is_same<Impl, weighted>
+ , tag::weighted_peaks_over_threshold<LeftRight>
+ , tag::peaks_over_threshold<LeftRight>
+ >::type
+ peaks_over_threshold_tag;
+
+ typedef
+ typename mpl::if_<
+ is_same<Impl, weighted>
+ , tag::weighted_pot_quantile<LeftRight>
+ , tag::pot_quantile<LeftRight>
+ >::type
+ pot_quantile_tag;
+
+ extractor<peaks_over_threshold_tag> const some_peaks_over_threshold = {};
+ extractor<pot_quantile_tag> const some_pot_quantile = {};
+
+ float_type beta_bar = some_peaks_over_threshold(args).template get<1>();
+ float_type xi_hat = some_peaks_over_threshold(args).template get<2>();
+
+ return some_pot_quantile(args) - this->sign_ * beta_bar/( xi_hat - 1. ) * std::pow(
+ is_same<LeftRight, left>::value ? args[quantile_probability] : 1. - args[quantile_probability]
+ , -xi_hat);
+ }
+ private:
+ short sign_; // if the fit parameters from the mirrored left tail extreme values are used, mirror back the result
+ };
+} // namespace impl
+
+///////////////////////////////////////////////////////////////////////////////
+// tag::pot_tail_mean
+// tag::pot_tail_mean_prob
+//
+namespace tag
+{
+ template<typename LeftRight>
+ struct pot_tail_mean
+ : depends_on<peaks_over_threshold<LeftRight>, pot_quantile<LeftRight> >
+ {
+ /// INTERNAL ONLY
+ ///
+ typedef accumulators::impl::pot_tail_mean_impl<mpl::_1, unweighted, LeftRight> impl;
+ };
+ template<typename LeftRight>
+ struct pot_tail_mean_prob
+ : depends_on<peaks_over_threshold_prob<LeftRight>, pot_quantile_prob<LeftRight> >
+ {
+ /// INTERNAL ONLY
+ ///
+ typedef accumulators::impl::pot_tail_mean_impl<mpl::_1, unweighted, LeftRight> impl;
+ };
+ template<typename LeftRight>
+ struct weighted_pot_tail_mean
+ : depends_on<weighted_peaks_over_threshold<LeftRight>, weighted_pot_quantile<LeftRight> >
+ {
+ /// INTERNAL ONLY
+ ///
+ typedef accumulators::impl::pot_tail_mean_impl<mpl::_1, weighted, LeftRight> impl;
+ };
+ template<typename LeftRight>
+ struct weighted_pot_tail_mean_prob
+ : depends_on<weighted_peaks_over_threshold_prob<LeftRight>, weighted_pot_quantile_prob<LeftRight> >
+ {
+ /// INTERNAL ONLY
+ ///
+ typedef accumulators::impl::pot_tail_mean_impl<mpl::_1, weighted, LeftRight> impl;
+ };
+}
+
+// pot_tail_mean<LeftRight>(with_threshold_value) -> pot_tail_mean<LeftRight>
+template<typename LeftRight>
+struct as_feature<tag::pot_tail_mean<LeftRight>(with_threshold_value)>
+{
+ typedef tag::pot_tail_mean<LeftRight> type;
+};
+
+// pot_tail_mean<LeftRight>(with_threshold_probability) -> pot_tail_mean_prob<LeftRight>
+template<typename LeftRight>
+struct as_feature<tag::pot_tail_mean<LeftRight>(with_threshold_probability)>
+{
+ typedef tag::pot_tail_mean_prob<LeftRight> type;
+};
+
+// weighted_pot_tail_mean<LeftRight>(with_threshold_value) -> weighted_pot_tail_mean<LeftRight>
+template<typename LeftRight>
+struct as_feature<tag::weighted_pot_tail_mean<LeftRight>(with_threshold_value)>
+{
+ typedef tag::weighted_pot_tail_mean<LeftRight> type;
+};
+
+// weighted_pot_tail_mean<LeftRight>(with_threshold_probability) -> weighted_pot_tail_mean_prob<LeftRight>
+template<typename LeftRight>
+struct as_feature<tag::weighted_pot_tail_mean<LeftRight>(with_threshold_probability)>
+{
+ typedef tag::weighted_pot_tail_mean_prob<LeftRight> type;
+};
+
+// for the purposes of feature-based dependency resolution,
+// pot_tail_mean<LeftRight> and pot_tail_mean_prob<LeftRight> provide
+// the same feature as tail_mean
+template<typename LeftRight>
+struct feature_of<tag::pot_tail_mean<LeftRight> >
+ : feature_of<tag::tail_mean>
+{
+};
+
+template<typename LeftRight>
+struct feature_of<tag::pot_tail_mean_prob<LeftRight> >
+ : feature_of<tag::tail_mean>
+{
+};
+
+// So that pot_tail_mean can be automatically substituted
+// with weighted_pot_tail_mean when the weight parameter is non-void.
+template<typename LeftRight>
+struct as_weighted_feature<tag::pot_tail_mean<LeftRight> >
+{
+ typedef tag::weighted_pot_tail_mean<LeftRight> type;
+};
+
+template<typename LeftRight>
+struct feature_of<tag::weighted_pot_tail_mean<LeftRight> >
+ : feature_of<tag::pot_tail_mean<LeftRight> >
+{
+};
+
+// So that pot_tail_mean_prob can be automatically substituted
+// with weighted_pot_tail_mean_prob when the weight parameter is non-void.
+template<typename LeftRight>
+struct as_weighted_feature<tag::pot_tail_mean_prob<LeftRight> >
+{
+ typedef tag::weighted_pot_tail_mean_prob<LeftRight> type;
+};
+
+template<typename LeftRight>
+struct feature_of<tag::weighted_pot_tail_mean_prob<LeftRight> >
+ : feature_of<tag::pot_tail_mean_prob<LeftRight> >
+{
+};
+
+}} // namespace boost::accumulators
+
+#endif
=== added file 'boost/boost/accumulators/statistics/rolling_count.hpp'
--- boost/boost/accumulators/statistics/rolling_count.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/statistics/rolling_count.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,80 @@
+///////////////////////////////////////////////////////////////////////////////
+// rolling_count.hpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#ifndef BOOST_ACCUMULATORS_STATISTICS_ROLLING_COUNT_HPP_EAN_26_12_2008
+#define BOOST_ACCUMULATORS_STATISTICS_ROLLING_COUNT_HPP_EAN_26_12_2008
+
+#include <boost/mpl/placeholders.hpp>
+#include <boost/accumulators/framework/accumulator_base.hpp>
+#include <boost/accumulators/framework/extractor.hpp>
+#include <boost/accumulators/numeric/functional.hpp>
+#include <boost/accumulators/framework/parameters/sample.hpp>
+#include <boost/accumulators/framework/depends_on.hpp>
+#include <boost/accumulators/statistics_fwd.hpp>
+#include <boost/accumulators/statistics/rolling_window.hpp>
+
+namespace boost { namespace accumulators
+{
+
+namespace impl
+{
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // rolling_count_impl
+ // returns the count of elements in the rolling window
+ template<typename Sample>
+ struct rolling_count_impl
+ : accumulator_base
+ {
+ typedef std::size_t result_type;
+
+ rolling_count_impl(dont_care)
+ {}
+
+ template<typename Args>
+ result_type result(Args const &args) const
+ {
+ return static_cast<std::size_t>(rolling_window_plus1(args).size()) - is_rolling_window_plus1_full(args);
+ }
+ };
+
+} // namespace impl
+
+///////////////////////////////////////////////////////////////////////////////
+// tag::rolling_count
+//
+namespace tag
+{
+ struct rolling_count
+ : depends_on< rolling_window_plus1 >
+ {
+ /// INTERNAL ONLY
+ ///
+ typedef accumulators::impl::rolling_count_impl< mpl::_1 > impl;
+
+ #ifdef BOOST_ACCUMULATORS_DOXYGEN_INVOKED
+ /// tag::rolling_window::window_size named parameter
+ static boost::parameter::keyword<tag::rolling_window_size> const window_size;
+ #endif
+ };
+} // namespace tag
+
+///////////////////////////////////////////////////////////////////////////////
+// extract::rolling_count
+//
+namespace extract
+{
+ extractor<tag::rolling_count> const rolling_count = {};
+
+ BOOST_ACCUMULATORS_IGNORE_GLOBAL(rolling_count)
+}
+
+using extract::rolling_count;
+
+}} // namespace boost::accumulators
+
+#endif
=== added file 'boost/boost/accumulators/statistics/rolling_mean.hpp'
--- boost/boost/accumulators/statistics/rolling_mean.hpp 1970-01-01 00:00:00 +0000
+++ boost/boost/accumulators/statistics/rolling_mean.hpp 2012-07-01 17:31:20 +0000
@@ -0,0 +1,81 @@
+///////////////////////////////////////////////////////////////////////////////
+// rolling_mean.hpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#ifndef BOOST_ACCUMULATORS_STATISTICS_ROLLING_MEAN_HPP_EAN_26_12_2008
+#define BOOST_ACCUMULATORS_STATISTICS_ROLLING_MEAN_HPP_EAN_26_12_2008
+
+#include <boost/mpl/placeholders.hpp>
+#include <boost/accumulators/framework/accumulator_base.hpp>
+#include <boost/accumulators/framework/extractor.hpp>
+#include <boost/accumulators/numeric/functional.hpp>
+#include <boost/accumulators/framework/parameters/sample.hpp>
+#include <boost/accumulators/framework/depends_on.hpp>
+#include <boost/accumulators/statistics_fwd.hpp>
+#include <boost/accumulators/statistics/rolling_sum.hpp>
+#include <boost/accumulators/statistics/rolling_count.hpp>
+
+namespace boost { namespace accumulators
+{
+
+namespace impl
+{
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // rolling_mean_impl
+ // returns the unshifted results from the shifted rolling window
+ template<typename Sample>
+ struct rolling_mean_impl
+ : accumulator_base
+ {
+ typedef typename numeric::functional::average<Sample, std::size_t>::result_type result_type;
+
+ rolling_mean_impl(dont_care)
+ {}
+
+ template<typename Args>
+ result_type result(Args const &args) const
+ {
+ return numeric::average(rolling_sum(args), rolling_count(args));
+ }
+ };
+
+} // namespace impl
+
+///////////////////////////////////////////////////////////////////////////////
+// tag::rolling_mean
+//
+namespace tag
+{
+ struct rolling_mean
+ : depends_on< rolling_sum, rolling_count >
+ {
+ /// INTERNAL ONLY
+ ///
+ typedef accumulators::impl::roll
Follow ups