diff --git a/RippleD.props b/RippleD.props
index 17597548c4..4d5516806b 100644
--- a/RippleD.props
+++ b/RippleD.props
@@ -15,7 +15,7 @@
USE_LEVELDB;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)trueLevel3
- $(RepoDir);$(RepoDir)\src\cpp\leveldb;$(RepoDir)\src\cpp\leveldb\include;$(RepoDir)\src\cpp\protobuf\src;$(RepoDir)\src\cpp\protobuf\vsprojects;$(RepoDir)\build\proto;%(AdditionalIncludeDirectories)
+ $(RepoDir);$(RepoDir)\src\cpp\leveldb;$(RepoDir)\src\cpp\leveldb\include;$(RepoDir)\src\cpp\protobuf\src;$(RepoDir)\src\cpp\protobuf\vsprojects;$(RepoDir)\build\proto;$(RepoDir)\Subtrees\beast;%(AdditionalIncludeDirectories)/bigobj %(AdditionalOptions)
diff --git a/SConstruct b/SConstruct
index fe051edb35..61b2ec991f 100644
--- a/SConstruct
+++ b/SConstruct
@@ -5,27 +5,28 @@
import commands
import copy
import glob
+import os
import platform
import re
-LevelDB = bool(1)
+LevelDB = bool(1)
-OSX = bool(platform.mac_ver()[0])
-FreeBSD = bool('FreeBSD' == platform.system())
-Linux = bool('Linux' == platform.system())
-Ubuntu = bool(Linux and 'Ubuntu' == platform.linux_distribution()[0])
+OSX = bool(platform.mac_ver()[0])
+FreeBSD = bool('FreeBSD' == platform.system())
+Linux = bool('Linux' == platform.system())
+Ubuntu = bool(Linux and 'Ubuntu' == platform.linux_distribution()[0])
if OSX or Ubuntu:
- CTAGS = '/usr/bin/ctags'
+ CTAGS = '/usr/bin/ctags'
else:
- CTAGS = '/usr/bin/exuberant-ctags'
+ CTAGS = '/usr/bin/exuberant-ctags'
#
# scons tools
#
env = Environment(
- tools = ['default', 'protoc']
+ tools = ['default', 'protoc']
)
GCC_VERSION = re.split('\.', commands.getoutput(env['CXX'] + ' -dumpversion'))
@@ -40,9 +41,9 @@ GCC_VERSION = re.split('\.', commands.getoutput(env['CXX'] + ' -dumpversion'))
ctags = Builder(action = '$CTAGS $CTAGSOPTIONS -f $TARGET $SOURCES')
env.Append(BUILDERS = { 'CTags' : ctags })
if OSX:
- env.Replace(CTAGS = CTAGS)
+ env.Replace(CTAGS = CTAGS)
else:
- env.Replace(CTAGS = CTAGS, CTAGSOPTIONS = '--tag-relative')
+ env.Replace(CTAGS = CTAGS, CTAGSOPTIONS = '--tag-relative')
# Use openssl
env.ParseConfig('pkg-config --cflags --libs openssl')
@@ -56,35 +57,88 @@ env.ParseConfig('pkg-config --cflags --libs openssl')
# FreeBSD and Ubuntu non-mt libs do link with pthreads.
if FreeBSD or Ubuntu:
env.Append(
- LIBS = [
- 'boost_date_time',
- 'boost_filesystem',
- 'boost_program_options',
- 'boost_regex',
- 'boost_system',
- 'boost_thread',
- 'boost_random',
- ]
+ LIBS = [
+ 'boost_date_time',
+ 'boost_filesystem',
+ 'boost_program_options',
+ 'boost_regex',
+ 'boost_system',
+ 'boost_thread',
+ 'boost_random',
+ ]
)
else:
env.Append(
- LIBS = [
- 'boost_date_time-mt',
- 'boost_filesystem-mt',
- 'boost_program_options-mt',
- 'boost_regex-mt',
- 'boost_system-mt',
- 'boost_thread-mt',
- 'boost_random-mt',
- ]
+ LIBS = [
+ 'boost_date_time-mt',
+ 'boost_filesystem-mt',
+ 'boost_program_options-mt',
+ 'boost_regex-mt',
+ 'boost_system-mt',
+ 'boost_thread-mt',
+ 'boost_random-mt',
+ ]
)
+#-------------------------------------------------------------------------------
+#
+# VFALCO: This is my oasis of sanity. Nothing having to do with directories,
+# source files, or include paths should reside outside the boundaries.
+#
+
+# List of includes passed to the C++ compiler.
+# These are all relative to the repo dir.
+#
+INCLUDE_PATHS = [
+ '.',
+ 'build/proto',
+ 'src/cpp/leveldb',
+ 'src/cpp/leveldb/port',
+ 'src/cpp/leveldb/include',
+ 'src/cpp/ripple',
+ 'Subtrees/beast'
+ ]
+
+COMPILED_FILES = [
+ 'src/cpp/database/sqlite3.c',
+ 'src/cpp/leveldb_core.cpp',
+ 'src/cpp/websocket_core.cpp',
+ 'modules/ripple_basics/ripple_basics.cpp',
+ 'modules/ripple_client/ripple_client.cpp',
+ 'modules/ripple_data/ripple_data.cpp',
+ 'modules/ripple_db/ripple_db.cpp',
+ 'modules/ripple_json/ripple_json.cpp',
+ 'modules/ripple_ledger/ripple_ledger.cpp',
+ 'modules/ripple_main/ripple_main.cpp',
+ 'modules/ripple_mess/ripple_mess.cpp',
+ 'modules/ripple_net/ripple_net.cpp',
+ 'Subtrees/beast/modules/beast_core/beast_core.cpp'
+ ]
+
+#-------------------------------------------------------------------------------
+
+# Map top level source directories to their location in the outputs
+#
+
+VariantDir('build/obj/src', 'src', duplicate=0)
+VariantDir('build/obj/modules', 'modules', duplicate=0)
+VariantDir('build/obj/Subtrees', 'Subtrees', duplicate=0)
+
+#-------------------------------------------------------------------------------
+
+# Add the list of includes to compiler include paths.
+#
+for path in INCLUDE_PATHS:
+ env.Append (CPPPATH = [ path ])
+
+#-------------------------------------------------------------------------------
+
# Apparently, only linux uses -ldl
if not FreeBSD:
env.Append(
- LIBS = [
- 'dl', # dynamic linking for linux
- ]
+ LIBS = [
+ 'dl', # dynamic linking for linux
+ ]
)
# Apparently, pkg-config --libs protobuf on bsd fails to provide this necessary include dir.
@@ -93,93 +147,47 @@ if FreeBSD:
env.Append(CXXFLAGS = ['-DOS_FREEBSD'])
env.Append(
- LIBS = [
- 'protobuf',
- 'z'
- ]
+ LIBS = [
+ 'protobuf',
+ 'z'
+ ]
)
-DEBUGFLAGS = ['-g', '-DDEBUG']
-BOOSTFLAGS = ['-DBOOST_TEST_DYN_LINK', '-DBOOST_FILESYSTEM_NO_DEPRECATED']
+DEBUGFLAGS = ['-g', '-DDEBUG']
+BOOSTFLAGS = ['-DBOOST_TEST_DYN_LINK', '-DBOOST_FILESYSTEM_NO_DEPRECATED']
env.Append(LINKFLAGS = ['-rdynamic', '-pthread'])
env.Append(CCFLAGS = ['-pthread', '-Wall', '-Wno-sign-compare', '-Wno-char-subscripts', '-DSQLITE_THREADSAFE=1'])
env.Append(CXXFLAGS = ['-O0', '-pthread', '-Wno-invalid-offsetof', '-Wformat']+BOOSTFLAGS+DEBUGFLAGS)
env.Append(CXXFLAGS = ['-DUSE_LEVELDB'])
-env.Append(CPPPATH = [ 'src/cpp/leveldb', 'src/cpp/leveldb/port', 'src/cpp/leveldb/include'])
-env.Append(CPPPATH = [ 'build/proto'])
-env.Append(CPPPATH = [ '.', 'src/cpp/ripple'])
-
if (int(GCC_VERSION[0]) > 4 or (int(GCC_VERSION[0]) == 4 and int(GCC_VERSION[1]) >= 7)):
env.Append(CXXFLAGS = ['-std=c++11'])
if OSX:
- env.Append(LINKFLAGS = ['-L/usr/local/opt/openssl/lib'])
- env.Append(CXXFLAGS = ['-I/usr/local/opt/openssl/include'])
-
-RIPPLE_SRCS = [
- 'src/cpp/database/sqlite3.c',
- 'src/cpp/leveldb_core.cpp',
- 'src/cpp/websocket_core.cpp',
- 'modules/ripple_basics/ripple_basics.cpp',
- 'modules/ripple_client/ripple_client.cpp',
- 'modules/ripple_data/ripple_data.cpp',
- 'modules/ripple_db/ripple_db.cpp',
- 'modules/ripple_json/ripple_json.cpp',
- 'modules/ripple_ledger/ripple_ledger.cpp',
- 'modules/ripple_main/ripple_main.cpp',
- 'modules/ripple_mess/ripple_mess.cpp',
- 'modules/ripple_net/ripple_net.cpp'
- ]
-
-# Put objects files in their own directory.
-for dir in ['.', 'ripple', 'database', 'json', 'leveldb/db', 'leveldb/port', 'leveldb/include', 'leveldb/table', 'leveldb/util', 'websocketpp']:
- VariantDir('build/obj/'+dir, 'src/cpp/'+dir, duplicate=0)
-
-for dir in [
- 'ripple_basics',
- 'ripple_client',
- 'ripple_data',
- 'ripple_db',
- 'ripple_json',
- 'ripple_ledger',
- 'ripple_main',
- 'ripple_mess',
- 'ripple_net'
- ]:
- VariantDir('build/obj/'+dir, 'modules/'+dir, duplicate=0)
+ env.Append(LINKFLAGS = ['-L/usr/local/opt/openssl/lib'])
+ env.Append(CXXFLAGS = ['-I/usr/local/opt/openssl/include'])
PROTO_SRCS = env.Protoc([], 'src/cpp/ripple/ripple.proto', PROTOCOUTDIR='build/proto', PROTOCPYTHONOUTDIR=None)
env.Clean(PROTO_SRCS, 'site_scons/site_tools/protoc.pyc')
-# PROTO_SRCS = [ 'src/cpp/protobuf_core.cpp' ]
-# env.Append(CXXFLAGS = ['-Ibuild/proto', '-Isrc/cpp/protobuf/src', '-Isrc/cpp/protobuf/vsprojects' ])
-
-# Remove unused source files.
-UNUSED_SRCS = []
-
-for file in UNUSED_SRCS:
- RIPPLE_SRCS.remove(file)
# Only tag actual Ripple files.
-TAG_SRCS = copy.copy(RIPPLE_SRCS)
+TAG_SRCS = copy.copy(COMPILED_FILES)
# Derive the object files from the source files.
-RIPPLE_OBJS = []
+OBJECT_FILES = []
-RIPPLE_OBJS += PROTO_SRCS
+OBJECT_FILES += PROTO_SRCS
-for file in RIPPLE_SRCS:
- # Strip src/cpp/ or modules/
- RIPPLE_OBJS.append('build/obj/' + file[8:])
+for file in COMPILED_FILES:
+ OBJECT_FILES.append('build/obj/' + file)
#
# Targets
#
-rippled = env.Program('build/rippled', RIPPLE_OBJS)
+rippled = env.Program('build/rippled', OBJECT_FILES)
-tags = env.CTags('tags', TAG_SRCS)
+tags = env.CTags('tags', TAG_SRCS)
Default(rippled, tags)
-
diff --git a/Subtrees/README.txt b/Subtrees/README.txt
new file mode 100644
index 0000000000..587675f47a
--- /dev/null
+++ b/Subtrees/README.txt
@@ -0,0 +1,2 @@
+These directories come from entire outside repositories
+brought in using git-subtree.
diff --git a/Subtrees/beast/.gitattributes b/Subtrees/beast/.gitattributes
new file mode 100644
index 0000000000..8d9c7343dc
--- /dev/null
+++ b/Subtrees/beast/.gitattributes
@@ -0,0 +1,12 @@
+# Set default behaviour, in case users don't have core.autocrlf set.
+* text=auto
+
+# Github
+.md text eol=lf
+
+# Visual Studio
+*.sln text eol=crlf
+*.vcproj text eol=crlf
+*.vcxproj text eol=crlf
+*.props text eol=crlf
+*.filters text eol=crlf
diff --git a/Subtrees/beast/.gitignore b/Subtrees/beast/.gitignore
new file mode 100644
index 0000000000..86b5dea12c
--- /dev/null
+++ b/Subtrees/beast/.gitignore
@@ -0,0 +1,3 @@
+Builds/VisualStudio2012/Debug
+Builds/VisualStudio2012/Release
+Builds/VisualStudio2012/*.user
diff --git a/Subtrees/beast/Builds/VisualStudio2012/beast.vcxproj b/Subtrees/beast/Builds/VisualStudio2012/beast.vcxproj
new file mode 100644
index 0000000000..9fe1e1d3bf
--- /dev/null
+++ b/Subtrees/beast/Builds/VisualStudio2012/beast.vcxproj
@@ -0,0 +1,88 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {73C5A0F0-7629-4DE7-9194-BE7AC6C19535}
+ Win32Proj
+ beast
+
+
+
+ StaticLibrary
+ true
+ v110
+ Unicode
+
+
+ StaticLibrary
+ false
+ v110
+ true
+ Unicode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Level3
+ Disabled
+ WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)
+
+
+ Windows
+ true
+
+
+
+
+ Level3
+
+
+ MaxSpeed
+ true
+ true
+ WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)
+
+
+ Windows
+ true
+ true
+ true
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Subtrees/beast/Builds/VisualStudio2012/beast.vcxproj.filters b/Subtrees/beast/Builds/VisualStudio2012/beast.vcxproj.filters
new file mode 100644
index 0000000000..d690caaf4b
--- /dev/null
+++ b/Subtrees/beast/Builds/VisualStudio2012/beast.vcxproj.filters
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+ beast_core
+
+
+
+
+ {6dafd8d5-2901-4b41-85b7-52f6e86baacc}
+
+
+ {883f776d-bec2-4e7a-b4e8-726ed3039071}
+
+
+
+
+ beast_core\memory
+
+
+ beast_core
+
+
+
+
+ beast_core
+
+
+
\ No newline at end of file
diff --git a/Subtrees/beast/CodingStyle.md b/Subtrees/beast/CodingStyle.md
new file mode 100644
index 0000000000..b9845fa2e4
--- /dev/null
+++ b/Subtrees/beast/CodingStyle.md
@@ -0,0 +1,200 @@
+--------------------------------------------------------------------------------
+
+# Coding Standards
+
+Coding standards used here are extreme strict and consistent. The style
+evolved gradually over the years, incorporating generally acknowledged
+best-practice C++ advice, experience, and personal preference.
+
+## D.R.Y.: Don't Repeat Yourself!
+
+The [Don't Repeat Yourself][1] principle summarises the essence of what it
+means to write good code, in all languages, at all levels.
+
+## Formatting
+
+* No tab characters!
+* Tabs are 4 spaces!
+* Braces are indented in the [Allman style][2].
+* Always put a space before and after all binary operators, especially
+ the assignment `operator=`!
+* The `!` operator should always be followed by a space.
+* The `~` operator should be preceded by a space, but not followed by one.
+* The `++` and `--` operators should have no spaces between the operator and its
+ operand.
+* Never put a space before a comma. Always put a space after a comma.
+* Always put a space before an open parenthesis! (One exception to this is if
+ you've got a pair of empty parentheses)
+* Don't put spaces after a parenthesis. A typical member function call might
+ look like this: `foobar (1, 2, 3);`
+* In general, leave a blank line before an `if` statement.
+* In general, leave a blank line after a closing brace `}`.
+* Do not write `if` statements all-on-one-line. The exception to this is when
+ you've got a sequence of similar if statements, and are aligning them all
+ vertically to highlight their similarities.
+* In an `if-else` statement, if you surround one half of the statement with
+ braces, you also need to put braces around the other half, to match.
+* When writing a pointer type, use this spacing: `SomeObject* myObject`.
+ Technically, a more correct spacing would be `SomeObject *myObject`, but
+ it makes more sense for the asterisk to be grouped with the type name,
+ since being a pointer is part of the type, not the variable name. The only
+ time that this can lead to any problems is when you're declaring multiple
+ pointers of the same type in the same statement - which leads on to the next
+ rule:
+* When declaring multiple pointers, never do so in a single statement, e.g.
+ `SomeObject* p1, *p2;` - instead, always split them out onto separate lines
+ and write the type name again, to make it quite clear what's going on, and
+ avoid the danger of missing out any vital asterisks.
+* The previous point also applies to references, so always put the `&` next to
+ the type rather than the variable, e.g. "void foo (const Thing& thing)". And
+ don't put a space on both sides of the `*` or `&` - always put a space after
+ it, but never before it.
+* The word `const` should be placed to the right of the thing that it modifies,
+ for consistency. For example `int const` refers to an int which is const.
+ `int const*` is a pointer to an int which is const. `int *const` is a const
+ pointer to an int.
+* Always place a space in between the template angle brackets and the type
+ name. Template code is already hard enough to read!
+
+## Naming conventions
+
+* Member variables and method names are written with camel-case, and never begin
+ with a capital letter.
+* Class names are also written in camel-case, but always begin with a capital
+ letter.
+* For global variables... well, you shouldn't have any, so it doesn't matter.
+* Class data members begin with `m_`, static data members begin with `s_`. Global
+ variables begin with `g_`. This is so the scope of the corresponding declaration
+ can be easily determined.
+* Avoid underscores in your names, especially leading or trailing underscores.
+ In particular, leading underscores should be avoided, as these are often used
+ in standard library code, so to use them in your own code looks quite jarring.
+* If you really have to write a macro for some reason, then make it all caps,
+ with underscores to separate the words. And obviously make sure that its name
+ is unlikely to clash with symbols used in other libraries or 3rd party code.
+
+## Types, const-correctness, etc
+
+* If a method can (and should!) be const, make it const!
+* If a method definitely doesn't throw an exception (be careful!), mark it as
+ `noexcept`
+* When returning a temporary object, e.g. a String, the returned object should be
+ non-const, so that if the class has a C++11 move operator, it can be used.
+* If a local variable can be const, then make it const!
+* Remember that pointers can be const as well as primitives - for example, if you
+ have a char pointer whose contents are going to be altered, you may still be
+ able to make the pointer itself const, e.g. `char* const foobar = getFoobar();`.
+* Do not declare all your local variables at the top of a function or method
+ (i.e. in the old-fashioned C-style). Declare them at the last possible moment,
+ and give them as small a scope as possible.
+* Object parameters should be passed as const references wherever possible. Only
+ pass a parameter as a copy-by-value object if you really need to mutate a local
+ copy inside the method, and if making a local copy inside the method would be
+ difficult.
+* Use portable `for()` loop variable scoping (i.e. do not have multiple for loops
+ in the same scope that each re-declare the same variable name, as this fails on
+ older compilers)
+* When you're testing a pointer to see if it's null, never write `if (myPointer)`.
+ Always avoid that implicit cast-to-bool by writing it more fully:
+ `if (myPointer != nullptr)`. And likewise, never ever write `if (! myPointer)`,
+ instead always write `if (myPointer == null)`. It is more readable that way.
+* Avoid C-style casts except when converting between primitive numeric types.
+ Some people would say "avoid C-style casts altogether", but `static_cast` is
+ a bit unreadable when you just want to cast an `int` to a `float`. But whenever
+ a pointer is involved, or a non-primitive object, always use `static_cast`.
+ And when you're reinterpreting data, always use `reinterpret_cast`.
+* Until C++ gets a universal 64-bit primitive type (part of the C++11 standard),
+ it's best to stick to the int64 and uint64 typedefs.
+
+## Object lifetime and ownership
+
+* Absolutely do NOT use `delete`, `deleteAndZero`, etc. There are very very few
+ situations where you can't use a `ScopedPointer` or some other automatic
+ lifetime management class.
+* Do not use `new` unless there's no alternative. Whenever you type `new`, always
+ treat it as a failure to find a better solution. If a local variable can be
+ allocated on the stack rather than the heap, then always do so.
+* Do not ever use `new` or `malloc` to allocate a C++ array. Always use a
+ `HeapBlock` instead.
+* ..and just to make it doubly clear: Never use `malloc` or `calloc`.
+* If a parent object needs to create and own some kind of child object, always
+ use composition as your first choice. If that's not possible (e.g. if the child
+ needs a pointer to the parent for its constructor), then use a `ScopedPointer`.
+* If possible, pass an object as a reference rather than a pointer. If possible,
+ make it a const reference.
+* Obviously avoid static and global values. Sometimes there's no alternative, but
+ if there is an alternative, then use it, no matter how much effort it involves.
+* If allocating a local POD structure (e.g. an operating-system structure in
+ native code), and you need to initialise it with zeros, use the `= { 0 };`
+ syntax as your first choice for doing this. If for some reason that's not
+ appropriate, use the `zerostruct()` function, or in case that isn't suitable,
+ use `zeromem()`. Don't use `memset()`.
+
+## Classes
+
+* Declare a class's public section first, and put its constructors and destructor
+ first. Any protected items come next, and then private ones.
+* Preferred
+ positioning for any inherited classes is to put them to the right of the class
+ name, vertically aligned, e.g.:
+
+ class Thing : public Foo,
+ private Bar
+ {
+ }
+* Put a class's member variables (which should almost always be private, of course),
+ after all the public and protected method declarations.
+* Any private methods can go towards the end of the class, after the member
+ variables.
+* If your class does not have copy-by-value semantics, derive the class from
+ `Uncopyable`.
+* If your class is likely to be leaked, then derive your class from
+ `LeakChecked<>`.
+* Constructors that take a single parameter should be default be marked
+ `explicit`. Obviously there are cases where you do want implicit conversion,
+ but always think about it carefully before writing a non-explicit constructor.
+* Do not use `NULL`, `null`, or 0 for a null-pointer. And especially never use
+ '0L', which is particulary burdensome. Use `nullptr` instead - this is the
+ C++2011 standard, so get used to it. There's a fallback definition for `nullptr`
+ in Beast, so it's always possible to use it even if your compiler isn't yet
+ C++2011 compliant.
+* All the C++ 'guru' books and articles are full of excellent and detailed advice
+ on when it's best to use inheritance vs composition. If you're not already
+ familiar with the received wisdom in these matters, then do some reading!
+
+## Miscellaneous
+
+* Don't use macros! OK, obviously there are many situations where they're the
+ right tool for the job, but treat them as a last resort. Certainly don't ever
+ use a macro just to hold a constant value or to perform any kind of function
+ that could have been done as a real inline function. And it goes without saying
+ that you should give them names which aren't going to clash with other code.
+ And #undef them after you've used them, if possible.
+* When using the ++ or -- operators, never use post-increment if pre-increment
+ could be used instead. Although it doesn't matter for primitive types, it's good
+ practice to pre-increment since this can be much more efficient for more complex
+ objects. In particular, if you're writing a for loop, always use pre-increment,
+ e.g. `for (int = 0; i < 10; ++i)`
+* Never put an "else" statement after a "return"! This is well-explained in the
+ LLVM coding standards...and a couple of other very good pieces of advice from
+ the LLVM standards are in there as well.
+* When getting a possibly-null pointer and using it only if it's non-null, limit
+ the scope of the pointer as much as possible - e.g. Do NOT do this:
+
+ Foo* f = getFoo(); if (f != nullptr) f->doSomething();
+ ...lots of code...
+ f->doSomething(); // oops! f may be null!
+
+ ..instead, prefer to write it like this, which reduces the scope of the
+ pointer, making it impossible to write code that accidentally uses a null
+ pointer:
+
+ if (Foo* f = getFoo())
+ f->doSomethingElse();
+
+ // f is out-of-scope here, so impossible to use it if it's null
+
+ (This also results in smaller, cleaner code)
+
+[1]: http://en.wikipedia.org/wiki/Don%27t_repeat_yourself
+[2]: http://en.wikipedia.org/wiki/Indent_style#Allman_style
diff --git a/Subtrees/beast/ReadMe.md b/Subtrees/beast/ReadMe.md
new file mode 100644
index 0000000000..9c8689bda5
--- /dev/null
+++ b/Subtrees/beast/ReadMe.md
@@ -0,0 +1,8 @@
+# Beast: An amazing cross platform library
+
+Contains cross platform objects to do a variety of useful things.
+No external dependencies, no complicated build steps.
+
+Things people need for building peer to peer, concurrent, cryptographic systems.
+
+The hope is that this will replace the use of boost and other cumbersome jalopies.
diff --git a/Subtrees/beast/modules/beast_core/beast_core.cpp b/Subtrees/beast/modules/beast_core/beast_core.cpp
new file mode 100644
index 0000000000..939a512ed3
--- /dev/null
+++ b/Subtrees/beast/modules/beast_core/beast_core.cpp
@@ -0,0 +1,2 @@
+
+#include "beast_core.h"
diff --git a/Subtrees/beast/modules/beast_core/beast_core.h b/Subtrees/beast/modules/beast_core/beast_core.h
new file mode 100644
index 0000000000..65284cd1e8
--- /dev/null
+++ b/Subtrees/beast/modules/beast_core/beast_core.h
@@ -0,0 +1,10 @@
+
+#include
+#include
+
+namespace beast
+{
+
+#include "memory/beast_ScopedPointer.h"
+
+}
diff --git a/Subtrees/beast/modules/beast_core/beast_core.mm b/Subtrees/beast/modules/beast_core/beast_core.mm
new file mode 100644
index 0000000000..96fbd4d0a8
--- /dev/null
+++ b/Subtrees/beast/modules/beast_core/beast_core.mm
@@ -0,0 +1 @@
+#include "beast_core.cpp"
diff --git a/Subtrees/beast/modules/beast_core/memory/beast_ScopedPointer.h b/Subtrees/beast/modules/beast_core/memory/beast_ScopedPointer.h
new file mode 100644
index 0000000000..e9c6cb16e2
--- /dev/null
+++ b/Subtrees/beast/modules/beast_core/memory/beast_ScopedPointer.h
@@ -0,0 +1,86 @@
+
+#ifndef BEAST_SCOPEDPOINTER_BEASTHEADER
+#define BEAST_SCOPEDPOINTER_BEASTHEADER
+
+template
+class ScopedPointer
+{
+public:
+ inline ScopedPointer() : object (0)
+ {
+ }
+
+ inline ScopedPointer (ObjectType* const objectToTakePossessionOf)
+ : object (objectToTakePossessionOf)
+ {
+ }
+
+ ScopedPointer (ScopedPointer& objectToTransferFrom)
+ : object (objectToTransferFrom.object)
+ {
+ objectToTransferFrom.object = 0;
+ }
+
+ inline ~ScopedPointer() { delete object; }
+
+ ScopedPointer& operator= (ScopedPointer& objectToTransferFrom)
+ {
+ if (this != objectToTransferFrom.getAddress())
+ {
+ ObjectType* const oldObject = object;
+ object = objectToTransferFrom.object;
+ objectToTransferFrom.object = 0;
+ delete oldObject;
+ }
+
+ return *this;
+ }
+
+ ScopedPointer& operator= (ObjectType* const newObjectToTakePossessionOf)
+ {
+ if (object != newObjectToTakePossessionOf)
+ {
+ ObjectType* const oldObject = object;
+ object = newObjectToTakePossessionOf;
+ delete oldObject;
+ }
+
+ return *this;
+ }
+
+ inline operator ObjectType*() const { return object; }
+ inline ObjectType* get() const { return object; }
+ inline ObjectType& operator*() const { return *object; }
+ inline ObjectType* operator->() const { return object; }
+
+ ObjectType* release() { ObjectType* const o = object; object = 0; return o; }
+
+ void swapWith (ScopedPointer & other)
+ {
+ std::swap (object, other.object);
+ }
+
+private:
+ ObjectType* object;
+
+ const ScopedPointer* getAddress() const { return this; }
+
+ #ifndef _MSC_VER
+ ScopedPointer (const ScopedPointer&);
+ ScopedPointer& operator= (const ScopedPointer&);
+ #endif
+};
+
+template
+bool operator== (const ScopedPointer& pointer1, ObjectType* const pointer2)
+{
+ return static_cast (pointer1) == pointer2;
+}
+
+template
+bool operator!= (const ScopedPointer& pointer1, ObjectType* const pointer2)
+{
+ return static_cast (pointer1) != pointer2;
+}
+
+#endif
diff --git a/modules/ripple_basics/ripple_basics.h b/modules/ripple_basics/ripple_basics.h
index 80f88ac66a..bc120b1bcc 100644
--- a/modules/ripple_basics/ripple_basics.h
+++ b/modules/ripple_basics/ripple_basics.h
@@ -122,6 +122,7 @@ namespace boost {
#include // For HashUtilities
#include // For HashUtilities
+#include "modules/beast_core/beast_core.h"
#include "../ripple_json/ripple_json.h"
diff --git a/newcoin.sln b/newcoin.sln
index e4ca352a2f..ee369eb98b 100644
--- a/newcoin.sln
+++ b/newcoin.sln
@@ -3,6 +3,8 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Express 2012 for Windows Desktop
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "newcoin", "newcoin.vcxproj", "{19465545-42EE-42FA-9CC8-F8975F8F1CC7}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "beast", "Subtrees\beast\Builds\VisualStudio2012\beast.vcxproj", "{73C5A0F0-7629-4DE7-9194-BE7AC6C19535}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@@ -18,6 +20,12 @@ Global
{19465545-42EE-42FA-9CC8-F8975F8F1CC7}.Release|Win32.ActiveCfg = Release|Win32
{19465545-42EE-42FA-9CC8-F8975F8F1CC7}.Release|Win32.Build.0 = Release|Win32
{19465545-42EE-42FA-9CC8-F8975F8F1CC7}.Release|x64.ActiveCfg = Release|Win32
+ {73C5A0F0-7629-4DE7-9194-BE7AC6C19535}.Debug|Win32.ActiveCfg = Debug|Win32
+ {73C5A0F0-7629-4DE7-9194-BE7AC6C19535}.Debug|Win32.Build.0 = Debug|Win32
+ {73C5A0F0-7629-4DE7-9194-BE7AC6C19535}.Debug|x64.ActiveCfg = Debug|Win32
+ {73C5A0F0-7629-4DE7-9194-BE7AC6C19535}.Release|Win32.ActiveCfg = Release|Win32
+ {73C5A0F0-7629-4DE7-9194-BE7AC6C19535}.Release|Win32.Build.0 = Release|Win32
+ {73C5A0F0-7629-4DE7-9194-BE7AC6C19535}.Release|x64.ActiveCfg = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/newcoin.vcxproj.filters b/newcoin.vcxproj.filters
index ba1b56c5d8..aa4fded316 100644
--- a/newcoin.vcxproj.filters
+++ b/newcoin.vcxproj.filters
@@ -4,6 +4,9 @@
{475c5b33-c9b5-415f-89df-fb9961f3b57c}
+
+ {290b7b39-a4e6-4b8b-b464-d1e458562fdd}
+ {60c3631e-8855-4a61-bdd3-9892d96242d5}
diff --git a/src/cpp/ripple/Application.cpp b/src/cpp/ripple/Application.cpp
index c5e73f8a09..bee8128d99 100644
--- a/src/cpp/ripple/Application.cpp
+++ b/src/cpp/ripple/Application.cpp
@@ -406,7 +406,6 @@ Application::~Application()
{
delete mValidations;
delete mFeeTrack;
- delete mFeeVote;
delete mTxnDB;
delete mLedgerDB;
diff --git a/src/cpp/ripple/Application.h b/src/cpp/ripple/Application.h
index 90c8a4e885..fc15c44694 100644
--- a/src/cpp/ripple/Application.h
+++ b/src/cpp/ripple/Application.h
@@ -66,7 +66,7 @@ class Application
OrderBookDB mOrderBookDB;
// VFALCO: Clean stuff
- IFeeVote* mFeeVote;
+ beast::ScopedPointer mFeeVote;
ILoadFeeTrack* mFeeTrack;
IValidations* mValidations;
// VFALCO: End Clean stuff