예제 #1
0
 def enqueue(self, mo_id, data):
     """
     :param data:
     :type data: DataCategory
     :return:
     """
     mo = self.mos.get(mo_id)
     if not mo:
         mo = MovableObject(mo_id)
         self.mos[mo_id] = mo
     if mo.update(data) == YES:
         return data
     return None
예제 #2
0
    def set(self, mo_id, data):
        """
        1.加入新的车辆标识到内存数据库用于之后的车牌名称检索

        :param mo_id: 车辆唯一标识
        :type mo_id: basestring
        :param data:
        :type data: DataEnvelope or DataCategory
        """
        mo = self.mos.get(mo_id)
        if not mo:
            mo = MovableObject(mo_id)
            self.mos[mo_id] = mo
            self.memconn.execute("insert into movable_object values(?)",
                                 (mo_id, ))
        if mo.update(data):
            self.diffs[mo.getId()] = mo  #数据更新了
            return mo
        return None