Compare commits

..

215 Commits

Author SHA1 Message Date
Vinnie Falco
b9454e0f0c Set version to 0.26.2 2014-08-12 12:19:13 -07:00
Vinnie Falco
26181907fc Merge branch 'release-next' into release
Conflicts:
	src/ripple/module/app/paths/cursor/ForwardLiquidity.cpp
	src/ripple/overlay/tests/peer_info.test.cpp
	src/ripple/unity/http.h
2014-08-12 12:19:04 -07:00
Miguel Portilla
ed597e5e99 Add owner_funds to subscription streams (RIPD-377) 2014-08-12 11:54:49 -07:00
Miguel Portilla
2c88c15f7f Fix unhandled exception in async HTTP server (RIPD-475) 2014-08-12 11:54:02 -07:00
Vinnie Falco
cfd3642cb1 Set version to 0.26.2-alpha-4 2014-08-07 17:13:55 -07:00
Tom Ritchford
f493590604 Logic fix for multiquality issues. 2014-08-07 17:10:38 -07:00
Vinnie Falco
8c084a3de8 Set version to 0.26.2-alpha-3 2014-08-07 10:13:22 -07:00
Tom Ritchford
985aa803a4 Fix error with multi-quality paths. 2014-08-07 10:12:09 -07:00
Vinnie Falco
9e319d7bd6 Set version to 0.26.2-alpha-2 2014-08-06 10:16:13 -07:00
David Schwartz
a122e176d7 Pathfinding fixes:
* Don't consider global freeze if not enforcing
 * Log if a covering path fails to cover
2014-08-06 10:16:12 -07:00
Tom Ritchford
88a6f2931e Fix local variable unfundedOffers that was shadowing a class variable. 2014-08-06 09:26:22 -07:00
Vinnie Falco
54f3a83e25 Fix missing return values in headers_t 2014-08-05 16:43:13 -07:00
Vinnie Falco
0955c0d8d3 Set version to 0.26.2-alpha-1 2014-08-05 15:40:34 -07:00
JoelKatz
6bb5be5216 Avoid a mutex 99+% of the time in SField::getField 2014-08-05 15:36:12 -07:00
JoelKatz
c9cd7e4be0 Rewrite STObject::setType for improved performance 2014-08-05 15:36:05 -07:00
Miguel Portilla
ce2cecf046 Add owner_funds to client subscription data (RIPD-377)
Conflicts:
	src/ripple/module/app/ledger/AcceptedLedger.cpp
2014-08-05 15:04:50 -07:00
Vinnie Falco
6e934ee6a1 HTTP handshake in peer protocol (RIPD-351):
* New I/O paths for client and server role
* New handshake_analyzer detects the peer protocol
* New basic_message class for parsing and storing HTTP messages
* Conditional compilation for selective feature enabling.
* Server supports both current handshake and HTTP handshake
2014-08-05 13:17:02 -07:00
Vinnie Falco
723d7d1263 HTTP support improvements:
* RFC2616 compliance
* Case insensitive equality, inequality operators for strings
* Improvements to http::parser
* Tidy up HTTP method enumeration
2014-08-05 13:17:01 -07:00
Scott Schurr
298572893e Improvements to aged_containers (RIPD-363)
- Added unit tests for element erase
- Added unit tests for range erase
- Added unit tests for touch
- Added unit tests for iterators and reverse_iterators
- Un-inlined operator== for unordered containers
- Fixed minor problems with ordered_container erase()
- Made ordered_container...
  - erase (reverse_iterator pos) not compile
  - erase (reverse_iterator first, reverse_iterator last) not compile
  - touch (reverse iterator pos) not compile
- Verified that ordered container...
  - insert() already rejects reverse_iterator
  - emplace_hint() already rejects reverse_iterator
- Made set/multiset iterators const

Regarding the set/multiset iterators, see section 1.5 of
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2913.pdf
as pointed out by Vinnie.
2014-08-04 15:25:30 -07:00
Mark Travis
405f6f7368 Make NetworkOPs::isFull() thread-safe 2014-08-04 11:19:07 -07:00
Tom Ritchford
648ccc7c17 Replace const Type& with Type const& for common types.
* std::string
* RippleAccount
* Account
* Currency
* uint256
* STAmount
* Json::Value
2014-08-04 11:18:44 -07:00
Mark Travis
f5afe0587f Fix filter_policy object leak in NodeStore backends 2014-08-04 11:16:44 -07:00
Tom Ritchford
91a227a475 Correct Pathfinder::getPaths out to handle order books (RIPD-427) 2014-08-02 10:38:57 -07:00
Tom Ritchford
4b905fe9ff Clean OrderBookDB::getBooksBy methods. 2014-08-02 10:38:57 -07:00
Howard Hinnant
0f409b7bec ASCII clean 2014-08-02 10:38:56 -07:00
Vinnie Falco
295c8de858 Detect inconsistency in PeerFinder self-connects (RIPD-411) 2014-07-31 16:10:54 -07:00
Nik Bougalis
e5252f90af Remove LedgerBase and decongest Ledger locks 2014-07-31 16:05:08 -07:00
Miguel Portilla
c2276155bf Add pubkey_node and hostid to server stream messages (RIPD-407) 2014-07-31 16:05:08 -07:00
Miguel Portilla
dbe49bcd87 Remove TRUST_NETWORK directive (RIPD-331) 2014-07-31 16:04:59 -07:00
David Schwartz
7b936de32c Freeze enforcing: (RIPD-399)
* Set enforce date: September 15, 2014
 * Enforce in stand alone mode
 * Enforce at source
 * Enforce intermediary nodes
 * Enforce global freeze in get paths out
 * Enforce global freeze in create offer
 * Don't consider frozen links a path out
 * Handle in getBookPage
 * Enforce in new offer transactors
2014-07-30 23:28:48 -07:00
evhub
9eb34f542c More fixes to VSProject sorting algorithm 2014-07-30 08:56:54 -07:00
Tom Ritchford
194304e544 Refactor RippleCalc:
* Rationalize method and filenames, move to subdirectory.
* Use Issue in Node.
* Restrict access to PathState variables.
* Line length and readability cleanups.
* New PathCursor stores path calculation data during rippleCalc.
* Extract methods PathCursor::node(), PathCursor::previousNode()
  and RippleCalc::addPath
2014-07-30 08:29:29 -07:00
Howard Hinnant
c59fc332d5 Make CBase58Data/RippleAddress movable (RIPD-428):
This significantly increases the performance in returning
these types from factory functions.
2014-07-30 07:25:24 -07:00
Nik Bougalis
b43832fe57 Use std::atomic 2014-07-29 21:50:58 -04:00
Howard Hinnant
c24a497a23 Further documentation improvements to Ledger Consensus. 2014-07-29 21:41:19 -04:00
Tom Ritchford
4096fcd1bf Reduce scope of RPC locks and general cleanup (RIPD-458) 2014-07-29 16:24:44 -04:00
Vinnie Falco
9a0e806f78 Set version to 0.26.1 2014-07-28 12:05:01 -07:00
Vinnie Falco
20c9632996 Enable asynchronous handling of HTTP-RPC (RIPD-390)
* Activate async code path
* Tidy up HTTP server code
* Use shared_ptr in HTTP server
* Remove check for unspecified IP
* Remove hairtrigger
* Fix missing HTTP authorization check
* Fix multisocket flags in RPC-HTTP server
* Fix authorization failure when no credentials required
* Addresses RIPD-159, RIPD-161, RIPD-390
2014-07-28 12:05:01 -07:00
Vinnie Falco
65a628ca88 Add HTTPHeaders::build_map 2014-07-28 12:05:00 -07:00
Vinnie Falco
d82dbba096 Make bind_handler variadic ctor explicit 2014-07-28 12:05:00 -07:00
Howard Hinnant
58547f6997 Tidy up hardened containers (RIPD-380):
* Rename hardened containers for clarity
* Fixes https://ripplelabs.atlassian.net/browse/RIPD-380
2014-07-28 09:06:35 -07:00
Howard Hinnant
e6f4eedb1e Tidy up hardened_hash:
* Added siphash as a HashAlgorithm
* Refactored class responsibilities
2014-07-28 09:06:22 -07:00
Vinnie Falco
c5b963141f Fix intrinsic calls in static_initializer 2014-07-28 09:04:41 -07:00
Nik Bougalis
5df40bd746 Fix auth handling during OfferCreate (RIPD-414) 2014-07-28 08:57:22 -07:00
Howard Hinnant
403f15dc48 Documentation for Ledger Consensus implementation (RIPD-405) 2014-07-28 08:56:23 -07:00
Nik Bougalis
704d7451a0 Fix auth handling during OfferCreate (RIPD-414) 2014-07-25 11:42:42 -07:00
Vinnie Falco
fa11071443 Enable asynchronous handling of HTTP-RPC (RIPD-390)
* Activate async code path
* Tidy up HTTP server code
* Use shared_ptr in HTTP server
* Remove check for unspecified IP
* Remove hairtrigger
* Fix missing HTTP authorization check
* Fix multisocket flags in RPC-HTTP server
* Fix authorization failure when no credentials required
* Addresses RIPD-159, RIPD-161, RIPD-390
2014-07-24 20:22:55 -07:00
Vinnie Falco
87351c8a0c Add HTTPHeaders::build_map 2014-07-24 20:18:51 -07:00
Vinnie Falco
2f5fb1e68e Make bind_handler variadic ctor explicit 2014-07-24 20:18:51 -07:00
Tom Ritchford
96e1ec6d31 Fix build warnings and .gitignore.
* Comment out unused local function for both clang and g++.
* Get rid of numerous Boost warnings for clang.
* Remove some unused local variables.
* Put TAGS into the .gitignore.
2014-07-24 20:18:51 -07:00
Nik Bougalis
ac3cf05f1a Properly order warning suppression flags during compile 2014-07-24 20:18:51 -07:00
Tom Ritchford
6335e34395 Simplify locking and move a typedef.
* Make DatabaseCon's lock private and expose a scoped lock_guard.
* Get rid of DeprecatedRecursiveMutex and DeprecatedScopedLock entirely.
* Move CancelCallback to Job where it logically belongs.
2014-07-23 19:38:52 -07:00
Scott Schurr
02c2029ac1 Add more documentation of ledger acquisition (RIPD-373)
Capturing information from a seminar on the topic into the source tree.
2014-07-23 19:29:13 -07:00
David Schwartz
6914aa3e27 Check for payment increments that make no progress. (RIPD-374) 2014-07-23 19:27:55 -07:00
David Schwartz
f4fcb1cc9a Remove some dead SHAMapMissingNode code 2014-07-23 19:27:50 -07:00
David Schwartz
b6eec21ec0 Pathfinder cleanups, more efficient 'd' handling (RIPD-156) 2014-07-23 19:27:46 -07:00
David Schwartz
0ce3aeb189 Stop finding paths when enough are found (RIPD-156) 2014-07-23 19:27:42 -07:00
Nicholas Dudfield
713c8efcbe Fix intermittently failing send test 2014-07-23 02:27:19 -07:00
Vinnie Falco
9fa5e39872 Set version to 0.26.0 2014-07-22 09:59:45 -07:00
Vinnie Falco
ace53fa405 Set version to 0.26.0-rc2 2014-07-21 10:39:48 -07:00
Vinnie Falco
3c06980107 Merge branch 'release' into develop 2014-07-21 10:25:23 -07:00
Vinnie Falco
1f26fbb5af Set version to 0.26.0-rc1 2014-07-21 10:00:16 -07:00
Howard Hinnant
84c6622122 Fix bugs, typo in SHAMapNodeID 2014-07-18 17:45:51 -07:00
Miguel Portilla
63f099f2f6 Fix book_offers limit parameter (RIPD-295)
Conflicts:
	src/ripple/module/app/misc/NetworkOPs.cpp
2014-07-18 10:37:45 -07:00
Nicholas Dudfield
373ce72984 Update freeze tests
* Conditionally skip freeze enforcement tests
* Honour remote.fee_cushion setting
* Workaround ripple-lib regression
* Don't use mocha features from wrong version
2014-07-18 10:35:06 -07:00
JoelKatz
4cf29455e4 Freeze flags: (RIPD-394)
* Define all flags
 * Set/clear bits in transactors
 * Frozen line counts towards reserve, is non-default
 * Report trust line state
2014-07-18 10:35:06 -07:00
David Schwartz
07db5d497c Remove SHAMapNodeID from SHAMapTreeNode (RIPD-347)
This resolves the "right data, wrong ID" issue in the
tree node cache.
2014-07-18 10:35:06 -07:00
JoelKatz
f1bb0afc4e Improve transaction fee and execution logic (RIPD-323):
* tecINSUFF_FEE if balance doesn't cover fee
* Ensure transaction recovery is deterministic
* Reduce transaction retries
2014-07-18 10:35:06 -07:00
Vinnie Falco
d791fe3013 Fix msvc static initialization in SHAMapNodeID 2014-07-17 20:05:39 -07:00
Miguel Portilla
c16e22a5c6 Fix book_offers limit parameter (RIPD-295) 2014-07-17 18:01:20 -07:00
Miguel Portilla
db7a720445 Fix static initializers in RippleSSLContext (RIPD-375) 2014-07-17 18:01:19 -07:00
Miguel Portilla
6c09a02099 Workaround gcc bug with static_initializer default ctor 2014-07-17 18:00:43 -07:00
Howard Hinnant
1b3356cafd Remove calls to SHAMapNode::getID (RIPD-347):
Calls in SHAMap::getCache and SHAMap::canonicalize are
purposefully left in place at this time (to be removed
later).
2014-07-17 15:58:03 -07:00
Scott Schurr
5869902f2c Tidy up Resource::Manager (RIPD-362):
* Style improvements
* More documentation
2014-07-17 14:18:18 -07:00
Howard Hinnant
28898031f0 Eliminate spurious SHAMap::getFetchPack failure (RIPD-379) 2014-07-17 10:38:07 -07:00
Vinnie Falco
1ce0f94638 Define OPENSSL_NO_SSL2 2014-07-17 10:18:37 -07:00
Vinnie Falco
f876ad973f Fix static_initializer: …
* Prevents double construction, invalid access
* Unit test works on MSVC and non MSVC
2014-07-16 16:43:17 -07:00
Tom Ritchford
6014b13234 Use Books in Ledger. 2014-07-15 21:16:42 -07:00
Vinnie Falco
3e9c702c47 Support stream composition of testcase names 2014-07-15 18:23:01 -07:00
Vinnie Falco
3ff919ccf1 Fix version to say 'rippled' 2014-07-15 13:03:40 -07:00
evhub
8dc0844c79 Fix VSProject item sorting (again)
Conflicts:
	src/beast/site_scons/site_tools/VSProject.py
2014-07-15 12:51:57 -07:00
David Schwartz
a2764b68ca Rate-limit SSL client renegotiation (RIPD-360) 2014-07-14 10:42:29 -07:00
Tom Ritchford
bbbae072ea Simplify initialization of Pathfinder using C++11 constructs. 2014-07-14 10:04:27 -07:00
evhub
b4735b5931 Fix VSProject item sorting:
* Use object type in the sort key
* Call _key recursively over containers
* Prevent passing of iterators to xsorted
* Fix VSProject generator with new sorting
2014-07-14 10:04:07 -07:00
Tom Ritchford
418638ad16 Serialization code improvements:
* Add generics to eliminate duplicate code in STHash
* Use generics in Serializer and callers
2014-07-11 12:00:49 -07:00
Scott Schurr
9fb09d3109 Pass and use time_point in DecayingSample ctor (RIPD-359)
Switches a number of places in Resource::Logic to use abstract_clock::now()
which returns a time_point.  Unfortunately Resource::Logic tracks time
locally also, but with ints, not time_point.  So Resource::Logic uses a
delicate mix of abstract_clock::now() and abstract_clock::elapsed() with
this commit.  That inconsistency could be addressed in a second commit.
2014-07-11 12:00:39 -07:00
Tom Ritchford
d7e08f96a5 Various tidying:
* Fix unused variable warnings.
* Clean unused items from TER.
* Improvement to LES use of shared_ptr.
2014-07-10 15:11:33 -07:00
JoelKatz
4d49d272eb Fix account_tx resume (RIPD-314) 2014-07-10 15:11:33 -07:00
JoelKatz
faa6890950 Find 'sabfd' paths (RIPD-335)
This permits USD/GW1 to be bridged to USD/GW2 by BTC/GW3 or
USD/GW1 to be bridged to BTC/GW2 by CNY/GW3.
2014-07-10 15:11:33 -07:00
David Schwartz
9c390f6da4 Impose a local limit on path lengths (RIPD-350) 2014-07-10 15:09:06 -07:00
Scott Schurr
6842277977 Add documentation for ledger entries (RIPD-361) 2014-07-10 15:08:07 -07:00
Mark Travis
ddf68d464d Set version to 0.25.2 2014-07-07 12:41:46 -07:00
JoelKatz
b2f19e8dc6 Find 'sabfd' paths
This permits USD/GW1 to be bridged to USD/GW2 by BTC/GW3 or
USD/GW1 to be bridged to BTC/GW2 by CNY/GW3. See RIPD-335.
2014-07-07 12:41:46 -07:00
David Schwartz
5714b42975 Impose a local limit on path lengths 2014-07-07 11:42:24 -07:00
David Schwartz
c4e9c49c10 Set version to 0.25.2-rc2 2014-07-07 11:33:26 -07:00
Mark Travis
9210efb051 In JSON, output unprintable currency codes as hex 2014-07-07 11:33:26 -07:00
Tom Ritchford
b9f1b05625 Use swapWith to save CPU; edit comment. 2014-07-07 11:33:26 -07:00
sublimator
828c2e3c71 Restore checkpointed ledger under all paths in PathFind. 2014-07-07 11:33:12 -07:00
Nik Bougalis
10150a7352 Patch Boost to suppress warnings on clang 2014-07-06 15:17:58 -07:00
Scott Schurr
baaa45f8c7 SHAMap Documentation 2014-07-06 14:57:59 -07:00
Tom Ritchford
322af30d6a Pathfinding Documentation 2014-07-06 14:57:59 -07:00
Tom Ritchford
206efbf30d Rename RippleAsset to Issue and RippleBook to Book:
* Split STAmount out of SerializedTypes.h
* New concept of "Issue consistency": when either both or neither of its
  currency and account are XRP.
* Stop checking for consistency of Issue in its constructor.
* Clarification of mIsNative logic in STAmount.
* Usual cleanups.
2014-07-06 14:57:59 -07:00
Tom Ritchford
a96dee85d2 Remove recursions from computeLiquidity 2014-07-06 14:57:58 -07:00
Vinnie Falco
d307568cbc Update rocksdb unity file 2014-07-03 17:49:17 -07:00
Vinnie Falco
0ee27b143c Merge commit '7bfb4a9ba5a2822f7d9ef7122b1388aea4be9404' as 'src/rocksdb' 2014-07-03 17:49:00 -07:00
Vinnie Falco
7bfb4a9ba5 Squashed 'src/rocksdb/' content from commit 78b8a7d
git-subtree-dir: src/rocksdb
git-subtree-split: 78b8a7d908
2014-07-03 17:49:00 -07:00
Vinnie Falco
110c73fc8d Remove rockdb subtree 2014-07-03 17:43:48 -07:00
Vinnie Falco
424d9b8385 Add preliminary Structured Overlay docs 2014-07-03 14:34:38 -07:00
Vinnie Falco
1b48ccc868 Fix base log partition severity 2014-07-03 11:57:14 -07:00
Howard Hinnant
fac82204b6 Remove boost::hash_value() overloads.
This addresses https://ripplelabs.atlassian.net/browse/RIPD-102
2014-07-02 15:33:11 -07:00
David Schwartz
61f114e655 Cleanup confusion of ledger base versus ledger header
The "ledger header" is the chunk of data that hashes to the
ledger's hash. It contains the sequence number, parent hash,
hash of the previous ledger, hash of the root node of the
state tree, and so on.

