rippled
OrderBook.h
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 #ifndef RIPPLE_APP_MISC_ORDERBOOK_H_INCLUDED
21 #define RIPPLE_APP_MISC_ORDERBOOK_H_INCLUDED
22 
23 namespace ripple {
24 
26 class OrderBook
27 {
28 public:
32 
38  // VFALCO NOTE what is the meaning of the index parameter?
39  OrderBook(uint256 const& base, Book const& book)
40  : mBookBase(base), mBook(book)
41  {
42  }
43 
44  uint256 const&
45  getBookBase() const
46  {
47  return mBookBase;
48  }
49 
50  Book const&
51  book() const
52  {
53  return mBook;
54  }
55 
56  Currency const&
57  getCurrencyIn() const
58  {
59  return mBook.in.currency;
60  }
61 
62  Currency const&
64  {
65  return mBook.out.currency;
66  }
67 
68  AccountID const&
69  getIssuerIn() const
70  {
71  return mBook.in.account;
72  }
73 
74  AccountID const&
75  getIssuerOut() const
76  {
77  return mBook.out.account;
78  }
79 
80 private:
82  Book const mBook;
83 };
84 
85 } // namespace ripple
86 
87 #endif
ripple::OrderBook::getCurrencyOut
Currency const & getCurrencyOut() const
Definition: OrderBook.h:63
std::shared_ptr
STL class.
ripple::Book::out
Issue out
Definition: Book.h:36
std::vector
STL class.
ripple::OrderBook::getCurrencyIn
Currency const & getCurrencyIn() const
Definition: OrderBook.h:57
ripple::Issue::currency
Currency currency
Definition: Issue.h:37
ripple::OrderBook::mBookBase
const uint256 mBookBase
Definition: OrderBook.h:81
ripple::OrderBook::book
Book const & book() const
Definition: OrderBook.h:51
ripple::base_uint< 256 >
ripple::OrderBook::OrderBook
OrderBook(uint256 const &base, Book const &book)
Construct from a currency specification.
Definition: OrderBook.h:39
ripple::OrderBook::getIssuerOut
AccountID const & getIssuerOut() const
Definition: OrderBook.h:75
ripple::OrderBook::getBookBase
uint256 const & getBookBase() const
Definition: OrderBook.h:45
ripple::OrderBook
Describes a serialized ledger entry for an order book.
Definition: OrderBook.h:26
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::OrderBook::getIssuerIn
AccountID const & getIssuerIn() const
Definition: OrderBook.h:69
ripple::Book
Specifies an order book.
Definition: Book.h:32
ripple::OrderBook::mBook
const Book mBook
Definition: OrderBook.h:82
ripple::Book::in
Issue in
Definition: Book.h:35
ripple::Issue::account
AccountID account
Definition: Issue.h:38