Clio
develop
The XRP Ledger API server.
Theme:
Default
Round
Robot
Loading...
Searching...
No Matches
OutputFile.hpp
1
#pragma once
2
3
#include "util/Shasum.hpp"
4
5
#include <xrpl/basics/base_uint.h>
6
7
#include <cstddef>
8
#include <cstring>
9
#include <expected>
10
#include <fstream>
11
#include <string>
12
13
namespace
data::impl {
14
15
class
OutputFile {
16
std::ofstream file_;
17
util::Sha256sum
shasum_;
18
19
public
:
20
OutputFile(std::string
const
& path);
21
22
bool
23
isOpen()
const
;
24
25
template
<
typename
T>
26
void
27
write(T&&
data
)
28
{
29
writeRaw(
reinterpret_cast<
char
const*
>
(&
data
),
sizeof
(T));
30
}
31
32
template
<
typename
T>
33
void
34
write(T
const
*
data
,
size_t
const
size)
35
{
36
writeRaw(
reinterpret_cast<
char
const*
>
(
data
), size);
37
}
38
39
void
40
writeRaw(
char
const
*
data
,
size_t
size);
41
42
ripple::uint256
43
hash()
const
;
44
45
std::expected<void, std::string>
46
close();
47
48
private
:
49
void
50
writeToFile(
char
const
*
data
,
size_t
size);
51
};
52
53
}
// namespace data::impl
util::Sha256sum
Streaming SHA-256 hasher for large data sets.
Definition
Shasum.hpp:35
data
This namespace implements the data access layer and related components.
Definition
AmendmentCenter.cpp:56
src
data
impl
OutputFile.hpp
Generated by
1.16.1