rippled
Loading...
Searching...
No Matches
LedgerFormats.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 <xrpl/protocol/LedgerFormats.h>
21#include <xrpl/protocol/jss.h>
22#include <utility>
23
24namespace ripple {
25
27{
28 // Fields shared by all ledger formats:
29 static const std::initializer_list<SOElement> commonFields{
30 {sfLedgerIndex, soeOPTIONAL},
31 {sfLedgerEntryType, soeREQUIRED},
32 {sfFlags, soeREQUIRED},
33 };
34
35#pragma push_macro("UNWRAP")
36#undef UNWRAP
37#pragma push_macro("LEDGER_ENTRY")
38#undef LEDGER_ENTRY
39
40#define UNWRAP(...) __VA_ARGS__
41#define LEDGER_ENTRY(tag, value, name, rpcName, fields) \
42 add(jss::name, tag, UNWRAP fields, commonFields);
43
44#include <xrpl/protocol/detail/ledger_entries.macro>
45
46#undef LEDGER_ENTRY
47#pragma pop_macro("LEDGER_ENTRY")
48#undef UNWRAP
49#pragma pop_macro("UNWRAP")
50}
51
52LedgerFormats const&
54{
55 static LedgerFormats instance;
56 return instance;
57}
58
59} // namespace ripple
Holds the list of known ledger entry formats.
LedgerFormats()
Create the object.
static LedgerFormats const & getInstance()
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: algorithm.h:26
@ soeOPTIONAL
Definition: SOTemplate.h:36
@ soeREQUIRED
Definition: SOTemplate.h:35