import builtin_interfaces/msg/Time_.builtin_interfaces.msg.dds_
import dds
import ddsutil
import geometry_msgs/msg/Pose_.geometry_msgs.msg.dds_
import struct

class MapMetaData___TypeSupport(dds.TypeSupport):

    _typename = 'nav_msgs::msg::dds_::MapMetaData_'
    _keylist = ''
    _metadescriptor = '<MetaData version="1.0.0"><Module name="geometry_msgs"><Module name="msg"><Module name="dds_"><Struct name="Point_"><Member name="x_"><Double/></Member><Member name="y_"><Double/></Member><Member name="z_"><Double/></Member></Struct><Struct name="Quaternion_"><Member name="x_"><Double/></Member><Member name="y_"><Double/></Member><Member name="z_"><Double/></Member><Member name="w_"><Double/></Member></Struct><Struct name="Pose_"><Member name="position_"><Type name="Point_"/></Member><Member name="orientation_"><Type name="Quaternion_"/></Member></Struct></Module></Module></Module><Module name="builtin_interfaces"><Module name="msg"><Module name="dds_"><Struct name="Time_"><Member name="sec_"><Long/></Member><Member name="nanosec_"><ULong/></Member></Struct></Module></Module></Module><Module name="nav_msgs"><Module name="msg"><Module name="dds_"><Struct name="MapMetaData_"><Member name="map_load_time_"><Type name="::builtin_interfaces::msg::dds_::Time_"/></Member><Member name="resolution_"><Float/></Member><Member name="width_"><ULong/></Member><Member name="height_"><ULong/></Member><Member name="origin_"><Type name="::geometry_msgs::msg::dds_::Pose_"/></Member></Struct></Module></Module></Module></MetaData>'

    def __init__(self):
        super(MapMetaData___TypeSupport, self).__init__(self._typename,
              self._keylist,
              self._metadescriptor,
              struct.calcsize(MapMetaData_()._get_packing_fmt()))

    def _serialize(self, o):
        if not isinstance(o, MapMetaData_):
            raise TypeError('Incorrect data type')
        result = o._serialize()
        return result

    def _deserialize(self, buf):
        result = MapMetaData_()
        data = struct.unpack(result._get_packing_fmt(), buf)
        result._deserialize(list(data))
        return result

class MapMetaData_(ddsutil.TopicDataClass):

    @staticmethod
    def get_type_support():
        ''' Return type support information required for dds.Topic constructor '''
        return MapMetaData___TypeSupport()

    @property
    def map_load_time_(self):
        '''
        a DDS builtin_interfaces::msg::dds_::Time_ value
        @rtype: builtin_interfaces/msg/Time_.builtin_interfaces.msg.dds_.Time_
        '''
        return self._map_load_time__

    _map_load_time__checker = ddsutil._class_checker(builtin_interfaces/msg/Time_.builtin_interfaces.msg.dds_.Time_)
    @map_load_time_.setter
    def map_load_time_(self, value):
        self._map_load_time__checker(value)
        self._map_load_time__ = value

    @property
    def resolution_(self):
        '''
        a DDS float value
        @rtype: float
        '''
        return self._resolution__

    _resolution__checker = ddsutil._float_checker
    @resolution_.setter
    def resolution_(self, value):
        self._resolution__checker(value)
        self._resolution__ = value

    @property
    def width_(self):
        '''
        a DDS unsigned long value
        @rtype: int
        '''
        return self._width__

    _width__checker = ddsutil._ulong_checker
    @width_.setter
    def width_(self, value):
        self._width__checker(value)
        self._width__ = value

    @property
    def height_(self):
        '''
        a DDS unsigned long value
        @rtype: int
        '''
        return self._height__

    _height__checker = ddsutil._ulong_checker
    @height_.setter
    def height_(self, value):
        self._height__checker(value)
        self._height__ = value

    @property
    def origin_(self):
        '''
        a DDS geometry_msgs::msg::dds_::Pose_ value
        @rtype: geometry_msgs/msg/Pose_.geometry_msgs.msg.dds_.Pose_
        '''
        return self._origin__

    _origin__checker = ddsutil._class_checker(geometry_msgs/msg/Pose_.geometry_msgs.msg.dds_.Pose_)
    @origin_.setter
    def origin_(self, value):
        self._origin__checker(value)
        self._origin__ = value

    _member_attributes = ('map_load_time_', 'resolution_', 'width_', 'height_', 'origin_')

    def __init__(self, **kwargs):
        ''' Create a MapMetaData_ instance, optionally initializing fields by name '''
        # init attributes to default value
        self.map_load_time_ = builtin_interfaces/msg/Time_.builtin_interfaces.msg.dds_.Time_()
        self.resolution_ = 0.0
        self.width_ = 0
        self.height_ = 0
        self.origin_ = geometry_msgs/msg/Pose_.geometry_msgs.msg.dds_.Pose_()
        # set values for attributes passed in
        for key, value in kwargs.items():
            if key not in self._member_attributes:
                raise TypeError('Invalid argument name : %s' %(key))
            setattr(self, key, value)

    _packing_fmt = None

    @staticmethod
    def _get_packing_fmt():
        ''' Returns packing format of this class data '''
        if MapMetaData_._packing_fmt is not None:
            return MapMetaData_._packing_fmt
        fmt = ''
        fmt += ddsutil._align(fmt, builtin_interfaces/msg/Time_.builtin_interfaces.msg.dds_.Time_._get_packing_fmt())
        fmt += 'f'
        fmt += 'I'
        fmt += 'I'
        fmt += ddsutil._align(fmt, geometry_msgs/msg/Pose_.geometry_msgs.msg.dds_.Pose_._get_packing_fmt())

        MapMetaData_._packing_fmt = ddsutil._pad_fmt(fmt)
        return MapMetaData_._packing_fmt

    def _serialize(self):
        ''' Serialize data for writing '''
        fmt = self._get_packing_fmt()
        args = self._get_packing_args()
        result = struct.pack(fmt, *args)
        return result

    def _deserialize(self, data):
        ''' Initialize values from data returned by struct.unpack()'''
        self.map_load_time_ = builtin_interfaces/msg/Time_.builtin_interfaces.msg.dds_.Time_()._deserialize(data)
        self.resolution_ = data.pop(0)
        self.width_ = data.pop(0)
        self.height_ = data.pop(0)
        self.origin_ = geometry_msgs/msg/Pose_.geometry_msgs.msg.dds_.Pose_()._deserialize(data)
        return self;

    def _get_packing_args(self):
        ''' Return an list of data suitable for struct.pack '''
        args = []
        args.extend(self.map_load_time_._get_packing_args())
        args.append(self.resolution_)
        args.append(self.width_)
        args.append(self.height_)
        args.extend(self.origin_._get_packing_args())
        return args

