_NVPerfCounter.py
Go to the documentation of this file.
00001 """autogenerated by genpy from rve_msgs/NVPerfCounter.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006 
00007 
00008 class NVPerfCounter(genpy.Message):
00009   _md5sum = "3d667dbed14291a3e9dc320a09c15f64"
00010   _type = "rve_msgs/NVPerfCounter"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """string name
00013 uint64 value
00014 uint64 cycles
00015 float64 value_as_pct
00016 """
00017   __slots__ = ['name','value','cycles','value_as_pct']
00018   _slot_types = ['string','uint64','uint64','float64']
00019 
00020   def __init__(self, *args, **kwds):
00021     """
00022     Constructor. Any message fields that are implicitly/explicitly
00023     set to None will be assigned a default value. The recommend
00024     use is keyword arguments as this is more robust to future message
00025     changes.  You cannot mix in-order arguments and keyword arguments.
00026 
00027     The available fields are:
00028        name,value,cycles,value_as_pct
00029 
00030     :param args: complete set of field values, in .msg order
00031     :param kwds: use keyword arguments corresponding to message field names
00032     to set specific fields.
00033     """
00034     if args or kwds:
00035       super(NVPerfCounter, self).__init__(*args, **kwds)
00036       #message fields cannot be None, assign default values for those that are
00037       if self.name is None:
00038         self.name = ''
00039       if self.value is None:
00040         self.value = 0
00041       if self.cycles is None:
00042         self.cycles = 0
00043       if self.value_as_pct is None:
00044         self.value_as_pct = 0.
00045     else:
00046       self.name = ''
00047       self.value = 0
00048       self.cycles = 0
00049       self.value_as_pct = 0.
00050 
00051   def _get_types(self):
00052     """
00053     internal API method
00054     """
00055     return self._slot_types
00056 
00057   def serialize(self, buff):
00058     """
00059     serialize message into buffer
00060     :param buff: buffer, ``StringIO``
00061     """
00062     try:
00063       _x = self.name
00064       length = len(_x)
00065       if python3 or type(_x) == unicode:
00066         _x = _x.encode('utf-8')
00067         length = len(_x)
00068       buff.write(struct.pack('<I%ss'%length, length, _x))
00069       _x = self
00070       buff.write(_struct_2Qd.pack(_x.value, _x.cycles, _x.value_as_pct))
00071     except struct.error as se: self._check_types(se)
00072     except TypeError as te: self._check_types(te)
00073 
00074   def deserialize(self, str):
00075     """
00076     unpack serialized message in str into this message instance
00077     :param str: byte array of serialized message, ``str``
00078     """
00079     try:
00080       end = 0
00081       start = end
00082       end += 4
00083       (length,) = _struct_I.unpack(str[start:end])
00084       start = end
00085       end += length
00086       if python3:
00087         self.name = str[start:end].decode('utf-8')
00088       else:
00089         self.name = str[start:end]
00090       _x = self
00091       start = end
00092       end += 24
00093       (_x.value, _x.cycles, _x.value_as_pct,) = _struct_2Qd.unpack(str[start:end])
00094       return self
00095     except struct.error as e:
00096       raise genpy.DeserializationError(e) #most likely buffer underfill
00097 
00098 
00099   def serialize_numpy(self, buff, numpy):
00100     """
00101     serialize message with numpy array types into buffer
00102     :param buff: buffer, ``StringIO``
00103     :param numpy: numpy python module
00104     """
00105     try:
00106       _x = self.name
00107       length = len(_x)
00108       if python3 or type(_x) == unicode:
00109         _x = _x.encode('utf-8')
00110         length = len(_x)
00111       buff.write(struct.pack('<I%ss'%length, length, _x))
00112       _x = self
00113       buff.write(_struct_2Qd.pack(_x.value, _x.cycles, _x.value_as_pct))
00114     except struct.error as se: self._check_types(se)
00115     except TypeError as te: self._check_types(te)
00116 
00117   def deserialize_numpy(self, str, numpy):
00118     """
00119     unpack serialized message in str into this message instance using numpy for array types
00120     :param str: byte array of serialized message, ``str``
00121     :param numpy: numpy python module
00122     """
00123     try:
00124       end = 0
00125       start = end
00126       end += 4
00127       (length,) = _struct_I.unpack(str[start:end])
00128       start = end
00129       end += length
00130       if python3:
00131         self.name = str[start:end].decode('utf-8')
00132       else:
00133         self.name = str[start:end]
00134       _x = self
00135       start = end
00136       end += 24
00137       (_x.value, _x.cycles, _x.value_as_pct,) = _struct_2Qd.unpack(str[start:end])
00138       return self
00139     except struct.error as e:
00140       raise genpy.DeserializationError(e) #most likely buffer underfill
00141 
00142 _struct_I = genpy.struct_I
00143 _struct_2Qd = struct.Struct("<2Qd")


rve_msgs
Author(s): Josh Faust
autogenerated on Wed Dec 11 2013 14:30:38