@@ -124,7 +124,7 @@ template<typename Stream> inline uint64_t ser_readdata64(Stream &s)
124124// i.e. anything that supports .read(Span<std::byte>) and .write(Span<const std::byte>)
125125//
126126
127- class CSizeComputer ;
127+ class SizeComputer ;
128128
129129enum
130130{
@@ -324,7 +324,7 @@ constexpr inline unsigned int GetSizeOfCompactSize(uint64_t nSize)
324324 else return sizeof (unsigned char ) + sizeof (uint64_t );
325325}
326326
327- inline void WriteCompactSize (CSizeComputer & os, uint64_t nSize);
327+ inline void WriteCompactSize (SizeComputer & os, uint64_t nSize);
328328
329329template <typename Stream>
330330void WriteCompactSize (Stream& os, uint64_t nSize)
@@ -450,7 +450,7 @@ inline unsigned int GetSizeOfVarInt(I n)
450450}
451451
452452template <typename I>
453- inline void WriteVarInt (CSizeComputer & os, I n);
453+ inline void WriteVarInt (SizeComputer & os, I n);
454454
455455template <typename Stream, VarIntMode Mode, typename I>
456456void WriteVarInt (Stream& os, I n)
@@ -1070,22 +1070,21 @@ struct ActionUnserialize {
10701070/* ::GetSerializeSize implementations
10711071 *
10721072 * 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
10741074 * to it.
10751075 *
10761076 * If your Serialize or SerializationOp method has non-trivial overhead for
10771077 * 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
10791079 * be written instead.
10801080 */
1081- class CSizeComputer
1081+ class SizeComputer
10821082{
10831083protected:
10841084 size_t nSize{0 };
10851085
1086- const int nVersion;
10871086public:
1088- explicit CSizeComputer ( int nVersionIn) : nVersion(nVersionIn ) {}
1087+ SizeComputer ( ) {}
10891088
10901089 void write (Span<const std::byte> src)
10911090 {
@@ -1099,7 +1098,7 @@ class CSizeComputer
10991098 }
11001099
11011100 template <typename T>
1102- CSizeComputer & operator <<(const T& obj)
1101+ SizeComputer & operator <<(const T& obj)
11031102 {
11041103 ::Serialize (*this , obj);
11051104 return (*this );
@@ -1108,31 +1107,29 @@ class CSizeComputer
11081107 size_t size () const {
11091108 return nSize;
11101109 }
1111-
1112- int GetVersion () const { return nVersion; }
11131110};
11141111
11151112template <typename I>
1116- inline void WriteVarInt (CSizeComputer &s, I n)
1113+ inline void WriteVarInt (SizeComputer &s, I n)
11171114{
11181115 s.seek (GetSizeOfVarInt<I>(n));
11191116}
11201117
1121- inline void WriteCompactSize (CSizeComputer &s, uint64_t nSize)
1118+ inline void WriteCompactSize (SizeComputer &s, uint64_t nSize)
11221119{
11231120 s.seek (GetSizeOfCompactSize (nSize));
11241121}
11251122
11261123template <typename T>
11271124size_t GetSerializeSize (const T& t, int nVersion = 0 )
11281125{
1129- return (CSizeComputer (nVersion ) << t).size ();
1126+ return (SizeComputer ( ) << t).size ();
11301127}
11311128
11321129template <typename ... T>
11331130size_t GetSerializeSizeMany (int nVersion, const T&... t)
11341131{
1135- CSizeComputer sc (nVersion) ;
1132+ SizeComputer sc;
11361133 SerializeMany (sc, t...);
11371134 return sc.size ();
11381135}
0 commit comments