|
|
|
@ -443,6 +443,7 @@ struct hb_serialize_context_t |
|
|
|
|
this->debug_depth = 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* To be called around main operation. */ |
|
|
|
|
template <typename Type> |
|
|
|
|
inline Type *start_serialize (void) |
|
|
|
|
{ |
|
|
|
@ -453,7 +454,6 @@ struct hb_serialize_context_t |
|
|
|
|
|
|
|
|
|
return start_embed<Type> (); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
inline void end_serialize (void) |
|
|
|
|
{ |
|
|
|
|
DEBUG_MSG_LEVEL (SERIALIZE, this->start, 0, -1, |
|
|
|
@ -463,6 +463,22 @@ struct hb_serialize_context_t |
|
|
|
|
this->ran_out_of_room ? "RAN OUT OF ROOM" : "did not ran out of room"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
inline unsigned int length (void) const { return this->head - this->start; } |
|
|
|
|
|
|
|
|
|
inline void align (unsigned int alignment) |
|
|
|
|
{ |
|
|
|
|
unsigned int l = length () % alignment; |
|
|
|
|
if (l) |
|
|
|
|
allocate_size<void> (alignment - l); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename Type> |
|
|
|
|
inline Type *start_embed (void) |
|
|
|
|
{ |
|
|
|
|
Type *ret = reinterpret_cast<Type *> (this->head); |
|
|
|
|
return ret; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename Type> |
|
|
|
|
inline Type *allocate_size (unsigned int size) |
|
|
|
|
{ |
|
|
|
@ -482,13 +498,6 @@ struct hb_serialize_context_t |
|
|
|
|
return this->allocate_size<Type> (Type::min_size); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename Type> |
|
|
|
|
inline Type *start_embed (void) |
|
|
|
|
{ |
|
|
|
|
Type *ret = reinterpret_cast<Type *> (this->head); |
|
|
|
|
return ret; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename Type> |
|
|
|
|
inline Type *embed (const Type &obj) |
|
|
|
|
{ |
|
|
|
|