rippled
Book.cpp
1 //------------------------------------------------------------------------------
2 /*
3  This file is part of rippled: https://github.com/ripple/rippled
4  Copyright (c) 2012, 2013 Ripple Labs Inc.
5 
6  Permission to use, copy, modify, and/or distribute this software for any
7  purpose with or without fee is hereby granted, provided that the above
8  copyright notice and this permission notice appear in all copies.
9 
10  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18 //==============================================================================
19 
20 #include <ripple/protocol/Book.h>
21 
22 namespace ripple {
23 
24 bool
25 isConsistent(Book const& book)
26 {
27  return isConsistent(book.in) && isConsistent(book.out) &&
28  book.in != book.out;
29 }
30 
32 to_string(Book const& book)
33 {
34  return to_string(book.in) + "->" + to_string(book.out);
35 }
36 
39 {
40  os << to_string(x);
41  return os;
42 }
43 
44 Book
45 reversed(Book const& book)
46 {
47  return Book(book.out, book.in);
48 }
49 
50 } // namespace ripple
std::string
STL class.
ripple::isConsistent
bool isConsistent(Book const &book)
Definition: Book.cpp:25
ripple::Book::out
Issue out
Definition: Book.h:37
ripple::operator<<
std::ostream & operator<<(std::ostream &os, TOffer< TIn, TOut > const &offer)
Definition: Offer.h:242
std::ostream
STL class.
ripple::reversed
Book reversed(Book const &book)
Definition: Book.cpp:45
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::to_string
std::string to_string(Manifest const &m)
Format the specified manifest to a string for debugging purposes.
Definition: app/misc/impl/Manifest.cpp:41
ripple::Book
Specifies an order book.
Definition: Book.h:33
ripple::Book::in
Issue in
Definition: Book.h:36