@@ -124,7 +124,7 @@ template<typename Stream> inline uint64_t ser_readdata64(Stream &s)
124
124
// i.e. anything that supports .read(Span<std::byte>) and .write(Span<const std::byte>)
125
125
//
126
126
127
- class CSizeComputer ;
127
+ class SizeComputer ;
128
128
129
129
enum
130
130
{
@@ -324,7 +324,7 @@ constexpr inline unsigned int GetSizeOfCompactSize(uint64_t nSize)
324
324
else return sizeof (unsigned char ) + sizeof (uint64_t );
325
325
}
326
326
327
- inline void WriteCompactSize (CSizeComputer & os, uint64_t nSize);
327
+ inline void WriteCompactSize (SizeComputer & os, uint64_t nSize);
328
328
329
329
template <typename Stream>
330
330
void WriteCompactSize (Stream& os, uint64_t nSize)
@@ -450,7 +450,7 @@ inline unsigned int GetSizeOfVarInt(I n)
450
450
}
451
451
452
452
template <typename I>
453
- inline void WriteVarInt (CSizeComputer & os, I n);
453
+ inline void WriteVarInt (SizeComputer & os, I n);
454
454
455
455
template <typename Stream, VarIntMode Mode, typename I>
456
456
void WriteVarInt (Stream& os, I n)
@@ -1070,22 +1070,21 @@ struct ActionUnserialize {
1070
1070
/* ::GetSerializeSize implementations
1071
1071
*
1072
1072
* Computing the serialized size of objects is done through a special stream
1073
- * object of type CSizeComputer , which only records the number of bytes written
1073
+ * object of type SizeComputer , which only records the number of bytes written
1074
1074
* to it.
1075
1075
*
1076
1076
* If your Serialize or SerializationOp method has non-trivial overhead for
1077
1077
* serialization, it may be worthwhile to implement a specialized version for
1078
- * CSizeComputer , which uses the s.seek() method to record bytes that would
1078
+ * SizeComputer , which uses the s.seek() method to record bytes that would
1079
1079
* be written instead.
1080
1080
*/
1081
- class CSizeComputer
1081
+ class SizeComputer
1082
1082
{
1083
1083
protected:
1084
1084
size_t nSize{0 };
1085
1085
1086
- const int nVersion;
1087
1086
public:
1088
- explicit CSizeComputer ( int nVersionIn) : nVersion(nVersionIn ) {}
1087
+ SizeComputer ( ) {}
1089
1088
1090
1089
void write (Span<const std::byte> src)
1091
1090
{
@@ -1099,7 +1098,7 @@ class CSizeComputer
1099
1098
}
1100
1099
1101
1100
template <typename T>
1102
- CSizeComputer & operator <<(const T& obj)
1101
+ SizeComputer & operator <<(const T& obj)
1103
1102
{
1104
1103
::Serialize (*this , obj);
1105
1104
return (*this );
@@ -1108,31 +1107,29 @@ class CSizeComputer
1108
1107
size_t size () const {
1109
1108
return nSize;
1110
1109
}
1111
-
1112
- int GetVersion () const { return nVersion; }
1113
1110
};
1114
1111
1115
1112
template <typename I>
1116
- inline void WriteVarInt (CSizeComputer &s, I n)
1113
+ inline void WriteVarInt (SizeComputer &s, I n)
1117
1114
{
1118
1115
s.seek (GetSizeOfVarInt<I>(n));
1119
1116
}
1120
1117
1121
- inline void WriteCompactSize (CSizeComputer &s, uint64_t nSize)
1118
+ inline void WriteCompactSize (SizeComputer &s, uint64_t nSize)
1122
1119
{
1123
1120
s.seek (GetSizeOfCompactSize (nSize));
1124
1121
}
1125
1122
1126
1123
template <typename T>
1127
1124
size_t GetSerializeSize (const T& t, int nVersion = 0 )
1128
1125
{
1129
- return (CSizeComputer (nVersion ) << t).size ();
1126
+ return (SizeComputer ( ) << t).size ();
1130
1127
}
1131
1128
1132
1129
template <typename ... T>
1133
1130
size_t GetSerializeSizeMany (int nVersion, const T&... t)
1134
1131
{
1135
- CSizeComputer sc (nVersion) ;
1132
+ SizeComputer sc;
1136
1133
SerializeMany (sc, t...);
1137
1134
return sc.size ();
1138
1135
}
0 commit comments