The term "ledger base" refers to a particular type of query
and response used in the ledger fetch process that includes
the ledger header but may also contain other information
such as the root node of the state tree.
2014-07-02 15:33:10 -07:00
MarkusTeufelberger
24410bf1bb Update Sconstruct 2014-07-01 19:12:47 -07:00
Vinnie Falco
aa24969eee Add README.md for ledger process 2014-07-01 12:42:41 -07:00
David Schwartz
a5297d13c4 Add new memo restrictions 2014-07-01 12:13:47 -07:00
David Schwartz
b06bdb83cb Fix a case where we put an extra node in the SHAMapDiff 2014-07-01 12:13:13 -07:00
David Schwartz
d06092212f Tighten up some serialization checks 2014-06-30 16:53:38 -07:00
David Schwartz
914778eae1 In JSON, output unprintable currency codes as hex 2014-06-30 16:40:53 -07:00
Nicholas Dudfield
e14c700c60 New integration tests:
* New tests for autobridging and freeze
* Discrepancy detection tests
* Don't let Mocha suppress load time errors
2014-06-28 18:27:33 -07:00
wltsmrz
0848e348bb Update ripple-lib integration tests 2014-06-28 13:17:31 -07:00
Vinnie Falco
3d5ae42660 Structured Overlay support:
* Add Peer Protocol detector
* Add RIPPLE_SINGLE_IO_SERVICE_THREAD setting
* Preliminary HTTP header parsing logic (disabled)
2014-06-26 18:24:50 -07:00
Vinnie Falco
f207b6b4c9 Improvements to HTTP parsing 2014-06-26 17:41:12 -07:00
David Schwartz
ed2c5078ad Tighten up some serialization checks 2014-06-26 17:16:34 -07:00
sublimator
aec792f5b8 Restore checkpointed ledger under all paths in PathFind. 2014-06-26 17:16:34 -07:00
Nik Bougalis
17d64de3d5 During playback close ledger before accepting 2014-06-26 17:16:34 -07:00
Tom Ritchford
f6bea08535 Update state during pathfinding 2014-06-26 17:16:33 -07:00
Tom Ritchford
feab6c39b3 New types Account, Currency, Directory:
* New tagged uint types.
* Extract to_string functions from header to hide dependencies.
* Include what you use and C++11 for cleanups.
2014-06-26 17:16:30 -07:00
Nik Bougalis
e999c76882 Autobridging:
* Remove legacy OfferCreate transactor
* Misc. cleanups on LedgerEntrySet
* Fix a subtle bug with arithmetic operations on Quality
* Sanity check offers after taking
2014-06-26 12:03:52 -07:00
Miguel Portilla
686cc599a2 Add ASIO strand to StatsDCollector 2014-06-26 12:03:51 -07:00
Vinnie Falco
92983556a0 Fix bug in VSProject when no LIBPATH in env 2014-06-26 12:03:51 -07:00
Scott Schurr
837872c3f3 Move static treeNodeCache from SHAMap to the Application
These changes address two JIRA issues:

 - 291 unittest reported leaked objects
 - 292 SHAMap::treeNodeCache should be a dependency injection

The treeNodeCache was a static member of SHAMap.  It's now a
non-static member of the Application accessed through
getTreeNodeCache().  That addressed JIRA 291

The SHAMap constructors were adjusted so the treeNodeCache is
passed in to the constructor.  That addresses JIRA 292,  It required
that any code constructing a SHAMap needed to be edited to pass
the new parameter to the constructed SHAMap.

In the mean time, SHAMap was examined for dead/unused code and
interfaces that could be made private.  Dead and unused interfaces
were removed and methods that could be private were made private.
2014-06-26 11:10:51 -07:00
Tom Ritchford
55222dc5d1 New types Account, Currency, Directory:
* New tagged uint types.
* Extract to_string functions from header to hide dependencies.
* Include what you use and C++11 for cleanups.
2014-06-24 11:11:25 -07:00
David Schwartz
adce6ae851 Ledger loading cleanups:
* Fix close time settings for ledger load
* More info in ledger_request and inbound ledger JSON replies
2014-06-23 20:19:53 -07:00
Howard Hinnant
9dc32cb791 SHAMap refactoring:
* Rename SHAMapNode to SHAMapNodeID.
* Cleanups
2014-06-23 20:19:53 -07:00
Howard Hinnant
23dc08c925 Improve Journal logging framework:
* Allow partition log levels to be adjusted
* Cleanups
2014-06-23 20:19:53 -07:00
Vinnie Falco
488a44b88e Fix case-sensitivity for NOLOGO in booltable 2014-06-18 17:04:31 -07:00
evhub
530bdf975e Fix VSProject generation issues with SConstruct:
* Always describe the Visual Studio targets
* Prevent checking nonexistant enviro vars
* Prevent pkg-config protobuf env vars if not clang/gcc
* Don't use any pkg-config enviro vars unless clang/gcc
* Make all VSProject/config directories windows-style
* Prevent beastobjc.mm from showing up in vcxproj
* Remove duplicate \src\protobuf\src
* Consistent quoting
2014-06-18 16:41:34 -07:00
evhub
d7a6627a1f Fixes to VSProject generator:
* Canonical sorting for all platforms
* Fix incorrect path separator
* Filter predefined duplicate environment switches
2014-06-18 16:38:26 -07:00
Vinnie Falco
d6066183b9 Refactor Overlay for Structured Network support:
* Move overlay up one directory
* Add abstract_protocol_handler, message_stream
* Add peer_protocol_detector
* Tidy up some declarations
* Use strand::running_in_this_thread instead of bool
* Update README.md
* Replace protocol message read loop:
  - Process data in arbitrary size chunks
  - message_stream extracts individual messages
  - peer_protocol_detector identifies the handshake
  - abstract_protocol_handler used for dispatching messages
* Remove unused protocol message types:
  - mtACCOUNT
  - mtCONTACT
  - mtERROR
  - mtGET_ACCOUNT
  - mtGET_CONTACTS
  - mtGET_VALIDATIONS
  - mtSEARCH_TRANSACTION
  - mtUNUSED_FIELD

Conflicts:
	src/ripple/module/app/main/Application.cpp
	src/ripple/module/app/misc/NetworkOPs.cpp
	src/ripple/module/app/peers/PeerSet.cpp
2014-06-18 15:17:18 -07:00
Vinnie Falco
3e2c3ba035 Add missing beast includes 2014-06-18 14:07:18 -07:00
Tom Ritchford
e24cba8c35 Better types and more comments in RippleCalc.
* Better automatic conversions to and from tagged uint160 varints.
* Start using tagged variants of uint160 for Currency, Account.
* Comments from 2014/6/11 RippleCalc session.
2014-06-18 12:38:06 -07:00
Tom Ritchford
a23013abc1 Tidy up rpc module:
* Move directory up to ripple/module/rpc
* Use C++11 idioms and best practices
2014-06-18 12:37:53 -07:00
evhub
27a4f44de5 Process switches with regex in VSProject generator:
* Handles "DisableSpecificWarnings" switches
2014-06-16 19:01:28 -07:00
Vinnie Falco
4e07dbbefc Fix state check in PeerImp::recvHello 2014-06-16 18:14:25 -07:00
David Schwartz
dcf4ad2c21 Ledger load and ledger replay fixes:
* Stash the loaded ledger where consensus can find it.
 * When loading a ledger for startup, try the backend too
 * Apply replay transactions to a mutable snapshot
2014-06-16 17:29:11 -07:00
Nik Bougalis
04dd861fe3 Cleanup:
* Remove is_bit_set and use regular bitwise operations instead.
* Remove the function-like macro "nothing".
2014-06-16 17:29:11 -07:00
Vinnie Falco
c8ee6c6f6d Use std::thread instead of boost::thread 2014-06-16 16:18:10 -07:00
Vinnie Falco
a57e4263d7 Fix MSVC workaround in basic_seconds_clock 2014-06-16 16:18:09 -07:00
Vinnie Falco
3d58f0d941 Add static_initializer 2014-06-16 16:18:09 -07:00
Vinnie Falco
a52c9232c4 Tidy up basics module:
* Move directory up
* Remove unity includes and "include what you use"
2014-06-15 18:51:05 -07:00
Vinnie Falco
7a059c7a73 Remove ScopedPointer, ContainerDeletePolicy 2014-06-15 18:35:12 -07:00
Vinnie Falco
506910147f Tidy up includes:
* Replace boost with std equivalents:
  - bind, ref, cref, function, placeholders
* More "include what you use"
* Remove unnecessary includes
2014-06-15 18:26:50 -07:00
Vinnie Falco
cf3eb24eb0 Move nodestore to its own module 2014-06-15 12:50:44 -07:00
Vinnie Falco
d965b23b2a Add missing beast includes 2014-06-15 12:37:52 -07:00
Vinnie Falco
f660743065 Remove unused SHAMap::getItem 2014-06-13 14:00:17 -07:00
David Schwartz
4559bd9030 Improve the way we declare a close time consensus 2014-06-12 10:20:48 -07:00
David Schwartz
3ac98fb101 SyncUnorderedMap cleanup 2014-06-12 10:14:47 -07:00
David Schwartz
aff52db289 Re-use the serializer 2014-06-12 10:14:47 -07:00
David Schwartz
ea27dfe08d Find 'sbfd' paths. 2014-06-12 09:41:52 -07:00
Tom Ritchford
27620af1bf Further cleanups of RippleCalc.
* Rename many variables.
* Make most of PathState private.
* Extract out common Node::isAccount() code.
* Rename bConsumed to allLiquidityConsumed_.
* Extract out code into PathState::clear().
2014-06-09 12:57:26 -07:00
Tom Ritchford
bf116308d4 Add newer validators to validators-example.txt 2014-06-09 12:41:27 -07:00
Tom Ritchford
3fb27d98ab Clean up LookupLedger and resolve issue 278.
* Use beast::zero to resolve issue 278.
* Rename variables and simplify logic.
* Restrict to 80 columns.
2014-06-09 12:40:38 -07:00
Tom Ritchford
7e45c17730 Rename ledger_get to ledger_request. 2014-06-09 12:37:24 -07:00
Tom Ritchford
626533d4a7 Clean up RPC messages from Main 2014-06-09 12:37:23 -07:00
Tom Ritchford
39719f4c17 Rearrange branch in accordance with new practices. 2014-06-09 12:37:23 -07:00
JoelKatz
526bd88dc4 Add ledger_get RPC command to fetch a ledger from the network
Conflicts:
	Builds/VisualStudio2013/RippleD.vcxproj
	Builds/VisualStudio2013/RippleD.vcxproj.filters
	Builds/VisualStudio2013/RippleD2.vcxproj
	Builds/VisualStudio2013/RippleD2.vcxproj.filters
	src/ripple_rpc/impl/Handlers.cpp
2014-06-09 12:37:22 -07:00
Vinnie Falco
37201ecaa6 Include BeastConfig.h from the root include path 2014-06-09 12:35:16 -07:00
Vinnie Falco
02ed879837 Update VS project file 2014-06-06 07:39:55 -07:00
Vinnie Falco
8b881d3a77 Add CBase58Data::hash_append 2014-06-05 20:00:24 -07:00
Miguel Portilla
f25456ce25 Fix VSProject.py extra dot 2014-06-05 17:47:46 -07:00
mDuo13
dfb1db4ab3 Return correct error for missing pathfinding request. Fixes RIPD-293 2014-06-05 17:47:28 -07:00
Vinnie Falco
4362cb660b Replace boost::shared_ptr with std::shared_ptr 2014-06-05 13:04:23 -07:00
Vinnie Falco
1aa0749ba8 Update rocksdb unity build 2014-06-04 17:20:43 -07:00
Vinnie Falco
c7f1f6a91f RocksDB changes to support unity build:
* Remove extra definition of TotalFileSize
* Remove extra definition of ClipToRange
* Move EncodedFileMetaData out from anonymous namespace
* Move version_set Saver to its own namespace
* Move some symbols into a named namespace
* Move symbols out of anonymous namespace (prevents warning)
* Make BloomHash inline
2014-06-04 17:15:28 -07:00
Vinnie Falco
888a3fec21 Merge commit '8514b88974c71c0fa85bb154507536ee49c33458' as 'src/rocksdb' 2014-06-04 16:10:38 -07:00
Vinnie Falco
8514b88974 Squashed 'src/rocksdb/' content from commit 457bae6
git-subtree-dir: src/rocksdb
git-subtree-split: 457bae6911
2014-06-04 16:10:38 -07:00
Vinnie Falco
724ec46129 Use per-file include directories for external code subtrees:
* leveldb, hyperleveldb, rocksdb, snappy
* SConstruct OSX fix regarding OpenSSL version check
2014-06-04 13:28:43 -07:00
Vinnie Falco
4f1d1d2a8a Reorganize source file hierarchy:
* Rename unity files
* Move some modules to new subdirectories
* Remove obsolete Visual Studio project files
* Remove obsolete coding style and TODO list
2014-06-03 21:43:59 -07:00
Tom Ritchford
39a387b54c Check for openSSL version in SConstruct.
* Uses the platform specific openssl binary to detect the current version.
2014-06-02 10:56:21 -07:00
Roberto Catini
2b0034667d Add Dockerfile:
* The ports are not automatically exposed.
* No test is performed after the build.
2014-06-02 10:27:09 -07:00
Tom Ritchford
98202c56ae base_uint now compares and assigns with beast::Zero.
Conflicts:
	src/ripple/types/api/base_uint.h
	src/ripple_basics/ripple_basics.h
2014-06-02 10:15:45 -07:00
Vinnie Falco
1e06ddf13c Refactor MultiSocket:
* Variadic constructor argument list
* Tidy up sources and filenames
2014-06-02 10:07:05 -07:00
Vinnie Falco
560071bb68 Make all include paths relative to a root directory:
* Better include path support in the VSProject scons tool.
* Various manual fixes to include paths.
2014-06-02 09:16:28 -07:00
Nik Bougalis
2e49ec47a3 Revert "Ste version to 0.25.2-rc1"
This reverts commit 3f10924594.
2014-06-01 16:32:41 -07:00
Mark Travis
e70d618aff Set version to 0.25.2-rc1 2014-06-01 22:51:13 +00:00
Mark Travis
3e4cf426bd Detect paths with illegal bridging offers 2014-06-01 22:45:55 +00:00
Mark Travis
3f10924594 Ste version to 0.25.2-rc1 2014-06-01 22:35:12 +00:00
Mark Travis
f8182c335a Detect paths with illegal bridging offers 2014-06-01 01:26:11 +00:00
Vinnie Falco
1d8d6a6d68 Revert "Improve checking of library versions."
This reverts commit 69fccdf5c6.
2014-05-28 19:04:37 -07:00
Tom Ritchford
69fccdf5c6 Improve checking of library versions.
* Correctly handle openSSL version checking on Ubuntu, Debian, OS/X.
* Also check versions of openSSL, Boost, GCC and MSVC at C++ compile time.
* Get rid of over-engineered runtime CheckLibraryVersions.
2014-05-28 17:07:35 -07:00
Nik Bougalis
27e8d44a56 Autobridging:
Complete implementation of bridged offers crossings. While processing an offer
A:B we consider both the A:B order book and the combined A:XRP and XRP:B books
and pick the better offers. The net result is better liquidity and potentially
better rates.

* Rearchitect core::Taker to perform direct and bridged crossings.
* Compute bridged qualities.
* Implement a new Bridged OfferCreate transactor.
* Factor out common code from the Bridged and Direct OfferCreate transactors.
* Perform flow calculations without losing accuracy.
* Rename all transactors.
* Cleanups.
2014-05-28 16:35:03 -07:00
Vinnie Falco
72bc4ebf37 Fix VSProject generator item sort 2014-05-28 16:35:02 -07:00
Tom Ritchford
353f32e6af Fix a few warnings 2014-05-28 09:28:50 -07:00
Howard Hinnant
9bbaa9a2ae Report whether a ledger is validated:
This addresses https://ripplelabs.atlassian.net/browse/RIPD-275
Use Json::StaticString to improve performance.
Use inject_error instead of manually adding errors.
2014-05-28 09:27:22 -07:00
Nicholas Dudfield
096fcefae9 Fix clang/travis, prefer static libs when BOOST_ROOT is set. 2014-05-28 08:32:11 -07:00
Vinnie Falco
0f1e292e34 New http::client_session for making requests:
- Add 10,000 popular URL data set for unit tests
2014-05-28 08:31:45 -07:00
Vinnie Falco
195957a7cc Add ci_char_traits 2014-05-28 07:30:02 -07:00
Vinnie Falco
eb122f45f9 Tidy up includes 2014-05-28 07:29:59 -07:00
Vinnie Falco
c51ac9d6da Fix rocksdb relative include 2014-05-27 15:23:50 -07:00
Vinnie Falco
97c9d02c43 Improved SConstruct:
* Automatic source list built via directory iteration
* Build multiple toolchains and flavors simulaneously:
    - Toolchains: gcc, clang, msvc
    - Flavors: debug, release
* Documentation on aliases (top of the SConstruct file)
2014-05-27 15:23:50 -07:00
Vinnie Falco
0c06939f38 Beast SCons tools:
* Add VSProject SCons Builder
* Add Protoc SCons Builder
* Add Beast build utilities python module
2014-05-27 15:23:49 -07:00
Vinnie Falco
5db677d74d Tidy up some source filenames:
* Add .unity suffix to mark unity sources
* Fix some relative include paths
2014-05-27 15:23:48 -07:00
Nik Bougalis
251ce4efbc base_uint cleanups:
* Remove unused and broken reverse iterators
* Use charUnHex to reduce code duplication
2014-05-27 09:26:18 -07:00
Nik Bougalis
386eabb61f Convert a unit test to manual 2014-05-26 15:29:48 -07:00
Nik Bougalis
b35eabe161 Optimize SQL query composition 2014-05-26 15:29:48 -07:00
Tom Swirly
9ad9845d69 Initialize unassigned variable bConsumed.
* Assigned in the code, but only to false.
* Someday will get assigned to true.
2014-05-23 12:16:24 -07:00
Tom Swirly
74eb25f9b5 RippleCalc: Stop using reference that might have been invalidated. 2014-05-23 12:16:22 -07:00
Nik Bougalis
044f390fe0 Properly standardize RFC1751 inputs 2014-05-23 11:06:43 -07:00
Miguel Portilla
06d6e4901e Complete NodeStore documentation
* Complete README.md
* Add missing doxygen
* Fix getHitRate bug
2014-05-19 10:53:40 -07:00
Tom Swirly
3ca9646329 Refactor the structure of RippleCalc
* Split code into multiple files
* Rename and move things
2014-05-19 10:53:40 -07:00
Tom Ritchford
4b3e629dfd Allow ledgers to be loaded from the command line.
Conflicts:

	src/ripple_data/protocol/BuildInfo.cpp
2014-05-19 10:53:39 -07:00
Tom Swirly
568fae9878 Add documentation comments 2014-05-19 10:53:39 -07:00
Tom Swirly
a844026f6b Clean up pre C++1 idioms:
* Use auto for in some loops
* Fix shadowing iterator declaration
* Rename NUMBER to ARRAYSIZE.
* Use placeholders instead of macros
* Replace macro BIND_TYPE with std::bind
* Replace BOOST_FOREACH with range-for
2014-05-19 10:53:38 -07:00
Vinnie Falco
b677cacb8c Set version to 0.25.1 2014-05-15 11:13:54 -07:00
Nik Bougalis
1d66169ef1 Fix rippled-example.cfg to list 'peers_max' 2014-05-15 11:11:16 -07:00
Vinnie Falco
74653e57e6 Use std::string in lexicalCast 2014-05-15 11:11:15 -07:00
1728 changed files with 147077 additions and 81722 deletions

1
.gitignore vendored
View File

