Serialization code improvements:

* Add generics to eliminate duplicate code in STHash
* Use generics in Serializer and callers
This commit is contained in:
Tom Ritchford
2014-07-07 20:40:50 -04:00
committed by Vinnie Falco
parent 9fb09d3109
commit 418638ad16
12 changed files with 510 additions and 708 deletions

View File

@@ -236,7 +236,8 @@ public:
if (rf->getSType () == STI_NOTPRESENT)
rf = makeFieldPresent (field);
if (auto cf = dynamic_cast<STHash160*> (rf))
using Bits = STBitString<160>;
if (auto cf = dynamic_cast<Bits*> (rf))
cf->setValue (v);
else
throw std::runtime_error ("Wrong field type");