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 <test/jtx/Env.h>
24 #include <ripple/ledger/View.h>
25 #include <ripple/protocol/LedgerFormats.h>
26 #include <ripple/protocol/UintTypes.h>
27 #include <cstdint>
28 
29 namespace ripple {
30 namespace test {
31 namespace jtx {
32 
33 namespace detail {
34 
36 owned_count_of (ReadView const& view,
37  AccountID const& id,
38  LedgerEntryType type);
39 
40 void
41 owned_count_helper(Env& env,
42  AccountID const& id,
43  LedgerEntryType type,
44  std::uint32_t value);
45 
46 } // detail
47 
48 // Helper for aliases
49 template <LedgerEntryType Type>
51 {
52 private:
55 
56 public:
57  owner_count (Account const& account,
58  std::uint32_t value)
59  : account_(account)
60  , value_(value)
61  {
62  }
63 
64  void
65  operator()(Env& env) const
66  {
68  env, account_.id(), Type, value_);
69  }
70 };
71 
73 class owners
74 {
75 private:
78 public:
79  owners (Account const& account,
80  std::uint32_t value)
81  : account_(account)
82  , value_(value)
83  {
84  }
85 
86  void
87  operator()(Env& env) const;
88 };
89 
92 
95 
96 } // jtx
97 } // test
98 } // ripple
99 
100 #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:73
ripple::test::jtx::owners::account_
Account account_
Definition: owners.h:76
ripple::test::jtx::owner_count::operator()
void operator()(Env &env) const
Definition: owners.h:65
ripple::test::jtx::owner_count::value_
std::uint32_t value_
Definition: owners.h:54
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:44
ripple::test::jtx::owner_count::owner_count
owner_count(Account const &account, std::uint32_t value)
Definition: owners.h:57
ripple::test::jtx::Account::id
AccountID id() const
Returns the Account ID.
Definition: Account.h:97
cstdint
std::uint32_t
ripple::test::jtx::owner_count::account_
Account account_
Definition: owners.h:53
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::LedgerEntryType
LedgerEntryType
Ledger entry types.
Definition: LedgerFormats.h:36
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:56
ripple::test::jtx::owners::value_
std::uint32_t value_
Definition: owners.h:77
ripple::test::jtx::owners::owners
owners(Account const &account, std::uint32_t value)
Definition: owners.h:79
ripple::test::jtx::Env
A transaction testing environment.
Definition: Env.h:117
ripple::test::jtx::owner_count
Definition: owners.h:50