rippled
Loading...
Searching...
No Matches
NodeObject.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 <xrpld/nodestore/NodeObject.h>
21
22#include <memory>
23
24namespace ripple {
25
26//------------------------------------------------------------------------------
27
29 NodeObjectType type,
30 Blob&& data,
31 uint256 const& hash,
33 : mType(type), mHash(hash), mData(std::move(data))
34{
35}
36
39{
40 return std::make_shared<NodeObject>(
41 type, std::move(data), hash, PrivateAccess());
42}
43
46{
47 return mType;
48}
49
50uint256 const&
52{
53 return mHash;
54}
55
56Blob const&
58{
59 return mData;
60}
61
62} // namespace ripple
uint256 const & getHash() const
Returns the hash of the data.
Definition: NodeObject.cpp:51
Blob const mData
Definition: NodeObject.h:100
NodeObjectType const mType
Definition: NodeObject.h:98
uint256 const mHash
Definition: NodeObject.h:99
static std::shared_ptr< NodeObject > createObject(NodeObjectType type, Blob &&data, uint256 const &hash)
Create an object from fields.
Definition: NodeObject.cpp:38
NodeObject(NodeObjectType type, Blob &&data, uint256 const &hash, PrivateAccess)
Definition: NodeObject.cpp:28
Blob const & getData() const
Returns the underlying data.
Definition: NodeObject.cpp:57
NodeObjectType getType() const
Returns the type of this object.
Definition: NodeObject.cpp:45
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: algorithm.h:26
NodeObjectType
The types of node objects.
Definition: NodeObject.h:32
STL namespace.