helpers.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:core-framework 作者: RedhawkSDR 项目源码 文件源码
def setType(props, prop_id, _type, typeCheck=True):
    '''
       change the property type for the element in the props sequence with id of prop_id
       This method returns a copy of props (does not modify the props input)
    '''
    if typeCheck:
        __typeCheck(props)
    if not properties.getTypeMap().has_key(_type):
        raise BadValue('Type "'+_type+'" does not exist')
    if _type == getType(props, prop_id, False):
        return props
    prop_idx = __getPropIdx(props, prop_id)
    ret_props = copy.deepcopy(props)
    if props[prop_idx].value._t._k == CORBA.tk_sequence:
        ret_props[prop_idx].value._t._d = (props[prop_idx].value._t._d[0], tvCode(_type), props[prop_idx].value._t._d[2])
    else:
        ret_props[prop_idx].value = properties.to_tc_value(props[prop_idx].value,_type)
    return ret_props
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号