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/SField.h>
22#include <xrpl/protocol/SOTemplate.h>
23#include <xrpl/protocol/jss.h>
24
25#include <initializer_list>
26
27namespace ripple {
28
30{
31 // Fields shared by all ledger formats:
32 static std::initializer_list<SOElement> const commonFields{
33 {sfLedgerIndex, soeOPTIONAL},
34 {sfLedgerEntryType, soeREQUIRED},
35 {sfFlags, soeREQUIRED},
36 };
37
38#pragma push_macro("UNWRAP")
39#undef UNWRAP
40#pragma push_macro("LEDGER_ENTRY")
41#undef LEDGER_ENTRY
42
43#define UNWRAP(...) __VA_ARGS__
44#define LEDGER_ENTRY(tag, value, name, rpcName, fields) \
45 add(jss::name, tag, UNWRAP fields, commonFields);
46
47#include <xrpl/protocol/detail/ledger_entries.macro>
48
49#undef LEDGER_ENTRY
50#pragma pop_macro("LEDGER_ENTRY")
51#undef UNWRAP
52#pragma pop_macro("UNWRAP")
53}
54
55LedgerFormats const&
57{
58 static LedgerFormats instance;
59 return instance;
60}
61
62} // 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:25
@ soeOPTIONAL
Definition SOTemplate.h:36
@ soeREQUIRED
Definition SOTemplate.h:35