Class: Pocolog::Format::V2::IndexStreamInfo

Inherits:
Struct
  • Object
show all
Defined in:
lib/pocolog/format/v2.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#base_timeObject

Returns the value of attribute base_time

Returns:

  • (Object)

    the current value of base_time



229
230
231
# File 'lib/pocolog/format/v2.rb', line 229

def base_time
  @base_time
end

#declaration_posObject

Returns the value of attribute declaration_pos

Returns:

  • (Object)

    the current value of declaration_pos



229
230
231
# File 'lib/pocolog/format/v2.rb', line 229

def declaration_pos
  @declaration_pos
end

#index_posObject

Returns the value of attribute index_pos

Returns:

  • (Object)

    the current value of index_pos



229
230
231
# File 'lib/pocolog/format/v2.rb', line 229

def index_pos
  @index_pos
end

#lg_maxObject

Returns the value of attribute lg_max

Returns:

  • (Object)

    the current value of lg_max



229
230
231
# File 'lib/pocolog/format/v2.rb', line 229

def lg_max
  @lg_max
end

#lg_minObject

Returns the value of attribute lg_min

Returns:

  • (Object)

    the current value of lg_min



229
230
231
# File 'lib/pocolog/format/v2.rb', line 229

def lg_min
  @lg_min
end

#rt_maxObject

Returns the value of attribute rt_max

Returns:

  • (Object)

    the current value of rt_max



229
230
231
# File 'lib/pocolog/format/v2.rb', line 229

def rt_max
  @rt_max
end

#rt_minObject

Returns the value of attribute rt_min

Returns:

  • (Object)

    the current value of rt_min



229
230
231
# File 'lib/pocolog/format/v2.rb', line 229

def rt_min
  @rt_min
end

#stream_sizeObject

Returns the value of attribute stream_size

Returns:

  • (Object)

    the current value of stream_size



229
230
231
# File 'lib/pocolog/format/v2.rb', line 229

def stream_size
  @stream_size
end

Class Method Details

.unmarshal(data) ⇒ Object

rubocop:disable Metrics/AbcSize



257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
# File 'lib/pocolog/format/v2.rb', line 257

def self.unmarshal(data) # rubocop:disable Metrics/AbcSize
    declaration_pos, index_pos, base_time, stream_size,
        interval_rt_min, interval_rt_max,
        interval_lg_min, interval_lg_max =
        data.unpack("Q>*")

    if stream_size == 0
        base_time = nil
        interval_rt = []
        interval_lg = []
    else
        interval_rt = [interval_rt_min, interval_rt_max]
        interval_lg = [interval_lg_min, interval_lg_max]
    end

    IndexStreamInfo.new(
        declaration_pos: declaration_pos,
        index_pos: index_pos,
        base_time: base_time,
        stream_size: stream_size,
        rt_min: interval_rt[0],
        rt_max: interval_rt[1],
        lg_min: interval_lg[0],
        lg_max: interval_lg[1]
    )
end

Instance Method Details

#interval_lgObject



245
246
247
248
249
250
251
# File 'lib/pocolog/format/v2.rb', line 245

def interval_lg
    if lg_min != lg_max || lg_min
        [lg_min, lg_max]
    else
        []
    end
end

#interval_rtObject



237
238
239
240
241
242
243
# File 'lib/pocolog/format/v2.rb', line 237

def interval_rt
    if rt_min != rt_max || rt_min
        [rt_min, rt_max]
    else
        []
    end
end

#marshalObject



253
254
255
# File 'lib/pocolog/format/v2.rb', line 253

def marshal
    to_a.pack("Q>*")
end