Raven Core  3.0.0
P2P Digital Currency
timestampindex.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2015 The Bitcoin Core developers
3 // Distributed under the MIT software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 
6 #ifndef RAVEN_TIMESTAMPINDEX_H
7 #define RAVEN_TIMESTAMPINDEX_H
8 
9 #include "uint256.h"
10 
12  unsigned int timestamp;
13 
14  size_t GetSerializeSize() const {
15  return 4;
16  }
17  template<typename Stream>
18  void Serialize(Stream& s) const {
19  ser_writedata32be(s, timestamp);
20  }
21  template<typename Stream>
22  void Unserialize(Stream& s) {
23  timestamp = ser_readdata32be(s);
24  }
25 
26  CTimestampIndexIteratorKey(unsigned int time) {
27  timestamp = time;
28  }
29 
31  SetNull();
32  }
33 
34  void SetNull() {
35  timestamp = 0;
36  }
37 };
38 
40  unsigned int timestamp;
42 
43  size_t GetSerializeSize() const {
44  return 36;
45  }
46  template<typename Stream>
47  void Serialize(Stream& s) const {
48  ser_writedata32be(s, timestamp);
49  blockHash.Serialize(s);
50  }
51  template<typename Stream>
52  void Unserialize(Stream& s) {
53  timestamp = ser_readdata32be(s);
54  blockHash.Unserialize(s);
55  }
56 
57  CTimestampIndexKey(unsigned int time, uint256 hash) {
58  timestamp = time;
59  blockHash = hash;
60  }
61 
63  SetNull();
64  }
65 
66  void SetNull() {
67  timestamp = 0;
68  blockHash.SetNull();
69  }
70 };
71 
74 
75  size_t GetSerializeSize() const {
76  return 32;
77  }
78 
79  template<typename Stream>
80  void Serialize(Stream& s) const {
81  blockHash.Serialize(s);
82  }
83 
84  template<typename Stream>
85  void Unserialize(Stream& s) {
86  blockHash.Unserialize(s);
87  }
88 
90  blockHash = hash;
91  }
92 
94  SetNull();
95  }
96 
97  void SetNull() {
98  blockHash.SetNull();
99  }
100 };
101 
103  unsigned int ltimestamp;
104  size_t GetSerializeSize() const {
105  return 4;
106  }
107 
108  template<typename Stream>
109  void Serialize(Stream& s) const {
110  ser_writedata32be(s, ltimestamp);
111  }
112 
113  template<typename Stream>
114  void Unserialize(Stream& s) {
115  ltimestamp = ser_readdata32be(s);
116  }
117 
118  CTimestampBlockIndexValue (unsigned int time) {
119  ltimestamp = time;
120  }
121 
123  SetNull();
124  }
125 
126  void SetNull() {
127  ltimestamp = 0;
128  }
129 };
130 
131 #endif // RAVEN_TIMESTAMPINDEX_H
void Serialize(Stream &s) const
void Unserialize(Stream &s)
void Unserialize(Stream &s)
void SetNull()
Definition: uint256.h:41
CTimestampIndexKey(unsigned int time, uint256 hash)
size_t GetSerializeSize() const
void Unserialize(Stream &s)
CTimestampBlockIndexValue(unsigned int time)
size_t GetSerializeSize() const
size_t GetSerializeSize() const
void Serialize(Stream &s) const
Definition: uint256.h:96
unsigned int timestamp
CTimestampBlockIndexKey(uint256 hash)
void Unserialize(Stream &s)
Definition: uint256.h:102
CTimestampIndexIteratorKey(unsigned int time)
void Serialize(Stream &s) const
void ser_writedata32be(Stream &s, uint32_t obj)
Definition: serialize.h:81
void Serialize(Stream &s) const
void Serialize(Stream &s) const
256-bit opaque blob.
Definition: uint256.h:123
void Unserialize(Stream &s)
uint32_t ser_readdata32be(Stream &s)
Definition: serialize.h:109
size_t GetSerializeSize() const