rippled
owners.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_TEST_JTX_OWNERS_H_INCLUDED
21 #define RIPPLE_TEST_JTX_OWNERS_H_INCLUDED
22 
23 #include <ripple/ledger/View.h>
24 #include <ripple/protocol/LedgerFormats.h>
25 #include <ripple/protocol/UintTypes.h>
26 #include <cstdint>
27 #include <test/jtx/Env.h>
28 
29 namespace ripple {
30 namespace test {
31 namespace jtx {
32 
33 namespace detail {
34 
36 owned_count_of(ReadView const& view, AccountID const& id, LedgerEntryType type);
37 
38 void
40  Env& env,
41  AccountID const& id,
42  LedgerEntryType type,
43  std::uint32_t value);
44 
45 } // namespace detail
46 
47 // Helper for aliases
48 template <LedgerEntryType Type>
50 {
51 private:
54 
55 public:
56  owner_count(Account const& account, std::uint32_t value)
57  : account_(account), value_(value)
58  {
59  }
60 
61  void
62  operator()(Env& env) const
63  {
65  }
66 };
67 
69 class owners
70 {
71 private:
74 
75 public:
76  owners(Account const& account, std::uint32_t value)
77  : account_(account), value_(value)
78  {
79  }
80 
81  void
82  operator()(Env& env) const;
83 };
84 
87 
90 
91 } // namespace jtx
92 } // namespace test
93 } // namespace ripple
94 
95 #endif
ripple::test::jtx::detail::owned_count_of
std::uint32_t owned_count_of(ReadView const &view, AccountID const &id, LedgerEntryType type)
Definition: owners.cpp:29
ripple::test::jtx::owners
Match the number of items in the account's owner directory.
Definition: owners.h:69
ripple::test::jtx::owners::account_
Account account_
Definition: owners.h:72
ripple::test::jtx::owner_count::operator()
void operator()(Env &env) const
Definition: owners.h:62
ripple::test::jtx::owner_count::value_
std::uint32_t value_
Definition: owners.h:53
ripple::test::jtx::detail::owned_count_helper
void owned_count_helper(Env &env, AccountID const &id, LedgerEntryType type, std::uint32_t value)
Definition: owners.cpp:41
ripple::test::jtx::owner_count::owner_count
owner_count(Account const &account, std::uint32_t value)
Definition: owners.h:56
ripple::test::jtx::Account::id
AccountID id() const
Returns the Account ID.
Definition: Account.h:106
cstdint
std::uint32_t
ripple::test::jtx::owner_count::account_
Account account_
Definition: owners.h:52
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::LedgerEntryType
LedgerEntryType
Identifiers for on-ledger objects.
Definition: LedgerFormats.h:53
ripple::test::jtx::Account
Immutable cryptographic account descriptor.
Definition: Account.h:37
ripple::test::jtx::owners::operator()
void operator()(Env &env) const
Definition: owners.cpp:53
ripple::test::jtx::owners::value_
std::uint32_t value_
Definition: owners.h:73
ripple::test::jtx::owners::owners
owners(Account const &account, std::uint32_t value)
Definition: owners.h:76
ripple::test::jtx::Env
A transaction testing environment.
Definition: Env.h:116
ripple::test::jtx::owner_count
Definition: owners.h:49