@@ -19,6 +19,7 @@
*.o
build
tags
TAGS
bin/rippled
Debug/*.*
Release/*.*

View File

@@ -12,6 +12,14 @@ before_install:
- sudo apt-get install -qq libboost1.55-all-dev
# We want debug symbols for boost as we install gdb later
- sudo apt-get install -qq libboost1.55-dbg
- | # Setup the BOOST_ROOT
export BOOST_ROOT=$HOME/boost_root
mkdir -p $BOOST_ROOT/stage
ln -s /usr/lib/x86_64-linux-gnu $BOOST_ROOT/stage/lib
ln -s /usr/include/boost $BOOST_ROOT/boost
- | # Try to patch boost
sudo patch /usr/include/boost/bimap/detail/debug/static_error.hpp Builds/travis/static_error.boost.patch
sudo patch /usr/include/boost/config/compiler/clang.hpp Builds/travis/clang.boost.patch
- sudo apt-get install -qq mlocate
- sudo updatedb
- sudo locate libboost | grep /lib | grep -e ".a$"

30
Builds/Docker/Dockerfile Normal file
View File

@@ -0,0 +1,30 @@
# rippled
# use the ubuntu base image
FROM ubuntu
MAINTAINER Roberto Catini roberto.catini@gmail.com
# make sure the package repository is up to date
RUN apt-get update
RUN apt-get -y upgrade
# install the dependencies
RUN apt-get -y install git scons pkg-config protobuf-compiler libprotobuf-dev libssl-dev libboost1.55-all-dev
# download source code from official repository
RUN git clone https://github.com/ripple/rippled.git src; cd src/; git checkout master
# compile
RUN cd src/; scons build/rippled
# move to root directory and strip
RUN cp src/build/rippled rippled; strip rippled
# copy default config
RUN cp src/doc/rippled-example.cfg rippled.cfg
# clean source
RUN rm -r src
# launch rippled when launching the container
ENTRYPOINT ./rippled

View File

@@ -62,42 +62,42 @@ UI_HEADERS_DIR += ../../src/ripple_basics
# New style
#
SOURCES += \
../../src/ripple/beast/ripple_beast.cpp \
../../src/ripple/beast/ripple_beast.unity.cpp \
../../src/ripple/beast/ripple_beastc.c \
../../src/ripple/common/ripple_common.cpp \
../../src/ripple/http/ripple_http.cpp \
../../src/ripple/json/ripple_json.cpp \
../../src/ripple/peerfinder/ripple_peerfinder.cpp \
../../src/ripple/radmap/ripple_radmap.cpp \
../../src/ripple/resource/ripple_resource.cpp \
../../src/ripple/sitefiles/ripple_sitefiles.cpp \
../../src/ripple/sslutil/ripple_sslutil.cpp \
../../src/ripple/testoverlay/ripple_testoverlay.cpp \
../../src/ripple/types/ripple_types.cpp \
../../src/ripple/validators/ripple_validators.cpp
../../src/ripple/common/ripple_common.unity.cpp \
../../src/ripple/http/ripple_http.unity.cpp \
../../src/ripple/json/ripple_json.unity.cpp \
../../src/ripple/peerfinder/ripple_peerfinder.unity.cpp \
../../src/ripple/radmap/ripple_radmap.unity.cpp \
../../src/ripple/resource/ripple_resource.unity.cpp \
../../src/ripple/sitefiles/ripple_sitefiles.unity.cpp \
../../src/ripple/sslutil/ripple_sslutil.unity.cpp \
../../src/ripple/testoverlay/ripple_testoverlay.unity.cpp \
../../src/ripple/types/ripple_types.unity.cpp \
../../src/ripple/validators/ripple_validators.unity.cpp
# ---------
# Old style
#
SOURCES += \
../../src/ripple_app/ripple_app.cpp \
../../src/ripple_app/ripple_app_pt1.cpp \
../../src/ripple_app/ripple_app_pt2.cpp \
../../src/ripple_app/ripple_app_pt3.cpp \
../../src/ripple_app/ripple_app_pt4.cpp \
../../src/ripple_app/ripple_app_pt5.cpp \
../../src/ripple_app/ripple_app_pt6.cpp \
../../src/ripple_app/ripple_app_pt7.cpp \
../../src/ripple_app/ripple_app_pt8.cpp \
../../src/ripple_basics/ripple_basics.cpp \
../../src/ripple_core/ripple_core.cpp \
../../src/ripple_data/ripple_data.cpp \
../../src/ripple_hyperleveldb/ripple_hyperleveldb.cpp \
../../src/ripple_leveldb/ripple_leveldb.cpp \
../../src/ripple_net/ripple_net.cpp \
../../src/ripple_overlay/ripple_overlay.cpp \
../../src/ripple_rpc/ripple_rpc.cpp \
../../src/ripple_websocket/ripple_websocket.cpp
../../src/ripple_app/ripple_app.unity.cpp \
../../src/ripple_app/ripple_app_pt1.unity.cpp \
../../src/ripple_app/ripple_app_pt2.unity.cpp \
../../src/ripple_app/ripple_app_pt3.unity.cpp \
../../src/ripple_app/ripple_app_pt4.unity.cpp \
../../src/ripple_app/ripple_app_pt5.unity.cpp \
../../src/ripple_app/ripple_app_pt6.unity.cpp \
../../src/ripple_app/ripple_app_pt7.unity.cpp \
../../src/ripple_app/ripple_app_pt8.unity.cpp \
../../src/ripple_basics/ripple_basics.unity.cpp \
../../src/ripple_core/ripple_core.unity.cpp \
../../src/ripple_data/ripple_data.unity.cpp \
../../src/ripple_hyperleveldb/ripple_hyperleveldb.unity.cpp \
../../src/ripple_leveldb/ripple_leveldb.unity.cpp \
../../src/ripple_net/ripple_net.unity.cpp \
../../src/ripple_overlay/ripple_overlay.unity.cpp \
../../src/ripple_rpc/ripple_rpc.unity.cpp \
../../src/ripple_websocket/ripple_websocket.unity.cpp
LIBS += \
-lboost_date_time-mt\

View File

@@ -0,0 +1,4 @@
RippleD.vcxproj -text
RippleD.vcxproj.filters -text

View File

@@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros">
<RepoDir>..\..</RepoDir>
</PropertyGroup>
<PropertyGroup>
<OutDir>$(RepoDir)\build\VisualStudio2013\$(Configuration).$(Platform)\</OutDir>
<IntDir>$(RepoDir)\build\obj\VisualStudio2013\$(Configuration).$(Platform)\</IntDir>
<TargetName>rippled</TargetName>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>_VARIADIC_MAX=10;_WIN32_WINNT=0x0600;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>$(RepoDir)\src\protobuf\src;$(RepoDir)\src\protobuf\vsprojects;$(RepoDir)\src\leveldb;$(RepoDir)\src\leveldb\include;$(RepoDir)\src\snappy\snappy;$(RepoDir)\src\snappy\config;$(RepoDir)\build\proto;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
<ExceptionHandling>Async</ExceptionHandling>
<DisableSpecificWarnings>4018;4244</DisableSpecificWarnings>
</ClCompile>
<Link>
<AdditionalDependencies>Shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SpecifySectionAttributes>
</SpecifySectionAttributes>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<BuildMacro Include="RepoDir">
<Value>$(RepoDir)</Value>
</BuildMacro>
</ItemGroup>
</Project>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemDefinitionGroup />
<ItemGroup />
</Project>

View File

@@ -3,9 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Express 2013 for Windows Desktop
VisualStudioVersion = 12.0.30110.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "beast", "..\..\src\beast\Builds\VisualStudio2013\beast.vcxproj", "{73C5A0F0-7629-4DE7-9194-BE7AC6C19535}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RippleD", "RippleD.vcxproj", "{B7F39ECD-473C-484D-BC34-31F8362506A5}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RippleD", "RippleD.vcxproj", "{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -15,21 +13,12 @@ Global
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{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|x64
{73C5A0F0-7629-4DE7-9194-BE7AC6C19535}.Debug|x64.Build.0 = Debug|x64
{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|x64
{73C5A0F0-7629-4DE7-9194-BE7AC6C19535}.Release|x64.Build.0 = Release|x64
{B7F39ECD-473C-484D-BC34-31F8362506A5}.Debug|Win32.ActiveCfg = Debug|x64
{B7F39ECD-473C-484D-BC34-31F8362506A5}.Debug|Win32.Build.0 = Debug|x64
{B7F39ECD-473C-484D-BC34-31F8362506A5}.Debug|x64.ActiveCfg = Debug|x64
{B7F39ECD-473C-484D-BC34-31F8362506A5}.Debug|x64.Build.0 = Debug|x64
{B7F39ECD-473C-484D-BC34-31F8362506A5}.Release|Win32.ActiveCfg = Release|x64
{B7F39ECD-473C-484D-BC34-31F8362506A5}.Release|x64.ActiveCfg = Release|x64
{B7F39ECD-473C-484D-BC34-31F8362506A5}.Release|x64.Build.0 = Release|x64
{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}.Debug|Win32.ActiveCfg = debug|x64
{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}.Debug|x64.ActiveCfg = debug|x64
{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}.Debug|x64.Build.0 = debug|x64
{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}.Release|Win32.ActiveCfg = release|x64
{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}.Release|x64.ActiveCfg = release|x64
{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}.Release|x64.Build.0 = release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemDefinitionGroup>
<ClCompile>
<DisableSpecificWarnings>4018;4244;4267</DisableSpecificWarnings>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup />
</Project>

View File

@@ -1,5 +1,5 @@
Name: rippled
Version: 0.24.0
Version: 0.26.2
Release: 1%{?dist}
Summary: Ripple peer-to-peer network daemon

View File

@@ -0,0 +1,13 @@
--- /usr/include/boost/config/compiler/clang.hpp 2013-07-20 13:17:10.000000000 -0400
+++ /usr/include/boost/config/compiler/clang.rippled.hpp 2014-03-11 16:40:51.000000000 -0400
@@ -39,6 +39,10 @@
// Clang supports "long long" in all compilation modes.
#define BOOST_HAS_LONG_LONG
+#if defined(__SIZEOF_INT128__)
+# define BOOST_HAS_INT128
+#endif
+
//
// Dynamic shared object (DSO) and dynamic-link library (DLL) support
//

View File

@@ -0,0 +1,10 @@
--- /usr/include/boost/bimap/detail/debug/static_error.hpp 2008-03-22 17:45:55.000000000 -0400
+++ /usr/include/boost/bimap/detail/debug/static_error.rippled.hpp 2014-03-12 19:40:05.000000000 -0400
@@ -25,7 +25,6 @@
// a static error.
/*===========================================================================*/
#define BOOST_BIMAP_STATIC_ERROR(MESSAGE,VARIABLES) \
- struct BOOST_PP_CAT(BIMAP_STATIC_ERROR__,MESSAGE) {}; \
BOOST_MPL_ASSERT_MSG(false, \
BOOST_PP_CAT(BIMAP_STATIC_ERROR__,MESSAGE), \
VARIABLES)

1134
SConstruct

File diff suppressed because it is too large Load Diff

View File

@@ -27,12 +27,12 @@
# Purpose
#
# This file documents and provides examples of all rippled server process
# configuration options. When the rippled server instance is lanched, it looks
# for a file with the following name:
# configuration options. When the rippled server instance is launched, it
# looks for a file with the following name:
#
# rippled.cfg
#
# For more information on where the rippled serer instance searches for
# For more information on where the rippled server instance searches for
# the file please visit the Ripple wiki. Specifically, the section explaining
# the --conf command line option:
#
@@ -136,10 +136,10 @@
#
#
#
# [max_peers]
# [peers_max]
#
# The largest number of desired peer connections (incoming or outgoing).
# Cluster and fixed peers do not count towards this total. There are
# The largest number of desired peer connections (incoming or outgoing).
# Cluster and fixed peers do not count towards this total. There are
# implementation-defined lower limits imposed on this value for security
# purposes.
#
@@ -242,7 +242,7 @@
#
# The amount of time to wait in seconds, before sending a websocket 'ping'
# message. Ping messages are used to determine if the remote end of the
# connection is no longer availabile.
# connection is no longer available.
#
#
#
@@ -299,7 +299,7 @@
#
# This group of settings configures security and access attributes of the
# RPC server section of the rippled process, used to service both local
# an optional remote clients.
# and optional remote clients.
#
#
#
@@ -314,7 +314,7 @@
#
# [rpc_admin_allow]
#
# Specify an list of IP addresses allowed to have admin access. One per line.
# Specify a list of IP addresses allowed to have admin access. One per line.
# If you want to test the output of non-admin commands add this section and
# just put an ip address not under your control.
# Defaults to 127.0.0.1.
@@ -334,7 +334,7 @@
#
# [rpc_admin_password]
#
# As a server, require this as the admin pasword to be specified. Also,
# As a server, require this as the admin password to be specified. Also,
# require rpc_admin_user and rpc_admin_password to be checked for RPC admin
# functions. The request must specify these as the admin_user and
# admin_password in the request object.
@@ -358,7 +358,7 @@
#
# [rpc_user]
#
# As a server, require a this user to specified and require rpc_password to
# As a server, require this user to be specified and require rpc_password to
# be checked for RPC access via the rpc_ip and rpc_port. The user and password
# must be specified via HTTP's basic authentication method.
# As a client, supply this to the server via HTTP's basic authentication
@@ -368,7 +368,7 @@
#
# [rpc_password]
#
# As a server, require a this password to specified and require rpc_user to
# As a server, require this password to be specified and require rpc_user to
# be checked for RPC access via the rpc_ip and rpc_port. The user and password
# must be specified via HTTP's basic authentication method.
# As a client, supply this to the server via HTTP's basic authentication
@@ -393,8 +393,9 @@
# 0: Server certificates are not provided for RPC clients using SSL [default]
# 1: Client RPC connections wil be provided with SSL certificates.
#
# Note that if rpc_secure is enabled, it will also be necessasry to configure the
# certificate file settings located in rpc_ssl_cert, rpc_ssl_chain, and rpc_ssl_key
# Note that if rpc_secure is enabled, it will also be necessary to configure
# the certificate file settings located in rpc_ssl_cert, rpc_ssl_chain, and
# rpc_ssl_key
#
#
#
@@ -402,8 +403,9 @@
#
# <pathname>
#
# A file system path leading to the SSL certificate file to use for secure RPC.
# The file is in PEM format. The file is not needed if the chain includes it.
# A file system path leading to the SSL certificate file to use for secure
# RPC. The file is in PEM format. The file is not needed if the chain
# includes it.
#
#
#
@@ -444,7 +446,7 @@
#
# [sms_url]?from=[sms_from]&to=[sms_to]&api_key=[sms_key]&api_secret=[sms_secret]&text=['text']
#
# Where [...] are the corresponding valus from the configuration file, and
# Where [...] are the corresponding values from the configuration file, and
# ['test'] is the value of the JSON field with name 'text'.
#
# [sms_url]
@@ -538,8 +540,8 @@
# For domains, rippled will probe for https web servers at the specified
# domain in the following order: ripple.DOMAIN, www.DOMAIN, DOMAIN
#
# For public key entries, a comment may optionally be spcified after adding a
# space to the pulic key.
# For public key entries, a comment may optionally be specified after adding
# a space to the public key.
#
# Examples:
# ripple.com
@@ -587,14 +589,14 @@
#
# [path_search_fast]
# [path_search_max]
# When seaching for paths, the minimum and maximum search aggressiveness.
# When searching for paths, the minimum and maximum search aggressiveness.
#
# The default for 'path_search_fast' is 2. The default for 'path_search_max' is 10.
#
# [path_search_old]
#
# For clients that use the legacy path finding interfaces, the search
# agressiveness to use. The default is 7.
# agressivness to use. The default is 7.
#
#
#

View File

@@ -20,6 +20,8 @@
#
[validators]
n9KPnVLn7ewVzHvn218DcEYsnWLzKerTDwhpofhk4Ym1RUq4TeGw first
n9LFzWuhKNvXStHAuemfRKFVECLApowncMAM5chSCL9R5ECHGN4V second
n94rSdgTyBNGvYg8pZXGuNt59Y5bGAZGxbxyvjDaqD9ceRAgD85P third
n949f75evCHwgyP4fPVgaHqNHxUVN15PsJEZ3B3HnXPcPjcZAoy7 RL1
n9MD5h24qrQqiyBC8aeqqCWvpiBiYQ3jxSr91uiDvmrkyHRdYLUj RL2
n9L81uNCaPgtUJfaHh89gmdvXKAmSt5Gdsw2g1iPWaPkAHW5Nm4C RL3
n9KiYM9CgngLvtRCQHZwgC2gjpdaZcCcbt3VboxiNFcKuwFVujzS RL4
n9LdgEtkmGB9E2h3K4Vp7iGUaKuq23Zr32ehxiU8FWY7xoxbWTSA RL5

View File

@@ -10,7 +10,7 @@
},
"dependencies": {
"ripple-lib": "0.7.25",
"ripple-lib": "0.7.37",
"async": "~0.2.9",
"extend": "~1.2.0",
"simple-jsonrpc": "~0.0.2",
@@ -31,4 +31,4 @@
},
"readmeFilename": "README.md"
}
}

2
src/.gitignore vendored
View File

@@ -1,2 +0,0 @@
# boost subtree
/boost

View File

@@ -166,16 +166,6 @@
#define RIPPLE_DUMP_LEAKS_ON_EXIT 1
#endif
/** Config: RIPPLE_TRACK_MUTEXES
Turns on a feature that enables tracking and diagnostics for mutex
and recursive mutex objects. This affects the type of lock used
by RippleMutex and RippleRecursiveMutex
@note This can slow down performance considerably.
*/
#ifndef RIPPLE_TRACK_MUTEXES
#define RIPPLE_TRACK_MUTEXES 0
#endif
//------------------------------------------------------------------------------
// These control whether or not certain functionality gets
@@ -200,26 +190,59 @@
#endif
/** Config: BEAST_USE_BOOST_FEATURES
This activates boost specific features and improvements. If this is
turned on, the include paths for your build environment must be set
correctly to find the boost headers.
This activates boost specific features and improvements. If this is
turned on, the include paths for your build environment must be set
correctly to find the boost headers.
*/
#ifndef BEAST_USE_BOOST_FEATURES
//#define BEAST_USE_BOOST_FEATURES 1
#endif
/** Config: RIPPLE_PROPOSE_FEATURES
This determines whether to add any features to the proposed transaction set.
This determines whether to add any features to the proposed transaction set.
*/
#ifndef RIPPLE_PROPOSE_AMENDMENTS
#define RIPPLE_PROPOSE_AMENDMENTS 0
#endif
/** Config: RIPPLE_USE_OLD_CREATE_TRANSACTOR
This determines whether ripple uses the legacy OfferCreate transactor.
/** Config: RIPPLE_ENABLE_AUTOBRIDGING
This determines whether ripple implements offer autobridging via XRP.
*/
#ifndef RIPPLE_USE_OLD_CREATE_TRANSACTOR
#define RIPPLE_USE_OLD_CREATE_TRANSACTOR 1
#ifndef RIPPLE_ENABLE_AUTOBRIDGING
#define RIPPLE_ENABLE_AUTOBRIDGING 0
#endif
/** Config: RIPPLE_SINGLE_IO_SERVICE_THREAD
When set, restricts the number of threads calling io_service::run to one.
This is useful when debugging.
*/
#ifndef RIPPLE_SINGLE_IO_SERVICE_THREAD
#define RIPPLE_SINGLE_IO_SERVICE_THREAD 0
#endif
/** Config: RIPPLE_STRUCTURED_OVERLAY_CLIENT
RIPPLE_STRUCTURED_OVERLAY_SERVER
Enables Structured Overlay support for the client or server roles.
This feature is currently in development:
https://ripplelabs.atlassian.net/browse/RIPD-157
*/
#ifndef RIPPLE_STRUCTURED_OVERLAY_CLIENT
#define RIPPLE_STRUCTURED_OVERLAY_CLIENT 0
#endif
#ifndef RIPPLE_STRUCTURED_OVERLAY_SERVER
#define RIPPLE_STRUCTURED_OVERLAY_SERVER 1
#endif
/** Config: RIPPLE_ASYNC_RPC_HANDLER
*/
#ifndef RIPPLE_ASYNC_RPC_HANDLER
#define RIPPLE_ASYNC_RPC_HANDLER 1
#endif
/** Config: RIPPLE_ASYNC_RPC_HANDLER
*/
#ifndef RIPPLE_ASYNC_RPC_HANDLER
#define RIPPLE_ASYNC_RPC_HANDLER 1
#endif
#endif

View File

