@@ -61,10 +61,11 @@ enum Types {
6161 CT_LIST = 0x09 ,
6262 CT_SET = 0x0A ,
6363 CT_MAP = 0x0B ,
64- CT_STRUCT = 0x0C
64+ CT_STRUCT = 0x0C ,
65+ CT_UUID = 0x0D
6566};
6667
67- const int8_t TTypeToCType[16 ] = {
68+ const int8_t TTypeToCType[17 ] = {
6869 CT_STOP, // T_STOP
6970 0 , // unused
7071 CT_BOOLEAN_TRUE, // T_BOOL
@@ -81,6 +82,7 @@ const int8_t TTypeToCType[16] = {
8182 CT_MAP, // T_MAP
8283 CT_SET, // T_SET
8384 CT_LIST, // T_LIST
85+ CT_UUID, // T_UUID
8486};
8587
8688}} // end detail::compact namespace
@@ -286,6 +288,15 @@ uint32_t TCompactProtocolT<Transport_>::writeBinary(const std::string& str) {
286288 return wsize;
287289}
288290
291+ /* *
292+ * Write a TUuid to the wire
293+ */
294+ template <class Transport_ >
295+ uint32_t TCompactProtocolT<Transport_>::writeUUID(const TUuid& uuid) {
296+ trans_->write (uuid.data (), uuid.size ());
297+ return uuid.size ();
298+ }
299+
289300//
290301// Internal Writing methods
291302//
@@ -719,6 +730,15 @@ uint32_t TCompactProtocolT<Transport_>::readBinary(std::string& str) {
719730 return rsize + static_cast <uint32_t >(size);
720731}
721732
733+
734+ /* *
735+ * Read a TUuid from the wire.
736+ */
737+ template <class Transport_ >
738+ uint32_t TCompactProtocolT<Transport_>::readUUID(TUuid& uuid) {
739+ return trans_->readAll (uuid.begin (), uuid.size ());
740+ }
741+
722742/* *
723743 * Read an i32 from the wire as a varint. The MSB of each byte is set
724744 * if there is another byte to follow. This can read up to 5 bytes.
@@ -826,6 +846,8 @@ TType TCompactProtocolT<Transport_>::getTType(int8_t type) {
826846 return T_MAP;
827847 case detail::compact::CT_STRUCT:
828848 return T_STRUCT;
849+ case detail::compact::CT_UUID:
850+ return T_UUID;
829851 default :
830852 throw TException (std::string (" don't know what type: " ) + static_cast <char >(type));
831853 }
@@ -850,6 +872,7 @@ int TCompactProtocolT<Transport_>::getMinSerializedSize(TType type)
850872 case T_MAP: return sizeof (int8_t ); // element count
851873 case T_SET: return sizeof (int8_t ); // element count
852874 case T_LIST: return sizeof (int8_t ); // element count
875+ case T_UUID: return 16 ; // 16 bytes
853876 default : throw TProtocolException (TProtocolException::UNKNOWN, " unrecognized type code" );
854877 }
855878}
0 commit comments