rippled
DecodedBlob.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_NODESTORE_DECODEDBLOB_H_INCLUDED
21 #define RIPPLE_NODESTORE_DECODEDBLOB_H_INCLUDED
22 
23 #include <ripple/nodestore/NodeObject.h>
24 
25 namespace ripple {
26 namespace NodeStore {
27 
39 {
40 public:
42  DecodedBlob(void const* key, void const* value, int valueBytes);
43 
45  bool
46  wasOk() const noexcept
47  {
48  return m_success;
49  }
50 
53  createObject();
54 
55 private:
56  bool m_success;
57 
58  void const* m_key;
60  unsigned char const* m_objectData;
62 };
63 
64 } // namespace NodeStore
65 } // namespace ripple
66 
67 #endif
ripple::NodeStore::DecodedBlob::wasOk
bool wasOk() const noexcept
Determine if the decoding was successful.
Definition: DecodedBlob.h:46
ripple::NodeStore::DecodedBlob
Parsed key/value blob into NodeObject components.
Definition: DecodedBlob.h:38
std::shared_ptr< NodeObject >
ripple::NodeStore::DecodedBlob::m_key
void const * m_key
Definition: DecodedBlob.h:58
ripple::NodeStore::DecodedBlob::m_success
bool m_success
Definition: DecodedBlob.h:56
ripple::NodeObjectType
NodeObjectType
The types of node objects.
Definition: NodeObject.h:32
ripple::NodeStore::DecodedBlob::m_objectData
unsigned char const * m_objectData
Definition: DecodedBlob.h:60
ripple::NodeStore::DecodedBlob::createObject
std::shared_ptr< NodeObject > createObject()
Create a NodeObject from this data.
Definition: DecodedBlob.cpp:73
ripple::NodeStore::DecodedBlob::m_dataBytes
int m_dataBytes
Definition: DecodedBlob.h:61
ripple::NodeStore::DecodedBlob::m_objectType
NodeObjectType m_objectType
Definition: DecodedBlob.h:59
ripple::NodeStore::DecodedBlob::DecodedBlob
DecodedBlob(void const *key, void const *value, int valueBytes)
Construct the decoded blob from raw data.
Definition: DecodedBlob.cpp:28
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29