@@ -1,9 +1,9 @@
# src
Some of these directories come from entire outside repositories
brought in using git-subtree. This means that the source files are
inserted directly into the rippled repository. They can be edited
and committed just as if they were normal files.
Some of these directories come from entire outside repositories brought in
using git-subtree. This means that the source files are inserted directly
into the rippled repository. They can be edited and committed just as if they
were normal files.
However, if you create a commit that contains files both from a
subtree, and from the ripple source tree please use care when designing

View File

@@ -1,23 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros">
<RepoDir>..\..</RepoDir>
</PropertyGroup>
<PropertyGroup />
<ItemDefinitionGroup>
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<PreprocessorDefinitions>BEAST_INCLUDE_BEASTCONFIG=1;_CRTDBG_MAP_ALLOC;_WIN32_WINNT=0x0600;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
<BuildMacro Include="RepoDir">
<Value>$(RepoDir)</Value>
</BuildMacro>
</ItemGroup>
</Project>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,228 +0,0 @@
Write code in a clear, self-documenting style but use comments where necessary.
Use Test Driven Development. It encourages designing interfaces first, before implementation.
Don't Repeat Yourself, <20>D.R.Y.<2E>. Put redundant code in a class so it can be re-used and unit tested.
Expose as little of a class as possible. Prefer private over protected. Prefer protected over public. The smaller the interface footprint, the easier it is to write unit tests and comprehend the operation of the class. This is the Interface Segregation Principle.
Use language constants (enum or static const) with descriptive names instead of hard-coded <20>magic numbers.<2E>
Make classes depend on as few external classes or routines as possible. Ideally, no dependencies.
Don't limit flexibility of parameters by forcing the caller to use specific types where general types would work.
--------------------------------------------------------------------------------
# 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.
## 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
The goal of source code formatting should always be to make things as easy to
read as possible. White space is used to guide the eye so that details are not
overlooked. Blank lines are used to separate code into "paragraphs."
* No tab characters please.
* Tab stops are set to 4 spaces.
* Braces are indented in the [Allman style][2].
* Always place a space before and after all binary operators,
especially assignments (`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
the operand.
* A space never appears before a comma, and always appears after a comma.
* Always place a space before an opening parenthesis. One exception is if
the parentheses are empty.
* 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 place code or comments on the same line as any opening or
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 (Thing const& 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
* 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*` 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&` 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 == nullptr)`.
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 `std::int64_t` and `std::uint64_t` 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.
* Use the most restrictive access-specifier possible for each member. Prefer
`private` over `protected`, and `protected` over `public`. Don't expose
things unnecessarily.
* 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
* Constrain the scope of identifiers to the smallest area that needs it. Consider
using nested classes or classes inside functions, if doing so will expose less
interface and implementation overall.
* `goto` statements should not be used at all, even if the alternative is
more verbose code. The only exception is when implementing an algorithm in
a function as a state machine.
* 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 ();
// other 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

View File

@@ -102,7 +102,7 @@ INPUT_ENCODING = UTF-8
FILE_PATTERNS =
RECURSIVE = YES
EXCLUDE = modules/beast_core/beast_core.h \
modules/beast_core/beast_core.cpp \
modules/beast_core/beast_core.unity.cpp \
modules/beast_basics/beast_basics.cpp \
modules/beast_basics/native \
modules/beast_basics/zip/zlib

View File

@@ -1,7 +1,10 @@
from __future__ import absolute_import, division, print_function, unicode_literals
import copy
import itertools
import ntpath
import os
import random
import sys
def add_beast_to_path():
@@ -24,7 +27,7 @@ VARIANT_DIRECTORIES = {
'modules': ('bin', 'modules'),
}
BOOST_LIBRARIES = 'boost_system',
BOOST_LIBRARIES = '' #boost_system'
MAIN_PROGRAM_FILE = 'beast/unit_test/tests/main.cpp'
DOTFILE = '~/.scons'
@@ -43,6 +46,94 @@ def main():
for name, path in VARIANT_DIRECTORIES.items():
env.VariantDir(os.path.join(*path), name, duplicate=0)
env.Replace(PRINT_CMD_LINE_FUNC=Print.print_cmd_line)
Tests.run_tests(env, MAIN_PROGRAM_FILE, '.', '.test.cpp')
#Tests.run_tests(env, MAIN_PROGRAM_FILE, '.', '.test.cpp')
#main()
#-------------------------------------------------------------------------------
def is_unity(path):
b, e = os.path.splitext(path)
return os.path.splitext(b)[1] == '.unity' and e in ['.c', '.cpp']
def files(base):
for parent, _, files in os.walk(base):
for path in files:
path = os.path.join(parent, path)
yield os.path.normpath(path)
#-------------------------------------------------------------------------------
'''
/MP /GS /W3 /wd"4018" /wd"4244" /wd"4267" /Gy- /Zc:wchar_t
/I"D:\lib\OpenSSL-Win64\include" /I"D:\lib\boost_1_55_0"
/I"..\..\src\protobuf\src" /I"..\..\src\protobuf\vsprojects"
/I"..\..\src\leveldb" /I"..\..\src\leveldb\include" /I"..\..\build\proto"
/Zi /Gm- /Od /Fd"..\..\build\obj\VisualStudio2013\Debug.x64\vc120.pdb"
/fp:precise /D "_CRTDBG_MAP_ALLOC" /D "WIN32" /D "_DEBUG" /D "_CONSOLE"
/D "_VARIADIC_MAX=10" /D "_WIN32_WINNT=0x0600" /D "_SCL_SECURE_NO_WARNINGS"
/D "_CRT_SECURE_NO_WARNINGS" /D "_MBCS" /errorReport:prompt /WX- /Zc:forScope
/RTC1 /GR /Gd /MTd /openmp- /Fa"..\..\build\obj\VisualStudio2013\Debug.x64\"
/EHa /nologo /Fo"..\..\build\obj\VisualStudio2013\Debug.x64\"
/Fp"..\..\build\obj\VisualStudio2013\Debug.x64\rippled.pch"
'''
# Path to this SConstruct file
base_dir = Dir('#').srcnode().get_abspath()
base_env = Environment(
tools = ['default', 'VSProject'],
CCCOMSTR = '',
CMDLINE_QUIET = 1,
CPPPATH = [
os.environ['BOOST_ROOT'],
os.environ['OPENSSL_ROOT']
],
CPPDEFINES = [
'_WIN32_WINNT=0x6000']
)
#base_env.Replace(PRINT_CMD_LINE_FUNC=Print.print_cmd_line)
env = base_env
bin_dir = os.path.join(base_dir, 'bin')
srcs = filter(is_unity, list(files('beast')) + list(files('modules')))
for variant in ['Debug']: #, 'Release']:
for platform in ['Win32']:
#env = base_env.Clone()
#env.Replace(PRINT_CMD_LINE_FUNC=Print.print_cmd_line)
variant_dir = os.path.join(bin_dir, variant + '.' + platform)
env.VariantDir(os.path.join(variant_dir, 'beast'), 'beast', duplicate=0)
env.VariantDir(os.path.join(variant_dir, 'modules'), 'modules', duplicate=0)
env.Append(CCFLAGS=[
'/EHsc',
'/bigobj',
'/Fd${TARGET}.pdb'
])
if variant == 'Debug':
env.Append(CCFLAGS=[
'/MTd',
'/Od',
'/Zi'
])
else:
env.Append(CCFLAGS=[
'/MT',
'/Ox'
])
variant_srcs = [os.path.join(variant_dir, os.path.relpath(f, base_dir)) for f in srcs]
beast = env.StaticLibrary(
target = os.path.join(variant_dir, 'beast.lib'),
source = variant_srcs)
env.VSProject (
'out',
buildtarget = beast,
source = filter(is_unity, list(files('beast')) + list(files('modules'))))
env.Default ('out.vcxproj')
#env.Default (os.path.join(bin_dir,'Debug.Win32', 'beast.lib'))
main()

View File

@@ -1,44 +0,0 @@
--------------------------------------------------------------------------------
BEAST TODO
--------------------------------------------------------------------------------
- Change sqdb to use exceptions instead of errors
- Use SemanticVersion for beast version numbers to replace BEAST_VERSION
- add support for a __PRETTY_FUNCTION__ equivalent for all environments
- Import secp256k1 from sipa
- Set sqlite thread safety model to '2' in beast_sqlite
- Document and rename all the sqdb files and classes
- Specialize UnsignedInteger<> for peformance in the storage format
- Rename HeapBlock routines to not conflict with _CRTDBG_MAP_ALLOC macros
- Implement beast::Bimap?
- Use Bimap for storage in the DeadlineTimer::Manager, to support
thousands of timers.
- Think about adding a shouldStop bool to InterruptibleThread, along
with a shouldStop () function returning bool, and a stop() method.
- Tidy up CacheLine, MemoryAlignment
- Implement a reasonable substitute for boost's thread_local_storage
- Rename malloc/calloc JUCE members that conflict with the debug CRT from MSVC
- Reformat every Doxygen comment
- Fix Doxygen metatags
- update Beast Doxyfile
- Rename SharedData to SharedState or something?
- Make sure the template BeastConfig.h is included in the Doxyfile
- Implement robust key/value database with bulk write

View File

@@ -24,9 +24,9 @@
#ifndef BEAST_ARITHMETIC_H_INCLUDED
#define BEAST_ARITHMETIC_H_INCLUDED
#include "Config.h"
#include <beast/Config.h>
#include "utility/noexcept.h"
#include <beast/utility/noexcept.h>
#include <cmath>
#include <cstdint>

View File

@@ -24,10 +24,10 @@
#ifndef BEAST_ATOMIC_H_INCLUDED
#define BEAST_ATOMIC_H_INCLUDED
#include "Config.h"
#include "StaticAssert.h"
#include <beast/Config.h>
#include <beast/StaticAssert.h>
#include "utility/noexcept.h"
#include <beast/utility/noexcept.h>
#include <cstdint>

View File

@@ -22,6 +22,6 @@
// These classes require boost in order to be used.
#include "boost/ErrorCode.h"
#include <beast/boost/ErrorCode.h>
#endif

View File

@@ -24,8 +24,8 @@
#ifndef BEAST_BYTEORDER_H_INCLUDED
#define BEAST_BYTEORDER_H_INCLUDED
#include "Config.h"
#include "Uncopyable.h"
#include <beast/Config.h>
#include <beast/Uncopyable.h>
#include <cstdint>

View File

@@ -20,13 +20,13 @@
#ifndef BEAST_CHRONO_H_INCLUDED
#define BEAST_CHRONO_H_INCLUDED
#include "chrono/abstract_clock.h"
#include "chrono/basic_seconds_clock.h"
#include "chrono/chrono_io.h"
#include "chrono/chrono_util.h"
#include "chrono/manual_clock.h"
#include "chrono/ratio_io.h"
#include <beast/chrono/abstract_clock.h>
#include <beast/chrono/basic_seconds_clock.h>
#include <beast/chrono/chrono_io.h>
#include <beast/chrono/chrono_util.h>
#include <beast/chrono/manual_clock.h>
#include <beast/chrono/ratio_io.h>
#include "chrono/RelativeTime.h"
#include <beast/chrono/RelativeTime.h>
#endif

View File

@@ -30,34 +30,34 @@
#define BOOST_ASIO_HAS_STD_ARRAY 1
#if !defined(BEAST_COMPILER_CONFIG) && !defined(BEAST_NO_COMPILER_CONFIG) && !defined(BEAST_NO_CONFIG)
#include "config/SelectCompilerConfig.h"
#include <beast/config/SelectCompilerConfig.h>
#endif
#ifdef BEAST_COMPILER_CONFIG
#include BEAST_COMPILER_CONFIG
#endif
#if !defined(BEAST_STDLIB_CONFIG) && !defined(BEAST_NO_STDLIB_CONFIG) && !defined(BEAST_NO_CONFIG) && defined(__cplusplus)
#include "config/SelectStdlibConfig.h"
#include <beast/config/SelectStdlibConfig.h>
#endif
#ifdef BEAST_STDLIB_CONFIG
#include BEAST_STDLIB_CONFIG
#endif
#if !defined(BEAST_PLATFORM_CONFIG) && !defined(BEAST_NO_PLATFORM_CONFIG) && !defined(BEAST_NO_CONFIG)
#include "config/SelectCompilerConfig.h"
#include <beast/config/SelectCompilerConfig.h>
#endif
#ifdef BEAST_PLATFORM_CONFIG
#include BEAST_PLATFORM_CONFIG
#endif
// Legacy
#include "Version.h"
#include "config/PlatformConfig.h"
#include "config/CompilerConfig.h"
#include "config/StandardConfig.h"
#include "config/ConfigCheck.h"
#include <beast/Version.h>
#include <beast/config/PlatformConfig.h>
#include <beast/config/CompilerConfig.h>
#include <beast/config/StandardConfig.h>
#include <beast/config/ConfigCheck.h>
// Suffix
#include "config/Suffix.h"
#include <beast/config/Suffix.h>
#endif

View File

@@ -20,11 +20,11 @@
#ifndef BEAST_CRYPTO_H_INCLUDED
#define BEAST_CRYPTO_H_INCLUDED
#include "crypto/BinaryEncoding.h"
#include "crypto/MurmurHash.h"
#include "crypto/Sha256.h"
#include "crypto/UnsignedInteger.h"
#include "crypto/UnsignedIntegerCalc.h"
#include <beast/crypto/BinaryEncoding.h>
#include <beast/crypto/MurmurHash.h>
#include <beast/crypto/Sha256.h>
#include <beast/crypto/UnsignedInteger.h>
#include <beast/crypto/UnsignedIntegerCalc.h>
#endif

View File

@@ -28,8 +28,8 @@
#include <cstdlib>
#include <stdexcept>
#include "Memory.h"
#include "Uncopyable.h"
#include <beast/Memory.h>
#include <beast/Uncopyable.h>
// If the MSVC debug heap headers were included, disable
// the macros during the juce include since they conflict.

View File

@@ -20,18 +20,18 @@
#ifndef BEAST_INSIGHT_H_INCLUDED
#define BEAST_INSIGHT_H_INCLUDED
#include "insight/Counter.h"
#include "insight/CounterImpl.h"
#include "insight/Event.h"
#include "insight/EventImpl.h"
#include "insight/Gauge.h"
#include "insight/GaugeImpl.h"
#include "insight/Group.h"
#include "insight/Groups.h"
#include "insight/Hook.h"
#include "insight/HookImpl.h"
#include "insight/Collector.h"
#include "insight/NullCollector.h"
#include "insight/StatsDCollector.h"
#include <beast/insight/Counter.h>
#include <beast/insight/CounterImpl.h>
#include <beast/insight/Event.h>
#include <beast/insight/EventImpl.h>
#include <beast/insight/Gauge.h>
#include <beast/insight/GaugeImpl.h>
#include <beast/insight/Group.h>
#include <beast/insight/Groups.h>
#include <beast/insight/Hook.h>
#include <beast/insight/HookImpl.h>
#include <beast/insight/Collector.h>
#include <beast/insight/NullCollector.h>
#include <beast/insight/StatsDCollector.h>
#endif

View File

@@ -20,7 +20,7 @@
#ifndef BEAST_INTRUSIVE_H_INCLUDED
#define BEAST_INTRUSIVE_H_INCLUDED
#include "intrusive/List.h"
#include "intrusive/LockFreeStack.h"
#include <beast/intrusive/List.h>
#include <beast/intrusive/LockFreeStack.h>
#endif

View File

@@ -26,8 +26,8 @@
#include <cstring>
#include "Config.h"
#include "Uncopyable.h"
#include <beast/Config.h>
#include <beast/Uncopyable.h>
namespace beast {
@@ -43,7 +43,7 @@ void zerostruct (Type& structure) noexcept
/** Delete an object pointer, and sets the pointer to null.
Remember that it's not good c++ practice to use delete directly - always try to use a ScopedPointer
Remember that it's not good c++ practice to use delete directly - always try to use a std::unique_ptr
or other automatic lifetime-management system rather than resorting to deleting raw pointers!
*/
template <typename Type>

View File

@@ -20,11 +20,9 @@
#ifndef BEAST_SMARTPTR_H_INCLUDED
#define BEAST_SMARTPTR_H_INCLUDED
#include "Config.h"
#include <beast/Config.h>
#include "smart_ptr/ContainerDeletePolicy.h"
#include "smart_ptr/SharedObject.h"
#include "smart_ptr/SharedPtr.h"
#include "smart_ptr/ScopedPointer.h"
#include <beast/smart_ptr/SharedObject.h>
#include <beast/smart_ptr/SharedPtr.h>
#endif

View File

@@ -20,8 +20,8 @@
#ifndef BEAST_STRINGS_H_INCLUDED
#define BEAST_STRINGS_H_INCLUDED
#include "strings/String.h"
#include "strings/NewLine.h"
#include <beast/strings/String.h>
#include <beast/strings/NewLine.h>
#endif

View File

@@ -20,19 +20,19 @@
#ifndef BEAST_THREADS_H_INCLUDED
#define BEAST_THREADS_H_INCLUDED
#include "threads/UnlockGuard.h"
#include "threads/TryLockGuard.h"
#include "threads/SharedLockGuard.h"
#include "threads/SharedMutexAdapter.h"
#include "threads/SharedData.h"
#include "threads/ServiceQueue.h"
#include "threads/SpinLock.h"
#include "threads/Stoppable.h"
#include "threads/Thread.h"
#include "threads/ThreadLocalValue.h"
#include "threads/WaitableEvent.h"
#include "threads/ScopedWrapperContext.h"
#include <beast/threads/UnlockGuard.h>
#include <beast/threads/TryLockGuard.h>
#include <beast/threads/SharedLockGuard.h>
#include <beast/threads/SharedMutexAdapter.h>
#include <beast/threads/SharedData.h>
#include <beast/threads/ServiceQueue.h>
#include <beast/threads/SpinLock.h>
#include <beast/threads/Stoppable.h>
#include <beast/threads/Thread.h>
#include <beast/threads/ThreadLocalValue.h>
#include <beast/threads/WaitableEvent.h>
#include <beast/threads/ScopedWrapperContext.h>
#include "threads/semaphore.h"
#include <beast/threads/semaphore.h>
#endif

View File

@@ -18,15 +18,15 @@
//==============================================================================
#if BEAST_INCLUDE_BEASTCONFIG
#include "../../BeastConfig.h"
#include <BeastConfig.h>
#endif
#include "impl/IPAddressConversion.cpp"
#include <beast/asio/impl/IPAddressConversion.cpp>
#include "tests/wrap_handler.test.cpp"
#include "tests/bind_handler.test.cpp"
#include "tests/enable_wait_for_async.test.cpp"
#include "tests/shared_handler.test.cpp"
#include <beast/asio/tests/wrap_handler.test.cpp>
#include <beast/asio/tests/bind_handler.test.cpp>
#include <beast/asio/tests/enable_wait_for_async.test.cpp>
#include <beast/asio/tests/shared_handler.test.cpp>
#include "abstract_socket.cpp" // TEMPORARY!
#include <beast/asio/abstract_socket.cpp> // TEMPORARY!

View File

@@ -20,7 +20,7 @@
#ifndef BEAST_ASIO_IPADDRESSCONVERSION_H_INCLUDED
#define BEAST_ASIO_IPADDRESSCONVERSION_H_INCLUDED
#include "../net/IPEndpoint.h"
#include <beast/net/IPEndpoint.h>
#include <sstream>

View File

@@ -17,8 +17,8 @@
*/
//==============================================================================
#include "abstract_socket.h"
#include "bind_handler.h"
#include <beast/asio/abstract_socket.h>
#include <beast/asio/bind_handler.h>
namespace beast {
namespace asio {

View File

@@ -20,9 +20,9 @@
#ifndef BEAST_ASIO_ABSTRACT_SOCKET_H_INCLUDED
#define BEAST_ASIO_ABSTRACT_SOCKET_H_INCLUDED
#include "buffer_sequence.h"
#include "shared_handler.h"
#include <beast/asio/buffer_sequence.h>
#include <beast/asio/shared_handler.h>
#include <boost/asio/io_service.hpp>
#include <boost/asio/socket_base.hpp>
#include <boost/asio/ssl/stream_base.hpp>

View File

@@ -25,8 +25,8 @@
#include <boost/asio/detail/handler_invoke_helpers.hpp>
#include <functional>
#include "../cxx14/type_traits.h" // <type_traits>
#include "../cxx14/utility.h" // <utility>
#include <beast/cxx14/type_traits.h> // <type_traits>
#include <beast/cxx14/utility.h> // <utility>
namespace beast {
namespace asio {
@@ -56,6 +56,7 @@ private:
public:
typedef void result_type;
explicit
bound_handler (DeducedHandler&& handler, Args&&... args)
: m_handler (std::forward <DeducedHandler> (handler))
, m_args (std::forward <Args> (args)...)

View File

@@ -22,10 +22,10 @@
#include <boost/asio/buffer.hpp>
#include "../utility/noexcept.h"
#include <beast/utility/noexcept.h>
#include <algorithm>
#include <iterator>
#include "../cxx14/type_traits.h" // <type_traits>
#include <beast/cxx14/type_traits.h> // <type_traits>
#include <vector>
namespace beast {

View File

@@ -20,9 +20,9 @@
#ifndef BEAST_ASIO_ENABLE_WAIT_FOR_ASYNC_H_INCLUDED
#define BEAST_ASIO_ENABLE_WAIT_FOR_ASYNC_H_INCLUDED
#include "wrap_handler.h"
#include <beast/asio/wrap_handler.h>
#include "../utility/is_call_possible.h"
#include <beast/utility/is_call_possible.h>
#include <boost/asio/detail/handler_alloc_helpers.hpp>
#include <boost/asio/detail/handler_cont_helpers.hpp>
@@ -31,7 +31,7 @@
#include <atomic>
#include <condition_variable>
#include <mutex>
#include "../cxx14/type_traits.h" // <type_traits>
#include <beast/cxx14/type_traits.h> // <type_traits>
namespace beast {
namespace asio {

View File

@@ -17,7 +17,7 @@
*/
//==============================================================================
#include "../IPAddressConversion.h"
#include <beast/asio/IPAddressConversion.h>
namespace beast {
namespace IP {

View File

@@ -20,11 +20,11 @@
#ifndef BEAST_ASIO_MEMORY_BUFFER_H_INCLUDED
#define BEAST_ASIO_MEMORY_BUFFER_H_INCLUDED
#include "../utility/empty_base_optimization.h"
#include <beast/utility/empty_base_optimization.h>
#include <boost/asio/buffer.hpp>
#include "../utility/noexcept.h"
#include <beast/utility/noexcept.h>
#include <cstddef>
#include <memory>
#include <type_traits>

View File

@@ -20,19 +20,19 @@
#ifndef BEAST_ASIO_SHARED_HANDLER_H_INCLUDED
#define BEAST_ASIO_SHARED_HANDLER_H_INCLUDED
#include "../Config.h"
#include <beast/Config.h>
#include "../utility/is_call_possible.h"
#include <beast/utility/is_call_possible.h>
#include <boost/utility/base_from_member.hpp>
#include <boost/asio/detail/handler_alloc_helpers.hpp>
#include <boost/asio/detail/handler_cont_helpers.hpp>
#include <boost/asio/detail/handler_invoke_helpers.hpp>
#include "../utility/noexcept.h"
#include <beast/utility/noexcept.h>
#include <functional>
#include <memory>
#include "../cxx14/type_traits.h" // <type_traits>
#include <beast/cxx14/type_traits.h> // <type_traits>
#ifndef BEAST_ASIO_NO_ALLOCATE_SHARED
#define BEAST_ASIO_NO_ALLOCATE_SHARED 0

View File

@@ -20,10 +20,10 @@
#ifndef BEAST_ASIO_SOCKET_WRAPPER_H_INCLUDED
#define BEAST_ASIO_SOCKET_WRAPPER_H_INCLUDED
#include "abstract_socket.h"
#include "bind_handler.h"
#include <beast/asio/abstract_socket.h>
#include <beast/asio/bind_handler.h>
#include "../utility/noexcept.h"
#include <beast/utility/noexcept.h>
namespace beast {
namespace asio {

View File

@@ -20,12 +20,12 @@
// LIBS: boost_system
#if BEAST_INCLUDE_BEASTCONFIG
#include "../../../BeastConfig.h"
#include <BeastConfig.h>
#endif
#include "../../unit_test/suite.h"
#include <beast/unit_test/suite.h>
#include "../bind_handler.h"
#include <beast/asio/bind_handler.h>
#include <functional>

View File

@@ -18,13 +18,13 @@
//==============================================================================
#if BEAST_INCLUDE_BEASTCONFIG
#include "../../../BeastConfig.h"
#include <BeastConfig.h>
#endif
#include "../../unit_test/suite.h"
#include <beast/unit_test/suite.h>
#include "../bind_handler.h"
#include "../enable_wait_for_async.h"
#include <beast/asio/bind_handler.h>
#include <beast/asio/enable_wait_for_async.h>
#include <boost/asio/io_service.hpp>

View File

@@ -18,12 +18,12 @@
//==============================================================================
#if BEAST_INCLUDE_BEASTCONFIG
#include "../../../BeastConfig.h"
#include <BeastConfig.h>
#endif
#include "../../unit_test/suite.h"
#include <beast/unit_test/suite.h>
#include "../shared_handler.h"
#include <beast/asio/shared_handler.h>
// Disables is_constructible tests for std::function
// Visual Studio std::function fails the is_constructible tests

View File

@@ -18,12 +18,12 @@
//==============================================================================
#if BEAST_INCLUDE_BEASTCONFIG
#include "../../../BeastConfig.h"
#include <BeastConfig.h>
#endif
#include "../../unit_test/suite.h"
#include <beast/unit_test/suite.h>
#include "../wrap_handler.h"
#include <beast/asio/wrap_handler.h>
#include <boost/version.hpp>

View File

@@ -24,7 +24,7 @@
#include <boost/asio/detail/handler_cont_helpers.hpp>
#include <boost/asio/detail/handler_invoke_helpers.hpp>
#include "../cxx14/type_traits.h" // <type_traits>
#include <beast/cxx14/type_traits.h> // <type_traits>
#include <utility>
namespace beast {

View File

@@ -18,10 +18,10 @@
//==============================================================================
#if BEAST_INCLUDE_BEASTCONFIG
#include "../../BeastConfig.h"
#include <BeastConfig.h>
#endif
#include "ErrorCode.h"
#include <beast/boost/ErrorCode.h>
namespace detail {

View File

@@ -18,13 +18,13 @@
//==============================================================================
#if BEAST_INCLUDE_BEASTCONFIG
#include "../../BeastConfig.h"
#include <BeastConfig.h>
#endif
#include "../Config.h"
#include <beast/Config.h>
#include "impl/chrono_io.cpp"
#include "impl/RelativeTime.cpp"
#include <beast/chrono/impl/chrono_io.cpp>
#include <beast/chrono/impl/RelativeTime.cpp>
#include "tests/abstract_clock.test.cpp"
#include "tests/basic_seconds_clock.test.cpp"
#include <beast/chrono/tests/abstract_clock.test.cpp>
#include <beast/chrono/tests/basic_seconds_clock.test.cpp>

View File

@@ -24,10 +24,10 @@
#ifndef BEAST_CHRONO_RELATIVETIME_H_INCLUDED
#define BEAST_CHRONO_RELATIVETIME_H_INCLUDED
#include "../Config.h"
#include "../strings/String.h"
#include <beast/Config.h>
#include <beast/strings/String.h>
#include "../utility/noexcept.h"
#include <beast/utility/noexcept.h>
#include <string>
#include <sstream>

View File

@@ -20,7 +20,7 @@
#ifndef BEAST_CHRONO_ABSTRACT_CLOCK_IO_H_INCLUDED
#define BEAST_CHRONO_ABSTRACT_CLOCK_IO_H_INCLUDED
#include "chrono_io.h"
#include <beast/chrono/chrono_io.h>
namespace beast {

View File

@@ -20,42 +20,15 @@
#ifndef BEAST_CHRONO_BASIC_SECONDS_CLOCK_H_INCLUDED
#define BEAST_CHRONO_BASIC_SECONDS_CLOCK_H_INCLUDED
#include <beast/chrono/chrono_util.h>
#include <algorithm>
#include <chrono>
#include <condition_variable>
#include <mutex>
#include <thread>
#include <vector>
#ifndef BEAST_BASIC_SECONDS_CLOCK_BOOST_WORKAROUND
# ifdef _MSC_VER
// Visual Studio 2012, 2013 have a bug in std::thread that
// causes a hang on exit, in the library function atexit()
# if BEAST_USE_BOOST_FEATURES
# define BEAST_BASIC_SECONDS_CLOCK_BOOST_WORKAROUND 1
# else
# define BEAST_BASIC_SECONDS_CLOCK_BOOST_WORKAROUND 0
# endif
# else
# define BEAST_BASIC_SECONDS_CLOCK_BOOST_WORKAROUND 0
# endif
#endif
#if BEAST_BASIC_SECONDS_CLOCK_BOOST_WORKAROUND
# include <boost/version.hpp>
# if BOOST_VERSION >= 105500
# include <boost/thread/thread.hpp>
# include <boost/thread/mutex.hpp>
# include <boost/thread/condition_variable.hpp>
# include <boost/chrono.hpp>
# else
# error "Boost version 1.55.0 or later is required"
# endif
#else
# include <condition_variable>
# include <mutex>
# include <thread>
#endif
#include "../chrono/chrono_util.h"
namespace beast {
namespace detail {
@@ -72,15 +45,6 @@ public:
class seconds_clock_thread
{
public:
#if BEAST_BASIC_SECONDS_CLOCK_BOOST_WORKAROUND
typedef boost::mutex mutex;
typedef boost::condition_variable cond_var;
typedef boost::lock_guard <mutex> lock_guard;
typedef boost::unique_lock <mutex> unique_lock;
typedef boost::chrono::steady_clock clock_type;
typedef boost::chrono::seconds seconds;
typedef boost::thread thread;
#else
typedef std::mutex mutex;
typedef std::condition_variable cond_var;
typedef std::lock_guard <mutex> lock_guard;
@@ -88,7 +52,6 @@ public:
typedef std::chrono::steady_clock clock_type;
typedef std::chrono::seconds seconds;
typedef std::thread thread;
#endif
typedef std::vector <seconds_clock_worker*> workers;
bool m_stop;
@@ -106,12 +69,7 @@ public:
~seconds_clock_thread ()
{
{
lock_guard lock (m_mutex);
m_stop = true;
}
m_cond.notify_all();
m_thread.join ();
stop();
}
void add (seconds_clock_worker& w)
@@ -127,7 +85,20 @@ public:
m_workers.begin (), m_workers.end(), &w));
}
void run ()
void stop()
{
if (m_thread.joinable())
{
{
lock_guard lock (m_mutex);
m_stop = true;
}
m_cond.notify_all();
m_thread.join();
}
}
void run()
{
unique_lock lock (m_mutex);;
@@ -157,6 +128,20 @@ public:
//------------------------------------------------------------------------------
/** Called before main exits to terminate the utility thread.
This is a workaround for Visual Studio 2013:
http://connect.microsoft.com/VisualStudio/feedback/details/786016/creating-a-global-c-object-that-used-thread-join-in-its-destructor-causes-a-lockup
http://stackoverflow.com/questions/10915233/stdthreadjoin-hangs-if-called-after-main-exits-when-using-vs2012-rc
*/
inline
void
basic_seconds_clock_main_hook()
{
#ifdef _MSC_VER
detail::seconds_clock_thread::instance().stop();
#endif
}
/** A clock whose minimum resolution is one second.
The purpose of this class is to optimize the performance of the now()
member function call. It uses a dedicated thread that wakes up at least

View File

@@ -27,9 +27,9 @@
#ifndef BEAST_CHRONO_CHRONO_IO_H_INCLUDED
#define BEAST_CHRONO_CHRONO_IO_H_INCLUDED
#include "../Config.h"
#include <beast/Config.h>
#include "../utility/noexcept.h"
#include <beast/utility/noexcept.h>
#include <ctime>
#include <locale>
@@ -156,7 +156,7 @@ template <class charT, class Traits, class Duration>
*/
#include <chrono>
#include "ratio_io.h"
#include <beast/chrono/ratio_io.h>
//_LIBCPP_BEGIN_NAMESPACE_STD
namespace std {

View File

@@ -21,7 +21,7 @@
*/
//==============================================================================
#include "../RelativeTime.h"
#include <beast/chrono/RelativeTime.h>
// VFALCO TODO Migrate the localizable strings interfaces for this file

View File

@@ -24,7 +24,7 @@
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt).
#include "../chrono_io.h"
#include <beast/chrono/chrono_io.h>
//_LIBCPP_BEGIN_NAMESPACE_STD
namespace std {

View File

@@ -20,7 +20,7 @@
#ifndef BEAST_CHRONO_MANUAL_CLOCK_H_INCLUDED
#define BEAST_CHRONO_MANUAL_CLOCK_H_INCLUDED
#include "abstract_clock.h"
#include <beast/chrono/abstract_clock.h>
namespace beast {

View File

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

View File

@@ -17,9 +17,9 @@
*/
//==============================================================================
#include "../../unit_test/suite.h"
#include <beast/unit_test/suite.h>
#include "../basic_seconds_clock.h"
#include <beast/chrono/basic_seconds_clock.h>
namespace beast {

View File

@@ -25,7 +25,7 @@
#define BEAST_CONFIG_COMPILERCONFIG_H_INCLUDED
#include <assert.h>
#include "PlatformConfig.h"
#include <beast/config/PlatformConfig.h>
// This file defines miscellaneous macros for debugging, assertions, etc.

View File

@@ -35,28 +35,28 @@
#endif
#if BEAST_USE_INTRINSICS
# include <intrin.h>
#include <intrin.h>
#endif
#if BEAST_MAC || BEAST_IOS
# include <libkern/OSAtomic.h>
#include <libkern/OSAtomic.h>
#endif
#if BEAST_LINUX
# include <signal.h>
#include <signal.h>
# if __INTEL_COMPILER
# if __ia64__
# include <ia64intrin.h>
#include <ia64intrin.h>
# else
# include <ia32intrin.h>
#include <ia32intrin.h>
# endif
# endif
#endif
#if BEAST_MSVC && BEAST_DEBUG
# include <crtdbg.h>
# include <stdlib.h>
# include <malloc.h>
#include <crtdbg.h>
#include <stdlib.h>
#include <malloc.h>
#endif
#if BEAST_MSVC

View File

@@ -19,4 +19,4 @@
// Microsoft Visual C++ compiler configuration
#include "../../utility/noexcept.h"
#include <beast/utility/noexcept.h>

View File

@@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
//==============================================================================
#if BEAST_INCLUDE_BEASTCONFIG
#include <BeastConfig.h>
#endif
#include <beast/container/impl/spookyv2.cpp>
#include <beast/container/impl/siphash.cpp>
#include <beast/container/tests/aged_associative_container.test.cpp>
#include <beast/container/tests/buffer_view.test.cpp>
#include <beast/container/tests/hardened_hash.test.cpp>
#include <beast/container/tests/hash_append.test.cpp>

View File

@@ -20,7 +20,7 @@
#ifndef BEAST_CONTAINER_AGED_CONTAINER_UTILITY_H_INCLUDED
#define BEAST_CONTAINER_AGED_CONTAINER_UTILITY_H_INCLUDED
#include "aged_container.h"
#include <beast/container/aged_container.h>
#include <type_traits>

View File

@@ -20,7 +20,7 @@
#ifndef BEAST_CONTAINER_AGED_MAP_H_INCLUDED
#define BEAST_CONTAINER_AGED_MAP_H_INCLUDED
#include "detail/aged_ordered_container.h"
#include <beast/container/detail/aged_ordered_container.h>
#include <chrono>
#include <functional>

View File

@@ -20,7 +20,7 @@
#ifndef BEAST_CONTAINER_AGED_MULTIMAP_H_INCLUDED
#define BEAST_CONTAINER_AGED_MULTIMAP_H_INCLUDED
#include "detail/aged_ordered_container.h"
#include <beast/container/detail/aged_ordered_container.h>
#include <chrono>
#include <functional>

View File

@@ -20,7 +20,7 @@
#ifndef BEAST_CONTAINER_AGED_MULTISET_H_INCLUDED
#define BEAST_CONTAINER_AGED_MULTISET_H_INCLUDED
#include "detail/aged_ordered_container.h"
#include <beast/container/detail/aged_ordered_container.h>
#include <chrono>
#include <functional>

View File

@@ -20,7 +20,7 @@
#ifndef BEAST_CONTAINER_AGED_SET_H_INCLUDED
#define BEAST_CONTAINER_AGED_SET_H_INCLUDED
#include "detail/aged_ordered_container.h"
#include <beast/container/detail/aged_ordered_container.h>
#include <chrono>
#include <functional>

View File

@@ -20,7 +20,7 @@
#ifndef BEAST_CONTAINER_AGED_UNORDERED_MAP_H_INCLUDED
#define BEAST_CONTAINER_AGED_UNORDERED_MAP_H_INCLUDED
#include "detail/aged_unordered_container.h"
#include <beast/container/detail/aged_unordered_container.h>
#include <chrono>
#include <functional>

View File

@@ -20,7 +20,7 @@
#ifndef BEAST_CONTAINER_AGED_UNORDERED_MULTIMAP_H_INCLUDED
#define BEAST_CONTAINER_AGED_UNORDERED_MULTIMAP_H_INCLUDED
#include "detail/aged_unordered_container.h"
#include <beast/container/detail/aged_unordered_container.h>
#include <chrono>
#include <functional>

View File

@@ -20,7 +20,7 @@
#ifndef BEAST_CONTAINER_AGED_UNORDERED_MULTISET_H_INCLUDED
#define BEAST_CONTAINER_AGED_UNORDERED_MULTISET_H_INCLUDED
#include "detail/aged_unordered_container.h"
#include <beast/container/detail/aged_unordered_container.h>
#include <chrono>
#include <functional>

View File

@@ -20,7 +20,7 @@
#ifndef BEAST_CONTAINER_AGED_UNORDERED_SET_H_INCLUDED
#define BEAST_CONTAINER_AGED_UNORDERED_SET_H_INCLUDED
#include "detail/aged_unordered_container.h"
#include <beast/container/detail/aged_unordered_container.h>
#include <chrono>
#include <functional>

View File

@@ -20,16 +20,16 @@
#ifndef BEAST_CONTAINER_BUFFER_VIEW_H_INCLUDED
#define BEAST_CONTAINER_BUFFER_VIEW_H_INCLUDED
#include "../Config.h"
#include <beast/Config.h>
#include <array>
#include "../cxx14/algorithm.h" // <algorithm>
#include <beast/cxx14/algorithm.h> // <algorithm>
#include <cstddef>
#include <iterator>
#include <memory>
#include <string>
#include <vector>
#include "../cxx14/type_traits.h" // <type_traits>
#include <beast/cxx14/type_traits.h> // <type_traits>
namespace beast {

View File

@@ -37,7 +37,7 @@ namespace detail {
template <
bool is_const,
class Iterator,
class Base =
class Base =
std::iterator <
typename std::iterator_traits <Iterator>::iterator_category,
typename std::conditional <is_const,
@@ -51,20 +51,46 @@ class aged_container_iterator
public:
typedef typename Iterator::value_type::stashed::time_point time_point;
// Could be '= default', but Visual Studio 2013 chokes on it [Aug 2014]
aged_container_iterator ()
{
}
template <class OtherIterator, class OtherBase>
aged_container_iterator (aged_container_iterator <
false, OtherIterator, OtherBase> const& other)
// copy constructor
aged_container_iterator (
aged_container_iterator<is_const, Iterator, Base>
const& other) = default;
// Disable constructing a const_iterator from a non-const_iterator.
// Converting between reverse and non-reverse iterators should be explicit.
template <bool other_is_const, class OtherIterator, class OtherBase,
class = typename std::enable_if <
(other_is_const == false || is_const == true) &&
std::is_same<Iterator, OtherIterator>::value == false>::type>
explicit aged_container_iterator (aged_container_iterator <
other_is_const, OtherIterator, OtherBase> const& other)
: m_iter (other.m_iter)
{
}
// Disable constructing a const_iterator from a non-const_iterator.
template <bool other_is_const, class OtherBase,
class = typename std::enable_if <
other_is_const == false || is_const == true>::type>
aged_container_iterator (aged_container_iterator <
other_is_const, Iterator, OtherBase> const& other)
: m_iter (other.m_iter)
{
}
// Disable assigning a const_iterator to a non-const iterator
template <bool other_is_const, class OtherIterator, class OtherBase>
aged_container_iterator& operator= (aged_container_iterator <
other_is_const, OtherIterator, OtherBase> const& other)
auto
operator= (aged_container_iterator <
other_is_const, OtherIterator, OtherBase> const& other) ->
typename std::enable_if <
other_is_const == false || is_const == true,
aged_container_iterator&>::type
{
m_iter = other.m_iter;
return *this;

View File

@@ -20,28 +20,40 @@
#ifndef BEAST_CONTAINER_AGED_ORDERED_CONTAINER_H_INCLUDED
#define BEAST_CONTAINER_AGED_ORDERED_CONTAINER_H_INCLUDED
#include "aged_container_iterator.h"
#include "aged_associative_container.h"
#include <beast/container/detail/aged_container_iterator.h>
#include <beast/container/detail/aged_associative_container.h>
#include "../aged_container.h"
#include <beast/container/aged_container.h>
#include "../../chrono/abstract_clock.h"
#include "../../utility/empty_base_optimization.h"
#include <beast/chrono/abstract_clock.h>
#include <beast/utility/empty_base_optimization.h>
#include <boost/intrusive/list.hpp>
#include <boost/intrusive/set.hpp>
#include "../../cxx14/algorithm.h" // <algorithm>
#include <beast/cxx14/algorithm.h> // <algorithm>
#include <functional>
#include <initializer_list>
#include <iterator>
#include <memory>
#include "../../cxx14/type_traits.h" // <type_traits>
#include <beast/cxx14/type_traits.h> // <type_traits>
#include <utility>
namespace beast {
namespace detail {
// Traits templates used to discern reverse_iterators, which are disallowed
// for mutating operations.
template <class It>
struct is_boost_reverse_iterator
: std::false_type
{};
template <class It>
struct is_boost_reverse_iterator<boost::intrusive::detail::reverse_iterator<It>>
: std::true_type
{};
/** Associative container where each element is also indexed by time.
This container mirrors the interface of the standard library ordered
@@ -203,7 +215,7 @@ private:
{
return this->member() (k, extract (e.value));
}
template <class K>
bool operator() (element const& e, K const& k) const
{
@@ -215,7 +227,7 @@ private:
{
return this->member() (k, extract (e.value));
}
bool operator() (element const& e, Key const& k) const
{
return this->member() (extract (e.value), k);
@@ -384,13 +396,14 @@ private:
return p;
}
void delete_element (element* p)
void delete_element (element const* p)
{
ElementAllocatorTraits::destroy (m_config.alloc(), p);
ElementAllocatorTraits::deallocate (m_config.alloc(), p, 1);
ElementAllocatorTraits::deallocate (
m_config.alloc(), const_cast<element*>(p), 1);
}
void unlink_and_delete_element (element* p)
void unlink_and_delete_element (element const* p)
{
chronological.list.erase (
chronological.list.iterator_to (*p));
@@ -412,11 +425,13 @@ public:
typedef typename std::allocator_traits <
Allocator>::const_pointer const_pointer;
typedef detail::aged_container_iterator <false,
// A set (that is, !IsMap) iterator is aways const because the elements
// of a set are immutable.
typedef detail::aged_container_iterator <!IsMap,
typename cont_type::iterator> iterator;
typedef detail::aged_container_iterator <true,
typename cont_type::iterator> const_iterator;
typedef detail::aged_container_iterator <false,
typedef detail::aged_container_iterator <!IsMap,
typename cont_type::reverse_iterator> reverse_iterator;
typedef detail::aged_container_iterator <true,
typename cont_type::reverse_iterator> const_reverse_iterator;
@@ -433,11 +448,13 @@ public:
class chronological_t
{
public:
typedef detail::aged_container_iterator <false,
// A set (that is, !IsMap) iterator is aways const because the elements
// of a set are immutable.
typedef detail::aged_container_iterator <!IsMap,
typename list_type::iterator> iterator;
typedef detail::aged_container_iterator <true,
typename list_type::iterator> const_iterator;
typedef detail::aged_container_iterator <false,
typedef detail::aged_container_iterator <!IsMap,
typename list_type::reverse_iterator> reverse_iterator;
typedef detail::aged_container_iterator <true,
typename list_type::reverse_iterator> const_reverse_iterator;
@@ -823,7 +840,7 @@ public:
template <bool maybe_multi = IsMulti>
typename std::enable_if <maybe_multi,
iterator>::type
insert (const_iterator const& /*hint*/, value_type const& value)
insert (const_iterator /*hint*/, value_type const& value)
{
// VFALCO TODO Figure out how to utilize 'hint'
return insert (value);
@@ -840,7 +857,7 @@ public:
template <bool maybe_multi = IsMulti>
typename std::enable_if <maybe_multi,
iterator>::type
insert (const_iterator const& /*hint*/, value_type&& value)
insert (const_iterator /*hint*/, value_type&& value)
{
// VFALCO TODO Figure out how to utilize 'hint'
return insert (std::move (value));
@@ -882,7 +899,7 @@ public:
template <class InputIt>
void
insert (InputIt first, InputIt const& last)
insert (InputIt first, InputIt last)
{
for (; first != last; ++first)
insert (cend(), *first);
@@ -911,7 +928,7 @@ public:
// map, set
template <bool maybe_multi = IsMulti, class... Args>
auto
emplace_hint (const_iterator const& hint, Args&&... args) ->
emplace_hint (const_iterator hint, Args&&... args) ->
typename std::enable_if <! maybe_multi,
std::pair <iterator, bool>>::type;
@@ -919,24 +936,26 @@ public:
template <bool maybe_multi = IsMulti, class... Args>
typename std::enable_if <maybe_multi,
iterator>::type
emplace_hint (const_iterator const& /*hint*/, Args&&... args)
emplace_hint (const_iterator /*hint*/, Args&&... args)
{
// VFALCO TODO Figure out how to utilize 'hint'
return emplace <maybe_multi> (
std::forward <Args> (args)...);
}
template <bool is_const, class Iterator, class Base>
// enable_if prevents erase (reverse_iterator pos) from compiling
template <bool is_const, class Iterator, class Base,
class = std::enable_if_t<!is_boost_reverse_iterator<Iterator>::value>>
detail::aged_container_iterator <false, Iterator, Base>
erase (detail::aged_container_iterator <
is_const, Iterator, Base> const& pos);
erase (detail::aged_container_iterator <is_const, Iterator, Base> pos);
template <bool is_const, class Iterator, class Base>
// enable_if prevents erase (reverse_iterator first, reverse_iterator last)
// from compiling
template <bool is_const, class Iterator, class Base,
class = std::enable_if_t<!is_boost_reverse_iterator<Iterator>::value>>
detail::aged_container_iterator <false, Iterator, Base>
erase (detail::aged_container_iterator <
is_const, Iterator, Base> first,
detail::aged_container_iterator <
is_const, Iterator, Base> const& last);
erase (detail::aged_container_iterator <is_const, Iterator, Base> first,
detail::aged_container_iterator <is_const, Iterator, Base> last);
template <class K>
auto
@@ -948,10 +967,11 @@ public:
//--------------------------------------------------------------------------
template <bool is_const, class Iterator, class Base>
// enable_if prevents touch (reverse_iterator pos) from compiling
template <bool is_const, class Iterator, class Base,
class = std::enable_if_t<!is_boost_reverse_iterator<Iterator>::value>>
void
touch (detail::aged_container_iterator <
is_const, Iterator, Base> const& pos)
touch (detail::aged_container_iterator <is_const, Iterator, Base> pos)
{
touch (pos, clock().now());
}
@@ -1047,7 +1067,7 @@ public:
const_iterator
upper_bound (K const& k) const
{
return const_iterator (m_cont.upper_bound (k,
return const_iterator (m_cont.upper_bound (k,
std::cref (m_config.key_compare())));
}
@@ -1176,10 +1196,12 @@ public:
}
private:
template <bool is_const, class Iterator, class Base>
// enable_if prevents erase (reverse_iterator pos, now) from compiling
template <bool is_const, class Iterator, class Base,
class = std::enable_if_t<!is_boost_reverse_iterator<Iterator>::value>>
void
touch (detail::aged_container_iterator <
is_const, Iterator, Base> const& pos,
is_const, Iterator, Base> pos,
typename clock_type::time_point const& now);
template <bool maybe_propagate = std::allocator_traits <
@@ -1693,7 +1715,7 @@ template <bool IsMulti, bool IsMap, class Key, class T,
template <bool maybe_multi, class... Args>
auto
aged_ordered_container <IsMulti, IsMap, Key, T, Duration, Compare, Allocator>::
emplace_hint (const_iterator const& hint, Args&&... args) ->
emplace_hint (const_iterator hint, Args&&... args) ->
typename std::enable_if <! maybe_multi,
std::pair <iterator, bool>>::type
{
@@ -1716,36 +1738,27 @@ emplace_hint (const_iterator const& hint, Args&&... args) ->
template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator>
template <bool is_const, class Iterator, class Base>
auto
template <bool is_const, class Iterator, class Base, class>
detail::aged_container_iterator <false, Iterator, Base>
aged_ordered_container <IsMulti, IsMap, Key, T, Duration, Compare, Allocator>::
erase (detail::aged_container_iterator <
is_const, Iterator, Base> const& pos) ->
detail::aged_container_iterator <false, Iterator, Base>
erase (detail::aged_container_iterator <is_const, Iterator, Base> pos)
{
auto iter (pos.iterator());
auto p (&*iter++);
unlink_and_delete_element (p);
unlink_and_delete_element(&*((pos++).iterator()));
return detail::aged_container_iterator <
false, Iterator, Base> (iter);
false, Iterator, Base> (pos.iterator());
}
template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator>
template <bool is_const, class Iterator, class Base>
auto
template <bool is_const, class Iterator, class Base, class>
detail::aged_container_iterator <false, Iterator, Base>
aged_ordered_container <IsMulti, IsMap, Key, T, Duration, Compare, Allocator>::
erase (detail::aged_container_iterator <
is_const, Iterator, Base> first,
detail::aged_container_iterator <
is_const, Iterator, Base> const& last) ->
detail::aged_container_iterator <false, Iterator, Base>
erase (detail::aged_container_iterator <is_const, Iterator, Base> first,
detail::aged_container_iterator <is_const, Iterator, Base> last)
{
for (; first != last;)
{
auto p (&*first++);
unlink_and_delete_element (p);
}
unlink_and_delete_element(&*((first++).iterator()));
return detail::aged_container_iterator <
false, Iterator, Base> (first.iterator());
}
@@ -1839,11 +1852,11 @@ operator== (
template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator>
template <bool is_const, class Iterator, class Base>
template <bool is_const, class Iterator, class Base, class>
void
aged_ordered_container <IsMulti, IsMap, Key, T, Duration, Compare, Allocator>::
touch (detail::aged_container_iterator <
is_const, Iterator, Base> const& pos,
is_const, Iterator, Base> pos,
typename clock_type::time_point const& now)
{
auto& e (*pos.iterator());

View File

@@ -20,23 +20,23 @@
#ifndef BEAST_CONTAINER_AGED_UNORDERED_CONTAINER_H_INCLUDED
#define BEAST_CONTAINER_AGED_UNORDERED_CONTAINER_H_INCLUDED
#include "aged_container_iterator.h"
#include "aged_associative_container.h"
#include <beast/container/detail/aged_container_iterator.h>
#include <beast/container/detail/aged_associative_container.h>
#include "../aged_container.h"
#include <beast/container/aged_container.h>
#include "../../chrono/abstract_clock.h"
#include "../../utility/empty_base_optimization.h"
#include <beast/chrono/abstract_clock.h>
#include <beast/utility/empty_base_optimization.h>
#include <boost/intrusive/list.hpp>
#include <boost/intrusive/unordered_set.hpp>
#include "../../cxx14/algorithm.h" // <algorithm>
#include <beast/cxx14/algorithm.h> // <algorithm>
#include <functional>
#include <initializer_list>
#include <iterator>
#include <memory>
#include "../../cxx14/type_traits.h" // <type_traits>
#include <beast/cxx14/type_traits.h> // <type_traits>
#include <utility>
/*
@@ -186,7 +186,7 @@ private:
{
return this->member() (extract (e.value));
}
Hash& hash_function()
{
return this->member();
@@ -222,7 +222,7 @@ private:
{
return this->member() (k, extract (e.value));
}
template <class K>
bool operator() (element const& e, K const& k) const
{
@@ -234,7 +234,7 @@ private:
{
return this->member() (k, extract (e.value));
}
bool operator() (element const& e, Key const& k) const
{
return this->member() (extract (e.value), k);
@@ -584,13 +584,14 @@ private:
return p;
}
void delete_element (element* p)
void delete_element (element const* p)
{
ElementAllocatorTraits::destroy (m_config.alloc(), p);
ElementAllocatorTraits::deallocate (m_config.alloc(), p, 1);
ElementAllocatorTraits::deallocate (
m_config.alloc(), const_cast<element*>(p), 1);
}
void unlink_and_delete_element (element* p)
void unlink_and_delete_element (element const* p)
{
chronological.list.erase (
chronological.list.iterator_to (*p));
@@ -609,12 +610,14 @@ public:
typedef typename std::allocator_traits <
Allocator>::const_pointer const_pointer;
typedef detail::aged_container_iterator <false,
// A set (that is, !IsMap) iterator is aways const because the elements
// of a set are immutable.
typedef detail::aged_container_iterator <!IsMap,
typename cont_type::iterator> iterator;
typedef detail::aged_container_iterator <true,
typename cont_type::iterator> const_iterator;
typedef detail::aged_container_iterator <false,
typedef detail::aged_container_iterator <!IsMap,
typename cont_type::local_iterator> local_iterator;
typedef detail::aged_container_iterator <true,
typename cont_type::local_iterator> const_local_iterator;
@@ -631,11 +634,13 @@ public:
class chronological_t
{
public:
typedef detail::aged_container_iterator <false,
// A set (that is, !IsMap) iterator is aways const because the elements
// of a set are immutable.
typedef detail::aged_container_iterator <!IsMap,
typename list_type::iterator> iterator;
typedef detail::aged_container_iterator <true,
typename list_type::iterator> const_iterator;
typedef detail::aged_container_iterator <false,
typedef detail::aged_container_iterator <!IsMap,
typename list_type::reverse_iterator> reverse_iterator;
typedef detail::aged_container_iterator <true,
typename list_type::reverse_iterator> const_reverse_iterator;
@@ -1021,7 +1026,7 @@ public:
template <bool maybe_multi = IsMulti>
typename std::enable_if <maybe_multi,
iterator>::type
insert (const_iterator const& /*hint*/, value_type const& value)
insert (const_iterator /*hint*/, value_type const& value)
{
// VFALCO TODO The hint could be used to let
// the client order equal ranges
@@ -1043,7 +1048,7 @@ public:
template <bool maybe_multi = IsMulti>
typename std::enable_if <maybe_multi,
iterator>::type
insert (const_iterator const& /*hint*/, value_type&& value)
insert (const_iterator /*hint*/, value_type&& value)
{
// VFALCO TODO The hint could be used to let
// the client order equal ranges
@@ -1083,7 +1088,7 @@ public:
}
template <class InputIt>
void insert (InputIt first, InputIt const& last)
void insert (InputIt first, InputIt last)
{
insert (first, last,
typename std::iterator_traits <
@@ -1113,7 +1118,7 @@ public:
// set, map
template <bool maybe_multi = IsMulti, class... Args>
auto
emplace_hint (const_iterator const& /*hint*/, Args&&... args) ->
emplace_hint (const_iterator /*hint*/, Args&&... args) ->
typename std::enable_if <! maybe_multi,
std::pair <iterator, bool>>::type;
@@ -1121,7 +1126,7 @@ public:
template <bool maybe_multi = IsMulti, class... Args>
typename std::enable_if <maybe_multi,
iterator>::type
emplace_hint (const_iterator const& /*hint*/, Args&&... args)
emplace_hint (const_iterator /*hint*/, Args&&... args)
{
// VFALCO TODO The hint could be used for multi, to let
// the client order equal ranges
@@ -1132,14 +1137,14 @@ public:
template <bool is_const, class Iterator, class Base>
detail::aged_container_iterator <false, Iterator, Base>
erase (detail::aged_container_iterator <
is_const, Iterator, Base> const& pos);
is_const, Iterator, Base> pos);
template <bool is_const, class Iterator, class Base>
detail::aged_container_iterator <false, Iterator, Base>
erase (detail::aged_container_iterator <
is_const, Iterator, Base> first,
detail::aged_container_iterator <
is_const, Iterator, Base> const& last);
is_const, Iterator, Base> last);
template <class K>
auto
@@ -1152,7 +1157,7 @@ public:
template <bool is_const, class Iterator, class Base>
void
touch (detail::aged_container_iterator <
is_const, Iterator, Base> const& pos)
is_const, Iterator, Base> pos)
{
touch (pos, clock().now());
}
@@ -1349,24 +1354,11 @@ public:
class OtherAllocator,
bool maybe_multi = IsMulti
>
typename std::enable_if <! maybe_multi,
bool>::type
typename std::enable_if <! maybe_multi, bool>::type
operator== (
aged_unordered_container <false, OtherIsMap,
OtherKey, OtherT, OtherDuration, OtherHash, KeyEqual,
OtherAllocator> const& other) const
{
if (size() != other.size())
return false;
for (auto iter (cbegin()), last (cend()), olast (other.cend());
iter != last; ++iter)
{
auto oiter (other.find (extract (*iter)));
if (oiter == olast)
return false;
}
return true;
}
OtherAllocator> const& other) const;
template <
bool OtherIsMap,
@@ -1377,35 +1369,11 @@ public:
class OtherAllocator,
bool maybe_multi = IsMulti
>
typename std::enable_if <maybe_multi,
bool>::type
typename std::enable_if <maybe_multi, bool>::type
operator== (
aged_unordered_container <true, OtherIsMap,
OtherKey, OtherT, OtherDuration, OtherHash, KeyEqual,
OtherAllocator> const& other) const
{
if (size() != other.size())
return false;
typedef std::pair <const_iterator, const_iterator> EqRng;
for (auto iter (cbegin()), last (cend()); iter != last;)
{
auto const& k (extract (*iter));
auto const eq (equal_range (k));
auto const oeq (other.equal_range (k));
#if BEAST_NO_CXX14_IS_PERMUTATION
if (std::distance (eq.first, eq.second) !=
std::distance (oeq.first, oeq.second) ||
! std::is_permutation (eq.first, eq.second, oeq.first))
return false;
#else
if (! std::is_permutation (eq.first,
eq.second, oeq.first, oeq.second))
return false;
#endif
iter = eq.second;
}
return true;
}
OtherAllocator> const& other) const;
template <
bool OtherIsMulti,
@@ -1456,7 +1424,7 @@ private:
template <class InputIt>
void
insert_unchecked (InputIt first, InputIt const& last)
insert_unchecked (InputIt first, InputIt last)
{
for (; first != last; ++first)
insert_unchecked (*first);
@@ -1464,7 +1432,7 @@ private:
template <class InputIt>
void
insert (InputIt first, InputIt const& last,
insert (InputIt first, InputIt last,
std::input_iterator_tag)
{
for (; first != last; ++first)
@@ -1473,7 +1441,7 @@ private:
template <class InputIt>
void
insert (InputIt first, InputIt const& last,
insert (InputIt first, InputIt last,
std::random_access_iterator_tag)
{
auto const n (std::distance (first, last));
@@ -1484,7 +1452,7 @@ private:
template <bool is_const, class Iterator, class Base>
void
touch (detail::aged_container_iterator <
is_const, Iterator, Base> const& pos,
is_const, Iterator, Base> pos,
typename clock_type::time_point const& now)
{
auto& e (*pos.iterator());
@@ -2268,7 +2236,7 @@ template <bool maybe_multi, class... Args>
auto
aged_unordered_container <IsMulti, IsMap, Key, T, Duration,
Hash, KeyEqual, Allocator>::
emplace_hint (const_iterator const& /*hint*/, Args&&... args) ->
emplace_hint (const_iterator /*hint*/, Args&&... args) ->
typename std::enable_if <! maybe_multi,
std::pair <iterator, bool>>::type
{
@@ -2298,13 +2266,11 @@ detail::aged_container_iterator <false, Iterator, Base>
aged_unordered_container <IsMulti, IsMap, Key, T, Duration,
Hash, KeyEqual, Allocator>::
erase (detail::aged_container_iterator <
is_const, Iterator, Base> const& pos)
is_const, Iterator, Base> pos)
{
auto iter (pos.iterator());
auto p (&*iter++);
unlink_and_delete_element (p);
unlink_and_delete_element(&*((pos++).iterator()));
return detail::aged_container_iterator <
false, Iterator, Base> (iter);
false, Iterator, Base> (pos.iterator());
}
template <bool IsMulti, bool IsMap, class Key, class T,
@@ -2316,14 +2282,11 @@ aged_unordered_container <IsMulti, IsMap, Key, T, Duration,
erase (detail::aged_container_iterator <
is_const, Iterator, Base> first,
detail::aged_container_iterator <
is_const, Iterator, Base> const& last)
is_const, Iterator, Base> last)
{
size_type n (0);
for (; first != last; ++n)
{
auto p (&*first++);
unlink_and_delete_element (p);
}
for (; first != last;)
unlink_and_delete_element(&*((first++).iterator()));
return detail::aged_container_iterator <
false, Iterator, Base> (first.iterator());
}
@@ -2387,6 +2350,79 @@ touch (K const& k) ->
return n;
}
template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator>
template <
bool OtherIsMap,
class OtherKey,
class OtherT,
class OtherDuration,
class OtherHash,
class OtherAllocator,
bool maybe_multi
>
typename std::enable_if <! maybe_multi, bool>::type
aged_unordered_container <
IsMulti, IsMap, Key, T, Duration, Hash, KeyEqual, Allocator>::
operator== (
aged_unordered_container <false, OtherIsMap,
OtherKey, OtherT, OtherDuration, OtherHash, KeyEqual,
OtherAllocator> const& other) const
{
if (size() != other.size())
return false;
for (auto iter (cbegin()), last (cend()), olast (other.cend());
iter != last; ++iter)
{
auto oiter (other.find (extract (*iter)));
if (oiter == olast)
return false;
}
return true;
}
template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator>
template <
bool OtherIsMap,
class OtherKey,
class OtherT,
class OtherDuration,
class OtherHash,
class OtherAllocator,
bool maybe_multi
>
typename std::enable_if <maybe_multi, bool>::type
aged_unordered_container <
IsMulti, IsMap, Key, T, Duration, Hash, KeyEqual, Allocator>::
operator== (
aged_unordered_container <true, OtherIsMap,
OtherKey, OtherT, OtherDuration, OtherHash, KeyEqual,
OtherAllocator> const& other) const
{
if (size() != other.size())
return false;
typedef std::pair <const_iterator, const_iterator> EqRng;
for (auto iter (cbegin()), last (cend()); iter != last;)
{
auto const& k (extract (*iter));
auto const eq (equal_range (k));
auto const oeq (other.equal_range (k));
#if BEAST_NO_CXX14_IS_PERMUTATION
if (std::distance (eq.first, eq.second) !=
std::distance (oeq.first, oeq.second) ||
! std::is_permutation (eq.first, eq.second, oeq.first))
return false;
#else
if (! std::is_permutation (eq.first,
eq.second, oeq.first, oeq.second))
return false;
#endif
iter = eq.second;
}
return true;
}
//------------------------------------------------------------------------------
// map, set

View File

@@ -20,17 +20,18 @@
#ifndef BEAST_CONTAINER_HARDENED_HASH_H_INCLUDED
#define BEAST_CONTAINER_HARDENED_HASH_H_INCLUDED
#include "hash_append.h"
#include <beast/container/hash_append.h>
#include <beast/cxx14/utility.h> // <utility>
#include <beast/cxx14/type_traits.h> // <type_traits>
#include <beast/utility/noexcept.h>
#include <beast/utility/static_initializer.h>
#include "../utility/noexcept.h"
#include <cstdint>
#include <functional>
#include <mutex>
#include <random>
#include "../cxx14/type_traits.h" // <type_traits>
#include <unordered_map>
#include <unordered_set>
#include "../cxx14/utility.h" // <utility>
// When set to 1, makes the seed per-process instead
// of per default-constructed instance of hardened_hash
@@ -44,78 +45,86 @@
#endif
namespace beast {
namespace detail {
template <class Result>
class hardened_hash_base
using seed_pair = std::pair<std::uint64_t, std::uint64_t>;
template <bool = true>
seed_pair
get_seed_pair() noexcept
{
public:
typedef Result result_type;
struct state_t
{
std::mutex mutex;
std::random_device rng;
std::mt19937_64 gen {rng()};
std::uniform_int_distribution <std::uint64_t> dist;
private:
state_t() : gen(rng()) {}
// state_t(state_t const&) = delete;
// state_t& operator=(state_t const&) = delete;
};
static static_initializer <state_t> state;
std::lock_guard <std::mutex> lock (state->mutex);
return {state->dist(state->gen), state->dist(state->gen)};
}
template <class HashAlgorithm, bool ProcessSeeded>
class basic_hardened_hash;
/**
* Seed functor once per process
*/
template <class HashAlgorithm>
class basic_hardened_hash<HashAlgorithm, true>
{
static
seed_pair const&
init_seed_pair()
{
static static_initializer <seed_pair, basic_hardened_hash> const
p(get_seed_pair<>());
return *p;
}
public:
using result_type = typename HashAlgorithm::result_type;
template <class T>
result_type
next_seed() noexcept
operator()(T const& t) const noexcept
{
static std::mutex mutex;
static std::random_device rng;
static std::mt19937_64 gen (rng());
std::lock_guard <std::mutex> lock (mutex);
std::uniform_int_distribution <result_type> dist;
result_type value;
for(;;)
{
value = dist (gen);
// VFALCO Do we care if 0 is picked?
if (value != 0)
break;
}
return value;
std::uint64_t seed0;
std::uint64_t seed1;
std::tie(seed0, seed1) = init_seed_pair();
HashAlgorithm h(seed0, seed1);
hash_append(h, t);
return static_cast<result_type>(h);
}
#if BEAST_NO_HARDENED_HASH_INSTANCE_SEED
protected:
hardened_hash_base() noexcept = default;
hardened_hash_base(result_type) noexcept
{
}
result_type
seed() const noexcept
{
static result_type const value (next_seed());
return value;
}
#else
protected:
hardened_hash_base() noexcept
: m_seed (next_seed())
{
}
hardened_hash_base(result_type seed) noexcept
: m_seed (seed)
{
}
result_type
seed() const noexcept
{
return m_seed;
}
private:
// VFALCO Should seed be per process or per hash function?
result_type m_seed;
#endif
};
//------------------------------------------------------------------------------
/**
* Seed functor once per construction
*/
template <class HashAlgorithm>
class basic_hardened_hash<HashAlgorithm, false>
{
seed_pair m_seeds;
public:
using result_type = typename HashAlgorithm::result_type;
} // detail
basic_hardened_hash()
: m_seeds(get_seed_pair<>())
{}
template <class T>
result_type
operator()(T const& t) const noexcept
{
HashAlgorithm h(m_seeds.first, m_seeds.second);
hash_append(h, t);
return static_cast<result_type>(h);
}
};
//------------------------------------------------------------------------------
@@ -140,31 +149,18 @@ private:
}
@endcode
Do not use any version of Murmur or CityHash for the Hasher
template parameter (the hashing algorithm). For details
see https://131002.net/siphash/#at
*/
template <class T, class Hasher = detail::spooky_wrapper>
class hardened_hash
: public detail::hardened_hash_base <std::size_t>
{
typedef detail::hardened_hash_base <std::size_t> base;
public:
typedef T argument_type;
using detail::hardened_hash_base <std::size_t>::result_type;
public:
hardened_hash() = default;
explicit hardened_hash(result_type seed)
: base (seed)
{
}
result_type
operator() (argument_type const& key) const noexcept
{
Hasher h {base::seed()};
hash_append (h, key);
return static_cast<result_type> (h);
}
};
#if BEAST_NO_HARDENED_HASH_INSTANCE_SEED
template <class HashAlgorithm = siphash>
using hardened_hash = basic_hardened_hash<HashAlgorithm, true>;
#else
template <class HashAlgorithm = siphash>
using hardened_hash = basic_hardened_hash<HashAlgorithm, false>;
#endif
} // beast

View File

@@ -21,23 +21,23 @@
#ifndef BEAST_CONTAINER_HASH_APPEND_H_INCLUDED
#define BEAST_CONTAINER_HASH_APPEND_H_INCLUDED
#include "../utility/meta.h"
#include <beast/utility/meta.h>
#include "impl/spookyv2.h"
#include <beast/container/impl/spookyv2.h>
#if BEAST_USE_BOOST_FEATURES
#include <boost/shared_ptr.hpp>
#endif
#include "../utility/noexcept.h"
#include <beast/utility/noexcept.h>
#include <array>
#include <cstdint>
#include <functional>
#include <memory>
#include <string>
#include <tuple>
#include "../cxx14/type_traits.h" // <type_traits>
#include "../cxx14/utility.h" // <utility>
#include <beast/cxx14/type_traits.h> // <type_traits>
#include <beast/cxx14/utility.h> // <utility>
#include <vector>
// Set to 1 to disable variadic hash_append for tuple. When set, overloads
@@ -656,16 +656,38 @@ hash_append (Hasher& h, T0 const& t0, T1 const& t1, T const& ...t) noexcept
hash_append (h, t1, t...);
}
namespace detail
// See http://www.isthe.com/chongo/tech/comp/fnv/
class fnv1a
{
std::uint64_t state_ = 14695981039346656037ULL;
public:
class spooky_wrapper
using result_type = std::size_t;
void
append (void const* key, std::size_t len) noexcept
{
unsigned char const* p = static_cast<unsigned char const*>(key);
unsigned char const* const e = p + len;
for (; p < e; ++p)
state_ = (state_ ^ *p) * 1099511628211ULL;
}
explicit
operator std::size_t() noexcept
{
return static_cast<std::size_t>(state_);
}
};
// See http://burtleburtle.net/bob/hash/spooky.html
class spooky
{
SpookyHash state_;
public:
using result_type = std::size_t;
spooky_wrapper (std::size_t seed1 = 1, std::size_t seed2 = 2) noexcept
spooky (std::size_t seed1 = 1, std::size_t seed2 = 2) noexcept
{
state_.Init (seed1, seed2);
}
@@ -685,9 +707,30 @@ public:
}
};
} // detail
// See https://131002.net/siphash/
class siphash
{
std::uint64_t v0_ = 0x736f6d6570736575ULL;
std::uint64_t v1_ = 0x646f72616e646f6dULL;
std::uint64_t v2_ = 0x6c7967656e657261ULL;
std::uint64_t v3_ = 0x7465646279746573ULL;
unsigned char buf_[8];
unsigned bufsize_ = 0;
unsigned total_length_ = 0;
public:
using result_type = std::size_t;
template <class Hasher = detail::spooky_wrapper>
siphash() = default;
explicit siphash(std::uint64_t k0, std::uint64_t k1 = 0) noexcept;
void
append (void const* key, std::size_t len) noexcept;
explicit
operator std::size_t() noexcept;
};
template <class Hasher = spooky>
struct uhash
{
using result_type = typename Hasher::result_type;
@@ -702,15 +745,6 @@ struct uhash
}
};
struct call_hash_value
{
template <class T>
std::size_t
operator()(T const& t) const noexcept
{
return hash_value(t);
}
};
} // beast

View File

@@ -0,0 +1,166 @@
//------------------------------- siphash.h ------------------------------------
//
// This software is in the public domain. The only restriction on its use is
// that no one can remove it from the public domain by claiming ownership of it,
// including the original authors.
//
// There is no warranty of correctness on the software contained herein. Use
// at your own risk.
//
// Derived from:
//
// SipHash reference C implementation
//
// Written in 2012 by Jean-Philippe Aumasson <jeanphilippe.aumasson@gmail.com>
// Daniel J. Bernstein <djb@cr.yp.to>
//
// To the extent possible under law, the author(s) have dedicated all copyright
// and related and neighboring rights to this software to the public domain
// worldwide. This software is distributed without any warranty.
//
// You should have received a copy of the CC0 Public Domain Dedication along
// with this software. If not, see
// <http://creativecommons.org/publicdomain/zero/1.0/>.
//
//------------------------------------------------------------------------------
#include <beast/container/hash_append.h>
#include <algorithm>
#include <cstddef>
#include <cstdint>
// namespace acme is used to demonstrate example code. It is not proposed.
namespace beast
{
namespace
{
typedef std::uint64_t u64;
typedef std::uint32_t u32;
typedef std::uint8_t u8;
inline
u64
rotl(u64 x, u64 b)
{
return (x << b) | (x >> (64 - b));
}
inline
u64
u8to64_le(const u8* p)
{
#if BEAST_LITTLE_ENDIAN
return *static_cast<u64 const*>(static_cast<void const*>(p));
#else
return static_cast<u64>(p[7]) << 56 | static_cast<u64>(p[6]) << 48 |
static_cast<u64>(p[5]) << 40 | static_cast<u64>(p[4]) << 32 |
static_cast<u64>(p[3]) << 24 | static_cast<u64>(p[2]) << 16 |
static_cast<u64>(p[1]) << 8 | static_cast<u64>(p[0]);
#endif
}
inline
void
sipround(u64& v0, u64& v1, u64& v2, u64& v3)
{
v0 += v1;
v1 = rotl(v1, 13);
v1 ^= v0;
v0 = rotl(v0, 32);
v2 += v3;
v3 = rotl(v3, 16);
v3 ^= v2;
v0 += v3;
v3 = rotl(v3, 21);
v3 ^= v0;
v2 += v1;
v1 = rotl(v1, 17);
v1 ^= v2;
v2 = rotl(v2, 32);
}
} // unnamed
siphash::siphash(std::uint64_t k0, std::uint64_t k1) noexcept
{
v3_ ^= k1;
v2_ ^= k0;
v1_ ^= k1;
v0_ ^= k0;
}
void
siphash::append (void const* key, std::size_t inlen) noexcept
{
u8 const* in = static_cast<const u8*>(key);
total_length_ += inlen;
if (bufsize_ + inlen < 8)
{
std::copy(in, in+inlen, buf_ + bufsize_);
bufsize_ += inlen;
return;
}
if (bufsize_ > 0)
{
auto t = 8 - bufsize_;
std::copy(in, in+t, buf_ + bufsize_);
u64 m = u8to64_le( buf_ );
v3_ ^= m;
sipround(v0_, v1_, v2_, v3_);
sipround(v0_, v1_, v2_, v3_);
v0_ ^= m;
in += t;
inlen -= t;
}
bufsize_ = inlen & 7;
u8 const* const end = in + (inlen - bufsize_);
for ( ; in != end; in += 8 )
{
u64 m = u8to64_le( in );
v3_ ^= m;
sipround(v0_, v1_, v2_, v3_);
sipround(v0_, v1_, v2_, v3_);
v0_ ^= m;
}
std::copy(end, end + bufsize_, buf_);
}
siphash::operator std::size_t() noexcept
{
std::size_t b = static_cast<u64>(total_length_) << 56;
switch(bufsize_)
{
case 7:
b |= static_cast<u64>(buf_[6]) << 48;
case 6:
b |= static_cast<u64>(buf_[5]) << 40;
case 5:
b |= static_cast<u64>(buf_[4]) << 32;
case 4:
b |= static_cast<u64>(buf_[3]) << 24;
case 3:
b |= static_cast<u64>(buf_[2]) << 16;
case 2:
b |= static_cast<u64>(buf_[1]) << 8;
case 1:
b |= static_cast<u64>(buf_[0]);
case 0:
break;
}
v3_ ^= b;
sipround(v0_, v1_, v2_, v3_);
sipround(v0_, v1_, v2_, v3_);
v0_ ^= b;
v2_ ^= 0xff;
sipround(v0_, v1_, v2_, v3_);
sipround(v0_, v1_, v2_, v3_);
sipround(v0_, v1_, v2_, v3_);
sipround(v0_, v1_, v2_, v3_);
b = v0_ ^ v1_ ^ v2_ ^ v3_;
return b;
}
} // beast

View File

@@ -10,7 +10,7 @@
// August 5 2012: SpookyV2: d = should be d += in short hash, and remove extra mix from long hash
#include <memory.h>
#include "spookyv2.h"
#include <beast/container/impl/spookyv2.h>
#ifdef _MSC_VER
#pragma warning (push)

View File

@@ -38,7 +38,7 @@
typedef unsigned __int16 uint16;
typedef unsigned __int8 uint8;
#else
# include <stdint.h>
#include <stdint.h>
# define INLINE inline
typedef uint64_t uint64;
typedef uint32_t uint32;

View File

@@ -17,17 +17,17 @@
*/
//==============================================================================
#include "../../chrono/manual_clock.h"
#include "../../unit_test/suite.h"
#include <beast/chrono/manual_clock.h>
#include <beast/unit_test/suite.h>
#include "../aged_set.h"
#include "../aged_map.h"
#include "../aged_multiset.h"
#include "../aged_multimap.h"
#include "../aged_unordered_set.h"
#include "../aged_unordered_map.h"
#include "../aged_unordered_multiset.h"
#include "../aged_unordered_multimap.h"
#include <beast/container/aged_set.h>
#include <beast/container/aged_map.h>
#include <beast/container/aged_multiset.h>
#include <beast/container/aged_multimap.h>
#include <beast/container/aged_unordered_set.h>
#include <beast/container/aged_unordered_map.h>
#include <beast/container/aged_unordered_multiset.h>
#include <beast/container/aged_unordered_multimap.h>
#include <vector>
#include <list>
@@ -147,7 +147,7 @@ public:
return static_cast <T*> (
::operator new (n * sizeof(T)));
}
void deallocate (T* p, std::size_t)
{
::operator delete (p);
@@ -482,6 +482,23 @@ public:
//--------------------------------------------------------------------------
template <bool IsUnordered, bool IsMulti, bool IsMap>
void
testIterator ();
// Unordered containers don't have reverse iterators
template <bool IsUnordered, bool IsMulti, bool IsMap>
typename std::enable_if <! IsUnordered>::type
testReverseIterator();
template <bool IsUnordered, bool IsMulti, bool IsMap>
typename std::enable_if <IsUnordered>::type
testReverseIterator()
{
}
//--------------------------------------------------------------------------
template <class Container, class Values>
void checkInsertCopy (Container& c, Values const& v);
@@ -524,6 +541,31 @@ public:
//--------------------------------------------------------------------------
// Helpers for erase tests
template <class Container, class Values>
void reverseFillAgedContainer(Container& c, Values const& v);
template <class Iter>
Iter nextToEndIter (Iter const beginIter, Iter const endItr);
//--------------------------------------------------------------------------
template <class Container, class Iter>
bool doElementErase (Container& c, Iter const beginItr, Iter const endItr);
template <bool IsUnordered, bool IsMulti, bool IsMap>
void testElementErase();
//--------------------------------------------------------------------------
template <class Container, class BeginEndSrc>
void doRangeErase (Container& c, BeginEndSrc const& beginEndSrc);
template <bool IsUnordered, bool IsMulti, bool IsMap>
void testRangeErase();
//--------------------------------------------------------------------------
// ordered
template <bool IsUnordered, bool IsMulti, bool IsMap>
typename std::enable_if <! IsUnordered>::type
@@ -1083,6 +1125,163 @@ testCopyMove ()
}
}
//------------------------------------------------------------------------------
//
// Iterator construction and assignment
//
//------------------------------------------------------------------------------
template <bool IsUnordered, bool IsMulti, bool IsMap>
void
aged_associative_container_test_base::
testIterator()
{
typedef TestTraits <IsUnordered, IsMulti, IsMap> Traits;
typedef typename Traits::Value Value;
typedef typename Traits::Alloc Alloc;
typename Traits::Clock clock;
auto const v (Traits::values());
//testcase (Traits::name() + " iterators");
testcase ("iterator");
typename Traits::template Cont <> c {clock};
using iterator = decltype (c.begin());
using const_iterator = decltype (c.cbegin());
// Should be able to construct or assign an iterator from an iterator.
iterator nnIt_0 {c.begin()};
iterator nnIt_1 {nnIt_0};
expect (nnIt_0 == nnIt_1, "iterator constructor failed");
iterator nnIt_2;
nnIt_2 = nnIt_1;
expect (nnIt_1 == nnIt_2, "iterator assignment failed");
// Should be able to construct or assign a const_iterator from a
// const_iterator.
const_iterator ccIt_0 {c.cbegin()};
const_iterator ccIt_1 {ccIt_0};
expect (ccIt_0 == ccIt_1, "const_iterator constructor failed");
const_iterator ccIt_2;
ccIt_2 = ccIt_1;
expect (ccIt_1 == ccIt_2, "const_iterator assignment failed");
// Comparison between iterator and const_iterator is okay
expect (nnIt_0 == ccIt_0,
"Comparing an iterator to a const_iterator failed");
expect (ccIt_1 == nnIt_1,
"Comparing a const_iterator to an iterator failed");
// Should be able to construct a const_iterator from an iterator.
const_iterator ncIt_3 {c.begin()};
const_iterator ncIt_4 {nnIt_0};
expect (ncIt_3 == ncIt_4,
"const_iterator construction from iterator failed");
const_iterator ncIt_5;
ncIt_5 = nnIt_2;
expect (ncIt_5 == ncIt_4,
"const_iterator assignment from iterator failed");
// None of these should compile because they construct or assign to a
// non-const iterator with a const_iterator.
// iterator cnIt_0 {c.cbegin()};
// iterator cnIt_1 {ccIt_0};
// iterator cnIt_2;
// cnIt_2 = ccIt_2;
}
template <bool IsUnordered, bool IsMulti, bool IsMap>
typename std::enable_if <! IsUnordered>::type
aged_associative_container_test_base::
testReverseIterator()
{
typedef TestTraits <IsUnordered, IsMulti, IsMap> Traits;
typedef typename Traits::Value Value;
typedef typename Traits::Alloc Alloc;
typename Traits::Clock clock;
auto const v (Traits::values());
//testcase (Traits::name() + " reverse_iterators");
testcase ("reverse_iterator");
typename Traits::template Cont <> c {clock};
using iterator = decltype (c.begin());
using const_iterator = decltype (c.cbegin());
using reverse_iterator = decltype (c.rbegin());
using const_reverse_iterator = decltype (c.crbegin());
// Naming decoder ring
// constructed from ------+ +----- constructed type
// /\/\ -- character pairs
// xAyBit
// r (reverse) or f (forward)--^-^
// ^-^------ C (const) or N (non-const)
// Should be able to construct or assign a reverse_iterator from a
// reverse_iterator.
reverse_iterator rNrNit_0 {c.rbegin()};
reverse_iterator rNrNit_1 {rNrNit_0};
expect (rNrNit_0 == rNrNit_1, "reverse_iterator constructor failed");
reverse_iterator xXrNit_2;
xXrNit_2 = rNrNit_1;
expect (rNrNit_1 == xXrNit_2, "reverse_iterator assignment failed");
// Should be able to construct or assign a const_reverse_iterator from a
// const_reverse_iterator
const_reverse_iterator rCrCit_0 {c.crbegin()};
const_reverse_iterator rCrCit_1 {rCrCit_0};
expect (rCrCit_0 == rCrCit_1, "reverse_iterator constructor failed");
const_reverse_iterator xXrCit_2;
xXrCit_2 = rCrCit_1;
expect (rCrCit_1 == xXrCit_2, "reverse_iterator assignment failed");
// Comparison between reverse_iterator and const_reverse_iterator is okay
expect (rNrNit_0 == rCrCit_0,
"Comparing an iterator to a const_iterator failed");
expect (rCrCit_1 == rNrNit_1,
"Comparing a const_iterator to an iterator failed");
// Should be able to construct or assign a const_reverse_iterator from a
// reverse_iterator
const_reverse_iterator rNrCit_0 {c.rbegin()};
const_reverse_iterator rNrCit_1 {rNrNit_0};
expect (rNrCit_0 == rNrCit_1,
"const_reverse_iterator construction from reverse_iterator failed");
xXrCit_2 = rNrNit_1;
expect (rNrCit_1 == xXrCit_2,
"const_reverse_iterator assignment from reverse_iterator failed");
// The standard allows these conversions:
// o reverse_iterator is explicitly constructible from iterator.
// o const_reverse_iterator is explicitly constructible from const_iterator.
// Should be able to construct or assign reverse_iterators from
// non-reverse iterators.
reverse_iterator fNrNit_0 {c.begin()};
const_reverse_iterator fNrCit_0 {c.begin()};
expect (fNrNit_0 == fNrCit_0,
"reverse_iterator construction from iterator failed");
const_reverse_iterator fCrCit_0 {c.cbegin()};
expect (fNrCit_0 == fCrCit_0,
"const_reverse_iterator construction from const_iterator failed");
// None of these should compile because they construct a non-reverse
// iterator from a reverse_iterator.
// iterator rNfNit_0 {c.rbegin()};
// const_iterator rNfCit_0 {c.rbegin()};
// const_iterator rCfCit_0 {c.crbegin()};
// You should not be able to assign an iterator to a reverse_iterator or
// vise-versa. So the following lines should not compile.
iterator xXfNit_0;
// xXfNit_0 = xXrNit_2;
// xXrNit_2 = xXfNit_0;
}
//------------------------------------------------------------------------------
//
// Modifiers
@@ -1232,9 +1431,12 @@ testChronological ()
c.chronological.cbegin(), c.chronological.cend(),
v.begin(), v.end(), equal_value <Traits> ()));
for (auto iter (v.rbegin()); iter != v.rend(); ++iter)
// Test touch() with a non-const iterator.
for (auto iter (v.crbegin()); iter != v.crend(); ++iter)
{
auto found (c.find (Traits::extract (*iter)));
using iterator = typename decltype (c)::iterator;
iterator found (c.find (Traits::extract (*iter)));
expect (found != c.cend());
if (found == c.cend())
return;
@@ -1243,7 +1445,30 @@ testChronological ()
expect (std::equal (
c.chronological.cbegin(), c.chronological.cend(),
v.rbegin(), v.rend(), equal_value <Traits> ()));
v.crbegin(), v.crend(), equal_value <Traits> ()));
// Test touch() with a const_iterator
for (auto iter (v.cbegin()); iter != v.cend(); ++iter)
{
using const_iterator = typename decltype (c)::const_iterator;
const_iterator found (c.find (Traits::extract (*iter)));
expect (found != c.cend());
if (found == c.cend())
return;
c.touch (found);
}
expect (std::equal (
c.chronological.cbegin(), c.chronological.cend(),
v.cbegin(), v.cend(), equal_value <Traits> ()));
{
// Because touch (reverse_iterator pos) is not allowed, the following
// lines should not compile for any aged_container type.
// c.touch (c.rbegin());
// c.touch (c.crbegin());
}
}
//------------------------------------------------------------------------------
@@ -1282,6 +1507,270 @@ testArrayCreate()
}
}
//------------------------------------------------------------------------------
//
// Helpers for erase tests
//
//------------------------------------------------------------------------------
template <class Container, class Values>
void
aged_associative_container_test_base::
reverseFillAgedContainer (Container& c, Values const& values)
{
// Just in case the passed in container was not empty.
c.clear();
// c.clock() returns an abstract_clock, so dynamic_cast to manual_clock.
typedef TestTraitsBase::Clock Clock;
Clock& clk (dynamic_cast <Clock&> (c.clock ()));
clk.set (0);
Values rev (values);
std::sort (rev.begin (), rev.end ());
std::reverse (rev.begin (), rev.end ());
for (auto& v : rev)
{
// Add values in reverse order so they are reversed chronologically.
++clk;
c.insert (v);
}
}
// Get one iterator before endIter. We have to use operator++ because you
// cannot use operator-- with unordered container iterators.
template <class Iter>
Iter
aged_associative_container_test_base::
nextToEndIter (Iter beginIter, Iter const endIter)
{
if (beginIter == endIter)
{
fail ("Internal test failure. Cannot advance beginIter");
return beginIter;
}
//
Iter nextToEnd = beginIter;
do
{
nextToEnd = beginIter++;
} while (beginIter != endIter);
return nextToEnd;
}
// Implementation for the element erase tests
//
// This test accepts:
// o the container from which we will erase elements
// o iterators into that container defining the range of the erase
//
// This implementation does not declare a pass, since it wants to allow
// the caller to examine the size of the container and the returned iterator
//
// Note that this test works on the aged_associative containers because an
// erase only invalidates references and iterators to the erased element
// (see 23.2.4/13). Therefore the passed-in end iterator stays valid through
// the whole test.
template <class Container, class Iter>
bool aged_associative_container_test_base::
doElementErase (Container& c, Iter const beginItr, Iter const endItr)
{
auto it (beginItr);
size_t count = c.size();
while (it != endItr)
{
auto expectIt = it;
++expectIt;
it = c.erase (it);
if (it != expectIt)
{
fail ("Unexpected returned iterator from element erase");
return false;
}
--count;
if (count != c.size())
{
fail ("Failed to erase element");
return false;
}
if (c.empty ())
{
if (it != endItr)
{
fail ("Erase of last element didn't produce end");
return false;
}
}
}
return true;
}
//------------------------------------------------------------------------------
//
// Erase of individual elements
//
//------------------------------------------------------------------------------
template <bool IsUnordered, bool IsMulti, bool IsMap>
void
aged_associative_container_test_base::
testElementErase ()
{
typedef TestTraits <IsUnordered, IsMulti, IsMap> Traits;
//testcase (Traits::name() + " element erase"
testcase ("element erase");
// Make and fill the container
typename Traits::Clock ck;
typename Traits::template Cont <> c {ck};
reverseFillAgedContainer (c, Traits::values());
{
// Test standard iterators
auto tempContainer (c);
if (! doElementErase (tempContainer,
tempContainer.cbegin(), tempContainer.cend()))
return; // Test failed
expect (tempContainer.empty(), "Failed to erase all elements");
pass();
}
{
// Test chronological iterators
auto tempContainer (c);
auto& chron (tempContainer.chronological);
if (! doElementErase (tempContainer, chron.begin(), chron.end()))
return; // Test failed
expect (tempContainer.empty(),
"Failed to chronologically erase all elements");
pass();
}
{
// Test standard iterator partial erase
auto tempContainer (c);
expect (tempContainer.size() > 2,
"Internal failure. Container too small.");
if (! doElementErase (tempContainer, ++tempContainer.begin(),
nextToEndIter (tempContainer.begin(), tempContainer.end())))
return; // Test failed
expect (tempContainer.size() == 2,
"Failed to erase expected number of elements");
pass();
}
{
// Test chronological iterator partial erase
auto tempContainer (c);
expect (tempContainer.size() > 2,
"Internal failure. Container too small.");
auto& chron (tempContainer.chronological);
if (! doElementErase (tempContainer, ++chron.begin(),
nextToEndIter (chron.begin(), chron.end())))
return; // Test failed
expect (tempContainer.size() == 2,
"Failed to chronologically erase expected number of elements");
pass();
}
{
auto tempContainer (c);
expect (tempContainer.size() > 4,
"Internal failure. Container too small.");
// erase(reverse_iterator) is not allowed. None of the following
// should compile for any aged_container type.
// c.erase (c.rbegin());
// c.erase (c.crbegin());
// c.erase(c.rbegin(), ++c.rbegin());
// c.erase(c.crbegin(), ++c.crbegin());
}
}
// Implementation for the range erase tests
//
// This test accepts:
//
// o A container with more than 2 elements and
// o An object to ask for begin() and end() iterators in the passed container
//
// This peculiar interface allows either the container itself to be passed as
// the second argument or the container's "chronological" element. Both
// sources of iterators need to be tested on the container.
//
// The test locates iterators such that a range-based delete leaves the first
// and last elements in the container. It then validates that the container
// ended up with the expected contents.
//
template <class Container, class BeginEndSrc>
void
aged_associative_container_test_base::
doRangeErase (Container& c, BeginEndSrc const& beginEndSrc)
{
expect (c.size () > 2,
"Internal test failure. Container must have more than 2 elements");
auto itBeginPlusOne (beginEndSrc.begin ());
auto const valueFront = *itBeginPlusOne;
++itBeginPlusOne;
// Get one iterator before end()
auto itBack (nextToEndIter (itBeginPlusOne, beginEndSrc.end ()));
auto const valueBack = *itBack;
// Erase all elements but first and last
auto const retIter = c.erase (itBeginPlusOne, itBack);
expect (c.size() == 2,
"Unexpected size for range-erased container");
expect (valueFront == *(beginEndSrc.begin()),
"Unexpected first element in range-erased container");
expect (valueBack == *(++beginEndSrc.begin()),
"Unexpected last element in range-erased container");
expect (retIter == (++beginEndSrc.begin()),
"Unexpected return iterator from erase");
pass ();
}
//------------------------------------------------------------------------------
//
// Erase range of elements
//
//------------------------------------------------------------------------------
template <bool IsUnordered, bool IsMulti, bool IsMap>
void
aged_associative_container_test_base::
testRangeErase ()
{
typedef TestTraits <IsUnordered, IsMulti, IsMap> Traits;
//testcase (Traits::name() + " element erase"
testcase ("range erase");
// Make and fill the container
typename Traits::Clock ck;
typename Traits::template Cont <> c {ck};
reverseFillAgedContainer (c, Traits::values());
// Not bothering to test range erase with reverse iterators.
{
auto tempContainer (c);
doRangeErase (tempContainer, tempContainer);
}
{
auto tempContainer (c);
doRangeErase (tempContainer, tempContainer.chronological);
}
}
//------------------------------------------------------------------------------
//
// Container-wide comparison
@@ -1378,9 +1867,13 @@ testMaybeUnorderedMultiMap ()
testConstructRange <IsUnordered, IsMulti, IsMap> ();
testConstructInitList <IsUnordered, IsMulti, IsMap> ();
testCopyMove <IsUnordered, IsMulti, IsMap> ();
testIterator <IsUnordered, IsMulti, IsMap> ();
testReverseIterator <IsUnordered, IsMulti, IsMap> ();
testModifiers <IsUnordered, IsMulti, IsMap> ();
testChronological <IsUnordered, IsMulti, IsMap> ();
testArrayCreate <IsUnordered, IsMulti, IsMap> ();
testElementErase <IsUnordered, IsMulti, IsMap> ();
testRangeErase <IsUnordered, IsMulti, IsMap> ();
testCompare <IsUnordered, IsMulti, IsMap> ();
testObservers <IsUnordered, IsMulti, IsMap> ();
}
@@ -1514,4 +2007,4 @@ BEAST_DEFINE_TESTSUITE(aged_unordered_map,container,beast);
BEAST_DEFINE_TESTSUITE(aged_unordered_multiset,container,beast);
BEAST_DEFINE_TESTSUITE(aged_unordered_multimap,container,beast);
}
} // namespace beast

View File

@@ -17,11 +17,11 @@
*/
//==============================================================================
#include "../../unit_test/suite.h"
#include <beast/unit_test/suite.h>
#include "../buffer_view.h"
#include <beast/container/buffer_view.h>
#include "../../cxx14/algorithm.h" // <algorithm>
#include <beast/cxx14/algorithm.h> // <algorithm>
namespace beast {

View File

@@ -20,13 +20,13 @@
// MODULES: ../../crypto/impl/Sha256.cpp ../../container/impl/spookyv2.cpp
#if BEAST_INCLUDE_BEASTCONFIG
#include "../../../BeastConfig.h"
#include <BeastConfig.h>
#endif
#include "../hardened_hash.h"
#include "../../unit_test/suite.h"
#include <beast/container/hardened_hash.h>
#include <beast/unit_test/suite.h>
#include "../../crypto/Sha256.h"
#include <beast/crypto/Sha256.h>
#include <boost/functional/hash.hpp>
#include <array>
@@ -90,19 +90,19 @@ namespace detail {
template <class T>
using test_hardened_unordered_set =
std::unordered_set <T, hardened_hash <T>>;
std::unordered_set <T, hardened_hash <>>;
template <class T>
using test_hardened_unordered_map =
std::unordered_map <T, int, hardened_hash <T>>;
std::unordered_map <T, int, hardened_hash <>>;
template <class T>
using test_hardened_unordered_multiset =
std::unordered_multiset <T, hardened_hash <T>>;
std::unordered_multiset <T, hardened_hash <>>;
template <class T>
using test_hardened_unordered_multimap =
std::unordered_multimap <T, int, hardened_hash <T>>;
std::unordered_multimap <T, int, hardened_hash <>>;
} // beast
@@ -196,7 +196,7 @@ public:
check ()
{
T t{};
hardened_hash <T>() (t);
hardened_hash <>() (t);
pass();
}
@@ -280,7 +280,7 @@ public:
log <<
"sizeof(std::size_t) == " << sizeof(std::size_t);
hardened_hash <sha256_t> h;
hardened_hash <> h;
for (int i = 0; i < 100; ++i)
{
sha256_t v (sha256_t::from_number (i));

View File

@@ -20,17 +20,17 @@
// MODULES: ../impl/spookyv2.cpp
#if BEAST_INCLUDE_BEASTCONFIG
#include "../../../BeastConfig.h"
#include <BeastConfig.h>
#endif
#include "hash_metrics.h"
#include <beast/container/tests/hash_metrics.h>
#include "../hash_append.h"
#include "../impl/spookyv2.h"
#include <beast/container/hash_append.h>
#include <beast/container/impl/spookyv2.h>
#include "../../chrono/chrono_io.h"
#include "../../unit_test/suite.h"
#include "../../utility/type_name.h"
#include <beast/chrono/chrono_io.h>
#include <beast/unit_test/suite.h>
#include <beast/utility/type_name.h>
#include <array>
#include <algorithm>

View File

@@ -157,7 +157,7 @@ window (T* blob, int start, int count )
/** Calculated a windowed metric using bins.
TODO Need reference (SMHasher?)
*/
*/
template <class FwdIter>
double
windowed_score (FwdIter first, FwdIter last)
@@ -169,8 +169,6 @@ windowed_score (FwdIter first, FwdIter last)
while (static_cast<double>(size) / (1 << maxwidth) < 5.0)
maxwidth--;
double worst = 0;
int worstStart = -1;
int worstWidth = -1;
std::vector <int> bins (1 << maxwidth);
int const hashbits = sizeof(std::size_t) * CHAR_BIT;
for (int start = 0; start < hashbits; ++start)
@@ -185,12 +183,7 @@ windowed_score (FwdIter first, FwdIter last)
{
double score (detail::score (
bins.data(), bins.size(), size));
if (score > worst)
{
worst = score;
worstStart = start;
worstWidth = width;
}
worst = std::max(score, worst);
if (--width < 8)
break;
for (std::size_t i = 0, j = bins.size() / 2; j < bins.size(); ++i, ++j)

View File

@@ -18,12 +18,13 @@
//==============================================================================
#if BEAST_INCLUDE_BEASTCONFIG
#include "../../BeastConfig.h"
#include <BeastConfig.h>
#endif
#include "impl/spookyv2.cpp"
#include <beast/crypto/impl/MurmurHash.cpp>
#include <beast/crypto/impl/Sha256.cpp>
#include <beast/crypto/impl/UnsignedInteger.cpp>
#include "tests/aged_associative_container.test.cpp"
#include "tests/buffer_view.test.cpp"
#include "tests/hardened_hash.test.cpp"
#include "tests/hash_append.test.cpp"
#include <beast/crypto/tests/BinaryEncoding.cpp>
#include <beast/crypto/tests/UnsignedInteger.test.cpp>

View File

@@ -20,7 +20,7 @@
#ifndef BEAST_CRYPTO_SHA256_H_INCLUDED
#define BEAST_CRYPTO_SHA256_H_INCLUDED
#include "../Config.h"
#include <beast/Config.h>
#include <array>
#include <cstdint>

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