Class: Roscpp::GetLoggersResponse

Inherits:
ROS::Message
  • Object
show all
Defined in:
lib/roscpp/GetLoggers.rb

Constant Summary collapse

@@struct_L =
::ROS::Struct.new("L")
@@slot_types =
['roscpp/Logger[]']

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ GetLoggersResponse

Constructor. You can set the default values using keyword operators.

Parameters:

  • args (Hash) (defaults to: {})

    keyword for initializing values

Options Hash (args):

  • :loggers (roscpp/Logger[])

    initialize value



106
107
108
109
110
111
112
113
# File 'lib/roscpp/GetLoggers.rb', line 106

def initialize(args={})
  # message fields cannot be None, assign default values for those that are
  if args[:loggers]
    @loggers = args[:loggers]
  else
    @loggers = []
  end
end

Instance Attribute Details

#loggersObject

Returns the value of attribute loggers.



96
97
98
# File 'lib/roscpp/GetLoggers.rb', line 96

def loggers
  @loggers
end

Class Method Details

.md5sumObject



74
75
76
# File 'lib/roscpp/GetLoggers.rb', line 74

def self.md5sum
  "32e97e85527d4678a8f9279894bb64b0"
end

.typeObject



78
79
80
# File 'lib/roscpp/GetLoggers.rb', line 78

def self.type
  "roscpp/GetLoggersResponse"
end

Instance Method Details

#_get_typesString

internal API method

Returns:

  • (String)

    Message type string.



117
118
119
# File 'lib/roscpp/GetLoggers.rb', line 117

def _get_types
  @slot_types
end

#deserialize(str) ⇒ Object

unpack serialized message in str into this message instance

@param [String] str: byte array of serialized message


143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/roscpp/GetLoggers.rb', line 143

def deserialize(str)

  begin
    end_point = 0
    start = end_point
    end_point += 4
    (length,) = @@struct_L.unpack(str[start..(end_point-1)])
    @loggers = []
    length.times do
      val1 = Roscpp::Logger.new
      start = end_point
      end_point += 4
      (length,) = @@struct_L.unpack(str[start..(end_point-1)])
      start = end_point
      end_point += length
      val1.name = str[start..(end_point-1)]
      start = end_point
      end_point += 4
      (length,) = @@struct_L.unpack(str[start..(end_point-1)])
      start = end_point
      end_point += length
      val1.level = str[start..(end_point-1)]
      @loggers.push(val1)
    end
    return self
  rescue => exception
    raise "message DeserializationError: #{exception}" #most likely buffer underfill
  end
end

#has_header?Boolean

Returns:

  • (Boolean)


82
83
84
# File 'lib/roscpp/GetLoggers.rb', line 82

def has_header?
  false
end

#message_definitionObject



86
87
88
89
90
91
92
93
94
95
# File 'lib/roscpp/GetLoggers.rb', line 86

def message_definition
  "Logger[] loggers

================================================================================
MSG: roscpp/Logger
string name
string level

"
end

#serialize(buff) ⇒ Object

serialize message into buffer

Parameters:

  • buff (IO)

    buffer



123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/roscpp/GetLoggers.rb', line 123

def serialize(buff)
  begin
    length = @loggers.length
    buff.write(@@struct_L.pack(length))
    for val1 in @loggers
      _x = val1.name
      length = _x.length
      buff.write([length, _x].pack("La#{length}"))
      _x = val1.level
      length = _x.length
      buff.write([length, _x].pack("La#{length}"))
    end
  rescue => exception
    raise "some erro in serialize: #{exception}"

  end
end