Class: Thrift::CompactProtocol::CompactTypes
- Inherits:
-
Object
- Object
- Thrift::CompactProtocol::CompactTypes
- Defined in:
- lib/thrift/protocol/compact_protocol.rb
Overview
All of the on-wire type codes.
Constant Summary collapse
- BOOLEAN_TRUE =
0x01
- BOOLEAN_FALSE =
0x02
- BYTE =
0x03
- I16 =
0x04
- I32 =
0x05
- I64 =
0x06
- DOUBLE =
0x07
- BINARY =
0x08
- LIST =
0x09
- SET =
0x0A
- MAP =
0x0B
- STRUCT =
0x0C
- COMPACT_TO_TTYPE =
{ Types::STOP => Types::STOP, BOOLEAN_FALSE => Types::BOOL, BOOLEAN_TRUE => Types::BOOL, BYTE => Types::BYTE, I16 => Types::I16, I32 => Types::I32, I64 => Types::I64, DOUBLE => Types::DOUBLE, BINARY => Types::STRING, LIST => Types::LIST, SET => Types::SET, MAP => Types::MAP, STRUCT => Types::STRUCT }
- TTYPE_TO_COMPACT =
{ Types::STOP => Types::STOP, Types::BOOL => BOOLEAN_TRUE, Types::BYTE => BYTE, Types::I16 => I16, Types::I32 => I32, Types::I64 => I64, Types::DOUBLE => DOUBLE, Types::STRING => BINARY, Types::LIST => LIST, Types::SET => SET, Types::MAP => MAP, Types::STRUCT => STRUCT }
Class Method Summary collapse
Class Method Details
.get_compact_type(ttype) ⇒ Object
90 91 92 93 94 |
# File 'lib/thrift/protocol/compact_protocol.rb', line 90 def self.get_compact_type(ttype) val = TTYPE_TO_COMPACT[ttype] raise "don't know what type: #{ttype & 0x0f}" unless val val end |
.get_ttype(compact_type) ⇒ Object
84 85 86 87 88 |
# File 'lib/thrift/protocol/compact_protocol.rb', line 84 def self.get_ttype(compact_type) val = COMPACT_TO_TTYPE[compact_type & 0x0f] raise "don't know what type: #{compact_type & 0x0f}" unless val val end |
.is_bool_type?(b) ⇒ Boolean
49 50 51 |
# File 'lib/thrift/protocol/compact_protocol.rb', line 49 def self.is_bool_type?(b) (b & 0x0f) == BOOLEAN_TRUE || (b & 0x0f) == BOOLEAN_FALSE end |