Class: Api::ResponseObserverAction

Inherits:
Object
  • Object
show all
Defined in:
lib/sc2ai/protocol/sc2api_pb.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeResponseObserverAction

required field readers



24423
24424
# File 'lib/sc2ai/protocol/sc2api_pb.rb', line 24423

def initialize()
end

Class Method Details

.decode(buff) ⇒ Object



24414
24415
24416
# File 'lib/sc2ai/protocol/sc2api_pb.rb', line 24414

def self.decode(buff)
  allocate.decode_from(buff.b, 0, buff.bytesize)
end

.encode(obj) ⇒ Object



24418
24419
24420
# File 'lib/sc2ai/protocol/sc2api_pb.rb', line 24418

def self.encode(obj)
  obj._encode("".b)
end

Instance Method Details

#_encode(buff) ⇒ Object



24575
24576
24577
# File 'lib/sc2ai/protocol/sc2api_pb.rb', line 24575

def _encode(buff)
  buff
end

#decode_from(buff, index, len) ⇒ Object



24430
24431
24432
24433
24434
24435
24436
24437
24438
24439
24440
24441
24442
24443
24444
24445
24446
24447
24448
24449
24450
24451
24452
24453
24454
24455
24456
24457
24458
24459
24460
24461
24462
24463
24464
24465
24466
24467
24468
24469
24470
24471
24472
24473
24474
24475
24476
24477
24478
24479
24480
24481
24482
24483
24484
24485
24486
24487
24488
24489
24490
24491
24492
24493
24494
24495
24496
24497
24498
24499
24500
24501
24502
24503
24504
24505
24506
24507
24508
24509
24510
24511
24512
24513
24514
24515
24516
24517
24518
24519
24520
24521
24522
24523
24524
24525
24526
24527
24528
24529
24530
24531
24532
24533
24534
24535
24536
24537
24538
24539
24540
24541
24542
24543
24544
24545
24546
24547
24548
24549
24550
24551
24552
24553
24554
24555
24556
24557
24558
24559
24560
24561
24562
24563
24564
24565
24566
24567
24568
24569
24570
24571
24572
24573
24574
# File 'lib/sc2ai/protocol/sc2api_pb.rb', line 24430

def decode_from(buff, index, len)
  return self if index >= len

  found = true
  while true
    # If we have looped around since the last found tag this one is
    # unexpected, so discard it and continue.
    if !found
      wire_type = tag & 0x7
      case wire_type
      when 0
        i = 0
        while true
          newbyte = buff.getbyte(index)
          index += 1
          break if newbyte.nil? || newbyte < 0x80
          i += 1
          break if i > 9
        end
      when 1
        index += 8
      when 2
        ## PULL_BYTES
        value =
          if (byte0 = buff.getbyte(index)) < 0x80
            index += 1
            byte0
          elsif (byte1 = buff.getbyte(index + 1)) < 0x80
            index += 2
            (byte1 << 7) | (byte0 & 0x7F)
          elsif (byte2 = buff.getbyte(index + 2)) < 0x80
            index += 3
            (byte2 << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
          elsif (byte3 = buff.getbyte(index + 3)) < 0x80
            index += 4
            (byte3 << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) |
              (byte0 & 0x7F)
          elsif (byte4 = buff.getbyte(index + 4)) < 0x80
            index += 5
            (byte4 << 28) | ((byte3 & 0x7F) << 21) |
              ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) |
              (byte0 & 0x7F)
          elsif (byte5 = buff.getbyte(index + 5)) < 0x80
            index += 6
            (byte5 << 35) | ((byte4 & 0x7F) << 28) |
              ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
              ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
          elsif (byte6 = buff.getbyte(index + 6)) < 0x80
            index += 7
            (byte6 << 42) | ((byte5 & 0x7F) << 35) |
              ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
              ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) |
              (byte0 & 0x7F)
          elsif (byte7 = buff.getbyte(index + 7)) < 0x80
            index += 8
            (byte7 << 49) | ((byte6 & 0x7F) << 42) |
              ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) |
              ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
              ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
          elsif (byte8 = buff.getbyte(index + 8)) < 0x80
            index += 9
            (byte8 << 56) | ((byte7 & 0x7F) << 49) |
              ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) |
              ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
              ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) |
              (byte0 & 0x7F)
          elsif (byte9 = buff.getbyte(index + 9)) < 0x80
            index += 10

            (byte9 << 63) | ((byte8 & 0x7F) << 56) |
              ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) |
              ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) |
              ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
              ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
          else
            raise "integer decoding error"
          end

        buff.byteslice(index, value)
        index += value

        ## END PULL_BYTES
      when 5
        index += 4
      else
        raise "unknown wire type #{wire_type}"
      end
      return self if index >= len
      ## PULL_UINT64
      tag =
        if (byte0 = buff.getbyte(index)) < 0x80
          index += 1
          byte0
        elsif (byte1 = buff.getbyte(index + 1)) < 0x80
          index += 2
          (byte1 << 7) | (byte0 & 0x7F)
        elsif (byte2 = buff.getbyte(index + 2)) < 0x80
          index += 3
          (byte2 << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
        elsif (byte3 = buff.getbyte(index + 3)) < 0x80
          index += 4
          (byte3 << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) |
            (byte0 & 0x7F)
        elsif (byte4 = buff.getbyte(index + 4)) < 0x80
          index += 5
          (byte4 << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
            ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
        elsif (byte5 = buff.getbyte(index + 5)) < 0x80
          index += 6
          (byte5 << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
            ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
        elsif (byte6 = buff.getbyte(index + 6)) < 0x80
          index += 7
          (byte6 << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) |
            ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
            ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
        elsif (byte7 = buff.getbyte(index + 7)) < 0x80
          index += 8
          (byte7 << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) |
            ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
            ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
        elsif (byte8 = buff.getbyte(index + 8)) < 0x80
          index += 9
          (byte8 << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) |
            ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) |
            ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
            ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
        elsif (byte9 = buff.getbyte(index + 9)) < 0x80
          index += 10

          (byte9 << 63) | ((byte8 & 0x7F) << 56) | ((byte7 & 0x7F) << 49) |
            ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) |
            ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
            ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
        else
          raise "integer decoding error"
        end

      ## END PULL_UINT64
    end
    found = false

    return self if index >= len
  end
end

#to_hObject



24579
24580
24581
24582
24583
# File 'lib/sc2ai/protocol/sc2api_pb.rb', line 24579

def to_h
  result = {}

  result
end

#to_proto(_options = {}) ⇒ Object



24426
24427
24428
# File 'lib/sc2ai/protocol/sc2api_pb.rb', line 24426

def to_proto(_options = {})
  self.class.encode(self)
end