rippled
Loading...
Searching...
No Matches
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
25#include <xrpld/ledger/View.h>
26
27#include <xrpl/protocol/LedgerFormats.h>
28#include <xrpl/protocol/UintTypes.h>
29
30#include <cstdint>
31
32namespace ripple {
33namespace test {
34namespace jtx {
35
36namespace detail {
37
39owned_count_of(ReadView const& view, AccountID const& id, LedgerEntryType type);
40
41void
43 Env& env,
44 AccountID const& id,
45 LedgerEntryType type,
46 std::uint32_t value);
47
48} // namespace detail
49
50// Helper for aliases
51template <LedgerEntryType Type>
53{
54private:
57
58public:
59 owner_count(Account const& account, std::uint32_t value)
60 : account_(account), value_(value)
61 {
62 }
63
64 void
65 operator()(Env& env) const
66 {
68 }
69};
70
72class owners
73{
74private:
77
78public:
79 owners(Account const& account, std::uint32_t value)
80 : account_(account), value_(value)
81 {
82 }
83
84 void
85 operator()(Env& env) const;
86};
87
90
93
94} // namespace jtx
95} // namespace test
96} // namespace ripple
97
98#endif
Immutable cryptographic account descriptor.
Definition: Account.h:39
AccountID id() const
Returns the Account ID.
Definition: Account.h:107
A transaction testing environment.
Definition: Env.h:121
void operator()(Env &env) const
Definition: owners.h:65
owner_count(Account const &account, std::uint32_t value)
Definition: owners.h:59
Match the number of items in the account's owner directory.
Definition: owners.h:73
owners(Account const &account, std::uint32_t value)
Definition: owners.h:79
std::uint32_t value_
Definition: owners.h:76
void operator()(Env &env) const
Definition: owners.cpp:53
std::uint32_t owned_count_of(ReadView const &view, AccountID const &id, LedgerEntryType type)
Definition: owners.cpp:29
void owned_count_helper(Env &env, AccountID const &id, LedgerEntryType type, std::uint32_t value)
Definition: owners.cpp:41
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: algorithm.h:25
base_uint< 160, detail::AccountIDTag > AccountID
A 160-bit unsigned that uniquely identifies an account.
Definition: AccountID.h:48
LedgerEntryType
Identifiers for on-ledger objects.
Definition: LedgerFormats.h:54